@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.
@@ -0,0 +1,484 @@
1
+ /// <reference types=".vue-global-types/vue_3.5_false.d.ts" />
2
+ import { computed, toRefs } from 'vue';
3
+ import { useI18n } from 'vue-i18n';
4
+ import { useSession } from '@data-fair/lib/vue/session.js';
5
+ import { useTheme } from 'vuetify';
6
+ import UserAvatar from './user-avatar.vue';
7
+ const { defineProps, defineSlots, defineEmits, defineExpose, defineModel, defineOptions, withDefaults, } = await import('vue');
8
+ const theme = useTheme();
9
+ const session = useSession();
10
+ const __VLS_props = defineProps({
11
+ darkModeSwitch: {
12
+ type: Boolean,
13
+ default: false
14
+ }
15
+ });
16
+ const { t } = useI18n({ useScope: 'local' });
17
+ const { user, account } = toRefs(session.state);
18
+ const switchableOrganizations = computed(() => {
19
+ const { user, account } = session.state;
20
+ if (!user || !account)
21
+ return;
22
+ return user.organizations.filter(o => account.type === 'user' || account.id !== o.id || (account.department || null) !== (o.department || null));
23
+ });
24
+ const __VLS_fnComponent = (await import('vue')).defineComponent({
25
+ props: {
26
+ darkModeSwitch: {
27
+ type: Boolean,
28
+ default: false
29
+ }
30
+ },
31
+ });
32
+ ;
33
+ let __VLS_functionalComponentProps;
34
+ function __VLS_template() {
35
+ const __VLS_ctx = {};
36
+ const __VLS_localComponents = {
37
+ ...{},
38
+ ...{},
39
+ ...__VLS_ctx,
40
+ };
41
+ let __VLS_components;
42
+ const __VLS_localDirectives = {
43
+ ...{},
44
+ ...__VLS_ctx,
45
+ };
46
+ let __VLS_directives;
47
+ let __VLS_styleScopedClasses;
48
+ // CSS variable injection
49
+ // CSS variable injection end
50
+ let __VLS_resolvedLocalAndGlobalComponents;
51
+ const __VLS_0 = __VLS_resolvedLocalAndGlobalComponents.VToolbarItems;
52
+ /** @type { [typeof __VLS_components.VToolbarItems, typeof __VLS_components.vToolbarItems, typeof __VLS_components.VToolbarItems, typeof __VLS_components.vToolbarItems, ] } */
53
+ // @ts-ignore
54
+ const __VLS_1 = __VLS_asFunctionalComponent(__VLS_0, new __VLS_0({ ...{ class: ("personal-menu") }, }));
55
+ const __VLS_2 = __VLS_1({ ...{ class: ("personal-menu") }, }, ...__VLS_functionalComponentArgsRest(__VLS_1));
56
+ if (!__VLS_ctx.user || !__VLS_ctx.account) {
57
+ const __VLS_6 = __VLS_resolvedLocalAndGlobalComponents.VBtn;
58
+ /** @type { [typeof __VLS_components.VBtn, typeof __VLS_components.vBtn, ] } */
59
+ // @ts-ignore
60
+ const __VLS_7 = __VLS_asFunctionalComponent(__VLS_6, new __VLS_6({ depressed: (true), color: ("primary"), href: ((__VLS_ctx.session.loginUrl())), }));
61
+ const __VLS_8 = __VLS_7({ depressed: (true), color: ("primary"), href: ((__VLS_ctx.session.loginUrl())), }, ...__VLS_functionalComponentArgsRest(__VLS_7));
62
+ __VLS_directiveAsFunction(__VLS_directives.vT)(null, { ...__VLS_directiveBindingRestFields, value: ('login') }, null, null);
63
+ }
64
+ else {
65
+ const __VLS_12 = __VLS_resolvedLocalAndGlobalComponents.VMenu;
66
+ /** @type { [typeof __VLS_components.VMenu, typeof __VLS_components.vMenu, typeof __VLS_components.VMenu, typeof __VLS_components.vMenu, ] } */
67
+ // @ts-ignore
68
+ const __VLS_13 = __VLS_asFunctionalComponent(__VLS_12, new __VLS_12({ offsetY: (true), nudgeLeft: (true), maxHeight: ("700"), }));
69
+ const __VLS_14 = __VLS_13({ offsetY: (true), nudgeLeft: (true), maxHeight: ("700"), }, ...__VLS_functionalComponentArgsRest(__VLS_13));
70
+ __VLS_elementAsFunction(__VLS_intrinsicElements.template, __VLS_intrinsicElements.template)({});
71
+ {
72
+ const { activator: __VLS_thisSlot } = __VLS_nonNullable(__VLS_17.slots);
73
+ const { props: activatorProps } = __VLS_getSlotParam(__VLS_thisSlot);
74
+ const __VLS_18 = __VLS_resolvedLocalAndGlobalComponents.VBtn;
75
+ /** @type { [typeof __VLS_components.VBtn, typeof __VLS_components.vBtn, typeof __VLS_components.VBtn, typeof __VLS_components.vBtn, ] } */
76
+ // @ts-ignore
77
+ const __VLS_19 = __VLS_asFunctionalComponent(__VLS_18, new __VLS_18({ ...{ class: ("px-0") }, title: ((__VLS_ctx.t('openPersonalMenu'))), ...(activatorProps), }));
78
+ const __VLS_20 = __VLS_19({ ...{ class: ("px-0") }, title: ((__VLS_ctx.t('openPersonalMenu'))), ...(activatorProps), }, ...__VLS_functionalComponentArgsRest(__VLS_19));
79
+ // @ts-ignore
80
+ [UserAvatar,];
81
+ // @ts-ignore
82
+ const __VLS_24 = __VLS_asFunctionalComponent(UserAvatar, new UserAvatar({ showAccount: (true), }));
83
+ const __VLS_25 = __VLS_24({ showAccount: (true), }, ...__VLS_functionalComponentArgsRest(__VLS_24));
84
+ if (__VLS_ctx.user.pd) {
85
+ const __VLS_29 = __VLS_resolvedLocalAndGlobalComponents.VIcon;
86
+ /** @type { [typeof __VLS_components.VIcon, typeof __VLS_components.vIcon, typeof __VLS_components.VIcon, typeof __VLS_components.vIcon, ] } */
87
+ // @ts-ignore
88
+ const __VLS_30 = __VLS_asFunctionalComponent(__VLS_29, new __VLS_29({ color: ("warning"), ...{ style: ({}) }, }));
89
+ const __VLS_31 = __VLS_30({ color: ("warning"), ...{ style: ({}) }, }, ...__VLS_functionalComponentArgsRest(__VLS_30));
90
+ __VLS_nonNullable(__VLS_34.slots).default;
91
+ const __VLS_34 = __VLS_pickFunctionalComponentCtx(__VLS_29, __VLS_31);
92
+ }
93
+ __VLS_nonNullable(__VLS_23.slots).default;
94
+ const __VLS_23 = __VLS_pickFunctionalComponentCtx(__VLS_18, __VLS_20);
95
+ }
96
+ const __VLS_35 = __VLS_resolvedLocalAndGlobalComponents.VList;
97
+ /** @type { [typeof __VLS_components.VList, typeof __VLS_components.vList, typeof __VLS_components.VList, typeof __VLS_components.vList, ] } */
98
+ // @ts-ignore
99
+ const __VLS_36 = __VLS_asFunctionalComponent(__VLS_35, new __VLS_35({ outlined: (true), ...{ class: ("py-0") }, }));
100
+ const __VLS_37 = __VLS_36({ outlined: (true), ...{ class: ("py-0") }, }, ...__VLS_functionalComponentArgsRest(__VLS_36));
101
+ const __VLS_41 = __VLS_resolvedLocalAndGlobalComponents.VListItem;
102
+ /** @type { [typeof __VLS_components.VListItem, typeof __VLS_components.vListItem, typeof __VLS_components.VListItem, typeof __VLS_components.vListItem, ] } */
103
+ // @ts-ignore
104
+ const __VLS_42 = __VLS_asFunctionalComponent(__VLS_41, new __VLS_41({ disabled: (true), ...{ style: ((__VLS_ctx.account.type !== 'user' ? 'padding-left:0' : '')) }, ...{ class: ("text--secondary") }, }));
105
+ const __VLS_43 = __VLS_42({ disabled: (true), ...{ style: ((__VLS_ctx.account.type !== 'user' ? 'padding-left:0' : '')) }, ...{ class: ("text--secondary") }, }, ...__VLS_functionalComponentArgsRest(__VLS_42));
106
+ __VLS_elementAsFunction(__VLS_intrinsicElements.template, __VLS_intrinsicElements.template)({});
107
+ {
108
+ const { prepend: __VLS_thisSlot } = __VLS_nonNullable(__VLS_46.slots);
109
+ // @ts-ignore
110
+ [UserAvatar,];
111
+ // @ts-ignore
112
+ const __VLS_47 = __VLS_asFunctionalComponent(UserAvatar, new UserAvatar({ showAccount: (true), ...{ style: ({}) }, }));
113
+ const __VLS_48 = __VLS_47({ showAccount: (true), ...{ style: ({}) }, }, ...__VLS_functionalComponentArgsRest(__VLS_47));
114
+ }
115
+ const __VLS_52 = __VLS_resolvedLocalAndGlobalComponents.VListItemTitle;
116
+ /** @type { [typeof __VLS_components.VListItemTitle, typeof __VLS_components.vListItemTitle, typeof __VLS_components.VListItemTitle, typeof __VLS_components.vListItemTitle, ] } */
117
+ // @ts-ignore
118
+ const __VLS_53 = __VLS_asFunctionalComponent(__VLS_52, new __VLS_52({}));
119
+ const __VLS_54 = __VLS_53({}, ...__VLS_functionalComponentArgsRest(__VLS_53));
120
+ (__VLS_ctx.account.type === 'user' ? __VLS_ctx.t('personalAccount') : __VLS_ctx.account.name);
121
+ __VLS_nonNullable(__VLS_57.slots).default;
122
+ const __VLS_57 = __VLS_pickFunctionalComponentCtx(__VLS_52, __VLS_54);
123
+ if (__VLS_ctx.account.department) {
124
+ const __VLS_58 = __VLS_resolvedLocalAndGlobalComponents.VListItemSubtitle;
125
+ /** @type { [typeof __VLS_components.VListItemSubtitle, typeof __VLS_components.vListItemSubtitle, typeof __VLS_components.VListItemSubtitle, typeof __VLS_components.vListItemSubtitle, ] } */
126
+ // @ts-ignore
127
+ const __VLS_59 = __VLS_asFunctionalComponent(__VLS_58, new __VLS_58({}));
128
+ const __VLS_60 = __VLS_59({}, ...__VLS_functionalComponentArgsRest(__VLS_59));
129
+ (__VLS_ctx.account.departmentName || __VLS_ctx.account.department);
130
+ __VLS_nonNullable(__VLS_63.slots).default;
131
+ const __VLS_63 = __VLS_pickFunctionalComponentCtx(__VLS_58, __VLS_60);
132
+ }
133
+ const __VLS_64 = __VLS_resolvedLocalAndGlobalComponents.VListItemSubtitle;
134
+ /** @type { [typeof __VLS_components.VListItemSubtitle, typeof __VLS_components.vListItemSubtitle, typeof __VLS_components.VListItemSubtitle, typeof __VLS_components.vListItemSubtitle, ] } */
135
+ // @ts-ignore
136
+ const __VLS_65 = __VLS_asFunctionalComponent(__VLS_64, new __VLS_64({}));
137
+ const __VLS_66 = __VLS_65({}, ...__VLS_functionalComponentArgsRest(__VLS_65));
138
+ (__VLS_ctx.user.name);
139
+ __VLS_nonNullable(__VLS_69.slots).default;
140
+ const __VLS_69 = __VLS_pickFunctionalComponentCtx(__VLS_64, __VLS_66);
141
+ const __VLS_46 = __VLS_pickFunctionalComponentCtx(__VLS_41, __VLS_43);
142
+ if (__VLS_ctx.user.pd) {
143
+ const __VLS_70 = __VLS_resolvedLocalAndGlobalComponents.VAlert;
144
+ /** @type { [typeof __VLS_components.VAlert, typeof __VLS_components.vAlert, typeof __VLS_components.VAlert, typeof __VLS_components.vAlert, ] } */
145
+ // @ts-ignore
146
+ const __VLS_71 = __VLS_asFunctionalComponent(__VLS_70, new __VLS_70({ value: ((true)), type: ("warning"), tile: (true), outlined: ((__VLS_ctx.theme.current.value.dark)), ...{ style: ({}) }, }));
147
+ const __VLS_72 = __VLS_71({ value: ((true)), type: ("warning"), tile: (true), outlined: ((__VLS_ctx.theme.current.value.dark)), ...{ style: ({}) }, }, ...__VLS_functionalComponentArgsRest(__VLS_71));
148
+ (__VLS_ctx.t('plannedDeletion', { name: __VLS_ctx.user.name, plannedDeletion: __VLS_ctx.$d(new Date(__VLS_ctx.user.pd)) }));
149
+ __VLS_nonNullable(__VLS_75.slots).default;
150
+ const __VLS_75 = __VLS_pickFunctionalComponentCtx(__VLS_70, __VLS_72);
151
+ const __VLS_76 = __VLS_resolvedLocalAndGlobalComponents.VRow;
152
+ /** @type { [typeof __VLS_components.VRow, typeof __VLS_components.vRow, typeof __VLS_components.VRow, typeof __VLS_components.vRow, ] } */
153
+ // @ts-ignore
154
+ const __VLS_77 = __VLS_asFunctionalComponent(__VLS_76, new __VLS_76({ ...{ class: ("justify-center ma-0 mb-2") }, }));
155
+ const __VLS_78 = __VLS_77({ ...{ class: ("justify-center ma-0 mb-2") }, }, ...__VLS_functionalComponentArgsRest(__VLS_77));
156
+ const __VLS_82 = __VLS_resolvedLocalAndGlobalComponents.VBtn;
157
+ /** @type { [typeof __VLS_components.VBtn, typeof __VLS_components.vBtn, typeof __VLS_components.VBtn, typeof __VLS_components.vBtn, ] } */
158
+ // @ts-ignore
159
+ const __VLS_83 = __VLS_asFunctionalComponent(__VLS_82, new __VLS_82({ ...{ 'onClick': {} }, color: ("warning"), }));
160
+ const __VLS_84 = __VLS_83({ ...{ 'onClick': {} }, color: ("warning"), }, ...__VLS_functionalComponentArgsRest(__VLS_83));
161
+ let __VLS_88;
162
+ const __VLS_89 = {
163
+ onClick: (__VLS_ctx.session.cancelDeletion)
164
+ };
165
+ let __VLS_85;
166
+ let __VLS_86;
167
+ (__VLS_ctx.t('cancelDeletion'));
168
+ __VLS_nonNullable(__VLS_87.slots).default;
169
+ const __VLS_87 = __VLS_pickFunctionalComponentCtx(__VLS_82, __VLS_84);
170
+ __VLS_nonNullable(__VLS_81.slots).default;
171
+ const __VLS_81 = __VLS_pickFunctionalComponentCtx(__VLS_76, __VLS_78);
172
+ }
173
+ if (__VLS_ctx.user.organizations.length > 1 || (__VLS_ctx.user.organizations.length === 1 && (!__VLS_ctx.user.ipa || __VLS_ctx.account.type === 'user'))) {
174
+ const __VLS_90 = __VLS_resolvedLocalAndGlobalComponents.VListSubheader;
175
+ /** @type { [typeof __VLS_components.VListSubheader, typeof __VLS_components.vListSubheader, ] } */
176
+ // @ts-ignore
177
+ const __VLS_91 = __VLS_asFunctionalComponent(__VLS_90, new __VLS_90({ ...{ style: ({}) }, }));
178
+ const __VLS_92 = __VLS_91({ ...{ style: ({}) }, }, ...__VLS_functionalComponentArgsRest(__VLS_91));
179
+ __VLS_directiveAsFunction(__VLS_directives.vT)(null, { ...__VLS_directiveBindingRestFields, value: ('switchAccount') }, null, null);
180
+ if (__VLS_ctx.account.type !== 'user' && !__VLS_ctx.user.ipa) {
181
+ const __VLS_96 = __VLS_resolvedLocalAndGlobalComponents.VListItem;
182
+ /** @type { [typeof __VLS_components.VListItem, typeof __VLS_components.vListItem, typeof __VLS_components.VListItem, typeof __VLS_components.vListItem, ] } */
183
+ // @ts-ignore
184
+ const __VLS_97 = __VLS_asFunctionalComponent(__VLS_96, new __VLS_96({ ...{ 'onClick': {} }, id: ("toolbar-menu-switch-user"), }));
185
+ const __VLS_98 = __VLS_97({ ...{ 'onClick': {} }, id: ("toolbar-menu-switch-user"), }, ...__VLS_functionalComponentArgsRest(__VLS_97));
186
+ let __VLS_102;
187
+ const __VLS_103 = {
188
+ onClick: (...[$event]) => {
189
+ if (!(!((!__VLS_ctx.user || !__VLS_ctx.account))))
190
+ return;
191
+ if (!((__VLS_ctx.user.organizations.length > 1 || (__VLS_ctx.user.organizations.length === 1 && (!__VLS_ctx.user.ipa || __VLS_ctx.account.type === 'user')))))
192
+ return;
193
+ if (!((__VLS_ctx.account.type !== 'user' && !__VLS_ctx.user.ipa)))
194
+ return;
195
+ __VLS_ctx.session.switchOrganization(null);
196
+ }
197
+ };
198
+ let __VLS_99;
199
+ let __VLS_100;
200
+ __VLS_elementAsFunction(__VLS_intrinsicElements.template, __VLS_intrinsicElements.template)({});
201
+ {
202
+ const { prepend: __VLS_thisSlot } = __VLS_nonNullable(__VLS_101.slots);
203
+ const __VLS_104 = __VLS_resolvedLocalAndGlobalComponents.VAvatar;
204
+ /** @type { [typeof __VLS_components.VAvatar, typeof __VLS_components.vAvatar, typeof __VLS_components.VAvatar, typeof __VLS_components.vAvatar, ] } */
205
+ // @ts-ignore
206
+ const __VLS_105 = __VLS_asFunctionalComponent(__VLS_104, new __VLS_104({ size: ((28)), }));
207
+ const __VLS_106 = __VLS_105({ size: ((28)), }, ...__VLS_functionalComponentArgsRest(__VLS_105));
208
+ __VLS_elementAsFunction(__VLS_intrinsicElements.img, __VLS_intrinsicElements.img)({ src: ((`${__VLS_ctx.session.options.directoryUrl}/api/avatars/user/${__VLS_ctx.user.id}/avatar.png`)), });
209
+ __VLS_nonNullable(__VLS_109.slots).default;
210
+ const __VLS_109 = __VLS_pickFunctionalComponentCtx(__VLS_104, __VLS_106);
211
+ }
212
+ const __VLS_110 = __VLS_resolvedLocalAndGlobalComponents.VListItemTitle;
213
+ /** @type { [typeof __VLS_components.VListItemTitle, typeof __VLS_components.vListItemTitle, ] } */
214
+ // @ts-ignore
215
+ const __VLS_111 = __VLS_asFunctionalComponent(__VLS_110, new __VLS_110({}));
216
+ const __VLS_112 = __VLS_111({}, ...__VLS_functionalComponentArgsRest(__VLS_111));
217
+ __VLS_directiveAsFunction(__VLS_directives.vT)(null, { ...__VLS_directiveBindingRestFields, value: ('personalAccount') }, null, null);
218
+ const __VLS_101 = __VLS_pickFunctionalComponentCtx(__VLS_96, __VLS_98);
219
+ }
220
+ for (const [organization] of __VLS_getVForSourceType((__VLS_ctx.switchableOrganizations))) {
221
+ const __VLS_116 = __VLS_resolvedLocalAndGlobalComponents.VListItem;
222
+ /** @type { [typeof __VLS_components.VListItem, typeof __VLS_components.vListItem, typeof __VLS_components.VListItem, typeof __VLS_components.vListItem, ] } */
223
+ // @ts-ignore
224
+ const __VLS_117 = __VLS_asFunctionalComponent(__VLS_116, new __VLS_116({ ...{ 'onClick': {} }, id: (('toolbar-menu-switch-orga-' + organization.id)), key: ((organization.id)), }));
225
+ const __VLS_118 = __VLS_117({ ...{ 'onClick': {} }, id: (('toolbar-menu-switch-orga-' + organization.id)), key: ((organization.id)), }, ...__VLS_functionalComponentArgsRest(__VLS_117));
226
+ let __VLS_122;
227
+ const __VLS_123 = {
228
+ onClick: (...[$event]) => {
229
+ if (!(!((!__VLS_ctx.user || !__VLS_ctx.account))))
230
+ return;
231
+ if (!((__VLS_ctx.user.organizations.length > 1 || (__VLS_ctx.user.organizations.length === 1 && (!__VLS_ctx.user.ipa || __VLS_ctx.account.type === 'user')))))
232
+ return;
233
+ __VLS_ctx.session.switchOrganization(organization.id, organization.department);
234
+ }
235
+ };
236
+ let __VLS_119;
237
+ let __VLS_120;
238
+ __VLS_elementAsFunction(__VLS_intrinsicElements.template, __VLS_intrinsicElements.template)({});
239
+ {
240
+ const { prepend: __VLS_thisSlot } = __VLS_nonNullable(__VLS_121.slots);
241
+ const __VLS_124 = __VLS_resolvedLocalAndGlobalComponents.VAvatar;
242
+ /** @type { [typeof __VLS_components.VAvatar, typeof __VLS_components.vAvatar, typeof __VLS_components.VAvatar, typeof __VLS_components.vAvatar, ] } */
243
+ // @ts-ignore
244
+ const __VLS_125 = __VLS_asFunctionalComponent(__VLS_124, new __VLS_124({ size: ((28)), }));
245
+ const __VLS_126 = __VLS_125({ size: ((28)), }, ...__VLS_functionalComponentArgsRest(__VLS_125));
246
+ if (organization.department) {
247
+ __VLS_elementAsFunction(__VLS_intrinsicElements.img, __VLS_intrinsicElements.img)({ src: ((`${__VLS_ctx.session.options.directoryUrl}/api/avatars/organization/${organization.id}/${organization.department}/avatar.png`)), });
248
+ }
249
+ else {
250
+ __VLS_elementAsFunction(__VLS_intrinsicElements.img, __VLS_intrinsicElements.img)({ src: ((`${__VLS_ctx.session.options.directoryUrl}/api/avatars/organization/${organization.id}/avatar.png`)), });
251
+ }
252
+ __VLS_nonNullable(__VLS_129.slots).default;
253
+ const __VLS_129 = __VLS_pickFunctionalComponentCtx(__VLS_124, __VLS_126);
254
+ }
255
+ const __VLS_130 = __VLS_resolvedLocalAndGlobalComponents.VListItemTitle;
256
+ /** @type { [typeof __VLS_components.VListItemTitle, typeof __VLS_components.vListItemTitle, typeof __VLS_components.VListItemTitle, typeof __VLS_components.vListItemTitle, ] } */
257
+ // @ts-ignore
258
+ const __VLS_131 = __VLS_asFunctionalComponent(__VLS_130, new __VLS_130({}));
259
+ const __VLS_132 = __VLS_131({}, ...__VLS_functionalComponentArgsRest(__VLS_131));
260
+ (organization.name);
261
+ __VLS_nonNullable(__VLS_135.slots).default;
262
+ const __VLS_135 = __VLS_pickFunctionalComponentCtx(__VLS_130, __VLS_132);
263
+ if (organization.department) {
264
+ const __VLS_136 = __VLS_resolvedLocalAndGlobalComponents.VListItemSubtitle;
265
+ /** @type { [typeof __VLS_components.VListItemSubtitle, typeof __VLS_components.vListItemSubtitle, typeof __VLS_components.VListItemSubtitle, typeof __VLS_components.vListItemSubtitle, ] } */
266
+ // @ts-ignore
267
+ const __VLS_137 = __VLS_asFunctionalComponent(__VLS_136, new __VLS_136({}));
268
+ const __VLS_138 = __VLS_137({}, ...__VLS_functionalComponentArgsRest(__VLS_137));
269
+ (organization.departmentName || organization.department);
270
+ __VLS_nonNullable(__VLS_141.slots).default;
271
+ const __VLS_141 = __VLS_pickFunctionalComponentCtx(__VLS_136, __VLS_138);
272
+ }
273
+ const __VLS_121 = __VLS_pickFunctionalComponentCtx(__VLS_116, __VLS_118);
274
+ }
275
+ }
276
+ const __VLS_142 = __VLS_resolvedLocalAndGlobalComponents.VDivider;
277
+ /** @type { [typeof __VLS_components.VDivider, typeof __VLS_components.vDivider, ] } */
278
+ // @ts-ignore
279
+ const __VLS_143 = __VLS_asFunctionalComponent(__VLS_142, new __VLS_142({}));
280
+ const __VLS_144 = __VLS_143({}, ...__VLS_functionalComponentArgsRest(__VLS_143));
281
+ var __VLS_148 = {};
282
+ if (__VLS_ctx.user.isAdmin) {
283
+ const __VLS_149 = __VLS_resolvedLocalAndGlobalComponents.VListItem;
284
+ /** @type { [typeof __VLS_components.VListItem, typeof __VLS_components.vListItem, typeof __VLS_components.VListItem, typeof __VLS_components.vListItem, ] } */
285
+ // @ts-ignore
286
+ const __VLS_150 = __VLS_asFunctionalComponent(__VLS_149, new __VLS_149({ density: ("compact"), ...{ class: ("personal-menu-switch-list-item") }, }));
287
+ const __VLS_151 = __VLS_150({ density: ("compact"), ...{ class: ("personal-menu-switch-list-item") }, }, ...__VLS_functionalComponentArgsRest(__VLS_150));
288
+ __VLS_elementAsFunction(__VLS_intrinsicElements.template, __VLS_intrinsicElements.template)({});
289
+ {
290
+ const { prepend: __VLS_thisSlot } = __VLS_nonNullable(__VLS_154.slots);
291
+ const __VLS_155 = __VLS_resolvedLocalAndGlobalComponents.VIcon;
292
+ /** @type { [typeof __VLS_components.VIcon, typeof __VLS_components.vIcon, typeof __VLS_components.VIcon, typeof __VLS_components.vIcon, ] } */
293
+ // @ts-ignore
294
+ const __VLS_156 = __VLS_asFunctionalComponent(__VLS_155, new __VLS_155({}));
295
+ const __VLS_157 = __VLS_156({}, ...__VLS_functionalComponentArgsRest(__VLS_156));
296
+ __VLS_nonNullable(__VLS_160.slots).default;
297
+ const __VLS_160 = __VLS_pickFunctionalComponentCtx(__VLS_155, __VLS_157);
298
+ }
299
+ const __VLS_161 = __VLS_resolvedLocalAndGlobalComponents.VListItemTitle;
300
+ /** @type { [typeof __VLS_components.VListItemTitle, typeof __VLS_components.vListItemTitle, typeof __VLS_components.VListItemTitle, typeof __VLS_components.vListItemTitle, ] } */
301
+ // @ts-ignore
302
+ const __VLS_162 = __VLS_asFunctionalComponent(__VLS_161, new __VLS_161({}));
303
+ const __VLS_163 = __VLS_162({}, ...__VLS_functionalComponentArgsRest(__VLS_162));
304
+ const __VLS_167 = __VLS_resolvedLocalAndGlobalComponents.VSwitch;
305
+ /** @type { [typeof __VLS_components.VSwitch, typeof __VLS_components.vSwitch, ] } */
306
+ // @ts-ignore
307
+ const __VLS_168 = __VLS_asFunctionalComponent(__VLS_167, new __VLS_167({ ...{ 'onChange': {} }, modelValue: ((__VLS_ctx.user.adminMode)), color: ("admin"), hideDetails: (true), ...{ class: ("mt-0") }, density: ("compact"), label: ((__VLS_ctx.t('adminMode'))), }));
308
+ const __VLS_169 = __VLS_168({ ...{ 'onChange': {} }, modelValue: ((__VLS_ctx.user.adminMode)), color: ("admin"), hideDetails: (true), ...{ class: ("mt-0") }, density: ("compact"), label: ((__VLS_ctx.t('adminMode'))), }, ...__VLS_functionalComponentArgsRest(__VLS_168));
309
+ let __VLS_173;
310
+ const __VLS_174 = {
311
+ onChange: (__VLS_ctx.session.setAdminMode)
312
+ };
313
+ let __VLS_170;
314
+ let __VLS_171;
315
+ const __VLS_172 = __VLS_pickFunctionalComponentCtx(__VLS_167, __VLS_169);
316
+ __VLS_nonNullable(__VLS_166.slots).default;
317
+ const __VLS_166 = __VLS_pickFunctionalComponentCtx(__VLS_161, __VLS_163);
318
+ const __VLS_154 = __VLS_pickFunctionalComponentCtx(__VLS_149, __VLS_151);
319
+ }
320
+ if (__VLS_ctx.user.asAdmin) {
321
+ const __VLS_175 = __VLS_resolvedLocalAndGlobalComponents.VListItem;
322
+ /** @type { [typeof __VLS_components.VListItem, typeof __VLS_components.vListItem, typeof __VLS_components.VListItem, typeof __VLS_components.vListItem, ] } */
323
+ // @ts-ignore
324
+ const __VLS_176 = __VLS_asFunctionalComponent(__VLS_175, new __VLS_175({ ...{ 'onClick': {} }, color: ("admin"), density: ("compact"), }));
325
+ const __VLS_177 = __VLS_176({ ...{ 'onClick': {} }, color: ("admin"), density: ("compact"), }, ...__VLS_functionalComponentArgsRest(__VLS_176));
326
+ let __VLS_181;
327
+ const __VLS_182 = {
328
+ onClick: (...[$event]) => {
329
+ if (!(!((!__VLS_ctx.user || !__VLS_ctx.account))))
330
+ return;
331
+ if (!((__VLS_ctx.user.asAdmin)))
332
+ return;
333
+ __VLS_ctx.session.asAdmin(null);
334
+ }
335
+ };
336
+ let __VLS_178;
337
+ let __VLS_179;
338
+ __VLS_elementAsFunction(__VLS_intrinsicElements.template, __VLS_intrinsicElements.template)({});
339
+ {
340
+ const { prepend: __VLS_thisSlot } = __VLS_nonNullable(__VLS_180.slots);
341
+ const __VLS_183 = __VLS_resolvedLocalAndGlobalComponents.VIcon;
342
+ /** @type { [typeof __VLS_components.VIcon, typeof __VLS_components.vIcon, typeof __VLS_components.VIcon, typeof __VLS_components.vIcon, ] } */
343
+ // @ts-ignore
344
+ const __VLS_184 = __VLS_asFunctionalComponent(__VLS_183, new __VLS_183({}));
345
+ const __VLS_185 = __VLS_184({}, ...__VLS_functionalComponentArgsRest(__VLS_184));
346
+ __VLS_nonNullable(__VLS_188.slots).default;
347
+ const __VLS_188 = __VLS_pickFunctionalComponentCtx(__VLS_183, __VLS_185);
348
+ }
349
+ const __VLS_189 = __VLS_resolvedLocalAndGlobalComponents.VListItemTitle;
350
+ /** @type { [typeof __VLS_components.VListItemTitle, typeof __VLS_components.vListItemTitle, typeof __VLS_components.VListItemTitle, typeof __VLS_components.vListItemTitle, ] } */
351
+ // @ts-ignore
352
+ const __VLS_190 = __VLS_asFunctionalComponent(__VLS_189, new __VLS_189({}));
353
+ const __VLS_191 = __VLS_190({}, ...__VLS_functionalComponentArgsRest(__VLS_190));
354
+ (__VLS_ctx.t('backToAdmin'));
355
+ __VLS_nonNullable(__VLS_194.slots).default;
356
+ const __VLS_194 = __VLS_pickFunctionalComponentCtx(__VLS_189, __VLS_191);
357
+ const __VLS_180 = __VLS_pickFunctionalComponentCtx(__VLS_175, __VLS_177);
358
+ }
359
+ if (__VLS_ctx.darkModeSwitch) {
360
+ const __VLS_195 = __VLS_resolvedLocalAndGlobalComponents.VListItem;
361
+ /** @type { [typeof __VLS_components.VListItem, typeof __VLS_components.vListItem, typeof __VLS_components.VListItem, typeof __VLS_components.vListItem, ] } */
362
+ // @ts-ignore
363
+ const __VLS_196 = __VLS_asFunctionalComponent(__VLS_195, new __VLS_195({ density: ("compact"), ...{ class: ("personal-menu-switch-list-item") }, }));
364
+ const __VLS_197 = __VLS_196({ density: ("compact"), ...{ class: ("personal-menu-switch-list-item") }, }, ...__VLS_functionalComponentArgsRest(__VLS_196));
365
+ __VLS_elementAsFunction(__VLS_intrinsicElements.template, __VLS_intrinsicElements.template)({});
366
+ {
367
+ const { prepend: __VLS_thisSlot } = __VLS_nonNullable(__VLS_200.slots);
368
+ const __VLS_201 = __VLS_resolvedLocalAndGlobalComponents.VIcon;
369
+ /** @type { [typeof __VLS_components.VIcon, typeof __VLS_components.vIcon, typeof __VLS_components.VIcon, typeof __VLS_components.vIcon, ] } */
370
+ // @ts-ignore
371
+ const __VLS_202 = __VLS_asFunctionalComponent(__VLS_201, new __VLS_201({}));
372
+ const __VLS_203 = __VLS_202({}, ...__VLS_functionalComponentArgsRest(__VLS_202));
373
+ __VLS_nonNullable(__VLS_206.slots).default;
374
+ const __VLS_206 = __VLS_pickFunctionalComponentCtx(__VLS_201, __VLS_203);
375
+ }
376
+ const __VLS_207 = __VLS_resolvedLocalAndGlobalComponents.VListItemTitle;
377
+ /** @type { [typeof __VLS_components.VListItemTitle, typeof __VLS_components.vListItemTitle, typeof __VLS_components.VListItemTitle, typeof __VLS_components.vListItemTitle, ] } */
378
+ // @ts-ignore
379
+ const __VLS_208 = __VLS_asFunctionalComponent(__VLS_207, new __VLS_207({}));
380
+ const __VLS_209 = __VLS_208({}, ...__VLS_functionalComponentArgsRest(__VLS_208));
381
+ const __VLS_213 = __VLS_resolvedLocalAndGlobalComponents.VSwitch;
382
+ /** @type { [typeof __VLS_components.VSwitch, typeof __VLS_components.vSwitch, ] } */
383
+ // @ts-ignore
384
+ const __VLS_214 = __VLS_asFunctionalComponent(__VLS_213, new __VLS_213({ ...{ 'onChange': {} }, inputValue: ((__VLS_ctx.session.state.dark)), hideDetails: (true), ...{ class: ("mt-0") }, density: ("compact"), label: ((__VLS_ctx.t('darkMode'))), color: ("white"), }));
385
+ const __VLS_215 = __VLS_214({ ...{ 'onChange': {} }, inputValue: ((__VLS_ctx.session.state.dark)), hideDetails: (true), ...{ class: ("mt-0") }, density: ("compact"), label: ((__VLS_ctx.t('darkMode'))), color: ("white"), }, ...__VLS_functionalComponentArgsRest(__VLS_214));
386
+ let __VLS_219;
387
+ const __VLS_220 = {
388
+ onChange: (() => __VLS_ctx.session.switchDark(!__VLS_ctx.session.state.dark))
389
+ };
390
+ let __VLS_216;
391
+ let __VLS_217;
392
+ const __VLS_218 = __VLS_pickFunctionalComponentCtx(__VLS_213, __VLS_215);
393
+ __VLS_nonNullable(__VLS_212.slots).default;
394
+ const __VLS_212 = __VLS_pickFunctionalComponentCtx(__VLS_207, __VLS_209);
395
+ const __VLS_200 = __VLS_pickFunctionalComponentCtx(__VLS_195, __VLS_197);
396
+ }
397
+ const __VLS_221 = __VLS_resolvedLocalAndGlobalComponents.VDivider;
398
+ /** @type { [typeof __VLS_components.VDivider, typeof __VLS_components.vDivider, ] } */
399
+ // @ts-ignore
400
+ const __VLS_222 = __VLS_asFunctionalComponent(__VLS_221, new __VLS_221({}));
401
+ const __VLS_223 = __VLS_222({}, ...__VLS_functionalComponentArgsRest(__VLS_222));
402
+ const __VLS_227 = __VLS_resolvedLocalAndGlobalComponents.VListItem;
403
+ /** @type { [typeof __VLS_components.VListItem, typeof __VLS_components.vListItem, typeof __VLS_components.VListItem, typeof __VLS_components.vListItem, ] } */
404
+ // @ts-ignore
405
+ const __VLS_228 = __VLS_asFunctionalComponent(__VLS_227, new __VLS_227({ ...{ 'onClick': {} }, }));
406
+ const __VLS_229 = __VLS_228({ ...{ 'onClick': {} }, }, ...__VLS_functionalComponentArgsRest(__VLS_228));
407
+ let __VLS_233;
408
+ const __VLS_234 = {
409
+ onClick: (() => __VLS_ctx.session.logout())
410
+ };
411
+ let __VLS_230;
412
+ let __VLS_231;
413
+ __VLS_elementAsFunction(__VLS_intrinsicElements.template, __VLS_intrinsicElements.template)({});
414
+ {
415
+ const { prepend: __VLS_thisSlot } = __VLS_nonNullable(__VLS_232.slots);
416
+ const __VLS_235 = __VLS_resolvedLocalAndGlobalComponents.VIcon;
417
+ /** @type { [typeof __VLS_components.VIcon, typeof __VLS_components.vIcon, typeof __VLS_components.VIcon, typeof __VLS_components.vIcon, ] } */
418
+ // @ts-ignore
419
+ const __VLS_236 = __VLS_asFunctionalComponent(__VLS_235, new __VLS_235({}));
420
+ const __VLS_237 = __VLS_236({}, ...__VLS_functionalComponentArgsRest(__VLS_236));
421
+ __VLS_nonNullable(__VLS_240.slots).default;
422
+ const __VLS_240 = __VLS_pickFunctionalComponentCtx(__VLS_235, __VLS_237);
423
+ }
424
+ const __VLS_241 = __VLS_resolvedLocalAndGlobalComponents.VListItemTitle;
425
+ /** @type { [typeof __VLS_components.VListItemTitle, typeof __VLS_components.vListItemTitle, ] } */
426
+ // @ts-ignore
427
+ const __VLS_242 = __VLS_asFunctionalComponent(__VLS_241, new __VLS_241({}));
428
+ const __VLS_243 = __VLS_242({}, ...__VLS_functionalComponentArgsRest(__VLS_242));
429
+ __VLS_directiveAsFunction(__VLS_directives.vT)(null, { ...__VLS_directiveBindingRestFields, value: ('logout') }, null, null);
430
+ const __VLS_232 = __VLS_pickFunctionalComponentCtx(__VLS_227, __VLS_229);
431
+ __VLS_nonNullable(__VLS_40.slots).default;
432
+ const __VLS_40 = __VLS_pickFunctionalComponentCtx(__VLS_35, __VLS_37);
433
+ const __VLS_17 = __VLS_pickFunctionalComponentCtx(__VLS_12, __VLS_14);
434
+ }
435
+ __VLS_nonNullable(__VLS_5.slots).default;
436
+ const __VLS_5 = __VLS_pickFunctionalComponentCtx(__VLS_0, __VLS_2);
437
+ __VLS_styleScopedClasses['personal-menu'];
438
+ __VLS_styleScopedClasses['px-0'];
439
+ __VLS_styleScopedClasses['py-0'];
440
+ __VLS_styleScopedClasses['text--secondary'];
441
+ __VLS_styleScopedClasses['justify-center'];
442
+ __VLS_styleScopedClasses['ma-0'];
443
+ __VLS_styleScopedClasses['mb-2'];
444
+ __VLS_styleScopedClasses['personal-menu-switch-list-item'];
445
+ __VLS_styleScopedClasses['mt-0'];
446
+ __VLS_styleScopedClasses['personal-menu-switch-list-item'];
447
+ __VLS_styleScopedClasses['mt-0'];
448
+ var __VLS_slots;
449
+ var __VLS_inheritedAttrs;
450
+ const __VLS_refs = {};
451
+ var $refs;
452
+ return {
453
+ slots: __VLS_slots,
454
+ refs: $refs,
455
+ attrs: {},
456
+ };
457
+ }
458
+ ;
459
+ const __VLS_self = (await import('vue')).defineComponent({
460
+ setup() {
461
+ return {
462
+ $props: __VLS_makeOptional(__VLS_props),
463
+ ...__VLS_props,
464
+ UserAvatar: UserAvatar,
465
+ theme: theme,
466
+ session: session,
467
+ t: t,
468
+ user: user,
469
+ account: account,
470
+ switchableOrganizations: switchableOrganizations,
471
+ };
472
+ },
473
+ });
474
+ const __VLS_component = (await import('vue')).defineComponent({
475
+ setup() {
476
+ return {
477
+ $props: __VLS_makeOptional(__VLS_props),
478
+ ...__VLS_props,
479
+ };
480
+ },
481
+ });
482
+ export default {};
483
+ ;
484
+ //# sourceMappingURL=personal-menu.vue.js.map
@@ -0,0 +1,75 @@
1
+ <script setup lang="ts">
2
+ import { VAutocomplete } from 'vuetify/components/VAutocomplete'
3
+ import { ref, watch } from 'vue'
4
+ import { ofetch } from 'ofetch'
5
+ import { useDebounceFn } from '@vueuse/core'
6
+
7
+ defineProps<{variant?: VAutocomplete['variant']}>()
8
+ const emit = defineEmits(['selected'])
9
+ const model = defineModel({ type: String })
10
+
11
+ const addressesList = ref([] as any[])
12
+ const loadingAddresses = ref(false)
13
+ const address = ref(null as any)
14
+
15
+ const findAdressesFn = async (search: string, selectedId?: string) => {
16
+ loadingAddresses.value = true
17
+ if (!search || search.length < 3) {
18
+ addressesList.value = address.value ? [address.value] : []
19
+ } else {
20
+ const params = { q: search }
21
+ const result = (await ofetch('https://api-adresse.data.gouv.fr/search/', { params }))
22
+ addressesList.value = result.features.map((f: any) => ({
23
+ title: f.properties.label,
24
+ value: {
25
+ lat: f.geometry.coordinates[1],
26
+ lon: f.geometry.coordinates[0],
27
+ ...f.properties
28
+ }
29
+ }))
30
+ }
31
+ if (selectedId) {
32
+ address.value = addressesList.value.find(a => a.value.id === selectedId)
33
+ }
34
+ loadingAddresses.value = false
35
+ }
36
+
37
+ const findAdresses = useDebounceFn(findAdressesFn, 300) as typeof findAdressesFn
38
+
39
+ if (model.value && model.value.length) {
40
+ // @ts-ignore
41
+ findAdresses(...JSON.parse(`[${model.value}]`))
42
+ }
43
+
44
+ watch(
45
+ address,
46
+ (addr) => {
47
+ if (addr) {
48
+ model.value = JSON.stringify([addr.title, addr.value.id]).slice(1, -1)
49
+ } else {
50
+ model.value = undefined
51
+ addressesList.value = []
52
+ }
53
+ emit('selected', addr ? addr.value : undefined)
54
+ }
55
+ )
56
+ </script>
57
+
58
+ <template>
59
+ <v-autocomplete
60
+ v-model="address"
61
+ :items="addressesList"
62
+ :loading="loadingAddresses"
63
+ no-filter
64
+ :clearable="true"
65
+ return-object
66
+ hide-no-data
67
+ hide-details
68
+ label="Adresse"
69
+ placeholder="Saisissez une adresse"
70
+ :variant="variant"
71
+ density="compact"
72
+ menu-icon=""
73
+ @update:search="(search: string) => findAdresses(search)"
74
+ />
75
+ </template>
@@ -0,0 +1,14 @@
1
+ import { VAutocomplete } from 'vuetify/components/VAutocomplete';
2
+ declare let __VLS_typeProps: {
3
+ variant?: VAutocomplete['variant'];
4
+ };
5
+ declare const model: import("vue").ModelRef<string | undefined, string, string | undefined, string | undefined>;
6
+ type __VLS_PublicProps = {
7
+ modelValue?: typeof model['value'];
8
+ } & typeof __VLS_typeProps;
9
+ declare const _default: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
10
+ selected: (...args: any[]) => void;
11
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
12
+ onSelected?: ((...args: any[]) => any) | undefined;
13
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
14
+ export default _default;