@quazardous/qdadm 2.51.0 → 2.53.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/dist/node/cards/tools/cardsTool.d.ts +32 -0
- package/dist/node/cards/tools/cardsTool.js +151 -0
- package/dist/node/cards/tools/cli.d.ts +2 -0
- package/dist/node/cards/tools/cli.js +38 -0
- package/dist/node/cards/validate.d.ts +35 -0
- package/dist/node/cards/validate.js +94 -0
- package/dist/styles/qdadm.css +1 -1
- package/package.json +7 -2
- package/src/board/QdBoardBlock.vue +67 -0
- package/src/board/QdDomainBoard.vue +64 -0
- package/src/board/blocks/BreakdownBlock.vue +44 -0
- package/src/board/blocks/KpiBlock.vue +31 -0
- package/src/board/blocks/TimelineBlock.vue +63 -0
- package/src/board/blocks/TopBlock.vue +57 -0
- package/src/board/blocks/schemas.ts +107 -0
- package/src/board/index.ts +31 -0
- package/src/board/registry.ts +33 -0
- package/src/board/types.ts +32 -0
- package/src/cards/QdCard.vue +175 -0
- package/src/cards/QdCardView.vue +53 -0
- package/src/cards/QdCardsGallery.vue +103 -0
- package/src/cards/QdFavoritesCard.vue +50 -0
- package/src/cards/QdRecentCard.vue +44 -0
- package/src/cards/builtin/agenda/AgendaCard.vue +37 -0
- package/src/cards/builtin/agenda/meta.json +60 -0
- package/src/cards/builtin/agenda/schema.json +48 -0
- package/src/cards/builtin/bullet/BulletCard.vue +76 -0
- package/src/cards/builtin/bullet/meta.json +38 -0
- package/src/cards/builtin/bullet/schema.json +18 -0
- package/src/cards/builtin/cards-index.json +1694 -0
- package/src/cards/builtin/compare/CompareCard.vue +47 -0
- package/src/cards/builtin/compare/meta.json +79 -0
- package/src/cards/builtin/compare/schema.json +40 -0
- package/src/cards/builtin/favorites/FavoritesCard.vue +50 -0
- package/src/cards/builtin/favorites/meta.json +33 -0
- package/src/cards/builtin/favorites/schema.json +20 -0
- package/src/cards/builtin/feed/FeedCard.vue +39 -0
- package/src/cards/builtin/feed/meta.json +64 -0
- package/src/cards/builtin/feed/schema.json +54 -0
- package/src/cards/builtin/funnel/FunnelCard.vue +44 -0
- package/src/cards/builtin/funnel/meta.json +53 -0
- package/src/cards/builtin/funnel/schema.json +37 -0
- package/src/cards/builtin/goal/GoalCard.vue +73 -0
- package/src/cards/builtin/goal/meta.json +43 -0
- package/src/cards/builtin/goal/schema.json +12 -0
- package/src/cards/builtin/heat/HeatCard.vue +46 -0
- package/src/cards/builtin/heat/meta.json +101 -0
- package/src/cards/builtin/heat/schema.json +39 -0
- package/src/cards/builtin/index.ts +71 -0
- package/src/cards/builtin/metric/MetricCard.vue +82 -0
- package/src/cards/builtin/metric/meta.json +109 -0
- package/src/cards/builtin/metric/schema.json +35 -0
- package/src/cards/builtin/pills.ts +36 -0
- package/src/cards/builtin/queue/QueueCard.vue +65 -0
- package/src/cards/builtin/queue/meta.json +47 -0
- package/src/cards/builtin/queue/schema.json +32 -0
- package/src/cards/builtin/ranking/RankingCard.vue +37 -0
- package/src/cards/builtin/ranking/meta.json +71 -0
- package/src/cards/builtin/ranking/schema.json +35 -0
- package/src/cards/builtin/recent/RecentCard.vue +41 -0
- package/src/cards/builtin/recent/meta.json +32 -0
- package/src/cards/builtin/recent/schema.json +21 -0
- package/src/cards/builtin/shared.ts +83 -0
- package/src/cards/builtin/split/SplitCard.vue +52 -0
- package/src/cards/builtin/split/meta.json +72 -0
- package/src/cards/builtin/split/schema.json +40 -0
- package/src/cards/builtin/trend/TrendCard.vue +75 -0
- package/src/cards/builtin/trend/meta.json +81 -0
- package/src/cards/builtin/trend/schema.json +58 -0
- package/src/cards/index.ts +29 -0
- package/src/cards/registry.ts +57 -0
- package/src/cards/tools/cardsTool.ts +181 -0
- package/src/cards/tools/cli.ts +35 -0
- package/src/cards/types.ts +111 -0
- package/src/cards/validate.ts +111 -0
- package/src/components/edit/FormActions.vue +9 -5
- package/src/components/edit/FormPage.vue +17 -2
- package/src/components/layout/AppLayout.vue +4 -0
- package/src/components/layout/BaseLayout.vue +4 -0
- package/src/components/layout/CardParamsForm.vue +157 -0
- package/src/components/layout/CardsDashboard.vue +276 -57
- package/src/components/layout/PageHeader.vue +22 -1
- package/src/components/layout/QdFavoriteStar.vue +71 -0
- package/src/components/layout/Zone.vue +2 -1
- package/src/components/lists/ListPage.vue +9 -1
- package/src/components/lists/QdSaveSearch.vue +79 -0
- package/src/components/pages/NotFoundPage.vue +5 -2
- package/src/components/run/QdRunBar.vue +99 -0
- package/src/components/show/ShowPage.vue +10 -1
- package/src/composables/useBreadcrumb.ts +1 -1
- package/src/composables/useCardsArrangement.ts +297 -27
- package/src/composables/useEntityItemFormPage.ts +39 -3
- package/src/composables/useEntityItemFormPage.types.ts +8 -0
- package/src/composables/useEntityItemShowPage.ts +22 -0
- package/src/composables/useListPage.ts +71 -0
- package/src/composables/useListPage.types.ts +6 -0
- package/src/composables/useUnsavedChangesGuard.ts +17 -1
- package/src/domain/QdBadge.vue +36 -0
- package/src/domain/QdDomainBar.vue +213 -0
- package/src/domain/QdDomainBarZone.vue +19 -0
- package/src/domain/index.ts +6 -0
- package/src/domain/registry.ts +122 -0
- package/src/favorites/index.ts +7 -0
- package/src/favorites/store.ts +172 -0
- package/src/favorites/useFavorites.ts +217 -0
- package/src/i18n/defaults/core.en.generated.ts +132 -0
- package/src/i18n/defaults/core.en.yml +132 -0
- package/src/i18n/defaults/core.fr.generated.ts +132 -0
- package/src/i18n/defaults/core.fr.yml +132 -0
- package/src/index.ts +23 -0
- package/src/kernel/Kernel.routing.ts +4 -15
- package/src/kernel/Kernel.types.ts +5 -1
- package/src/kernel/Kernel.vue.ts +2 -2
- package/src/kernel/KernelContext.routing.ts +10 -1
- package/src/kernel/KernelContext.ts +7 -0
- package/src/kernel/KernelContext.types.ts +2 -0
- package/src/kernel/homeRoute.ts +45 -0
- package/src/module/moduleRegistry.ts +4 -0
- package/src/run/index.ts +6 -0
- package/src/run/run.ts +162 -0
- package/src/run/useRun.ts +207 -0
- package/src/styles/_cards-dashboard.scss +190 -0
- package/src/styles/_qd-board.scss +359 -0
- package/src/styles/_qd-cards.scss +1197 -0
- package/src/styles/_qd-domain-bar.scss +159 -0
- package/src/styles/_qd-run.scss +135 -0
- package/src/styles/index.scss +4 -0
- package/src/zones/ZoneRegistry.ts +16 -0
- package/src/zones/index.ts +1 -0
|
@@ -21,15 +21,26 @@
|
|
|
21
21
|
* Edit mode ("Customise") shows a handle (arrows, Home/End, or drag with
|
|
22
22
|
* mouse, touch or pen), pin and hide on each card, and the hidden cards'
|
|
23
23
|
* tray with Reset. Outside it, only the cards show.
|
|
24
|
+
*
|
|
25
|
+
* Since #5348: "Add a card" opens a catalogue (the hidden cards, and the
|
|
26
|
+
* repeatable blocks, each added with its parameters as many times as wanted),
|
|
27
|
+
* each card has the size its person picks, and cards go in named sections.
|
|
24
28
|
*/
|
|
25
29
|
import { computed, inject, nextTick, onBeforeUnmount, ref, watch, h, defineComponent, type Component, type VNode } from 'vue'
|
|
26
30
|
import QdButton from '../base/QdButton.vue'
|
|
31
|
+
import CardParamsForm from './CardParamsForm.vue'
|
|
32
|
+
import QdCardView from '../../cards/QdCardView.vue'
|
|
33
|
+
import { getCard } from '../../cards/registry'
|
|
27
34
|
import { DASHBOARD_ZONES } from '../../zones/zones'
|
|
28
35
|
import { useAuth } from '../../composables/useAuth'
|
|
29
36
|
import { useI18n } from '../../i18n/useI18n'
|
|
30
37
|
import {
|
|
31
38
|
useCardsArrangement,
|
|
32
39
|
moveCard,
|
|
40
|
+
cardGroup,
|
|
41
|
+
cardSizes,
|
|
42
|
+
cardSpan,
|
|
43
|
+
sectionOfCard,
|
|
33
44
|
localArrangementStorage,
|
|
34
45
|
type CardDef,
|
|
35
46
|
type CardsArrangement,
|
|
@@ -96,6 +107,7 @@ const state = useCardsArrangement(storageKey, cards, {
|
|
|
96
107
|
})
|
|
97
108
|
|
|
98
109
|
const editing = ref(false)
|
|
110
|
+
const arrangement = computed(() => state.arrangement.value)
|
|
99
111
|
|
|
100
112
|
function saveFailed(): void {
|
|
101
113
|
const text = tOr('core.cardsDashboard.saveFailed', 'Could not save the arrangement')
|
|
@@ -135,10 +147,105 @@ const root = ref<HTMLElement | null>(null)
|
|
|
135
147
|
/** The selector of a card's slot: ids are app strings, quoted safely */
|
|
136
148
|
const slotSelector = (id: string) => `[data-card-id="${id.replace(/["\\]/g, '\\$&')}"]`
|
|
137
149
|
const title = (c: CardDef) => tOr(c.card.title, c.card.title)
|
|
138
|
-
const span = (c: CardDef) =>
|
|
139
|
-
const isPinned = (c: CardDef) =>
|
|
140
|
-
const
|
|
141
|
-
|
|
150
|
+
const span = (c: CardDef) => cardSpan(arrangement.value, c)
|
|
151
|
+
const isPinned = (c: CardDef) => arrangement.value.pinned.includes(c.id)
|
|
152
|
+
const groupFor = (c: CardDef) => cardGroup(arrangement.value, cards.value, c.id)
|
|
153
|
+
/** An added card is drawn by its block, its parameters merged into the block's props */
|
|
154
|
+
const blockOf = (c: CardDef) => blockById.value.get(c.block ?? c.id)!
|
|
155
|
+
const propsOf = (c: CardDef) => ({ ...(blockOf(c).props ?? {}), ...(c.params ?? {}) })
|
|
156
|
+
|
|
157
|
+
// What the grid draws: the pinned cards then the one group, as before; with
|
|
158
|
+
// sections, the pinned cards above them, then one grid per section (#5348)
|
|
159
|
+
const grids = computed(() => {
|
|
160
|
+
const g = state.groups.value
|
|
161
|
+
if (!arrangement.value.sections.length) return [{ key: 'all', section: null, cards: [...g.pinned, ...g.rest] }]
|
|
162
|
+
return [
|
|
163
|
+
...(g.pinned.length ? [{ key: 'pinned', section: null, cards: g.pinned }] : []),
|
|
164
|
+
...g.sections.map((s) => ({ key: s.section!.id, section: s.section, cards: s.cards })),
|
|
165
|
+
]
|
|
166
|
+
})
|
|
167
|
+
|
|
168
|
+
// ── Size and section (#5348) ──────────────────────────────────────────────
|
|
169
|
+
const SIZE_LABEL = { s: 'core.cardsDashboard.sizeS', m: 'core.cardsDashboard.sizeM', l: 'core.cardsDashboard.sizeL' } as const
|
|
170
|
+
const SIZE_FALLBACK = { s: 'Small', m: 'Medium', l: 'Large' } as const
|
|
171
|
+
const sizeLabel = (size: 's' | 'm' | 'l') => tOr(SIZE_LABEL[size], SIZE_FALLBACK[size])
|
|
172
|
+
const currentSize = (c: CardDef) => (['s', 'm', 'l'] as const)[span(c) - 1]!
|
|
173
|
+
|
|
174
|
+
function onSize(c: CardDef, size: string): void {
|
|
175
|
+
if (state.resize(c.id, size as 's' | 'm' | 'l')) announce(tOr('core.cardsDashboard.resized', '{title}: {size}', { title: title(c), size: sizeLabel(size as 's' | 'm' | 'l') }))
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const sectionTitle = (id: string | null) => arrangement.value.sections.find((s) => s.id === id)?.title ?? ''
|
|
179
|
+
|
|
180
|
+
function onSection(c: CardDef, section: string): void {
|
|
181
|
+
if (state.moveToSection(c.id, section)) {
|
|
182
|
+
announce(tOr('core.cardsDashboard.movedToSection', '{title} moved to {section}', { title: title(c), section: sectionTitle(section) }))
|
|
183
|
+
void focusHandle(c.id)
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
async function addSection(): Promise<void> {
|
|
188
|
+
const name = tOr('core.cardsDashboard.newSection', 'New section')
|
|
189
|
+
const id = state.addSection(arrangement.value.sections.length ? name : tOr('core.cardsDashboard.firstSection', 'Main'))
|
|
190
|
+
// The first section takes every card; a second one is the one to name
|
|
191
|
+
const target = arrangement.value.sections.length === 1 ? state.addSection(name) : id
|
|
192
|
+
announce(tOr('core.cardsDashboard.sectionAdded', 'Section {title} added', { title: sectionTitle(target) }))
|
|
193
|
+
await nextTick()
|
|
194
|
+
root.value?.querySelector<HTMLInputElement>(`[data-section-input="${target}"]`)?.select()
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function renameSection(id: string, value: string): void {
|
|
198
|
+
const text = value.trim()
|
|
199
|
+
if (text) state.renameSection(id, text)
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
function removeSection(id: string): void {
|
|
203
|
+
const name = sectionTitle(id)
|
|
204
|
+
state.removeSection(id)
|
|
205
|
+
announce(tOr('core.cardsDashboard.sectionRemoved', 'Section {title} removed, its cards moved to the first one', { title: name }))
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// ── The catalogue (#5348) ─────────────────────────────────────────────────
|
|
209
|
+
const catalogueOpen = ref(false)
|
|
210
|
+
const adding = ref<CardDef | null>(null)
|
|
211
|
+
const templates = computed(() => cards.value.filter((c) => c.card.repeatable))
|
|
212
|
+
/** What a card type answers, when the block draws a registered card */
|
|
213
|
+
function question(c: CardDef): string | null {
|
|
214
|
+
const block = blockById.value.get(c.id)
|
|
215
|
+
const type = block?.component === QdCardView ? (block.props?.type as string | undefined) : undefined
|
|
216
|
+
const q = type ? getCard(type)?.meta.question : undefined
|
|
217
|
+
return q ?? null
|
|
218
|
+
}
|
|
219
|
+
const description = (c: CardDef) => (c.card.description ? tOr(c.card.description, c.card.description) : null)
|
|
220
|
+
|
|
221
|
+
async function openCatalogue(): Promise<void> {
|
|
222
|
+
catalogueOpen.value = !catalogueOpen.value
|
|
223
|
+
adding.value = null
|
|
224
|
+
if (catalogueOpen.value) {
|
|
225
|
+
await nextTick()
|
|
226
|
+
root.value?.querySelector<HTMLElement>('.qd-cards-catalogue h2')?.focus()
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
async function chooseTemplate(c: CardDef): Promise<void> {
|
|
231
|
+
adding.value = c
|
|
232
|
+
await nextTick()
|
|
233
|
+
root.value?.querySelector<HTMLInputElement>('.qd-cards-catalogue form input, .qd-cards-catalogue form select')?.focus()
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
function addInstance(c: CardDef, value: { params: Record<string, unknown>; title: string; section: string | null }): void {
|
|
237
|
+
const id = state.add(c.id, value.params, { title: value.title === title(c) ? undefined : value.title, section: value.section })
|
|
238
|
+
if (!id) return
|
|
239
|
+
adding.value = null
|
|
240
|
+
catalogueOpen.value = false
|
|
241
|
+
announce(tOr('core.cardsDashboard.added', '{title} added', { title: value.title }))
|
|
242
|
+
void focusHandle(id)
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
function removeCard(c: CardDef): void {
|
|
246
|
+
state.remove(c.id)
|
|
247
|
+
announce(tOr('core.cardsDashboard.removed', '{title} removed', { title: title(c) }))
|
|
248
|
+
}
|
|
142
249
|
|
|
143
250
|
function announce(text: string): void {
|
|
144
251
|
// Same text twice must still be read: clear, then set
|
|
@@ -206,8 +313,7 @@ function onPointerDown(event: PointerEvent, c: CardDef): void {
|
|
|
206
313
|
if (c.card.fixed || (event.pointerType === 'mouse' && event.button !== 0)) return
|
|
207
314
|
event.preventDefault()
|
|
208
315
|
// A plain copy: the arrangement's arrays are reactive proxies, which structuredClone refuses
|
|
209
|
-
|
|
210
|
-
snapshot = { v: 1, order: [...order], hidden: [...hidden], pinned: [...pinned] }
|
|
316
|
+
snapshot = JSON.parse(JSON.stringify(state.arrangement.value)) as CardsArrangement
|
|
211
317
|
dragging.value = c.id
|
|
212
318
|
dragged = c
|
|
213
319
|
window.addEventListener('pointermove', onPointerMove)
|
|
@@ -269,12 +375,12 @@ onBeforeUnmount(() => {
|
|
|
269
375
|
})
|
|
270
376
|
|
|
271
377
|
// A block with wrappers renders through them, as in Zone
|
|
272
|
-
function render(block: BlockConfig): Component {
|
|
378
|
+
function render(block: BlockConfig, props?: Record<string, unknown>): Component {
|
|
273
379
|
if (!block.wrappers?.length) return block.component
|
|
274
380
|
return defineComponent({
|
|
275
381
|
name: 'WrappedCard',
|
|
276
382
|
render(): VNode {
|
|
277
|
-
let current: VNode = h(block.component, block.props ?? {})
|
|
383
|
+
let current: VNode = h(block.component, props ?? block.props ?? {})
|
|
278
384
|
for (const wrapper of [...block.wrappers!].reverse()) {
|
|
279
385
|
const inner = current
|
|
280
386
|
current = h(wrapper.component, wrapper.props || {}, { default: () => inner })
|
|
@@ -289,6 +395,26 @@ function render(block: BlockConfig): Component {
|
|
|
289
395
|
<div ref="root" class="qd-cards-dashboard" :class="{ 'qd-cards-editing': editing }" :data-zone="zone">
|
|
290
396
|
<div v-if="editable && cards.length" class="qd-cards-toolbar">
|
|
291
397
|
<template v-if="editing">
|
|
398
|
+
<QdButton
|
|
399
|
+
type="button"
|
|
400
|
+
size="small"
|
|
401
|
+
outlined
|
|
402
|
+
icon="pi pi-plus"
|
|
403
|
+
class="qd-cards-add"
|
|
404
|
+
:label="tOr('core.cardsDashboard.addCard', 'Add a card')"
|
|
405
|
+
:aria-expanded="catalogueOpen"
|
|
406
|
+
aria-controls="qd-cards-catalogue"
|
|
407
|
+
@click="openCatalogue"
|
|
408
|
+
/>
|
|
409
|
+
<QdButton
|
|
410
|
+
type="button"
|
|
411
|
+
size="small"
|
|
412
|
+
text
|
|
413
|
+
icon="pi pi-folder-plus"
|
|
414
|
+
class="qd-cards-add-section"
|
|
415
|
+
:label="tOr('core.cardsDashboard.addSection', 'Add a section')"
|
|
416
|
+
@click="addSection"
|
|
417
|
+
/>
|
|
292
418
|
<QdButton
|
|
293
419
|
type="button"
|
|
294
420
|
size="small"
|
|
@@ -318,55 +444,148 @@ function render(block: BlockConfig): Component {
|
|
|
318
444
|
/>
|
|
319
445
|
</div>
|
|
320
446
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
class="qd-cards-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
@click="
|
|
352
|
-
>
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
447
|
+
<!-- The catalogue (#5348): the hidden cards, and the cards to add with their parameters -->
|
|
448
|
+
<section v-if="editing && catalogueOpen" id="qd-cards-catalogue" class="qd-cards-catalogue" aria-labelledby="qd-cards-catalogue-title">
|
|
449
|
+
<h2 id="qd-cards-catalogue-title" tabindex="-1">{{ tOr('core.cardsDashboard.catalogue', 'Add a card') }}</h2>
|
|
450
|
+
<template v-if="adding">
|
|
451
|
+
<h3>{{ title(adding) }}</h3>
|
|
452
|
+
<p v-if="description(adding)" class="qd-cards-catalogue-desc">{{ description(adding) }}</p>
|
|
453
|
+
<CardParamsForm
|
|
454
|
+
:schema="adding.card.params ?? null"
|
|
455
|
+
:title="title(adding)"
|
|
456
|
+
:sections="arrangement.sections"
|
|
457
|
+
:id-prefix="`qd-cards-param-${zone}`"
|
|
458
|
+
@submit="addInstance(adding!, $event)"
|
|
459
|
+
@cancel="adding = null"
|
|
460
|
+
/>
|
|
461
|
+
</template>
|
|
462
|
+
<template v-else>
|
|
463
|
+
<ul class="qd-cards-catalogue-list">
|
|
464
|
+
<li v-for="c in templates" :key="c.id" class="qd-cards-catalogue-item" :data-catalogue-card="c.id">
|
|
465
|
+
<div class="qd-cards-catalogue-text">
|
|
466
|
+
<strong>{{ title(c) }}</strong>
|
|
467
|
+
<span v-if="description(c)">{{ description(c) }}</span>
|
|
468
|
+
<span v-if="question(c)" class="qd-cards-catalogue-question">{{ question(c) }}</span>
|
|
469
|
+
</div>
|
|
470
|
+
<QdButton type="button" size="small" outlined icon="pi pi-plus" :label="tOr('core.cardsDashboard.add', 'Add')" :aria-label="tOr('core.cardsDashboard.addOne', 'Add {title}', { title: title(c) })" @click="chooseTemplate(c)" />
|
|
471
|
+
</li>
|
|
472
|
+
<li v-for="c in state.groups.value.hidden" :key="`hidden-${c.id}`" class="qd-cards-catalogue-item" :data-catalogue-hidden="c.id">
|
|
473
|
+
<div class="qd-cards-catalogue-text">
|
|
474
|
+
<strong>{{ title(c) }}</strong>
|
|
475
|
+
<span>{{ tOr('core.cardsDashboard.hiddenNow', 'Hidden: it comes back where it was') }}</span>
|
|
476
|
+
</div>
|
|
477
|
+
<QdButton type="button" size="small" text icon="pi pi-eye" :label="tOr('core.cardsDashboard.show', 'Show')" :aria-label="tOr('core.cardsDashboard.restore', 'Show {title}', { title: title(c) })" @click="restore(c)" />
|
|
478
|
+
</li>
|
|
479
|
+
</ul>
|
|
480
|
+
<p v-if="!templates.length && !state.groups.value.hidden.length" class="qd-cards-tray-empty">{{ tOr('core.cardsDashboard.catalogueEmpty', 'Every card is already on the board') }}</p>
|
|
481
|
+
</template>
|
|
482
|
+
</section>
|
|
483
|
+
|
|
484
|
+
<div v-for="(grid, gi) in grids" :key="grid.key" class="qd-cards-group" :data-section-id="grid.section?.id">
|
|
485
|
+
<div v-if="grid.section" class="qd-cards-section-head">
|
|
486
|
+
<input
|
|
487
|
+
v-if="editing"
|
|
488
|
+
:data-section-input="grid.section.id"
|
|
489
|
+
class="qd-cards-section-input p-inputtext p-component"
|
|
490
|
+
:value="grid.section.title"
|
|
491
|
+
:aria-label="tOr('core.cardsDashboard.sectionName', 'Name of the section')"
|
|
492
|
+
@change="renameSection(grid.section.id, ($event.target as HTMLInputElement).value)"
|
|
493
|
+
@keydown.enter="($event.target as HTMLInputElement).blur()"
|
|
494
|
+
/>
|
|
495
|
+
<h2 v-else class="qd-cards-section-title">{{ grid.section.title }}</h2>
|
|
496
|
+
<QdButton
|
|
497
|
+
v-if="editing"
|
|
498
|
+
type="button"
|
|
499
|
+
size="small"
|
|
500
|
+
text
|
|
501
|
+
icon="pi pi-trash"
|
|
502
|
+
:aria-label="tOr('core.cardsDashboard.removeSection', 'Remove the section {title}', { title: grid.section.title })"
|
|
503
|
+
:title="tOr('core.cardsDashboard.removeSection', 'Remove the section {title}', { title: grid.section.title })"
|
|
504
|
+
@click="removeSection(grid.section.id)"
|
|
505
|
+
/>
|
|
367
506
|
</div>
|
|
368
|
-
<div
|
|
369
|
-
<
|
|
507
|
+
<div class="qd-cards-grid" :class="{ 'qd-cards-loading': state.loading.value }" :aria-busy="state.loading.value || undefined" :style="{ '--qd-card-min': minCardWidth }">
|
|
508
|
+
<div
|
|
509
|
+
v-for="c in grid.cards"
|
|
510
|
+
:key="c.id"
|
|
511
|
+
class="qd-cards-slot"
|
|
512
|
+
:class="{ 'qd-cards-pinned': isPinned(c), 'qd-cards-dragging': dragging === c.id }"
|
|
513
|
+
:style="{ '--qd-card-span': span(c) }"
|
|
514
|
+
:data-card-id="c.id"
|
|
515
|
+
:data-zone-block="c.block ?? c.id"
|
|
516
|
+
>
|
|
517
|
+
<div v-if="editing" class="qd-cards-bar">
|
|
518
|
+
<button
|
|
519
|
+
v-if="!c.card.fixed"
|
|
520
|
+
type="button"
|
|
521
|
+
class="qd-cards-handle"
|
|
522
|
+
:aria-label="tOr('core.cardsDashboard.move', 'Move {title}', { title: title(c) })"
|
|
523
|
+
:aria-describedby="`qd-cards-help-${zone}`"
|
|
524
|
+
@keydown="onHandleKey($event, c)"
|
|
525
|
+
@pointerdown="onPointerDown($event, c)"
|
|
526
|
+
>
|
|
527
|
+
<i class="pi pi-arrows-alt" aria-hidden="true"></i>
|
|
528
|
+
</button>
|
|
529
|
+
<span class="qd-cards-title">{{ title(c) }}</span>
|
|
530
|
+
<select
|
|
531
|
+
v-if="cardSizes(c).length > 1"
|
|
532
|
+
class="qd-cards-size"
|
|
533
|
+
:value="currentSize(c)"
|
|
534
|
+
:aria-label="tOr('core.cardsDashboard.size', 'Size of {title}', { title: title(c) })"
|
|
535
|
+
:title="tOr('core.cardsDashboard.size', 'Size of {title}', { title: title(c) })"
|
|
536
|
+
@change="onSize(c, ($event.target as HTMLSelectElement).value)"
|
|
537
|
+
>
|
|
538
|
+
<option v-for="size in cardSizes(c)" :key="size" :value="size">{{ sizeLabel(size) }}</option>
|
|
539
|
+
</select>
|
|
540
|
+
<select
|
|
541
|
+
v-if="arrangement.sections.length > 1 && !isPinned(c) && !c.card.fixed"
|
|
542
|
+
class="qd-cards-section"
|
|
543
|
+
:value="sectionOfCard(arrangement, c.id)"
|
|
544
|
+
:aria-label="tOr('core.cardsDashboard.section', 'Section of {title}', { title: title(c) })"
|
|
545
|
+
:title="tOr('core.cardsDashboard.section', 'Section of {title}', { title: title(c) })"
|
|
546
|
+
@change="onSection(c, ($event.target as HTMLSelectElement).value)"
|
|
547
|
+
>
|
|
548
|
+
<option v-for="sec in arrangement.sections" :key="sec.id" :value="sec.id">{{ sec.title }}</option>
|
|
549
|
+
</select>
|
|
550
|
+
<button
|
|
551
|
+
v-if="!c.card.fixed"
|
|
552
|
+
type="button"
|
|
553
|
+
class="qd-cards-action"
|
|
554
|
+
:aria-pressed="isPinned(c)"
|
|
555
|
+
:aria-label="isPinned(c) ? tOr('core.cardsDashboard.unpin', 'Unpin {title}', { title: title(c) }) : tOr('core.cardsDashboard.pin', 'Pin {title} at the top', { title: title(c) })"
|
|
556
|
+
:title="isPinned(c) ? tOr('core.cardsDashboard.unpin', 'Unpin {title}', { title: title(c) }) : tOr('core.cardsDashboard.pin', 'Pin {title} at the top', { title: title(c) })"
|
|
557
|
+
@click="togglePin(c)"
|
|
558
|
+
>
|
|
559
|
+
<i :class="isPinned(c) ? 'pi pi-thumbtack qd-cards-on' : 'pi pi-thumbtack'" aria-hidden="true"></i>
|
|
560
|
+
</button>
|
|
561
|
+
<button
|
|
562
|
+
v-if="!c.card.required"
|
|
563
|
+
type="button"
|
|
564
|
+
class="qd-cards-action"
|
|
565
|
+
:aria-label="tOr('core.cardsDashboard.hide', 'Hide {title}', { title: title(c) })"
|
|
566
|
+
:title="tOr('core.cardsDashboard.hide', 'Hide {title}', { title: title(c) })"
|
|
567
|
+
@click="hide(c)"
|
|
568
|
+
>
|
|
569
|
+
<i class="pi pi-eye-slash" aria-hidden="true"></i>
|
|
570
|
+
</button>
|
|
571
|
+
<button
|
|
572
|
+
v-if="c.block"
|
|
573
|
+
type="button"
|
|
574
|
+
class="qd-cards-action qd-cards-remove"
|
|
575
|
+
:aria-label="tOr('core.cardsDashboard.remove', 'Remove {title}', { title: title(c) })"
|
|
576
|
+
:title="tOr('core.cardsDashboard.remove', 'Remove {title}', { title: title(c) })"
|
|
577
|
+
@click="removeCard(c)"
|
|
578
|
+
>
|
|
579
|
+
<i class="pi pi-trash" aria-hidden="true"></i>
|
|
580
|
+
</button>
|
|
581
|
+
</div>
|
|
582
|
+
<component :is="render(blockOf(c), propsOf(c))" v-bind="propsOf(c)" />
|
|
583
|
+
</div>
|
|
584
|
+
<template v-if="gi === grids.length - 1">
|
|
585
|
+
<div v-for="(b, i) in plainBlocks" :key="`plain-${i}`" class="qd-cards-slot">
|
|
586
|
+
<component :is="render(b)" v-bind="b.props ?? {}" />
|
|
587
|
+
</div>
|
|
588
|
+
</template>
|
|
370
589
|
</div>
|
|
371
590
|
</div>
|
|
372
591
|
|
|
@@ -410,7 +629,7 @@ function render(block: BlockConfig): Component {
|
|
|
410
629
|
/>
|
|
411
630
|
</div>
|
|
412
631
|
<div class="qd-cards-hidden-body" inert>
|
|
413
|
-
<component :is="render(
|
|
632
|
+
<component :is="render(blockOf(c), propsOf(c))" v-bind="propsOf(c)" />
|
|
414
633
|
</div>
|
|
415
634
|
</div>
|
|
416
635
|
</div>
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
*/
|
|
21
21
|
import { computed, inject, type Ref } from 'vue'
|
|
22
22
|
import Tag from 'primevue/tag'
|
|
23
|
+
import QdFavoriteStar from './QdFavoriteStar.vue'
|
|
23
24
|
import type { ButtonSeverity } from '../../types'
|
|
24
25
|
|
|
25
26
|
interface TitleParts {
|
|
@@ -34,18 +35,28 @@ interface BadgeConfig {
|
|
|
34
35
|
severity?: ButtonSeverity
|
|
35
36
|
}
|
|
36
37
|
|
|
38
|
+
/** The favourite star beside the title (#5349): what kind of page this is */
|
|
39
|
+
interface FavoriteConfig {
|
|
40
|
+
kind: 'item' | 'list' | 'search' | 'board'
|
|
41
|
+
entity?: string | null
|
|
42
|
+
itemId?: string | number | null
|
|
43
|
+
}
|
|
44
|
+
|
|
37
45
|
interface Props {
|
|
38
46
|
title?: string | null
|
|
39
47
|
titleParts?: TitleParts | null
|
|
40
48
|
subtitle?: string | null
|
|
41
49
|
badges?: BadgeConfig[]
|
|
50
|
+
/** Draw the favourite star (#5349); null: none */
|
|
51
|
+
favorite?: FavoriteConfig | null
|
|
42
52
|
}
|
|
43
53
|
|
|
44
54
|
const props = withDefaults(defineProps<Props>(), {
|
|
45
55
|
title: null,
|
|
46
56
|
titleParts: null,
|
|
47
57
|
subtitle: null,
|
|
48
|
-
badges: () => []
|
|
58
|
+
badges: () => [],
|
|
59
|
+
favorite: null
|
|
49
60
|
})
|
|
50
61
|
|
|
51
62
|
// Auto-injected title from the form composables (if available)
|
|
@@ -63,6 +74,15 @@ const simpleTitle = computed((): string | undefined => effectiveTitleParts.value
|
|
|
63
74
|
const hasDecoratedTitle = computed((): boolean => {
|
|
64
75
|
return !!effectiveTitleParts.value?.entityLabel
|
|
65
76
|
})
|
|
77
|
+
|
|
78
|
+
// The favourite's name: the title as shown
|
|
79
|
+
const favoriteLabel = computed((): string => {
|
|
80
|
+
if (simpleTitle.value) return simpleTitle.value
|
|
81
|
+
const parts = effectiveTitleParts.value
|
|
82
|
+
if (parts?.entityLabel) return parts.entityLabel
|
|
83
|
+
if (parts) return [parts.action, parts.entityName].filter(Boolean).join(' ')
|
|
84
|
+
return props.title ?? ''
|
|
85
|
+
})
|
|
66
86
|
</script>
|
|
67
87
|
|
|
68
88
|
<template>
|
|
@@ -88,6 +108,7 @@ const hasDecoratedTitle = computed((): boolean => {
|
|
|
88
108
|
</h1>
|
|
89
109
|
<p v-if="subtitle" class="page-subtitle">{{ subtitle }}</p>
|
|
90
110
|
</div>
|
|
111
|
+
<QdFavoriteStar v-if="favorite && favoriteLabel" :label="favoriteLabel" :kind="favorite.kind" :entity="favorite.entity ?? null" :item-id="favorite.itemId ?? null" />
|
|
91
112
|
<slot name="subtitle" ></slot>
|
|
92
113
|
</div>
|
|
93
114
|
<div class="header-actions">
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* QdFavoriteStar (#5349): follow this page. A star beside the page's title:
|
|
4
|
+
* pressed when the page is a favourite, saying so in words too.
|
|
5
|
+
*
|
|
6
|
+
* PageHeader draws it on list, show and edit pages; a page of the app's own
|
|
7
|
+
* puts it where it wants. It shows only when the app declares the favorites
|
|
8
|
+
* entity:
|
|
9
|
+
*
|
|
10
|
+
* <QdFavoriteStar :label="title" kind="board" />
|
|
11
|
+
*/
|
|
12
|
+
import { computed } from 'vue'
|
|
13
|
+
import { useRoute } from 'vue-router'
|
|
14
|
+
import { useI18n } from '../../i18n/useI18n'
|
|
15
|
+
import { useFavorites } from '../../favorites/useFavorites'
|
|
16
|
+
import type { Favorite } from '../../favorites/store'
|
|
17
|
+
|
|
18
|
+
const props = withDefaults(
|
|
19
|
+
defineProps<{
|
|
20
|
+
/** The favourite's name: the page's title */
|
|
21
|
+
label: string
|
|
22
|
+
kind?: Favorite['kind']
|
|
23
|
+
entity?: string | null
|
|
24
|
+
/** A record's id: its show and edit pages share one favourite */
|
|
25
|
+
itemId?: string | number | null
|
|
26
|
+
/** The page, as a path; default the current route's path, without its query */
|
|
27
|
+
to?: string | null
|
|
28
|
+
}>(),
|
|
29
|
+
{ kind: 'item', entity: null, itemId: null, to: null }
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
const route = useRoute() as ReturnType<typeof useRoute> | undefined
|
|
33
|
+
const { tOr } = useI18n()
|
|
34
|
+
const favorites = useFavorites()
|
|
35
|
+
|
|
36
|
+
const target = computed(() => props.to ?? route?.path ?? '')
|
|
37
|
+
const isItem = computed(() => !!props.entity && props.itemId !== null && props.itemId !== undefined && props.itemId !== '')
|
|
38
|
+
const on = computed(() => (isItem.value ? !!favorites.findItem(props.entity!, props.itemId!) : favorites.has(target.value)))
|
|
39
|
+
const text = computed(() =>
|
|
40
|
+
on.value
|
|
41
|
+
? tOr('core.favorites.remove', 'Remove {label} from favourites', { label: props.label })
|
|
42
|
+
: tOr('core.favorites.add', 'Add {label} to favourites', { label: props.label })
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
function toggle(): void {
|
|
46
|
+
if (!target.value || !props.label) return
|
|
47
|
+
void favorites.toggle({
|
|
48
|
+
kind: props.kind,
|
|
49
|
+
label: props.label,
|
|
50
|
+
to: target.value,
|
|
51
|
+
...(props.entity ? { entity: props.entity } : {}),
|
|
52
|
+
...(isItem.value ? { itemId: String(props.itemId) } : {}),
|
|
53
|
+
})
|
|
54
|
+
}
|
|
55
|
+
</script>
|
|
56
|
+
|
|
57
|
+
<template>
|
|
58
|
+
<button
|
|
59
|
+
v-if="favorites.available && target && label"
|
|
60
|
+
type="button"
|
|
61
|
+
class="qd-favorite-star"
|
|
62
|
+
:class="{ 'qd-favorite-on': on }"
|
|
63
|
+
:aria-pressed="on"
|
|
64
|
+
:aria-label="text"
|
|
65
|
+
:title="text"
|
|
66
|
+
data-favorite-star
|
|
67
|
+
@click="toggle"
|
|
68
|
+
>
|
|
69
|
+
<i :class="on ? 'pi pi-star-fill' : 'pi pi-star'" aria-hidden="true"></i>
|
|
70
|
+
</button>
|
|
71
|
+
</template>
|
|
@@ -64,7 +64,8 @@ const blocks = computed<BlockConfig[]>(() => {
|
|
|
64
64
|
if (version) {
|
|
65
65
|
void version.value
|
|
66
66
|
}
|
|
67
|
-
|
|
67
|
+
// A repeatable card is only a model for CardsDashboard's catalogue (#5348)
|
|
68
|
+
return registry.getBlocks(props.name).filter((b) => !b.card?.repeatable)
|
|
68
69
|
})
|
|
69
70
|
|
|
70
71
|
const hasBlocks = computed<boolean>(() => blocks.value.length > 0)
|
|
@@ -22,6 +22,7 @@ import ActionButtons from './ActionButtons.vue'
|
|
|
22
22
|
import DataTable from 'primevue/datatable'
|
|
23
23
|
import Column from 'primevue/column'
|
|
24
24
|
import QdButton from '../base/QdButton.vue'
|
|
25
|
+
import QdSaveSearch from './QdSaveSearch.vue'
|
|
25
26
|
import SeverityTag from '../SeverityTag.vue'
|
|
26
27
|
import { useI18n } from '../../i18n/useI18n'
|
|
27
28
|
import ShowDisplay from '../show/ShowDisplay.vue'
|
|
@@ -82,6 +83,12 @@ const props = defineProps({
|
|
|
82
83
|
title: { type: String, default: '' },
|
|
83
84
|
subtitle: { type: String as PropType<string | null>, default: null },
|
|
84
85
|
headerActions: { type: Array as PropType<ResolvedHeaderAction[]>, default: () => [] },
|
|
86
|
+
/** The entity listed, for its favourites (#5349) */
|
|
87
|
+
entity: { type: String as PropType<string | null>, default: null },
|
|
88
|
+
/** The favourite star beside the title (#5349) */
|
|
89
|
+
favorite: { type: Boolean, default: true },
|
|
90
|
+
/** The filter in words while one is on: offers "Save this search" (#5349) */
|
|
91
|
+
searchLabel: { type: String as PropType<string | null>, default: null },
|
|
85
92
|
|
|
86
93
|
// Cards
|
|
87
94
|
cards: { type: Array as PropType<CardConfig[]>, default: () => [] },
|
|
@@ -350,9 +357,10 @@ function getFilterClass(filter: FilterConfig): Record<string, boolean> {
|
|
|
350
357
|
<!-- Nav slot for PageNav (child routes) -->
|
|
351
358
|
<slot name="nav" />
|
|
352
359
|
|
|
353
|
-
<PageHeader :title="title" :subtitle="subtitle">
|
|
360
|
+
<PageHeader :title="title" :subtitle="subtitle" :favorite="favorite ? { kind: 'list', entity } : null">
|
|
354
361
|
<template #actions>
|
|
355
362
|
<slot name="header-actions" ></slot>
|
|
363
|
+
<QdSaveSearch v-if="searchLabel" :default-name="searchLabel" :entity="entity" />
|
|
356
364
|
<!-- Mobile: split button (primary action + dropdown) -->
|
|
357
365
|
<template v-if="isMobile && headerActions.length > 0 && primaryHeaderAction">
|
|
358
366
|
<!-- Single action: just a button -->
|