-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Section Sidebar Menu Expansion #19810
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 124 commits
Commits
Show all changes
131 commits
Select commit
Hold shift + click to select a range
7912e61
wip section menu expansion
madsrasmussen 286587e
make section context local to each section
madsrasmussen 652afb1
split kind manifest from element file
madsrasmussen 335b94a
Merge branch 'main' into v16/feature/menu-expansion
madsrasmussen c1f10b9
make generic entity expansion manager
madsrasmussen fc2525e
wip menu context
madsrasmussen 8a146e8
add collapsed and expanded events
madsrasmussen 2c8e185
Export new expansion entity event modules
madsrasmussen c2f3619
rename events
madsrasmussen 90a6db2
dispatch events
madsrasmussen 8316f66
Set tree expansion changes in the menu context
madsrasmussen 6990157
expand menu from workspace
madsrasmussen f0719d6
do not allow undefined
madsrasmussen e7b50fc
make menu item feature folder
madsrasmussen 6cf35c1
Update menu-variant-tree-structure-workspace-context-base.ts
madsrasmussen 2e1a1c5
Merge branch 'main' into v16/feature/menu-expansion
madsrasmussen b887808
menu: pass expansion as prop to prevent dependency on the section sid…
madsrasmussen 9a57dc7
use correct event
madsrasmussen b307d8c
Add event listener support to extension slot element
madsrasmussen aaa59af
Add entity expansion event handling to sidebar menu
madsrasmussen 34922d1
Optimize expansion state updates in menu components
madsrasmussen f21224b
only check if we have a local state already
madsrasmussen 63f04ae
add bulk expand method
madsrasmussen e192f67
use bulk expand method
madsrasmussen a7f4e9e
align naming
madsrasmussen 7957891
mute updates
madsrasmussen f566b0f
lower threshold
madsrasmussen 4cf39f0
add expansion model with target
madsrasmussen 3f5c665
add function to link entries
madsrasmussen 438d6ae
fix self import
madsrasmussen 09a76f1
export constants
madsrasmussen 8a408d0
update js docs for entity expansion manager
madsrasmussen 654c558
link entries
madsrasmussen 56c21ad
fix import
madsrasmussen eba4138
do not export from menu here
madsrasmussen ecdc84a
fix import
madsrasmussen d7c1d04
fix import
madsrasmussen f9973ac
Merge branch 'main' into v16/feature/menu-expansion
madsrasmussen b637fcc
align how we register manifests
madsrasmussen fabcad7
add specific managers for section sidebar menu
madsrasmussen a2939eb
use structure items
madsrasmussen d6469cc
dot not expand current item
madsrasmussen f68cefc
Refactor section sidebar menu to use programmatic extension slot
madsrasmussen af2d4e6
add section context extension
madsrasmussen 8ce93ab
register menu as section context instead of hardcoding
madsrasmussen 8d02980
rename folder
madsrasmussen ac11898
align naming
madsrasmussen 12723d7
export extension slot elements
madsrasmussen b549957
fix typings
madsrasmussen 2266eeb
destroy extension slot element when host is disconnected
madsrasmussen 9204675
use entry model
madsrasmussen 020b752
move and rename
madsrasmussen 44c55fd
register global context to hold menu state across sections
madsrasmussen 4b55108
temp observe section specific expansions
madsrasmussen 489dd2d
temp observe section specific expansions
madsrasmussen 6a361ff
add method to collapse multiple items
madsrasmussen ce59d2e
bind expansion to section
madsrasmussen aa463fa
make entity expansion manager generic
madsrasmussen 5d7660e
add helper method
madsrasmussen d2739b9
remove temp test data
madsrasmussen da56702
include last item in target
madsrasmussen cb0f063
Merge branch 'main' into v16/feature/menu-expansion
madsrasmussen 2f38dee
Merge branch 'main' into v16/feature/menu-expansion
madsrasmussen 3a9b99b
remove unused
madsrasmussen f412ee6
pass full entry to event
madsrasmussen cebd848
add type for menu item expansion
madsrasmussen dc8c298
export types
madsrasmussen 0a7ec5b
add menuItem alias
madsrasmussen 168bd20
Update types.ts
madsrasmussen 14882b0
support menu item expansion entry
madsrasmussen b839174
add const for menu item alias + use for breadcrumb and menu item
madsrasmussen 77685a5
add data type menu item alias const + apply to breadcrumb
madsrasmussen bde787d
move to correct manifest
madsrasmussen d624e26
add menu item alias to expand entries
madsrasmussen b318537
Update manifests.ts
madsrasmussen 2d046ad
add menu structure kind types
madsrasmussen 732d4e7
add kind to manifests
madsrasmussen 99bb2b3
add menu item context
madsrasmussen 4798686
filter menu items
madsrasmussen ea37741
handle menu item expansion
madsrasmussen 1a1b9b5
clean up
madsrasmussen d11994b
fix order
madsrasmussen 381cf0d
add example dashboard and entity action
madsrasmussen 1fd858f
import types
madsrasmussen b4c83df
align model type names
madsrasmussen bb3e7ea
align naming
madsrasmussen 90315af
use ui component
madsrasmussen dd49974
add guard for menu item entry
madsrasmussen 42f40e4
use correct type
madsrasmussen 83cf8a0
Update section-sidebar-menu.element.ts
madsrasmussen b849da2
Update entity-expansion.manager.ts
madsrasmussen 7fa076a
Merge branch 'main' into v16/feature/menu-expansion
madsrasmussen 4ffb904
export constants
madsrasmussen 82861e8
add menuItemAlias to manifest
madsrasmussen 0414dac
add menuItemAlias to manifest
madsrasmussen 14d0bfd
add menuItemAlias to manifest
madsrasmussen 08bebca
add menuItemAlias to manifest
madsrasmussen 078d799
add menu item alias
madsrasmussen 55fd940
add menuItemAlias to manifest
madsrasmussen 93c1a97
add menuItemAlias to manifest
madsrasmussen 9267ec7
add menuItemAlias to manifest
madsrasmussen 96babd8
add alias
madsrasmussen 54c1ecf
add kind
madsrasmussen 5222389
fix import path
madsrasmussen a52c0dc
do not expand menu from modal
madsrasmussen d30183b
collect all menu-item files in one folder
madsrasmussen f34b4d4
Merge branch 'main' into v16/feature/menu-expansion
madsrasmussen 4190933
fix lint errors
madsrasmussen 4b64646
Merge branch 'v16/feature/menu-expansion' of https://github.com/umbra…
madsrasmussen 6299e56
Update content-detail-workspace-base.ts
madsrasmussen 592c246
Merge branch 'main' into v16/feature/menu-expansion
madsrasmussen ab2d1f1
clean up
madsrasmussen 7086067
rename to example
madsrasmussen 95cb2a7
add button to collapse everything within a section
madsrasmussen f46796f
fix breadcrumb for non-variant structure
madsrasmussen 70dd7f3
reload entity
madsrasmussen 98956ad
destroy
madsrasmussen ad35d49
remove self
madsrasmussen 7a95310
Updated acceptance tests to check if a caret button is open before cl…
andr317c 64617db
Bumped version of test helpers
andr317c c51295a
Merge branch 'main' into v16/feature/menu-expansion
madsrasmussen 6435588
use const
madsrasmussen 741bde4
Merge branch 'main' into v16/feature/menu-expansion
nielslyngsoe 7a1b50c
correct
nielslyngsoe a1baf6a
using Event Contsants for event map
nielslyngsoe 628a274
comment
nielslyngsoe 9c64c41
clean event listeners before adding new ones
madsrasmussen 923410e
use createObservablePart
madsrasmussen 2d99b85
Merge branch 'main' into v16/feature/menu-expansion
nielslyngsoe e5d76ee
add controller alias to observer
nielslyngsoe bd5b17f
Merge branch 'main' into v16/feature/menu-expansion
nielslyngsoe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
...debar-menu-expansion/collapse-menu-item-entity-action/collapse-menu-item.entity-action.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { UmbEntityActionBase } from '@umbraco-cms/backoffice/entity-action'; | ||
import { UMB_MENU_ITEM_CONTEXT } from '@umbraco-cms/backoffice/menu'; | ||
|
||
export class ExampleCollapseMenuItemEntityAction extends UmbEntityActionBase<never> { | ||
override async execute() { | ||
const context = await this.getContext(UMB_MENU_ITEM_CONTEXT); | ||
context?.expansion.collapseAll(); | ||
} | ||
} | ||
|
||
export { ExampleCollapseMenuItemEntityAction as api }; |
15 changes: 15 additions & 0 deletions
15
...ent/examples/section-sidebar-menu-expansion/collapse-menu-item-entity-action/manifests.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
export const manifests: Array<UmbExtensionManifest> = [ | ||
{ | ||
type: 'entityAction', | ||
kind: 'default', | ||
alias: 'Umb.EntityAction.Document.MenuItem.Collapse', | ||
name: 'Collapse Document Menu Item', | ||
api: () => import('./collapse-menu-item.entity-action.js'), | ||
forEntityTypes: ['document-type-root', 'media-type-root', 'member-type-root', 'data-type-root'], | ||
weight: -10, | ||
meta: { | ||
label: 'Collapse Menu Item', | ||
icon: 'icon-wand', | ||
}, | ||
}, | ||
]; |
4 changes: 4 additions & 0 deletions
4
src/Umbraco.Web.UI.Client/examples/section-sidebar-menu-expansion/index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { manifests as playgroundDashboardManifests } from './playground-dashboard/manifests.js'; | ||
import { manifests as collapseMenuItemManifests } from './collapse-menu-item-entity-action/manifests.js'; | ||
|
||
export const manifests: Array<UmbExtensionManifest> = [...playgroundDashboardManifests, ...collapseMenuItemManifests]; |
14 changes: 14 additions & 0 deletions
14
...o.Web.UI.Client/examples/section-sidebar-menu-expansion/playground-dashboard/manifests.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
export const manifests: Array<UmbExtensionManifest> = [ | ||
{ | ||
type: 'dashboard', | ||
kind: 'default', | ||
name: 'Example Section Sidebar Menu Playground Dashboard', | ||
alias: 'Example.Dashboard.SectionSidebarMenuPlayground', | ||
element: () => import('./section-sidebar-menu-playground.element.js'), | ||
weight: 3000, | ||
meta: { | ||
label: 'Section Sidebar Menu Playground', | ||
pathname: 'section-sidebar-menu-playground', | ||
}, | ||
}, | ||
]; |
102 changes: 102 additions & 0 deletions
102
...on-sidebar-menu-expansion/playground-dashboard/section-sidebar-menu-playground.element.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
import { html, customElement, LitElement, css, state, repeat } from '@umbraco-cms/backoffice/external/lit'; | ||
import { UmbElementMixin } from '@umbraco-cms/backoffice/element-api'; | ||
import { | ||
UMB_SECTION_SIDEBAR_MENU_GLOBAL_CONTEXT, | ||
UMB_SECTION_SIDEBAR_MENU_SECTION_CONTEXT, | ||
type UmbSectionMenuItemExpansionEntryModel, | ||
} from '@umbraco-cms/backoffice/menu'; | ||
|
||
@customElement('example-section-sidebar-menu-playground-dashboard') | ||
export class ExampleSectionSidebarMenuPlaygroundDashboard extends UmbElementMixin(LitElement) { | ||
#globalContext?: typeof UMB_SECTION_SIDEBAR_MENU_GLOBAL_CONTEXT.TYPE; | ||
#sectionContext?: typeof UMB_SECTION_SIDEBAR_MENU_SECTION_CONTEXT.TYPE; | ||
|
||
@state() | ||
private _globalExpansion: Array<UmbSectionMenuItemExpansionEntryModel> = []; | ||
|
||
@state() | ||
private _sectionExpansion: Array<UmbSectionMenuItemExpansionEntryModel> = []; | ||
|
||
constructor() { | ||
super(); | ||
|
||
this.consumeContext(UMB_SECTION_SIDEBAR_MENU_GLOBAL_CONTEXT, (section) => { | ||
this.#globalContext = section; | ||
this.#observeGlobalExpansion(); | ||
}); | ||
|
||
this.consumeContext(UMB_SECTION_SIDEBAR_MENU_SECTION_CONTEXT, (section) => { | ||
this.#sectionContext = section; | ||
this.#observeSectionExpansion(); | ||
}); | ||
} | ||
|
||
#observeGlobalExpansion() { | ||
this.observe(this.#globalContext?.expansion.expansion, (items) => { | ||
this._globalExpansion = items || []; | ||
}); | ||
} | ||
|
||
#observeSectionExpansion() { | ||
this.observe(this.#sectionContext?.expansion.expansion, (items) => { | ||
this._sectionExpansion = items || []; | ||
}); | ||
} | ||
|
||
#onCloseItem(event: PointerEvent, item: UmbSectionMenuItemExpansionEntryModel) { | ||
event.stopPropagation(); | ||
this.#sectionContext?.expansion.collapseItem(item); | ||
} | ||
|
||
#onCollapseSection() { | ||
this.#sectionContext?.expansion.collapseAll(); | ||
} | ||
|
||
override render() { | ||
return html` <umb-stack> | ||
<uui-box headline="Open Items for this section"> | ||
<uui-button slot="header-actions" @click=${this.#onCollapseSection} compact> | ||
<uui-icon name="icon-wand"></uui-icon> | ||
Collapse All</uui-button | ||
> | ||
${repeat( | ||
this._sectionExpansion, | ||
(item) => item.entityType + item.unique, | ||
(item) => this.#renderItem(item), | ||
)} | ||
</uui-box> | ||
<uui-box headline="Open Items for all sections"> | ||
${repeat( | ||
this._globalExpansion, | ||
(item) => item.entityType + item.unique, | ||
(item) => this.#renderItem(item), | ||
)} | ||
</uui-box> | ||
</umb-stack>`; | ||
} | ||
|
||
#renderItem(item: UmbSectionMenuItemExpansionEntryModel) { | ||
return html` <uui-ref-node | ||
name=${item.entityType} | ||
detail=${item.unique + ', ' + item.menuItemAlias + ', ' + item.sectionAlias}> | ||
<uui-button slot="actions" @click=${(event: PointerEvent) => this.#onCloseItem(event, item)}>Close</uui-button> | ||
</uui-ref-node>`; | ||
} | ||
|
||
static override styles = [ | ||
css` | ||
:host { | ||
display: block; | ||
padding: var(--uui-size-layout-1); | ||
} | ||
`, | ||
]; | ||
} | ||
|
||
export { ExampleSectionSidebarMenuPlaygroundDashboard as element }; | ||
|
||
declare global { | ||
interface HTMLElementTagNameMap { | ||
'example-section-sidebar-menu-playground-dashboard': ExampleSectionSidebarMenuPlaygroundDashboard; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/Umbraco.Web.UI.Client/src/packages/core/menu/components/menu-item/action/types.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
src/Umbraco.Web.UI.Client/src/packages/core/menu/components/menu-item/constants.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './menu-item.context.token.js'; |
16 changes: 16 additions & 0 deletions
16
...c/packages/core/menu/components/menu-item/expansion/is-menu-item-expansion-entry.guard.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import type { UmbMenuItemExpansionEntryModel } from '../../types.js'; | ||
|
||
/** | ||
* Checks if the provided object is a Menu Item Expansion Entry. | ||
* @param {object } object - The object to check. | ||
* @returns {boolean } True if the object is a Menu Item Expansion Entry, false otherwise. | ||
*/ | ||
export function isMenuItemExpansionEntry(object: unknown): object is UmbMenuItemExpansionEntryModel { | ||
return ( | ||
typeof object === 'object' && | ||
object !== null && | ||
'entityType' in object && | ||
'unique' in object && | ||
'menuItemAlias' in object | ||
); | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.