@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.
Files changed (129) hide show
  1. package/dist/node/cards/tools/cardsTool.d.ts +32 -0
  2. package/dist/node/cards/tools/cardsTool.js +151 -0
  3. package/dist/node/cards/tools/cli.d.ts +2 -0
  4. package/dist/node/cards/tools/cli.js +38 -0
  5. package/dist/node/cards/validate.d.ts +35 -0
  6. package/dist/node/cards/validate.js +94 -0
  7. package/dist/styles/qdadm.css +1 -1
  8. package/package.json +7 -2
  9. package/src/board/QdBoardBlock.vue +67 -0
  10. package/src/board/QdDomainBoard.vue +64 -0
  11. package/src/board/blocks/BreakdownBlock.vue +44 -0
  12. package/src/board/blocks/KpiBlock.vue +31 -0
  13. package/src/board/blocks/TimelineBlock.vue +63 -0
  14. package/src/board/blocks/TopBlock.vue +57 -0
  15. package/src/board/blocks/schemas.ts +107 -0
  16. package/src/board/index.ts +31 -0
  17. package/src/board/registry.ts +33 -0
  18. package/src/board/types.ts +32 -0
  19. package/src/cards/QdCard.vue +175 -0
  20. package/src/cards/QdCardView.vue +53 -0
  21. package/src/cards/QdCardsGallery.vue +103 -0
  22. package/src/cards/QdFavoritesCard.vue +50 -0
  23. package/src/cards/QdRecentCard.vue +44 -0
  24. package/src/cards/builtin/agenda/AgendaCard.vue +37 -0
  25. package/src/cards/builtin/agenda/meta.json +60 -0
  26. package/src/cards/builtin/agenda/schema.json +48 -0
  27. package/src/cards/builtin/bullet/BulletCard.vue +76 -0
  28. package/src/cards/builtin/bullet/meta.json +38 -0
  29. package/src/cards/builtin/bullet/schema.json +18 -0
  30. package/src/cards/builtin/cards-index.json +1694 -0
  31. package/src/cards/builtin/compare/CompareCard.vue +47 -0
  32. package/src/cards/builtin/compare/meta.json +79 -0
  33. package/src/cards/builtin/compare/schema.json +40 -0
  34. package/src/cards/builtin/favorites/FavoritesCard.vue +50 -0
  35. package/src/cards/builtin/favorites/meta.json +33 -0
  36. package/src/cards/builtin/favorites/schema.json +20 -0
  37. package/src/cards/builtin/feed/FeedCard.vue +39 -0
  38. package/src/cards/builtin/feed/meta.json +64 -0
  39. package/src/cards/builtin/feed/schema.json +54 -0
  40. package/src/cards/builtin/funnel/FunnelCard.vue +44 -0
  41. package/src/cards/builtin/funnel/meta.json +53 -0
  42. package/src/cards/builtin/funnel/schema.json +37 -0
  43. package/src/cards/builtin/goal/GoalCard.vue +73 -0
  44. package/src/cards/builtin/goal/meta.json +43 -0
  45. package/src/cards/builtin/goal/schema.json +12 -0
  46. package/src/cards/builtin/heat/HeatCard.vue +46 -0
  47. package/src/cards/builtin/heat/meta.json +101 -0
  48. package/src/cards/builtin/heat/schema.json +39 -0
  49. package/src/cards/builtin/index.ts +71 -0
  50. package/src/cards/builtin/metric/MetricCard.vue +82 -0
  51. package/src/cards/builtin/metric/meta.json +109 -0
  52. package/src/cards/builtin/metric/schema.json +35 -0
  53. package/src/cards/builtin/pills.ts +36 -0
  54. package/src/cards/builtin/queue/QueueCard.vue +65 -0
  55. package/src/cards/builtin/queue/meta.json +47 -0
  56. package/src/cards/builtin/queue/schema.json +32 -0
  57. package/src/cards/builtin/ranking/RankingCard.vue +37 -0
  58. package/src/cards/builtin/ranking/meta.json +71 -0
  59. package/src/cards/builtin/ranking/schema.json +35 -0
  60. package/src/cards/builtin/recent/RecentCard.vue +41 -0
  61. package/src/cards/builtin/recent/meta.json +32 -0
  62. package/src/cards/builtin/recent/schema.json +21 -0
  63. package/src/cards/builtin/shared.ts +83 -0
  64. package/src/cards/builtin/split/SplitCard.vue +52 -0
  65. package/src/cards/builtin/split/meta.json +72 -0
  66. package/src/cards/builtin/split/schema.json +40 -0
  67. package/src/cards/builtin/trend/TrendCard.vue +75 -0
  68. package/src/cards/builtin/trend/meta.json +81 -0
  69. package/src/cards/builtin/trend/schema.json +58 -0
  70. package/src/cards/index.ts +29 -0
  71. package/src/cards/registry.ts +57 -0
  72. package/src/cards/tools/cardsTool.ts +181 -0
  73. package/src/cards/tools/cli.ts +35 -0
  74. package/src/cards/types.ts +111 -0
  75. package/src/cards/validate.ts +111 -0
  76. package/src/components/edit/FormActions.vue +9 -5
  77. package/src/components/edit/FormPage.vue +17 -2
  78. package/src/components/layout/AppLayout.vue +4 -0
  79. package/src/components/layout/BaseLayout.vue +4 -0
  80. package/src/components/layout/CardParamsForm.vue +157 -0
  81. package/src/components/layout/CardsDashboard.vue +276 -57
  82. package/src/components/layout/PageHeader.vue +22 -1
  83. package/src/components/layout/QdFavoriteStar.vue +71 -0
  84. package/src/components/layout/Zone.vue +2 -1
  85. package/src/components/lists/ListPage.vue +9 -1
  86. package/src/components/lists/QdSaveSearch.vue +79 -0
  87. package/src/components/pages/NotFoundPage.vue +5 -2
  88. package/src/components/run/QdRunBar.vue +99 -0
  89. package/src/components/show/ShowPage.vue +10 -1
  90. package/src/composables/useBreadcrumb.ts +1 -1
  91. package/src/composables/useCardsArrangement.ts +297 -27
  92. package/src/composables/useEntityItemFormPage.ts +39 -3
  93. package/src/composables/useEntityItemFormPage.types.ts +8 -0
  94. package/src/composables/useEntityItemShowPage.ts +22 -0
  95. package/src/composables/useListPage.ts +71 -0
  96. package/src/composables/useListPage.types.ts +6 -0
  97. package/src/composables/useUnsavedChangesGuard.ts +17 -1
  98. package/src/domain/QdBadge.vue +36 -0
  99. package/src/domain/QdDomainBar.vue +213 -0
  100. package/src/domain/QdDomainBarZone.vue +19 -0
  101. package/src/domain/index.ts +6 -0
  102. package/src/domain/registry.ts +122 -0
  103. package/src/favorites/index.ts +7 -0
  104. package/src/favorites/store.ts +172 -0
  105. package/src/favorites/useFavorites.ts +217 -0
  106. package/src/i18n/defaults/core.en.generated.ts +132 -0
  107. package/src/i18n/defaults/core.en.yml +132 -0
  108. package/src/i18n/defaults/core.fr.generated.ts +132 -0
  109. package/src/i18n/defaults/core.fr.yml +132 -0
  110. package/src/index.ts +23 -0
  111. package/src/kernel/Kernel.routing.ts +4 -15
  112. package/src/kernel/Kernel.types.ts +5 -1
  113. package/src/kernel/Kernel.vue.ts +2 -2
  114. package/src/kernel/KernelContext.routing.ts +10 -1
  115. package/src/kernel/KernelContext.ts +7 -0
  116. package/src/kernel/KernelContext.types.ts +2 -0
  117. package/src/kernel/homeRoute.ts +45 -0
  118. package/src/module/moduleRegistry.ts +4 -0
  119. package/src/run/index.ts +6 -0
  120. package/src/run/run.ts +162 -0
  121. package/src/run/useRun.ts +207 -0
  122. package/src/styles/_cards-dashboard.scss +190 -0
  123. package/src/styles/_qd-board.scss +359 -0
  124. package/src/styles/_qd-cards.scss +1197 -0
  125. package/src/styles/_qd-domain-bar.scss +159 -0
  126. package/src/styles/_qd-run.scss +135 -0
  127. package/src/styles/index.scss +4 -0
  128. package/src/zones/ZoneRegistry.ts +16 -0
  129. package/src/zones/index.ts +1 -0
@@ -0,0 +1,79 @@
1
+ <script setup lang="ts">
2
+ /**
3
+ * QdSaveSearch (#5349): "Save this search" on a filtered list. It asks for a
4
+ * name (by default the filter in words) and keeps the list's route with its
5
+ * query as a favourite of kind `search`: the list writes its filters in the
6
+ * URL, so the favourite opens it filtered again.
7
+ */
8
+ import { computed, nextTick, ref } from 'vue'
9
+ import { useRoute } from 'vue-router'
10
+ import QdButton from '../base/QdButton.vue'
11
+ import { useI18n } from '../../i18n/useI18n'
12
+ import { useFavorites } from '../../favorites/useFavorites'
13
+
14
+ const props = withDefaults(defineProps<{ defaultName: string; entity?: string | null }>(), { entity: null })
15
+
16
+ const route = useRoute() as ReturnType<typeof useRoute> | undefined
17
+ const { tOr } = useI18n()
18
+ const favorites = useFavorites()
19
+
20
+ /** The list as it is now, without a run's key */
21
+ const target = computed(() => {
22
+ if (!route) return ''
23
+ const params = new URLSearchParams()
24
+ for (const [k, v] of Object.entries(route.query)) {
25
+ if (k === 'run' || v === null || v === undefined) continue
26
+ for (const one of Array.isArray(v) ? v : [v]) if (one !== null) params.append(k, String(one))
27
+ }
28
+ const q = params.toString()
29
+ return q ? `${route.path}?${q}` : route.path
30
+ })
31
+ const saved = computed(() => favorites.has(target.value))
32
+
33
+ const asking = ref(false)
34
+ const name = ref('')
35
+ const input = ref<HTMLInputElement | null>(null)
36
+
37
+ async function ask(): Promise<void> {
38
+ if (saved.value) return
39
+ name.value = props.defaultName
40
+ asking.value = true
41
+ await nextTick()
42
+ input.value?.focus()
43
+ input.value?.select()
44
+ }
45
+
46
+ async function close(): Promise<void> {
47
+ asking.value = false
48
+ await nextTick()
49
+ ;(document.querySelector('[data-save-search]') as HTMLElement | null)?.focus()
50
+ }
51
+
52
+ function save(): void {
53
+ const label = name.value.trim() || props.defaultName
54
+ void favorites.add({ kind: 'search', label, to: target.value, ...(props.entity ? { entity: props.entity } : {}) })
55
+ void close()
56
+ }
57
+ </script>
58
+
59
+ <template>
60
+ <template v-if="favorites.available">
61
+ <form v-if="asking" class="qd-save-search" @submit.prevent="save" @keydown.esc.prevent="close">
62
+ <label class="qd-cards-sr" for="qd-save-search-name">{{ tOr('core.favorites.searchName', 'Name of the search') }}</label>
63
+ <input id="qd-save-search-name" ref="input" v-model="name" type="text" class="qd-save-search-input" />
64
+ <QdButton type="submit" size="small" icon="pi pi-check" :label="tOr('core.favorites.save', 'Save')" />
65
+ <QdButton type="button" size="small" text :label="tOr('core.actions.cancel', 'Cancel')" @click="close" />
66
+ </form>
67
+ <QdButton
68
+ v-else
69
+ type="button"
70
+ size="small"
71
+ text
72
+ :icon="saved ? 'pi pi-bookmark-fill' : 'pi pi-bookmark'"
73
+ :label="saved ? tOr('core.favorites.searchSaved', 'Search saved') : tOr('core.favorites.saveSearch', 'Save this search')"
74
+ :aria-disabled="saved || undefined"
75
+ data-save-search
76
+ @click="ask"
77
+ />
78
+ </template>
79
+ </template>
@@ -4,15 +4,18 @@
4
4
  *
5
5
  * Simple page with link to home. Can be replaced via pages.notFound option.
6
6
  */
7
- import { computed, type ComputedRef } from 'vue'
7
+ import { computed, inject, type ComputedRef } from 'vue'
8
8
  import { useRouter, type RouteRecordName } from 'vue-router'
9
9
  import { useI18n } from '../../i18n/useI18n'
10
10
 
11
11
  const router = useRouter()
12
12
  const { tOr } = useI18n()
13
13
 
14
+ const declaredHome = inject<string | null>('qdadmHomeRoute', null)
15
+
14
16
  const homeRoute: ComputedRef<RouteRecordName | string> = computed(() => {
15
- // Find home route (first route or named 'home'/'dashboard')
17
+ // The home the app declares (homeRoute), else a route named 'home' or 'dashboard', else '/' (#5365)
18
+ if (declaredHome && router.hasRoute(declaredHome)) return declaredHome
16
19
  const routes = router.getRoutes()
17
20
  const home = routes.find(r => r.name === 'home' || r.name === 'dashboard')
18
21
  return home?.name || '/'
@@ -0,0 +1,99 @@
1
+ <script setup lang="ts">
2
+ /**
3
+ * QdRunBar (#5343): where this item is in the run it was opened from.
4
+ *
5
+ * "Book 3 of 14 to process", how the items were chosen and ordered, how many
6
+ * are done; Previous / Next, and K / J on the keyboard; the strip, one segment
7
+ * per item (done filled, urgent warm, current outlined, each saying so in its
8
+ * title too). FormPage and ShowPage render it when the URL carries `?run=`;
9
+ * it renders nothing otherwise.
10
+ */
11
+ import { computed, onBeforeUnmount, onMounted } from 'vue'
12
+ import { useI18n } from '../../i18n/useI18n'
13
+ import { useRun } from '../../run/useRun'
14
+
15
+ const props = withDefaults(defineProps<{ entityLabel?: string | null }>(), { entityLabel: null })
16
+
17
+ const { t } = useI18n()
18
+ const run = useRun()
19
+
20
+ const heading = computed(() => {
21
+ const r = run.run.value
22
+ if (!r) return ''
23
+ const where = t('core.run.position', { position: run.position.value, total: run.total.value })
24
+ return [props.entityLabel, where, r.label].filter(Boolean).join(' ')
25
+ })
26
+
27
+ const details = computed(() => {
28
+ const r = run.run.value
29
+ if (!r) return []
30
+ return [
31
+ r.order ? t('core.run.order', { order: r.order }) : null,
32
+ r.filter ? t('core.run.filter', { filter: r.filter }) : null,
33
+ run.doneCount.value ? t('core.run.doneSince', { count: run.doneCount.value }) : null,
34
+ ].filter((d): d is string => !!d)
35
+ })
36
+
37
+ const segments = computed(() =>
38
+ (run.run.value?.items ?? []).map((item, i) => {
39
+ const state = i === run.index.value ? 'current' : item.done ? 'done' : item.urgent ? 'urgent' : 'todo'
40
+ const name = item.label ?? item.id
41
+ return { i, state, done: !!item.done, title: `${i + 1}. ${name} · ${t(`core.run.state.${state}`)}` }
42
+ })
43
+ )
44
+
45
+ function typing(target: EventTarget | null): boolean {
46
+ const el = target as HTMLElement | null
47
+ if (!el || typeof el.closest !== 'function') return false
48
+ return !!el.closest('input, textarea, select, [contenteditable=""], [contenteditable="true"], [role="textbox"], [role="combobox"]')
49
+ }
50
+
51
+ function onKey(e: KeyboardEvent): void {
52
+ if (!run.active.value || e.ctrlKey || e.metaKey || e.altKey || e.defaultPrevented || typing(e.target)) return
53
+ const key = e.key.toLowerCase()
54
+ if (key === 'j' && run.next.value) {
55
+ e.preventDefault()
56
+ void run.goNext()
57
+ } else if (key === 'k' && run.prev.value) {
58
+ e.preventDefault()
59
+ void run.goPrev()
60
+ }
61
+ }
62
+
63
+ onMounted(() => window.addEventListener('keydown', onKey))
64
+ onBeforeUnmount(() => window.removeEventListener('keydown', onKey))
65
+ </script>
66
+
67
+ <template>
68
+ <nav v-if="run.active.value" class="qd-run-bar" :aria-label="t('core.run.bar')" data-run-bar>
69
+ <button type="button" class="qd-run-step qd-run-prev" :disabled="!run.prev.value" @click="run.goPrev()">
70
+ <i class="pi pi-arrow-left" aria-hidden="true"></i>
71
+ <span>{{ t('core.run.prev') }}</span>
72
+ <kbd aria-hidden="true">K</kbd>
73
+ </button>
74
+
75
+ <div class="qd-run-where">
76
+ <div class="qd-run-heading" aria-live="polite">{{ heading }}</div>
77
+ <div v-if="details.length" class="qd-run-details">{{ details.join(' · ') }}</div>
78
+ <ol class="qd-run-strip">
79
+ <li v-for="seg in segments" :key="seg.i">
80
+ <button
81
+ type="button"
82
+ class="qd-run-seg"
83
+ :data-state="seg.state"
84
+ :title="seg.title"
85
+ :aria-label="seg.title"
86
+ :aria-current="seg.state === 'current' ? 'step' : undefined"
87
+ @click="run.goTo(seg.i)"
88
+ ></button>
89
+ </li>
90
+ </ol>
91
+ </div>
92
+
93
+ <button type="button" class="qd-run-step qd-run-next" :disabled="!run.next.value" @click="run.goNext()">
94
+ <span>{{ t('core.run.next') }}</span>
95
+ <kbd aria-hidden="true">J</kbd>
96
+ <i class="pi pi-arrow-right" aria-hidden="true"></i>
97
+ </button>
98
+ </nav>
99
+ </template>
@@ -42,6 +42,7 @@
42
42
  import { computed, type PropType } from 'vue'
43
43
  import PageHeader from '../layout/PageHeader.vue'
44
44
  import CardShell from '../layout/CardShell.vue'
45
+ import QdRunBar from '../run/QdRunBar.vue'
45
46
  import { formatFetchError } from '../../utils/errors'
46
47
  import QdButton from '../base/QdButton.vue'
47
48
  import QdMessage from '../base/QdMessage.vue'
@@ -124,6 +125,11 @@ const props = defineProps({
124
125
  // UI options
125
126
  showActions: { type: Boolean, default: true },
126
127
  cardWrapper: { type: Boolean, default: true },
128
+ // The favourite star beside the title (#5349)
129
+ favorite: { type: Boolean, default: true },
130
+ // The entity and the record, for the favourite (#5349)
131
+ entity: { type: String as PropType<string | null>, default: null },
132
+ entityId: { type: [String, Number] as PropType<string | number | null>, default: null },
127
133
  horizontalFields: { type: Boolean, default: true },
128
134
  labelWidth: { type: String, default: '140px' },
129
135
  // Media zone options
@@ -185,7 +191,7 @@ type ShowFieldValue = string | number | boolean | Date | Record<string, unknown>
185
191
  <!-- Nav slot for PageNav (child routes) -->
186
192
  <slot name="nav" />
187
193
 
188
- <PageHeader :title="title" :title-parts="titleParts" :badges="badges">
194
+ <PageHeader :title="title" :title-parts="titleParts" :badges="badges" :favorite="favorite ? { kind: 'item', entity, itemId: entityId } : null">
189
195
  <template #actions>
190
196
  <slot name="header-actions" />
191
197
  <!-- Header actions from builder (e.g., edit) -->
@@ -202,6 +208,9 @@ type ShowFieldValue = string | number | boolean | Date | Record<string, unknown>
202
208
  </template>
203
209
  </PageHeader>
204
210
 
211
+ <!-- Where this item is in the run it was opened from (#5343) -->
212
+ <QdRunBar :entity-label="titleParts?.entityName ?? null" />
213
+
205
214
  <!-- Toolbar slot (between header and content) -->
206
215
  <slot name="toolbar" />
207
216
 
@@ -142,7 +142,7 @@ export function useBreadcrumb(options: UseBreadcrumbOptions = {}): UseBreadcrumb
142
142
  const routeName = item.route!
143
143
  displayItem.label = item.label || label(routeName) || capitalize(routeName)
144
144
  displayItem.to = isLast ? null : routeExists(routeName) ? { name: routeName } : null
145
- if (routeName === 'home') {
145
+ if (routeName === 'home' || routeName === homeRouteName) {
146
146
  displayItem.icon = 'pi pi-home'
147
147
  }
148
148
  } else if (item.kind.startsWith('entity-')) {