@quazardous/qdadm 2.50.0 → 2.51.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 (30) hide show
  1. package/dist/styles/qdadm.css +1 -1
  2. package/package.json +2 -1
  3. package/src/components/edit/FormActions.vue +33 -9
  4. package/src/components/edit/FormPage.vue +8 -0
  5. package/src/components/editors/JsonStructuredField.vue +36 -219
  6. package/src/components/editors/PermissionEditor.vue +62 -204
  7. package/src/components/editors/permissionSuggestions.ts +139 -0
  8. package/src/components/editors/structured/JsonRawFace.vue +37 -0
  9. package/src/components/editors/structured/StructuredField.vue +214 -0
  10. package/src/components/editors/structured/YamlRawFace.vue +70 -0
  11. package/src/components/editors/structured/faces.ts +35 -0
  12. package/src/components/editors/structured/registerJson.ts +5 -0
  13. package/src/components/editors/structured/registerYaml.ts +5 -0
  14. package/src/components/index.ts +8 -2
  15. package/src/components/lists/ActionButtons.vue +3 -0
  16. package/src/composables/confirmDelete.ts +20 -1
  17. package/src/composables/useEntityItemFormPage.ts +16 -6
  18. package/src/composables/useEntityItemFormPage.types.ts +7 -1
  19. package/src/composables/useEntityItemShowPage.ts +1 -1
  20. package/src/composables/useListPage.ts +9 -4
  21. package/src/composables/useListPage.types.ts +4 -0
  22. package/src/editors/index.ts +4 -14
  23. package/src/editors/json.ts +19 -0
  24. package/src/editors/yaml.ts +6 -1
  25. package/src/i18n/defaults/core.en.generated.ts +19 -0
  26. package/src/i18n/defaults/core.en.yml +19 -0
  27. package/src/i18n/defaults/core.fr.generated.ts +19 -0
  28. package/src/i18n/defaults/core.fr.yml +19 -0
  29. package/src/styles/_forms.scss +2 -1
  30. package/src/styles/_responsive.scss +2 -1
@@ -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>
@@ -1,17 +1,7 @@
1
1
  /**
2
- * qdadm/editors - Optional editors that require vanilla-jsoneditor
2
+ * qdadm/editors - the JSON editors, as '@quazardous/qdadm/editors/json'
3
3
  *
4
- * Import from '@quazardous/qdadm/editors' only if you need VanillaJsonEditor.
5
- * This keeps vanilla-jsoneditor out of the main bundle.
6
- *
7
- * Usage:
8
- * import { VanillaJsonEditor, JsonStructuredField } from '@quazardous/qdadm/editors'
4
+ * Kept so existing imports work; new code imports
5
+ * '@quazardous/qdadm/editors/json' (and '@quazardous/qdadm/editors/yaml').
9
6
  */
10
-
11
- export { default as VanillaJsonEditor } from '../components/editors/VanillaJsonEditor.vue'
12
- export { default as JsonStructuredField } from '../components/editors/JsonStructuredField.vue'
13
-
14
- // Re-export the mode enum so consumers who want it don't need to depend on
15
- // vanilla-jsoneditor directly (#1253). String literals ('tree' | 'text' |
16
- // 'table') are accepted by VanillaJsonEditor's `mode` prop anyway.
17
- export { Mode } from 'vanilla-jsoneditor'
7
+ export * from './json'
@@ -0,0 +1,19 @@
1
+ /**
2
+ * qdadm/editors/json - JSON editors on vanilla-jsoneditor (an optional peer)
3
+ *
4
+ * Import from '@quazardous/qdadm/editors/json' only if you install
5
+ * vanilla-jsoneditor: it stays out of the main bundle. Importing it also
6
+ * registers the JSON face of StructuredField (#5333).
7
+ *
8
+ * import { VanillaJsonEditor, JsonStructuredField } from '@quazardous/qdadm/editors/json'
9
+ */
10
+ import '../components/editors/structured/registerJson'
11
+
12
+ export { default as VanillaJsonEditor } from '../components/editors/VanillaJsonEditor.vue'
13
+ export { default as JsonStructuredField } from '../components/editors/JsonStructuredField.vue'
14
+ export { default as StructuredField } from '../components/editors/structured/StructuredField.vue'
15
+
16
+ // Re-export the mode enum so consumers who want it don't need to depend on
17
+ // vanilla-jsoneditor directly (#1253). String literals ('tree' | 'text' |
18
+ // 'table') are accepted by VanillaJsonEditor's `mode` prop anyway.
19
+ export { Mode } from 'vanilla-jsoneditor'
@@ -3,10 +3,15 @@
3
3
  *
4
4
  * Import from '@quazardous/qdadm/editors/yaml' only if you install
5
5
  * @quazardous/vanilla-yamleditor (an optional peer): it stays out of the
6
- * main bundle and of '@quazardous/qdadm/editors'.
6
+ * main bundle and of '@quazardous/qdadm/editors/json'.
7
7
  *
8
8
  * import { VanillaYamlEditor, YamlConfigEditor, restYamlAdapter } from '@quazardous/qdadm/editors/yaml'
9
+ *
10
+ * Importing it also registers the YAML face of StructuredField (#5333).
9
11
  */
12
+ import '../components/editors/structured/registerYaml'
13
+
14
+ export { default as StructuredField } from '../components/editors/structured/StructuredField.vue'
10
15
  export { default as VanillaYamlEditor } from '../components/editors/yaml/VanillaYamlEditor.vue'
11
16
  export { default as YamlConfigEditor } from '../components/editors/yaml/YamlConfigEditor.vue'
12
17
  export {
@@ -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})
@@ -363,6 +365,23 @@ export default `core:
363
365
  moreKeys: "+{count} more"
364
366
  takeTheirs: Load their version
365
367
  keepMine: Keep mine and save over it
368
+ # PermissionEditor (#5333)
369
+ permissionEditor:
370
+ placeholder: Type a permission…
371
+ help: 'Type a permission (e.g. "entity:books:read"), Tab to complete'
372
+ noMatch: No matching permission
373
+ noPermissions: No permission to suggest
374
+ all: All permissions
375
+ actionEverywhere: "{action}, everywhere"
376
+ anActionEverywhere: One action, everywhere
377
+ allUnder: "Everything under {prefix}"
378
+ directUnder: "Every {prefix} permission, one level"
379
+ actionUnder: "{action} under {prefix}"
380
+ subItems: "{count} sub-item | {count} sub-items"
381
+ # StructuredField: a structured face and a raw JSON / YAML one (#5333)
382
+ structuredField:
383
+ structured: Structured
384
+ invalid: "Invalid {format}: fix it before switching views"
366
385
  # Values a create reveals once: a key's token (QdRevealOnce, #5319)
367
386
  revealOnce:
368
387
  title: "{entity} created"
@@ -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})
@@ -361,6 +363,23 @@ core:
361
363
  moreKeys: "+{count} more"
362
364
  takeTheirs: Load their version
363
365
  keepMine: Keep mine and save over it
366
+ # PermissionEditor (#5333)
367
+ permissionEditor:
368
+ placeholder: Type a permission…
369
+ help: 'Type a permission (e.g. "entity:books:read"), Tab to complete'
370
+ noMatch: No matching permission
371
+ noPermissions: No permission to suggest
372
+ all: All permissions
373
+ actionEverywhere: "{action}, everywhere"
374
+ anActionEverywhere: One action, everywhere
375
+ allUnder: "Everything under {prefix}"
376
+ directUnder: "Every {prefix} permission, one level"
377
+ actionUnder: "{action} under {prefix}"
378
+ subItems: "{count} sub-item | {count} sub-items"
379
+ # StructuredField: a structured face and a raw JSON / YAML one (#5333)
380
+ structuredField:
381
+ structured: Structured
382
+ invalid: "Invalid {format}: fix it before switching views"
364
383
  # Values a create reveals once: a key's token (QdRevealOnce, #5319)
365
384
  revealOnce:
366
385
  title: "{entity} created"
@@ -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})
@@ -363,6 +365,23 @@ export default `core:
363
365
  moreKeys: "+{count} autres"
364
366
  takeTheirs: Charger sa version
365
367
  keepMine: Garder la mienne et l'enregistrer par-dessus
368
+ # PermissionEditor (#5333)
369
+ permissionEditor:
370
+ placeholder: Saisir un droit…
371
+ help: 'Saisissez un droit (ex. « entity:books:read »), Tab pour compléter'
372
+ noMatch: Aucun droit correspondant
373
+ noPermissions: Aucun droit à proposer
374
+ all: Tous les droits
375
+ actionEverywhere: "{action}, partout"
376
+ anActionEverywhere: Une action, partout
377
+ allUnder: "Tout ce qui est sous {prefix}"
378
+ directUnder: "Tous les droits de {prefix}, un niveau"
379
+ actionUnder: "{action} sous {prefix}"
380
+ subItems: "{count} sous-élément | {count} sous-éléments"
381
+ # StructuredField: a structured face and a raw JSON / YAML one (#5333)
382
+ structuredField:
383
+ structured: Structuré
384
+ invalid: "{format} invalide : corrigez-le avant de changer de vue"
366
385
  # Values a create reveals once: a key's token (QdRevealOnce, #5319)
367
386
  revealOnce:
368
387
  title: "{entity} : création réussie"
@@ -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})
@@ -361,6 +363,23 @@ core:
361
363
  moreKeys: "+{count} autres"
362
364
  takeTheirs: Charger sa version
363
365
  keepMine: Garder la mienne et l'enregistrer par-dessus
366
+ # PermissionEditor (#5333)
367
+ permissionEditor:
368
+ placeholder: Saisir un droit…
369
+ help: 'Saisissez un droit (ex. « entity:books:read »), Tab pour compléter'
370
+ noMatch: Aucun droit correspondant
371
+ noPermissions: Aucun droit à proposer
372
+ all: Tous les droits
373
+ actionEverywhere: "{action}, partout"
374
+ anActionEverywhere: Une action, partout
375
+ allUnder: "Tout ce qui est sous {prefix}"
376
+ directUnder: "Tous les droits de {prefix}, un niveau"
377
+ actionUnder: "{action} sous {prefix}"
378
+ subItems: "{count} sous-élément | {count} sous-éléments"
379
+ # StructuredField: a structured face and a raw JSON / YAML one (#5333)
380
+ structuredField:
381
+ structured: Structuré
382
+ invalid: "{format} invalide : corrigez-le avant de changer de vue"
364
383
  # Values a create reveals once: a key's token (QdRevealOnce, #5319)
365
384
  revealOnce:
366
385
  title: "{entity} : création réussie"
@@ -377,7 +377,8 @@
377
377
  border-top: 1px solid var(--p-surface-200);
378
378
  }
379
379
 
380
- .form-actions-left {
380
+ .form-actions-left,
381
+ .form-actions-right {
381
382
  display: flex;
382
383
  align-items: center;
383
384
  gap: 0.5rem;
@@ -199,7 +199,8 @@
199
199
  flex-direction: column;
200
200
  gap: 0.5rem;
201
201
 
202
- .form-actions-left {
202
+ .form-actions-left,
203
+ .form-actions-right {
203
204
  width: 100%;
204
205
  flex-direction: column;
205
206
  }