feat: add caption prop

Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
pull/38950/head
John Molakvoæ 2023-06-30 10:59:00 +07:00
parent 047218b5b0
commit 7929ad4a93
No known key found for this signature in database
GPG Key ID: 60C25B8C072916CF
1 changed files with 7 additions and 0 deletions

@ -49,6 +49,8 @@ export interface Navigation {
id: string
/** Translated view name */
name: string
/** Translated view accessible description */
caption?: string
/**
* Method return the content of the provided path
* This ideally should be a cancellable promise.
@ -171,6 +173,11 @@ const isValidNavigation = function(view: Navigation): boolean {
throw new Error('Navigation name is required and must be a string')
}
if (view.columns && view.columns.length > 0
&& (!view.caption || typeof view.caption !== 'string')) {
throw new Error('Navigation caption is required for top-level views and must be a string')
}
/**
* Legacy handle their content and icon differently
* TODO: remove when support for legacy views is removed