@ui5/webcomponents-fiori 2.29.0-rc.0 → 2.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +61 -0
- package/README.md +12 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/DynamicSideContent.js +7 -4
- package/dist/DynamicSideContent.js.map +1 -1
- package/dist/NavigationLayoutTemplate.js +1 -1
- package/dist/NavigationLayoutTemplate.js.map +1 -1
- package/dist/ProductSwitch.d.ts +15 -4
- package/dist/ProductSwitch.js +49 -17
- package/dist/ProductSwitch.js.map +1 -1
- package/dist/ProductSwitchTemplate.js +2 -1
- package/dist/ProductSwitchTemplate.js.map +1 -1
- package/dist/Search.d.ts +7 -0
- package/dist/Search.js +31 -2
- package/dist/Search.js.map +1 -1
- package/dist/SearchField.d.ts +1 -0
- package/dist/SearchField.js +4 -1
- package/dist/SearchField.js.map +1 -1
- package/dist/SearchFieldTemplate.js +1 -1
- package/dist/SearchFieldTemplate.js.map +1 -1
- package/dist/SearchItem.d.ts +0 -2
- package/dist/SearchItem.js +0 -9
- package/dist/SearchItem.js.map +1 -1
- package/dist/SearchItemTemplate.js +7 -1
- package/dist/SearchItemTemplate.js.map +1 -1
- package/dist/ShellBar.d.ts +1 -0
- package/dist/ShellBar.js +6 -2
- package/dist/ShellBar.js.map +1 -1
- package/dist/ShellBarItem.d.ts +9 -0
- package/dist/ShellBarItem.js +3 -0
- package/dist/ShellBarItem.js.map +1 -1
- package/dist/ShellBarItemTemplate.js +1 -1
- package/dist/ShellBarItemTemplate.js.map +1 -1
- package/dist/SideNavigation.d.ts +0 -1
- package/dist/SideNavigation.js +1 -8
- package/dist/SideNavigation.js.map +1 -1
- package/dist/SideNavigationGroupTemplate.js +2 -1
- package/dist/SideNavigationGroupTemplate.js.map +1 -1
- package/dist/SideNavigationItemBase.d.ts +0 -6
- package/dist/SideNavigationItemBase.js +0 -9
- package/dist/SideNavigationItemBase.js.map +1 -1
- package/dist/SideNavigationItemTemplate.js +3 -2
- package/dist/SideNavigationItemTemplate.js.map +1 -1
- package/dist/SideNavigationItemTextTemplate.d.ts +2 -0
- package/dist/SideNavigationItemTextTemplate.js +11 -0
- package/dist/SideNavigationItemTextTemplate.js.map +1 -0
- package/dist/SideNavigationPopoverTemplate.js +2 -2
- package/dist/SideNavigationPopoverTemplate.js.map +1 -1
- package/dist/SideNavigationSubItemTemplate.js +2 -1
- package/dist/SideNavigationSubItemTemplate.js.map +1 -1
- package/dist/SideNavigationTemplate.js +4 -4
- package/dist/SideNavigationTemplate.js.map +1 -1
- package/dist/css/themes/NavigationLayout.css +1 -1
- package/dist/css/themes/ProductSwitch.css +1 -1
- package/dist/css/themes/ProductSwitchItem.css +1 -1
- package/dist/css/themes/SearchField.css +1 -1
- package/dist/css/themes/ShellBar.css +1 -1
- package/dist/css/themes/TimelineItem.css +1 -1
- package/dist/css/themes/sap_fiori_3/parameters-bundle.css +1 -1
- package/dist/css/themes/sap_fiori_3_dark/parameters-bundle.css +1 -1
- package/dist/custom-elements-internal.json +95 -8
- package/dist/custom-elements.json +82 -6
- package/dist/generated/assets/themes/sap_fiori_3/parameters-bundle.css.json +1 -1
- package/dist/generated/assets/themes/sap_fiori_3_dark/parameters-bundle.css.json +1 -1
- package/dist/generated/i18n/i18n-defaults.d.ts +1 -3
- package/dist/generated/i18n/i18n-defaults.js +1 -3
- package/dist/generated/i18n/i18n-defaults.js.map +1 -1
- package/dist/generated/themes/NavigationLayout.css.d.ts +1 -1
- package/dist/generated/themes/NavigationLayout.css.js +1 -1
- package/dist/generated/themes/NavigationLayout.css.js.map +1 -1
- package/dist/generated/themes/ProductSwitch.css.d.ts +1 -1
- package/dist/generated/themes/ProductSwitch.css.js +1 -1
- package/dist/generated/themes/ProductSwitch.css.js.map +1 -1
- package/dist/generated/themes/ProductSwitchItem.css.d.ts +1 -1
- package/dist/generated/themes/ProductSwitchItem.css.js +1 -1
- package/dist/generated/themes/ProductSwitchItem.css.js.map +1 -1
- package/dist/generated/themes/SearchField.css.d.ts +1 -1
- package/dist/generated/themes/SearchField.css.js +1 -1
- package/dist/generated/themes/SearchField.css.js.map +1 -1
- package/dist/generated/themes/ShellBar.css.d.ts +1 -1
- package/dist/generated/themes/ShellBar.css.js +1 -1
- package/dist/generated/themes/ShellBar.css.js.map +1 -1
- package/dist/generated/themes/TimelineItem.css.d.ts +1 -1
- package/dist/generated/themes/TimelineItem.css.js +1 -1
- package/dist/generated/themes/TimelineItem.css.js.map +1 -1
- package/dist/generated/themes/sap_fiori_3/parameters-bundle.css.d.ts +1 -1
- package/dist/generated/themes/sap_fiori_3/parameters-bundle.css.js +1 -1
- package/dist/generated/themes/sap_fiori_3/parameters-bundle.css.js.map +1 -1
- package/dist/generated/themes/sap_fiori_3_dark/parameters-bundle.css.d.ts +1 -1
- package/dist/generated/themes/sap_fiori_3_dark/parameters-bundle.css.js +1 -1
- package/dist/generated/themes/sap_fiori_3_dark/parameters-bundle.css.js.map +1 -1
- package/dist/vscode.html-custom-data.json +17 -1
- package/dist/web-types.json +38 -3
- package/llms.txt +120 -0
- package/package.json +11 -8
- package/src/NavigationLayoutTemplate.tsx +2 -2
- package/src/ProductSwitchTemplate.tsx +16 -9
- package/src/SearchFieldTemplate.tsx +1 -1
- package/src/SearchItemTemplate.tsx +9 -1
- package/src/ShellBarItemTemplate.tsx +2 -1
- package/src/SideNavigationGroupTemplate.tsx +2 -1
- package/src/SideNavigationItemTemplate.tsx +34 -33
- package/src/SideNavigationItemTextTemplate.tsx +12 -0
- package/src/SideNavigationPopoverTemplate.tsx +2 -0
- package/src/SideNavigationSubItemTemplate.tsx +2 -1
- package/src/SideNavigationTemplate.tsx +0 -4
- package/src/i18n/messagebundle.properties +1 -7
- package/src/themes/NavigationLayout.css +7 -7
- package/src/themes/ProductSwitch.css +15 -11
- package/src/themes/ProductSwitchItem.css +16 -12
- package/src/themes/SearchField.css +5 -0
- package/src/themes/ShellBar.css +1 -4
- package/src/themes/TimelineItem.css +2 -2
- package/src/themes/sap_fiori_3/ProductSwitchItem-parameters.css +7 -0
- package/src/themes/sap_fiori_3/parameters-bundle.css +1 -1
- package/src/themes/sap_fiori_3_dark/ProductSwitchItem-parameters.css +7 -0
- package/src/themes/sap_fiori_3_dark/parameters-bundle.css +1 -1
|
@@ -288,14 +288,17 @@ let DynamicSideContent = DynamicSideContent_1 = class DynamicSideContent extends
|
|
|
288
288
|
const sideContentAttr = this.accessibilityAttributes.sideContent || {};
|
|
289
289
|
const hasMainRole = "role" in mainContentAttr;
|
|
290
290
|
const hasSideRole = "role" in sideContentAttr;
|
|
291
|
+
const mainRole = hasMainRole ? mainContentAttr.role : "main";
|
|
292
|
+
const sideRole = hasSideRole ? sideContentAttr.role : "complementary";
|
|
293
|
+
const isPresentational = (role) => role === "none" || role === "presentation" || role === undefined;
|
|
291
294
|
return {
|
|
292
295
|
mainContent: {
|
|
293
|
-
ariaLabel: mainContentAttr.ariaLabel || DynamicSideContent_1.i18nBundle.getText(DSC_MAIN_ARIA_LABEL),
|
|
294
|
-
role:
|
|
296
|
+
ariaLabel: isPresentational(mainRole) ? undefined : (mainContentAttr.ariaLabel || DynamicSideContent_1.i18nBundle.getText(DSC_MAIN_ARIA_LABEL)),
|
|
297
|
+
role: mainRole,
|
|
295
298
|
},
|
|
296
299
|
sideContent: {
|
|
297
|
-
ariaLabel: sideContentAttr.ariaLabel || DynamicSideContent_1.i18nBundle.getText(DSC_SIDE_ARIA_LABEL),
|
|
298
|
-
role:
|
|
300
|
+
ariaLabel: isPresentational(sideRole) ? undefined : (sideContentAttr.ariaLabel || DynamicSideContent_1.i18nBundle.getText(DSC_SIDE_ARIA_LABEL)),
|
|
301
|
+
role: sideRole,
|
|
299
302
|
},
|
|
300
303
|
};
|
|
301
304
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DynamicSideContent.js","sourceRoot":"","sources":["../src/DynamicSideContent.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,UA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,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;2DACJ;AASxB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;2DACJ;AAWxB;IADC,QAAQ,EAAE;+DAC2C;AAStD;IADC,QAAQ,EAAE;iEACsD;AASjE;IADC,QAAQ,EAAE;+DACsD;AAYjE;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;sDACT;AAoBnB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mEAC6C;AAMxE;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;oDAC9B;AAMjB;IADC,QAAQ,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;8DACJ;AAM5B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;0EACR;AAOvC;IADC,IAAI,EAAE;uDACyB;AAGhC;IADC,KAAK,CAAC,eAAe,CAAC;wDACI;AAG3B;IADC,KAAK,CAAC,eAAe,CAAC;wDACI;AAKpB;IADN,IAAI,CAAC,0BAA0B,CAAC;4CACH;AArHzB,kBAAkB;IAjBvB,aAAa,CAAC;QACd,GAAG,EAAE,0BAA0B;QAC/B,QAAQ,EAAE,WAAW;QACrB,MAAM,EAAE,CAAC,qBAAqB,CAAC;QAC/B,QAAQ,EAAE,0BAA0B;KACpC,CAAC;IACF;;;;;;;OAOG;;IACF,KAAK,CAAC,eAAe,EAAE;QACvB,OAAO,EAAE,IAAI;KACb,CAAC;GACI,kBAAkB,CAwUvB;AAED,kBAAkB,CAAC,MAAM,EAAE,CAAC;AAE5B,eAAe,kBAAkB,CAAC","sourcesContent":["import UI5Element from \"@ui5/webcomponents-base/dist/UI5Element.js\";\nimport type { Slot } from \"@ui5/webcomponents-base/dist/UI5Element.js\";\nimport customElement from \"@ui5/webcomponents-base/dist/decorators/customElement.js\";\nimport event from \"@ui5/webcomponents-base/dist/decorators/event-strict.js\";\nimport property from \"@ui5/webcomponents-base/dist/decorators/property.js\";\nimport slot from \"@ui5/webcomponents-base/dist/decorators/slot-strict.js\";\nimport query from \"@ui5/webcomponents-base/dist/decorators/query.js\";\nimport i18n from \"@ui5/webcomponents-base/dist/decorators/i18n.js\";\nimport type I18nBundle from \"@ui5/webcomponents-base/dist/i18nBundle.js\";\nimport jsxRenderer from \"@ui5/webcomponents-base/dist/renderer/JsxRenderer.js\";\nimport SideContentPosition from \"./types/SideContentPosition.js\";\nimport SideContentVisibility from \"./types/SideContentVisibility.js\";\nimport SideContentFallDown from \"./types/SideContentFallDown.js\";\nimport DynamicSideContentTemplate from \"./DynamicSideContentTemplate.js\";\nimport type {\n\tAccessibilityAttributes,\n} from \"@ui5/webcomponents-base\";\n\n// Styles\nimport DynamicSideContentCss from \"./generated/themes/DynamicSideContent.css.js\";\n\n// Texts\nimport {\n\tDSC_MAIN_ARIA_LABEL,\n\tDSC_SIDE_ARIA_LABEL,\n} from \"./generated/i18n/i18n-defaults.js\";\n\n// Breakpoint-related constants\nconst S_M_BREAKPOINT = 720,\t// Breakpoint between S and M screen sizes\n\tM_L_BREAKPOINT = 1024, // Breakpoint between M and L screen sizes\n\tL_XL_BREAKPOINT = 1440, // Breakpoint between L and XL screen sizes\n\tMINIMUM_WIDTH_BREAKPOINT = 960; // Minimum width of the control where main and side contents are side by side\n\ntype DynamicSideContentLayoutChangeEventDetail = {\n\tcurrentBreakpoint: string,\n\tpreviousBreakpoint: string | undefined,\n\tmainContentVisible: boolean,\n\tsideContentVisible: boolean,\n}\n\ntype DynamicSideContentAriaAccessibilityAttributes = Pick<AccessibilityAttributes, \"ariaLabel\" | \"role\">;\ntype DynamicSideContentAccessibilityAttributes = {\n\tmainContent?: DynamicSideContentAriaAccessibilityAttributes,\n\tsideContent?: DynamicSideContentAriaAccessibilityAttributes,\n}\n\n/**\n * @class\n *\n * ### Overview\n *\n * The DynamicSideContent (`ui5-dynamic-side-content`) is a layout component that allows additional content\n * to be displayed in a way that flexibly adapts to different screen sizes. The side\n * content appears in a container next to or directly below the main content\n * (it doesn't overlay). When the side content is triggered, the main content becomes\n * narrower (if appearing side-by-side). The side content contains a separate scrollbar\n * when appearing next to the main content.\n *\n * ### Usage\n *\n * *When to use?*\n *\n * Use this component if you want to display relevant information that is not critical\n * for users to complete a task. Users should have access to all the key functions and\n * critical information in the app even if they do not see the side content. This is\n * important because on smaller screen sizes it may be difficult to display the side\n * content in a way that is easily accessible for the user.\n *\n * *When not to use?*\n *\n * Don't use it if you want to display navigation or critical information that prevents\n * users from completing a task when they have no access to the side content.\n *\n * ### Responsive Behavior\n *\n * Screen width \\> 1440px\n *\n * - Main vs. side content ratio is 75 vs. 25 percent (with a minimum of 320px\n * each).\n * - If the application defines a trigger, the side content can be hidden.\n *\n * Screen width \\<\\= 1440px and \\> 1024px\n *\n * - Main vs. side content ratio is 66.666 vs. 33.333 percent (with a minimum of\n * 320px each). If the side content width falls below 320 px, it automatically slides\n * under the main content, unless the app development team specifies that it should\n * disappear.\n *\n * Screen width \\<\\= 1024px and \\> 720px\n *\n * - The side content ratio is fixed to 340px, and the main content takes the rest\n * of the width. Only if the `sideContentFallDown` is set to `OnMinimumWidth`\n * and screen width is \\<\\= 960px and \\> 720px the side content falls below the main content.\n *\n * Screen width \\<\\= 720px (for example on a mobile device)\n *\n * - In this case, the side content automatically disappears from the screen (unless\n * specified to stay under the content by setting of `sideContentVisibility`\n * property to `AlwaysShow`) and can be triggered from a pre-set trigger\n * (specified within the app). When the side content is triggered, it replaces the main\n * content. We recommend that you always place the trigger for the side content in the\n * same location, such as in the app footer.\n *\n * A special case allows switching the comparison mode between the main and side content.\n * In this case, the screen is split into 50:50 percent for main vs. side content. The\n * responsive behavior of the equal split is the same as in the standard view - the\n * side content disappears on screen widths of less than 720 px and can only be\n * viewed by triggering it.\n *\n * ### ES6 Module Import\n *\n * `import \"@ui5/webcomponents-fiori/dist/DynamicSideContent.js\";`\n * @constructor\n * @extends UI5Element\n * @public\n * @since 1.1.0\n * @slot {Array<HTMLElement>} default - Defines the main content.\n */\n@customElement({\n\ttag: \"ui5-dynamic-side-content\",\n\trenderer: jsxRenderer,\n\tstyles: [DynamicSideContentCss],\n\ttemplate: DynamicSideContentTemplate,\n})\n/**\n * Fires when the current breakpoint has been changed.\n * @param {string} currentBreakpoint the current breakpoint.\n * @param {string | undefined} previousBreakpoint the breakpoint that was active before change to current breakpoint.\n * @param {boolean} mainContentVisible visibility of the main content.\n * @param {boolean} sideContentVisible visibility of the side content.\n * @public\n */\n@event(\"layout-change\", {\n\tbubbles: true,\n})\nclass DynamicSideContent extends UI5Element {\n\teventDetails!: {\n\t\t\"layout-change\": DynamicSideContentLayoutChangeEventDetail\n\t}\n\t/**\n\t * Defines the visibility of the main content.\n\t * @default false\n\t * @public\n\t *\n\t */\n\t@property({ type: Boolean })\n\thideMainContent = false;\n\n\t/**\n\t * Defines the visibility of the side content.\n\t * @default false\n\t * @public\n\t *\n\t */\n\t@property({ type: Boolean })\n\thideSideContent = false;\n\n\t/**\n\t * Defines whether the side content is positioned before the main content (left side\n\t * in LTR mode), or after the the main content (right side in LTR mode).\n\n\t * @default \"End\"\n\t * @public\n\t *\n\t */\n\t@property()\n\tsideContentPosition: `${SideContentPosition}` = \"End\";\n\n\t/**\n\t * Defines on which breakpoints the side content is visible.\n \t * @default \"ShowAboveS\"\n\t * @public\n\t *\n\t */\n\t@property()\n\tsideContentVisibility: `${SideContentVisibility}` = \"ShowAboveS\";\n\n\t/**\n\t * Defines on which breakpoints the side content falls down below the main content.\n\t * @default \"OnMinimumWidth\"\n\t * @public\n\t *\n\t */\n\t@property()\n\tsideContentFallDown: `${SideContentFallDown}` = \"OnMinimumWidth\";\n\n\t/**\n\t * Defines whether the component is in equal split mode. In this mode, the side and\n\t * the main content take 50:50 percent of the container on all screen sizes\n\t * except for phone, where the main and side contents are switching visibility\n\t * using the toggle method.\n\t * @default false\n\t * @public\n\t *\n\t */\n\t@property({ type: Boolean })\n\tequalSplit = false;\n\n\t/**\n\t* Defines additional accessibility attributes on different areas of the component.\n\t*\n\t* The accessibilityAttributes object has the following fields:\n\t*\n\t* - **mainContent**:\n\t* - **ariaLabel**: defines the aria-label of the main content area. Accepts any string.\n\t* - **role**: defines the role of the main content area. When not set, defaults to `\"main\"`. Set to `undefined` to remove the role attribute.\n\t*\n\t* - **sideContent**:\n\t* - **ariaLabel**: defines the aria-label of the side content area. Accepts any string.\n\t* - **role**: defines the role of the side content area. When not set, defaults to `\"complementary\"`. Set to `undefined` to remove the role attribute.\n\t*\n\t* @default {}\n\t* @public\n\t* @since 2.6.0\n\t*/\n\t@property({ type: Object })\n\taccessibilityAttributes: DynamicSideContentAccessibilityAttributes = {};\n\n\t/**\n\t * @private\n\t */\n\t@property({ type: Boolean, noAttribute: true })\n\t_toggled = false;\n\n\t/**\n\t * @private\n\t */\n\t@property({ noAttribute: true })\n\t_currentBreakpoint?: string;\n\n\t/**\n\t * @private\n\t */\n\t@property({ type: Boolean, noAttribute: true })\n\t_isSideContentBelowMainContent = false;\n\n\t/**\n\t * Defines the side content.\n\t * @public\n\t */\n\t@slot()\n\tsideContent!: Slot<HTMLElement>;\n\n\t@query(\".ui5-dsc-main\")\n\t_mainContent!: HTMLElement;\n\n\t@query(\".ui5-dsc-side\")\n\t_sideContent!: HTMLElement;\n\n\t_resizeObserver?: ResizeObserver;\n\n\t@i18n(\"@ui5/webcomponents-fiori\")\n\tstatic i18nBundle: I18nBundle;\n\n\tonEnterDOM() {\n\t\tthis._resizeObserver = new ResizeObserver(entries => {\n\t\t\tentries.forEach(entry => {\n\t\t\t\tconst width = entry.contentRect.width;\n\t\t\t\tlet breakpoint: string;\n\t\t\t\tif (width <= S_M_BREAKPOINT) {\n\t\t\t\t\tbreakpoint = \"S\";\n\t\t\t\t} else if (width <= M_L_BREAKPOINT) {\n\t\t\t\t\tbreakpoint = \"M\";\n\t\t\t\t} else if (width <= L_XL_BREAKPOINT) {\n\t\t\t\t\tbreakpoint = \"L\";\n\t\t\t\t} else {\n\t\t\t\t\tbreakpoint = \"XL\";\n\t\t\t\t}\n\n\t\t\t\tthis._isSideContentBelowMainContent = this.isSideContentBelowMainContent;\n\n\t\t\t\tif (breakpoint !== this._currentBreakpoint) {\n\t\t\t\t\tthis.fireDecoratorEvent(\"layout-change\", {\n\t\t\t\t\t\tcurrentBreakpoint: breakpoint,\n\t\t\t\t\t\tpreviousBreakpoint: this._currentBreakpoint,\n\t\t\t\t\t\tmainContentVisible: this._getMainContentVisibility(),\n\t\t\t\t\t\tsideContentVisible: this._getSideContentVisibility(),\n\t\t\t\t\t});\n\t\t\t\t\tthis._currentBreakpoint = breakpoint;\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t\tthis._resizeObserver.observe(this);\n\t}\n\n\tonExitDOM() {\n\t\tthis._resizeObserver?.disconnect();\n\t}\n\n\t/**\n\t * Toggles visibility of main and side contents on S screen size (mobile device).\n\t * @public\n\t */\n\ttoggleContents(): void {\n\t\tif (this._isToggleEnabled) {\n\t\t\tthis._toggled = !this._toggled;\n\t\t}\n\t}\n\n\t/**\n\t * Gets main content visibility by checking CSS display property\n\t * @private\n\t */\n\t_getMainContentVisibility(): boolean {\n\t\tif (!this._mainContent) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst computedStyle = getComputedStyle(this._mainContent);\n\t\treturn computedStyle.display !== \"none\";\n\t}\n\n\t/**\n\t * Gets side content visibility by checking CSS display property\n\t * @private\n\t */\n\t_getSideContentVisibility(): boolean {\n\t\tif (!this._sideContent) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst computedStyle = getComputedStyle(this._sideContent);\n\t\treturn computedStyle.display !== \"none\";\n\t}\n\n\tget classes() {\n\t\treturn {\n\t\t\tmain: {\n\t\t\t\t\"ui5-dsc-main\": true,\n\t\t\t},\n\t\t\tside: {\n\t\t\t\t\"ui5-dsc-side\": true,\n\t\t\t},\n\t\t\troot: {\n\t\t\t\t\"ui5-dsc-root\": true,\n\t\t\t\t\"ui5-dsc-toggled\": this._toggled,\n\t\t\t},\n\t\t};\n\t}\n\n\tget isSideContentBelowMainContent() {\n\t\tif (this.sideContentVisibility === SideContentVisibility.NeverShow) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Cases when side content falls below main content\n\t\tconst fallOnMinimumWidth = this.sideContentFallDown === SideContentFallDown.OnMinimumWidth && this._currentBreakpoint === this.sizeM && this.containerWidth <= MINIMUM_WIDTH_BREAKPOINT;\n\t\tconst fallBelowM = this.sideContentFallDown === SideContentFallDown.BelowM && (this._currentBreakpoint === this.sizeM || this._currentBreakpoint === this.sizeS);\n\t\tconst fallBelowL = this.sideContentFallDown === SideContentFallDown.BelowL && (this._currentBreakpoint === this.sizeM || this._currentBreakpoint === this.sizeS);\n\t\tconst fallBelowXL = this.sideContentFallDown === SideContentFallDown.BelowXL\n\t\t\t&& (this._currentBreakpoint === this.sizeL || this._currentBreakpoint === this.sizeM || this._currentBreakpoint === this.sizeS)\n\t\t\t&& this._currentBreakpoint !== this.sizeXL;\n\t\tconst fallWhenAlwaysShow = this.sideContentVisibility === SideContentVisibility.AlwaysShow && (\n\t\t\tthis._currentBreakpoint === this.sizeS\n\t\t\t|| (this._currentBreakpoint === this.sizeM && this.containerWidth <= MINIMUM_WIDTH_BREAKPOINT)\n\t\t);\n\n\t\treturn fallOnMinimumWidth || fallBelowM || fallBelowL || fallBelowXL || fallWhenAlwaysShow;\n\t}\n\n\tget styles() {\n\t\tthis._isSideContentBelowMainContent = this.isSideContentBelowMainContent;\n\n\t\treturn {\n\t\t\troot: {\n\t\t\t\t\"flex-wrap\": \"nowrap\",\n\t\t\t},\n\t\t\tmain: {\n\t\t\t\t\"height\": this._isSideContentBelowMainContent ? \"auto\" : \"100%\",\n\t\t\t},\n\t\t\tside: {\n\t\t\t\t\"height\": this._isSideContentBelowMainContent ? \"auto\" : \"100%\",\n\t\t\t},\n\t\t};\n\t}\n\n\tget accInfo(): DynamicSideContentAccessibilityAttributes {\n\t\tconst mainContentAttr = this.accessibilityAttributes.mainContent || {};\n\t\tconst sideContentAttr = this.accessibilityAttributes.sideContent || {};\n\t\tconst hasMainRole = \"role\" in mainContentAttr;\n\t\tconst hasSideRole = \"role\" in sideContentAttr;\n\n\t\treturn {\n\t\t\tmainContent: {\n\t\t\t\tariaLabel: mainContentAttr.ariaLabel || DynamicSideContent.i18nBundle.getText(DSC_MAIN_ARIA_LABEL),\n\t\t\t\trole: hasMainRole ? mainContentAttr.role : \"main\",\n\t\t\t},\n\t\t\tsideContent: {\n\t\t\t\tariaLabel: sideContentAttr.ariaLabel || DynamicSideContent.i18nBundle.getText(DSC_SIDE_ARIA_LABEL),\n\t\t\t\trole: hasSideRole ? sideContentAttr.role : \"complementary\",\n\t\t\t},\n\t\t};\n\t}\n\n\tget sizeS() {\n\t\treturn \"S\";\n\t}\n\n\tget sizeM() {\n\t\treturn \"M\";\n\t}\n\n\tget sizeL() {\n\t\treturn \"L\";\n\t}\n\n\tget sizeXL() {\n\t\treturn \"XL\";\n\t}\n\n\tget containerWidth() {\n\t\treturn this.clientWidth;\n\t}\n\n\tget breakpoint(): string {\n\t\tconst width = this.containerWidth;\n\n\t\tif (width <= S_M_BREAKPOINT) {\n\t\t\treturn this.sizeS;\n\t\t}\n\t\tif (width <= M_L_BREAKPOINT) {\n\t\t\treturn this.sizeM;\n\t\t}\n\t\tif (width <= L_XL_BREAKPOINT) {\n\t\t\treturn this.sizeL;\n\t\t}\n\t\treturn this.sizeXL;\n\t}\n\n\tget _isSideContentFirst() {\n\t\treturn this.sideContentPosition === SideContentPosition.Start;\n\t}\n\n\t/**\n\t * Returns true when the toggleContents functionality should be enabled.\n\t * Toggle is available when side content would normally be hidden in the current breakpoint\n\t * but can be shown via the toggle mechanism.\n\t * @private\n\t */\n\tget _isToggleEnabled(): boolean {\n\t\t// Never allow toggle when NeverShow is set or content is explicitly hidden\n\t\tif (this.sideContentVisibility === SideContentVisibility.NeverShow\n\t\t\t|| this.hideMainContent\n\t\t\t|| this.hideSideContent) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst currentBreakpoint = this.breakpoint;\n\n\t\t// S breakpoint: toggle available unless AlwaysShow\n\t\tif (currentBreakpoint === this.sizeS) {\n\t\t\treturn this.sideContentVisibility !== SideContentVisibility.AlwaysShow;\n\t\t}\n\n\t\t// For other breakpoints, check if side content would be hidden based on visibility setting\n\t\tconst breakpointHierarchy = {\n\t\t\t[this.sizeM]: [SideContentVisibility.ShowAboveM, SideContentVisibility.ShowAboveL],\n\t\t\t[this.sizeL]: [SideContentVisibility.ShowAboveL],\n\t\t};\n\n\t\tconst hiddenVisibilities = breakpointHierarchy[currentBreakpoint];\n\t\treturn hiddenVisibilities?.includes(this.sideContentVisibility as SideContentVisibility) ?? false;\n\t}\n}\n\nDynamicSideContent.define();\n\nexport default DynamicSideContent;\nexport type {\n\tDynamicSideContentLayoutChangeEventDetail,\n\tDynamicSideContentAccessibilityAttributes,\n};\n"]}
|
|
1
|
+
{"version":3,"file":"DynamicSideContent.js","sourceRoot":"","sources":["../src/DynamicSideContent.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,UAAU,MAAM,4CAA4C,CAAC;AAEpE,OAAO,aAAa,MAAM,0DAA0D,CAAC;AACrF,OAAO,KAAK,MAAM,yDAAyD,CAAC;AAC5E,OAAO,QAAQ,MAAM,qDAAqD,CAAC;AAC3E,OAAO,IAAI,MAAM,wDAAwD,CAAC;AAC1E,OAAO,KAAK,MAAM,kDAAkD,CAAC;AACrE,OAAO,IAAI,MAAM,iDAAiD,CAAC;AAEnE,OAAO,WAAW,MAAM,sDAAsD,CAAC;AAC/E,OAAO,mBAAmB,MAAM,gCAAgC,CAAC;AACjE,OAAO,qBAAqB,MAAM,kCAAkC,CAAC;AACrE,OAAO,mBAAmB,MAAM,gCAAgC,CAAC;AACjE,OAAO,0BAA0B,MAAM,iCAAiC,CAAC;AAKzE,SAAS;AACT,OAAO,qBAAq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AWxB;IADC,QAAQ,EAAE;+DAC2C;AAStD;IADC,QAAQ,EAAE;iEACsD;AASjE;IADC,QAAQ,EAAE;+DACsD;AAYjE;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;sDACT;AAoBnB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mEAC6C;AAMxE;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;oDAC9B;AAMjB;IADC,QAAQ,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;8DACJ;AAM5B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;0EACR;AAOvC;IADC,IAAI,EAAE;uDACyB;AAGhC;IADC,KAAK,CAAC,eAAe,CAAC;wDACI;AAG3B;IADC,KAAK,CAAC,eAAe,CAAC;wDACI;AAKpB;IADN,IAAI,CAAC,0BAA0B,CAAC;4CACH;AArHzB,kBAAkB;IAjBvB,aAAa,CAAC;QACd,GAAG,EAAE,0BAA0B;QAC/B,QAAQ,EAAE,WAAW;QACrB,MAAM,EAAE,CAAC,qBAAqB,CAAC;QAC/B,QAAQ,EAAE,0BAA0B;KACpC,CAAC;IACF;;;;;;;OAOG;;IACF,KAAK,CAAC,eAAe,EAAE;QACvB,OAAO,EAAE,IAAI;KACb,CAAC;GACI,kBAAkB,CA4UvB;AAED,kBAAkB,CAAC,MAAM,EAAE,CAAC;AAE5B,eAAe,kBAAkB,CAAC","sourcesContent":["import UI5Element from \"@ui5/webcomponents-base/dist/UI5Element.js\";\nimport type { Slot } from \"@ui5/webcomponents-base/dist/UI5Element.js\";\nimport customElement from \"@ui5/webcomponents-base/dist/decorators/customElement.js\";\nimport event from \"@ui5/webcomponents-base/dist/decorators/event-strict.js\";\nimport property from \"@ui5/webcomponents-base/dist/decorators/property.js\";\nimport slot from \"@ui5/webcomponents-base/dist/decorators/slot-strict.js\";\nimport query from \"@ui5/webcomponents-base/dist/decorators/query.js\";\nimport i18n from \"@ui5/webcomponents-base/dist/decorators/i18n.js\";\nimport type I18nBundle from \"@ui5/webcomponents-base/dist/i18nBundle.js\";\nimport jsxRenderer from \"@ui5/webcomponents-base/dist/renderer/JsxRenderer.js\";\nimport SideContentPosition from \"./types/SideContentPosition.js\";\nimport SideContentVisibility from \"./types/SideContentVisibility.js\";\nimport SideContentFallDown from \"./types/SideContentFallDown.js\";\nimport DynamicSideContentTemplate from \"./DynamicSideContentTemplate.js\";\nimport type {\n\tAccessibilityAttributes,\n} from \"@ui5/webcomponents-base\";\n\n// Styles\nimport DynamicSideContentCss from \"./generated/themes/DynamicSideContent.css.js\";\n\n// Texts\nimport {\n\tDSC_MAIN_ARIA_LABEL,\n\tDSC_SIDE_ARIA_LABEL,\n} from \"./generated/i18n/i18n-defaults.js\";\n\n// Breakpoint-related constants\nconst S_M_BREAKPOINT = 720,\t// Breakpoint between S and M screen sizes\n\tM_L_BREAKPOINT = 1024, // Breakpoint between M and L screen sizes\n\tL_XL_BREAKPOINT = 1440, // Breakpoint between L and XL screen sizes\n\tMINIMUM_WIDTH_BREAKPOINT = 960; // Minimum width of the control where main and side contents are side by side\n\ntype DynamicSideContentLayoutChangeEventDetail = {\n\tcurrentBreakpoint: string,\n\tpreviousBreakpoint: string | undefined,\n\tmainContentVisible: boolean,\n\tsideContentVisible: boolean,\n}\n\ntype DynamicSideContentAriaAccessibilityAttributes = Pick<AccessibilityAttributes, \"ariaLabel\" | \"role\">;\ntype DynamicSideContentAccessibilityAttributes = {\n\tmainContent?: DynamicSideContentAriaAccessibilityAttributes,\n\tsideContent?: DynamicSideContentAriaAccessibilityAttributes,\n}\n\n/**\n * @class\n *\n * ### Overview\n *\n * The DynamicSideContent (`ui5-dynamic-side-content`) is a layout component that allows additional content\n * to be displayed in a way that flexibly adapts to different screen sizes. The side\n * content appears in a container next to or directly below the main content\n * (it doesn't overlay). When the side content is triggered, the main content becomes\n * narrower (if appearing side-by-side). The side content contains a separate scrollbar\n * when appearing next to the main content.\n *\n * ### Usage\n *\n * *When to use?*\n *\n * Use this component if you want to display relevant information that is not critical\n * for users to complete a task. Users should have access to all the key functions and\n * critical information in the app even if they do not see the side content. This is\n * important because on smaller screen sizes it may be difficult to display the side\n * content in a way that is easily accessible for the user.\n *\n * *When not to use?*\n *\n * Don't use it if you want to display navigation or critical information that prevents\n * users from completing a task when they have no access to the side content.\n *\n * ### Responsive Behavior\n *\n * Screen width \\> 1440px\n *\n * - Main vs. side content ratio is 75 vs. 25 percent (with a minimum of 320px\n * each).\n * - If the application defines a trigger, the side content can be hidden.\n *\n * Screen width \\<\\= 1440px and \\> 1024px\n *\n * - Main vs. side content ratio is 66.666 vs. 33.333 percent (with a minimum of\n * 320px each). If the side content width falls below 320 px, it automatically slides\n * under the main content, unless the app development team specifies that it should\n * disappear.\n *\n * Screen width \\<\\= 1024px and \\> 720px\n *\n * - The side content ratio is fixed to 340px, and the main content takes the rest\n * of the width. Only if the `sideContentFallDown` is set to `OnMinimumWidth`\n * and screen width is \\<\\= 960px and \\> 720px the side content falls below the main content.\n *\n * Screen width \\<\\= 720px (for example on a mobile device)\n *\n * - In this case, the side content automatically disappears from the screen (unless\n * specified to stay under the content by setting of `sideContentVisibility`\n * property to `AlwaysShow`) and can be triggered from a pre-set trigger\n * (specified within the app). When the side content is triggered, it replaces the main\n * content. We recommend that you always place the trigger for the side content in the\n * same location, such as in the app footer.\n *\n * A special case allows switching the comparison mode between the main and side content.\n * In this case, the screen is split into 50:50 percent for main vs. side content. The\n * responsive behavior of the equal split is the same as in the standard view - the\n * side content disappears on screen widths of less than 720 px and can only be\n * viewed by triggering it.\n *\n * ### ES6 Module Import\n *\n * `import \"@ui5/webcomponents-fiori/dist/DynamicSideContent.js\";`\n * @constructor\n * @extends UI5Element\n * @public\n * @since 1.1.0\n * @slot {Array<HTMLElement>} default - Defines the main content.\n */\n@customElement({\n\ttag: \"ui5-dynamic-side-content\",\n\trenderer: jsxRenderer,\n\tstyles: [DynamicSideContentCss],\n\ttemplate: DynamicSideContentTemplate,\n})\n/**\n * Fires when the current breakpoint has been changed.\n * @param {string} currentBreakpoint the current breakpoint.\n * @param {string | undefined} previousBreakpoint the breakpoint that was active before change to current breakpoint.\n * @param {boolean} mainContentVisible visibility of the main content.\n * @param {boolean} sideContentVisible visibility of the side content.\n * @public\n */\n@event(\"layout-change\", {\n\tbubbles: true,\n})\nclass DynamicSideContent extends UI5Element {\n\teventDetails!: {\n\t\t\"layout-change\": DynamicSideContentLayoutChangeEventDetail\n\t}\n\t/**\n\t * Defines the visibility of the main content.\n\t * @default false\n\t * @public\n\t *\n\t */\n\t@property({ type: Boolean })\n\thideMainContent = false;\n\n\t/**\n\t * Defines the visibility of the side content.\n\t * @default false\n\t * @public\n\t *\n\t */\n\t@property({ type: Boolean })\n\thideSideContent = false;\n\n\t/**\n\t * Defines whether the side content is positioned before the main content (left side\n\t * in LTR mode), or after the the main content (right side in LTR mode).\n\n\t * @default \"End\"\n\t * @public\n\t *\n\t */\n\t@property()\n\tsideContentPosition: `${SideContentPosition}` = \"End\";\n\n\t/**\n\t * Defines on which breakpoints the side content is visible.\n \t * @default \"ShowAboveS\"\n\t * @public\n\t *\n\t */\n\t@property()\n\tsideContentVisibility: `${SideContentVisibility}` = \"ShowAboveS\";\n\n\t/**\n\t * Defines on which breakpoints the side content falls down below the main content.\n\t * @default \"OnMinimumWidth\"\n\t * @public\n\t *\n\t */\n\t@property()\n\tsideContentFallDown: `${SideContentFallDown}` = \"OnMinimumWidth\";\n\n\t/**\n\t * Defines whether the component is in equal split mode. In this mode, the side and\n\t * the main content take 50:50 percent of the container on all screen sizes\n\t * except for phone, where the main and side contents are switching visibility\n\t * using the toggle method.\n\t * @default false\n\t * @public\n\t *\n\t */\n\t@property({ type: Boolean })\n\tequalSplit = false;\n\n\t/**\n\t* Defines additional accessibility attributes on different areas of the component.\n\t*\n\t* The accessibilityAttributes object has the following fields:\n\t*\n\t* - **mainContent**:\n\t* - **ariaLabel**: defines the aria-label of the main content area. Accepts any string.\n\t* - **role**: defines the role of the main content area. When not set, defaults to `\"main\"`. Set to `undefined` to remove the role attribute.\n\t*\n\t* - **sideContent**:\n\t* - **ariaLabel**: defines the aria-label of the side content area. Accepts any string.\n\t* - **role**: defines the role of the side content area. When not set, defaults to `\"complementary\"`. Set to `undefined` to remove the role attribute.\n\t*\n\t* @default {}\n\t* @public\n\t* @since 2.6.0\n\t*/\n\t@property({ type: Object })\n\taccessibilityAttributes: DynamicSideContentAccessibilityAttributes = {};\n\n\t/**\n\t * @private\n\t */\n\t@property({ type: Boolean, noAttribute: true })\n\t_toggled = false;\n\n\t/**\n\t * @private\n\t */\n\t@property({ noAttribute: true })\n\t_currentBreakpoint?: string;\n\n\t/**\n\t * @private\n\t */\n\t@property({ type: Boolean, noAttribute: true })\n\t_isSideContentBelowMainContent = false;\n\n\t/**\n\t * Defines the side content.\n\t * @public\n\t */\n\t@slot()\n\tsideContent!: Slot<HTMLElement>;\n\n\t@query(\".ui5-dsc-main\")\n\t_mainContent!: HTMLElement;\n\n\t@query(\".ui5-dsc-side\")\n\t_sideContent!: HTMLElement;\n\n\t_resizeObserver?: ResizeObserver;\n\n\t@i18n(\"@ui5/webcomponents-fiori\")\n\tstatic i18nBundle: I18nBundle;\n\n\tonEnterDOM() {\n\t\tthis._resizeObserver = new ResizeObserver(entries => {\n\t\t\tentries.forEach(entry => {\n\t\t\t\tconst width = entry.contentRect.width;\n\t\t\t\tlet breakpoint: string;\n\t\t\t\tif (width <= S_M_BREAKPOINT) {\n\t\t\t\t\tbreakpoint = \"S\";\n\t\t\t\t} else if (width <= M_L_BREAKPOINT) {\n\t\t\t\t\tbreakpoint = \"M\";\n\t\t\t\t} else if (width <= L_XL_BREAKPOINT) {\n\t\t\t\t\tbreakpoint = \"L\";\n\t\t\t\t} else {\n\t\t\t\t\tbreakpoint = \"XL\";\n\t\t\t\t}\n\n\t\t\t\tthis._isSideContentBelowMainContent = this.isSideContentBelowMainContent;\n\n\t\t\t\tif (breakpoint !== this._currentBreakpoint) {\n\t\t\t\t\tthis.fireDecoratorEvent(\"layout-change\", {\n\t\t\t\t\t\tcurrentBreakpoint: breakpoint,\n\t\t\t\t\t\tpreviousBreakpoint: this._currentBreakpoint,\n\t\t\t\t\t\tmainContentVisible: this._getMainContentVisibility(),\n\t\t\t\t\t\tsideContentVisible: this._getSideContentVisibility(),\n\t\t\t\t\t});\n\t\t\t\t\tthis._currentBreakpoint = breakpoint;\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t\tthis._resizeObserver.observe(this);\n\t}\n\n\tonExitDOM() {\n\t\tthis._resizeObserver?.disconnect();\n\t}\n\n\t/**\n\t * Toggles visibility of main and side contents on S screen size (mobile device).\n\t * @public\n\t */\n\ttoggleContents(): void {\n\t\tif (this._isToggleEnabled) {\n\t\t\tthis._toggled = !this._toggled;\n\t\t}\n\t}\n\n\t/**\n\t * Gets main content visibility by checking CSS display property\n\t * @private\n\t */\n\t_getMainContentVisibility(): boolean {\n\t\tif (!this._mainContent) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst computedStyle = getComputedStyle(this._mainContent);\n\t\treturn computedStyle.display !== \"none\";\n\t}\n\n\t/**\n\t * Gets side content visibility by checking CSS display property\n\t * @private\n\t */\n\t_getSideContentVisibility(): boolean {\n\t\tif (!this._sideContent) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst computedStyle = getComputedStyle(this._sideContent);\n\t\treturn computedStyle.display !== \"none\";\n\t}\n\n\tget classes() {\n\t\treturn {\n\t\t\tmain: {\n\t\t\t\t\"ui5-dsc-main\": true,\n\t\t\t},\n\t\t\tside: {\n\t\t\t\t\"ui5-dsc-side\": true,\n\t\t\t},\n\t\t\troot: {\n\t\t\t\t\"ui5-dsc-root\": true,\n\t\t\t\t\"ui5-dsc-toggled\": this._toggled,\n\t\t\t},\n\t\t};\n\t}\n\n\tget isSideContentBelowMainContent() {\n\t\tif (this.sideContentVisibility === SideContentVisibility.NeverShow) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Cases when side content falls below main content\n\t\tconst fallOnMinimumWidth = this.sideContentFallDown === SideContentFallDown.OnMinimumWidth && this._currentBreakpoint === this.sizeM && this.containerWidth <= MINIMUM_WIDTH_BREAKPOINT;\n\t\tconst fallBelowM = this.sideContentFallDown === SideContentFallDown.BelowM && (this._currentBreakpoint === this.sizeM || this._currentBreakpoint === this.sizeS);\n\t\tconst fallBelowL = this.sideContentFallDown === SideContentFallDown.BelowL && (this._currentBreakpoint === this.sizeM || this._currentBreakpoint === this.sizeS);\n\t\tconst fallBelowXL = this.sideContentFallDown === SideContentFallDown.BelowXL\n\t\t\t&& (this._currentBreakpoint === this.sizeL || this._currentBreakpoint === this.sizeM || this._currentBreakpoint === this.sizeS)\n\t\t\t&& this._currentBreakpoint !== this.sizeXL;\n\t\tconst fallWhenAlwaysShow = this.sideContentVisibility === SideContentVisibility.AlwaysShow && (\n\t\t\tthis._currentBreakpoint === this.sizeS\n\t\t\t|| (this._currentBreakpoint === this.sizeM && this.containerWidth <= MINIMUM_WIDTH_BREAKPOINT)\n\t\t);\n\n\t\treturn fallOnMinimumWidth || fallBelowM || fallBelowL || fallBelowXL || fallWhenAlwaysShow;\n\t}\n\n\tget styles() {\n\t\tthis._isSideContentBelowMainContent = this.isSideContentBelowMainContent;\n\n\t\treturn {\n\t\t\troot: {\n\t\t\t\t\"flex-wrap\": \"nowrap\",\n\t\t\t},\n\t\t\tmain: {\n\t\t\t\t\"height\": this._isSideContentBelowMainContent ? \"auto\" : \"100%\",\n\t\t\t},\n\t\t\tside: {\n\t\t\t\t\"height\": this._isSideContentBelowMainContent ? \"auto\" : \"100%\",\n\t\t\t},\n\t\t};\n\t}\n\n\tget accInfo(): DynamicSideContentAccessibilityAttributes {\n\t\tconst mainContentAttr = this.accessibilityAttributes.mainContent || {};\n\t\tconst sideContentAttr = this.accessibilityAttributes.sideContent || {};\n\t\tconst hasMainRole = \"role\" in mainContentAttr;\n\t\tconst hasSideRole = \"role\" in sideContentAttr;\n\n\t\tconst mainRole = hasMainRole ? mainContentAttr.role : \"main\";\n\t\tconst sideRole = hasSideRole ? sideContentAttr.role : \"complementary\";\n\t\tconst isPresentational = (role?: string) => role === \"none\" || role === \"presentation\" || role === undefined;\n\n\t\treturn {\n\t\t\tmainContent: {\n\t\t\t\tariaLabel: isPresentational(mainRole) ? undefined : (mainContentAttr.ariaLabel || DynamicSideContent.i18nBundle.getText(DSC_MAIN_ARIA_LABEL)),\n\t\t\t\trole: mainRole,\n\t\t\t},\n\t\t\tsideContent: {\n\t\t\t\tariaLabel: isPresentational(sideRole) ? undefined : (sideContentAttr.ariaLabel || DynamicSideContent.i18nBundle.getText(DSC_SIDE_ARIA_LABEL)),\n\t\t\t\trole: sideRole,\n\t\t\t},\n\t\t};\n\t}\n\n\tget sizeS() {\n\t\treturn \"S\";\n\t}\n\n\tget sizeM() {\n\t\treturn \"M\";\n\t}\n\n\tget sizeL() {\n\t\treturn \"L\";\n\t}\n\n\tget sizeXL() {\n\t\treturn \"XL\";\n\t}\n\n\tget containerWidth() {\n\t\treturn this.clientWidth;\n\t}\n\n\tget breakpoint(): string {\n\t\tconst width = this.containerWidth;\n\n\t\tif (width <= S_M_BREAKPOINT) {\n\t\t\treturn this.sizeS;\n\t\t}\n\t\tif (width <= M_L_BREAKPOINT) {\n\t\t\treturn this.sizeM;\n\t\t}\n\t\tif (width <= L_XL_BREAKPOINT) {\n\t\t\treturn this.sizeL;\n\t\t}\n\t\treturn this.sizeXL;\n\t}\n\n\tget _isSideContentFirst() {\n\t\treturn this.sideContentPosition === SideContentPosition.Start;\n\t}\n\n\t/**\n\t * Returns true when the toggleContents functionality should be enabled.\n\t * Toggle is available when side content would normally be hidden in the current breakpoint\n\t * but can be shown via the toggle mechanism.\n\t * @private\n\t */\n\tget _isToggleEnabled(): boolean {\n\t\t// Never allow toggle when NeverShow is set or content is explicitly hidden\n\t\tif (this.sideContentVisibility === SideContentVisibility.NeverShow\n\t\t\t|| this.hideMainContent\n\t\t\t|| this.hideSideContent) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst currentBreakpoint = this.breakpoint;\n\n\t\t// S breakpoint: toggle available unless AlwaysShow\n\t\tif (currentBreakpoint === this.sizeS) {\n\t\t\treturn this.sideContentVisibility !== SideContentVisibility.AlwaysShow;\n\t\t}\n\n\t\t// For other breakpoints, check if side content would be hidden based on visibility setting\n\t\tconst breakpointHierarchy = {\n\t\t\t[this.sizeM]: [SideContentVisibility.ShowAboveM, SideContentVisibility.ShowAboveL],\n\t\t\t[this.sizeL]: [SideContentVisibility.ShowAboveL],\n\t\t};\n\n\t\tconst hiddenVisibilities = breakpointHierarchy[currentBreakpoint];\n\t\treturn hiddenVisibilities?.includes(this.sideContentVisibility as SideContentVisibility) ?? false;\n\t}\n}\n\nDynamicSideContent.define();\n\nexport default DynamicSideContent;\nexport type {\n\tDynamicSideContentLayoutChangeEventDetail,\n\tDynamicSideContentAccessibilityAttributes,\n};\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@ui5/webcomponents-base/jsx-runtime";
|
|
2
2
|
export default function NavigationLayoutTemplate() {
|
|
3
|
-
return (_jsxs("div", { class: "ui5-nl-root", children: [_jsx("header", { class: "ui5-nl-header", children: _jsx("slot", { name: "header" }) }), _jsxs("section", { class: "ui5-nl-section", children: [_jsx("
|
|
3
|
+
return (_jsxs("div", { class: "ui5-nl-root", children: [_jsx("header", { class: "ui5-nl-header", children: _jsx("slot", { name: "header" }) }), _jsxs("section", { class: "ui5-nl-section", children: [_jsx("div", { class: "ui5-nl-side", children: _jsx("slot", { name: "sideContent" }) }), _jsx("div", { class: "ui5-nl-content", children: _jsx("slot", {}) })] })] }));
|
|
4
4
|
}
|
|
5
5
|
//# sourceMappingURL=NavigationLayoutTemplate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavigationLayoutTemplate.js","sourceRoot":"","sources":["../src/NavigationLayoutTemplate.tsx"],"names":[],"mappings":";AAEA,MAAM,CAAC,OAAO,UAAU,wBAAwB;IAC/C,OAAO,CACN,eAAK,KAAK,EAAC,aAAa,aACvB,iBAAQ,KAAK,EAAC,eAAe,YAC5B,eAAM,IAAI,EAAC,QAAQ,GAAQ,GACnB,EACT,mBAAS,KAAK,EAAC,gBAAgB,aAC9B,
|
|
1
|
+
{"version":3,"file":"NavigationLayoutTemplate.js","sourceRoot":"","sources":["../src/NavigationLayoutTemplate.tsx"],"names":[],"mappings":";AAEA,MAAM,CAAC,OAAO,UAAU,wBAAwB;IAC/C,OAAO,CACN,eAAK,KAAK,EAAC,aAAa,aACvB,iBAAQ,KAAK,EAAC,eAAe,YAC5B,eAAM,IAAI,EAAC,QAAQ,GAAQ,GACnB,EACT,mBAAS,KAAK,EAAC,gBAAgB,aAC9B,cAAK,KAAK,EAAC,aAAa,YACvB,eAAM,IAAI,EAAC,aAAa,GAAQ,GAC3B,EACN,cAAK,KAAK,EAAC,gBAAgB,YAC1B,gBAAa,GACR,IACG,IACL,CACN,CAAC;AACH,CAAC","sourcesContent":["import type NavigationLayout from \"./NavigationLayout.js\";\n\nexport default function NavigationLayoutTemplate(this: NavigationLayout) {\n\treturn (\n\t\t<div class=\"ui5-nl-root\">\n\t\t\t<header class=\"ui5-nl-header\">\n\t\t\t\t<slot name=\"header\"></slot>\n\t\t\t</header>\n\t\t\t<section class=\"ui5-nl-section\">\n\t\t\t\t<div class=\"ui5-nl-side\">\n\t\t\t\t\t<slot name=\"sideContent\"></slot>\n\t\t\t\t</div>\n\t\t\t\t<div class=\"ui5-nl-content\">\n\t\t\t\t\t<slot></slot>\n\t\t\t\t</div>\n\t\t\t</section>\n\t\t</div>\n\t);\n}\n"]}
|
package/dist/ProductSwitch.d.ts
CHANGED
|
@@ -43,6 +43,21 @@ interface IProductSwitchItem extends HTMLElement, ITabbable {
|
|
|
43
43
|
* @ui5subcomponent ProductSwitchItem
|
|
44
44
|
*/
|
|
45
45
|
declare class ProductSwitch extends UI5Element {
|
|
46
|
+
/**
|
|
47
|
+
* Defines whether the component is in loading state.
|
|
48
|
+
* When set to `true`, the component displays a busy indicator over its content.
|
|
49
|
+
* @default false
|
|
50
|
+
* @public
|
|
51
|
+
* @since 2.29.0
|
|
52
|
+
*/
|
|
53
|
+
loading: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Defines the delay in milliseconds, after which the busy indicator will show up for this component.
|
|
56
|
+
* @default 1000
|
|
57
|
+
* @public
|
|
58
|
+
* @since 2.29.0
|
|
59
|
+
*/
|
|
60
|
+
loadingDelay: number;
|
|
46
61
|
/**
|
|
47
62
|
* Indicates how many columns are displayed.
|
|
48
63
|
* @private
|
|
@@ -59,10 +74,6 @@ declare class ProductSwitch extends UI5Element {
|
|
|
59
74
|
_handleResizeBound: ResizeObserverCallback;
|
|
60
75
|
constructor();
|
|
61
76
|
static i18nBundle: I18nBundle;
|
|
62
|
-
static get ROW_MIN_WIDTH(): {
|
|
63
|
-
ONE_COLUMN: number;
|
|
64
|
-
THREE_COLUMN: number;
|
|
65
|
-
};
|
|
66
77
|
get _ariaLabelText(): string;
|
|
67
78
|
onEnterDOM(): void;
|
|
68
79
|
onExitDOM(): void;
|
package/dist/ProductSwitch.js
CHANGED
|
@@ -47,6 +47,21 @@ import ProductSwitchCss from "./generated/themes/ProductSwitch.css.js";
|
|
|
47
47
|
let ProductSwitch = ProductSwitch_1 = class ProductSwitch extends UI5Element {
|
|
48
48
|
constructor() {
|
|
49
49
|
super();
|
|
50
|
+
/**
|
|
51
|
+
* Defines whether the component is in loading state.
|
|
52
|
+
* When set to `true`, the component displays a busy indicator over its content.
|
|
53
|
+
* @default false
|
|
54
|
+
* @public
|
|
55
|
+
* @since 2.29.0
|
|
56
|
+
*/
|
|
57
|
+
this.loading = false;
|
|
58
|
+
/**
|
|
59
|
+
* Defines the delay in milliseconds, after which the busy indicator will show up for this component.
|
|
60
|
+
* @default 1000
|
|
61
|
+
* @public
|
|
62
|
+
* @since 2.29.0
|
|
63
|
+
*/
|
|
64
|
+
this.loadingDelay = 1000;
|
|
50
65
|
this._currentIndex = 0;
|
|
51
66
|
this._rowSize = 4;
|
|
52
67
|
this._itemNavigation = new ItemNavigation(this, {
|
|
@@ -55,20 +70,14 @@ let ProductSwitch = ProductSwitch_1 = class ProductSwitch extends UI5Element {
|
|
|
55
70
|
});
|
|
56
71
|
this._handleResizeBound = this._handleResize.bind(this);
|
|
57
72
|
}
|
|
58
|
-
static get ROW_MIN_WIDTH() {
|
|
59
|
-
return {
|
|
60
|
-
ONE_COLUMN: 600,
|
|
61
|
-
THREE_COLUMN: 900,
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
73
|
get _ariaLabelText() {
|
|
65
74
|
return ProductSwitch_1.i18nBundle.getText(PRODUCT_SWITCH_CONTAINER_LABEL);
|
|
66
75
|
}
|
|
67
76
|
onEnterDOM() {
|
|
68
|
-
ResizeHandler.register(
|
|
77
|
+
ResizeHandler.register(this, this._handleResizeBound);
|
|
69
78
|
}
|
|
70
79
|
onExitDOM() {
|
|
71
|
-
ResizeHandler.deregister(
|
|
80
|
+
ResizeHandler.deregister(this, this._handleResizeBound);
|
|
72
81
|
}
|
|
73
82
|
onBeforeRendering() {
|
|
74
83
|
if (this.items.length > 6) {
|
|
@@ -82,19 +91,36 @@ let ProductSwitch = ProductSwitch_1 = class ProductSwitch extends UI5Element {
|
|
|
82
91
|
}
|
|
83
92
|
}
|
|
84
93
|
_handleResize() {
|
|
85
|
-
const
|
|
86
|
-
if (
|
|
87
|
-
|
|
94
|
+
const items = this.items;
|
|
95
|
+
if (!items.length) {
|
|
96
|
+
return;
|
|
88
97
|
}
|
|
89
|
-
|
|
90
|
-
|
|
98
|
+
const root = this.shadowRoot?.querySelector(".ui5-product-switch-root");
|
|
99
|
+
if (!root) {
|
|
100
|
+
return;
|
|
91
101
|
}
|
|
92
|
-
|
|
93
|
-
|
|
102
|
+
// Derive the column count from the component's own available width (not the
|
|
103
|
+
// viewport), so the keyboard navigation matches the columns that actually render.
|
|
104
|
+
const firstItemStyle = getComputedStyle(items[0]);
|
|
105
|
+
const itemOuterWidth = items[0].offsetWidth
|
|
106
|
+
+ parseFloat(firstItemStyle.marginLeft)
|
|
107
|
+
+ parseFloat(firstItemStyle.marginRight);
|
|
108
|
+
if (itemOuterWidth <= 0) {
|
|
109
|
+
return;
|
|
94
110
|
}
|
|
95
|
-
|
|
96
|
-
|
|
111
|
+
const rootStyle = getComputedStyle(root);
|
|
112
|
+
const availableWidth = root.clientWidth
|
|
113
|
+
- parseFloat(rootStyle.paddingLeft)
|
|
114
|
+
- parseFloat(rootStyle.paddingRight);
|
|
115
|
+
let maxColumnsByItems = 3;
|
|
116
|
+
if (items.length > 6) {
|
|
117
|
+
maxColumnsByItems = 4;
|
|
118
|
+
}
|
|
119
|
+
else if (items.length <= 2) {
|
|
120
|
+
maxColumnsByItems = 2;
|
|
97
121
|
}
|
|
122
|
+
const columnsByWidth = Math.floor(availableWidth / itemOuterWidth);
|
|
123
|
+
this._setRowSize(Math.max(1, Math.min(columnsByWidth, maxColumnsByItems)));
|
|
98
124
|
}
|
|
99
125
|
handleProductSwitchItemClick(e) {
|
|
100
126
|
this.items.forEach(item => { item.selected = false; });
|
|
@@ -132,6 +158,12 @@ let ProductSwitch = ProductSwitch_1 = class ProductSwitch extends UI5Element {
|
|
|
132
158
|
return this._itemNavigation._getCurrentItem();
|
|
133
159
|
}
|
|
134
160
|
};
|
|
161
|
+
__decorate([
|
|
162
|
+
property({ type: Boolean })
|
|
163
|
+
], ProductSwitch.prototype, "loading", void 0);
|
|
164
|
+
__decorate([
|
|
165
|
+
property({ type: Number })
|
|
166
|
+
], ProductSwitch.prototype, "loadingDelay", void 0);
|
|
135
167
|
__decorate([
|
|
136
168
|
property({ type: Number })
|
|
137
169
|
], ProductSwitch.prototype, "desktopColumns", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,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C;IAED,cAAc;QACb,OAAO,IAAI,CAAC,eAAe,CAAC,eAAe,EAAE,CAAC;IAC/C,CAAC;CACD,CAAA;AAnHA;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qDACH;AAOxB;IADC,IAAI,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,IAAI,EAAE,uBAAuB,EAAE,IAAI,EAAE,CAAC;4CACrC;AAsBhC;IADN,IAAI,CAAC,0BAA0B,CAAC;uCACH;AAnCzB,aAAa;IANlB,aAAa,CAAC;QACd,GAAG,EAAE,oBAAoB;QACzB,QAAQ,EAAE,WAAW;QACrB,MAAM,EAAE,gBAAgB;QACxB,QAAQ,EAAE,qBAAqB;KAC/B,CAAC;GACI,aAAa,CAyHlB;AAED,aAAa,CAAC,MAAM,EAAE,CAAC;AAEvB,eAAe,aAAa,CAAC","sourcesContent":["import type I18nBundle from \"@ui5/webcomponents-base/dist/i18nBundle.js\";\nimport UI5Element from \"@ui5/webcomponents-base/dist/UI5Element.js\";\nimport type { DefaultSlot } from \"@ui5/webcomponents-base/dist/UI5Element.js\";\nimport ItemNavigation from \"@ui5/webcomponents-base/dist/delegate/ItemNavigation.js\";\nimport type { ITabbable } from \"@ui5/webcomponents-base/dist/delegate/ItemNavigation.js\";\nimport property from \"@ui5/webcomponents-base/dist/decorators/property.js\";\nimport slot from \"@ui5/webcomponents-base/dist/decorators/slot-strict.js\";\nimport customElement from \"@ui5/webcomponents-base/dist/decorators/customElement.js\";\nimport i18n from \"@ui5/webcomponents-base/dist/decorators/i18n.js\";\nimport ResizeHandler from \"@ui5/webcomponents-base/dist/delegate/ResizeHandler.js\";\nimport type { ResizeObserverCallback } from \"@ui5/webcomponents-base/dist/delegate/ResizeHandler.js\";\nimport jsxRenderer from \"@ui5/webcomponents-base/dist/renderer/JsxRenderer.js\";\n\nimport {\n\tisDown,\n\tisUp,\n} from \"@ui5/webcomponents-base/dist/Keys.js\";\n\nimport ProductSwitchTemplate from \"./ProductSwitchTemplate.js\";\n\nimport {\n\tPRODUCT_SWITCH_CONTAINER_LABEL,\n} from \"./generated/i18n/i18n-defaults.js\";\n\n// Styles\nimport ProductSwitchCss from \"./generated/themes/ProductSwitch.css.js\";\n\n/**\n * Interface for components that may be slotted inside `ui5-product-switch` as items\n * @public\n */\ninterface IProductSwitchItem extends HTMLElement, ITabbable {\n\ttitleText?: string,\n\tsubtitleText?: string,\n\ticon?: string,\n\ttarget?: string,\n\ttargetSrc?: string,\n\tselected: boolean,\n}\n\n/**\n * @class\n * ### Overview\n *\n * The `ui5-product-switch` is an SAP Fiori specific web component that is used in `ui5-shellbar`\n * and allows the user to easily switch between products.\n *\n * ### Keyboard Handling\n * The `ui5-product-switch` provides advanced keyboard handling.\n * When focused, the user can use the following keyboard\n * shortcuts in order to perform a navigation:\n *\n * - [Tab] - Move focus to the next interactive element after the `ui5-product-switch`\n * - [Up] or [Down] - Navigates up and down the items\n * - [Left] or [Right] - Navigates left and right the items\n *\n * ### ES6 Module Import\n * `import \"@ui5/webcomponents-fiori/dist/ProductSwitch.js\";`\n *\n * `import \"@ui5/webcomponents-fiori/dist/ProductSwitchItem.js\";` (for `ui5-product-switch-item`)\n * @constructor\n * @extends UI5Element\n * @public\n * @since 1.0.0\n * @ui5subcomponent ProductSwitchItem\n */\n@customElement({\n\ttag: \"ui5-product-switch\",\n\trenderer: jsxRenderer,\n\tstyles: ProductSwitchCss,\n\ttemplate: ProductSwitchTemplate,\n})\nclass ProductSwitch extends UI5Element {\n\t/**\n\t * Indicates how many columns are displayed.\n\t * @private\n\t */\n\t@property({ type: Number })\n\tdesktopColumns?: number;\n\n\t/**\n\t * Defines the items of the `ui5-product-switch`.\n\t * @public\n\t */\n\t@slot({ type: HTMLElement, \"default\": true, invalidateOnChildChange: true })\n\titems!: DefaultSlot<IProductSwitchItem>\n\n\t_itemNavigation: ItemNavigation;\n\t_currentIndex: number;\n\t_rowSize: number;\n\t_handleResizeBound: ResizeObserverCallback;\n\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis._currentIndex = 0;\n\t\tthis._rowSize = 4;\n\n\t\tthis._itemNavigation = new ItemNavigation(this, {\n\t\t\trowSize: this._rowSize,\n\t\t\tgetItemsCallback: () => this.items,\n\t\t});\n\n\t\tthis._handleResizeBound = this._handleResize.bind(this);\n\t}\n\n\t@i18n(\"@ui5/webcomponents-fiori\")\n\tstatic i18nBundle: I18nBundle;\n\n\tstatic get ROW_MIN_WIDTH() {\n\t\treturn {\n\t\t\tONE_COLUMN: 600,\n\t\t\tTHREE_COLUMN: 900,\n\t\t};\n\t}\n\n\tget _ariaLabelText() {\n\t\treturn ProductSwitch.i18nBundle.getText(PRODUCT_SWITCH_CONTAINER_LABEL);\n\t}\n\n\tonEnterDOM() {\n\t\tResizeHandler.register(document.body, this._handleResizeBound);\n\t}\n\n\tonExitDOM() {\n\t\tResizeHandler.deregister(document.body, this._handleResizeBound);\n\t}\n\n\tonBeforeRendering() {\n\t\tif (this.items.length > 6) {\n\t\t\tthis.desktopColumns = 4;\n\t\t} else if (this.items.length <= 2) {\n\t\t\tthis.desktopColumns = 2;\n\t\t} else {\n\t\t\tthis.desktopColumns = 3;\n\t\t}\n\t}\n\n\t_handleResize() {\n\t\tconst documentWidth = document.body.clientWidth;\n\n\t\tif (documentWidth <= (this.constructor as typeof ProductSwitch).ROW_MIN_WIDTH.ONE_COLUMN) {\n\t\t\tthis._setRowSize(1);\n\t\t} else if (this.items.length <= 2) {\n\t\t\tthis._setRowSize(2);\n\t\t} else if (documentWidth <= (this.constructor as typeof ProductSwitch).ROW_MIN_WIDTH.THREE_COLUMN || this.items.length <= 6) {\n\t\t\tthis._setRowSize(3);\n\t\t} else {\n\t\t\tthis._setRowSize(4);\n\t\t}\n\t}\n\n\thandleProductSwitchItemClick(e: MouseEvent) {\n\t\tthis.items.forEach(item => { item.selected = false; });\n\t\t(e.target as IProductSwitchItem).selected = true;\n\t}\n\n\t_onfocusin(e: FocusEvent) {\n\t\tconst target = e.target as IProductSwitchItem;\n\n\t\tthis._itemNavigation.setCurrentItem(target);\n\t\tthis._currentIndex = this.items.indexOf(target);\n\t}\n\n\t_setRowSize(size: number) {\n\t\tthis._rowSize = size;\n\t\tthis._itemNavigation.setRowSize(size);\n\t}\n\n\t_onkeydown(e: KeyboardEvent) {\n\t\tif (isDown(e)) {\n\t\t\tthis._handleDown(e);\n\t\t} else if (isUp(e)) {\n\t\t\tthis._handleUp(e);\n\t\t}\n\t}\n\n\t_handleDown(e: KeyboardEvent) {\n\t\tconst itemsLength = this.items.length;\n\t\tif (this._currentIndex + this._rowSize > itemsLength) { // border reached, do nothing\n\t\t\te.stopPropagation();\n\t\t}\n\t}\n\n\t_handleUp(e: KeyboardEvent) {\n\t\tif (this._currentIndex - this._rowSize < 0) { // border reached, do nothing\n\t\t\te.stopPropagation();\n\t\t}\n\t}\n\n\tgetFocusDomRef() {\n\t\treturn this._itemNavigation._getCurrentItem();\n\t}\n}\n\nProductSwitch.define();\n\nexport default ProductSwitch;\n\nexport type {\n\tIProductSwitchItem,\n};\n"]}
|
|
1
|
+
{"version":3,"file":"ProductSwitch.js","sourceRoot":"","sources":["../src/ProductSwitch.ts"],"names":[],"mappings":";;;;;;;AACA,OAAO,UAAU,MAAM,4CAA4C,CAAC;AAEpE,OAAO,cAAc,MAAM,yDAAyD,CAAC;AAErF,OAAO,QAAQ,MAAM,qDAAqD,CAAC;AAC3E,OAAO,IAAI,MAAM,wDAAwD,CAAC;AAC1E,OAAO,aAAa,MAAM,0DAA0D,CAAC;AACrF,OAAO,IAAI,MAAM,iDAAiD,CAAC;AACnE,OAAO,aAAa,MAAM,wDAAwD,CAAC;AAEnF,OAAO,WAAW,MAAM,sDAAsD,CAAC;AAE/E,OAAO,EACN,MAAM,EACN,IAAI,GACJ,MAAM,sCAAsC,CAAC;AAE9C,OAAO,qBAAqB,MAAM,4BAA4B,CAAC;AAE/D,OAAO,EACN,8BAA8B,GAC9B,MAAM,mCAAmC,CAAC;AAE3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C1E,CAAC,CAAC,eAAe,EAAE,CAAC;QACrB,CAAC;IACF,CAAC;IAED,cAAc;QACb,OAAO,IAAI,CAAC,eAAe,CAAC,eAAe,EAAE,CAAC;IAC/C,CAAC;CACD,CAAA;AArJA;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;8CACZ;AAShB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mDACP;AAOpB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qDACH;AAOxB;IADC,IAAI,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,IAAI,EAAE,uBAAuB,EAAE,IAAI,EAAE,CAAC;4CACrC;AAsBhC;IADN,IAAI,CAAC,0BAA0B,CAAC;uCACH;AAtDzB,aAAa;IANlB,aAAa,CAAC;QACd,GAAG,EAAE,oBAAoB;QACzB,QAAQ,EAAE,WAAW;QACrB,MAAM,EAAE,gBAAgB;QACxB,QAAQ,EAAE,qBAAqB;KAC/B,CAAC;GACI,aAAa,CA8JlB;AAED,aAAa,CAAC,MAAM,EAAE,CAAC;AAEvB,eAAe,aAAa,CAAC","sourcesContent":["import type I18nBundle from \"@ui5/webcomponents-base/dist/i18nBundle.js\";\nimport UI5Element from \"@ui5/webcomponents-base/dist/UI5Element.js\";\nimport type { DefaultSlot } from \"@ui5/webcomponents-base/dist/UI5Element.js\";\nimport ItemNavigation from \"@ui5/webcomponents-base/dist/delegate/ItemNavigation.js\";\nimport type { ITabbable } from \"@ui5/webcomponents-base/dist/delegate/ItemNavigation.js\";\nimport property from \"@ui5/webcomponents-base/dist/decorators/property.js\";\nimport slot from \"@ui5/webcomponents-base/dist/decorators/slot-strict.js\";\nimport customElement from \"@ui5/webcomponents-base/dist/decorators/customElement.js\";\nimport i18n from \"@ui5/webcomponents-base/dist/decorators/i18n.js\";\nimport ResizeHandler from \"@ui5/webcomponents-base/dist/delegate/ResizeHandler.js\";\nimport type { ResizeObserverCallback } from \"@ui5/webcomponents-base/dist/delegate/ResizeHandler.js\";\nimport jsxRenderer from \"@ui5/webcomponents-base/dist/renderer/JsxRenderer.js\";\n\nimport {\n\tisDown,\n\tisUp,\n} from \"@ui5/webcomponents-base/dist/Keys.js\";\n\nimport ProductSwitchTemplate from \"./ProductSwitchTemplate.js\";\n\nimport {\n\tPRODUCT_SWITCH_CONTAINER_LABEL,\n} from \"./generated/i18n/i18n-defaults.js\";\n\n// Styles\nimport ProductSwitchCss from \"./generated/themes/ProductSwitch.css.js\";\n\n/**\n * Interface for components that may be slotted inside `ui5-product-switch` as items\n * @public\n */\ninterface IProductSwitchItem extends HTMLElement, ITabbable {\n\ttitleText?: string,\n\tsubtitleText?: string,\n\ticon?: string,\n\ttarget?: string,\n\ttargetSrc?: string,\n\tselected: boolean,\n}\n\n/**\n * @class\n * ### Overview\n *\n * The `ui5-product-switch` is an SAP Fiori specific web component that is used in `ui5-shellbar`\n * and allows the user to easily switch between products.\n *\n * ### Keyboard Handling\n * The `ui5-product-switch` provides advanced keyboard handling.\n * When focused, the user can use the following keyboard\n * shortcuts in order to perform a navigation:\n *\n * - [Tab] - Move focus to the next interactive element after the `ui5-product-switch`\n * - [Up] or [Down] - Navigates up and down the items\n * - [Left] or [Right] - Navigates left and right the items\n *\n * ### ES6 Module Import\n * `import \"@ui5/webcomponents-fiori/dist/ProductSwitch.js\";`\n *\n * `import \"@ui5/webcomponents-fiori/dist/ProductSwitchItem.js\";` (for `ui5-product-switch-item`)\n * @constructor\n * @extends UI5Element\n * @public\n * @since 1.0.0\n * @ui5subcomponent ProductSwitchItem\n */\n@customElement({\n\ttag: \"ui5-product-switch\",\n\trenderer: jsxRenderer,\n\tstyles: ProductSwitchCss,\n\ttemplate: ProductSwitchTemplate,\n})\nclass ProductSwitch extends UI5Element {\n\t/**\n\t * Defines whether the component is in loading state.\n\t * When set to `true`, the component displays a busy indicator over its content.\n\t * @default false\n\t * @public\n\t * @since 2.29.0\n\t */\n\t@property({ type: Boolean })\n\tloading = false;\n\n\t/**\n\t * Defines the delay in milliseconds, after which the busy indicator will show up for this component.\n\t * @default 1000\n\t * @public\n\t * @since 2.29.0\n\t */\n\t@property({ type: Number })\n\tloadingDelay = 1000;\n\n\t/**\n\t * Indicates how many columns are displayed.\n\t * @private\n\t */\n\t@property({ type: Number })\n\tdesktopColumns?: number;\n\n\t/**\n\t * Defines the items of the `ui5-product-switch`.\n\t * @public\n\t */\n\t@slot({ type: HTMLElement, \"default\": true, invalidateOnChildChange: true })\n\titems!: DefaultSlot<IProductSwitchItem>\n\n\t_itemNavigation: ItemNavigation;\n\t_currentIndex: number;\n\t_rowSize: number;\n\t_handleResizeBound: ResizeObserverCallback;\n\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis._currentIndex = 0;\n\t\tthis._rowSize = 4;\n\n\t\tthis._itemNavigation = new ItemNavigation(this, {\n\t\t\trowSize: this._rowSize,\n\t\t\tgetItemsCallback: () => this.items,\n\t\t});\n\n\t\tthis._handleResizeBound = this._handleResize.bind(this);\n\t}\n\n\t@i18n(\"@ui5/webcomponents-fiori\")\n\tstatic i18nBundle: I18nBundle;\n\n\tget _ariaLabelText() {\n\t\treturn ProductSwitch.i18nBundle.getText(PRODUCT_SWITCH_CONTAINER_LABEL);\n\t}\n\n\tonEnterDOM() {\n\t\tResizeHandler.register(this, this._handleResizeBound);\n\t}\n\n\tonExitDOM() {\n\t\tResizeHandler.deregister(this, this._handleResizeBound);\n\t}\n\n\tonBeforeRendering() {\n\t\tif (this.items.length > 6) {\n\t\t\tthis.desktopColumns = 4;\n\t\t} else if (this.items.length <= 2) {\n\t\t\tthis.desktopColumns = 2;\n\t\t} else {\n\t\t\tthis.desktopColumns = 3;\n\t\t}\n\t}\n\n\t_handleResize() {\n\t\tconst items = this.items;\n\t\tif (!items.length) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst root = this.shadowRoot?.querySelector<HTMLElement>(\".ui5-product-switch-root\");\n\t\tif (!root) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Derive the column count from the component's own available width (not the\n\t\t// viewport), so the keyboard navigation matches the columns that actually render.\n\t\tconst firstItemStyle = getComputedStyle(items[0]);\n\t\tconst itemOuterWidth = items[0].offsetWidth\n\t\t\t+ parseFloat(firstItemStyle.marginLeft)\n\t\t\t+ parseFloat(firstItemStyle.marginRight);\n\n\t\tif (itemOuterWidth <= 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst rootStyle = getComputedStyle(root);\n\t\tconst availableWidth = root.clientWidth\n\t\t\t- parseFloat(rootStyle.paddingLeft)\n\t\t\t- parseFloat(rootStyle.paddingRight);\n\n\t\tlet maxColumnsByItems = 3;\n\t\tif (items.length > 6) {\n\t\t\tmaxColumnsByItems = 4;\n\t\t} else if (items.length <= 2) {\n\t\t\tmaxColumnsByItems = 2;\n\t\t}\n\n\t\tconst columnsByWidth = Math.floor(availableWidth / itemOuterWidth);\n\n\t\tthis._setRowSize(Math.max(1, Math.min(columnsByWidth, maxColumnsByItems)));\n\t}\n\n\thandleProductSwitchItemClick(e: MouseEvent) {\n\t\tthis.items.forEach(item => { item.selected = false; });\n\t\t(e.target as IProductSwitchItem).selected = true;\n\t}\n\n\t_onfocusin(e: FocusEvent) {\n\t\tconst target = e.target as IProductSwitchItem;\n\n\t\tthis._itemNavigation.setCurrentItem(target);\n\t\tthis._currentIndex = this.items.indexOf(target);\n\t}\n\n\t_setRowSize(size: number) {\n\t\tthis._rowSize = size;\n\t\tthis._itemNavigation.setRowSize(size);\n\t}\n\n\t_onkeydown(e: KeyboardEvent) {\n\t\tif (isDown(e)) {\n\t\t\tthis._handleDown(e);\n\t\t} else if (isUp(e)) {\n\t\t\tthis._handleUp(e);\n\t\t}\n\t}\n\n\t_handleDown(e: KeyboardEvent) {\n\t\tconst itemsLength = this.items.length;\n\t\tif (this._currentIndex + this._rowSize > itemsLength) { // border reached, do nothing\n\t\t\te.stopPropagation();\n\t\t}\n\t}\n\n\t_handleUp(e: KeyboardEvent) {\n\t\tif (this._currentIndex - this._rowSize < 0) { // border reached, do nothing\n\t\t\te.stopPropagation();\n\t\t}\n\t}\n\n\tgetFocusDomRef() {\n\t\treturn this._itemNavigation._getCurrentItem();\n\t}\n}\n\nProductSwitch.define();\n\nexport default ProductSwitch;\n\nexport type {\n\tIProductSwitchItem,\n};\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "@ui5/webcomponents-base/jsx-runtime";
|
|
2
|
+
import BusyIndicator from "@ui5/webcomponents/dist/BusyIndicator.js";
|
|
2
3
|
export default function ProductSwitchTemplate() {
|
|
3
|
-
return (_jsx("div", { role: "list", class: "ui5-product-switch-root", "aria-label": this._ariaLabelText, onFocusIn: this._onfocusin, onKeyDown: this._onkeydown, onClick: this.handleProductSwitchItemClick, children: _jsx("slot", {}) }));
|
|
4
|
+
return (_jsx(BusyIndicator, { active: this.loading, delay: this.loadingDelay, class: "ui5-product-switch-busy-indicator", children: _jsx("div", { role: "list", class: "ui5-product-switch-root", "aria-label": this._ariaLabelText, onFocusIn: this._onfocusin, onKeyDown: this._onkeydown, onClick: this.handleProductSwitchItemClick, children: _jsx("slot", {}) }) }));
|
|
4
5
|
}
|
|
5
6
|
//# sourceMappingURL=ProductSwitchTemplate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductSwitchTemplate.js","sourceRoot":"","sources":["../src/ProductSwitchTemplate.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"ProductSwitchTemplate.js","sourceRoot":"","sources":["../src/ProductSwitchTemplate.tsx"],"names":[],"mappings":";AAAA,OAAO,aAAa,MAAM,0CAA0C,CAAC;AAGrE,MAAM,CAAC,OAAO,UAAU,qBAAqB;IAC5C,OAAO,CACN,KAAC,aAAa,IACb,MAAM,EAAE,IAAI,CAAC,OAAO,EACpB,KAAK,EAAE,IAAI,CAAC,YAAY,EACxB,KAAK,EAAC,mCAAmC,YAEzC,cACC,IAAI,EAAC,MAAM,EACX,KAAK,EAAC,yBAAyB,gBACnB,IAAI,CAAC,cAAc,EAC/B,SAAS,EAAE,IAAI,CAAC,UAAU,EAC1B,SAAS,EAAE,IAAI,CAAC,UAAU,EAC1B,OAAO,EAAE,IAAI,CAAC,4BAA4B,YAE1C,gBAAa,GACR,GACS,CAChB,CAAC;AACH,CAAC","sourcesContent":["import BusyIndicator from \"@ui5/webcomponents/dist/BusyIndicator.js\";\nimport type ProductSwitch from \"./ProductSwitch.js\";\n\nexport default function ProductSwitchTemplate(this: ProductSwitch) {\n\treturn (\n\t\t<BusyIndicator\n\t\t\tactive={this.loading}\n\t\t\tdelay={this.loadingDelay}\n\t\t\tclass=\"ui5-product-switch-busy-indicator\"\n\t\t>\n\t\t\t<div\n\t\t\t\trole=\"list\"\n\t\t\t\tclass=\"ui5-product-switch-root\"\n\t\t\t\taria-label={this._ariaLabelText}\n\t\t\t\tonFocusIn={this._onfocusin}\n\t\t\t\tonKeyDown={this._onkeydown}\n\t\t\t\tonClick={this.handleProductSwitchItemClick}\n\t\t\t>\n\t\t\t\t<slot></slot>\n\t\t\t</div>\n\t\t</BusyIndicator>\n\t);\n}\n"]}
|
package/dist/Search.d.ts
CHANGED
|
@@ -205,6 +205,13 @@ declare class Search extends SearchField {
|
|
|
205
205
|
_handleClear(): void;
|
|
206
206
|
_popoupHasAnyContent(): boolean;
|
|
207
207
|
_onItemKeydown(e: KeyboardEvent): void;
|
|
208
|
+
/**
|
|
209
|
+
* Returns focus to the active search input. On phone the open picker is a full-screen
|
|
210
|
+
* dialog with its own input (`mobileInput`); the host focus ref sits under the dialog,
|
|
211
|
+
* so focusing the host would lose the focus. Target the dialog input directly in that case.
|
|
212
|
+
* @private
|
|
213
|
+
*/
|
|
214
|
+
_focusSearchInput(): void;
|
|
208
215
|
_onListItemFocusIn(e: FocusEvent): void;
|
|
209
216
|
_onItemClick(e: CustomEvent): void;
|
|
210
217
|
_onItemDelete(e: CustomEvent): void;
|
package/dist/Search.js
CHANGED
|
@@ -10,7 +10,7 @@ import slot from "@ui5/webcomponents-base/dist/decorators/slot-strict.js";
|
|
|
10
10
|
import event from "@ui5/webcomponents-base/dist/decorators/event-strict.js";
|
|
11
11
|
import customElement from "@ui5/webcomponents-base/dist/decorators/customElement.js";
|
|
12
12
|
import { isPhone } from "@ui5/webcomponents-base/dist/Device.js";
|
|
13
|
-
import { isUp, isDown, isEnter, isBackSpace, isDelete, isEscape, isTabNext, isPageUp, isPageDown, isHome, isEnd, } from "@ui5/webcomponents-base/dist/Keys.js";
|
|
13
|
+
import { isUp, isDown, isEnter, isBackSpace, isDelete, isEscape, isTabNext, isTabPrevious, isPageUp, isPageDown, isHome, isEnd, } from "@ui5/webcomponents-base/dist/Keys.js";
|
|
14
14
|
import SearchTemplate from "./SearchTemplate.js";
|
|
15
15
|
import SearchCss from "./generated/themes/Search.css.js";
|
|
16
16
|
import SearchField from "./SearchField.js";
|
|
@@ -264,6 +264,15 @@ let Search = Search_1 = class Search extends SearchField {
|
|
|
264
264
|
this._handleEnter();
|
|
265
265
|
this.blur();
|
|
266
266
|
}
|
|
267
|
+
// ArrowDown moves focus from the mobile dialog input into the suggestions list,
|
|
268
|
+
// mirroring the desktop input (_onkeydown -> _handleDown). Without this the mobile
|
|
269
|
+
// input and the list are not connected by the keyboard and arrow navigation is lost.
|
|
270
|
+
if (isDown(e)) {
|
|
271
|
+
this._handleDown(e);
|
|
272
|
+
}
|
|
273
|
+
if (isEscape(e)) {
|
|
274
|
+
this._handleEscape();
|
|
275
|
+
}
|
|
267
276
|
}
|
|
268
277
|
_handleSearchEvent() {
|
|
269
278
|
this.fireDecoratorEvent("search", { item: this._proposedItem });
|
|
@@ -319,6 +328,12 @@ let Search = Search_1 = class Search extends SearchField {
|
|
|
319
328
|
const isArrowUp = isUp(e);
|
|
320
329
|
const isArrowDown = isDown(e);
|
|
321
330
|
const isTab = isTabNext(e);
|
|
331
|
+
// Shift+Tab leaves the suggestions through the natural back-tab order (e.g. to the
|
|
332
|
+
// Cancel button on phone, or the input), so let the browser handle it - calling
|
|
333
|
+
// preventDefault below would swallow it and the focus would be lost.
|
|
334
|
+
if (isTabPrevious(e)) {
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
322
337
|
e.preventDefault();
|
|
323
338
|
if (isFirstItem && isArrowUp) {
|
|
324
339
|
// Restore original value when navigating back to input
|
|
@@ -327,7 +342,7 @@ let Search = Search_1 = class Search extends SearchField {
|
|
|
327
342
|
this._innerValue = this._valueBeforeArrowNav;
|
|
328
343
|
this._valueBeforeArrowNav = undefined;
|
|
329
344
|
}
|
|
330
|
-
this.
|
|
345
|
+
this._focusSearchInput();
|
|
331
346
|
this._shouldAutocomplete = true;
|
|
332
347
|
}
|
|
333
348
|
if (isEscape(e)) {
|
|
@@ -337,6 +352,20 @@ let Search = Search_1 = class Search extends SearchField {
|
|
|
337
352
|
this._getFooterButton()?.focus();
|
|
338
353
|
}
|
|
339
354
|
}
|
|
355
|
+
/**
|
|
356
|
+
* Returns focus to the active search input. On phone the open picker is a full-screen
|
|
357
|
+
* dialog with its own input (`mobileInput`); the host focus ref sits under the dialog,
|
|
358
|
+
* so focusing the host would lose the focus. Target the dialog input directly in that case.
|
|
359
|
+
* @private
|
|
360
|
+
*/
|
|
361
|
+
_focusSearchInput() {
|
|
362
|
+
if (isPhone() && this.mobileInput) {
|
|
363
|
+
this.mobileInput.focus();
|
|
364
|
+
}
|
|
365
|
+
else {
|
|
366
|
+
this.nativeInput?.focus();
|
|
367
|
+
}
|
|
368
|
+
}
|
|
340
369
|
_onListItemFocusIn(e) {
|
|
341
370
|
// Update input value when an item gets focus during arrow navigation
|
|
342
371
|
if (this._valueBeforeArrowNav === undefined) {
|