Skip to content
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

feat(ui5-side-navigation): add navigation groups #8261

Merged
merged 65 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
8ed86ae
feat(ui5-side-navigation): add navigation groups
TeodorTaushanov Feb 8, 2024
caa974a
feat(ui5-side-navigation): add navigation groups
TeodorTaushanov Feb 9, 2024
e17a74b
feat(ui5-side-navigation): fix lint error
TeodorTaushanov Feb 9, 2024
e9ce541
Merge remote-tracking branch 'origin/main' into sidenav_groups
TeodorTaushanov Feb 9, 2024
1151968
feat(ui5-side-navigation): add group support
TeodorTaushanov Feb 12, 2024
2b971d7
Merge remote-tracking branch 'origin/main' into sidenav_groups
TeodorTaushanov Feb 12, 2024
777520c
feat(ui5-side-navigation): fix lint error
TeodorTaushanov Feb 12, 2024
5a22a46
feat(ui5-side-navigation): fix "this" context
TeodorTaushanov Feb 12, 2024
493d687
feat(ui5-side-navigation): refactor rendering
TeodorTaushanov Feb 12, 2024
d7de161
feat(ui5-side-navigation): refactor rendering
TeodorTaushanov Feb 12, 2024
3e503b6
Merge remote-tracking branch 'origin/main' into sidenav_groups
TeodorTaushanov Feb 12, 2024
9bcc6b6
Merge remote-tracking branch 'origin/main' into sidenav_groups
TeodorTaushanov Feb 13, 2024
ca76b07
feat(ui5-side-navigation): refactor rendering
TeodorTaushanov Feb 13, 2024
93b9cb9
feat(ui5-side-navigation): refactor rendering
TeodorTaushanov Feb 13, 2024
5d4c69e
Merge remote-tracking branch 'origin/main' into sidenav_groups
TeodorTaushanov Feb 13, 2024
68d5107
feat(ui5-side-navigation): refactor rendering
TeodorTaushanov Feb 13, 2024
83447e3
Merge remote-tracking branch 'origin/main' into sidenav_groups
TeodorTaushanov Feb 13, 2024
076f399
feat(ui5-side-navigation): overflow items
TeodorTaushanov Feb 14, 2024
faced76
feat(ui5-side-navigation): overflow item
TeodorTaushanov Feb 15, 2024
eaf8d34
feat(ui5-side-navigation): selection
TeodorTaushanov Feb 15, 2024
179e5b1
feat(ui5-side-navigation): invalidation flow
TeodorTaushanov Feb 15, 2024
8cc1cad
feat(ui5-side-navigation): fix lint errors
TeodorTaushanov Feb 15, 2024
401487e
Merge remote-tracking branch 'origin/main' into sidenav_groups
TeodorTaushanov Feb 15, 2024
782b160
feat(ui5-side-navigation): fixed selection
TeodorTaushanov Feb 15, 2024
8238b6a
feat(ui5-side-navigation): fixe lint error
TeodorTaushanov Feb 15, 2024
641497b
feat(ui5-side-navigation): fix overflow item selection
TeodorTaushanov Feb 16, 2024
7805454
feat(ui5-side-navigation): group styles
TeodorTaushanov Feb 16, 2024
f4ed750
feat(ui5-side-navigation): groups item navigation
TeodorTaushanov Feb 16, 2024
39229ab
feat(ui5-side-navigation): remove overflow item aria-checked
TeodorTaushanov Feb 16, 2024
b0bdba3
Merge remote-tracking branch 'origin/main' into sidenav_groups
TeodorTaushanov Feb 19, 2024
86b4b12
feat(ui5-side-navigation): style popover items
TeodorTaushanov Feb 19, 2024
c41fbac
feat(ui5-side-navigation): improve styles
TeodorTaushanov Feb 19, 2024
96f3f12
Merge remote-tracking branch 'origin/main' into sidenav_groups
TeodorTaushanov Feb 19, 2024
606dde8
feat(ui5-side-navigation): improve styles
TeodorTaushanov Feb 19, 2024
5fb784e
feat(ui5-side-navigation): improve styles
TeodorTaushanov Feb 19, 2024
b968b69
Merge remote-tracking branch 'origin/main' into sidenav_groups
TeodorTaushanov Feb 20, 2024
b3dfb7b
feat(ui5-side-navigation): fix overflow when groups are used
TeodorTaushanov Feb 20, 2024
dbb7a7e
Merge remote-tracking branch 'origin/main' into sidenav_groups
TeodorTaushanov Feb 21, 2024
45f8b27
feat(ui5-side-navigation): focus handling
TeodorTaushanov Feb 21, 2024
1a68678
feat(ui5-side-navigation): improve item navigation
TeodorTaushanov Feb 21, 2024
fb94aed
Merge remote-tracking branch 'origin/main' into sidenav_groups
TeodorTaushanov Feb 22, 2024
f9149f4
feat(ui5-side-navigation): fix item navigation
TeodorTaushanov Feb 22, 2024
bf8be50
feat(ui5-side-navigation): tests
TeodorTaushanov Feb 23, 2024
d46f785
Merge remote-tracking branch 'origin/main' into sidenav_groups
TeodorTaushanov Feb 23, 2024
0fb12d2
feat(ui5-side-navigation): tests
TeodorTaushanov Feb 23, 2024
8dc8023
feat(ui5-side-navigation): tests
TeodorTaushanov Feb 23, 2024
2db34ff
feat(ui5-side-navigation): tests
TeodorTaushanov Feb 23, 2024
ee096a2
feat(ui5-side-navigation): tests
TeodorTaushanov Feb 23, 2024
b9addf8
Merge remote-tracking branch 'origin/main' into sidenav_groups
TeodorTaushanov Feb 26, 2024
c2384c1
feat(ui5-side-navigation): texts, documentations, examples
TeodorTaushanov Feb 26, 2024
b2c4683
feat(ui5-side-navigation): code clean, documentation
TeodorTaushanov Feb 26, 2024
e3ef35d
feat(ui5-side-navigation): fix item navigation
TeodorTaushanov Feb 26, 2024
c8b0bc6
Merge remote-tracking branch 'origin/main' into sidenav_groups
TeodorTaushanov Feb 26, 2024
6f95d96
Merge remote-tracking branch 'origin/main' into sidenav_groups
TeodorTaushanov Feb 27, 2024
f8b2eb3
Merge remote-tracking branch 'origin/main' into sidenav_groups
TeodorTaushanov Feb 28, 2024
253e532
Merge remote-tracking branch 'origin/main' into sidenav_groups
TeodorTaushanov Mar 1, 2024
611b489
feat(ui5-side-navigation): fix code review comments
TeodorTaushanov Mar 1, 2024
dcc43e0
Merge remote-tracking branch 'origin/main' into sidenav_groups
TeodorTaushanov Mar 1, 2024
2666f08
feat(ui5-side-navigation): resoleve merge conflicts
TeodorTaushanov Mar 1, 2024
43af0c9
feat(ui5-side-navigation): fix code review issues
TeodorTaushanov Mar 1, 2024
4205e1e
feat(ui5-side-navigation): fix failing tests
TeodorTaushanov Mar 1, 2024
590f8e7
Merge remote-tracking branch 'origin/main' into sidenav_groups
TeodorTaushanov Mar 1, 2024
b0f4089
feat(ui5-side-navigation): move to Markdown syntax
TeodorTaushanov Mar 1, 2024
5a5675f
docs: better wording
dimovpetar Mar 14, 2024
d55b8d1
Merge branch 'main' of github.com:SAP/ui5-webcomponents into sidenav_…
dimovpetar Mar 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions packages/fiori/src/SideNavigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import Icon from "@ui5/webcomponents/dist/Icon.js";
import "@ui5/webcomponents-icons/dist/circle-task-2.js";
import "@ui5/webcomponents-icons/dist/navigation-right-arrow.js";
import "@ui5/webcomponents-icons/dist/navigation-down-arrow.js";
import type SideNavigationItemBase from "./SideNavigationItemBase.js";
import type SideNavigationSelectableItemBase from "./SideNavigationSelectableItemBase.js";
import SideNavigationItem from "./SideNavigationItem.js";
import SideNavigationSubItem from "./SideNavigationSubItem.js";
import SideNavigationTemplate from "./generated/templates/SideNavigationTemplate.lit.js";
Expand All @@ -51,20 +51,20 @@ type SideNavigationPopoverContents = {
};

type SideNavigationSelectionChangeEventDetail = {
item: SideNavigationItemBase;
item: SideNavigationSelectableItemBase;
};

// used for the inner side navigation used in the SideNavigationPopoverTemplate
type PopupClickEventDetail = {
target: {
associatedItem: SideNavigationItemBase
associatedItem: SideNavigationSelectableItemBase
}
};

// used for the inner side navigation used in the SideNavigationPopoverTemplate
type NavigationMenuClickEventDetail = {
item: {
associatedItem: SideNavigationItemBase
associatedItem: SideNavigationSelectableItemBase
}
};

Expand Down Expand Up @@ -128,7 +128,7 @@ type NavigationMenuClickEventDetail = {
/**
* Fired when the selection has changed via user interaction
*
* @param {SideNavigationItemBase} item the clicked item.
* @param {SideNavigationSelectableItemBase} item the clicked item.
* @allowPreventDefault
* @public
*/
Expand Down Expand Up @@ -416,7 +416,7 @@ class SideNavigation extends UI5Element {
return result;
}

focusItem(item: SideNavigationItemBase) {
focusItem(item: SideNavigationSelectableItemBase) {
if (item.isFixedItem) {
this._fixedItemNavigation.setCurrentItem(item);
} else {
Expand Down Expand Up @@ -527,7 +527,7 @@ class SideNavigation extends UI5Element {
});
}

_findFocusedItem(items: Array<SideNavigationItem>) : SideNavigationItemBase | undefined {
_findFocusedItem(items: Array<SideNavigationItem>) : SideNavigationSelectableItemBase | undefined {
let focusedItem;

if (this.collapsed) {
Expand All @@ -539,8 +539,8 @@ class SideNavigation extends UI5Element {
return focusedItem;
}

_getWithNestedItems(items: Array<SideNavigationItem>, expandedOnly = false): Array<SideNavigationItemBase> {
let result = new Array<SideNavigationItemBase>();
_getWithNestedItems(items: Array<SideNavigationItem>, expandedOnly = false): Array<SideNavigationSelectableItemBase> {
let result = new Array<SideNavigationSelectableItemBase>();

items.forEach(item => {
result.push(item);
Expand All @@ -553,7 +553,7 @@ class SideNavigation extends UI5Element {
return result;
}

_findSelectedItem(items: Array<SideNavigationItem>) : SideNavigationItemBase | undefined {
_findSelectedItem(items: Array<SideNavigationItem>) : SideNavigationSelectableItemBase | undefined {
let selectedItem;

if (this.collapsed) {
Expand All @@ -565,7 +565,7 @@ class SideNavigation extends UI5Element {
return selectedItem;
}

_handleItemClick(e: KeyboardEvent | PointerEvent, item: SideNavigationItemBase) {
_handleItemClick(e: KeyboardEvent | PointerEvent, item: SideNavigationSelectableItemBase) {
if (item.selected && !this.collapsed) {
item.fireEvent("click");
return;
Expand Down Expand Up @@ -609,7 +609,7 @@ class SideNavigation extends UI5Element {
return result;
}

_selectItem(item: SideNavigationItemBase) {
_selectItem(item: SideNavigationSelectableItemBase) {
if (item.disabled) {
return;
}
Expand Down
6 changes: 3 additions & 3 deletions packages/fiori/src/SideNavigationItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import customElement from "@ui5/webcomponents-base/dist/decorators/customElement
import property from "@ui5/webcomponents-base/dist/decorators/property.js";
import slot from "@ui5/webcomponents-base/dist/decorators/slot.js";
import { isLeft, isRight } from "@ui5/webcomponents-base/dist/Keys.js";
import SideNavigationItemBase from "./SideNavigationItemBase.js";
import SideNavigationSelectableItemBase from "./SideNavigationSelectableItemBase.js";
import type SideNavigation from "./SideNavigation.js";
import type SideNavigationSubItem from "./SideNavigationSubItem.js";

Expand All @@ -19,13 +19,13 @@ import type SideNavigationSubItem from "./SideNavigationSubItem.js";
* <code>import "@ui5/webcomponents-fiori/dist/SideNavigationItem.js";</code>
*
* @constructor
* @extends SideNavigationItemBase
* @extends SideNavigationSelectableItemBase
* @abstract
* @public
* @since 1.0.0-rc.8
*/
@customElement("ui5-side-navigation-item")
class SideNavigationItem extends SideNavigationItemBase {
class SideNavigationItem extends SideNavigationSelectableItemBase {
/**
* Defines if the item is expanded
*
Expand Down
112 changes: 0 additions & 112 deletions packages/fiori/src/SideNavigationItemBase.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
import event from "@ui5/webcomponents-base/dist/decorators/event.js";
import property from "@ui5/webcomponents-base/dist/decorators/property.js";
import { isSpace, isEnter } from "@ui5/webcomponents-base/dist/Keys.js";
import type { ITabbable } from "@ui5/webcomponents-base/dist/delegate/ItemNavigation.js";
import type SideNavigation from "./SideNavigation.js";

Expand Down Expand Up @@ -34,63 +33,6 @@ class SideNavigationItemBase extends UI5Element implements ITabbable {
@property()
text!: string;

/**
* Defines the icon of the item.
* <br><br>
*
* The SAP-icons font provides numerous options.
* <br>
* See all the available icons in the <ui5-link target="_blank" href="https://sdk.openui5.org/test-resources/sap/m/demokit/iconExplorer/webapp/index.html">Icon Explorer</ui5-link>.
* @public
* @default ""
*/
@property()
icon!: string;

/**
* Defines whether the item is selected
*
* @public
* @default false
*/
@property({ type: Boolean })
selected!: boolean;

/**
* Defines the link target URI. Supports standard hyperlink behavior.
* If a JavaScript action should be triggered,
* this should not be set, but instead an event handler
* for the <code>click</code> event should be registered.
*
* @public
* @default ""
* @since 1.19.0
*/
@property()
href!: string;

/**
* Defines the component target.
* <br><br>
* <b>Notes:</b>
*
* <ul>
* <li><code>_self</code></li>
* <li><code>_top</code></li>
* <li><code>_blank</code></li>
* <li><code>_parent</code></li>
* <li><code>_search</code></li>
* </ul>
*
* <b>This property must only be used when the <code>href</code> property is set.</b>
*
* @public
* @default ""
* @since 1.19.0
*/
@property()
target!: string;

/**
* Defines whether the component is disabled.
* A disabled component can't be pressed or
Expand Down Expand Up @@ -119,44 +61,20 @@ class SideNavigationItemBase extends UI5Element implements ITabbable {
return this.title || this.text;
}

get _href() {
return (!this.disabled && this.href) ? this.href : undefined;
}

get _target() {
return (!this.disabled && this.target) ? this.target : undefined;
}

get _selected() {
return this.selected;
}

get classesArray() {
const classes = [];

if (this.disabled) {
classes.push("ui5-sn-item-disabled");
}

if (this._selected) {
classes.push("ui5-sn-item-selected");
}

return classes;
}

get _classes() {
return this.classesArray.join(" ");
}

get _ariaCurrent() {
if (!this.selected) {
return undefined;
}

return "page";
}

get _effectiveTabIndex() {
if (this.disabled) {
return undefined;
Expand All @@ -181,39 +99,9 @@ class SideNavigationItemBase extends UI5Element implements ITabbable {
return this.sideNavigation?.shadowRoot!.querySelector(`#${this._id}`) as HTMLElement;
}

_onkeydown(e: KeyboardEvent) {
if (isSpace(e)) {
e.preventDefault();
}

if (isEnter(e)) {
this._activate(e);
}
}

_onkeyup(e: KeyboardEvent) {
if (isSpace(e)) {
this._activate(e);
}
}

_onclick(e: PointerEvent) {
this._activate(e);
}

get isFixedItem() {
return true;
}

_onfocusin(e: FocusEvent) {
e.stopPropagation();

this.sideNavigation?.focusItem(this);
}

_activate(e: KeyboardEvent | PointerEvent) {
this.sideNavigation?._handleItemClick(e, this);
}
}

export default SideNavigationItemBase;
Loading
Loading