@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
@@ -33,6 +33,8 @@ interface Props {
33
33
  dirty?: boolean
34
34
  showSaveAndClose?: boolean
35
35
  deleteAction?: DeleteAction | null
36
+ /** In a run (#5343): Save & Close becomes "Save and go to the next", enabled even with nothing changed */
37
+ inRun?: boolean
36
38
  }
37
39
 
38
40
  withDefaults(defineProps<Props>(), {
@@ -40,7 +42,8 @@ withDefaults(defineProps<Props>(), {
40
42
  saving: false,
41
43
  dirty: true, // Default true for backwards compatibility
42
44
  showSaveAndClose: true,
43
- deleteAction: null
45
+ deleteAction: null,
46
+ inRun: false
44
47
  })
45
48
 
46
49
  const emit = defineEmits<{
@@ -65,13 +68,14 @@ const emit = defineEmits<{
65
68
  <QdButton
66
69
  v-if="showSaveAndClose"
67
70
  type="button"
68
- :label="isEdit ? t('core.actions.updateAndClose') : t('core.actions.createAndClose')"
71
+ :label="inRun ? t('core.run.saveAndNext') : isEdit ? t('core.actions.updateAndClose') : t('core.actions.createAndClose')"
69
72
  :loading="saving"
70
- :disabled="!dirty || saving"
71
- icon="pi pi-check-circle"
73
+ :disabled="(!dirty && !inRun) || saving"
74
+ :icon="inRun ? 'pi pi-arrow-right' : 'pi pi-check-circle'"
72
75
  severity="success"
76
+ data-save-and-close
73
77
  @click="emit('saveAndClose')"
74
- v-tooltip.top="t('core.tooltips.saveAndReturn')"
78
+ v-tooltip.top="inRun ? undefined : t('core.tooltips.saveAndReturn')"
75
79
  />
76
80
  <span v-if="dirty" class="dirty-indicator" v-tooltip.top="t('core.tooltips.unsavedChanges')">
77
81
  <i class="pi pi-circle-fill"></i>
@@ -39,6 +39,8 @@ import FormActions from './FormActions.vue'
39
39
  import UnsavedChangesDialog from '../dialogs/UnsavedChangesDialog.vue'
40
40
  import QdRevealOnce from '../dialogs/QdRevealOnce.vue'
41
41
  import CardShell from '../layout/CardShell.vue'
42
+ import QdRunBar from '../run/QdRunBar.vue'
43
+ import { useRun } from '../../run/useRun'
42
44
  import { formatFetchError } from '../../utils/errors'
43
45
  import QdButton from '../base/QdButton.vue'
44
46
  import QdMessage from '../base/QdMessage.vue'
@@ -109,7 +111,12 @@ const props = defineProps({
109
111
  // UI options
110
112
  showFormActions: { type: Boolean, default: true },
111
113
  showSaveAndClose: { type: Boolean, default: true },
112
- cardWrapper: { type: Boolean, default: true }
114
+ cardWrapper: { type: Boolean, default: true },
115
+ /** The favourite star beside the title, in edit mode (#5349) */
116
+ favorite: { type: Boolean, default: true },
117
+ /** The entity and the record, for the favourite (#5349) */
118
+ entity: { type: String as PropType<string | null>, default: null },
119
+ entityId: { type: [String, Number] as PropType<string | number | null>, default: null }
113
120
  })
114
121
 
115
122
  const emit = defineEmits<{
@@ -133,6 +140,10 @@ const deleteAction = computed(() => {
133
140
  })
134
141
 
135
142
  // Get error message from fetchError
143
+ // A run (#5343): the bar, and Save & Close goes to the next item instead
144
+ const run = useRun()
145
+ const inRun = computed(() => props.isEdit && run.active.value)
146
+
136
147
  const fetchErrorMessage = computed<string | null>(() => formatFetchError(props.fetchError))
137
148
 
138
149
  // A qdadm layout (AppLayout, BaseLayout) renders the registered guard dialog: rendering it here too
@@ -164,7 +175,7 @@ function onGuardStay(): void {
164
175
  <!-- Nav slot for PageNav (child routes) -->
165
176
  <slot name="nav" />
166
177
 
167
- <PageHeader :title="title" :title-parts="titleParts">
178
+ <PageHeader :title="title" :title-parts="titleParts" :favorite="favorite && isEdit ? { kind: 'item', entity, itemId: entityId } : null">
168
179
  <template #actions>
169
180
  <slot name="header-actions" />
170
181
  <!-- Header actions from builder (excludes save/delete/cancel) -->
@@ -182,6 +193,9 @@ function onGuardStay(): void {
182
193
  </template>
183
194
  </PageHeader>
184
195
 
196
+ <!-- Where this item is in the run it was opened from (#5343) -->
197
+ <QdRunBar :entity-label="titleParts?.entityName ?? null" />
198
+
185
199
  <!-- Toolbar slot (between header and form) -->
186
200
  <slot name="toolbar" />
187
201
 
@@ -232,6 +246,7 @@ function onGuardStay(): void {
232
246
  :dirty="dirty"
233
247
  :showSaveAndClose="showSaveAndClose"
234
248
  :deleteAction="deleteAction"
249
+ :inRun="inRun"
235
250
  @save="emit('save')"
236
251
  @saveAndClose="emit('saveAndClose')"
237
252
  @cancel="emit('cancel')"
@@ -31,6 +31,7 @@ import SidebarBox from './SidebarBox.vue'
31
31
  import Zone from './Zone.vue'
32
32
  import AppBanner from './AppBanner.vue'
33
33
  import NavlinksGroup from './NavlinksGroup.vue'
34
+ import QdDomainBarZone from '../../domain/QdDomainBarZone.vue'
34
35
  import qdadmLogo from '../../assets/logo.svg'
35
36
  import { version as qdadmVersion } from '../../../package.json'
36
37
 
@@ -409,6 +410,9 @@ const showBreadcrumb = computed<boolean>(() => {
409
410
  <span class="mobile-header-title">{{ app.name }}</span>
410
411
  </div>
411
412
 
413
+ <!-- The domain's bar, on every page of a domain (#5389) -->
414
+ <QdDomainBarZone />
415
+
412
416
  <!-- Breadcrumb + Navlinks bar -->
413
417
  <div v-if="showBreadcrumb" class="layout-nav-bar">
414
418
  <Breadcrumb :model="breadcrumbItems" class="layout-breadcrumb">
@@ -34,6 +34,7 @@ import { useSlots, provide, ref } from 'vue'
34
34
  import { RouterView } from 'vue-router'
35
35
  import ConfirmDialog from 'primevue/confirmdialog'
36
36
  import Zone from './Zone.vue'
37
+ import QdDomainBarZone from '../../domain/QdDomainBarZone.vue'
37
38
  import AppBanner from './AppBanner.vue'
38
39
  import { LAYOUT_ZONES } from '../../zones/zones'
39
40
  import { useGuardDialog, GUARD_DIALOG_HOST } from '../../composables/useGuardStore'
@@ -99,6 +100,9 @@ provide('qdadmNavlinksOverride', navlinksOverride)
99
100
 
100
101
  <!-- Main content area -->
101
102
  <div class="main-area">
103
+ <!-- The domain's bar, on every page of a domain (#5389) -->
104
+ <QdDomainBarZone />
105
+
102
106
  <!-- Breadcrumb zone -->
103
107
  <Zone
104
108
  :name="LAYOUT_ZONES.BREADCRUMB"
@@ -0,0 +1,157 @@
1
+ <script setup lang="ts">
2
+ /**
3
+ * CardParamsForm (#5348): the small form CardsDashboard's catalogue draws
4
+ * from a repeatable card's `params` schema, to add it.
5
+ *
6
+ * One field per property: a choice for an `enum` (labels from `enumLabels`,
7
+ * keyed by value), a number for `number` / `integer`, yes / no for
8
+ * `boolean`, text otherwise. Each with its `title` (else its key) and its
9
+ * `description`. The values are checked against the schema before `submit`.
10
+ */
11
+ import { computed, reactive, ref } from 'vue'
12
+ import QdButton from '../base/QdButton.vue'
13
+ import { useI18n } from '../../i18n/useI18n'
14
+ import { validateCardData, type CardSchema } from '../../cards/validate'
15
+
16
+ const props = withDefaults(
17
+ defineProps<{
18
+ schema?: CardSchema | null
19
+ /** The card's title, as the person may change it */
20
+ title: string
21
+ /** The sections to choose from; none: no choice */
22
+ sections?: Array<{ id: string; title: string }>
23
+ idPrefix: string
24
+ }>(),
25
+ { schema: null, sections: () => [] }
26
+ )
27
+
28
+ const emit = defineEmits<{
29
+ (e: 'submit', value: { params: Record<string, unknown>; title: string; section: string | null }): void
30
+ (e: 'cancel'): void
31
+ }>()
32
+
33
+ const { tOr } = useI18n()
34
+
35
+ type Kind = 'choice' | 'number' | 'boolean' | 'text'
36
+ interface Field {
37
+ key: string
38
+ kind: Kind
39
+ label: string
40
+ description?: string
41
+ required: boolean
42
+ options: Array<{ value: unknown; label: string }>
43
+ integer: boolean
44
+ }
45
+
46
+ const fields = computed<Field[]>(() =>
47
+ Object.entries(props.schema?.properties ?? {}).map(([key, p]) => {
48
+ const types = Array.isArray(p.type) ? p.type : [p.type]
49
+ const labels = (p.enumLabels ?? {}) as Record<string, string>
50
+ const kind: Kind = Array.isArray(p.enum) ? 'choice' : types.includes('boolean') ? 'boolean' : types.some((t) => t === 'number' || t === 'integer') ? 'number' : 'text'
51
+ return {
52
+ key,
53
+ kind,
54
+ label: tOr(p.title ?? key, p.title ?? key),
55
+ ...(p.description ? { description: tOr(p.description, p.description) } : {}),
56
+ required: (props.schema?.required ?? []).includes(key),
57
+ options: (p.enum ?? []).map((v) => ({ value: v, label: tOr(labels[String(v)] ?? String(v), labels[String(v)] ?? String(v)) })),
58
+ integer: types.includes('integer'),
59
+ }
60
+ })
61
+ )
62
+
63
+ const values = reactive<Record<string, unknown>>(
64
+ Object.fromEntries(Object.entries(props.schema?.properties ?? {}).map(([key, p]) => [key, p.default ?? (p.type === 'boolean' ? false : '')]))
65
+ )
66
+ const title = ref(props.title)
67
+ const section = ref<string | null>(props.sections[0]?.id ?? null)
68
+ const problems = ref<Record<string, string>>({})
69
+
70
+ /** The values as the schema wants them: numbers as numbers, empty as absent */
71
+ function collect(): Record<string, unknown> {
72
+ const out: Record<string, unknown> = {}
73
+ for (const f of fields.value) {
74
+ const v = values[f.key]
75
+ if (v === '' || v === null || v === undefined) continue
76
+ if (f.kind === 'number') {
77
+ const n = Number(v)
78
+ out[f.key] = Number.isNaN(n) ? v : n
79
+ } else if (f.kind === 'choice') {
80
+ // A select gives strings: back to the enum's own value
81
+ out[f.key] = f.options.find((o) => String(o.value) === String(v))?.value ?? v
82
+ } else out[f.key] = v
83
+ }
84
+ return out
85
+ }
86
+
87
+ function submit(): void {
88
+ const params = collect()
89
+ const found: Record<string, string> = {}
90
+ if (props.schema) {
91
+ for (const p of validateCardData(params, props.schema, 'params')) {
92
+ const key = p.path.replace(/^params\.?/, '').split(/[.[]/)[0] || '_'
93
+ found[key] ??= p.message === 'is required' ? tOr('core.cardsDashboard.paramRequired', 'Fill this in') : tOr('core.cardsDashboard.paramInvalid', 'Not a valid value: {problem}', { problem: p.message })
94
+ }
95
+ }
96
+ problems.value = found
97
+ if (Object.keys(found).length) {
98
+ const first = fields.value.find((f) => found[f.key])
99
+ if (first) document.getElementById(`${props.idPrefix}-${first.key}`)?.focus()
100
+ return
101
+ }
102
+ emit('submit', { params, title: title.value.trim() || props.title, section: section.value })
103
+ }
104
+ </script>
105
+
106
+ <template>
107
+ <form class="qd-card-params" novalidate @submit.prevent="submit">
108
+ <div class="qd-card-params-field">
109
+ <label :for="`${idPrefix}-title`">{{ tOr('core.cardsDashboard.cardTitle', 'Title') }}</label>
110
+ <input :id="`${idPrefix}-title`" v-model="title" type="text" class="p-inputtext p-component" />
111
+ </div>
112
+ <div v-for="f in fields" :key="f.key" class="qd-card-params-field" :class="{ 'qd-card-params-check': f.kind === 'boolean' }">
113
+ <template v-if="f.kind === 'boolean'">
114
+ <input :id="`${idPrefix}-${f.key}`" v-model="values[f.key]" type="checkbox" :aria-describedby="f.description ? `${idPrefix}-${f.key}-help` : undefined" />
115
+ <label :for="`${idPrefix}-${f.key}`">{{ f.label }}</label>
116
+ </template>
117
+ <template v-else>
118
+ <label :for="`${idPrefix}-${f.key}`">{{ f.label }}<span v-if="f.required" aria-hidden="true"> *</span></label>
119
+ <select
120
+ v-if="f.kind === 'choice'"
121
+ :id="`${idPrefix}-${f.key}`"
122
+ v-model="values[f.key]"
123
+ class="p-inputtext p-component"
124
+ :required="f.required"
125
+ :aria-invalid="problems[f.key] ? 'true' : undefined"
126
+ :aria-describedby="[f.description ? `${idPrefix}-${f.key}-help` : '', problems[f.key] ? `${idPrefix}-${f.key}-error` : ''].filter(Boolean).join(' ') || undefined"
127
+ >
128
+ <option value="">{{ tOr('core.cardsDashboard.choose', 'Choose…') }}</option>
129
+ <option v-for="o in f.options" :key="String(o.value)" :value="String(o.value)">{{ o.label }}</option>
130
+ </select>
131
+ <input
132
+ v-else
133
+ :id="`${idPrefix}-${f.key}`"
134
+ v-model="values[f.key]"
135
+ :type="f.kind === 'number' ? 'number' : 'text'"
136
+ :step="f.integer ? 1 : 'any'"
137
+ class="p-inputtext p-component"
138
+ :required="f.required"
139
+ :aria-invalid="problems[f.key] ? 'true' : undefined"
140
+ :aria-describedby="[f.description ? `${idPrefix}-${f.key}-help` : '', problems[f.key] ? `${idPrefix}-${f.key}-error` : ''].filter(Boolean).join(' ') || undefined"
141
+ />
142
+ </template>
143
+ <small v-if="f.description" :id="`${idPrefix}-${f.key}-help`" class="qd-card-params-help">{{ f.description }}</small>
144
+ <small v-if="problems[f.key]" :id="`${idPrefix}-${f.key}-error`" class="qd-card-params-error">{{ problems[f.key] }}</small>
145
+ </div>
146
+ <div v-if="sections.length > 1" class="qd-card-params-field">
147
+ <label :for="`${idPrefix}-section`">{{ tOr('core.cardsDashboard.inSection', 'In the section') }}</label>
148
+ <select :id="`${idPrefix}-section`" v-model="section" class="p-inputtext p-component">
149
+ <option v-for="s in sections" :key="s.id" :value="s.id">{{ s.title }}</option>
150
+ </select>
151
+ </div>
152
+ <div class="qd-card-params-actions">
153
+ <QdButton type="submit" size="small" icon="pi pi-plus" :label="tOr('core.cardsDashboard.add', 'Add')" />
154
+ <QdButton type="button" size="small" text :label="tOr('core.actions.cancel', 'Cancel')" @click="emit('cancel')" />
155
+ </div>
156
+ </form>
157
+ </template>