Skip to content

Commit 0329577

Browse files
Merge branch '2026.1' into 2026.x
2 parents f6ba13b + 53ff71c commit 0329577

754 files changed

Lines changed: 1743 additions & 30359 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

assets/js/src/core/modules/app/base-layout/main-nav/main-nav.tsx

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import { CUSTOM_REPORTS_WIDGET, REPORTS_WIDGET } from '@Pimcore/modules/reports'
3737
import { REDIRECTS_WIDGET } from '@Pimcore/modules/redirects'
3838
import { TAG_CONFIGURATION_WIDGET } from '@Pimcore/modules/tags'
3939
import { UserPermission } from '@Pimcore/modules/auth/enums/user-permission'
40+
import { normalizeIcon } from '@Pimcore/utils/normalize-icon'
4041

4142
export const MainNav = (): React.JSX.Element => {
4243
const { t } = useTranslation()
@@ -81,27 +82,31 @@ export const MainNav = (): React.JSX.Element => {
8182
return hasChildren && (isOpen || isNestedItem)
8283
}
8384

85+
const renderMainNavIcon = ({ iconValue, isExpanded }: { iconValue: IMainNavItem['icon'], isExpanded: boolean }): React.JSX.Element | null => {
86+
const icon = normalizeIcon(iconValue)
87+
88+
if (isUndefined(icon?.value)) return null
89+
90+
return (
91+
<Icon
92+
{ ...icon }
93+
className={ isExpanded ? undefined : 'plain-icon' }
94+
options={ isExpanded ? { width: 16, height: 16 } : undefined }
95+
sphere={ isExpanded }
96+
/>
97+
)
98+
}
99+
84100
const renderNavItem = (item: IMainNavItem, index: string, level = 0): React.JSX.Element => {
85101
const hasChildren = !isEmpty(item.children)
86102
const isVisible = hasChildren || !isUndefined(item.widgetConfig) || !isUndefined(item.useCustomMainNavItem)
87-
88103
const isHiddenInPerspective = !isUndefined(item.perspectivePermissionHide) && isAllowedInPerspective(item.perspectivePermissionHide)
89-
90104
const isHidden = !isUndefined(item.hidden) && item.hidden()
91105

92106
if (!isVisible || isHiddenInPerspective || isHidden) {
93107
return <></>
94108
}
95109

96-
const renderIcon = (value: string): React.JSX.Element => (
97-
<Icon
98-
className={ openKeys.includes(index) ? undefined : 'plain-icon' }
99-
options={ openKeys.includes(index) ? { width: 16, height: 16 } : undefined }
100-
sphere={ openKeys.includes(index) }
101-
value={ value }
102-
/>
103-
)
104-
105110
const elementWithGroupIcon = hasChildren ? item.children?.find(child => !isEmpty(child.groupIcon)) : undefined
106111

107112
return (
@@ -125,7 +130,7 @@ export const MainNav = (): React.JSX.Element => {
125130
setIsOpen(false)
126131
} }
127132
>
128-
{!isUndefined(item.icon) && renderIcon(item.icon)}
133+
{!isUndefined(item.icon) && renderMainNavIcon({ iconValue: item.icon, isExpanded: openKeys.includes(index) })}
129134

130135
<SanitizeHtml html={ t(`${item.label}`) } />
131136
</button>
@@ -148,10 +153,9 @@ export const MainNav = (): React.JSX.Element => {
148153
}
149154
} }
150155
>
151-
{!isUndefined(item.icon) && renderIcon(item.icon)}
152-
156+
{!isUndefined(item.icon) && renderMainNavIcon({ iconValue: item.icon, isExpanded: openKeys.includes(index) })}
153157
{!isUndefined(elementWithGroupIcon?.groupIcon) && isUndefined(item.icon) && (
154-
renderIcon(elementWithGroupIcon?.groupIcon)
158+
renderMainNavIcon({ iconValue: elementWithGroupIcon.groupIcon, isExpanded: openKeys.includes(index) })
155159
)}
156160

157161
<SanitizeHtml html={ t(`${item.label}`) } />
@@ -164,7 +168,6 @@ export const MainNav = (): React.JSX.Element => {
164168
/>
165169
)}
166170
</button>
167-
168171
{renderDivider(item.dividerBottom)}
169172
</>
170173
)}
@@ -276,7 +279,6 @@ export const MainNav = (): React.JSX.Element => {
276279
className={ ['main-nav', styles.mainNav].join(' ') }
277280
data-testid="main-nav-menu"
278281
>
279-
280282
<ul
281283
className={ 'main-nav__list main-nav__list--level-0' }
282284
data-testid="nav-list-main"
@@ -286,9 +288,7 @@ export const MainNav = (): React.JSX.Element => {
286288
renderNavItem(item, `${index}`)
287289
))}
288290
</ul>
289-
290291
<Divider className={ 'main-nav__divider' } />
291-
292292
<PerspectiveSwitch setIsOpen={ setIsOpen } />
293293
</div>
294294
)

assets/js/src/core/modules/app/base-layout/main-nav/services/main-nav-registry.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,16 @@
99
*/
1010

1111
import { type WidgetManagerTabConfig } from '@Pimcore/modules/widget-manager/widget-manager-slice'
12+
import { type ElementIcon } from '@Pimcore/components/icon/icon'
1213
import { injectable } from 'inversify'
1314
import { isNil, isUndefined } from 'lodash'
1415

1516
export interface IMainNavItem {
1617
path: string
1718
order?: number
1819
id?: string
19-
icon?: string
20-
groupIcon?: string
20+
icon?: string | ElementIcon
21+
groupIcon?: string | ElementIcon
2122
label?: string
2223
group?: string
2324
dividerTop?: boolean

assets/js/src/core/modules/reports/reports-view/reports-view.tsx

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import React, { useMemo, useState } from 'react'
1212
import { isEmpty, isUndefined } from 'lodash'
1313
import cn from 'classnames'
1414
import { type DefaultOptionType } from 'antd/es/select'
15+
import { type ElementIcon } from '@Pimcore/components/icon/icon'
1516
import { isEmptyValue } from '@Pimcore/utils/type-utils'
1617
import { useCustomReportsGetTreeQuery } from '@Pimcore/modules/reports/custom-reports-api-slice-enhanced'
1718
import { Content } from '@Pimcore/components/content/content'
@@ -22,6 +23,7 @@ import { ReportDataProvider } from '@Pimcore/modules/reports/reports-view/contex
2223
import { ReportViewContent } from '@Pimcore/modules/reports/reports-view/components/report-view-content/report-view-content'
2324
import { isAllowed } from '@Pimcore/modules/auth/permission-helper'
2425
import { UserPermission } from '@Pimcore/modules/auth/enums/user-permission'
26+
import { normalizeIcon } from '@Pimcore/utils/normalize-icon'
2527
import { useStyles } from './reports-view.styles'
2628

2729
interface IReportsViewProps {
@@ -37,15 +39,19 @@ export const ReportsView = ({ reportId }: IReportsViewProps): React.JSX.Element
3739

3840
const { styles } = useStyles()
3941

40-
const renderOptionLabel = (iconClass: string, value: any): React.JSX.Element => (
41-
<Flex
42-
align="center"
43-
gap="mini"
44-
>
45-
{!isEmptyValue(iconClass) && <Icon value={ iconClass } />}
46-
<SanitizeHtml html={ value } />
47-
</Flex>
48-
)
42+
const renderOptionLabel = (iconClass: ElementIcon | string | null | undefined, value: any): React.JSX.Element => {
43+
const icon = normalizeIcon(iconClass)
44+
45+
return (
46+
<Flex
47+
align="center"
48+
gap="mini"
49+
>
50+
{!isUndefined(icon?.value) && <Icon { ...icon } />}
51+
<SanitizeHtml html={ value } />
52+
</Flex>
53+
)
54+
}
4955

5056
const reportsTreeOptions: DefaultOptionType[] | undefined = useMemo(() => {
5157
if (!isUndefined(reportsTreeData?.items)) {

public/build/082403c1-15b2-4269-b8ef-1346c24cd07b/entrypoints.json

Lines changed: 0 additions & 22 deletions
This file was deleted.

public/build/082403c1-15b2-4269-b8ef-1346c24cd07b/manifest.json

Lines changed: 0 additions & 33 deletions
This file was deleted.

public/build/325e7298-d0e9-4965-9913-4cd5fc09e0ad/entrypoints.json

Lines changed: 0 additions & 23 deletions
This file was deleted.

public/build/325e7298-d0e9-4965-9913-4cd5fc09e0ad/exposeRemote.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

public/build/325e7298-d0e9-4965-9913-4cd5fc09e0ad/index.html

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)