@quazardous/qdadm 2.53.0 → 2.55.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.js +2 -1
- package/dist/styles/qdadm.css +1 -1
- package/package.json +1 -1
- package/src/cards/QdCard.vue +4 -0
- package/src/cards/QdCardView.vue +7 -2
- package/src/cards/QdFavoritesCard.vue +73 -14
- package/src/cards/builtin/agenda/meta.json +1 -0
- package/src/cards/builtin/cards-index.json +19 -1
- package/src/cards/builtin/favorites/FavoritesCard.vue +69 -10
- package/src/cards/builtin/favorites/meta.json +4 -2
- package/src/cards/builtin/favorites/schema.json +3 -1
- package/src/cards/builtin/feed/meta.json +1 -0
- package/src/cards/builtin/queue/meta.json +1 -0
- package/src/cards/builtin/recent/meta.json +1 -0
- package/src/cards/tools/cardsTool.ts +2 -1
- package/src/cards/types.ts +4 -0
- package/src/components/edit/FormPage.vue +1 -1
- package/src/components/layout/PageHeader.vue +8 -0
- package/src/components/show/ShowPage.vue +1 -1
- package/src/domain/QdDomainBar.vue +13 -3
- package/src/domain/index.ts +1 -1
- package/src/domain/registry.ts +8 -0
- package/src/i18n/defaults/core.en.generated.ts +3 -0
- package/src/i18n/defaults/core.en.yml +3 -0
- package/src/i18n/defaults/core.fr.generated.ts +3 -0
- package/src/i18n/defaults/core.fr.yml +3 -0
- package/src/kernel/Kernel.types.ts +2 -0
- package/src/styles/_qd-cards.scss +93 -0
- package/src/styles/_qd-domain-bar.scss +87 -7
package/src/cards/QdCard.vue
CHANGED
|
@@ -27,6 +27,8 @@ import type { RouteLocationRaw } from 'vue-router'
|
|
|
27
27
|
const props = withDefaults(
|
|
28
28
|
defineProps<{
|
|
29
29
|
title: string
|
|
30
|
+
/** An icon class drawn before the title */
|
|
31
|
+
icon?: string | null
|
|
30
32
|
status?: CardStatus | null
|
|
31
33
|
source?: string | null
|
|
32
34
|
freshness?: string | number | Date | null
|
|
@@ -40,6 +42,7 @@ const props = withDefaults(
|
|
|
40
42
|
problems?: SchemaProblem[]
|
|
41
43
|
}>(),
|
|
42
44
|
{
|
|
45
|
+
icon: null,
|
|
43
46
|
status: null,
|
|
44
47
|
source: null,
|
|
45
48
|
freshness: null,
|
|
@@ -116,6 +119,7 @@ const actionIcon = computed(() => (props.action?.mode === 'list' ? 'pi pi-list'
|
|
|
116
119
|
>
|
|
117
120
|
<header class="qd-card-head">
|
|
118
121
|
<h3 class="qd-card-title">
|
|
122
|
+
<i v-if="icon" class="qd-card-icon" :class="icon" aria-hidden="true"></i>
|
|
119
123
|
<RouterLink v-if="to" :to="to" class="qd-card-surface">{{ title }}</RouterLink>
|
|
120
124
|
<span v-else>{{ title }}</span>
|
|
121
125
|
</h3>
|
package/src/cards/QdCardView.vue
CHANGED
|
@@ -21,8 +21,10 @@ const props = withDefaults(
|
|
|
21
21
|
envelope: CardEnvelope
|
|
22
22
|
data?: unknown
|
|
23
23
|
options?: Record<string, unknown>
|
|
24
|
+
/** Listeners for the body's own events (a favourite removed…) */
|
|
25
|
+
on?: Record<string, (...args: never[]) => unknown>
|
|
24
26
|
}>(),
|
|
25
|
-
{ data: undefined, options: () => ({}) }
|
|
27
|
+
{ data: undefined, options: () => ({}), on: () => ({}) }
|
|
26
28
|
)
|
|
27
29
|
|
|
28
30
|
const definition = computed(() => getCard(props.type))
|
|
@@ -37,6 +39,8 @@ const problems = computed<SchemaProblem[]>(() => {
|
|
|
37
39
|
|
|
38
40
|
const shownState = computed(() => (problems.value.length ? 'invalid' : state.value))
|
|
39
41
|
const options = computed(() => (definition.value ? resolveCardOptions(definition.value.meta, props.options) : {}))
|
|
42
|
+
// The envelope's icon, else the type's; `null` or '' says none
|
|
43
|
+
const icon = computed(() => (props.envelope.icon !== undefined ? props.envelope.icon || null : definition.value?.meta.icon ?? null))
|
|
40
44
|
const size = computed(() => props.envelope.size ?? definition.value?.meta.sizes[0] ?? 's')
|
|
41
45
|
</script>
|
|
42
46
|
|
|
@@ -44,10 +48,11 @@ const size = computed(() => props.envelope.size ?? definition.value?.meta.sizes[
|
|
|
44
48
|
<QdCard
|
|
45
49
|
v-bind="envelope"
|
|
46
50
|
:size="size"
|
|
51
|
+
:icon="icon"
|
|
47
52
|
:state="shownState"
|
|
48
53
|
:problems="problems"
|
|
49
54
|
:data-card-type="type"
|
|
50
55
|
>
|
|
51
|
-
<component :is="definition!.component" v-if="definition" :data="data" :options="options" :size="size" />
|
|
56
|
+
<component :is="definition!.component" v-if="definition" :data="data" :options="options" :size="size" v-on="on" />
|
|
52
57
|
</QdCard>
|
|
53
58
|
</template>
|
|
@@ -4,34 +4,83 @@
|
|
|
4
4
|
* a page header, a search saved, show here at once.
|
|
5
5
|
*
|
|
6
6
|
* ctx.block(DASHBOARD_ZONES.WIDGETS, { id: 'favorites', component: QdFavoritesCard, card: { title: 'Favourites' } })
|
|
7
|
+
*
|
|
8
|
+
* A × beside each line removes it (#5392), at once; the line stays a few
|
|
9
|
+
* seconds where it was, saying so, with an Undo that adds it back.
|
|
10
|
+
* Renaming and ordering are the app's to offer: `useFavorites().rename`.
|
|
7
11
|
*/
|
|
8
|
-
import { computed, onMounted } from 'vue'
|
|
12
|
+
import { computed, onBeforeUnmount, onMounted, ref } from 'vue'
|
|
9
13
|
import QdCardView from './QdCardView.vue'
|
|
10
14
|
import { useI18n } from '../i18n/useI18n'
|
|
11
15
|
import { useFavorites } from '../favorites/useFavorites'
|
|
16
|
+
import type { Favorite } from '../favorites/store'
|
|
12
17
|
import type { CardSize } from './types'
|
|
13
18
|
|
|
14
|
-
const props = withDefaults(
|
|
15
|
-
title
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
const props = withDefaults(
|
|
20
|
+
defineProps<{ title?: string | null; size?: CardSize; maxItems?: number; groupByKind?: boolean; removable?: boolean; icon?: string | null }>(),
|
|
21
|
+
{
|
|
22
|
+
title: null,
|
|
23
|
+
size: 's',
|
|
24
|
+
maxItems: 8,
|
|
25
|
+
groupByKind: true,
|
|
26
|
+
removable: true,
|
|
27
|
+
icon: undefined,
|
|
28
|
+
}
|
|
29
|
+
)
|
|
20
30
|
const { tOr } = useI18n()
|
|
21
31
|
const favorites = useFavorites()
|
|
22
32
|
// Read again when it shows: another tab or a page may have changed them
|
|
23
33
|
onMounted(() => void favorites.reload())
|
|
24
34
|
|
|
35
|
+
/** How long a removed line stays, with its Undo */
|
|
36
|
+
const UNDO_MS = 8000
|
|
37
|
+
|
|
38
|
+
// The lines just removed: where they were in the list, until their Undo goes
|
|
39
|
+
interface Removed {
|
|
40
|
+
fav: Favorite
|
|
41
|
+
index: number
|
|
42
|
+
timer: ReturnType<typeof setTimeout>
|
|
43
|
+
}
|
|
44
|
+
const removed = ref<Removed[]>([])
|
|
45
|
+
|
|
46
|
+
function drop(id: string): void {
|
|
47
|
+
const r = removed.value.find((x) => x.fav.id === id)
|
|
48
|
+
if (r) clearTimeout(r.timer)
|
|
49
|
+
removed.value = removed.value.filter((x) => x.fav.id !== id)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async function onRemove(id: string): Promise<void> {
|
|
53
|
+
const shown = [...favorites.list.value].reverse()
|
|
54
|
+
const index = shown.findIndex((f) => f.id === id)
|
|
55
|
+
if (index < 0) return
|
|
56
|
+
const fav = shown[index]!
|
|
57
|
+
removed.value = [...removed.value, { fav, index, timer: setTimeout(() => drop(id), UNDO_MS) }]
|
|
58
|
+
await favorites.remove(id)
|
|
59
|
+
// It failed: it is back in the list, no Undo to show
|
|
60
|
+
if (favorites.list.value.some((f) => f.id === id)) drop(id)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async function onRestore(id: string): Promise<void> {
|
|
64
|
+
const r = removed.value.find((x) => x.fav.id === id)
|
|
65
|
+
if (!r) return
|
|
66
|
+
drop(id)
|
|
67
|
+
const { id: _id, at: _at, ...entry } = r.fav
|
|
68
|
+
await favorites.add(entry)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
onBeforeUnmount(() => removed.value.forEach((r) => clearTimeout(r.timer)))
|
|
72
|
+
|
|
25
73
|
const envelope = computed(() => ({
|
|
26
74
|
title: props.title ?? tOr('core.favorites.title', 'Favourites'),
|
|
75
|
+
...(props.icon !== undefined ? { icon: props.icon } : {}),
|
|
27
76
|
size: props.size,
|
|
28
77
|
state: !favorites.available
|
|
29
78
|
? ('empty' as const)
|
|
30
79
|
: !favorites.loaded.value
|
|
31
80
|
? ('loading' as const)
|
|
32
|
-
: favorites.error.value && !favorites.list.value.length
|
|
81
|
+
: favorites.error.value && !favorites.list.value.length && !removed.value.length
|
|
33
82
|
? ('unreachable' as const)
|
|
34
|
-
: favorites.list.value.length
|
|
83
|
+
: favorites.list.value.length || removed.value.length
|
|
35
84
|
? ('ready' as const)
|
|
36
85
|
: ('empty' as const),
|
|
37
86
|
error: favorites.error.value ?? undefined,
|
|
@@ -39,12 +88,22 @@ const envelope = computed(() => ({
|
|
|
39
88
|
? tOr('core.favorites.none', 'No favourites yet: the star beside a page title adds one')
|
|
40
89
|
: tOr('core.favorites.noEntity', 'No favorites entity is declared'),
|
|
41
90
|
}))
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
91
|
+
|
|
92
|
+
const line = (f: Favorite, gone = false) => ({ id: f.id, label: f.label, to: f.to, kind: f.kind, ...(gone ? { removed: true } : {}) })
|
|
93
|
+
const data = computed(() => {
|
|
94
|
+
// The latest first, each removed line back where it was
|
|
95
|
+
const items = [...favorites.list.value].reverse().map((f) => line(f))
|
|
96
|
+
for (const r of [...removed.value].sort((a, b) => a.index - b.index)) items.splice(Math.min(r.index, items.length), 0, line(r.fav, true))
|
|
97
|
+
return { items }
|
|
98
|
+
})
|
|
46
99
|
</script>
|
|
47
100
|
|
|
48
101
|
<template>
|
|
49
|
-
<QdCardView
|
|
102
|
+
<QdCardView
|
|
103
|
+
type="favorites"
|
|
104
|
+
:envelope="envelope"
|
|
105
|
+
:data="data"
|
|
106
|
+
:options="{ maxItems, groupByKind, removable }"
|
|
107
|
+
:on="{ remove: onRemove, restore: onRestore }"
|
|
108
|
+
/>
|
|
50
109
|
</template>
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
"type": "agenda",
|
|
6
6
|
"title": "Agenda",
|
|
7
7
|
"question": "What is coming?",
|
|
8
|
+
"icon": "pi pi-calendar",
|
|
8
9
|
"readings": [
|
|
9
10
|
"each line: when (a time today, \"tomorrow\", a date) and what",
|
|
10
11
|
"the first ones first"
|
|
@@ -336,6 +337,7 @@
|
|
|
336
337
|
"type": "favorites",
|
|
337
338
|
"title": "Favourites",
|
|
338
339
|
"question": "What do I follow?",
|
|
340
|
+
"icon": "pi pi-star",
|
|
339
341
|
"readings": [
|
|
340
342
|
"the pages the person starred and the searches they saved, by kind",
|
|
341
343
|
"each line opens its page, filtered as it was for a search"
|
|
@@ -363,9 +365,14 @@
|
|
|
363
365
|
"type": "boolean",
|
|
364
366
|
"default": true,
|
|
365
367
|
"description": "Group the lines by kind (records, lists, searches, boards)"
|
|
368
|
+
},
|
|
369
|
+
"removable": {
|
|
370
|
+
"type": "boolean",
|
|
371
|
+
"default": false,
|
|
372
|
+
"description": "A remove button on each line that has an id: the card emits `remove` and `restore` with it (QdFavoritesCard turns it on)"
|
|
366
373
|
}
|
|
367
374
|
},
|
|
368
|
-
"action": "none: each line is its own gesture",
|
|
375
|
+
"action": "none: each line is its own gesture; with removable, a × beside it removes it, Undo puts it back",
|
|
369
376
|
"example": {
|
|
370
377
|
"envelope": {
|
|
371
378
|
"title": "Favourites",
|
|
@@ -413,6 +420,10 @@
|
|
|
413
420
|
],
|
|
414
421
|
"additionalProperties": false,
|
|
415
422
|
"properties": {
|
|
423
|
+
"id": {
|
|
424
|
+
"type": "string",
|
|
425
|
+
"description": "The favourite's id: what a removal names"
|
|
426
|
+
},
|
|
416
427
|
"label": {
|
|
417
428
|
"type": "string"
|
|
418
429
|
},
|
|
@@ -432,6 +443,10 @@
|
|
|
432
443
|
"board"
|
|
433
444
|
],
|
|
434
445
|
"description": "What it is: a record, a list, a saved search, a board"
|
|
446
|
+
},
|
|
447
|
+
"removed": {
|
|
448
|
+
"type": "boolean",
|
|
449
|
+
"description": "Just removed: drawn as such, with its Undo"
|
|
435
450
|
}
|
|
436
451
|
}
|
|
437
452
|
}
|
|
@@ -443,6 +458,7 @@
|
|
|
443
458
|
"type": "feed",
|
|
444
459
|
"title": "Feed",
|
|
445
460
|
"question": "What happened?",
|
|
461
|
+
"icon": "pi pi-bell",
|
|
446
462
|
"readings": [
|
|
447
463
|
"each line: when, and what happened",
|
|
448
464
|
"its status, when it has one: a side mark and a word"
|
|
@@ -1069,6 +1085,7 @@
|
|
|
1069
1085
|
"type": "queue",
|
|
1070
1086
|
"title": "Queue",
|
|
1071
1087
|
"question": "What do I have to do?",
|
|
1088
|
+
"icon": "pi pi-inbox",
|
|
1072
1089
|
"readings": [
|
|
1073
1090
|
"the big number: how many are waiting, with a short note (\"1 expires tomorrow\")",
|
|
1074
1091
|
"each line: one item to process, with its own gesture",
|
|
@@ -1338,6 +1355,7 @@
|
|
|
1338
1355
|
"type": "recent",
|
|
1339
1356
|
"title": "Recent",
|
|
1340
1357
|
"question": "What was I just looking at?",
|
|
1358
|
+
"icon": "pi pi-history",
|
|
1341
1359
|
"readings": [
|
|
1342
1360
|
"the last records the person opened, the last one first",
|
|
1343
1361
|
"what each one is, and when it was seen"
|
|
@@ -5,19 +5,31 @@
|
|
|
5
5
|
* The pages someone starred and the searches they saved, grouped by kind,
|
|
6
6
|
* each opening its page. QdFavoritesCard feeds it live from useFavorites.
|
|
7
7
|
* See meta.json for the sheet.
|
|
8
|
+
*
|
|
9
|
+
* `removable` (#5392): a × beside each line that has an id, shown on hover
|
|
10
|
+
* and focus (always on a touch screen). The card only says it: `remove` with
|
|
11
|
+
* the id; a line marked `removed` reads so, with an Undo that says `restore`.
|
|
8
12
|
*/
|
|
9
|
-
import { computed } from 'vue'
|
|
13
|
+
import { computed, nextTick, ref, watch } from 'vue'
|
|
10
14
|
import { RouterLink, type RouteLocationRaw } from 'vue-router'
|
|
11
15
|
import { useI18n } from '../../../i18n/useI18n'
|
|
12
16
|
import type { CardSize } from '../../types'
|
|
13
17
|
|
|
14
18
|
type Kind = 'item' | 'list' | 'search' | 'board'
|
|
19
|
+
interface FavoriteLine {
|
|
20
|
+
id?: string
|
|
21
|
+
label: string
|
|
22
|
+
to: RouteLocationRaw
|
|
23
|
+
kind?: Kind
|
|
24
|
+
removed?: boolean
|
|
25
|
+
}
|
|
15
26
|
interface FavoritesData {
|
|
16
|
-
items:
|
|
27
|
+
items: FavoriteLine[]
|
|
17
28
|
}
|
|
18
29
|
|
|
19
|
-
const props = defineProps<{ data: FavoritesData; options: { maxItems?: number; groupByKind?: boolean }; size: CardSize }>()
|
|
20
|
-
const {
|
|
30
|
+
const props = defineProps<{ data: FavoritesData; options: { maxItems?: number; groupByKind?: boolean; removable?: boolean }; size: CardSize }>()
|
|
31
|
+
const emit = defineEmits<{ remove: [id: string]; restore: [id: string] }>()
|
|
32
|
+
const { t, tOr } = useI18n()
|
|
21
33
|
|
|
22
34
|
const KINDS: Kind[] = ['item', 'list', 'search', 'board']
|
|
23
35
|
const ICON: Record<Kind, string> = { item: 'pi pi-file', list: 'pi pi-list', search: 'pi pi-filter', board: 'pi pi-th-large' }
|
|
@@ -30,18 +42,65 @@ const groups = computed(() => {
|
|
|
30
42
|
return byKind
|
|
31
43
|
})
|
|
32
44
|
const more = computed(() => props.data.items.length - shown.value.length)
|
|
45
|
+
const canRemove = (item: FavoriteLine) => !!props.options.removable && !!item.id
|
|
46
|
+
|
|
47
|
+
// The × goes with its line: the focus moves to the Undo that replaces it
|
|
48
|
+
const root = ref<HTMLElement | null>(null)
|
|
49
|
+
const removing = ref<string | null>(null)
|
|
50
|
+
function remove(id: string): void {
|
|
51
|
+
removing.value = id
|
|
52
|
+
emit('remove', id)
|
|
53
|
+
}
|
|
54
|
+
watch(
|
|
55
|
+
() => props.data.items,
|
|
56
|
+
async () => {
|
|
57
|
+
const id = removing.value
|
|
58
|
+
if (!id || !props.data.items.some((i) => i.id === id && i.removed)) return
|
|
59
|
+
removing.value = null
|
|
60
|
+
await nextTick()
|
|
61
|
+
const buttons = root.value ? Array.from(root.value.querySelectorAll('[data-favorite-undo]')) : []
|
|
62
|
+
const undo = buttons.find((b) => (b.closest('[data-favorite]') as HTMLElement | null)?.dataset.favorite === id) as HTMLElement | undefined
|
|
63
|
+
undo?.focus()
|
|
64
|
+
}
|
|
65
|
+
)
|
|
33
66
|
</script>
|
|
34
67
|
|
|
35
68
|
<template>
|
|
36
|
-
<div class="qd-favorites">
|
|
69
|
+
<div ref="root" class="qd-favorites" :class="{ 'qd-favorites--removable': options.removable }">
|
|
37
70
|
<section v-for="g in groups" :key="g.kind ?? 'all'" class="qd-favorites-group">
|
|
38
71
|
<h3 v-if="g.kind" class="qd-favorites-kind">{{ t(`core.favorites.kind.${g.kind}`) }}</h3>
|
|
39
72
|
<ul class="qd-favorites-list">
|
|
40
|
-
<li v-for="(item, i) in g.items" :key="i">
|
|
41
|
-
<
|
|
42
|
-
<
|
|
43
|
-
<
|
|
44
|
-
|
|
73
|
+
<li v-for="(item, i) in g.items" :key="item.id ?? i" class="qd-favorites-item" :data-favorite="item.id" :data-removed="item.removed || undefined">
|
|
74
|
+
<template v-if="item.removed">
|
|
75
|
+
<span class="qd-favorites-removed" role="status">{{ tOr('core.favorites.removed', '{label} removed from favourites', { label: item.label }) }}</span>
|
|
76
|
+
<button
|
|
77
|
+
v-if="item.id"
|
|
78
|
+
type="button"
|
|
79
|
+
class="qd-favorites-undo"
|
|
80
|
+
:aria-label="tOr('core.favorites.undoLabel', 'Put {label} back in favourites', { label: item.label })"
|
|
81
|
+
data-favorite-undo
|
|
82
|
+
@click="emit('restore', item.id)"
|
|
83
|
+
>
|
|
84
|
+
{{ tOr('core.favorites.undo', 'Undo') }}
|
|
85
|
+
</button>
|
|
86
|
+
</template>
|
|
87
|
+
<template v-else>
|
|
88
|
+
<RouterLink :to="item.to" class="qd-favorites-link" :title="item.label">
|
|
89
|
+
<i :class="ICON[item.kind ?? 'item']" aria-hidden="true"></i>
|
|
90
|
+
<span class="qd-favorites-label">{{ item.label }}</span>
|
|
91
|
+
</RouterLink>
|
|
92
|
+
<button
|
|
93
|
+
v-if="canRemove(item)"
|
|
94
|
+
type="button"
|
|
95
|
+
class="qd-favorites-remove"
|
|
96
|
+
:aria-label="tOr('core.favorites.remove', 'Remove {label} from favourites', { label: item.label })"
|
|
97
|
+
:title="tOr('core.favorites.remove', 'Remove {label} from favourites', { label: item.label })"
|
|
98
|
+
data-favorite-remove
|
|
99
|
+
@click="remove(item.id!)"
|
|
100
|
+
>
|
|
101
|
+
<i class="pi pi-times" aria-hidden="true"></i>
|
|
102
|
+
</button>
|
|
103
|
+
</template>
|
|
45
104
|
</li>
|
|
46
105
|
</ul>
|
|
47
106
|
</section>
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
"type": "favorites",
|
|
3
3
|
"title": "Favourites",
|
|
4
4
|
"question": "What do I follow?",
|
|
5
|
+
"icon": "pi pi-star",
|
|
5
6
|
"readings": [
|
|
6
7
|
"the pages the person starred and the searches they saved, by kind",
|
|
7
8
|
"each line opens its page, filtered as it was for a search"
|
|
@@ -16,9 +17,10 @@
|
|
|
16
17
|
"sizes": ["s", "m"],
|
|
17
18
|
"options": {
|
|
18
19
|
"maxItems": { "type": "integer", "minimum": 1, "maximum": 20, "default": 8, "description": "How many lines to show" },
|
|
19
|
-
"groupByKind": { "type": "boolean", "default": true, "description": "Group the lines by kind (records, lists, searches, boards)" }
|
|
20
|
+
"groupByKind": { "type": "boolean", "default": true, "description": "Group the lines by kind (records, lists, searches, boards)" },
|
|
21
|
+
"removable": { "type": "boolean", "default": false, "description": "A remove button on each line that has an id: the card emits `remove` and `restore` with it (QdFavoritesCard turns it on)" }
|
|
20
22
|
},
|
|
21
|
-
"action": "none: each line is its own gesture",
|
|
23
|
+
"action": "none: each line is its own gesture; with removable, a × beside it removes it, Undo puts it back",
|
|
22
24
|
"example": {
|
|
23
25
|
"envelope": { "title": "Favourites", "status": "info", "size": "s" },
|
|
24
26
|
"data": {
|
|
@@ -10,9 +10,11 @@
|
|
|
10
10
|
"required": ["label", "to"],
|
|
11
11
|
"additionalProperties": false,
|
|
12
12
|
"properties": {
|
|
13
|
+
"id": { "type": "string", "description": "The favourite's id: what a removal names" },
|
|
13
14
|
"label": { "type": "string" },
|
|
14
15
|
"to": { "type": ["string", "object"], "description": "The page it opens" },
|
|
15
|
-
"kind": { "type": "string", "enum": ["item", "list", "search", "board"], "description": "What it is: a record, a list, a saved search, a board" }
|
|
16
|
+
"kind": { "type": "string", "enum": ["item", "list", "search", "board"], "description": "What it is: a record, a list, a saved search, a board" },
|
|
17
|
+
"removed": { "type": "boolean", "description": "Just removed: drawn as such, with its Undo" }
|
|
16
18
|
}
|
|
17
19
|
}
|
|
18
20
|
}
|
|
@@ -86,6 +86,7 @@ export function renderBestiary(cards: CardFolder[], title = 'Cards'): string {
|
|
|
86
86
|
'| Field | What it says |',
|
|
87
87
|
'|---|---|',
|
|
88
88
|
'| `title` | What the card counts |',
|
|
89
|
+
'| `icon` | An icon class before the title; default the type\'s own (below), `null` for none |',
|
|
89
90
|
'| `status` | `critical`, `watch`, `good` or `info`: a side bar, a hue and a word |',
|
|
90
91
|
'| `source`, `freshness` | Where the data comes from, and when it was read |',
|
|
91
92
|
'| `to` | The surface: the whole card opens the domain\'s board |',
|
|
@@ -117,7 +118,7 @@ export function renderBestiary(cards: CardFolder[], title = 'Cards'): string {
|
|
|
117
118
|
'',
|
|
118
119
|
list(m.avoid),
|
|
119
120
|
'',
|
|
120
|
-
`**Sizes**: ${(m.sizes as string[] | undefined)?.join(', ') ?? 's'}. **Main action**: ${String(m.action)}`,
|
|
121
|
+
`**Sizes**: ${(m.sizes as string[] | undefined)?.join(', ') ?? 's'}.${m.icon ? ` **Icon**: \`${String(m.icon)}\`.` : ''} **Main action**: ${String(m.action)}`,
|
|
121
122
|
''
|
|
122
123
|
)
|
|
123
124
|
if (Object.keys(options).length) {
|
package/src/cards/types.ts
CHANGED
|
@@ -36,6 +36,8 @@ export interface CardAction {
|
|
|
36
36
|
/** What the envelope shows around the body */
|
|
37
37
|
export interface CardEnvelope {
|
|
38
38
|
title: string
|
|
39
|
+
/** An icon class beside the title (`pi pi-star`); default the type's own, `null` for none */
|
|
40
|
+
icon?: string | null
|
|
39
41
|
status?: CardStatus
|
|
40
42
|
/** Where the data comes from ("boutique") */
|
|
41
43
|
source?: string
|
|
@@ -64,6 +66,8 @@ export interface CardMeta {
|
|
|
64
66
|
title: string
|
|
65
67
|
/** The question it answers */
|
|
66
68
|
question: string
|
|
69
|
+
/** The icon its cards show beside their title, unless the envelope says otherwise */
|
|
70
|
+
icon?: string
|
|
67
71
|
/** What each visual channel says */
|
|
68
72
|
readings: string[]
|
|
69
73
|
strengths: string[]
|
|
@@ -175,7 +175,7 @@ function onGuardStay(): void {
|
|
|
175
175
|
<!-- Nav slot for PageNav (child routes) -->
|
|
176
176
|
<slot name="nav" />
|
|
177
177
|
|
|
178
|
-
<PageHeader :title="title" :title-parts="titleParts" :favorite="favorite && isEdit ? { kind: 'item', entity, itemId: entityId } : null">
|
|
178
|
+
<PageHeader :title="title" :title-parts="titleParts" :favorite="favorite && isEdit ? { kind: 'item', entity, itemId: entityId, ready: !loading } : null">
|
|
179
179
|
<template #actions>
|
|
180
180
|
<slot name="header-actions" />
|
|
181
181
|
<!-- Header actions from builder (excludes save/delete/cancel) -->
|
|
@@ -40,6 +40,8 @@ interface FavoriteConfig {
|
|
|
40
40
|
kind: 'item' | 'list' | 'search' | 'board'
|
|
41
41
|
entity?: string | null
|
|
42
42
|
itemId?: string | number | null
|
|
43
|
+
/** The record is read (#5392): without a label of its own, it is named by its id */
|
|
44
|
+
ready?: boolean
|
|
43
45
|
}
|
|
44
46
|
|
|
45
47
|
interface Props {
|
|
@@ -80,6 +82,12 @@ const favoriteLabel = computed((): string => {
|
|
|
80
82
|
if (simpleTitle.value) return simpleTitle.value
|
|
81
83
|
const parts = effectiveTitleParts.value
|
|
82
84
|
if (parts?.entityLabel) return parts.entityLabel
|
|
85
|
+
// A record's page before its record is read (#5392): "View Task" would be
|
|
86
|
+
// its favourite's name; no star until the record's own label is known
|
|
87
|
+
const itemId = props.favorite?.itemId
|
|
88
|
+
if (itemId !== null && itemId !== undefined && itemId !== '') {
|
|
89
|
+
return props.favorite?.ready ? [parts?.entityName, `#${itemId}`].filter(Boolean).join(' ') : ''
|
|
90
|
+
}
|
|
83
91
|
if (parts) return [parts.action, parts.entityName].filter(Boolean).join(' ')
|
|
84
92
|
return props.title ?? ''
|
|
85
93
|
})
|
|
@@ -191,7 +191,7 @@ type ShowFieldValue = string | number | boolean | Date | Record<string, unknown>
|
|
|
191
191
|
<!-- Nav slot for PageNav (child routes) -->
|
|
192
192
|
<slot name="nav" />
|
|
193
193
|
|
|
194
|
-
<PageHeader :title="title" :title-parts="titleParts" :badges="badges" :favorite="favorite ? { kind: 'item', entity, itemId: entityId } : null">
|
|
194
|
+
<PageHeader :title="title" :title-parts="titleParts" :badges="badges" :favorite="favorite ? { kind: 'item', entity, itemId: entityId, ready: !!data } : null">
|
|
195
195
|
<template #actions>
|
|
196
196
|
<slot name="header-actions" />
|
|
197
197
|
<!-- Header actions from builder (e.g., edit) -->
|
|
@@ -5,10 +5,15 @@
|
|
|
5
5
|
* an indicator) and its indicators: mini cards, each read from its own source
|
|
6
6
|
* and drawn as a pill whose count is a badge.
|
|
7
7
|
*
|
|
8
|
+
* Its look (#5396): a card above the page, or a ribbon glued to the top edge
|
|
9
|
+
* of the content, its pages as tabs: the domain's `look`, else the app's
|
|
10
|
+
* `features.domainBar.look`. Both are drawn from CSS custom properties
|
|
11
|
+
* (`--qd-domain-bar-*`, `--qd-ribbon-*`), to change in the app's own CSS.
|
|
12
|
+
*
|
|
8
13
|
* Compact: one line of icons and badges, on its own once the page scrolls, or
|
|
9
14
|
* by the person's choice, kept per account.
|
|
10
15
|
*/
|
|
11
|
-
import { computed, onBeforeUnmount, onMounted, ref, watch, type Ref } from 'vue'
|
|
16
|
+
import { computed, inject, onBeforeUnmount, onMounted, ref, watch, type Ref } from 'vue'
|
|
12
17
|
import { RouterLink, useRoute, useRouter, type RouteLocationRaw } from 'vue-router'
|
|
13
18
|
import { useI18n } from '../i18n/useI18n'
|
|
14
19
|
import { useAuth } from '../composables/useAuth'
|
|
@@ -16,10 +21,14 @@ import { useAsyncRead } from '../composables/useAsyncRead'
|
|
|
16
21
|
import { getCard, checkCardInput, resolveCardOptions } from '../cards/registry'
|
|
17
22
|
import type { CardStatus } from '../cards/types'
|
|
18
23
|
import QdBadge from './QdBadge.vue'
|
|
19
|
-
import { badgeTone, type DomainDefinition, type DomainIndicator, type DomainNavEntry } from './registry'
|
|
24
|
+
import { badgeTone, type DomainDefinition, type DomainIndicator, type DomainLook, type DomainNavEntry } from './registry'
|
|
20
25
|
|
|
21
26
|
const props = defineProps<{ domain: DomainDefinition }>()
|
|
22
27
|
|
|
28
|
+
// The look (#5396): the domain's, else the app's, else a card
|
|
29
|
+
const features = inject<{ domainBar?: { look?: DomainLook } } | null>('qdadmFeatures', null)
|
|
30
|
+
const look = computed<DomainLook>(() => props.domain.look ?? features?.domainBar?.look ?? 'card')
|
|
31
|
+
|
|
23
32
|
const { locale, tOr } = useI18n()
|
|
24
33
|
const route = useRoute()
|
|
25
34
|
const router = useRouter()
|
|
@@ -147,9 +156,10 @@ function pillTitle(i: IndicatorView): string {
|
|
|
147
156
|
<div ref="sentinel" class="qd-domain-bar-sentinel" aria-hidden="true"></div>
|
|
148
157
|
<section
|
|
149
158
|
class="qd-domain-bar"
|
|
150
|
-
:class="{ 'qd-domain-bar--compact': compact }"
|
|
159
|
+
:class="[`qd-domain-bar--${look}`, { 'qd-domain-bar--compact': compact }]"
|
|
151
160
|
:aria-label="label"
|
|
152
161
|
:data-domain="domain.name"
|
|
162
|
+
:data-look="look"
|
|
153
163
|
:data-compact="compact ? (chosen ? 'chosen' : 'scrolled') : undefined"
|
|
154
164
|
>
|
|
155
165
|
<component :is="domain.to ? RouterLink : 'span'" :to="domain.to" class="qd-domain-bar-title">
|
package/src/domain/index.ts
CHANGED
|
@@ -3,4 +3,4 @@ export { default as QdDomainBar } from './QdDomainBar.vue'
|
|
|
3
3
|
export { default as QdDomainBarZone } from './QdDomainBarZone.vue'
|
|
4
4
|
export { default as QdBadge } from './QdBadge.vue'
|
|
5
5
|
export { registerDomain, getDomain, listDomains, domainOfRoute, badgeTone } from './registry'
|
|
6
|
-
export type { DomainConfig, DomainDefinition, DomainIndicator, DomainNavEntry } from './registry'
|
|
6
|
+
export type { DomainConfig, DomainDefinition, DomainIndicator, DomainLook, DomainNavEntry } from './registry'
|
package/src/domain/registry.ts
CHANGED
|
@@ -45,10 +45,18 @@ export interface DomainNavEntry {
|
|
|
45
45
|
badge?: string
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
/**
|
|
49
|
+
* How the bar sits (#5396): `card`, a card above the page (the default);
|
|
50
|
+
* `ribbon`, a panel glued to the top edge of the content, its pages as tabs
|
|
51
|
+
*/
|
|
52
|
+
export type DomainLook = 'card' | 'ribbon'
|
|
53
|
+
|
|
48
54
|
/** What `ctx.domain(name, …)` declares */
|
|
49
55
|
export interface DomainConfig {
|
|
50
56
|
label: string
|
|
51
57
|
icon?: string
|
|
58
|
+
/** Default: the app's `features.domainBar.look`, else `card` */
|
|
59
|
+
look?: DomainLook
|
|
52
60
|
/** Where the domain's title leads (its board) */
|
|
53
61
|
to?: RouteLocationRaw
|
|
54
62
|
nav?: DomainNavEntry[]
|
|
@@ -487,6 +487,9 @@ export default `core:
|
|
|
487
487
|
favorites:
|
|
488
488
|
add: "Add {label} to favourites"
|
|
489
489
|
remove: "Remove {label} from favourites"
|
|
490
|
+
removed: "{label} removed from favourites"
|
|
491
|
+
undo: Undo
|
|
492
|
+
undoLabel: "Put {label} back in favourites"
|
|
490
493
|
saveSearch: Save this search
|
|
491
494
|
searchSaved: Search saved
|
|
492
495
|
searchName: Name of the search
|
|
@@ -485,6 +485,9 @@ core:
|
|
|
485
485
|
favorites:
|
|
486
486
|
add: "Add {label} to favourites"
|
|
487
487
|
remove: "Remove {label} from favourites"
|
|
488
|
+
removed: "{label} removed from favourites"
|
|
489
|
+
undo: Undo
|
|
490
|
+
undoLabel: "Put {label} back in favourites"
|
|
488
491
|
saveSearch: Save this search
|
|
489
492
|
searchSaved: Search saved
|
|
490
493
|
searchName: Name of the search
|
|
@@ -487,6 +487,9 @@ export default `core:
|
|
|
487
487
|
favorites:
|
|
488
488
|
add: "Ajouter {label} aux favoris"
|
|
489
489
|
remove: "Retirer {label} des favoris"
|
|
490
|
+
removed: "{label} retiré des favoris"
|
|
491
|
+
undo: Annuler
|
|
492
|
+
undoLabel: "Remettre {label} dans les favoris"
|
|
490
493
|
saveSearch: Enregistrer cette recherche
|
|
491
494
|
searchSaved: Recherche enregistrée
|
|
492
495
|
searchName: Nom de la recherche
|
|
@@ -485,6 +485,9 @@ core:
|
|
|
485
485
|
favorites:
|
|
486
486
|
add: "Ajouter {label} aux favoris"
|
|
487
487
|
remove: "Retirer {label} des favoris"
|
|
488
|
+
removed: "{label} retiré des favoris"
|
|
489
|
+
undo: Annuler
|
|
490
|
+
undoLabel: "Remettre {label} dans les favoris"
|
|
488
491
|
saveSearch: Enregistrer cette recherche
|
|
489
492
|
searchSaved: Recherche enregistrée
|
|
490
493
|
searchName: Nom de la recherche
|