| | |
| | | } |
| | | |
| | | export function getMenuDisplayTitle(row = {}, titleFormatter = defaultMenuTitleFormatter) { |
| | | return titleFormatter(normalizeMenuTitleKey(row)) |
| | | const normalizedTitle = normalizeMenuTitleKey(row) |
| | | const formattedTitle = titleFormatter(normalizedTitle) |
| | | if (formattedTitle) { |
| | | return formattedTitle |
| | | } |
| | | |
| | | return defaultMenuTitleFormatter(row.name || row.meta?.title || '') |
| | | } |
| | | |
| | | export function getMenuDisplayIcon(row = {}) { |
| | |
| | | })) |
| | | } |
| | | |
| | | export function buildMenuTreeOptions(tree = [], titleFormatter = defaultMenuTitleFormatter, t = $t) { |
| | | export function buildMenuTreeOptions( |
| | | tree = [], |
| | | titleFormatter = defaultMenuTitleFormatter, |
| | | t = $t |
| | | ) { |
| | | return [ |
| | | { |
| | | label: t('table.topLevelMenu'), |
| | |
| | | }) |
| | | } |
| | | |
| | | export function filterMenuTree(items = [], filters = {}, titleFormatter = defaultMenuTitleFormatter) { |
| | | export function filterMenuTree( |
| | | items = [], |
| | | filters = {}, |
| | | titleFormatter = defaultMenuTitleFormatter |
| | | ) { |
| | | const results = [] |
| | | const searchName = String(filters.name || '').toLowerCase().trim() |
| | | const searchRoute = String(filters.route || '').toLowerCase().trim() |
| | | const searchName = String(filters.name || '') |
| | | .toLowerCase() |
| | | .trim() |
| | | const searchRoute = String(filters.route || '') |
| | | .toLowerCase() |
| | | .trim() |
| | | |
| | | for (const item of items) { |
| | | const menuTitle = getMenuDisplayTitle(item, titleFormatter).toLowerCase() |