@tekkare/romulus 0.1.226 → 0.1.227

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
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.16.0"
6
6
  },
7
- "version": "0.1.225",
7
+ "version": "0.1.226",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "0.8.4",
10
10
  "unbuild": "2.0.0"
@@ -13,7 +13,7 @@
13
13
  bouton qui disparait n'apprend pas pourquoi.
14
14
  -->
15
15
  <script setup lang="ts">
16
- import { computed } from 'vue'
16
+ import { computed, reactive } from 'vue'
17
17
  import type { RmAlert, RmAlertEvent, RmAlertMenuItem } from '../utils/alerts'
18
18
 
19
19
  const props = withDefaults(
@@ -36,6 +36,12 @@ const props = withDefaults(
36
36
  expandedEvents?: RmAlertEvent[]
37
37
  expandedLoading?: boolean
38
38
  lang?: 'fr' | 'en'
39
+ /**
40
+ * Sections rendues repliees, par leur libelle (`group`). Pour ce qui se
41
+ * consulte rarement, comme les alertes posees depuis une autre app : la
42
+ * liste reste complete sans que ces cartes passent devant.
43
+ */
44
+ collapsedGroups?: string[]
39
45
  }>(),
40
46
  {
41
47
  events: () => [],
@@ -49,6 +55,7 @@ const props = withDefaults(
49
55
  expandedEvents: () => [],
50
56
  expandedLoading: false,
51
57
  lang: 'fr',
58
+ collapsedGroups: () => [],
52
59
  },
53
60
  )
54
61
 
@@ -129,6 +136,9 @@ const sections = computed(() => {
129
136
  return order.map((label) => ({ label, alerts: byLabel.get(label)! }))
130
137
  })
131
138
 
139
+ /** Sections repliables ouvertes a la main. Toutes fermees au depart. */
140
+ const opened = reactive<Record<string, boolean>>({})
141
+
132
142
  const unreadTotal = computed(() =>
133
143
  props.alerts.reduce((total, alert) => total + (alert.unreadCount ?? 0), 0),
134
144
  )
@@ -200,30 +210,52 @@ function setTab(value: 'active' | 'paused' | 'events') {
200
210
 
201
211
  <template v-else>
202
212
  <div v-if="sections.length" class="rm-alerts__list">
203
- <section
204
- v-for="section in sections"
205
- :key="section.label"
206
- class="rm-alerts__section"
207
- >
208
- <h3 v-if="section.label" class="rm-alerts__section-title">
209
- {{ section.label }}
210
- <span class="rm-alerts__section-count">{{ section.alerts.length }}</span>
211
- </h3>
212
- <RmAlertCard
213
- v-for="alert in section.alerts"
214
- :key="alert.id"
215
- :alert="alert"
216
- :menu="menu"
217
- :lang="lang"
218
- :on-watched-page="onWatchedPage"
219
- :expanded="expandedId === alert.id"
220
- :events="expandedId === alert.id ? expandedEvents : []"
221
- :events-loading="expandedId === alert.id && expandedLoading"
222
- @open="emit('open', $event)"
223
- @rearm="emit('rearm', $event)"
224
- @menu="emit('menu', $event)"
225
- />
226
- </section>
213
+ <template v-for="section in sections" :key="section.label">
214
+ <RmCollapse
215
+ v-if="section.label && collapsedGroups.includes(section.label)"
216
+ :model-value="!!opened[section.label]"
217
+ :title="section.label"
218
+ :count="section.alerts.length"
219
+ @update:model-value="opened[section.label] = $event"
220
+ >
221
+ <div class="rm-alerts__section">
222
+ <RmAlertCard
223
+ v-for="alert in section.alerts"
224
+ :key="alert.id"
225
+ :alert="alert"
226
+ :menu="menu"
227
+ :lang="lang"
228
+ :on-watched-page="onWatchedPage"
229
+ :expanded="expandedId === alert.id"
230
+ :events="expandedId === alert.id ? expandedEvents : []"
231
+ :events-loading="expandedId === alert.id && expandedLoading"
232
+ @open="emit('open', $event)"
233
+ @rearm="emit('rearm', $event)"
234
+ @menu="emit('menu', $event)"
235
+ />
236
+ </div>
237
+ </RmCollapse>
238
+ <section v-else class="rm-alerts__section">
239
+ <h3 v-if="section.label" class="rm-alerts__section-title">
240
+ {{ section.label }}
241
+ <span class="rm-alerts__section-count">{{ section.alerts.length }}</span>
242
+ </h3>
243
+ <RmAlertCard
244
+ v-for="alert in section.alerts"
245
+ :key="alert.id"
246
+ :alert="alert"
247
+ :menu="menu"
248
+ :lang="lang"
249
+ :on-watched-page="onWatchedPage"
250
+ :expanded="expandedId === alert.id"
251
+ :events="expandedId === alert.id ? expandedEvents : []"
252
+ :events-loading="expandedId === alert.id && expandedLoading"
253
+ @open="emit('open', $event)"
254
+ @rearm="emit('rearm', $event)"
255
+ @menu="emit('menu', $event)"
256
+ />
257
+ </section>
258
+ </template>
227
259
  </div>
228
260
 
229
261
  <!-- Meme etat vide que les vues : cadre pointille, cloche teintee quand
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tekkare/romulus",
3
- "version": "0.1.226",
3
+ "version": "0.1.227",
4
4
  "description": "Romulus Design System - Nuxt module by Tekkare",
5
5
  "license": "MIT",
6
6
  "type": "module",