@quazardous/qdadm 2.38.0 → 2.40.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/styles/qdadm.css +1 -1
- package/package.json +1 -1
- package/src/components/index.ts +1 -0
- package/src/components/layout/CardsDashboard.vue +395 -0
- package/src/components/layout/DashboardLayout.vue +12 -1
- package/src/components/pages/LoginPage.vue +284 -18
- package/src/components/pages/OAuthCallbackPage.vue +32 -4
- package/src/composables/useCardsArrangement.ts +220 -0
- package/src/composables/useNavigation.ts +16 -1
- package/src/i18n/defaults/core.en.generated.ts +30 -0
- package/src/i18n/defaults/core.en.yml +30 -0
- package/src/i18n/defaults/core.fr.generated.ts +30 -0
- package/src/i18n/defaults/core.fr.yml +30 -0
- package/src/index.ts +10 -0
- package/src/kernel/Kernel.routing.ts +36 -6
- package/src/kernel/KernelContext.types.ts +2 -0
- package/src/module/moduleRegistry.ts +6 -1
- package/src/styles/_cards-dashboard.scss +189 -0
- package/src/styles/index.scss +1 -0
- package/src/zones/ZoneRegistry.ts +25 -1
- package/src/zones/index.ts +1 -0
|
@@ -112,7 +112,11 @@ export function useNavigation(): UseNavigationReturn {
|
|
|
112
112
|
function canAccessNavItem(item: NavItem): boolean {
|
|
113
113
|
// Its own permission, on any entry (#3675, #4318): a link out has nothing
|
|
114
114
|
// else to check, a route entry no longer needs `entity` to follow rights.
|
|
115
|
-
|
|
115
|
+
// Without one, a route entry takes its route's (#4332), so the menu shows
|
|
116
|
+
// what the router guard lets through.
|
|
117
|
+
const permissions = item.permission ?? (item.route ? routePermission(item.route) : undefined)
|
|
118
|
+
const required = (Array.isArray(permissions) ? permissions : [permissions]).filter((p): p is string => !!p)
|
|
119
|
+
if (securityChecker && required.some((p) => !securityChecker.isGranted(p))) return false
|
|
116
120
|
if (item.href || !item.entity || !orchestrator) return true
|
|
117
121
|
const manager = orchestrator.get(item.entity)
|
|
118
122
|
if (!manager) return true
|
|
@@ -123,6 +127,17 @@ export function useNavigation(): UseNavigationReturn {
|
|
|
123
127
|
return manager.canRead()
|
|
124
128
|
}
|
|
125
129
|
|
|
130
|
+
function routePermission(name: string): string | string[] | undefined {
|
|
131
|
+
try {
|
|
132
|
+
return router.resolve({ name }).matched.flatMap((r) => {
|
|
133
|
+
const p = r.meta?.permission as string | string[] | undefined
|
|
134
|
+
return p === undefined ? [] : Array.isArray(p) ? p : [p]
|
|
135
|
+
})
|
|
136
|
+
} catch {
|
|
137
|
+
return undefined
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
126
141
|
function routeAction(name: string): string | undefined {
|
|
127
142
|
try {
|
|
128
143
|
return router.resolve({ name }).meta?.entityAction as string | undefined
|
|
@@ -174,6 +174,36 @@ export default `core:
|
|
|
174
174
|
invalidCredentials: Invalid credentials
|
|
175
175
|
configError: Configuration Error
|
|
176
176
|
noAuthAdapter: No auth adapter configured
|
|
177
|
+
# Identity provider first (#4321)
|
|
178
|
+
sso: Sign in
|
|
179
|
+
providerHome: My account
|
|
180
|
+
localFallback: Alternative login
|
|
181
|
+
localSection: Alternative login
|
|
182
|
+
noSso: No sign-in flow configured for this button
|
|
183
|
+
# CardsDashboard (#4320)
|
|
184
|
+
cardsDashboard:
|
|
185
|
+
customise: Customise
|
|
186
|
+
done: Done
|
|
187
|
+
reset: Reset
|
|
188
|
+
resetDone: Default arrangement restored
|
|
189
|
+
hidden: Hidden cards
|
|
190
|
+
noneHidden: None
|
|
191
|
+
move: "Move {title}"
|
|
192
|
+
moved: "{title}: card {position} of {total}"
|
|
193
|
+
help: Arrow keys move the card, Home and End to the start or the end
|
|
194
|
+
dragCancelled: Move cancelled
|
|
195
|
+
pin: "Pin {title} at the top"
|
|
196
|
+
unpin: "Unpin {title}"
|
|
197
|
+
pinnedOne: "{title} pinned at the top"
|
|
198
|
+
unpinnedOne: "{title} unpinned"
|
|
199
|
+
hide: "Hide {title}"
|
|
200
|
+
hiddenOne: "{title} hidden"
|
|
201
|
+
restore: "Show {title}"
|
|
202
|
+
restoredOne: "{title} shown"
|
|
203
|
+
show: Show
|
|
204
|
+
trayView: Show hidden cards as
|
|
205
|
+
viewCards: Cards
|
|
206
|
+
viewCompact: Compact
|
|
177
207
|
# NotificationPanel and NotificationBadge (#4171)
|
|
178
208
|
notifications:
|
|
179
209
|
title: Notifications
|
|
@@ -172,6 +172,36 @@ core:
|
|
|
172
172
|
invalidCredentials: Invalid credentials
|
|
173
173
|
configError: Configuration Error
|
|
174
174
|
noAuthAdapter: No auth adapter configured
|
|
175
|
+
# Identity provider first (#4321)
|
|
176
|
+
sso: Sign in
|
|
177
|
+
providerHome: My account
|
|
178
|
+
localFallback: Alternative login
|
|
179
|
+
localSection: Alternative login
|
|
180
|
+
noSso: No sign-in flow configured for this button
|
|
181
|
+
# CardsDashboard (#4320)
|
|
182
|
+
cardsDashboard:
|
|
183
|
+
customise: Customise
|
|
184
|
+
done: Done
|
|
185
|
+
reset: Reset
|
|
186
|
+
resetDone: Default arrangement restored
|
|
187
|
+
hidden: Hidden cards
|
|
188
|
+
noneHidden: None
|
|
189
|
+
move: "Move {title}"
|
|
190
|
+
moved: "{title}: card {position} of {total}"
|
|
191
|
+
help: Arrow keys move the card, Home and End to the start or the end
|
|
192
|
+
dragCancelled: Move cancelled
|
|
193
|
+
pin: "Pin {title} at the top"
|
|
194
|
+
unpin: "Unpin {title}"
|
|
195
|
+
pinnedOne: "{title} pinned at the top"
|
|
196
|
+
unpinnedOne: "{title} unpinned"
|
|
197
|
+
hide: "Hide {title}"
|
|
198
|
+
hiddenOne: "{title} hidden"
|
|
199
|
+
restore: "Show {title}"
|
|
200
|
+
restoredOne: "{title} shown"
|
|
201
|
+
show: Show
|
|
202
|
+
trayView: Show hidden cards as
|
|
203
|
+
viewCards: Cards
|
|
204
|
+
viewCompact: Compact
|
|
175
205
|
# NotificationPanel and NotificationBadge (#4171)
|
|
176
206
|
notifications:
|
|
177
207
|
title: Notifications
|
|
@@ -174,6 +174,36 @@ export default `core:
|
|
|
174
174
|
invalidCredentials: Identifiants invalides
|
|
175
175
|
configError: Erreur de configuration
|
|
176
176
|
noAuthAdapter: Aucun adaptateur d'authentification configuré
|
|
177
|
+
# Identity provider first (#4321)
|
|
178
|
+
sso: Se connecter
|
|
179
|
+
providerHome: Mon compte
|
|
180
|
+
localFallback: Login alternatif
|
|
181
|
+
localSection: Login alternatif
|
|
182
|
+
noSso: Aucun parcours de connexion configuré pour ce bouton
|
|
183
|
+
# CardsDashboard (#4320)
|
|
184
|
+
cardsDashboard:
|
|
185
|
+
customise: Personnaliser
|
|
186
|
+
done: Terminé
|
|
187
|
+
reset: Réinitialiser
|
|
188
|
+
resetDone: Disposition par défaut rétablie
|
|
189
|
+
hidden: Cartes masquées
|
|
190
|
+
noneHidden: Aucune
|
|
191
|
+
move: "Déplacer {title}"
|
|
192
|
+
moved: "{title} : carte {position} sur {total}"
|
|
193
|
+
help: Les flèches déplacent la carte, Début et Fin vers le début ou la fin
|
|
194
|
+
dragCancelled: Déplacement annulé
|
|
195
|
+
pin: "Épingler {title} en haut"
|
|
196
|
+
unpin: "Désépingler {title}"
|
|
197
|
+
pinnedOne: "{title} épinglée en haut"
|
|
198
|
+
unpinnedOne: "{title} désépinglée"
|
|
199
|
+
hide: "Masquer {title}"
|
|
200
|
+
hiddenOne: "{title} masquée"
|
|
201
|
+
restore: "Afficher {title}"
|
|
202
|
+
restoredOne: "{title} affichée"
|
|
203
|
+
show: Afficher
|
|
204
|
+
trayView: Afficher les cartes masquées en
|
|
205
|
+
viewCards: Cartes
|
|
206
|
+
viewCompact: Compact
|
|
177
207
|
# NotificationPanel and NotificationBadge (#4171)
|
|
178
208
|
notifications:
|
|
179
209
|
title: Notifications
|
|
@@ -172,6 +172,36 @@ core:
|
|
|
172
172
|
invalidCredentials: Identifiants invalides
|
|
173
173
|
configError: Erreur de configuration
|
|
174
174
|
noAuthAdapter: Aucun adaptateur d'authentification configuré
|
|
175
|
+
# Identity provider first (#4321)
|
|
176
|
+
sso: Se connecter
|
|
177
|
+
providerHome: Mon compte
|
|
178
|
+
localFallback: Login alternatif
|
|
179
|
+
localSection: Login alternatif
|
|
180
|
+
noSso: Aucun parcours de connexion configuré pour ce bouton
|
|
181
|
+
# CardsDashboard (#4320)
|
|
182
|
+
cardsDashboard:
|
|
183
|
+
customise: Personnaliser
|
|
184
|
+
done: Terminé
|
|
185
|
+
reset: Réinitialiser
|
|
186
|
+
resetDone: Disposition par défaut rétablie
|
|
187
|
+
hidden: Cartes masquées
|
|
188
|
+
noneHidden: Aucune
|
|
189
|
+
move: "Déplacer {title}"
|
|
190
|
+
moved: "{title} : carte {position} sur {total}"
|
|
191
|
+
help: Les flèches déplacent la carte, Début et Fin vers le début ou la fin
|
|
192
|
+
dragCancelled: Déplacement annulé
|
|
193
|
+
pin: "Épingler {title} en haut"
|
|
194
|
+
unpin: "Désépingler {title}"
|
|
195
|
+
pinnedOne: "{title} épinglée en haut"
|
|
196
|
+
unpinnedOne: "{title} désépinglée"
|
|
197
|
+
hide: "Masquer {title}"
|
|
198
|
+
hiddenOne: "{title} masquée"
|
|
199
|
+
restore: "Afficher {title}"
|
|
200
|
+
restoredOne: "{title} affichée"
|
|
201
|
+
show: Afficher
|
|
202
|
+
trayView: Afficher les cartes masquées en
|
|
203
|
+
viewCards: Cartes
|
|
204
|
+
viewCompact: Compact
|
|
175
205
|
# NotificationPanel and NotificationBadge (#4171)
|
|
176
206
|
notifications:
|
|
177
207
|
title: Notifications
|
package/src/index.ts
CHANGED
|
@@ -381,6 +381,15 @@ export {
|
|
|
381
381
|
type AppBannerStore,
|
|
382
382
|
type UseAppBannerReturn,
|
|
383
383
|
} from './composables/useAppBanner'
|
|
384
|
+
export {
|
|
385
|
+
useCardsArrangement,
|
|
386
|
+
reconcileArrangement,
|
|
387
|
+
defaultArrangement,
|
|
388
|
+
type CardDef,
|
|
389
|
+
type CardsArrangement,
|
|
390
|
+
type CardsGroups,
|
|
391
|
+
type UseCardsArrangementReturn,
|
|
392
|
+
} from './composables/useCardsArrangement'
|
|
384
393
|
export {
|
|
385
394
|
useUserImpersonator,
|
|
386
395
|
type UseUserImpersonatorOptions,
|
|
@@ -476,6 +485,7 @@ export {
|
|
|
476
485
|
type ZoneDetailInfo,
|
|
477
486
|
type ZoneInspection,
|
|
478
487
|
type ZoneRegistryOptions,
|
|
488
|
+
type BlockCard,
|
|
479
489
|
// BlockConfig - already exported from kernel
|
|
480
490
|
} from './zones/ZoneRegistry'
|
|
481
491
|
export {
|
|
@@ -253,21 +253,50 @@ export function applyRoutingMethods(KernelClass: { prototype: Kernel }): void {
|
|
|
253
253
|
// allowed pass-through; a failing access check must fail CLOSED,
|
|
254
254
|
// not silently allow (#1190).
|
|
255
255
|
const orchestrator = this.orchestrator
|
|
256
|
-
|
|
256
|
+
const entityToCheck = !!entity && !!orchestrator && orchestrator.isRegistered(entity)
|
|
257
|
+
|
|
258
|
+
// Page permissions (#4332): every matched record's meta.permission, so a
|
|
259
|
+
// parent's covers its children; a list needs every entry. Without a
|
|
260
|
+
// security checker (an app without security) nothing is checked, as for
|
|
261
|
+
// the menu.
|
|
262
|
+
const permissions = to.matched.flatMap((record: RouteRecordNormalized) => {
|
|
263
|
+
const p = record.meta.permission
|
|
264
|
+
return (Array.isArray(p) ? p : [p]).filter((x): x is string => typeof x === 'string' && x !== '')
|
|
265
|
+
})
|
|
266
|
+
const checker = this.securityChecker
|
|
267
|
+
const permissionsToCheck = permissions.length > 0 && !!checker
|
|
268
|
+
|
|
269
|
+
if (!entityToCheck && !permissionsToCheck) return
|
|
270
|
+
|
|
271
|
+
const checkPermissions = (): { path: string } | undefined => {
|
|
272
|
+
if (!permissionsToCheck) return undefined
|
|
273
|
+
try {
|
|
274
|
+
const missing = permissions.find((p) => !checker!.isGranted(p))
|
|
275
|
+
if (missing === undefined) return undefined
|
|
276
|
+
console.warn(`[qdadm] Access denied to ${to.path} (permission: ${missing})`)
|
|
277
|
+
orchestrator?.toast.error('Access Denied', "You don't have permission to access this page", 'Kernel')
|
|
278
|
+
this.signals!.emit('auth:access-denied', { path: to.path, permission: missing })
|
|
279
|
+
return { path: '/' }
|
|
280
|
+
} catch (err) {
|
|
281
|
+
console.error(`[qdadm] Permission check failed for ${to.path} — denying navigation:`, err)
|
|
282
|
+
return { path: '/' }
|
|
283
|
+
}
|
|
284
|
+
}
|
|
257
285
|
|
|
258
286
|
// The action the route declares (#2497): a list route is governed by
|
|
259
287
|
// `list`. A route that declares none — any custom page — checks `read`.
|
|
260
288
|
const action = to.meta?.entityAction === 'list' ? 'list' : 'read'
|
|
261
289
|
|
|
262
290
|
const checkEntity = (): { path: string } | undefined => {
|
|
291
|
+
if (!entityToCheck) return undefined
|
|
263
292
|
try {
|
|
264
|
-
const manager = orchestrator
|
|
293
|
+
const manager = orchestrator!.get(entity!)
|
|
265
294
|
const allowed = manager && (action === 'list' ? manager.canList() : manager.canRead())
|
|
266
295
|
if (manager && !allowed) {
|
|
267
296
|
console.warn(
|
|
268
297
|
`[qdadm] Access denied to ${to.path} (entity: ${entity}, action: ${action})`
|
|
269
298
|
)
|
|
270
|
-
orchestrator
|
|
299
|
+
orchestrator!.toast.error(
|
|
271
300
|
'Access Denied',
|
|
272
301
|
`You don't have permission to access ${manager.labelPlural || entity}`,
|
|
273
302
|
'Kernel'
|
|
@@ -294,12 +323,13 @@ export function applyRoutingMethods(KernelClass: { prototype: Kernel }): void {
|
|
|
294
323
|
// miss would fall through to an empty role matrix and read as a refusal:
|
|
295
324
|
// wait for its answers instead of deciding early. Still fail closed — a
|
|
296
325
|
// judge that rejects or never settles denies.
|
|
326
|
+
const decide = (): { path: string } | undefined => checkPermissions() ?? checkEntity()
|
|
297
327
|
const judge = this.securityChecker?.grant
|
|
298
|
-
if (typeof judge?.ready !== 'function') return
|
|
328
|
+
if (typeof judge?.ready !== 'function') return decide()
|
|
299
329
|
const timeoutMs = this.options.security?.readyTimeoutMs ?? 10_000
|
|
300
|
-
return waitForJudge(judge as { ready(): Promise<void> }, timeoutMs).then(
|
|
330
|
+
return waitForJudge(judge as { ready(): Promise<void> }, timeoutMs).then(decide, (reason: Error) => {
|
|
301
331
|
console.error(
|
|
302
|
-
`[qdadm] security.grant never became ready for ${to.path}
|
|
332
|
+
`[qdadm] security.grant never became ready for ${to.path}: ${reason.message} — denying navigation`
|
|
303
333
|
)
|
|
304
334
|
return { path: '/' }
|
|
305
335
|
})
|
|
@@ -132,6 +132,8 @@ export interface RouteOptions {
|
|
|
132
132
|
parent?: ParentConfig
|
|
133
133
|
label?: string
|
|
134
134
|
layout?: string
|
|
135
|
+
/** Every route of the group needs it to open (#4332), unless a route declares its own `meta.permission` */
|
|
136
|
+
permission?: string | string[]
|
|
135
137
|
}
|
|
136
138
|
|
|
137
139
|
/** Parent route configuration */
|
|
@@ -50,6 +50,8 @@ export interface ModuleRouteMeta {
|
|
|
50
50
|
navLabel?: string
|
|
51
51
|
layout?: 'list' | 'form' | 'dashboard' | 'base' | string
|
|
52
52
|
title?: string
|
|
53
|
+
/** Who may open the page (#4332): enforced by the router guard; a list needs every entry */
|
|
54
|
+
permission?: string | string[]
|
|
53
55
|
[key: string]: unknown
|
|
54
56
|
}
|
|
55
57
|
|
|
@@ -113,6 +115,8 @@ export interface AddRoutesOptions {
|
|
|
113
115
|
parent?: ParentConfig
|
|
114
116
|
label?: string
|
|
115
117
|
layout?: 'list' | 'form' | 'dashboard' | 'base' | string
|
|
118
|
+
/** Every route of the group needs it (#4332), unless a route declares its own */
|
|
119
|
+
permission?: string | string[]
|
|
116
120
|
}
|
|
117
121
|
|
|
118
122
|
/**
|
|
@@ -192,7 +196,7 @@ const registry = {
|
|
|
192
196
|
moduleRoutes: (ModuleRoute | RouteRecordRaw)[],
|
|
193
197
|
options: AddRoutesOptions = {}
|
|
194
198
|
): void {
|
|
195
|
-
const { entity, parent, label, layout } = options
|
|
199
|
+
const { entity, parent, label, layout, permission } = options
|
|
196
200
|
const prefixedRoutes = moduleRoutes.map((route) => {
|
|
197
201
|
const r = route as ModuleRoute
|
|
198
202
|
const routePath = r.path || ''
|
|
@@ -207,6 +211,7 @@ const registry = {
|
|
|
207
211
|
...(label && { navLabel: label }),
|
|
208
212
|
// Layout can be set per-route or inherited from options
|
|
209
213
|
...((routeLayout || layout) && { layout: routeLayout || layout }),
|
|
214
|
+
...(r.meta?.permission === undefined && permission !== undefined && { permission }),
|
|
210
215
|
},
|
|
211
216
|
} as ModuleRoute
|
|
212
217
|
})
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CardsDashboard (#4320): an auto grid of cards, an edit bar on each card in
|
|
3
|
+
* edit mode, the hidden cards' tray.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
.qd-cards-dashboard {
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
gap: 0.75rem;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.qd-cards-toolbar {
|
|
13
|
+
display: flex;
|
|
14
|
+
justify-content: flex-end;
|
|
15
|
+
gap: 0.5rem;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.qd-cards-grid {
|
|
19
|
+
container-type: inline-size;
|
|
20
|
+
display: grid;
|
|
21
|
+
grid-template-columns: repeat(auto-fill, minmax(min(var(--qd-card-min, 18rem), 100%), 1fr));
|
|
22
|
+
gap: 1rem;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.qd-cards-slot {
|
|
26
|
+
grid-column: span var(--qd-card-span, 1);
|
|
27
|
+
display: flex;
|
|
28
|
+
flex-direction: column;
|
|
29
|
+
min-width: 0;
|
|
30
|
+
|
|
31
|
+
> :not(.qd-cards-bar) {
|
|
32
|
+
flex: 1;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Too narrow for a wide card: it takes one column like the others
|
|
37
|
+
@container (max-width: 40rem) {
|
|
38
|
+
.qd-cards-slot {
|
|
39
|
+
grid-column: auto;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.qd-cards-editing .qd-cards-slot {
|
|
44
|
+
outline: 1px dashed var(--p-content-border-color, #d1d5db);
|
|
45
|
+
outline-offset: 4px;
|
|
46
|
+
border-radius: var(--p-content-border-radius, 6px);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.qd-cards-editing .qd-cards-pinned {
|
|
50
|
+
outline-color: var(--p-primary-color);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.qd-cards-dragging {
|
|
54
|
+
opacity: 0.6;
|
|
55
|
+
outline: 2px solid var(--p-primary-color) !important;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.qd-cards-bar {
|
|
59
|
+
display: flex;
|
|
60
|
+
align-items: center;
|
|
61
|
+
gap: 0.25rem;
|
|
62
|
+
margin-bottom: 0.5rem;
|
|
63
|
+
font-size: 0.875rem;
|
|
64
|
+
color: var(--p-text-muted-color, #6b7280);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.qd-cards-title {
|
|
68
|
+
flex: 1;
|
|
69
|
+
min-width: 0;
|
|
70
|
+
overflow: hidden;
|
|
71
|
+
text-overflow: ellipsis;
|
|
72
|
+
white-space: nowrap;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.qd-cards-handle,
|
|
76
|
+
.qd-cards-action {
|
|
77
|
+
display: inline-flex;
|
|
78
|
+
align-items: center;
|
|
79
|
+
justify-content: center;
|
|
80
|
+
width: 2rem;
|
|
81
|
+
height: 2rem;
|
|
82
|
+
border: 1px solid transparent;
|
|
83
|
+
border-radius: var(--p-content-border-radius, 6px);
|
|
84
|
+
background: transparent;
|
|
85
|
+
color: inherit;
|
|
86
|
+
cursor: pointer;
|
|
87
|
+
|
|
88
|
+
&:hover {
|
|
89
|
+
background: var(--p-content-hover-background, rgba(0, 0, 0, 0.04));
|
|
90
|
+
color: var(--p-text-color);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
&:focus-visible {
|
|
94
|
+
outline: 2px solid var(--p-primary-color);
|
|
95
|
+
outline-offset: 1px;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// The page must not scroll under a finger that drags
|
|
100
|
+
.qd-cards-handle {
|
|
101
|
+
cursor: grab;
|
|
102
|
+
touch-action: none;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.qd-cards-dragging .qd-cards-handle {
|
|
106
|
+
cursor: grabbing;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.qd-cards-on {
|
|
110
|
+
color: var(--p-primary-color);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.qd-cards-tray {
|
|
114
|
+
display: flex;
|
|
115
|
+
flex-direction: column;
|
|
116
|
+
gap: 0.75rem;
|
|
117
|
+
padding: 0.75rem;
|
|
118
|
+
border: 1px dashed var(--p-content-border-color, #d1d5db);
|
|
119
|
+
border-radius: var(--p-content-border-radius, 6px);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.qd-cards-tray-head {
|
|
123
|
+
display: flex;
|
|
124
|
+
flex-wrap: wrap;
|
|
125
|
+
align-items: center;
|
|
126
|
+
gap: 0.5rem;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.qd-cards-tray-label {
|
|
130
|
+
font-weight: 500;
|
|
131
|
+
font-size: 0.875rem;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.qd-cards-tray-empty {
|
|
135
|
+
font-size: 0.875rem;
|
|
136
|
+
color: var(--p-text-muted-color, #6b7280);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// Cards / Compact, a two-option switch
|
|
140
|
+
.qd-cards-tray-view {
|
|
141
|
+
display: inline-flex;
|
|
142
|
+
margin-left: auto;
|
|
143
|
+
border: 1px solid var(--p-content-border-color, #d1d5db);
|
|
144
|
+
border-radius: var(--p-content-border-radius, 6px);
|
|
145
|
+
overflow: hidden;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.qd-cards-tray-view-option {
|
|
149
|
+
padding: 0.25rem 0.625rem;
|
|
150
|
+
border: 0;
|
|
151
|
+
background: transparent;
|
|
152
|
+
color: var(--p-text-muted-color, #6b7280);
|
|
153
|
+
font: inherit;
|
|
154
|
+
font-size: 0.8125rem;
|
|
155
|
+
cursor: pointer;
|
|
156
|
+
|
|
157
|
+
&[aria-pressed='true'] {
|
|
158
|
+
background: var(--p-primary-color);
|
|
159
|
+
color: var(--p-primary-contrast-color, #fff);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
&:focus-visible {
|
|
163
|
+
outline: 2px solid var(--p-primary-color);
|
|
164
|
+
outline-offset: -2px;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.qd-cards-chips {
|
|
169
|
+
display: flex;
|
|
170
|
+
flex-wrap: wrap;
|
|
171
|
+
gap: 0.5rem;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// A hidden card, whole: dimmed and inert, only its "Show" acts
|
|
175
|
+
.qd-cards-hidden .qd-cards-hidden-body {
|
|
176
|
+
flex: 1;
|
|
177
|
+
opacity: 0.45;
|
|
178
|
+
filter: grayscale(0.6);
|
|
179
|
+
pointer-events: none;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.qd-cards-sr {
|
|
183
|
+
position: absolute;
|
|
184
|
+
width: 1px;
|
|
185
|
+
height: 1px;
|
|
186
|
+
overflow: hidden;
|
|
187
|
+
clip: rect(0 0 0 0);
|
|
188
|
+
white-space: nowrap;
|
|
189
|
+
}
|
package/src/styles/index.scss
CHANGED
|
@@ -81,6 +81,24 @@ export interface WrapperInfo {
|
|
|
81
81
|
/**
|
|
82
82
|
* Block configuration
|
|
83
83
|
*/
|
|
84
|
+
/**
|
|
85
|
+
* A block as a dashboard card (#4320): read by CardsDashboard, ignored by a
|
|
86
|
+
* classic Zone, so the same block works in both. The block's `id` is the
|
|
87
|
+
* card's key in the user's saved arrangement; every field here is optional.
|
|
88
|
+
*/
|
|
89
|
+
export interface BlockCard {
|
|
90
|
+
/** Names the card in the hidden tray and in announcements (an i18n key works); default: the block's `title` prop, else its id */
|
|
91
|
+
title?: string
|
|
92
|
+
/** Always shown: the user cannot hide it */
|
|
93
|
+
required?: boolean
|
|
94
|
+
/** Stays at its default place: the user cannot move it */
|
|
95
|
+
fixed?: boolean
|
|
96
|
+
/** Pinned at the top by default; the user can unpin it */
|
|
97
|
+
pinned?: boolean
|
|
98
|
+
/** Columns it spans, 1 to 3 (default 1) */
|
|
99
|
+
span?: number
|
|
100
|
+
}
|
|
101
|
+
|
|
84
102
|
export interface BlockConfig {
|
|
85
103
|
/** Vue component to render */
|
|
86
104
|
component: Component
|
|
@@ -102,6 +120,8 @@ export interface BlockConfig {
|
|
|
102
120
|
wraps?: string | null
|
|
103
121
|
/** Wrappers applied to this block */
|
|
104
122
|
wrappers?: WrapperInfo[]
|
|
123
|
+
/** As a dashboard card (#4320) */
|
|
124
|
+
card?: BlockCard | null
|
|
105
125
|
}
|
|
106
126
|
|
|
107
127
|
/**
|
|
@@ -118,6 +138,7 @@ interface InternalBlock {
|
|
|
118
138
|
after: string | null
|
|
119
139
|
wraps: string | null
|
|
120
140
|
wrappers?: WrapperInfo[]
|
|
141
|
+
card: BlockCard | null
|
|
121
142
|
}
|
|
122
143
|
|
|
123
144
|
/**
|
|
@@ -380,6 +401,7 @@ export class ZoneRegistry {
|
|
|
380
401
|
before: blockConfig.before ?? null,
|
|
381
402
|
after: blockConfig.after ?? null,
|
|
382
403
|
wraps: blockConfig.wraps ?? null,
|
|
404
|
+
card: blockConfig.card ?? null,
|
|
383
405
|
}
|
|
384
406
|
|
|
385
407
|
// Update wrap graph for cycle detection (wrap operation only)
|
|
@@ -611,6 +633,7 @@ export class ZoneRegistry {
|
|
|
611
633
|
before: block.before,
|
|
612
634
|
after: block.after,
|
|
613
635
|
wraps: block.wraps,
|
|
636
|
+
card: block.card,
|
|
614
637
|
wrappers: allWrappers.map((w) => ({
|
|
615
638
|
component: w.component,
|
|
616
639
|
props: w.props,
|
|
@@ -638,12 +661,13 @@ export class ZoneRegistry {
|
|
|
638
661
|
}
|
|
639
662
|
|
|
640
663
|
// Clean up internal operation fields for external consumers
|
|
641
|
-
const cleaned: BlockConfig[] = result.map(({ component, weight, props, id, wrappers }) => ({
|
|
664
|
+
const cleaned: BlockConfig[] = result.map(({ component, weight, props, id, wrappers, card }) => ({
|
|
642
665
|
component,
|
|
643
666
|
weight,
|
|
644
667
|
props,
|
|
645
668
|
id,
|
|
646
669
|
...(wrappers ? { wrappers } : {}),
|
|
670
|
+
...(card ? { card } : {}),
|
|
647
671
|
}))
|
|
648
672
|
|
|
649
673
|
// Cache the result
|