@quazardous/qdadm 2.50.0 → 2.50.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quazardous/qdadm",
3
- "version": "2.50.0",
3
+ "version": "2.50.1",
4
4
  "description": "Vue 3 framework for admin dashboards with PrimeVue",
5
5
  "author": "quazardous",
6
6
  "license": "MIT",
@@ -18,6 +18,8 @@ interface Action {
18
18
  name: string
19
19
  icon?: string
20
20
  tooltip?: string
21
+ /** The button's accessible name: an icon alone has none (#5323) */
22
+ ariaLabel?: string
21
23
  severity: string
22
24
  handler: () => void | Promise<void>
23
25
  isDisabled?: boolean
@@ -40,6 +42,7 @@ defineProps<Props>()
40
42
  text
41
43
  rounded
42
44
  :disabled="action.isDisabled"
45
+ :aria-label="action.ariaLabel ?? action.tooltip"
43
46
  @click="action.handler"
44
47
  v-tooltip.top="action.tooltip"
45
48
  />
@@ -18,17 +18,33 @@ export interface ConfirmRequire {
18
18
  header: string
19
19
  icon: string
20
20
  acceptClass?: string
21
+ acceptLabel?: string
22
+ rejectLabel?: string
23
+ acceptIcon?: string
24
+ rejectIcon?: string
25
+ rejectClass?: string
21
26
  closeOnEscape?: boolean
22
27
  accept: () => void
23
28
  }) => void
24
29
  }
25
30
 
26
- export function requireDeleteConfirmation(confirm: ConfirmRequire, { message, header, accept }: DeleteConfirmation): void {
31
+ /** The catalogue lookup of useI18n: a key, its English fallback */
32
+ export type TranslateOr = (key: string, fallback: string) => string
33
+
34
+ /**
35
+ * The buttons say what they do, in the app's language (#5323): Delete / Cancel
36
+ * from the catalogue, not PrimeVue's own Yes / No.
37
+ */
38
+ export function requireDeleteConfirmation(confirm: ConfirmRequire, tOr: TranslateOr, { message, header, accept }: DeleteConfirmation): void {
27
39
  confirm.require({
28
40
  message,
29
41
  header,
30
42
  icon: 'pi pi-exclamation-triangle',
31
43
  acceptClass: 'p-button-danger',
44
+ acceptLabel: tOr('core.actions.delete', 'Delete'),
45
+ acceptIcon: 'pi pi-trash',
46
+ rejectLabel: tOr('core.actions.cancel', 'Cancel'),
47
+ rejectClass: 'p-button-secondary p-button-text',
32
48
  closeOnEscape: true,
33
49
  accept,
34
50
  })
@@ -480,7 +480,7 @@ export function useEntityItemFormPage<T extends Record<string, unknown> = Record
480
480
 
481
481
  function confirmDelete(): void {
482
482
  const label = manager.getEntityLabel(data.value) || entityId.value
483
- requireDeleteConfirmation(confirm, {
483
+ requireDeleteConfirmation(confirm, tOr, {
484
484
  message: tOr('core.messages.confirmDeleteItem', 'Delete {entity} "{label}"?', { entity: entityName, label: String(label) }),
485
485
  header: tOr('core.messages.confirmDeleteTitle', 'Confirm Delete'),
486
486
  accept: remove,
@@ -476,7 +476,7 @@ export function useEntityItemShowPage<T = Record<string, unknown>>(
476
476
  severity: 'danger',
477
477
  onClick: () => {
478
478
  if (confirmDelete) {
479
- requireDeleteConfirmation(confirm, {
479
+ requireDeleteConfirmation(confirm, tOr, {
480
480
  message: tOr('core.messages.confirmDeleteThis', 'Are you sure you want to delete this {entity}?', { entity: manager.label || entity }),
481
481
  header: tOr('core.messages.confirmDeleteTitle', 'Confirm Delete'),
482
482
  accept: () => deleteEntity(),
@@ -764,6 +764,8 @@ export function useListPage<T = unknown>(config: UseListPageOptions<T>): UseList
764
764
  name: action.name,
765
765
  icon: action.icon ? resolveValue(action.icon, row) : undefined,
766
766
  tooltip: action.tooltip ? resolveValue(action.tooltip, row) : undefined,
767
+ // An icon alone has no name: the label read aloud, and the one a test finds it by (#5323)
768
+ ariaLabel: action.ariaLabel ? resolveValue(action.ariaLabel, row) : action.tooltip ? resolveValue(action.tooltip, row) : undefined,
767
769
  severity: resolveValue(action.severity || 'secondary', row),
768
770
  isDisabled: action.disabled ? action.disabled(row) : false,
769
771
  handler: () => action.onClick(row),
@@ -1097,7 +1099,7 @@ export function useListPage<T = unknown>(config: UseListPageOptions<T>): UseList
1097
1099
 
1098
1100
  function confirmDelete(item: unknown, labelField = 'name'): void {
1099
1101
  const itemRecord = item as Record<string, unknown>
1100
- requireDeleteConfirmation(confirm, {
1102
+ requireDeleteConfirmation(confirm, tOr, {
1101
1103
  message: tOr('core.messages.confirmDeleteItem', 'Delete {entity} "{label}"?', {
1102
1104
  entity: entityName,
1103
1105
  label: String(itemRecord[labelField] || itemRecord[resolvedDataKey]),
@@ -1151,9 +1153,12 @@ export function useListPage<T = unknown>(config: UseListPageOptions<T>): UseList
1151
1153
 
1152
1154
  function confirmBulkDelete(): void {
1153
1155
  const count = selected.value.length
1154
- requireDeleteConfirmation(confirm, {
1155
- message: `Delete ${count} ${count > 1 ? entityNamePlural : entityName}?`,
1156
- header: 'Confirm Bulk Delete',
1156
+ requireDeleteConfirmation(confirm, tOr, {
1157
+ message: tOr('core.messages.confirmBulkDelete', 'Delete {count} {entities}?', {
1158
+ count,
1159
+ entities: count > 1 ? entityNamePlural : entityName,
1160
+ }),
1161
+ header: tOr('core.messages.confirmBulkDeleteTitle', 'Confirm Bulk Delete'),
1157
1162
  accept: bulkDelete,
1158
1163
  })
1159
1164
  }
@@ -151,6 +151,8 @@ export interface ActionConfig {
151
151
  name: string
152
152
  icon?: string | ((row: unknown) => string)
153
153
  tooltip?: string | ((row: unknown) => string)
154
+ /** The button's accessible name; the tooltip when absent (#5323) */
155
+ ariaLabel?: string | ((row: unknown) => string)
154
156
  severity?: string | ((row: unknown) => string)
155
157
  onClick: (row: unknown) => void | Promise<void>
156
158
  visible?: (row: unknown) => boolean
@@ -164,6 +166,8 @@ export interface ResolvedAction {
164
166
  name: string
165
167
  icon: string | undefined
166
168
  tooltip: string | undefined
169
+ /** The button's accessible name (#5323) */
170
+ ariaLabel: string | undefined
167
171
  severity: string
168
172
  isDisabled: boolean
169
173
  handler: () => void | Promise<void>
@@ -65,6 +65,8 @@ export default `core:
65
65
  confirmDeleteTitle: Confirm Delete
66
66
  confirmDeleteItem: 'Delete {entity} "{label}"?'
67
67
  confirmDeleteThis: Are you sure you want to delete this {entity}?
68
+ confirmBulkDelete: "Delete {count} {entities}?"
69
+ confirmBulkDeleteTitle: Confirm Bulk Delete
68
70
  errors:
69
71
  required: Required
70
72
  tooShort: Too short (min {min})
@@ -63,6 +63,8 @@ core:
63
63
  confirmDeleteTitle: Confirm Delete
64
64
  confirmDeleteItem: 'Delete {entity} "{label}"?'
65
65
  confirmDeleteThis: Are you sure you want to delete this {entity}?
66
+ confirmBulkDelete: "Delete {count} {entities}?"
67
+ confirmBulkDeleteTitle: Confirm Bulk Delete
66
68
  errors:
67
69
  required: Required
68
70
  tooShort: Too short (min {min})
@@ -65,6 +65,8 @@ export default `core:
65
65
  confirmDeleteTitle: Confirmer la suppression
66
66
  confirmDeleteItem: "Supprimer {entity} « {label} » ?"
67
67
  confirmDeleteThis: "Êtes-vous sûr de vouloir supprimer cet élément ({entity}) ?"
68
+ confirmBulkDelete: "Supprimer {count} {entities} ?"
69
+ confirmBulkDeleteTitle: Confirmer la suppression groupée
68
70
  errors:
69
71
  required: Requis
70
72
  tooShort: Trop court (min {min})
@@ -63,6 +63,8 @@ core:
63
63
  confirmDeleteTitle: Confirmer la suppression
64
64
  confirmDeleteItem: "Supprimer {entity} « {label} » ?"
65
65
  confirmDeleteThis: "Êtes-vous sûr de vouloir supprimer cet élément ({entity}) ?"
66
+ confirmBulkDelete: "Supprimer {count} {entities} ?"
67
+ confirmBulkDeleteTitle: Confirmer la suppression groupée
66
68
  errors:
67
69
  required: Requis
68
70
  tooShort: Trop court (min {min})