Skip to content

Commit

Permalink
feat(ui5-dynamic-page): proper docs added
Browse files Browse the repository at this point in the history
  • Loading branch information
PetyaMarkovaBogdanova committed Jan 23, 2024
1 parent 810b08d commit 0b4f9e2
Show file tree
Hide file tree
Showing 5 changed files with 186 additions and 36 deletions.
86 changes: 61 additions & 25 deletions packages/fiori/src/DynamicPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,68 @@ const SCROLL_DEBOUNCE_RATE = 0; // ms
/**
* @class
*
* <h3 class="comment-api-title">Overview</h3>
* A layout control, representing a web page, consisting of a title, header with dynamic behavior, a content area, and an optional floating footer.
*
* <h3>Overview</h3>
*
* The control consist of several components:
*
* <ul><li><code>DynamicPageTitle</code> consists of a heading
* on the left side, content in the middle, and actions on the right. The displayed
* content changes based on the current mode of the DynamicPageHeader.</li>
* <li><code>DynamicPageHeader</code> is a generic container, which
* can contain a single layout control. The header works in two modes - expanded and snapped and its
* behavior can be adjusted with the help of different properties.</li>
* <li><code>Content area</code> is a generic container, which can have a single UI5 layout.</li>
* <li><code>Footer</code> is positioned at the bottom with a small offset and used for additional
* actions, the footer floats above the content.</li></ul>
*
* <h3>Usage</h3>
*
* Use the <code>DynamicPage</code> if you need to have a title, that is always visible
* and a header, that has configurable Expanding/Snapping functionality.
* If you don't need the Expanding/Snapping functionality it is better to use the
* <code>ui5-page</code> as a lighter control.
*
* The app can add to the <code>content</code> slot of the ui5-dynamic-page either content that is designed to fit its container (e.g. has 100% height),
* or content with own height that may overflow its container. In the second case the <code>DynamicPage</code> will show a scrollbar that allows the user
* scroll through the content.
*
* <ul><b>Notes:</b>
* <li>Snapping of the <code>DynamicPageTitle</code> is not supported in the following case:
* When the <code>DynamicPage</code> has a scroll bar, the control usually scrolls to the snapping point - the point,
* where the <code>DynamicPageHeader</code> is scrolled out completely.
* However, when there is a scroll bar, but not enough content to reach the snapping point,
* the snapping is not possible using scrolling.</li>
* </ul>
*
* <h3>Responsive Behavior</h3>
*
* Dynamic page web component implements the resposive paddings design.
*
* <h3>Keyboard Handling</h3>
*
* <h4>Basic Navigation</h4>
* <ul>
* <li>[SPACE, ENTER, RETURN] - If focus is on a button inside DynamicPageTitle its action is being triggered, once activated.
* If focus is on the snap header button (arrow button), or on the header itself, once activated, it triggers the associated action (such as snap/expand the header).
* If focus is on pin button (the button with pin icon on the bottom of the header), once activated, it triggers the associated action (pinning of the header). </li>
* </ul>
*
* <h4>Fast Navigation</h4>
* <ul>
* <li>This component provides a build in fast navigation group which can be used via <code>F6 / Shift + F6</code> or <code> Ctrl + Alt(Option) + Down / Ctrl + Alt(Option) + Up</code>.
* In order to use this functionality, you need to import the following module:
* <code>import "@ui5/webcomponents-base/dist/features/F6Navigation.js"</code></li>
* </ul>
*
* <h3>ES6 Module Import</h3>
*
* <code>import "@ui5/webcomponents-fiori/dist/DynamicPage.js";</code>
*
* @constructor
* @author SAP SE
* @alias sap.ui.webc.fiori.DynamicPage
* @extends sap.ui.webc.base.UI5Element
* @tagname ui5-dynamic-page
* @since 1.122
* @public
*/
@customElement({
Expand All @@ -68,9 +122,7 @@ class DynamicPage extends UI5Element {
/**
* Defines if the header is snapped.
*
* @type {boolean}
* @name sap.ui.webc.fiori.DynamicPage.prototype.headerSnapped
* @defaultvalue false
* @default false
* @public
*/
@property({ type: Boolean })
Expand All @@ -79,9 +131,7 @@ class DynamicPage extends UI5Element {
/**
* Defines if the header is pinned.
*
* @type {boolean}
* @name sap.ui.webc.fiori.DynamicPage.prototype.headerPinned
* @defaultvalue false
* @default false
* @public
*/
@property({ type: Boolean })
Expand All @@ -90,9 +140,7 @@ class DynamicPage extends UI5Element {
/**
* Defines if the footer is shown.
*
* @type {boolean}
* @name sap.ui.webc.fiori.DynamicPage.prototype.showFooter
* @defaultvalue false
* @default false
* @public
*/
@property({ type: Boolean })
Expand All @@ -101,7 +149,6 @@ class DynamicPage extends UI5Element {
/**
* Defines the current media query size.
*
* @type {string}
* @private
*/
@property()
Expand All @@ -110,8 +157,6 @@ class DynamicPage extends UI5Element {
/**
* Defines the content of the Dynamic Page.
*
* @name sap.ui.webc.fiori.DynamicPage.prototype.content
* @slot
* @public
*/
@slot({ "default": true, type: HTMLElement })
Expand All @@ -120,9 +165,6 @@ class DynamicPage extends UI5Element {
/**
* Defines the title HTML Element.
*
* @type {sap.ui.webc.fiori.DynamicPageTitle}
* @name sap.ui.webc.fiori.DynamicPage.prototype.titleArea
* @slot
* @public
*/
@slot({ type: DynamicPageTitle })
Expand All @@ -131,9 +173,6 @@ class DynamicPage extends UI5Element {
/**
* Defines the title HTML Element.
*
* @type {sap.ui.webc.fiori.DynamicPageHeader}
* @name sap.ui.webc.fiori.DynamicPage.prototype.headerArea
* @slot
* @public
*/
@slot({ type: DynamicPageHeader })
Expand All @@ -142,9 +181,6 @@ class DynamicPage extends UI5Element {
/**
* Defines the title HTML Element.
*
* @type {sap.ui.webc.fiori.IBar}
* @name sap.ui.webc.fiori.DynamicPage.prototype.footer
* @slot
* @public
*/
@slot({ type: HTMLElement })
Expand Down
10 changes: 7 additions & 3 deletions packages/fiori/src/DynamicPageHeader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ import DynamicPageHeaderCss from "./generated/themes/DynamicPageHeader.css.js";
*
*
* @constructor
* @alias sap.ui.webc.fiori.DynamicPageHeader
* @extends sap.ui.webc.base.UI5Element
* @tagname ui5-dynamic-page-header
* @public
* @since 1.122
*/
@customElement({
tag: "ui5-dynamic-page-header",
Expand All @@ -35,9 +34,14 @@ class DynamicPageHeader extends UI5Element {
static async onDefine() {
DynamicPageHeader.i18nBundle = await getI18nBundle("@ui5/webcomponents-fiori");
}

/**
* Defines the content of the Dynamic Page Header.
*
* @public
*/
@slot({ "default": true, type: HTMLElement })
content!: HTMLElement[];

get classes() {
return {
root: {
Expand Down
32 changes: 30 additions & 2 deletions packages/fiori/src/DynamicPageHeaderActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@ import {
*
*
* @constructor
* @alias sap.ui.webc.fiori.DynamicPageHeaderActions
* @extends sap.ui.webc.base.UI5Element
* @tagname ui5-dynamic-page-header-actions
* @public
* @since 1.122
*/
@customElement({
tag: "ui5-dynamic-page-header-actions",
Expand All @@ -37,7 +36,18 @@ import {
template: DynamicPageHeaderActionsTemplate,
})

/**
* Event that is being fired by clicking on the expand button.
*
* @public
*/
@event("expand-button-click")

/**
* Event that is being fired by clicking on the pin button.
*
* @public
*/
@event("pin-button-click")

class DynamicPageHeaderActions extends UI5Element {
Expand All @@ -47,12 +57,30 @@ class DynamicPageHeaderActions extends UI5Element {
DynamicPageHeaderActions.i18nBundle = await getI18nBundle("@ui5/webcomponents-fiori");
}

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

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

/**
* Contains attributes to be added to HTML to gain accessibility.
*
* @public
* @default {}
*/
@property({ type: Object })
accessibilityAttributes!: {controls: string};

Expand Down
59 changes: 56 additions & 3 deletions packages/fiori/src/DynamicPageTitle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ import {
*
*
* @constructor
* @alias sap.ui.webc.fiori.DynamicPageTitle
* @extends sap.ui.webc.base.UI5Element
* @tagname ui5-dynamic-page-title
* @public
*/
@customElement({
Expand All @@ -48,37 +46,92 @@ class DynamicPageTitle extends UI5Element {
DynamicPageTitle.i18nBundle = await getI18nBundle("@ui5/webcomponents-fiori");
}

/**
* Defines the content of the Heading of the Dynamic Page.
*
* @public
*/
@slot({ type: HTMLElement })
heading!: HTMLElement[];

/**
* Defines the heading that is shown only when the header is snapped.
*
* @public
*/
@slot({ type: HTMLElement })
snappedHeading!: HTMLElement[];

/**
* Defines the heading that is shown only when the header is expanded.
*
* @public
*/
@slot({ type: HTMLElement })
expandedHeading!: HTMLElement[];

/**
* Defines the actions in the Dynamic page title.
*
* @public
*/
@slot({ type: HTMLElement })
actions!: HTMLElement[];

/**
* Defines the navigation actions in the Dynamic page title.
*
* @public
*/
@slot({ type: HTMLElement })
navigationActions!: HTMLElement[];

/**
* Defines the content of the Dynamic page title.
*
* @public
*/
@slot({ "default": true, type: HTMLElement })
content!: HTMLElement[];

/**
* Defines the content of the title that is shown only when the header is snapped.
*
* @public
*/
@slot({ type: HTMLElement })
snappedContent!: HTMLElement[];

/**
* Defines the content of the title that is shown only when the header is expanded.
*
* @public
*/
@slot({ type: HTMLElement })
expandedContent!: HTMLElement[];

/**
* Defines the content of the breadcrumbs inside Dynamic Page Title.
*
* @public
*/
@slot({ type: HTMLElement })
breadcrumbs!: HTMLElement[];

/**
* Defines if the title is snapped.
*
* @public
* @default false
*/
@property({ type: Boolean })
snapped!: boolean;

// private properties
/**
* Defines if the mobileNavigationActions are shown.
*
* @private
*/
@property({ type: Boolean })
mobileNavigationActions!: boolean;

Expand Down
Loading

0 comments on commit 0b4f9e2

Please sign in to comment.