@tekkare/romulus 0.1.249 → 0.1.250
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
CHANGED
|
@@ -17,9 +17,16 @@
|
|
|
17
17
|
main : une note qu'on rallonge annoncerait sinon une duree fausse. La date,
|
|
18
18
|
elle, vient de l'appelant — c'est une date de revision editoriale, que rien
|
|
19
19
|
dans le contenu ne permet de deviner.
|
|
20
|
+
|
|
21
|
+
`openId` sert au lecteur qui arrive par un renvoi (le « i » d'un filtre) :
|
|
22
|
+
la note qu'il est venu chercher s'ouvre depliee et defile en vue, au lieu
|
|
23
|
+
d'une liste repliee ou il devrait la retrouver. La recherche et la pastille
|
|
24
|
+
sont remises a zero, sinon la note pourrait etre filtree hors de la liste.
|
|
25
|
+
Le depliage n'a lieu qu'une fois par identifiant : un rechargement des notes
|
|
26
|
+
ne rouvre pas une note que le lecteur vient de replier.
|
|
20
27
|
-->
|
|
21
28
|
<script setup lang="ts">
|
|
22
|
-
import { computed, ref } from 'vue'
|
|
29
|
+
import { computed, nextTick, ref, watch } from 'vue'
|
|
23
30
|
|
|
24
31
|
export type RmNoteTone = 'primary' | 'info' | 'warning' | 'success' | 'neutral'
|
|
25
32
|
|
|
@@ -90,6 +97,11 @@ const props = withDefaults(defineProps<{
|
|
|
90
97
|
*/
|
|
91
98
|
editable?: boolean
|
|
92
99
|
lang?: 'fr' | 'en'
|
|
100
|
+
/**
|
|
101
|
+
* Note a ouvrir depliee et a montrer. Attendue meme si les notes arrivent
|
|
102
|
+
* apres (chargement distant) : elle s'ouvre des qu'elle est dans la liste.
|
|
103
|
+
*/
|
|
104
|
+
openId?: string | null
|
|
93
105
|
}>(), {
|
|
94
106
|
categories: () => [],
|
|
95
107
|
title: 'Notes',
|
|
@@ -97,6 +109,7 @@ const props = withDefaults(defineProps<{
|
|
|
97
109
|
badge: undefined,
|
|
98
110
|
editable: false,
|
|
99
111
|
lang: 'fr',
|
|
112
|
+
openId: null,
|
|
100
113
|
})
|
|
101
114
|
|
|
102
115
|
const emit = defineEmits<{ navigate: [to: string], edit: [id: string] }>()
|
|
@@ -136,6 +149,30 @@ const search = ref('')
|
|
|
136
149
|
const category = ref('all')
|
|
137
150
|
const open = ref<string[]>([])
|
|
138
151
|
|
|
152
|
+
const root = ref<HTMLElement | null>(null)
|
|
153
|
+
let revealed: string | null = null
|
|
154
|
+
|
|
155
|
+
watch(
|
|
156
|
+
() => [props.openId, props.notes] as const,
|
|
157
|
+
([id]) => {
|
|
158
|
+
if (!id) {
|
|
159
|
+
revealed = null
|
|
160
|
+
return
|
|
161
|
+
}
|
|
162
|
+
if (id === revealed || !props.notes.some(note => note.id === id)) return
|
|
163
|
+
revealed = id
|
|
164
|
+
search.value = ''
|
|
165
|
+
category.value = 'all'
|
|
166
|
+
if (!open.value.includes(id)) open.value = [...open.value, id]
|
|
167
|
+
nextTick(() => {
|
|
168
|
+
root.value
|
|
169
|
+
?.querySelector(`[data-note-id="${CSS.escape(id)}"]`)
|
|
170
|
+
?.scrollIntoView({ block: 'start' })
|
|
171
|
+
})
|
|
172
|
+
},
|
|
173
|
+
{ immediate: true },
|
|
174
|
+
)
|
|
175
|
+
|
|
139
176
|
function toggle(id: string) {
|
|
140
177
|
open.value = open.value.includes(id)
|
|
141
178
|
? open.value.filter(item => item !== id)
|
|
@@ -237,7 +274,7 @@ function onLink(to: string) {
|
|
|
237
274
|
</script>
|
|
238
275
|
|
|
239
276
|
<template>
|
|
240
|
-
<div class="rm-notes">
|
|
277
|
+
<div ref="root" class="rm-notes">
|
|
241
278
|
<div class="rm-notes__head">
|
|
242
279
|
<h2 v-if="title" class="rm-notes__title">{{ title }}</h2>
|
|
243
280
|
<span v-if="badge" class="rm-notes__badge">
|
|
@@ -290,6 +327,7 @@ function onLink(to: string) {
|
|
|
290
327
|
<article
|
|
291
328
|
v-for="note in shown"
|
|
292
329
|
:key="note.id"
|
|
330
|
+
:data-note-id="note.id"
|
|
293
331
|
class="rm-notes__note"
|
|
294
332
|
:class="{ 'rm-notes__note--open': open.includes(note.id) }"
|
|
295
333
|
>
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
badge="Tekkare"
|
|
30
30
|
:lang="locale === 'en' ? 'en' : 'fr'"
|
|
31
31
|
:editable="superAdmin"
|
|
32
|
+
:open-id="openId"
|
|
32
33
|
@navigate="go"
|
|
33
34
|
@edit="openEditor"
|
|
34
35
|
/>
|
|
@@ -60,8 +61,10 @@ const props = withDefaults(
|
|
|
60
61
|
showOrigin?: boolean;
|
|
61
62
|
/** Notes encore ecrites dans le code de l'app (cf. useOipNotes). */
|
|
62
63
|
localNotes?: Note[];
|
|
64
|
+
/** Note a ouvrir depliee : le « i » d'un filtre renvoie a sa note. */
|
|
65
|
+
openId?: string | null;
|
|
63
66
|
}>(),
|
|
64
|
-
{ sourceUuids: () => [], superAdmin: false, showOrigin: undefined, localNotes: () => [] },
|
|
67
|
+
{ openId: null, sourceUuids: () => [], superAdmin: false, showOrigin: undefined, localNotes: () => [] },
|
|
65
68
|
);
|
|
66
69
|
|
|
67
70
|
const { locale } = useI18n();
|