@tekkare/romulus 0.1.261 → 0.1.262
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/dist/module.json +1 -1
- package/layer/app/components/panels/OipPanelProjects.vue +70 -21
- package/layer/app/components/project/AddButton.vue +127 -0
- package/layer/app/components/project/Banner.vue +68 -0
- package/layer/app/components/project/Dashboard.vue +85 -0
- package/layer/app/components/project/DiscardConfirm.vue +74 -0
- package/layer/app/components/project/Documents.vue +611 -0
- package/layer/app/components/project/Export.vue +205 -0
- package/layer/app/components/project/Inbox.vue +1241 -0
- package/layer/app/components/project/ListPage.vue +102 -0
- package/layer/app/components/project/NewButton.vue +147 -0
- package/layer/app/components/project/Notes.vue +1158 -0
- package/layer/app/components/project/Page.vue +820 -0
- package/layer/app/components/project/Share.vue +135 -0
- package/layer/app/components/project/Watch.vue +273 -0
- package/layer/app/composables/useOipProjectKinds.ts +71 -0
- package/layer/app/composables/useOipResourceHooks.ts +8 -3
- package/layer/app/composables/useProjectDashboard.ts +22 -0
- package/layer/app/composables/useProjects.ts +646 -0
- package/layer/app/oip-defaults/projects.ts +175 -0
- package/layer/app/pages/projects/[id].vue +8 -0
- package/layer/app/pages/projects/index.vue +8 -0
- package/layer/app/types/projects.ts +168 -0
- package/layer/app/utils/projectNoteWelcome.ts +137 -0
- package/layer/nuxt.config.ts +16 -0
- package/layer/server/api/oip/sharing/artifacts.get.ts +44 -0
- package/package.json +2 -1
package/dist/module.json
CHANGED
|
@@ -6,41 +6,50 @@
|
|
|
6
6
|
devient l'actif sans quitter la page. Renommer et supprimer restent sur la
|
|
7
7
|
page du projet.
|
|
8
8
|
|
|
9
|
-
Les projets vivent dans la Virtual Lab API
|
|
10
|
-
|
|
11
|
-
`
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
Les projets vivent dans la Virtual Lab API. Par defaut le panneau se
|
|
10
|
+
branche seul sur les projets du layer (useProjects, ProjectNewButton,
|
|
11
|
+
`PROJECTS_PATH`) : l'app n'a rien a lui passer. Une app qui tient ses
|
|
12
|
+
projets elle-meme passe la liste et les gestes par `panelProps.Projects`
|
|
13
|
+
(cf. les props ci-dessous ; `projects` present = branchement de l'app), et
|
|
14
|
+
son bouton de creation assistee par `newButton` (un composant qui emet
|
|
15
|
+
`free` pour ouvrir le formulaire simple).
|
|
16
|
+
|
|
17
|
+
Sans acces aux projets (`useProjectsAccess` de #oip-app/projects) : le
|
|
18
|
+
panneau `PROJECTS_UPSELL`.
|
|
14
19
|
-->
|
|
15
20
|
<template>
|
|
21
|
+
<component :is="PROJECTS_UPSELL" v-if="wired && !allowed && PROJECTS_UPSELL" :feature="FEATURE" />
|
|
16
22
|
<RmProjectPanel
|
|
17
|
-
|
|
18
|
-
:
|
|
19
|
-
:active-
|
|
20
|
-
:
|
|
21
|
-
:
|
|
23
|
+
v-else-if="!wired || allowed"
|
|
24
|
+
:projects="list"
|
|
25
|
+
:active-id="active"
|
|
26
|
+
:active-count="count"
|
|
27
|
+
:loading="isLoading"
|
|
28
|
+
:failed="hasFailed"
|
|
22
29
|
:creating="creating"
|
|
23
|
-
:all-to="
|
|
30
|
+
:all-to="allLink"
|
|
24
31
|
:lang="locale === 'en' ? 'en' : 'fr'"
|
|
25
32
|
@activate="activate"
|
|
26
|
-
@open="
|
|
27
|
-
@pin="
|
|
33
|
+
@open="open"
|
|
34
|
+
@pin="pin"
|
|
28
35
|
@create="onCreate"
|
|
29
36
|
>
|
|
30
|
-
<template v-if="
|
|
31
|
-
<component :is="
|
|
37
|
+
<template v-if="button" #new="{ openForm }">
|
|
38
|
+
<component :is="button" size="sm" @free="openForm" />
|
|
32
39
|
</template>
|
|
33
40
|
</RmProjectPanel>
|
|
34
41
|
</template>
|
|
35
42
|
|
|
36
43
|
<script setup lang="ts">
|
|
37
|
-
import type
|
|
44
|
+
import { resolveComponent, type Component } from "vue";
|
|
38
45
|
import type { RmProject } from "@tekkare/romulus/utils/projects";
|
|
46
|
+
import { PROJECTS_PATH, PROJECTS_UPSELL, useProjectsAccess } from "#oip-projects";
|
|
39
47
|
|
|
40
48
|
const props = withDefaults(
|
|
41
49
|
defineProps<{
|
|
42
50
|
appKey?: string;
|
|
43
51
|
superAdmin?: boolean;
|
|
52
|
+
/** Liste de l'app. Absente : les projets du layer (useProjects). */
|
|
44
53
|
projects?: RmProject[];
|
|
45
54
|
activeId?: string | null;
|
|
46
55
|
/** Elements du projet actif. */
|
|
@@ -58,7 +67,7 @@ const props = withDefaults(
|
|
|
58
67
|
newButton?: Component | null;
|
|
59
68
|
}>(),
|
|
60
69
|
{
|
|
61
|
-
projects:
|
|
70
|
+
projects: undefined,
|
|
62
71
|
activeId: null,
|
|
63
72
|
activeCount: 0,
|
|
64
73
|
loading: false,
|
|
@@ -79,23 +88,63 @@ const emit = defineEmits<{
|
|
|
79
88
|
close: [];
|
|
80
89
|
}>();
|
|
81
90
|
|
|
91
|
+
const FEATURE = { fr: "Projets", en: "Projects" };
|
|
92
|
+
|
|
82
93
|
const { locale } = useI18n();
|
|
94
|
+
const router = useRouter();
|
|
95
|
+
const localePath = useLocalePath();
|
|
83
96
|
const creating = ref(false);
|
|
84
97
|
|
|
98
|
+
/** Branche sur les projets du layer quand l'app ne passe pas les siens. */
|
|
99
|
+
const wired = props.projects === undefined;
|
|
100
|
+
const own = wired ? useProjects() : null;
|
|
101
|
+
const allowed = useProjectsAccess();
|
|
102
|
+
const newProjectButton = resolveComponent("ProjectNewButton");
|
|
103
|
+
|
|
104
|
+
const list = computed(() => (own ? own.rmProjects.value : props.projects ?? []));
|
|
105
|
+
const active = computed(() => (own ? own.activeId.value : props.activeId));
|
|
106
|
+
const count = computed(() => (own ? own.items.value.length : props.activeCount));
|
|
107
|
+
const isLoading = computed(() => (own ? own.pending.value : props.loading));
|
|
108
|
+
const hasFailed = computed(() => (own ? !!own.failure.value : props.failed));
|
|
109
|
+
const allLink = computed(() => (own ? localePath(PROJECTS_PATH) : props.allTo));
|
|
110
|
+
const button = computed(() => (own ? newProjectButton : props.newButton));
|
|
111
|
+
|
|
85
112
|
async function onCreate(title: string) {
|
|
86
|
-
|
|
113
|
+
const create = own
|
|
114
|
+
? async (name: string) => {
|
|
115
|
+
const project = await own.create(name);
|
|
116
|
+
own.setActive(project.id);
|
|
117
|
+
}
|
|
118
|
+
: props.create;
|
|
119
|
+
if (!create) return;
|
|
87
120
|
creating.value = true;
|
|
88
121
|
try {
|
|
89
|
-
await
|
|
122
|
+
await create(title);
|
|
90
123
|
} finally {
|
|
91
124
|
creating.value = false;
|
|
92
125
|
}
|
|
93
126
|
}
|
|
94
127
|
|
|
95
128
|
function activate(id: string) {
|
|
96
|
-
|
|
129
|
+
if (own) own.setActive(id);
|
|
130
|
+
else emit("activate", id);
|
|
97
131
|
emit("close");
|
|
98
132
|
}
|
|
99
133
|
|
|
100
|
-
|
|
134
|
+
function open(id: string) {
|
|
135
|
+
if (own) router.push(own.pathOf(id));
|
|
136
|
+
else emit("open", id);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function pin(id: string) {
|
|
140
|
+
if (own) own.togglePin(id);
|
|
141
|
+
else emit("pin", id);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
onMounted(() => {
|
|
145
|
+
if (own) own.restoreActive();
|
|
146
|
+
emit("mounted");
|
|
147
|
+
});
|
|
148
|
+
// L'acces (une licence) peut arriver apres le montage : la liste se charge quand il est su.
|
|
149
|
+
if (own) watch(allowed, (on) => on && own.load(), { immediate: true });
|
|
101
150
|
</script>
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Bouton « Projet » d'une carte ou d'un en-tete : RmProjectAddButton branche
|
|
3
|
+
sur le projet actif (cf. useProjects).
|
|
4
|
+
|
|
5
|
+
Il se pose dans le slot `#actions` d'une RmResultCard. La carte s'inscrit
|
|
6
|
+
aupres du cadre tant qu'elle est a l'ecran : c'est ce qui permet au bandeau
|
|
7
|
+
de proposer « Ajouter la page » sans que chaque page declare ce qu'elle
|
|
8
|
+
affiche.
|
|
9
|
+
-->
|
|
10
|
+
<template>
|
|
11
|
+
<RmProjectAddButton
|
|
12
|
+
v-if="ids.length"
|
|
13
|
+
v-model:archived="archived"
|
|
14
|
+
:in-project="inProject"
|
|
15
|
+
:needs-project="!projects.activeId.value"
|
|
16
|
+
:compact="compact"
|
|
17
|
+
:loading="busy"
|
|
18
|
+
:error="error"
|
|
19
|
+
:projects="projects.rmProjects.value"
|
|
20
|
+
:projects-loading="projects.pending.value"
|
|
21
|
+
:projects-failed="!!projects.failure.value"
|
|
22
|
+
:creating="creating"
|
|
23
|
+
:lang="projects.lang.value"
|
|
24
|
+
@toggle="toggle"
|
|
25
|
+
@pick="projects.load()"
|
|
26
|
+
@choose="chooseAndAdd"
|
|
27
|
+
@create="createAndAdd"
|
|
28
|
+
@unarchive="confirmUnarchive"
|
|
29
|
+
/>
|
|
30
|
+
</template>
|
|
31
|
+
|
|
32
|
+
<script setup lang="ts">
|
|
33
|
+
import type { ProjectResourceId } from "../../composables/useProjects";
|
|
34
|
+
|
|
35
|
+
const props = defineProps<{
|
|
36
|
+
/** `_id` Elasticsearch du document, cf. useOipProjectKinds. Une liste quand la carte en porte plusieurs. */
|
|
37
|
+
resourceId: ProjectResourceId | null | undefined;
|
|
38
|
+
/** Le `resourceType` de l'API, cle de OIP_RESOURCE_SPECS. */
|
|
39
|
+
type: string;
|
|
40
|
+
/** Icone seule : la carte de resultat porte deja ses autres actions en icones. */
|
|
41
|
+
compact?: boolean;
|
|
42
|
+
/** Titre de la carte : ce que le bandeau nomme quand une fiche est archivee. */
|
|
43
|
+
label?: string;
|
|
44
|
+
}>();
|
|
45
|
+
|
|
46
|
+
const projects = useProjects();
|
|
47
|
+
|
|
48
|
+
const busy = ref(false);
|
|
49
|
+
const creating = ref(false);
|
|
50
|
+
const archived = ref(false);
|
|
51
|
+
const error = ref("");
|
|
52
|
+
|
|
53
|
+
const ids = computed(() => {
|
|
54
|
+
const raw = Array.isArray(props.resourceId) ? props.resourceId : [props.resourceId];
|
|
55
|
+
return raw.filter((value) => value != null && value !== "").map(String);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
const inProject = computed(() => projects.has(ids.value, props.type));
|
|
59
|
+
|
|
60
|
+
const registryKey = computed(() => `${props.type}:${ids.value.join(",")}`);
|
|
61
|
+
|
|
62
|
+
onMounted(() => projects.restoreActive());
|
|
63
|
+
|
|
64
|
+
watch(
|
|
65
|
+
[registryKey, () => props.label],
|
|
66
|
+
([key, label], [previous]) => {
|
|
67
|
+
if (previous && previous !== key) projects.unregisterAddable(previous);
|
|
68
|
+
if (!ids.value.length) return;
|
|
69
|
+
projects.registerAddable(key, { ids: ids.value, resourceType: props.type, label: label ?? "" });
|
|
70
|
+
},
|
|
71
|
+
{ immediate: true },
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
onBeforeUnmount(() => projects.unregisterAddable(registryKey.value));
|
|
75
|
+
|
|
76
|
+
function reason(err: any) {
|
|
77
|
+
return err?.data?.message || err?.message || "";
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
async function run(task: () => Promise<unknown>) {
|
|
81
|
+
busy.value = true;
|
|
82
|
+
error.value = "";
|
|
83
|
+
try {
|
|
84
|
+
await task();
|
|
85
|
+
} catch (err) {
|
|
86
|
+
error.value = reason(err);
|
|
87
|
+
} finally {
|
|
88
|
+
busy.value = false;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function toggle() {
|
|
93
|
+
return run(async () => {
|
|
94
|
+
if (inProject.value) return projects.remove(ids.value, props.type);
|
|
95
|
+
const response = await projects.add(ids.value, props.type);
|
|
96
|
+
// Refusee parce qu'archivee : la question se pose, elle ne se tranche pas.
|
|
97
|
+
if (projects.archivedOf(response).length) archived.value = true;
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function chooseAndAdd(projectId: string) {
|
|
102
|
+
projects.setActive(projectId);
|
|
103
|
+
return run(async () => {
|
|
104
|
+
const response = await projects.add(ids.value, props.type, projectId);
|
|
105
|
+
if (projects.archivedOf(response).length) archived.value = true;
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
async function createAndAdd(title: string) {
|
|
110
|
+
creating.value = true;
|
|
111
|
+
try {
|
|
112
|
+
const project = await projects.create(title);
|
|
113
|
+
await chooseAndAdd(project.id);
|
|
114
|
+
} catch (err) {
|
|
115
|
+
error.value = reason(err);
|
|
116
|
+
} finally {
|
|
117
|
+
creating.value = false;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function confirmUnarchive() {
|
|
122
|
+
return run(async () => {
|
|
123
|
+
await projects.unarchive(ids.value, props.type);
|
|
124
|
+
archived.value = false;
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
</script>
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Bandeau du projet actif : RmProjectBanner branche sur useProjects.
|
|
3
|
+
|
|
4
|
+
Servi par le layer OIP : l'app le pose une fois dans son cadre
|
|
5
|
+
(layout/shell.vue, slot `header-after` d'OipShell), sur toutes les pages.
|
|
6
|
+
C'est lui qui restaure le projet actif au chargement, et la liste des
|
|
7
|
+
projets (le bandeau nomme le projet, seul le nom vient de la liste). Sur la
|
|
8
|
+
page d'un projet, il redirait ce que la page affiche : seul le rendu se
|
|
9
|
+
coupe.
|
|
10
|
+
-->
|
|
11
|
+
<template>
|
|
12
|
+
<RmProjectBanner
|
|
13
|
+
v-if="projects.active.value && !onProjectPage"
|
|
14
|
+
:title="projects.active.value.title"
|
|
15
|
+
:to="projects.pathOf(projects.active.value.id)"
|
|
16
|
+
:count="projects.items.value.length"
|
|
17
|
+
:addable="projects.pageAddable.value.length"
|
|
18
|
+
:adding="adding"
|
|
19
|
+
:archived="archived"
|
|
20
|
+
:unarchiving="unarchiving"
|
|
21
|
+
:lang="projects.lang.value"
|
|
22
|
+
@add-page="addPage"
|
|
23
|
+
@open="router.push(projects.pathOf(projects.activeId.value!))"
|
|
24
|
+
@leave="projects.setActive(null)"
|
|
25
|
+
@unarchive="confirmUnarchive"
|
|
26
|
+
@dismiss-archived="archived = []"
|
|
27
|
+
/>
|
|
28
|
+
</template>
|
|
29
|
+
|
|
30
|
+
<script setup lang="ts">
|
|
31
|
+
import type { RmProjectArchivedEntry } from "@tekkare/romulus/utils/projects";
|
|
32
|
+
import { PROJECTS_PATH } from "#oip-projects";
|
|
33
|
+
|
|
34
|
+
const projects = useProjects();
|
|
35
|
+
const router = useRouter();
|
|
36
|
+
const route = useRoute();
|
|
37
|
+
|
|
38
|
+
const onProjectPage = computed(() => route.path.includes(`${PROJECTS_PATH}/`));
|
|
39
|
+
|
|
40
|
+
onMounted(() => {
|
|
41
|
+
projects.restoreActive();
|
|
42
|
+
if (projects.activeId.value) projects.load();
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const adding = ref(false);
|
|
46
|
+
const archived = ref<RmProjectArchivedEntry[]>([]);
|
|
47
|
+
const unarchiving = ref(false);
|
|
48
|
+
|
|
49
|
+
async function addPage() {
|
|
50
|
+
if (adding.value) return;
|
|
51
|
+
adding.value = true;
|
|
52
|
+
try {
|
|
53
|
+
archived.value = await projects.addPage();
|
|
54
|
+
} finally {
|
|
55
|
+
adding.value = false;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
async function confirmUnarchive() {
|
|
60
|
+
unarchiving.value = true;
|
|
61
|
+
try {
|
|
62
|
+
await projects.unarchiveEntries(archived.value);
|
|
63
|
+
archived.value = [];
|
|
64
|
+
} finally {
|
|
65
|
+
unarchiving.value = false;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
</script>
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
L'onglet « Tableau de bord » d'un projet : RmDashboard branche sur le
|
|
3
|
+
catalogue de l'app (`PROJECT_DASHBOARD_WIDGETS` de #oip-app/projects, sinon
|
|
4
|
+
le seul contenu du projet) et sur l'API des projets (useProjectDashboard).
|
|
5
|
+
Repris de France Augmented Science et d'OIP Case Atlas.
|
|
6
|
+
|
|
7
|
+
Les widgets decrivent ce que le projet range, a partir des documents que la
|
|
8
|
+
page a deja relus. Ce que le layer ajoute au paquet :
|
|
9
|
+
- la source de chaque entree : le contenu du projet, lu a l'instant ;
|
|
10
|
+
- l'export de l'onglet (tuile Export du rail, rapport PDF) : un onglet de
|
|
11
|
+
classeur par widget, avec ses nombres bruts.
|
|
12
|
+
-->
|
|
13
|
+
<template>
|
|
14
|
+
<RmDashboard
|
|
15
|
+
ref="board"
|
|
16
|
+
:widgets="widgets"
|
|
17
|
+
:catalog="PROJECT_DASHBOARD_WIDGETS"
|
|
18
|
+
:context="context"
|
|
19
|
+
:source-of="sourceOf"
|
|
20
|
+
:loading="loading"
|
|
21
|
+
:failed="failed"
|
|
22
|
+
:saving="saving"
|
|
23
|
+
:save-failed="saveFailed"
|
|
24
|
+
:lang="lang"
|
|
25
|
+
:empty-text="PROJECT_WORDING.dashboard[lang]"
|
|
26
|
+
@update:widgets="update"
|
|
27
|
+
@load="load"
|
|
28
|
+
@retry-save="retrySave"
|
|
29
|
+
/>
|
|
30
|
+
</template>
|
|
31
|
+
|
|
32
|
+
<script setup lang="ts">
|
|
33
|
+
import type { RmExportSheet } from "@tekkare/romulus/utils/export";
|
|
34
|
+
import type { RmWidgetSource } from "@tekkare/romulus/utils/dashboard";
|
|
35
|
+
import { PROJECT_DASHBOARD_WIDGETS, PROJECT_WORDING } from "#oip-projects";
|
|
36
|
+
import type { OipProjectWidgetContext as WidgetContext } from "../../oip-defaults/projects";
|
|
37
|
+
import { visibleExportCharts } from "../../utils/exportPage";
|
|
38
|
+
|
|
39
|
+
type Lang = "fr" | "en";
|
|
40
|
+
|
|
41
|
+
const props = defineProps<{
|
|
42
|
+
projectId: string;
|
|
43
|
+
projectTitle: string;
|
|
44
|
+
groups: WidgetContext["groups"];
|
|
45
|
+
docs: WidgetContext["docs"];
|
|
46
|
+
lang: Lang;
|
|
47
|
+
}>();
|
|
48
|
+
|
|
49
|
+
const en = computed(() => props.lang === "en");
|
|
50
|
+
|
|
51
|
+
const { widgets, loading, failed, saving, saveFailed, load, update, retrySave } = useProjectDashboard(props.projectId);
|
|
52
|
+
onMounted(load);
|
|
53
|
+
|
|
54
|
+
const context = computed<WidgetContext>(() => ({
|
|
55
|
+
brands: [],
|
|
56
|
+
lang: props.lang,
|
|
57
|
+
groups: props.groups,
|
|
58
|
+
docs: props.docs,
|
|
59
|
+
}));
|
|
60
|
+
|
|
61
|
+
/** Le contenu du projet n'a pas de producteur public : c'est le projet, lu a l'instant. */
|
|
62
|
+
function sourceOf(): RmWidgetSource {
|
|
63
|
+
return {
|
|
64
|
+
name: en.value ? "Project content" : "Contenu du projet",
|
|
65
|
+
verified: new Date().toISOString().slice(0, 10),
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// --- Export -----------------------------------------------------------------------
|
|
70
|
+
|
|
71
|
+
const board = ref<{ exportSheets: () => RmExportSheet[] } | null>(null);
|
|
72
|
+
|
|
73
|
+
useExportSource().declare(() => {
|
|
74
|
+
const sheets = board.value?.exportSheets() ?? [];
|
|
75
|
+
if (!sheets.length) return null;
|
|
76
|
+
const title = `${props.projectTitle}, ${en.value ? "dashboard" : "tableau de bord"}`;
|
|
77
|
+
return {
|
|
78
|
+
title,
|
|
79
|
+
fileName: title,
|
|
80
|
+
sheets,
|
|
81
|
+
layout: "table",
|
|
82
|
+
charts: () => visibleExportCharts(),
|
|
83
|
+
};
|
|
84
|
+
});
|
|
85
|
+
</script>
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
« Quitter sans enregistrer ? » : posee au-dessus d'une fenetre de creation
|
|
3
|
+
quand on la ferme apres avoir commence a la remplir. Une fermeture par la
|
|
4
|
+
croix, un clic a cote ou Echap ne doit pas perdre ce qui a ete tape.
|
|
5
|
+
-->
|
|
6
|
+
<template>
|
|
7
|
+
<RmModal
|
|
8
|
+
:model-value="modelValue"
|
|
9
|
+
size="sm"
|
|
10
|
+
mode="free"
|
|
11
|
+
:label="locale === 'en' ? 'Leave without saving?' : 'Quitter sans enregistrer ?'"
|
|
12
|
+
@update:model-value="emit('update:modelValue', $event)"
|
|
13
|
+
>
|
|
14
|
+
<template #header>
|
|
15
|
+
<p class="prj_dc_title">
|
|
16
|
+
{{ locale === "en" ? "Leave without saving?" : "Quitter sans enregistrer ?" }}
|
|
17
|
+
</p>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<p class="prj_dc_text">
|
|
21
|
+
{{
|
|
22
|
+
locale === "en"
|
|
23
|
+
? "What you entered will be lost."
|
|
24
|
+
: "Ce que vous avez saisi sera perdu."
|
|
25
|
+
}}
|
|
26
|
+
</p>
|
|
27
|
+
|
|
28
|
+
<template #footer>
|
|
29
|
+
<div class="prj_dc_actions">
|
|
30
|
+
<RmButton variant="tertiary" @click="emit('update:modelValue', false)">
|
|
31
|
+
{{ locale === "en" ? "Keep editing" : "Continuer la saisie" }}
|
|
32
|
+
</RmButton>
|
|
33
|
+
<RmButton variant="danger" @click="discard">
|
|
34
|
+
{{ locale === "en" ? "Leave" : "Quitter" }}
|
|
35
|
+
</RmButton>
|
|
36
|
+
</div>
|
|
37
|
+
</template>
|
|
38
|
+
</RmModal>
|
|
39
|
+
</template>
|
|
40
|
+
|
|
41
|
+
<script setup lang="ts">
|
|
42
|
+
defineProps<{ modelValue: boolean }>();
|
|
43
|
+
const emit = defineEmits<{
|
|
44
|
+
(event: "update:modelValue", value: boolean): void;
|
|
45
|
+
(event: "discard"): void;
|
|
46
|
+
}>();
|
|
47
|
+
|
|
48
|
+
const { locale } = useI18n();
|
|
49
|
+
|
|
50
|
+
function discard() {
|
|
51
|
+
emit("update:modelValue", false);
|
|
52
|
+
emit("discard");
|
|
53
|
+
}
|
|
54
|
+
</script>
|
|
55
|
+
|
|
56
|
+
<style scoped>
|
|
57
|
+
.prj_dc_title {
|
|
58
|
+
margin: 0;
|
|
59
|
+
font-size: 16px;
|
|
60
|
+
font-weight: 600;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.prj_dc_text {
|
|
64
|
+
margin: 0;
|
|
65
|
+
font-size: 14px;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.prj_dc_actions {
|
|
69
|
+
display: flex;
|
|
70
|
+
justify-content: flex-end;
|
|
71
|
+
align-items: center;
|
|
72
|
+
gap: 8px;
|
|
73
|
+
}
|
|
74
|
+
</style>
|