@ui5/webcomponents-base 2.0.0-rc.5 → 2.0.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 +39 -0
- package/README.md +1 -4
- package/dist/.tsbuildinfo +1 -1
- package/dist/Boot.js.map +1 -1
- package/dist/CustomElementsRegistry.js.map +1 -1
- package/dist/InitialConfiguration.d.ts +1 -1
- package/dist/InitialConfiguration.js.map +1 -1
- package/dist/ManagedStyles.d.ts +1 -1
- package/dist/ManagedStyles.js.map +1 -1
- package/dist/Render.js.map +1 -1
- package/dist/UI5Element.d.ts +11 -9
- package/dist/UI5Element.js +115 -109
- package/dist/UI5Element.js.map +1 -1
- package/dist/UI5ElementMetadata.d.ts +6 -15
- package/dist/UI5ElementMetadata.js +3 -71
- package/dist/UI5ElementMetadata.js.map +1 -1
- package/dist/asset-registries/Icons.d.ts +1 -1
- package/dist/asset-registries/Icons.js.map +1 -1
- package/dist/connectToComponent.js.map +1 -1
- package/dist/converters/DOMReference.d.ts +5 -0
- package/dist/converters/DOMReference.js +13 -0
- package/dist/converters/DOMReference.js.map +1 -0
- package/dist/custom-elements-internal.json +15 -275
- package/dist/custom-elements.json +15 -269
- package/dist/decorators/property.d.ts +1 -1
- package/dist/decorators/property.js +1 -1
- package/dist/decorators/property.js.map +1 -1
- package/dist/decorators/slot.d.ts +1 -1
- package/dist/decorators/slot.js.map +1 -1
- package/dist/delegate/ItemNavigation.d.ts +1 -1
- package/dist/delegate/ItemNavigation.js.map +1 -1
- package/dist/features/F6Navigation.js +1 -1
- package/dist/features/F6Navigation.js.map +1 -1
- package/dist/features/InputElementsFormSupport.d.ts +1 -1
- package/dist/features/InputElementsFormSupport.js.map +1 -1
- package/dist/features/OpenUI5Enablement.d.ts +1 -1
- package/dist/features/OpenUI5Enablement.js.map +1 -1
- package/dist/features/OpenUI5Support.d.ts +1 -1
- package/dist/features/OpenUI5Support.js +3 -0
- package/dist/features/OpenUI5Support.js.map +1 -1
- package/dist/features/patchPopup.d.ts +1 -0
- package/dist/features/patchPopup.js +11 -0
- package/dist/features/patchPopup.js.map +1 -1
- package/dist/generated/VersionInfo.js +3 -3
- package/dist/generated/VersionInfo.js.map +1 -1
- package/dist/prod/Boot.js +1 -1
- package/dist/prod/Boot.js.map +1 -1
- package/dist/prod/CustomElementsRegistry.js +2 -2
- package/dist/prod/CustomElementsRegistry.js.map +1 -1
- package/dist/prod/InitialConfiguration.js.map +1 -1
- package/dist/prod/ManagedStyles.js +1 -1
- package/dist/prod/ManagedStyles.js.map +1 -1
- package/dist/prod/Render.js +1 -1
- package/dist/prod/Render.js.map +1 -1
- package/dist/prod/UI5Element.js +1 -1
- package/dist/prod/UI5Element.js.map +3 -3
- package/dist/prod/UI5ElementMetadata.js +1 -1
- package/dist/prod/UI5ElementMetadata.js.map +3 -3
- package/dist/prod/asset-registries/Icons.js +1 -1
- package/dist/prod/asset-registries/Icons.js.map +2 -2
- package/dist/prod/connectToComponent.js +1 -1
- package/dist/prod/connectToComponent.js.map +1 -1
- package/dist/prod/converters/DOMReference.js +2 -0
- package/dist/prod/converters/DOMReference.js.map +7 -0
- package/dist/prod/decorators/property.js +1 -1
- package/dist/prod/decorators/property.js.map +2 -2
- package/dist/prod/decorators/slot.js +1 -1
- package/dist/prod/decorators/slot.js.map +1 -1
- package/dist/prod/delegate/ItemNavigation.js.map +1 -1
- package/dist/prod/features/F6Navigation.js +1 -1
- package/dist/prod/features/F6Navigation.js.map +2 -2
- package/dist/prod/features/InputElementsFormSupport.js.map +1 -1
- package/dist/prod/features/OpenUI5Enablement.js.map +1 -1
- package/dist/prod/features/OpenUI5Support.js +1 -1
- package/dist/prod/features/OpenUI5Support.js.map +2 -2
- package/dist/prod/features/patchPopup.js +1 -1
- package/dist/prod/features/patchPopup.js.map +3 -3
- package/dist/prod/generated/VersionInfo.js +1 -1
- package/dist/prod/generated/VersionInfo.js.map +2 -2
- package/dist/prod/renderer/LitRenderer.js +1 -1
- package/dist/prod/renderer/LitRenderer.js.map +2 -2
- package/dist/prod/theming/getConstructableStyle.js +1 -1
- package/dist/prod/theming/getConstructableStyle.js.map +1 -1
- package/dist/prod/theming/getEffectiveStyle.js +1 -1
- package/dist/prod/theming/getEffectiveStyle.js.map +1 -1
- package/dist/prod/util/AriaLabelHelper.js +1 -1
- package/dist/prod/util/AriaLabelHelper.js.map +2 -2
- package/dist/prod/util/TabbableElements.js +1 -1
- package/dist/prod/util/TabbableElements.js.map +3 -3
- package/dist/prod/util/debounce.js +1 -1
- package/dist/prod/util/debounce.js.map +1 -1
- package/dist/prod/util/dragAndDrop/DragRegistry.js +1 -1
- package/dist/prod/util/dragAndDrop/DragRegistry.js.map +2 -2
- package/dist/prod/util/isElementTabbable.js +1 -1
- package/dist/prod/util/isElementTabbable.js.map +3 -3
- package/dist/renderer/LitRenderer.d.ts +1 -1
- package/dist/renderer/LitRenderer.js.map +1 -1
- package/dist/theming/getConstructableStyle.d.ts +1 -1
- package/dist/theming/getConstructableStyle.js.map +1 -1
- package/dist/theming/getEffectiveStyle.js.map +1 -1
- package/dist/util/AriaLabelHelper.d.ts +1 -1
- package/dist/util/AriaLabelHelper.js.map +1 -1
- package/dist/util/TabbableElements.js +3 -10
- package/dist/util/TabbableElements.js.map +1 -1
- package/dist/util/debounce.js.map +1 -1
- package/dist/util/dragAndDrop/DragRegistry.js +0 -2
- package/dist/util/dragAndDrop/DragRegistry.js.map +1 -1
- package/dist/util/getClassCopy.d.ts +5 -2
- package/dist/util/isElementTabbable.js +2 -2
- package/dist/util/isElementTabbable.js.map +1 -1
- package/package.json +3 -3
- package/dist/prod/types/CSSColor.js +0 -2
- package/dist/prod/types/CSSColor.js.map +0 -7
- package/dist/prod/types/CSSSize.js +0 -2
- package/dist/prod/types/CSSSize.js.map +0 -7
- package/dist/prod/types/DOMReference.js +0 -2
- package/dist/prod/types/DOMReference.js.map +0 -7
- package/dist/prod/types/DataType.js +0 -2
- package/dist/prod/types/DataType.js.map +0 -7
- package/dist/prod/types/Float.js +0 -2
- package/dist/prod/types/Float.js.map +0 -7
- package/dist/prod/types/Integer.js +0 -2
- package/dist/prod/types/Integer.js.map +0 -7
- package/dist/types/CSSColor.d.ts +0 -11
- package/dist/types/CSSColor.js +0 -14
- package/dist/types/CSSColor.js.map +0 -1
- package/dist/types/CSSSize.d.ts +0 -11
- package/dist/types/CSSSize.js +0 -14
- package/dist/types/CSSSize.js.map +0 -1
- package/dist/types/DOMReference.d.ts +0 -13
- package/dist/types/DOMReference.js +0 -21
- package/dist/types/DOMReference.js.map +0 -1
- package/dist/types/DataType.d.ts +0 -20
- package/dist/types/DataType.js +0 -39
- package/dist/types/DataType.js.map +0 -1
- package/dist/types/Float.d.ts +0 -14
- package/dist/types/Float.js +0 -18
- package/dist/types/Float.js.map +0 -1
- package/dist/types/Integer.d.ts +0 -14
- package/dist/types/Integer.js +0 -18
- package/dist/types/Integer.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/delegate/ItemNavigation.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n\tisDown,\n\tisUp,\n\tisLeft,\n\tisRight,\n\tisHome,\n\tisEnd,\n\tisPageDown,\n\tisPageUp,\n} from \"../Keys.js\";\nimport getActiveElement from \"../util/getActiveElement.js\";\n\nimport NavigationMode from \"../types/NavigationMode.js\";\nimport ItemNavigationBehavior from \"../types/ItemNavigationBehavior.js\";\n\nimport type UI5Element from \"../UI5Element.js\";\nimport { instanceOfUI5Element } from \"../UI5Element.js\";\n\ninterface ITabbable {\n\tid: string,\n\tforcedTabIndex: string,\n}\n\ntype ItemNavigationOptions = {\n\tcurrentIndex?: number,\n\tnavigationMode?: NavigationMode,\n\trowSize?: number\n\tskipItemsSize?: number,\n\tbehavior?: ItemNavigationBehavior,\n\tgetItemsCallback: () => Array<ITabbable>,\n\taffectedPropertiesNames?: Array<string>,\n};\n\n/**\n * The ItemNavigation class manages the calculations to determine the correct \"tabindex\" for a group of related items inside a root component.\n * Important: ItemNavigation only does the calculations and does not change \"tabindex\" directly, this is a responsibility of the developer.\n *\n * The keys that trigger ItemNavigation are:\n * - Up/down\n * - Left/right\n * - Home/End\n *\n * Usage:\n * 1) Use the \"getItemsCallback\" constructor property to pass a callback to ItemNavigation, which, whenever called, will return the list of items to navigate among.\n *\n * Each item passed to ItemNavigation via \"getItemsCallback\" must be:\n * - A) either a UI5Element with a \"forcedTabIndex\" property\n * - B) or an Object with \"id\" and \"forcedTabIndex\" properties which represents a part of the root component's shadow DOM.\n * The \"id\" must be a valid ID within the shadow root of the component ItemNavigation operates on.\n * This object must not be a DOM object because, as said, ItemNavigation will not set \"tabindex\" on it. It must be a representation of a DOM object only\n * and the developer has the responsibility to update the \"tabindex\" in the component's DOM.\n * - C) a combination of the above\n *\n * Whenever the user navigates with the keyboard, ItemNavigation will modify the \"forcedTabIndex\" properties of the items.\n * It is the items' responsibilities to re-render themselves and apply the correct value of \"tabindex\" (i.e. to map the \"forcedTabIndex\" ItemNavigation set to them to the \"tabindex\" property).\n * If the items of the ItemNavigation are UI5Elements themselves, this can happen naturally since they will be invalidated by their \"forcedTabIndex\" property.\n * If the items are Objects with \"id\" and \"forcedTabIndex\" however, it is the developer's responsibility to apply these and the easiest way is to have the root component invalidated by ItemNavigation.\n * To do so, set the \"affectedPropertiesNames\" constructor property to point to one or more of the root component's properties that need refreshing when \"forcedTabIndex\" is changed deeply.\n *\n * 2) Call the \"setCurrentItem\" method of ItemNavigation whenever you want to change the current item.\n * This is most commonly required if the user for example clicks on an item and thus selects it directly.\n * Pass as the only argument to \"setCurrentItem\" the item that becomes current (must be one of the items, returned by \"getItemsCallback\").\n *\n * @class\n * @public\n */\nclass ItemNavigation {\n\trootWebComponent: UI5Element;\n\n\t_getItems: () => Array<ITabbable>;\n\n\t_currentIndex: number;\n\n\t_rowSize: number;\n\n\t_behavior: ItemNavigationBehavior;\n\n\t_navigationMode: NavigationMode;\n\n\t_affectedPropertiesNames: Array<string>;\n\n\t_skipItemsSize: number | null;\n\n\t_initBound: () => void;\n\n\t/**\n\t *\n\t * @param rootWebComponent the component to operate on (component that slots or contains within its shadow root the items the user navigates among)\n\t * @param {ItemNavigationOptions} options Object with configuration options:\n\t * - currentIndex: the index of the item that will be initially selected (from which navigation will begin)\n\t * - navigationMode (Auto|Horizontal|Vertical): whether the items are displayed horizontally (Horizontal), vertically (Vertical) or as a matrix (Auto) meaning the user can navigate in both directions (up/down and left/right)\n\t * - rowSize: tells how many items per row there are when the items are not rendered as a flat list but rather as a matrix. Relevant for navigationMode=Auto\n\t * \t- skipItemsSize: tells how many items upon PAGE_UP and PAGE_DOWN should be skipped to applying the focus on the next item\n\t * - behavior (Static|Cycling): tells what to do when trying to navigate beyond the first and last items\n\t * Static means that nothing happens if the user tries to navigate beyond the first/last item.\n\t * Cycling means that when the user navigates beyond the last item they go to the first and vice versa.\n\t * - getItemsCallback: function that, when called, returns an array with all items the user can navigate among\n\t * - affectedPropertiesNames: a list of metadata properties on the root component which, upon user navigation, will be reassigned by address thus causing the root component to invalidate\n\t */\n\tconstructor(rootWebComponent: UI5Element, options: ItemNavigationOptions) {\n\t\tif (!rootWebComponent.isUI5Element) {\n\t\t\tthrow new Error(\"The root web component must be a UI5 Element instance\");\n\t\t}\n\n\t\tthis.rootWebComponent = rootWebComponent;\n\t\tthis.rootWebComponent.addEventListener(\"keydown\", this._onkeydown.bind(this));\n\t\tthis._initBound = this._init.bind(this);\n\t\tthis.rootWebComponent.attachComponentStateFinalized(this._initBound);\n\n\t\tif (typeof options.getItemsCallback !== \"function\") {\n\t\t\tthrow new Error(\"getItemsCallback is required\");\n\t\t}\n\n\t\tthis._getItems = options.getItemsCallback;\n\t\tthis._currentIndex = options.currentIndex || 0;\n\t\tthis._rowSize = options.rowSize || 1;\n\t\tthis._behavior = options.behavior || ItemNavigationBehavior.Static;\n\t\tthis._navigationMode = options.navigationMode || NavigationMode.Auto;\n\t\tthis._affectedPropertiesNames = options.affectedPropertiesNames || [];\n\t\tthis._skipItemsSize = options.skipItemsSize || null;\n\t}\n\n\t/**\n\t * Call this method to set a new \"current\" (selected) item in the item navigation\n\t * Note: the item passed to this function must be one of the items, returned by the getItemsCallback function\n\t *\n\t * @public\n\t * @param current the new selected item\n\t */\n\tsetCurrentItem(current: ITabbable): void {\n\t\tconst currentItemIndex = this._getItems().indexOf(current);\n\n\t\tif (currentItemIndex === -1) {\n\t\t\tconsole.warn(`The provided item is not managed by ItemNavigation`, current); // eslint-disable-line\n\t\t\treturn;\n\t\t}\n\n\t\tthis._currentIndex = currentItemIndex;\n\t\tthis._applyTabIndex();\n\t}\n\n\t/**\n\t * Call this method to dynamically change the row size\n\t *\n\t * @public\n\t * @param newRowSize\n\t */\n\tsetRowSize(newRowSize: number): void {\n\t\tthis._rowSize = newRowSize;\n\t}\n\n\t_init() {\n\t\tthis._getItems().forEach((item, idx) => {\n\t\t\titem.forcedTabIndex = (idx === this._currentIndex) ? \"0\" : \"-1\";\n\t\t});\n\t}\n\n\t_onkeydown(event: KeyboardEvent) {\n\t\tif (!this._canNavigate()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst horizontalNavigationOn = this._navigationMode === NavigationMode.Horizontal || this._navigationMode === NavigationMode.Auto;\n\t\tconst verticalNavigationOn = this._navigationMode === NavigationMode.Vertical || this._navigationMode === NavigationMode.Auto;\n\t\tconst isRTL = this.rootWebComponent.effectiveDir === \"rtl\";\n\n\t\tif (isRTL && isLeft(event) && horizontalNavigationOn) {\n\t\t\tthis._handleRight();\n\t\t} else if (isRTL && isRight(event) && horizontalNavigationOn) {\n\t\t\tthis._handleLeft();\n\t\t} else if (isLeft(event) && horizontalNavigationOn) {\n\t\t\tthis._handleLeft();\n\t\t} else if (isRight(event) && horizontalNavigationOn) {\n\t\t\tthis._handleRight();\n\t\t} else if (isUp(event) && verticalNavigationOn) {\n\t\t\tthis._handleUp();\n\t\t} else if (isDown(event) && verticalNavigationOn) {\n\t\t\tthis._handleDown();\n\t\t} else if (isHome(event)) {\n\t\t\tthis._handleHome();\n\t\t} else if (isEnd(event)) {\n\t\t\tthis._handleEnd();\n\t\t} else if (isPageUp(event)) {\n\t\t\tthis._handlePageUp();\n\t\t} else if (isPageDown(event)) {\n\t\t\tthis._handlePageDown();\n\t\t} else {\n\t\t\treturn; // if none of the supported keys is pressed, we don't want to prevent the event or update the item navigation\n\t\t}\n\n\t\tevent.preventDefault();\n\t\tthis._applyTabIndex();\n\t\tthis._focusCurrentItem();\n\t}\n\n\t_handleUp() {\n\t\tconst itemsLength = this._getItems().length;\n\t\tif (this._currentIndex - this._rowSize >= 0) { // no border reached, just decrease the index by a row\n\t\t\tthis._currentIndex -= this._rowSize;\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._behavior === ItemNavigationBehavior.Cyclic) { // if cyclic, go to the **last** item in the **previous** column\n\t\t\tconst firstItemInThisColumnIndex = this._currentIndex % this._rowSize;\n\t\t\tconst firstItemInPreviousColumnIndex = firstItemInThisColumnIndex === 0 ? this._rowSize - 1 : firstItemInThisColumnIndex - 1; // find the first item in the previous column (if the current column is the first column -> move to the last column)\n\t\t\tconst rows = Math.ceil(itemsLength / this._rowSize); // how many rows there are (even if incomplete, f.e. for 14 items and _rowSize=4 -> 4 rows total, although only 2 items on the last row)\n\t\t\tlet lastItemInPreviousColumnIndex = firstItemInPreviousColumnIndex + (rows - 1) * this._rowSize; // multiply rows by columns, and add the column's first item's index\n\t\t\tif (lastItemInPreviousColumnIndex > itemsLength - 1) { // for incomplete rows, use the previous row's last item, as for them the last item is missing\n\t\t\t\tlastItemInPreviousColumnIndex -= this._rowSize;\n\t\t\t}\n\t\t\tthis._currentIndex = lastItemInPreviousColumnIndex;\n\t\t} else { // not cyclic, so just go to the first item\n\t\t\tthis._currentIndex = 0;\n\t\t}\n\t}\n\n\t_handleDown() {\n\t\tconst itemsLength = this._getItems().length;\n\t\tif (this._currentIndex + this._rowSize < itemsLength) { // no border reached, just increase the index by a row\n\t\t\tthis._currentIndex += this._rowSize;\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._behavior === ItemNavigationBehavior.Cyclic) { // if cyclic, go to the **first** item in the **next** column\n\t\t\tconst firstItemInThisColumnIndex = this._currentIndex % this._rowSize; // find the first item in the current column first\n\t\t\tconst firstItemInNextColumnIndex = (firstItemInThisColumnIndex + 1) % this._rowSize; // to get the first item in the next column, just increase the index by 1. The modulo by rows is for the case when we are at the last column\n\t\t\tthis._currentIndex = firstItemInNextColumnIndex;\n\t\t} else { // not cyclic, so just go to the last item\n\t\t\tthis._currentIndex = itemsLength - 1;\n\t\t}\n\t}\n\n\t_handleLeft() {\n\t\tconst itemsLength = this._getItems().length;\n\t\tif (this._currentIndex > 0) {\n\t\t\tthis._currentIndex -= 1;\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._behavior === ItemNavigationBehavior.Cyclic) { // go to the first item in the next column\n\t\t\tthis._currentIndex = itemsLength - 1;\n\t\t}\n\t}\n\n\t_handleRight() {\n\t\tconst itemsLength = this._getItems().length;\n\t\tif (this._currentIndex < itemsLength - 1) {\n\t\t\tthis._currentIndex += 1;\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._behavior === ItemNavigationBehavior.Cyclic) { // go to the first item in the next column\n\t\t\tthis._currentIndex = 0;\n\t\t}\n\t}\n\n\t_handleHome() {\n\t\tconst homeEndRange = this._rowSize > 1 ? this._rowSize : this._getItems().length;\n\t\tthis._currentIndex -= this._currentIndex % homeEndRange;\n\t}\n\n\t_handleEnd() {\n\t\tconst homeEndRange = this._rowSize > 1 ? this._rowSize : this._getItems().length;\n\t\tthis._currentIndex += (homeEndRange - 1 - this._currentIndex % homeEndRange); // eslint-disable-line\n\t}\n\n\t_handlePageUp() {\n\t\tif (this._rowSize > 1) {\n\t\t\t// eslint-disable-next-line\n\t\t\t// TODO: handle page up on matrix (grid) layout - ColorPalette, ProductSwitch.\n\t\t\treturn;\n\t\t}\n\t\tthis._handlePageUpFlat();\n\t}\n\n\t_handlePageDown() {\n\t\tif (this._rowSize > 1) {\n\t\t\t// eslint-disable-next-line\n\t\t\t// TODO: handle page up on matrix (grid) layout - ColorPalette, ProductSwitch.\n\t\t\treturn;\n\t\t}\n\t\tthis._handlePageDownFlat();\n\t}\n\n\t/**\n\t * Handles PAGE_UP in a flat list-like structure, both vertically and horizontally.\n\t */\n\t_handlePageUpFlat() {\n\t\tif (this._skipItemsSize === null) {\n\t\t\t// Move the focus to the very top (as Home).\n\t\t\tthis._currentIndex -= this._currentIndex;\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._currentIndex + 1 > this._skipItemsSize) {\n\t\t\t// When there are more than \"skipItemsSize\" number of items to the top,\n\t\t\t// move the focus up/left with the predefined number.\n\t\t\tthis._currentIndex -= this._skipItemsSize;\n\t\t} else {\n\t\t\t// Otherwise, move the focus to the very top (as Home).\n\t\t\tthis._currentIndex -= this._currentIndex;\n\t\t}\n\t}\n\n\t/**\n\t * Handles PAGE_DOWN in a flat list-like structure, both vertically and horizontally.\n\t */\n\t_handlePageDownFlat() {\n\t\tif (this._skipItemsSize === null) {\n\t\t\t// Move the focus to the very bottom (as End).\n\t\t\tthis._currentIndex = this._getItems().length - 1;\n\t\t\treturn;\n\t\t}\n\n\t\tconst currentToEndRange = this._getItems().length - this._currentIndex - 1;\n\n\t\tif (currentToEndRange > this._skipItemsSize) {\n\t\t\t// When there are more than \"skipItemsSize\" number of items until the bottom,\n\t\t\t// move the focus down/right with the predefined number.\n\t\t\tthis._currentIndex += this._skipItemsSize;\n\t\t} else {\n\t\t\t// Otherwise, move the focus to the very bottom (as End).\n\t\t\tthis._currentIndex = this._getItems().length - 1;\n\t\t}\n\t}\n\n\t_applyTabIndex() {\n\t\tconst items = this._getItems();\n\t\tfor (let i = 0; i < items.length; i++) {\n\t\t\titems[i].forcedTabIndex = i === this._currentIndex ? \"0\" : \"-1\";\n\t\t}\n\n\t\tthis._affectedPropertiesNames.forEach(propName => {\n\t\t\tconst prop = (this.rootWebComponent as Record<string, any>)[propName];\n\t\t\t(this.rootWebComponent as Record<string, any>)[propName] = Array.isArray(prop) ? [...prop] : { ...prop };\n\t\t});\n\t}\n\n\t_focusCurrentItem() {\n\t\tconst currentItem = this._getCurrentItem();\n\t\tif (currentItem) {\n\t\t\tcurrentItem.focus();\n\t\t}\n\t}\n\n\t_canNavigate() {\n\t\tconst currentItem = this._getCurrentItem();\n\t\tconst activeElement = getActiveElement();\n\n\t\treturn currentItem && currentItem === activeElement;\n\t}\n\n\t_getCurrentItem() {\n\t\tconst items = this._getItems();\n\n\t\tif (!items.length) {\n\t\t\treturn;\n\t\t}\n\n\t\t// normalize the index\n\t\twhile (this._currentIndex >= items.length) {\n\t\t\tthis._currentIndex -= this._rowSize;\n\t\t}\n\n\t\tif (this._currentIndex < 0) {\n\t\t\tthis._currentIndex = 0;\n\t\t}\n\n\t\tconst currentItem = items[this._currentIndex];\n\n\t\tif (!currentItem) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (instanceOfUI5Element(currentItem)) {\n\t\t\treturn currentItem.getFocusDomRef();\n\t\t}\n\n\t\tconst currentItemDOMRef = this.rootWebComponent.getDomRef();\n\t\tif (!currentItemDOMRef) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (currentItem.id) {\n\t\t\treturn currentItemDOMRef.querySelector(`[id=\"${currentItem.id}\"]`) as HTMLElement;\n\t\t}\n\t}\n}\n\nexport default ItemNavigation;\n\nexport {\n\tITabbable,\n};\n"],
|
|
4
|
+
"sourcesContent": ["import {\n\tisDown,\n\tisUp,\n\tisLeft,\n\tisRight,\n\tisHome,\n\tisEnd,\n\tisPageDown,\n\tisPageUp,\n} from \"../Keys.js\";\nimport getActiveElement from \"../util/getActiveElement.js\";\n\nimport NavigationMode from \"../types/NavigationMode.js\";\nimport ItemNavigationBehavior from \"../types/ItemNavigationBehavior.js\";\n\nimport type UI5Element from \"../UI5Element.js\";\nimport { instanceOfUI5Element } from \"../UI5Element.js\";\n\ninterface ITabbable {\n\tid: string,\n\tforcedTabIndex?: string,\n}\n\ntype ItemNavigationOptions = {\n\tcurrentIndex?: number,\n\tnavigationMode?: NavigationMode,\n\trowSize?: number\n\tskipItemsSize?: number,\n\tbehavior?: ItemNavigationBehavior,\n\tgetItemsCallback: () => Array<ITabbable>,\n\taffectedPropertiesNames?: Array<string>,\n};\n\n/**\n * The ItemNavigation class manages the calculations to determine the correct \"tabindex\" for a group of related items inside a root component.\n * Important: ItemNavigation only does the calculations and does not change \"tabindex\" directly, this is a responsibility of the developer.\n *\n * The keys that trigger ItemNavigation are:\n * - Up/down\n * - Left/right\n * - Home/End\n *\n * Usage:\n * 1) Use the \"getItemsCallback\" constructor property to pass a callback to ItemNavigation, which, whenever called, will return the list of items to navigate among.\n *\n * Each item passed to ItemNavigation via \"getItemsCallback\" must be:\n * - A) either a UI5Element with a \"forcedTabIndex\" property\n * - B) or an Object with \"id\" and \"forcedTabIndex\" properties which represents a part of the root component's shadow DOM.\n * The \"id\" must be a valid ID within the shadow root of the component ItemNavigation operates on.\n * This object must not be a DOM object because, as said, ItemNavigation will not set \"tabindex\" on it. It must be a representation of a DOM object only\n * and the developer has the responsibility to update the \"tabindex\" in the component's DOM.\n * - C) a combination of the above\n *\n * Whenever the user navigates with the keyboard, ItemNavigation will modify the \"forcedTabIndex\" properties of the items.\n * It is the items' responsibilities to re-render themselves and apply the correct value of \"tabindex\" (i.e. to map the \"forcedTabIndex\" ItemNavigation set to them to the \"tabindex\" property).\n * If the items of the ItemNavigation are UI5Elements themselves, this can happen naturally since they will be invalidated by their \"forcedTabIndex\" property.\n * If the items are Objects with \"id\" and \"forcedTabIndex\" however, it is the developer's responsibility to apply these and the easiest way is to have the root component invalidated by ItemNavigation.\n * To do so, set the \"affectedPropertiesNames\" constructor property to point to one or more of the root component's properties that need refreshing when \"forcedTabIndex\" is changed deeply.\n *\n * 2) Call the \"setCurrentItem\" method of ItemNavigation whenever you want to change the current item.\n * This is most commonly required if the user for example clicks on an item and thus selects it directly.\n * Pass as the only argument to \"setCurrentItem\" the item that becomes current (must be one of the items, returned by \"getItemsCallback\").\n *\n * @class\n * @public\n */\nclass ItemNavigation {\n\trootWebComponent: UI5Element;\n\n\t_getItems: () => Array<ITabbable>;\n\n\t_currentIndex: number;\n\n\t_rowSize: number;\n\n\t_behavior: ItemNavigationBehavior;\n\n\t_navigationMode: NavigationMode;\n\n\t_affectedPropertiesNames: Array<string>;\n\n\t_skipItemsSize: number | null;\n\n\t_initBound: () => void;\n\n\t/**\n\t *\n\t * @param rootWebComponent the component to operate on (component that slots or contains within its shadow root the items the user navigates among)\n\t * @param {ItemNavigationOptions} options Object with configuration options:\n\t * - currentIndex: the index of the item that will be initially selected (from which navigation will begin)\n\t * - navigationMode (Auto|Horizontal|Vertical): whether the items are displayed horizontally (Horizontal), vertically (Vertical) or as a matrix (Auto) meaning the user can navigate in both directions (up/down and left/right)\n\t * - rowSize: tells how many items per row there are when the items are not rendered as a flat list but rather as a matrix. Relevant for navigationMode=Auto\n\t * \t- skipItemsSize: tells how many items upon PAGE_UP and PAGE_DOWN should be skipped to applying the focus on the next item\n\t * - behavior (Static|Cycling): tells what to do when trying to navigate beyond the first and last items\n\t * Static means that nothing happens if the user tries to navigate beyond the first/last item.\n\t * Cycling means that when the user navigates beyond the last item they go to the first and vice versa.\n\t * - getItemsCallback: function that, when called, returns an array with all items the user can navigate among\n\t * - affectedPropertiesNames: a list of metadata properties on the root component which, upon user navigation, will be reassigned by address thus causing the root component to invalidate\n\t */\n\tconstructor(rootWebComponent: UI5Element, options: ItemNavigationOptions) {\n\t\tif (!rootWebComponent.isUI5Element) {\n\t\t\tthrow new Error(\"The root web component must be a UI5 Element instance\");\n\t\t}\n\n\t\tthis.rootWebComponent = rootWebComponent;\n\t\tthis.rootWebComponent.addEventListener(\"keydown\", this._onkeydown.bind(this));\n\t\tthis._initBound = this._init.bind(this);\n\t\tthis.rootWebComponent.attachComponentStateFinalized(this._initBound);\n\n\t\tif (typeof options.getItemsCallback !== \"function\") {\n\t\t\tthrow new Error(\"getItemsCallback is required\");\n\t\t}\n\n\t\tthis._getItems = options.getItemsCallback;\n\t\tthis._currentIndex = options.currentIndex || 0;\n\t\tthis._rowSize = options.rowSize || 1;\n\t\tthis._behavior = options.behavior || ItemNavigationBehavior.Static;\n\t\tthis._navigationMode = options.navigationMode || NavigationMode.Auto;\n\t\tthis._affectedPropertiesNames = options.affectedPropertiesNames || [];\n\t\tthis._skipItemsSize = options.skipItemsSize || null;\n\t}\n\n\t/**\n\t * Call this method to set a new \"current\" (selected) item in the item navigation\n\t * Note: the item passed to this function must be one of the items, returned by the getItemsCallback function\n\t *\n\t * @public\n\t * @param current the new selected item\n\t */\n\tsetCurrentItem(current: ITabbable): void {\n\t\tconst currentItemIndex = this._getItems().indexOf(current);\n\n\t\tif (currentItemIndex === -1) {\n\t\t\tconsole.warn(`The provided item is not managed by ItemNavigation`, current); // eslint-disable-line\n\t\t\treturn;\n\t\t}\n\n\t\tthis._currentIndex = currentItemIndex;\n\t\tthis._applyTabIndex();\n\t}\n\n\t/**\n\t * Call this method to dynamically change the row size\n\t *\n\t * @public\n\t * @param newRowSize\n\t */\n\tsetRowSize(newRowSize: number): void {\n\t\tthis._rowSize = newRowSize;\n\t}\n\n\t_init() {\n\t\tthis._getItems().forEach((item, idx) => {\n\t\t\titem.forcedTabIndex = (idx === this._currentIndex) ? \"0\" : \"-1\";\n\t\t});\n\t}\n\n\t_onkeydown(event: KeyboardEvent) {\n\t\tif (!this._canNavigate()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst horizontalNavigationOn = this._navigationMode === NavigationMode.Horizontal || this._navigationMode === NavigationMode.Auto;\n\t\tconst verticalNavigationOn = this._navigationMode === NavigationMode.Vertical || this._navigationMode === NavigationMode.Auto;\n\t\tconst isRTL = this.rootWebComponent.effectiveDir === \"rtl\";\n\n\t\tif (isRTL && isLeft(event) && horizontalNavigationOn) {\n\t\t\tthis._handleRight();\n\t\t} else if (isRTL && isRight(event) && horizontalNavigationOn) {\n\t\t\tthis._handleLeft();\n\t\t} else if (isLeft(event) && horizontalNavigationOn) {\n\t\t\tthis._handleLeft();\n\t\t} else if (isRight(event) && horizontalNavigationOn) {\n\t\t\tthis._handleRight();\n\t\t} else if (isUp(event) && verticalNavigationOn) {\n\t\t\tthis._handleUp();\n\t\t} else if (isDown(event) && verticalNavigationOn) {\n\t\t\tthis._handleDown();\n\t\t} else if (isHome(event)) {\n\t\t\tthis._handleHome();\n\t\t} else if (isEnd(event)) {\n\t\t\tthis._handleEnd();\n\t\t} else if (isPageUp(event)) {\n\t\t\tthis._handlePageUp();\n\t\t} else if (isPageDown(event)) {\n\t\t\tthis._handlePageDown();\n\t\t} else {\n\t\t\treturn; // if none of the supported keys is pressed, we don't want to prevent the event or update the item navigation\n\t\t}\n\n\t\tevent.preventDefault();\n\t\tthis._applyTabIndex();\n\t\tthis._focusCurrentItem();\n\t}\n\n\t_handleUp() {\n\t\tconst itemsLength = this._getItems().length;\n\t\tif (this._currentIndex - this._rowSize >= 0) { // no border reached, just decrease the index by a row\n\t\t\tthis._currentIndex -= this._rowSize;\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._behavior === ItemNavigationBehavior.Cyclic) { // if cyclic, go to the **last** item in the **previous** column\n\t\t\tconst firstItemInThisColumnIndex = this._currentIndex % this._rowSize;\n\t\t\tconst firstItemInPreviousColumnIndex = firstItemInThisColumnIndex === 0 ? this._rowSize - 1 : firstItemInThisColumnIndex - 1; // find the first item in the previous column (if the current column is the first column -> move to the last column)\n\t\t\tconst rows = Math.ceil(itemsLength / this._rowSize); // how many rows there are (even if incomplete, f.e. for 14 items and _rowSize=4 -> 4 rows total, although only 2 items on the last row)\n\t\t\tlet lastItemInPreviousColumnIndex = firstItemInPreviousColumnIndex + (rows - 1) * this._rowSize; // multiply rows by columns, and add the column's first item's index\n\t\t\tif (lastItemInPreviousColumnIndex > itemsLength - 1) { // for incomplete rows, use the previous row's last item, as for them the last item is missing\n\t\t\t\tlastItemInPreviousColumnIndex -= this._rowSize;\n\t\t\t}\n\t\t\tthis._currentIndex = lastItemInPreviousColumnIndex;\n\t\t} else { // not cyclic, so just go to the first item\n\t\t\tthis._currentIndex = 0;\n\t\t}\n\t}\n\n\t_handleDown() {\n\t\tconst itemsLength = this._getItems().length;\n\t\tif (this._currentIndex + this._rowSize < itemsLength) { // no border reached, just increase the index by a row\n\t\t\tthis._currentIndex += this._rowSize;\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._behavior === ItemNavigationBehavior.Cyclic) { // if cyclic, go to the **first** item in the **next** column\n\t\t\tconst firstItemInThisColumnIndex = this._currentIndex % this._rowSize; // find the first item in the current column first\n\t\t\tconst firstItemInNextColumnIndex = (firstItemInThisColumnIndex + 1) % this._rowSize; // to get the first item in the next column, just increase the index by 1. The modulo by rows is for the case when we are at the last column\n\t\t\tthis._currentIndex = firstItemInNextColumnIndex;\n\t\t} else { // not cyclic, so just go to the last item\n\t\t\tthis._currentIndex = itemsLength - 1;\n\t\t}\n\t}\n\n\t_handleLeft() {\n\t\tconst itemsLength = this._getItems().length;\n\t\tif (this._currentIndex > 0) {\n\t\t\tthis._currentIndex -= 1;\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._behavior === ItemNavigationBehavior.Cyclic) { // go to the first item in the next column\n\t\t\tthis._currentIndex = itemsLength - 1;\n\t\t}\n\t}\n\n\t_handleRight() {\n\t\tconst itemsLength = this._getItems().length;\n\t\tif (this._currentIndex < itemsLength - 1) {\n\t\t\tthis._currentIndex += 1;\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._behavior === ItemNavigationBehavior.Cyclic) { // go to the first item in the next column\n\t\t\tthis._currentIndex = 0;\n\t\t}\n\t}\n\n\t_handleHome() {\n\t\tconst homeEndRange = this._rowSize > 1 ? this._rowSize : this._getItems().length;\n\t\tthis._currentIndex -= this._currentIndex % homeEndRange;\n\t}\n\n\t_handleEnd() {\n\t\tconst homeEndRange = this._rowSize > 1 ? this._rowSize : this._getItems().length;\n\t\tthis._currentIndex += (homeEndRange - 1 - this._currentIndex % homeEndRange); // eslint-disable-line\n\t}\n\n\t_handlePageUp() {\n\t\tif (this._rowSize > 1) {\n\t\t\t// eslint-disable-next-line\n\t\t\t// TODO: handle page up on matrix (grid) layout - ColorPalette, ProductSwitch.\n\t\t\treturn;\n\t\t}\n\t\tthis._handlePageUpFlat();\n\t}\n\n\t_handlePageDown() {\n\t\tif (this._rowSize > 1) {\n\t\t\t// eslint-disable-next-line\n\t\t\t// TODO: handle page up on matrix (grid) layout - ColorPalette, ProductSwitch.\n\t\t\treturn;\n\t\t}\n\t\tthis._handlePageDownFlat();\n\t}\n\n\t/**\n\t * Handles PAGE_UP in a flat list-like structure, both vertically and horizontally.\n\t */\n\t_handlePageUpFlat() {\n\t\tif (this._skipItemsSize === null) {\n\t\t\t// Move the focus to the very top (as Home).\n\t\t\tthis._currentIndex -= this._currentIndex;\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._currentIndex + 1 > this._skipItemsSize) {\n\t\t\t// When there are more than \"skipItemsSize\" number of items to the top,\n\t\t\t// move the focus up/left with the predefined number.\n\t\t\tthis._currentIndex -= this._skipItemsSize;\n\t\t} else {\n\t\t\t// Otherwise, move the focus to the very top (as Home).\n\t\t\tthis._currentIndex -= this._currentIndex;\n\t\t}\n\t}\n\n\t/**\n\t * Handles PAGE_DOWN in a flat list-like structure, both vertically and horizontally.\n\t */\n\t_handlePageDownFlat() {\n\t\tif (this._skipItemsSize === null) {\n\t\t\t// Move the focus to the very bottom (as End).\n\t\t\tthis._currentIndex = this._getItems().length - 1;\n\t\t\treturn;\n\t\t}\n\n\t\tconst currentToEndRange = this._getItems().length - this._currentIndex - 1;\n\n\t\tif (currentToEndRange > this._skipItemsSize) {\n\t\t\t// When there are more than \"skipItemsSize\" number of items until the bottom,\n\t\t\t// move the focus down/right with the predefined number.\n\t\t\tthis._currentIndex += this._skipItemsSize;\n\t\t} else {\n\t\t\t// Otherwise, move the focus to the very bottom (as End).\n\t\t\tthis._currentIndex = this._getItems().length - 1;\n\t\t}\n\t}\n\n\t_applyTabIndex() {\n\t\tconst items = this._getItems();\n\t\tfor (let i = 0; i < items.length; i++) {\n\t\t\titems[i].forcedTabIndex = i === this._currentIndex ? \"0\" : \"-1\";\n\t\t}\n\n\t\tthis._affectedPropertiesNames.forEach(propName => {\n\t\t\tconst prop = (this.rootWebComponent as Record<string, any>)[propName];\n\t\t\t(this.rootWebComponent as Record<string, any>)[propName] = Array.isArray(prop) ? [...prop] : { ...prop };\n\t\t});\n\t}\n\n\t_focusCurrentItem() {\n\t\tconst currentItem = this._getCurrentItem();\n\t\tif (currentItem) {\n\t\t\tcurrentItem.focus();\n\t\t}\n\t}\n\n\t_canNavigate() {\n\t\tconst currentItem = this._getCurrentItem();\n\t\tconst activeElement = getActiveElement();\n\n\t\treturn currentItem && currentItem === activeElement;\n\t}\n\n\t_getCurrentItem() {\n\t\tconst items = this._getItems();\n\n\t\tif (!items.length) {\n\t\t\treturn;\n\t\t}\n\n\t\t// normalize the index\n\t\twhile (this._currentIndex >= items.length) {\n\t\t\tthis._currentIndex -= this._rowSize;\n\t\t}\n\n\t\tif (this._currentIndex < 0) {\n\t\t\tthis._currentIndex = 0;\n\t\t}\n\n\t\tconst currentItem = items[this._currentIndex];\n\n\t\tif (!currentItem) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (instanceOfUI5Element(currentItem)) {\n\t\t\treturn currentItem.getFocusDomRef();\n\t\t}\n\n\t\tconst currentItemDOMRef = this.rootWebComponent.getDomRef();\n\t\tif (!currentItemDOMRef) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (currentItem.id) {\n\t\t\treturn currentItemDOMRef.querySelector(`[id=\"${currentItem.id}\"]`) as HTMLElement;\n\t\t}\n\t}\n}\n\nexport default ItemNavigation;\n\nexport {\n\tITabbable,\n};\n"],
|
|
5
5
|
"mappings": "aAAA,OACC,UAAAA,EACA,QAAAC,EACA,UAAAC,EACA,WAAAC,EACA,UAAAC,EACA,SAAAC,EACA,cAAAC,EACA,YA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UAAU,EAAE,OAAS,CAEjD,CAEA,gBAAiB,CAChB,MAAMC,EAAQ,KAAK,UAAU,EAC7B,QAASC,EAAI,EAAGA,EAAID,EAAM,OAAQC,IACjCD,EAAMC,CAAC,EAAE,eAAiBA,IAAM,KAAK,cAAgB,IAAM,KAG5D,KAAK,yBAAyB,QAAQC,GAAY,CACjD,MAAMC,EAAQ,KAAK,iBAAyCD,CAAQ,EACnE,KAAK,iBAAyCA,CAAQ,EAAI,MAAM,QAAQC,CAAI,EAAI,CAAC,GAAGA,CAAI,EAAI,CAAE,GAAGA,CAAK,CACxG,CAAC,CACF,CAEA,mBAAoB,CACnB,MAAMC,EAAc,KAAK,gBAAgB,EACrCA,GACHA,EAAY,MAAM,CAEpB,CAEA,cAAe,CACd,MAAMA,EAAc,KAAK,gBAAgB,EACnCC,EAAgB5B,EAAiB,EAEvC,OAAO2B,GAAeA,IAAgBC,CACvC,CAEA,iBAAkB,CACjB,MAAML,EAAQ,KAAK,UAAU,EAE7B,GAAI,CAACA,EAAM,OACV,OAID,KAAO,KAAK,eAAiBA,EAAM,QAClC,KAAK,eAAiB,KAAK,SAGxB,KAAK,cAAgB,IACxB,KAAK,cAAgB,GAGtB,MAAMI,EAAcJ,EAAM,KAAK,aAAa,EAE5C,GAAI,CAACI,EACJ,OAGD,GAAIxB,EAAqBwB,CAAW,EACnC,OAAOA,EAAY,eAAe,EAGnC,MAAME,EAAoB,KAAK,iBAAiB,UAAU,EAC1D,GAAKA,GAIDF,EAAY,GACf,OAAOE,EAAkB,cAAc,QAAQF,EAAY,EAAE,IAAI,CAEnE,CACD,CAEA,eAAevB,EAEf",
|
|
6
6
|
"names": ["isDown", "isUp", "isLeft", "isRight", "isHome", "isEnd", "isPageDown", "isPageUp", "getActiveElement", "NavigationMode", "ItemNavigationBehavior", "instanceOfUI5Element", "ItemNavigation", "rootWebComponent", "options", "current", "currentItemIndex", "newRowSize", "item", "idx", "event", "horizontalNavigationOn", "verticalNavigationOn", "isRTL", "itemsLength", "firstItemInThisColumnIndex", "firstItemInPreviousColumnIndex", "rows", "lastItemInPreviousColumnIndex", "firstItemInNextColumnIndex", "homeEndRange", "items", "i", "propName", "prop", "currentItem", "activeElement", "currentItemDOMRef"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";import{registerFeature as a}from"../FeaturesRegistry.js";import{isF6Next as r,isF6Previous as l}from"../Keys.js";import{instanceOfUI5Element as u}from"../UI5Element.js";import{getFirstFocusableElement as h}from"../util/FocusableElements.js";import m from"../util/getFastNavigationGroups.js";import p from"../util/isElementClickable.js";class n{constructor(){this.selectedGroup=null;this.groups=[];this.keydownHandler=this._keydownHandler.bind(this),this.attachEventListeners()}attachEventListeners(){document.addEventListener("keydown",this.keydownHandler)}async groupElementToFocus(e){const
|
|
1
|
+
"use strict";import{registerFeature as a}from"../FeaturesRegistry.js";import{isF6Next as r,isF6Previous as l}from"../Keys.js";import{instanceOfUI5Element as u}from"../UI5Element.js";import{getFirstFocusableElement as h}from"../util/FocusableElements.js";import m from"../util/getFastNavigationGroups.js";import p from"../util/isElementClickable.js";class n{constructor(){this.selectedGroup=null;this.groups=[];this.keydownHandler=this._keydownHandler.bind(this),this.attachEventListeners()}attachEventListeners(){document.addEventListener("keydown",this.keydownHandler)}async groupElementToFocus(e){const o=u(e)?e.getDomRef():e;if(o){if(p(o))return o;const t=await h(o);if(t)return t}}async findNextFocusableGroupElement(e){let o;for(let t=0;t<this.groups.length;t++){let s;if(e>-1?e+1>=this.groups.length?(e=0,s=this.groups[e]):(e+=1,s=this.groups[e]):(e=0,s=this.groups[e]),o=await this.groupElementToFocus(s),o)break}return o}async findPreviousFocusableGroupElement(e){let o;for(let t=0;t<this.groups.length;t++){let s;if(e>0?(e=await this.groupElementToFocus(this.groups[e-1])===await this.groupElementToFocus(this.groups[e])?e-2:e-1,e<0&&(e=this.groups.length-1),s=this.groups[e]):(e=this.groups.length-1,s=this.groups[e]),o=await this.groupElementToFocus(s),o)break}return o}async _keydownHandler(e){const o=r(e),t=l(e);if(!(o||t)||(this.updateGroups(),this.groups.length<1))return;e.preventDefault();let s;if(this.groups.length===0)return s=await this.groupElementToFocus(this.groups[0]),s?.focus();let i=-1;this.selectedGroup&&(i=this.groups.indexOf(this.selectedGroup)),o&&(s=await this.findNextFocusableGroupElement(i)),t&&(s=await this.findPreviousFocusableGroupElement(i)),s?.focus()}removeEventListeners(){document.removeEventListener("keydown",this.keydownHandler)}updateGroups(){this.setSelectedGroup(),this.groups=m(document.body)}setSelectedGroup(e=window.document){const o=window.document.querySelector("html");let t=this.deepActive(e);for(;t&&t.getAttribute("data-sap-ui-fastnavgroup")!=="true"&&t!==o;)t=t.parentElement?t.parentNode:t.parentNode.host;this.selectedGroup=t}deepActive(e){return e?.activeElement?.shadowRoot?.activeElement?this.deepActive(e.activeElement.shadowRoot):e.activeElement}destroy(){this.removeEventListeners()}static init(){return this._instance||(this._instance=new n),this._instance}}a("F6Navigation",n);export default n;
|
|
2
2
|
//# sourceMappingURL=F6Navigation.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/features/F6Navigation.ts"],
|
|
4
|
-
"sourcesContent": ["import { registerFeature } from \"../FeaturesRegistry.js\";\nimport { isF6Next, isF6Previous } from \"../Keys.js\";\nimport { instanceOfUI5Element } from \"../UI5Element.js\";\nimport { getFirstFocusableElement } from \"../util/FocusableElements.js\";\nimport getFastNavigationGroups from \"../util/getFastNavigationGroups.js\";\nimport isElementClickable from \"../util/isElementClickable.js\";\n\nclass F6Navigation {\n\tstatic _instance: F6Navigation;\n\tkeydownHandler: (event: KeyboardEvent) => void;\n\tselectedGroup: HTMLElement | null = null;\n\tgroups: Array<HTMLElement> = [];\n\n\tconstructor() {\n\t\tthis.keydownHandler = this._keydownHandler.bind(this) as (event: KeyboardEvent) => void;\n\t\tthis.attachEventListeners();\n\t}\n\n\tattachEventListeners() {\n\t\tdocument.addEventListener(\"keydown\", this.keydownHandler);\n\t}\n\n\tasync groupElementToFocus(nextElement: HTMLElement) {\n\t\tconst nextElementDomRef = instanceOfUI5Element(nextElement) ? nextElement.getDomRef() : nextElement;\n\n\t\tif (nextElementDomRef) {\n\t\t\tif (isElementClickable(nextElementDomRef)) {\n\t\t\t\treturn nextElementDomRef;\n\t\t\t}\n\n\t\t\tconst elementToFocus = await getFirstFocusableElement(nextElementDomRef);\n\n\t\t\tif (elementToFocus) {\n\t\t\t\treturn elementToFocus;\n\t\t\t}\n\t\t}\n\t}\n\n\tasync findNextFocusableGroupElement(currentIndex: number) {\n\t\tlet elementToFocus;\n\n\t\t/* eslint-disable no-await-in-loop */\n\t\tfor (let index = 0; index < this.groups.length; index++) {\n\t\t\tlet nextElement;\n\n\t\t\tif (currentIndex > -1) {\n\t\t\t\tif (currentIndex + 1 >= this.groups.length) {\n\t\t\t\t\tcurrentIndex = 0;\n\t\t\t\t\tnextElement = this.groups[currentIndex];\n\t\t\t\t} else {\n\t\t\t\t\tcurrentIndex += 1;\n\t\t\t\t\tnextElement = this.groups[currentIndex];\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tcurrentIndex = 0;\n\t\t\t\tnextElement = this.groups[currentIndex];\n\t\t\t}\n\n\t\t\telementToFocus = await this.groupElementToFocus(nextElement);\n\n\t\t\tif (elementToFocus) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t/* eslint-enable no-await-in-loop */\n\n\t\treturn elementToFocus;\n\t}\n\n\tasync findPreviousFocusableGroupElement(currentIndex: number) {\n\t\tlet elementToFocus;\n\n\t\t/* eslint-disable no-await-in-loop */\n\t\tfor (let index = 0; index < this.groups.length; index++) {\n\t\t\tlet nextElement;\n\n\t\t\tif (currentIndex > 0) {\n\t\t\t\t// Handle the situation where the first focusable element of two neighbor groups is the same\n\t\t\t\t// For example:\n\t\t\t\t// <ui5-flexible-column-layout>\n\t\t\t\t// <ui5-list>\n\t\t\t\t// <ui5-li>List Item</ui5-li>\n\t\t\t\t// </ui5-list>\n\t\t\t\t// </ui5-flexible-column-layout>\n\t\t\t\t// Here for both FCL & List the firstFoccusableElement is the same (the ui5-li)\n\t\t\t\tconst firstFocusable = await this.groupElementToFocus(this.groups[currentIndex - 1]);\n\t\t\t\tconst shouldSkipParent = firstFocusable === await this.groupElementToFocus(this.groups[currentIndex]);\n\n\t\t\t\tcurrentIndex = shouldSkipParent ? currentIndex - 2 : currentIndex - 1;\n\n\t\t\t\tif (currentIndex < 0) {\n\t\t\t\t\tcurrentIndex = this.groups.length - 1;\n\t\t\t\t}\n\n\t\t\t\tnextElement = this.groups[currentIndex];\n\t\t\t} else {\n\t\t\t\tcurrentIndex = this.groups.length - 1;\n\t\t\t\tnextElement = this.groups[currentIndex];\n\t\t\t}\n\n\t\t\telementToFocus = await this.groupElementToFocus(nextElement);\n\n\t\t\tif (elementToFocus) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t/* eslint-enable no-await-in-loop */\n\n\t\treturn elementToFocus;\n\t}\n\n\tasync _keydownHandler(event: KeyboardEvent) {\n\t\tconst forward = isF6Next(event);\n\t\tconst backward = isF6Previous(event);\n\t\tif (!(forward || backward)) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.updateGroups();\n\n\t\tif (this.groups.length < 1) {\n\t\t\treturn;\n\t\t}\n\n\t\tevent.preventDefault();\n\n\t\tlet elementToFocus;\n\n\t\tif (this.groups.length === 0) {\n\t\t\telementToFocus = await this.groupElementToFocus(this.groups[0]);\n\n\t\t\treturn elementToFocus?.focus();\n\t\t}\n\n\t\tlet currentIndex = -1;\n\n\t\tif (this.selectedGroup) {\n\t\t\tcurrentIndex = this.groups.indexOf(this.selectedGroup);\n\t\t}\n\n\t\tif (forward) {\n\t\t\telementToFocus = await this.findNextFocusableGroupElement(currentIndex);\n\t\t}\n\n\t\tif (backward) {\n\t\t\telementToFocus = await this.findPreviousFocusableGroupElement(currentIndex);\n\t\t}\n\n\t\telementToFocus?.focus();\n\t}\n\n\tremoveEventListeners() {\n\t\tdocument.removeEventListener(\"keydown\", this.keydownHandler);\n\t}\n\n\tupdateGroups() {\n\t\tthis.setSelectedGroup();\n\t\tthis.groups = getFastNavigationGroups(document.body);\n\t}\n\n\tsetSelectedGroup(root: DocumentOrShadowRoot = window.document) {\n\t\tconst htmlElement = window.document.querySelector(\"html\");\n\t\tlet element: Element | null | ParentNode = this.deepActive(root);\n\n\t\twhile (element && (element as Element).getAttribute(\"data-sap-ui-fastnavgroup\") !== \"true\" && element !== htmlElement) {\n\t\t\telement = element.parentElement ? element.parentNode : (element.parentNode as ShadowRoot).host;\n\t\t}\n\n\t\tthis.selectedGroup = element as HTMLElement;\n\t}\n\n\tdeepActive(root: DocumentOrShadowRoot): Element | null {\n\t\tif (root
|
|
5
|
-
"mappings": "aAAA,OAAS,mBAAAA,MAAuB,yBAChC,OAAS,YAAAC,EAAU,gBAAAC,MAAoB,aACvC,OAAS,wBAAAC,MAA4B,mBACrC,OAAS,4BAAAC,MAAgC,+BACzC,OAAOC,MAA6B,qCACpC,OAAOC,MAAwB,gCAE/B,MAAMC,CAAa,CAMlB,aAAc,CAHd,mBAAoC,KACpC,YAA6B,CAAC,EAG7B,KAAK,eAAiB,KAAK,gBAAgB,KAAK,IAAI,EACpD,KAAK,qBAAqB,CAC3B,CAEA,sBAAuB,CACtB,SAAS,iBAAiB,UAAW,KAAK,cAAc,CACzD,CAEA,MAAM,oBAAoBC,EAA0B,CACnD,MAAMC,EAAoBN,EAAqBK,CAAW,EAAIA,EAAY,UAAU,EAAIA,EAExF,GAAIC,EAAmB,CACtB,GAAIH,EAAmBG,CAAiB,EACvC,OAAOA,EAGR,MAAMC,EAAiB,MAAMN,EAAyBK,CAAiB,EAEvE,GAAIC,EACH,OAAOA,CAET,CACD,CAEA,MAAM,8BAA8BC,EAAsB,CACzD,IAAID,EAGJ,QAASE,EAAQ,EAAGA,EAAQ,KAAK,OAAO,OAAQA,IAAS,CACxD,IAAIJ,EAiBJ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L,EAAiB,MAAM,KAAK,kCAAkCC,CAAY,GAG3ED,GAAgB,MAAM,CACvB,CAEA,sBAAuB,CACtB,SAAS,oBAAoB,UAAW,KAAK,cAAc,CAC5D,CAEA,cAAe,CACd,KAAK,iBAAiB,EACtB,KAAK,OAASL,EAAwB,SAAS,IAAI,CACpD,CAEA,iBAAiBW,EAA6B,OAAO,SAAU,CAC9D,MAAMC,EAAc,OAAO,SAAS,cAAc,MAAM,EACxD,IAAIC,EAAuC,KAAK,WAAWF,CAAI,EAE/D,KAAOE,GAAYA,EAAoB,aAAa,0BAA0B,IAAM,QAAUA,IAAYD,GACzGC,EAAUA,EAAQ,cAAgBA,EAAQ,WAAcA,EAAQ,WAA0B,KAG3F,KAAK,cAAgBA,CACtB,CAEA,WAAWF,EAA4C,CACtD,OAAIA,
|
|
4
|
+
"sourcesContent": ["import { registerFeature } from \"../FeaturesRegistry.js\";\nimport { isF6Next, isF6Previous } from \"../Keys.js\";\nimport { instanceOfUI5Element } from \"../UI5Element.js\";\nimport { getFirstFocusableElement } from \"../util/FocusableElements.js\";\nimport getFastNavigationGroups from \"../util/getFastNavigationGroups.js\";\nimport isElementClickable from \"../util/isElementClickable.js\";\n\nclass F6Navigation {\n\tstatic _instance: F6Navigation;\n\tkeydownHandler: (event: KeyboardEvent) => void;\n\tselectedGroup: HTMLElement | null = null;\n\tgroups: Array<HTMLElement> = [];\n\n\tconstructor() {\n\t\tthis.keydownHandler = this._keydownHandler.bind(this) as (event: KeyboardEvent) => void;\n\t\tthis.attachEventListeners();\n\t}\n\n\tattachEventListeners() {\n\t\tdocument.addEventListener(\"keydown\", this.keydownHandler);\n\t}\n\n\tasync groupElementToFocus(nextElement: HTMLElement) {\n\t\tconst nextElementDomRef = instanceOfUI5Element(nextElement) ? nextElement.getDomRef() : nextElement;\n\n\t\tif (nextElementDomRef) {\n\t\t\tif (isElementClickable(nextElementDomRef)) {\n\t\t\t\treturn nextElementDomRef;\n\t\t\t}\n\n\t\t\tconst elementToFocus = await getFirstFocusableElement(nextElementDomRef);\n\n\t\t\tif (elementToFocus) {\n\t\t\t\treturn elementToFocus;\n\t\t\t}\n\t\t}\n\t}\n\n\tasync findNextFocusableGroupElement(currentIndex: number) {\n\t\tlet elementToFocus;\n\n\t\t/* eslint-disable no-await-in-loop */\n\t\tfor (let index = 0; index < this.groups.length; index++) {\n\t\t\tlet nextElement;\n\n\t\t\tif (currentIndex > -1) {\n\t\t\t\tif (currentIndex + 1 >= this.groups.length) {\n\t\t\t\t\tcurrentIndex = 0;\n\t\t\t\t\tnextElement = this.groups[currentIndex];\n\t\t\t\t} else {\n\t\t\t\t\tcurrentIndex += 1;\n\t\t\t\t\tnextElement = this.groups[currentIndex];\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tcurrentIndex = 0;\n\t\t\t\tnextElement = this.groups[currentIndex];\n\t\t\t}\n\n\t\t\telementToFocus = await this.groupElementToFocus(nextElement);\n\n\t\t\tif (elementToFocus) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t/* eslint-enable no-await-in-loop */\n\n\t\treturn elementToFocus;\n\t}\n\n\tasync findPreviousFocusableGroupElement(currentIndex: number) {\n\t\tlet elementToFocus;\n\n\t\t/* eslint-disable no-await-in-loop */\n\t\tfor (let index = 0; index < this.groups.length; index++) {\n\t\t\tlet nextElement;\n\n\t\t\tif (currentIndex > 0) {\n\t\t\t\t// Handle the situation where the first focusable element of two neighbor groups is the same\n\t\t\t\t// For example:\n\t\t\t\t// <ui5-flexible-column-layout>\n\t\t\t\t// <ui5-list>\n\t\t\t\t// <ui5-li>List Item</ui5-li>\n\t\t\t\t// </ui5-list>\n\t\t\t\t// </ui5-flexible-column-layout>\n\t\t\t\t// Here for both FCL & List the firstFoccusableElement is the same (the ui5-li)\n\t\t\t\tconst firstFocusable = await this.groupElementToFocus(this.groups[currentIndex - 1]);\n\t\t\t\tconst shouldSkipParent = firstFocusable === await this.groupElementToFocus(this.groups[currentIndex]);\n\n\t\t\t\tcurrentIndex = shouldSkipParent ? currentIndex - 2 : currentIndex - 1;\n\n\t\t\t\tif (currentIndex < 0) {\n\t\t\t\t\tcurrentIndex = this.groups.length - 1;\n\t\t\t\t}\n\n\t\t\t\tnextElement = this.groups[currentIndex];\n\t\t\t} else {\n\t\t\t\tcurrentIndex = this.groups.length - 1;\n\t\t\t\tnextElement = this.groups[currentIndex];\n\t\t\t}\n\n\t\t\telementToFocus = await this.groupElementToFocus(nextElement);\n\n\t\t\tif (elementToFocus) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t/* eslint-enable no-await-in-loop */\n\n\t\treturn elementToFocus;\n\t}\n\n\tasync _keydownHandler(event: KeyboardEvent) {\n\t\tconst forward = isF6Next(event);\n\t\tconst backward = isF6Previous(event);\n\t\tif (!(forward || backward)) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.updateGroups();\n\n\t\tif (this.groups.length < 1) {\n\t\t\treturn;\n\t\t}\n\n\t\tevent.preventDefault();\n\n\t\tlet elementToFocus;\n\n\t\tif (this.groups.length === 0) {\n\t\t\telementToFocus = await this.groupElementToFocus(this.groups[0]);\n\n\t\t\treturn elementToFocus?.focus();\n\t\t}\n\n\t\tlet currentIndex = -1;\n\n\t\tif (this.selectedGroup) {\n\t\t\tcurrentIndex = this.groups.indexOf(this.selectedGroup);\n\t\t}\n\n\t\tif (forward) {\n\t\t\telementToFocus = await this.findNextFocusableGroupElement(currentIndex);\n\t\t}\n\n\t\tif (backward) {\n\t\t\telementToFocus = await this.findPreviousFocusableGroupElement(currentIndex);\n\t\t}\n\n\t\telementToFocus?.focus();\n\t}\n\n\tremoveEventListeners() {\n\t\tdocument.removeEventListener(\"keydown\", this.keydownHandler);\n\t}\n\n\tupdateGroups() {\n\t\tthis.setSelectedGroup();\n\t\tthis.groups = getFastNavigationGroups(document.body);\n\t}\n\n\tsetSelectedGroup(root: DocumentOrShadowRoot = window.document) {\n\t\tconst htmlElement = window.document.querySelector(\"html\");\n\t\tlet element: Element | null | ParentNode = this.deepActive(root);\n\n\t\twhile (element && (element as Element).getAttribute(\"data-sap-ui-fastnavgroup\") !== \"true\" && element !== htmlElement) {\n\t\t\telement = element.parentElement ? element.parentNode : (element.parentNode as ShadowRoot).host;\n\t\t}\n\n\t\tthis.selectedGroup = element as HTMLElement;\n\t}\n\n\tdeepActive(root: DocumentOrShadowRoot): Element | null {\n\t\tif (root?.activeElement?.shadowRoot?.activeElement) {\n\t\t\treturn this.deepActive(root.activeElement.shadowRoot);\n\t\t}\n\n\t\treturn root.activeElement;\n\t}\n\n\tdestroy() {\n\t\tthis.removeEventListeners();\n\t}\n\n\tstatic init() {\n\t\tif (!this._instance) {\n\t\t\tthis._instance = new F6Navigation();\n\t\t}\n\n\t\treturn this._instance;\n\t}\n}\n\nregisterFeature(\"F6Navigation\", F6Navigation);\n\nexport default F6Navigation;\n"],
|
|
5
|
+
"mappings": "aAAA,OAAS,mBAAAA,MAAuB,yBAChC,OAAS,YAAAC,EAAU,gBAAAC,MAAoB,aACvC,OAAS,wBAAAC,MAA4B,mBACrC,OAAS,4BAAAC,MAAgC,+BACzC,OAAOC,MAA6B,qCACpC,OAAOC,MAAwB,gCAE/B,MAAMC,CAAa,CAMlB,aAAc,CAHd,mBAAoC,KACpC,YAA6B,CAAC,EAG7B,KAAK,eAAiB,KAAK,gBAAgB,KAAK,IAAI,EACpD,KAAK,qBAAqB,CAC3B,CAEA,sBAAuB,CACtB,SAAS,iBAAiB,UAAW,KAAK,cAAc,CACzD,CAEA,MAAM,oBAAoBC,EAA0B,CACnD,MAAMC,EAAoBN,EAAqBK,CAAW,EAAIA,EAAY,UAAU,EAAIA,EAExF,GAAIC,EAAmB,CACtB,GAAIH,EAAmBG,CAAiB,EACvC,OAAOA,EAGR,MAAMC,EAAiB,MAAMN,EAAyBK,CAAiB,EAEvE,GAAIC,EACH,OAAOA,CAET,CACD,CAEA,MAAM,8BAA8BC,EAAsB,CACzD,IAAID,EAGJ,QAASE,EAAQ,EAAGA,EAAQ,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AAiB,MAAM,KAAK,8BAA8BC,CAAY,GAGnEI,IACHL,EAAiB,MAAM,KAAK,kCAAkCC,CAAY,GAG3ED,GAAgB,MAAM,CACvB,CAEA,sBAAuB,CACtB,SAAS,oBAAoB,UAAW,KAAK,cAAc,CAC5D,CAEA,cAAe,CACd,KAAK,iBAAiB,EACtB,KAAK,OAASL,EAAwB,SAAS,IAAI,CACpD,CAEA,iBAAiBW,EAA6B,OAAO,SAAU,CAC9D,MAAMC,EAAc,OAAO,SAAS,cAAc,MAAM,EACxD,IAAIC,EAAuC,KAAK,WAAWF,CAAI,EAE/D,KAAOE,GAAYA,EAAoB,aAAa,0BAA0B,IAAM,QAAUA,IAAYD,GACzGC,EAAUA,EAAQ,cAAgBA,EAAQ,WAAcA,EAAQ,WAA0B,KAG3F,KAAK,cAAgBA,CACtB,CAEA,WAAWF,EAA4C,CACtD,OAAIA,GAAM,eAAe,YAAY,cAC7B,KAAK,WAAWA,EAAK,cAAc,UAAU,EAG9CA,EAAK,aACb,CAEA,SAAU,CACT,KAAK,qBAAqB,CAC3B,CAEA,OAAO,MAAO,CACb,OAAK,KAAK,YACT,KAAK,UAAY,IAAIT,GAGf,KAAK,SACb,CACD,CAEAP,EAAgB,eAAgBO,CAAY,EAE5C,eAAeA",
|
|
6
6
|
"names": ["registerFeature", "isF6Next", "isF6Previous", "instanceOfUI5Element", "getFirstFocusableElement", "getFastNavigationGroups", "isElementClickable", "F6Navigation", "nextElement", "nextElementDomRef", "elementToFocus", "currentIndex", "index", "event", "forward", "backward", "root", "htmlElement", "element"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/features/InputElementsFormSupport.ts"],
|
|
4
|
-
"sourcesContent": ["import type UI5Element from \"../UI5Element.js\";\n\ninterface IFormElement extends UI5Element {\n\t_internals?: ElementInternals;\n}\n\ninterface IFormInputElement extends IFormElement {\n\tname
|
|
4
|
+
"sourcesContent": ["import type UI5Element from \"../UI5Element.js\";\n\ninterface IFormElement extends UI5Element {\n\t_internals?: ElementInternals;\n}\n\ninterface IFormInputElement extends IFormElement {\n\tname?: string;\n\tformFormattedValue: FormData | string | null;\n\tformValidityMessage?: string;\n\tformValidity?: ValidityStateFlags;\n\tformElementAnchor?: () => HTMLElement | undefined | Promise<HTMLElement | undefined>;\n}\n\nconst attachFormElementInternals = (element: IFormInputElement | IFormElement) => {\n\telement._internals = element.attachInternals();\n\n\tif (isInputElement(element)) {\n\t\tsetFormValue(element);\n\t}\n};\n\nconst setFormValue = (element: IFormInputElement) => {\n\tif (!element._internals?.form) {\n\t\treturn;\n\t}\n\n\tsetFormValidity(element);\n\n\tif (!element.name) {\n\t\telement._internals?.setFormValue(null);\n\t\treturn;\n\t}\n\n\telement._internals.setFormValue(element.formFormattedValue);\n};\n\nconst setFormValidity = async (element: IFormInputElement) => {\n\tif (!element._internals?.form) {\n\t\treturn;\n\t}\n\tif (element.formValidity && Object.keys(element.formValidity).some(key => key)) {\n\t\tconst focusRef = await element.formElementAnchor?.();\n\t\telement._internals.setValidity(element.formValidity, element.formValidityMessage, focusRef);\n\t} else {\n\t\telement._internals.setValidity({});\n\t}\n};\n\nconst submitForm = (element: IFormElement) => {\n\telement._internals?.form?.requestSubmit();\n};\n\nconst resetForm = (element: IFormElement) => {\n\telement._internals?.form?.reset();\n};\n\nconst isInputElement = (element: IFormInputElement | IFormElement): element is IFormInputElement => {\n\treturn \"formFormattedValue\" in element && \"name\" in element;\n};\n\nexport {\n\tattachFormElementInternals,\n\tsetFormValue,\n\tsetFormValidity,\n\tsubmitForm,\n\tresetForm,\n};\n\nexport type {\n\tIFormInputElement,\n\tIFormElement,\n};\n"],
|
|
5
5
|
"mappings": "aAcA,MAAMA,EAA8BC,GAA8C,CACjFA,EAAQ,WAAaA,EAAQ,gBAAgB,EAEzCC,EAAeD,CAAO,GACzBE,EAAaF,CAAO,CAEtB,EAEME,EAAgBF,GAA+B,CACpD,GAAKA,EAAQ,YAAY,KAMzB,IAFAG,EAAgBH,CAAO,EAEnB,CAACA,EAAQ,KAAM,CAClBA,EAAQ,YAAY,aAAa,IAAI,EACrC,MACD,CAEAA,EAAQ,WAAW,aAAaA,EAAQ,kBAAkB,EAC3D,EAEMG,EAAkB,MAAOH,GAA+B,CAC7D,GAAKA,EAAQ,YAAY,KAGzB,GAAIA,EAAQ,cAAgB,OAAO,KAAKA,EAAQ,YAAY,EAAE,KAAKI,GAAOA,CAAG,EAAG,CAC/E,MAAMC,EAAW,MAAML,EAAQ,oBAAoB,EACnDA,EAAQ,WAAW,YAAYA,EAAQ,aAAcA,EAAQ,oBAAqBK,CAAQ,CAC3F,MACCL,EAAQ,WAAW,YAAY,CAAC,CAAC,CAEnC,EAEMM,EAAcN,GAA0B,CAC7CA,EAAQ,YAAY,MAAM,cAAc,CACzC,EAEMO,EAAaP,GAA0B,CAC5CA,EAAQ,YAAY,MAAM,MAAM,CACjC,EAEMC,EAAkBD,GAChB,uBAAwBA,GAAW,SAAUA,EAGrD,OACCD,KAAA,2BACAG,KAAA,aACAC,KAAA,gBACAG,KAAA,WACAC,KAAA",
|
|
6
6
|
"names": ["attachFormElementInternals", "element", "isInputElement", "setFormValue", "setFormValidity", "key", "focusRef", "submitForm", "resetForm"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/features/OpenUI5Enablement.ts"],
|
|
4
|
-
"sourcesContent": ["import { TemplateResult } from \"lit-html\";\nimport { registerFeature } from \"../FeaturesRegistry.js\";\nimport BusyIndicatorStyles from \"../generated/css/BusyIndicator.css.js\";\nimport merge from \"../thirdparty/merge.js\";\nimport {\n\tisTabPrevious,\n} from \"../Keys.js\";\n\nimport type UI5Element from \"../UI5Element.js\";\nimport type OpenUI5Element from \"./OpenUI5Element.js\";\n\nconst busyIndicatorMetadata = {\n\tproperties: {\n\t\t__isBusy: {\n\t\t\ttype: Boolean,\n\t\t},\n\t},\n};\n\nclass OpenUI5Enablement {\n\tstatic wrapTemplateResultInBusyMarkup(html: (strings: TemplateStringsArray, ...values: Array<unknown>) => TemplateResult, host: OpenUI5Element, templateResult: TemplateResult) {\n\t\tif (host.isOpenUI5Component && host.__isBusy) {\n\t\t\ttemplateResult = html`\n\t\t\t<div class=\"busy-indicator-wrapper\">\n\t\t\t\t<span tabindex=\"0\" busy-indicator-before-span @focusin=${host.__suppressFocusIn}></span>\n\t\t\t\t${templateResult}\n\t\t\t\t<div class=\"busy-indicator-overlay\"></div>\n\t\t\t\t<div busy-indicator\n\t\t\t\t\tclass=\"busy-indicator-busy-area\"\n\t\t\t\t\ttabindex=\"0\"\n\t\t\t\t\trole=\"progressbar\"\n\t\t\t\t\t@keydown=${host.__suppressFocusBack}\n\t\t\t\t\taria-valuemin=\"0\"\n\t\t\t\t\taria-valuemax=\"100\"\n\t\t\t\t\taria-valuetext=\"Busy\">\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<div class=\"busy-indicator-circle circle-animation-0\"></div>\n\t\t\t\t\t\t<div class=\"busy-indicator-circle circle-animation-1\"></div>\n\t\t\t\t\t\t<div class=\"busy-indicator-circle circle-animation-2\"></div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>`;\n\t\t}\n\n\t\treturn templateResult;\n\t}\n\n\tstatic enrichBusyIndicatorSettings(klass: typeof UI5Element) {\n\t\tOpenUI5Enablement.enrichBusyIndicatorMetadata(klass);\n\t\tOpenUI5Enablement.enrichBusyIndicatorMethods(klass.prototype);\n\t}\n\n\tstatic enrichBusyIndicatorMetadata(klass: typeof UI5Element) {\n\t\tklass.metadata = merge(klass.metadata, busyIndicatorMetadata);\n\t}\n\n\tstatic enrichBusyIndicatorMethods(UI5ElementPrototype: typeof OpenUI5Element.prototype) {\n\t\tObject.defineProperties(UI5ElementPrototype, {\n\t\t\t\"__redirectFocus\": { value: true, writable: true },\n\t\t\t\"__suppressFocusBack\": {\n\t\t\t\tget() {\n\t\t\t\t\treturn {\n\t\t\t\t\t\thandleEvent: (e: KeyboardEvent) => {\n\t\t\t\t\t\t\tif (isTabPrevious(e)) {\n\t\t\t\t\t\t\t\tconst beforeElem = this.shadowRoot.querySelector(\"[busy-indicator-before-span]\");\n\t\t\t\t\t\t\t\tthis.__redirectFocus = false;\n\t\t\t\t\t\t\t\tbeforeElem.focus();\n\t\t\t\t\t\t\t\tthis.__redirectFocus = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\tcapture: true,\n\t\t\t\t\t\tpassive: false,\n\t\t\t\t\t};\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"isOpenUI5Component\": { get: () => { return true; } },\n\t\t});\n\n\t\tUI5ElementPrototype.__suppressFocusIn = function handleFocusIn() {\n\t\t\tconst busyIndicator = this.shadowRoot?.querySelector(\"[busy-indicator]\") as HTMLElement;\n\t\t\tif (busyIndicator && this.__redirectFocus) {\n\t\t\t\tbusyIndicator.focus();\n\t\t\t}\n\t\t};\n\n\t\tUI5ElementPrototype.getDomRef = function getDomRef() {\n\t\t\t// If a component set _getRealDomRef to its children, use the return value of this function\n\t\t\tif (typeof this._getRealDomRef === \"function\") {\n\t\t\t\treturn this._getRealDomRef();\n\t\t\t}\n\n\t\t\tif (!this.shadowRoot || this.shadowRoot.children.length === 0) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst children = [...this.shadowRoot.children].filter(child => ![\"link\", \"style\"].includes(child.localName));\n\n\t\t\tif (children.length !== 1) {\n\t\t\t\tconsole.warn(`The shadow DOM for ${(this.constructor as typeof UI5Element).getMetadata().getTag()} does not have a top level element, the getDomRef() method might not work as expected`); // eslint-disable-line\n\t\t\t}\n\n\t\t\tif (this.__isBusy) {\n\t\t\t\treturn children[0].querySelector(\".busy-indicator-wrapper > :not([busy-indicator-before-span]):not(.busy-indicator-overlay):not(.busy-indicator-busy-area)\") as HTMLElement;\n\t\t\t}\n\n\t\t\treturn children[0] as HTMLElement;\n\t\t};\n\t}\n\n\tstatic getBusyIndicatorStyles() {\n\t\treturn BusyIndicatorStyles;\n\t}\n}\n\nregisterFeature(\"OpenUI5Enablement\", OpenUI5Enablement);\n\nexport default OpenUI5Enablement;\n"],
|
|
4
|
+
"sourcesContent": ["import type { TemplateResult } from \"lit-html\";\nimport { registerFeature } from \"../FeaturesRegistry.js\";\nimport BusyIndicatorStyles from \"../generated/css/BusyIndicator.css.js\";\nimport merge from \"../thirdparty/merge.js\";\nimport {\n\tisTabPrevious,\n} from \"../Keys.js\";\n\nimport type UI5Element from \"../UI5Element.js\";\nimport type OpenUI5Element from \"./OpenUI5Element.js\";\n\nconst busyIndicatorMetadata = {\n\tproperties: {\n\t\t__isBusy: {\n\t\t\ttype: Boolean,\n\t\t},\n\t},\n};\n\nclass OpenUI5Enablement {\n\tstatic wrapTemplateResultInBusyMarkup(html: (strings: TemplateStringsArray, ...values: Array<unknown>) => TemplateResult, host: OpenUI5Element, templateResult: TemplateResult) {\n\t\tif (host.isOpenUI5Component && host.__isBusy) {\n\t\t\ttemplateResult = html`\n\t\t\t<div class=\"busy-indicator-wrapper\">\n\t\t\t\t<span tabindex=\"0\" busy-indicator-before-span @focusin=${host.__suppressFocusIn}></span>\n\t\t\t\t${templateResult}\n\t\t\t\t<div class=\"busy-indicator-overlay\"></div>\n\t\t\t\t<div busy-indicator\n\t\t\t\t\tclass=\"busy-indicator-busy-area\"\n\t\t\t\t\ttabindex=\"0\"\n\t\t\t\t\trole=\"progressbar\"\n\t\t\t\t\t@keydown=${host.__suppressFocusBack}\n\t\t\t\t\taria-valuemin=\"0\"\n\t\t\t\t\taria-valuemax=\"100\"\n\t\t\t\t\taria-valuetext=\"Busy\">\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<div class=\"busy-indicator-circle circle-animation-0\"></div>\n\t\t\t\t\t\t<div class=\"busy-indicator-circle circle-animation-1\"></div>\n\t\t\t\t\t\t<div class=\"busy-indicator-circle circle-animation-2\"></div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>`;\n\t\t}\n\n\t\treturn templateResult;\n\t}\n\n\tstatic enrichBusyIndicatorSettings(klass: typeof UI5Element) {\n\t\tOpenUI5Enablement.enrichBusyIndicatorMetadata(klass);\n\t\tOpenUI5Enablement.enrichBusyIndicatorMethods(klass.prototype);\n\t}\n\n\tstatic enrichBusyIndicatorMetadata(klass: typeof UI5Element) {\n\t\tklass.metadata = merge(klass.metadata, busyIndicatorMetadata);\n\t}\n\n\tstatic enrichBusyIndicatorMethods(UI5ElementPrototype: typeof OpenUI5Element.prototype) {\n\t\tObject.defineProperties(UI5ElementPrototype, {\n\t\t\t\"__redirectFocus\": { value: true, writable: true },\n\t\t\t\"__suppressFocusBack\": {\n\t\t\t\tget() {\n\t\t\t\t\treturn {\n\t\t\t\t\t\thandleEvent: (e: KeyboardEvent) => {\n\t\t\t\t\t\t\tif (isTabPrevious(e)) {\n\t\t\t\t\t\t\t\tconst beforeElem = this.shadowRoot.querySelector(\"[busy-indicator-before-span]\");\n\t\t\t\t\t\t\t\tthis.__redirectFocus = false;\n\t\t\t\t\t\t\t\tbeforeElem.focus();\n\t\t\t\t\t\t\t\tthis.__redirectFocus = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\tcapture: true,\n\t\t\t\t\t\tpassive: false,\n\t\t\t\t\t};\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"isOpenUI5Component\": { get: () => { return true; } },\n\t\t});\n\n\t\tUI5ElementPrototype.__suppressFocusIn = function handleFocusIn() {\n\t\t\tconst busyIndicator = this.shadowRoot?.querySelector(\"[busy-indicator]\") as HTMLElement;\n\t\t\tif (busyIndicator && this.__redirectFocus) {\n\t\t\t\tbusyIndicator.focus();\n\t\t\t}\n\t\t};\n\n\t\tUI5ElementPrototype.getDomRef = function getDomRef() {\n\t\t\t// If a component set _getRealDomRef to its children, use the return value of this function\n\t\t\tif (typeof this._getRealDomRef === \"function\") {\n\t\t\t\treturn this._getRealDomRef();\n\t\t\t}\n\n\t\t\tif (!this.shadowRoot || this.shadowRoot.children.length === 0) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst children = [...this.shadowRoot.children].filter(child => ![\"link\", \"style\"].includes(child.localName));\n\n\t\t\tif (children.length !== 1) {\n\t\t\t\tconsole.warn(`The shadow DOM for ${(this.constructor as typeof UI5Element).getMetadata().getTag()} does not have a top level element, the getDomRef() method might not work as expected`); // eslint-disable-line\n\t\t\t}\n\n\t\t\tif (this.__isBusy) {\n\t\t\t\treturn children[0].querySelector(\".busy-indicator-wrapper > :not([busy-indicator-before-span]):not(.busy-indicator-overlay):not(.busy-indicator-busy-area)\") as HTMLElement;\n\t\t\t}\n\n\t\t\treturn children[0] as HTMLElement;\n\t\t};\n\t}\n\n\tstatic getBusyIndicatorStyles() {\n\t\treturn BusyIndicatorStyles;\n\t}\n}\n\nregisterFeature(\"OpenUI5Enablement\", OpenUI5Enablement);\n\nexport default OpenUI5Enablement;\n"],
|
|
5
5
|
"mappings": "aACA,OAAS,mBAAAA,MAAuB,yBAChC,OAAOC,MAAyB,wCAChC,OAAOC,MAAW,yBAClB,OACC,iBAAAC,MACM,aAKP,MAAMC,EAAwB,CAC7B,WAAY,CACX,SAAU,CACT,KAAM,OACP,CACD,CACD,EAEA,MAAMC,CAAkB,CACvB,OAAO,+BAA+BC,EAAoFC,EAAsBC,EAAgC,CAC/K,OAAID,EAAK,oBAAsBA,EAAK,WACnCC,EAAiBF;AAAA;AAAA,6DAEyCC,EAAK,iBAAiB;AAAA,MAC7EC,CAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAMJD,EAAK,mBAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAa/BC,CACR,CAEA,OAAO,4BAA4BC,EAA0B,CAC5DJ,EAAkB,4BAA4BI,CAAK,EACnDJ,EAAkB,2BAA2BI,EAAM,SAAS,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ata", "OpenUI5Enablement", "html", "host", "templateResult", "klass", "UI5ElementPrototype", "e", "beforeElem", "busyIndicator", "children", "child"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";import u from"./patchPatcher.js";import l from"./patchPopup.js";import{registerFeature as m}from"../FeaturesRegistry.js";import{setTheme as g}from"../config/Theme.js";class a{static isAtLeastVersion116(){const e=window.sap.ui.version.split(".");return!e||e.length<2?!1:parseInt(e[0])>1||parseInt(e[1])>=116}static isOpenUI5Detected(){return typeof window.sap?.ui?.require=="function"}static init(){return a.isOpenUI5Detected()?new Promise(t=>{window.sap.ui.require(["sap/ui/core/Core"],async e=>{const i=()=>{let n=["sap/ui/core/Popup","sap/ui/core/Patcher","sap/ui/core/LocaleData"];a.isAtLeastVersion116()&&(n=[...n,"sap/base/i18n/Formatting","sap/base/i18n/Localization","sap/ui/core/ControlBehavior","sap/ui/core/Theming","sap/ui/core/date/CalendarUtils"]),window.sap.ui.require(n,(o,r)=>{u(r),l(o),t()})};a.isAtLeastVersion116()?(await e.ready(),i()):e.attachInit(i)})}):Promise.resolve()}static getConfigurationSettingsObject(){if(!a.isOpenUI5Detected())return{};if(a.isAtLeastVersion116()){const n=window.sap.ui.require("sap/ui/core/ControlBehavior"),o=window.sap.ui.require("sap/base/i18n/Localization"),r=window.sap.ui.require("sap/ui/core/Theming"),s=window.sap.ui.require("sap/base/i18n/Formatting"),c=window.sap.ui.require("sap/ui/core/date/CalendarUtils");return{animationMode:n.getAnimationMode(),language:o.getLanguage(),theme:r.getTheme(),themeRoot:r.getThemeRoot(),rtl:o.getRTL(),timezone:o.getTimezone(),calendarType:s.getCalendarType(),formatSettings:{firstDayOfWeek:c.getWeekConfigurationValues().firstDayOfWeek,legacyDateCalendarCustomizing:s.getCustomIslamicCalendarData?.()??s.getLegacyDateCalendarCustomizing?.()}}}const e=window.sap.ui.require("sap/ui/core/Core").getConfiguration(),i=window.sap.ui.require("sap/ui/core/LocaleData");return{animationMode:e.getAnimationMode(),language:e.getLanguage(),theme:e.getTheme(),themeRoot:e.getThemeRoot(),rtl:e.getRTL(),timezone:e.getTimezone(),calendarType:e.getCalendarType(),formatSettings:{firstDayOfWeek:i?i.getInstance(e.getLocale()).getFirstDayOfWeek():void 0,legacyDateCalendarCustomizing:e.getFormatSettings().getLegacyDateCalendarCustomizing()}}}static getLocaleDataObject(){if(!a.isOpenUI5Detected())return;const t=window.sap.ui.require("sap/ui/core/LocaleData");if(a.isAtLeastVersion116()){const n=window.sap.ui.require("sap/base/i18n/Localization");return t.getInstance(n.getLanguageTag())._get()}const i=window.sap.ui.require("sap/ui/core/Core").getConfiguration();return t.getInstance(i.getLocale())._get()}static _listenForThemeChange(){if(a.isAtLeastVersion116()){const t=window.sap.ui.require("sap/ui/core/Theming");t.attachApplied(()=>{g(t.getTheme())})}else{const t=window.sap.ui.require("sap/ui/core/Core"),e=t.getConfiguration();t.attachThemeChanged(()=>{g(e.getTheme())})}}static attachListeners(){a.isOpenUI5Detected()&&a._listenForThemeChange()}static cssVariablesLoaded(){if(!a.isOpenUI5Detected())return;const t=[...document.head.children].find(e=>e.id==="sap-ui-theme-sap.ui.core");return t?!!t.href.match(/\/css(-|_)variables\.css/):!1}}m("OpenUI5Support",a);export default a;
|
|
1
|
+
"use strict";import u from"./patchPatcher.js";import l from"./patchPopup.js";import{registerFeature as m}from"../FeaturesRegistry.js";import{setTheme as g}from"../config/Theme.js";class a{static isAtLeastVersion116(){if(!window.sap.ui.version)return!0;const e=window.sap.ui.version.split(".");return!e||e.length<2?!1:parseInt(e[0])>1||parseInt(e[1])>=116}static isOpenUI5Detected(){return typeof window.sap?.ui?.require=="function"}static init(){return a.isOpenUI5Detected()?new Promise(t=>{window.sap.ui.require(["sap/ui/core/Core"],async e=>{const i=()=>{let n=["sap/ui/core/Popup","sap/ui/core/Patcher","sap/ui/core/LocaleData"];a.isAtLeastVersion116()&&(n=[...n,"sap/base/i18n/Formatting","sap/base/i18n/Localization","sap/ui/core/ControlBehavior","sap/ui/core/Theming","sap/ui/core/date/CalendarUtils"]),window.sap.ui.require(n,(o,r)=>{u(r),l(o),t()})};a.isAtLeastVersion116()?(await e.ready(),i()):e.attachInit(i)})}):Promise.resolve()}static getConfigurationSettingsObject(){if(!a.isOpenUI5Detected())return{};if(a.isAtLeastVersion116()){const n=window.sap.ui.require("sap/ui/core/ControlBehavior"),o=window.sap.ui.require("sap/base/i18n/Localization"),r=window.sap.ui.require("sap/ui/core/Theming"),s=window.sap.ui.require("sap/base/i18n/Formatting"),c=window.sap.ui.require("sap/ui/core/date/CalendarUtils");return{animationMode:n.getAnimationMode(),language:o.getLanguage(),theme:r.getTheme(),themeRoot:r.getThemeRoot(),rtl:o.getRTL(),timezone:o.getTimezone(),calendarType:s.getCalendarType(),formatSettings:{firstDayOfWeek:c.getWeekConfigurationValues().firstDayOfWeek,legacyDateCalendarCustomizing:s.getCustomIslamicCalendarData?.()??s.getLegacyDateCalendarCustomizing?.()}}}const e=window.sap.ui.require("sap/ui/core/Core").getConfiguration(),i=window.sap.ui.require("sap/ui/core/LocaleData");return{animationMode:e.getAnimationMode(),language:e.getLanguage(),theme:e.getTheme(),themeRoot:e.getThemeRoot(),rtl:e.getRTL(),timezone:e.getTimezone(),calendarType:e.getCalendarType(),formatSettings:{firstDayOfWeek:i?i.getInstance(e.getLocale()).getFirstDayOfWeek():void 0,legacyDateCalendarCustomizing:e.getFormatSettings().getLegacyDateCalendarCustomizing()}}}static getLocaleDataObject(){if(!a.isOpenUI5Detected())return;const t=window.sap.ui.require("sap/ui/core/LocaleData");if(a.isAtLeastVersion116()){const n=window.sap.ui.require("sap/base/i18n/Localization");return t.getInstance(n.getLanguageTag())._get()}const i=window.sap.ui.require("sap/ui/core/Core").getConfiguration();return t.getInstance(i.getLocale())._get()}static _listenForThemeChange(){if(a.isAtLeastVersion116()){const t=window.sap.ui.require("sap/ui/core/Theming");t.attachApplied(()=>{g(t.getTheme())})}else{const t=window.sap.ui.require("sap/ui/core/Core"),e=t.getConfiguration();t.attachThemeChanged(()=>{g(e.getTheme())})}}static attachListeners(){a.isOpenUI5Detected()&&a._listenForThemeChange()}static cssVariablesLoaded(){if(!a.isOpenUI5Detected())return;const t=[...document.head.children].find(e=>e.id==="sap-ui-theme-sap.ui.core");return t?!!t.href.match(/\/css(-|_)variables\.css/):!1}}m("OpenUI5Support",a);export default a;
|
|
2
2
|
//# sourceMappingURL=OpenUI5Support.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/features/OpenUI5Support.ts"],
|
|
4
|
-
"sourcesContent": ["import patchPatcher from \"./patchPatcher.js\";\nimport type { OpenUI5Patcher } from \"./patchPatcher.js\";\nimport patchPopup from \"./patchPopup.js\";\nimport type { OpenUI5Popup } from \"./patchPopup.js\";\nimport { registerFeature } from \"../FeaturesRegistry.js\";\nimport { setTheme } from \"../config/Theme.js\";\nimport { CLDRData } from \"../asset-registries/LocaleData.js\";\nimport type { LegacyDateCalendarCustomizing } from \"../features/LegacyDateFormats.js\";\n\ntype OpenUI5Core = {\n\tattachInit: (callback: () => void) => void,\n\tready: () => Promise<void>,\n\tattachThemeChanged: (callback: () => void) => void,\n\tgetConfiguration: () => OpenUI5CoreConfiguration,\n};\n\ntype OpenUI5CoreConfiguration = {\n\tgetAnimationMode: () => string,\n\tgetLanguage: () => string,\n\tgetTheme: () => string,\n\tgetThemeRoot: () => string,\n\tgetRTL: () => string,\n\tgetTimezone: () => string,\n\tgetCalendarType: () => string,\n\tgetLocale: () => string,\n\tgetFormatSettings: () => {\n\t\tgetLegacyDateCalendarCustomizing: () => LegacyDateCalendarCustomizing;\n\t}\n};\n\ntype ControlBehavior = {\n\tgetAnimationMode: () => string,\n}\n\ntype Localization = {\n\tgetLanguage: () => string,\n\tgetLanguageTag: () => string,\n\tgetRTL: () => string,\n\tgetTimezone: () => string,\n}\n\ntype LocaleData = {\n\tgetInstance: (locale: string) => Locale,\n}\n\ntype Theming = {\n\tgetThemeRoot: () => string,\n\tgetTheme: () => string,\n\tattachApplied: (callback: () => void) => void,\n}\n\ntype Formatting = {\n\tgetCalendarType: () => string,\n\tgetLegacyDateCalendarCustomizing: () => LegacyDateCalendarCustomizing,\n\tgetCustomIslamicCalendarData?: () => LegacyDateCalendarCustomizing,\n}\n\ntype CalendarUtils = {\n\tgetWeekConfigurationValues: () => {\n\t\tfirstDayOfWeek: number | undefined,\n\t},\n}\n\ntype Locale = {\n\tgetFirstDayOfWeek: () => number,\n\t_get: () => CLDRData,\n};\n\nclass OpenUI5Support {\n\tstatic isAtLeastVersion116() {\n\t\tconst version = window.sap.ui!.version as string;\n\t\tconst parts = version.split(\".\");\n\t\tif (!parts || parts.length < 2) {\n\t\t\treturn false;\n\t\t}\n\t\treturn parseInt(parts[0]) > 1 || parseInt(parts[1]) >= 116;\n\t}\n\n\tstatic isOpenUI5Detected() {\n\t\treturn typeof window.sap?.ui?.require === \"function\";\n\t}\n\n\tstatic init() {\n\t\tif (!OpenUI5Support.isOpenUI5Detected()) {\n\t\t\treturn Promise.resolve();\n\t\t}\n\n\t\treturn new Promise<void>(resolve => {\n\t\t\twindow.sap.ui.require([\"sap/ui/core/Core\"], async (Core: OpenUI5Core) => {\n\t\t\t\tconst callback = () => {\n\t\t\t\t\tlet deps: Array<string> = [\"sap/ui/core/Popup\", \"sap/ui/core/Patcher\", \"sap/ui/core/LocaleData\"];\n\t\t\t\t\tif (OpenUI5Support.isAtLeastVersion116()) { // for versions since 1.116.0 and onward, use the modular core\n\t\t\t\t\t\tdeps = [\n\t\t\t\t\t\t\t...deps,\n\t\t\t\t\t\t\t\"sap/base/i18n/Formatting\",\n\t\t\t\t\t\t\t\"sap/base/i18n/Localization\",\n\t\t\t\t\t\t\t\"sap/ui/core/ControlBehavior\",\n\t\t\t\t\t\t\t\"sap/ui/core/Theming\",\n\t\t\t\t\t\t\t\"sap/ui/core/date/CalendarUtils\",\n\t\t\t\t\t\t];\n\t\t\t\t\t}\n\t\t\t\t\twindow.sap.ui.require(deps, (Popup: OpenUI5Popup, Patcher: OpenUI5Patcher) => {\n\t\t\t\t\t\tpatchPatcher(Patcher);\n\t\t\t\t\t\tpatchPopup(Popup);\n\t\t\t\t\t\tresolve();\n\t\t\t\t\t});\n\t\t\t\t};\n\t\t\t\tif (OpenUI5Support.isAtLeastVersion116()) {\n\t\t\t\t\tawait Core.ready();\n\t\t\t\t\tcallback();\n\t\t\t\t} else {\n\t\t\t\t\tCore.attachInit(callback);\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}\n\n\tstatic getConfigurationSettingsObject() {\n\t\tif (!OpenUI5Support.isOpenUI5Detected()) {\n\t\t\treturn {};\n\t\t}\n\n\t\tif (OpenUI5Support.isAtLeastVersion116()) {\n\t\t\tconst ControlBehavior = window.sap.ui.require(\"sap/ui/core/ControlBehavior\") as ControlBehavior;\n\t\t\tconst Localization = window.sap.ui.require(\"sap/base/i18n/Localization\") as Localization;\n\t\t\tconst Theming = window.sap.ui.require(\"sap/ui/core/Theming\") as Theming;\n\t\t\tconst Formatting = window.sap.ui.require(\"sap/base/i18n/Formatting\") as Formatting;\n\t\t\tconst CalendarUtils = window.sap.ui.require(\"sap/ui/core/date/CalendarUtils\") as CalendarUtils;\n\n\t\t\treturn {\n\t\t\t\tanimationMode: ControlBehavior.getAnimationMode(),\n\t\t\t\tlanguage: Localization.getLanguage(),\n\t\t\t\ttheme: Theming.getTheme(),\n\t\t\t\tthemeRoot: Theming.getThemeRoot(),\n\t\t\t\trtl: Localization.getRTL(),\n\t\t\t\ttimezone: Localization.getTimezone(),\n\t\t\t\tcalendarType: Formatting.getCalendarType(),\n\t\t\t\tformatSettings: {\n\t\t\t\t\tfirstDayOfWeek: CalendarUtils.getWeekConfigurationValues().firstDayOfWeek,\n\t\t\t\t\tlegacyDateCalendarCustomizing: Formatting.getCustomIslamicCalendarData?.()\n\t\t\t\t\t\t\t\t\t\t\t\t?? Formatting.getLegacyDateCalendarCustomizing?.(),\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\tconst Core = window.sap.ui.require(\"sap/ui/core/Core\") as OpenUI5Core;\n\t\tconst config = Core.getConfiguration();\n\t\tconst LocaleData = window.sap.ui.require(\"sap/ui/core/LocaleData\") as LocaleData;\n\n\t\treturn {\n\t\t\tanimationMode: config.getAnimationMode(),\n\t\t\tlanguage: config.getLanguage(),\n\t\t\ttheme: config.getTheme(),\n\t\t\tthemeRoot: config.getThemeRoot(),\n\t\t\trtl: config.getRTL(),\n\t\t\ttimezone: config.getTimezone(),\n\t\t\tcalendarType: config.getCalendarType(),\n\t\t\tformatSettings: {\n\t\t\t\tfirstDayOfWeek: LocaleData ? LocaleData.getInstance(config.getLocale()).getFirstDayOfWeek() : undefined,\n\t\t\t\tlegacyDateCalendarCustomizing: config.getFormatSettings().getLegacyDateCalendarCustomizing(),\n\t\t\t},\n\t\t};\n\t}\n\n\tstatic getLocaleDataObject() {\n\t\tif (!OpenUI5Support.isOpenUI5Detected()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst LocaleData = window.sap.ui.require(\"sap/ui/core/LocaleData\") as LocaleData;\n\n\t\tif (OpenUI5Support.isAtLeastVersion116()) {\n\t\t\tconst Localization = window.sap.ui.require(\"sap/base/i18n/Localization\") as Localization;\n\t\t\treturn LocaleData.getInstance(Localization.getLanguageTag())._get();\n\t\t}\n\n\t\tconst Core = window.sap.ui.require(\"sap/ui/core/Core\") as OpenUI5Core;\n\t\tconst config = Core.getConfiguration();\n\t\treturn LocaleData.getInstance(config.getLocale())._get();\n\t}\n\n\tstatic _listenForThemeChange() {\n\t\tif (OpenUI5Support.isAtLeastVersion116()) {\n\t\t\tconst Theming: Theming = window.sap.ui.require(\"sap/ui/core/Theming\");\n\t\t\tTheming.attachApplied(() => {\n\t\t\t\tsetTheme(Theming.getTheme());\n\t\t\t});\n\t\t} else {\n\t\t\tconst Core = window.sap.ui.require(\"sap/ui/core/Core\") as OpenUI5Core;\n\t\t\tconst config = Core.getConfiguration();\n\t\t\tCore.attachThemeChanged(() => {\n\t\t\t\tsetTheme(config.getTheme());\n\t\t\t});\n\t\t}\n\t}\n\n\tstatic attachListeners() {\n\t\tif (!OpenUI5Support.isOpenUI5Detected()) {\n\t\t\treturn;\n\t\t}\n\n\t\tOpenUI5Support._listenForThemeChange();\n\t}\n\n\tstatic cssVariablesLoaded() {\n\t\tif (!OpenUI5Support.isOpenUI5Detected()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst link = [...document.head.children].find(el => el.id === \"sap-ui-theme-sap.ui.core\") as HTMLLinkElement; // more reliable than querySelector early\n\t\tif (!link) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn !!link.href.match(/\\/css(-|_)variables\\.css/);\n\t}\n}\n\nregisterFeature(\"OpenUI5Support\", OpenUI5Support);\n\nexport default OpenUI5Support;\n"],
|
|
5
|
-
"mappings": "aAAA,OAAOA,MAAkB,oBAEzB,OAAOC,MAAgB,kBAEvB,OAAS,mBAAAC,MAAuB,yBAChC,OAAS,YAAAC,MAAgB,qBA+DzB,MAAMC,CAAe,CACpB,OAAO,qBAAsB,
|
|
4
|
+
"sourcesContent": ["import patchPatcher from \"./patchPatcher.js\";\nimport type { OpenUI5Patcher } from \"./patchPatcher.js\";\nimport patchPopup from \"./patchPopup.js\";\nimport type { OpenUI5Popup } from \"./patchPopup.js\";\nimport { registerFeature } from \"../FeaturesRegistry.js\";\nimport { setTheme } from \"../config/Theme.js\";\nimport type { CLDRData } from \"../asset-registries/LocaleData.js\";\nimport type { LegacyDateCalendarCustomizing } from \"../features/LegacyDateFormats.js\";\n\ntype OpenUI5Core = {\n\tattachInit: (callback: () => void) => void,\n\tready: () => Promise<void>,\n\tattachThemeChanged: (callback: () => void) => void,\n\tgetConfiguration: () => OpenUI5CoreConfiguration,\n};\n\ntype OpenUI5CoreConfiguration = {\n\tgetAnimationMode: () => string,\n\tgetLanguage: () => string,\n\tgetTheme: () => string,\n\tgetThemeRoot: () => string,\n\tgetRTL: () => string,\n\tgetTimezone: () => string,\n\tgetCalendarType: () => string,\n\tgetLocale: () => string,\n\tgetFormatSettings: () => {\n\t\tgetLegacyDateCalendarCustomizing: () => LegacyDateCalendarCustomizing;\n\t}\n};\n\ntype ControlBehavior = {\n\tgetAnimationMode: () => string,\n}\n\ntype Localization = {\n\tgetLanguage: () => string,\n\tgetLanguageTag: () => string,\n\tgetRTL: () => string,\n\tgetTimezone: () => string,\n}\n\ntype LocaleData = {\n\tgetInstance: (locale: string) => Locale,\n}\n\ntype Theming = {\n\tgetThemeRoot: () => string,\n\tgetTheme: () => string,\n\tattachApplied: (callback: () => void) => void,\n}\n\ntype Formatting = {\n\tgetCalendarType: () => string,\n\tgetLegacyDateCalendarCustomizing: () => LegacyDateCalendarCustomizing,\n\tgetCustomIslamicCalendarData?: () => LegacyDateCalendarCustomizing,\n}\n\ntype CalendarUtils = {\n\tgetWeekConfigurationValues: () => {\n\t\tfirstDayOfWeek: number | undefined,\n\t},\n}\n\ntype Locale = {\n\tgetFirstDayOfWeek: () => number,\n\t_get: () => CLDRData,\n};\n\nclass OpenUI5Support {\n\tstatic isAtLeastVersion116() {\n\t\tif (!window.sap.ui!.version) {\n\t\t\treturn true; // sap.ui.version will be removed in newer OpenUI5 versions\n\t\t}\n\t\tconst version = window.sap.ui!.version as string;\n\t\tconst parts = version.split(\".\");\n\t\tif (!parts || parts.length < 2) {\n\t\t\treturn false;\n\t\t}\n\t\treturn parseInt(parts[0]) > 1 || parseInt(parts[1]) >= 116;\n\t}\n\n\tstatic isOpenUI5Detected() {\n\t\treturn typeof window.sap?.ui?.require === \"function\";\n\t}\n\n\tstatic init() {\n\t\tif (!OpenUI5Support.isOpenUI5Detected()) {\n\t\t\treturn Promise.resolve();\n\t\t}\n\n\t\treturn new Promise<void>(resolve => {\n\t\t\twindow.sap.ui.require([\"sap/ui/core/Core\"], async (Core: OpenUI5Core) => {\n\t\t\t\tconst callback = () => {\n\t\t\t\t\tlet deps: Array<string> = [\"sap/ui/core/Popup\", \"sap/ui/core/Patcher\", \"sap/ui/core/LocaleData\"];\n\t\t\t\t\tif (OpenUI5Support.isAtLeastVersion116()) { // for versions since 1.116.0 and onward, use the modular core\n\t\t\t\t\t\tdeps = [\n\t\t\t\t\t\t\t...deps,\n\t\t\t\t\t\t\t\"sap/base/i18n/Formatting\",\n\t\t\t\t\t\t\t\"sap/base/i18n/Localization\",\n\t\t\t\t\t\t\t\"sap/ui/core/ControlBehavior\",\n\t\t\t\t\t\t\t\"sap/ui/core/Theming\",\n\t\t\t\t\t\t\t\"sap/ui/core/date/CalendarUtils\",\n\t\t\t\t\t\t];\n\t\t\t\t\t}\n\t\t\t\t\twindow.sap.ui.require(deps, (Popup: OpenUI5Popup, Patcher: OpenUI5Patcher) => {\n\t\t\t\t\t\tpatchPatcher(Patcher);\n\t\t\t\t\t\tpatchPopup(Popup);\n\t\t\t\t\t\tresolve();\n\t\t\t\t\t});\n\t\t\t\t};\n\t\t\t\tif (OpenUI5Support.isAtLeastVersion116()) {\n\t\t\t\t\tawait Core.ready();\n\t\t\t\t\tcallback();\n\t\t\t\t} else {\n\t\t\t\t\tCore.attachInit(callback);\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}\n\n\tstatic getConfigurationSettingsObject() {\n\t\tif (!OpenUI5Support.isOpenUI5Detected()) {\n\t\t\treturn {};\n\t\t}\n\n\t\tif (OpenUI5Support.isAtLeastVersion116()) {\n\t\t\tconst ControlBehavior = window.sap.ui.require(\"sap/ui/core/ControlBehavior\") as ControlBehavior;\n\t\t\tconst Localization = window.sap.ui.require(\"sap/base/i18n/Localization\") as Localization;\n\t\t\tconst Theming = window.sap.ui.require(\"sap/ui/core/Theming\") as Theming;\n\t\t\tconst Formatting = window.sap.ui.require(\"sap/base/i18n/Formatting\") as Formatting;\n\t\t\tconst CalendarUtils = window.sap.ui.require(\"sap/ui/core/date/CalendarUtils\") as CalendarUtils;\n\n\t\t\treturn {\n\t\t\t\tanimationMode: ControlBehavior.getAnimationMode(),\n\t\t\t\tlanguage: Localization.getLanguage(),\n\t\t\t\ttheme: Theming.getTheme(),\n\t\t\t\tthemeRoot: Theming.getThemeRoot(),\n\t\t\t\trtl: Localization.getRTL(),\n\t\t\t\ttimezone: Localization.getTimezone(),\n\t\t\t\tcalendarType: Formatting.getCalendarType(),\n\t\t\t\tformatSettings: {\n\t\t\t\t\tfirstDayOfWeek: CalendarUtils.getWeekConfigurationValues().firstDayOfWeek,\n\t\t\t\t\tlegacyDateCalendarCustomizing: Formatting.getCustomIslamicCalendarData?.()\n\t\t\t\t\t\t\t\t\t\t\t\t?? Formatting.getLegacyDateCalendarCustomizing?.(),\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\tconst Core = window.sap.ui.require(\"sap/ui/core/Core\") as OpenUI5Core;\n\t\tconst config = Core.getConfiguration();\n\t\tconst LocaleData = window.sap.ui.require(\"sap/ui/core/LocaleData\") as LocaleData;\n\n\t\treturn {\n\t\t\tanimationMode: config.getAnimationMode(),\n\t\t\tlanguage: config.getLanguage(),\n\t\t\ttheme: config.getTheme(),\n\t\t\tthemeRoot: config.getThemeRoot(),\n\t\t\trtl: config.getRTL(),\n\t\t\ttimezone: config.getTimezone(),\n\t\t\tcalendarType: config.getCalendarType(),\n\t\t\tformatSettings: {\n\t\t\t\tfirstDayOfWeek: LocaleData ? LocaleData.getInstance(config.getLocale()).getFirstDayOfWeek() : undefined,\n\t\t\t\tlegacyDateCalendarCustomizing: config.getFormatSettings().getLegacyDateCalendarCustomizing(),\n\t\t\t},\n\t\t};\n\t}\n\n\tstatic getLocaleDataObject() {\n\t\tif (!OpenUI5Support.isOpenUI5Detected()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst LocaleData = window.sap.ui.require(\"sap/ui/core/LocaleData\") as LocaleData;\n\n\t\tif (OpenUI5Support.isAtLeastVersion116()) {\n\t\t\tconst Localization = window.sap.ui.require(\"sap/base/i18n/Localization\") as Localization;\n\t\t\treturn LocaleData.getInstance(Localization.getLanguageTag())._get();\n\t\t}\n\n\t\tconst Core = window.sap.ui.require(\"sap/ui/core/Core\") as OpenUI5Core;\n\t\tconst config = Core.getConfiguration();\n\t\treturn LocaleData.getInstance(config.getLocale())._get();\n\t}\n\n\tstatic _listenForThemeChange() {\n\t\tif (OpenUI5Support.isAtLeastVersion116()) {\n\t\t\tconst Theming: Theming = window.sap.ui.require(\"sap/ui/core/Theming\");\n\t\t\tTheming.attachApplied(() => {\n\t\t\t\tsetTheme(Theming.getTheme());\n\t\t\t});\n\t\t} else {\n\t\t\tconst Core = window.sap.ui.require(\"sap/ui/core/Core\") as OpenUI5Core;\n\t\t\tconst config = Core.getConfiguration();\n\t\t\tCore.attachThemeChanged(() => {\n\t\t\t\tsetTheme(config.getTheme());\n\t\t\t});\n\t\t}\n\t}\n\n\tstatic attachListeners() {\n\t\tif (!OpenUI5Support.isOpenUI5Detected()) {\n\t\t\treturn;\n\t\t}\n\n\t\tOpenUI5Support._listenForThemeChange();\n\t}\n\n\tstatic cssVariablesLoaded() {\n\t\tif (!OpenUI5Support.isOpenUI5Detected()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst link = [...document.head.children].find(el => el.id === \"sap-ui-theme-sap.ui.core\") as HTMLLinkElement; // more reliable than querySelector early\n\t\tif (!link) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn !!link.href.match(/\\/css(-|_)variables\\.css/);\n\t}\n}\n\nregisterFeature(\"OpenUI5Support\", OpenUI5Support);\n\nexport default OpenUI5Support;\n"],
|
|
5
|
+
"mappings": "aAAA,OAAOA,MAAkB,oBAEzB,OAAOC,MAAgB,kBAEvB,OAAS,mBAAAC,MAAuB,yBAChC,OAAS,YAAAC,MAAgB,qBA+DzB,MAAMC,CAAe,CACpB,OAAO,qBAAsB,CAC5B,GAAI,CAAC,OAAO,IAAI,GAAI,QACnB,MAAO,GAGR,MAAMC,EADU,OAAO,IAAI,GAAI,QACT,MAAM,GAAG,EAC/B,MAAI,CAACA,GAASA,EAAM,OAAS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AAG,QAAQ,kBAAkB,EAC/CU,EAASV,EAAK,iBAAiB,EACrCA,EAAK,mBAAmB,IAAM,CAC7BJ,EAASc,EAAO,SAAS,CAAC,CAC3B,CAAC,CACF,CACD,CAEA,OAAO,iBAAkB,CACnBb,EAAe,kBAAkB,GAItCA,EAAe,sBAAsB,CACtC,CAEA,OAAO,oBAAqB,CAC3B,GAAI,CAACA,EAAe,kBAAkB,EACrC,OAGD,MAAMe,EAAO,CAAC,GAAG,SAAS,KAAK,QAAQ,EAAE,KAAKC,GAAMA,EAAG,KAAO,0BAA0B,EACxF,OAAKD,EAIE,CAAC,CAACA,EAAK,KAAK,MAAM,0BAA0B,EAH3C,EAIT,CACD,CAEAjB,EAAgB,iBAAkBE,CAAc,EAEhD,eAAeA",
|
|
6
6
|
"names": ["patchPatcher", "patchPopup", "registerFeature", "setTheme", "OpenUI5Support", "parts", "resolve", "Core", "callback", "deps", "Popup", "Patcher", "ControlBehavior", "Localization", "Theming", "Formatting", "CalendarUtils", "config", "LocaleData", "link", "el"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const r=e=>{e.setAttribute("popover","manual"),e.showPopover()},a=e=>{e.hasAttribute("popover")&&(e.hidePopover(),e.removeAttribute("popover"))},l=e=>{const o=e.prototype.open;e.prototype.open=function(...t){o.apply(this,t);const p=!!document.body.querySelector(":popover-open");if(["OPENING","OPEN"].includes(this.getOpenState())&&p){const c=this.getContent();if(c){const i=c.getDomRef();i&&r(i)}}}},u=e=>{const o=e.prototype._closed;e.prototype._closed=function(...t){const n=this.getContent().getDomRef();o.apply(this,t),n&&a(n)}},y=e=>{const o=e.prototype.onFocusEvent;e.prototype.onFocusEvent=function(t){const p=t.type==="focus"||t.type==="activate",n=t.target;(!p||!n.closest("[ui5-popover],[ui5-responsive-popover],[ui5-dialog]"))&&o.call(this,t)}},v=()=>{const e=new CSSStyleSheet;e.replaceSync(".sapMPopup-CTX:popover-open { inset: unset; }"),document.adoptedStyleSheets=[...document.adoptedStyleSheets,e]},d=e=>{l(e),u(e),v(),y(e)};export default d;
|
|
2
2
|
//# sourceMappingURL=patchPopup.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/features/patchPopup.ts"],
|
|
4
|
-
"sourcesContent": ["// OpenUI5's Element.js subset\ntype Element = {\n\tgetDomRef: () => HTMLElement | null,\n}\n\n// The lifecycle of Popup.js is open -> _opened -> close -> _closed, we're interested in the first (open) and last (_closed)\ntype OpenUI5Popup = {\n\tprototype: {\n\t\topen: (...args: any[]) => void,\n\t\t_closed: (...args: any[]) => void,\n\t\tgetOpenState: () => \"CLOSED\" | \"CLOSING\" | \"OPEN\" | \"OPENING\",\n\t\tgetContent: () => Element, // this is the OpenUI5 Element/Control instance that opens the Popup (usually sap.m.Popover/sap.m.Dialog)\n\t}\n};\n\nconst openNativePopover = (domRef: HTMLElement) => {\n\tdomRef.setAttribute(\"popover\", \"manual\");\n\tdomRef.showPopover();\n};\n\nconst closeNativePopover = (domRef: HTMLElement) => {\n\tif (domRef.hasAttribute(\"popover\")) {\n\t\tdomRef.hidePopover();\n\t\tdomRef.removeAttribute(\"popover\");\n\t}\n};\n\nconst patchOpen = (Popup: OpenUI5Popup) => {\n\tconst origOpen = Popup.prototype.open;\n\tPopup.prototype.open = function open(...args: any[]) {\n\t\torigOpen.apply(this, args); // call open first to initiate opening\n\t\tconst topLayerAlreadyInUse = !!document.body.querySelector(\":popover-open\"); // check if there is already something in the top layer\n\t\tconst openingInitiated = [\"OPENING\", \"OPEN\"].includes(this.getOpenState());\n\t\tif (openingInitiated && topLayerAlreadyInUse) {\n\t\t\tconst element = this.getContent();\n\t\t\tif (element) {\n\t\t\t\tconst domRef = element.getDomRef();\n\t\t\t\tif (domRef) {\n\t\t\t\t\topenNativePopover(domRef);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t};\n};\n\nconst patchClosed = (Popup: OpenUI5Popup) => {\n\tconst _origClosed = Popup.prototype._closed;\n\tPopup.prototype._closed = function _closed(...args: any[]) {\n\t\tconst element = this.getContent();\n\t\tconst domRef = element.getDomRef();\n\t\t_origClosed.apply(this, args); // only then call _close\n\t\tif (domRef) {\n\t\t\tcloseNativePopover(domRef); // unset the popover attribute and close the native popover, but only if still in DOM\n\t\t}\n\t};\n};\n\nconst createGlobalStyles = () => {\n\tconst stylesheet = new CSSStyleSheet();\n\tstylesheet.replaceSync(`.sapMPopup-CTX:popover-open { inset: unset; }`);\n\tdocument.adoptedStyleSheets = [...document.adoptedStyleSheets, stylesheet];\n};\n\nconst patchPopup = (Popup: OpenUI5Popup) => {\n\tpatchOpen(Popup); // Popup.prototype.open\n\tpatchClosed(Popup); // Popup.prototype._closed\n\tcreateGlobalStyles(); // Ensures correct popover positioning by OpenUI5 (otherwise 0,0 is the center of the screen)\n};\n\nexport default patchPopup;\nexport type { OpenUI5Popup };\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["openNativePopover", "domRef", "closeNativePopover", "patchOpen", "Popup", "origOpen", "args", "topLayerAlreadyInUse", "element", "patchClosed", "_origClosed", "createGlobalStyles", "stylesheet", "patchPopup"]
|
|
4
|
+
"sourcesContent": ["// OpenUI5's Element.js subset\ntype Element = {\n\tgetDomRef: () => HTMLElement | null,\n}\n\n// The lifecycle of Popup.js is open -> _opened -> close -> _closed, we're interested in the first (open) and last (_closed)\ntype OpenUI5Popup = {\n\tprototype: {\n\t\topen: (...args: any[]) => void,\n\t\t_closed: (...args: any[]) => void,\n\t\tgetOpenState: () => \"CLOSED\" | \"CLOSING\" | \"OPEN\" | \"OPENING\",\n\t\tgetContent: () => Element, // this is the OpenUI5 Element/Control instance that opens the Popup (usually sap.m.Popover/sap.m.Dialog)\n\t\tonFocusEvent: (e: FocusEvent) => void,\n\t}\n};\n\nconst openNativePopover = (domRef: HTMLElement) => {\n\tdomRef.setAttribute(\"popover\", \"manual\");\n\tdomRef.showPopover();\n};\n\nconst closeNativePopover = (domRef: HTMLElement) => {\n\tif (domRef.hasAttribute(\"popover\")) {\n\t\tdomRef.hidePopover();\n\t\tdomRef.removeAttribute(\"popover\");\n\t}\n};\n\nconst patchOpen = (Popup: OpenUI5Popup) => {\n\tconst origOpen = Popup.prototype.open;\n\tPopup.prototype.open = function open(...args: any[]) {\n\t\torigOpen.apply(this, args); // call open first to initiate opening\n\t\tconst topLayerAlreadyInUse = !!document.body.querySelector(\":popover-open\"); // check if there is already something in the top layer\n\t\tconst openingInitiated = [\"OPENING\", \"OPEN\"].includes(this.getOpenState());\n\t\tif (openingInitiated && topLayerAlreadyInUse) {\n\t\t\tconst element = this.getContent();\n\t\t\tif (element) {\n\t\t\t\tconst domRef = element.getDomRef();\n\t\t\t\tif (domRef) {\n\t\t\t\t\topenNativePopover(domRef);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t};\n};\n\nconst patchClosed = (Popup: OpenUI5Popup) => {\n\tconst _origClosed = Popup.prototype._closed;\n\tPopup.prototype._closed = function _closed(...args: any[]) {\n\t\tconst element = this.getContent();\n\t\tconst domRef = element.getDomRef();\n\t\t_origClosed.apply(this, args); // only then call _close\n\t\tif (domRef) {\n\t\t\tcloseNativePopover(domRef); // unset the popover attribute and close the native popover, but only if still in DOM\n\t\t}\n\t};\n};\n\nconst patchFocusEvent = (Popup: OpenUI5Popup) => {\n\tconst origFocusEvent = Popup.prototype.onFocusEvent;\n\tPopup.prototype.onFocusEvent = function onFocusEvent(e: FocusEvent) {\n\t\tconst isTypeFocus = e.type === \"focus\" || e.type === \"activate\";\n\t\tconst target = e.target as HTMLElement;\n\t\tif (!isTypeFocus || !target.closest(\"[ui5-popover],[ui5-responsive-popover],[ui5-dialog]\")) {\n\t\t\torigFocusEvent.call(this, e);\n\t\t}\n\t};\n};\n\nconst createGlobalStyles = () => {\n\tconst stylesheet = new CSSStyleSheet();\n\tstylesheet.replaceSync(`.sapMPopup-CTX:popover-open { inset: unset; }`);\n\tdocument.adoptedStyleSheets = [...document.adoptedStyleSheets, stylesheet];\n};\n\nconst patchPopup = (Popup: OpenUI5Popup) => {\n\tpatchOpen(Popup); // Popup.prototype.open\n\tpatchClosed(Popup); // Popup.prototype._closed\n\tcreateGlobalStyles(); // Ensures correct popover positioning by OpenUI5 (otherwise 0,0 is the center of the screen)\n\tpatchFocusEvent(Popup);// Popup.prototype.onFocusEvent\n};\n\nexport default patchPopup;\nexport type { OpenUI5Popup };\n"],
|
|
5
|
+
"mappings": "aAgBA,MAAMA,EAAqBC,GAAwB,CAClDA,EAAO,aAAa,UAAW,QAAQ,EACvCA,EAAO,YAAY,CACpB,EAEMC,EAAsBD,GAAwB,CAC/CA,EAAO,aAAa,SAAS,IAChCA,EAAO,YAAY,EACnBA,EAAO,gBAAgB,SAAS,EAElC,EAEME,EAAaC,GAAwB,CAC1C,MAAMC,EAAWD,EAAM,UAAU,KACjCA,EAAM,UAAU,KAAO,YAAiBE,EAAa,CACpDD,EAAS,MAAM,KAAMC,CAAI,EACzB,MAAMC,EAAuB,CAAC,CAAC,SAAS,KAAK,cAAc,eAAe,EAE1E,GADyB,CAAC,UAAW,MAAM,EAAE,SAAS,KAAK,aAAa,CAAC,GACjDA,EAAsB,CAC7C,MAAMC,EAAU,KAAK,WAAW,EAChC,GAAIA,EAAS,CACZ,MAAMP,EAASO,EAAQ,UAAU,EAC7BP,GACHD,EAAkBC,CAAM,CAE1B,CACD,CACD,CACD,EAEMQ,EAAeL,GAAwB,CAC5C,MAAMM,EAAcN,EAAM,UAAU,QACpCA,EAAM,UAAU,QAAU,YAAoBE,EAAa,CAE1D,MAAML,EADU,KAAK,WAAW,EACT,UAAU,EACjCS,EAAY,MAAM,KAAMJ,CAAI,EACxBL,GACHC,EAAmBD,CAAM,CAE3B,CACD,EAEMU,EAAmBP,GAAwB,CAChD,MAAMQ,EAAiBR,EAAM,UAAU,aACvCA,EAAM,UAAU,aAAe,SAAsBS,EAAe,CACnE,MAAMC,EAAcD,EAAE,OAAS,SAAWA,EAAE,OAAS,WAC/CE,EAASF,EAAE,QACb,CAACC,GAAe,CAACC,EAAO,QAAQ,qDAAqD,IACxFH,EAAe,KAAK,KAAMC,CAAC,CAE7B,CACD,EAEMG,EAAqB,IAAM,CAChC,MAAMC,EAAa,IAAI,cACvBA,EAAW,YAAY,+CAA+C,EACtE,SAAS,mBAAqB,CAAC,GAAG,SAAS,mBAAoBA,CAAU,CAC1E,EAEMC,EAAcd,GAAwB,CAC3CD,EAAUC,CAAK,EACfK,EAAYL,CAAK,EACjBY,EAAmB,EACnBL,EAAgBP,CAAK,CACtB,EAEA,eAAec",
|
|
6
|
+
"names": ["openNativePopover", "domRef", "closeNativePopover", "patchOpen", "Popup", "origOpen", "args", "topLayerAlreadyInUse", "element", "patchClosed", "_origClosed", "patchFocusEvent", "origFocusEvent", "e", "isTypeFocus", "target", "createGlobalStyles", "stylesheet", "patchPopup"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const e={version:"2.0.0
|
|
1
|
+
"use strict";const e={version:"2.0.0",major:2,minor:0,patch:0,suffix:"",isNext:!1,buildTime:1720013643};export default e;
|
|
2
2
|
//# sourceMappingURL=VersionInfo.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/generated/VersionInfo.ts"],
|
|
4
|
-
"sourcesContent": ["const VersionInfo = {\n\tversion: \"2.0.0
|
|
5
|
-
"mappings": "aAAA,MAAMA,EAAc,CACnB,QAAS,
|
|
4
|
+
"sourcesContent": ["const VersionInfo = {\n\tversion: \"2.0.0\",\n\tmajor: 2,\n\tminor: 0,\n\tpatch: 0,\n\tsuffix: \"\",\n\tisNext: false,\n\tbuildTime: 1720013643,\n};\nexport default VersionInfo;"],
|
|
5
|
+
"mappings": "aAAA,MAAMA,EAAc,CACnB,QAAS,QACT,MAAO,EACP,MAAO,EACP,MAAO,EACP,OAAQ,GACR,OAAQ,GACR,UAAW,UACZ,EACA,eAAeA",
|
|
6
6
|
"names": ["VersionInfo"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";import{render as
|
|
1
|
+
"use strict";import{render as i,html as p,svg as s}from"lit-html";import{getFeature as o}from"../FeaturesRegistry.js";const m=(t,...n)=>{const e=o("LitStatic");return(e?e.html:p)(t,...n)},a=(t,...n)=>{const e=o("LitStatic");return(e?e.svg:s)(t,...n)},l=(t,n,e)=>{const r=o("OpenUI5Enablement");r&&(t=r.wrapTemplateResultInBusyMarkup(m,e.host,t)),i(t,n,e)},f=(t,n,e)=>{const r=o("LitStatic");if(r)return r.unsafeStatic((n||[]).includes(t)?`${t}-${e}`:t)};export{m as html,a as svg};export{f as scopeTag};export{repeat}from"lit-html/directives/repeat.js";export{classMap}from"lit-html/directives/class-map.js";export{styleMap}from"./directives/style-map.js";export{ifDefined}from"lit-html/directives/if-defined.js";export{unsafeHTML}from"lit-html/directives/unsafe-html.js";export default l;
|
|
2
2
|
//# sourceMappingURL=LitRenderer.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/renderer/LitRenderer.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n\trender,\n\thtml,\n\tsvg,\n\
|
|
5
|
-
"mappings": "aAAA,OACC,UAAAA,EACA,QAAAC,EACA,OAAAC,
|
|
4
|
+
"sourcesContent": ["import {\n\trender,\n\thtml,\n\tsvg,\n} from \"lit-html\";\n\nimport type { TemplateResult } from \"lit-html\";\n\nimport { getFeature } from \"../FeaturesRegistry.js\";\nimport type { LitStatic } from \"../CustomElementsScope.js\";\nimport type OpenUI5Enablement from \"../features/OpenUI5Enablement.js\";\nimport type UI5Element from \"../UI5Element.js\";\nimport type { Renderer, RendererOptions } from \"../UI5Element.js\";\nimport type { TemplateFunctionResult } from \"./executeTemplate.js\";\n\nconst effectiveHtml = (strings: TemplateStringsArray, ...values: Array<unknown>) => {\n\tconst litStatic = getFeature<typeof LitStatic>(\"LitStatic\");\n\tconst fn = litStatic ? litStatic.html : html;\n\treturn fn(strings, ...values);\n};\n\nconst effectiveSvg = (strings: TemplateStringsArray, ...values: Array<unknown>) => {\n\tconst litStatic = getFeature<typeof LitStatic>(\"LitStatic\");\n\tconst fn = litStatic ? litStatic.svg : svg;\n\treturn fn(strings, ...values);\n};\n\nconst litRender: Renderer = (templateResult: TemplateFunctionResult, container: HTMLElement | DocumentFragment, options: RendererOptions) => {\n\tconst openUI5Enablement = getFeature<typeof OpenUI5Enablement>(\"OpenUI5Enablement\");\n\tif (openUI5Enablement) {\n\t\ttemplateResult = openUI5Enablement.wrapTemplateResultInBusyMarkup(effectiveHtml, options.host as UI5Element, templateResult as TemplateResult);\n\t}\n\n\trender(templateResult as TemplateResult, container, options);\n};\n\nconst scopeTag = (tag: string, tags: Array<string>, suffix: string) => {\n\tconst litStatic = getFeature<typeof LitStatic>(\"LitStatic\");\n\tif (litStatic) {\n\t\treturn litStatic.unsafeStatic((tags || []).includes(tag) ? `${tag}-${suffix}` : tag);\n\t}\n};\n\nexport {\n\teffectiveHtml as html,\n\teffectiveSvg as svg,\n};\nexport { scopeTag };\nexport { repeat } from \"lit-html/directives/repeat.js\";\nexport { classMap } from \"lit-html/directives/class-map.js\";\n// @ts-ignore style-map is a JS file\nexport { styleMap } from \"./directives/style-map.js\";\nexport { ifDefined } from \"lit-html/directives/if-defined.js\";\nexport { unsafeHTML } from \"lit-html/directives/unsafe-html.js\";\n\nexport default litRender;\n"],
|
|
5
|
+
"mappings": "aAAA,OACC,UAAAA,EACA,QAAAC,EACA,OAAAC,MACM,WAIP,OAAS,cAAAC,MAAkB,yBAO3B,MAAMC,EAAgB,CAACC,KAAkCC,IAA2B,CACnF,MAAMC,EAAYJ,EAA6B,WAAW,EAE1D,OADWI,EAAYA,EAAU,KAAON,GAC9BI,EAAS,GAAGC,CAAM,CAC7B,EAEME,EAAe,CAACH,KAAkCC,IAA2B,CAClF,MAAMC,EAAYJ,EAA6B,WAAW,EAE1D,OADWI,EAAYA,EAAU,IAAML,GAC7BG,EAAS,GAAGC,CAAM,CAC7B,EAEMG,EAAsB,CAACC,EAAwCC,EAA2CC,IAA6B,CAC5I,MAAMC,EAAoBV,EAAqC,mBAAmB,EAC9EU,IACHH,EAAiBG,EAAkB,+BAA+BT,EAAeQ,EAAQ,KAAoBF,CAAgC,GAG9IV,EAAOU,EAAkCC,EAAWC,CAAO,CAC5D,EAEME,EAAW,CAACC,EAAaC,EAAqBC,IAAmB,CACtE,MAAMV,EAAYJ,EAA6B,WAAW,EAC1D,GAAII,EACH,OAAOA,EAAU,cAAcS,GAAQ,CAAC,GAAG,SAASD,CAAG,EAAI,GAAGA,CAAG,IAAIE,CAAM,GAAKF,CAAG,CAErF,EAEA,OACCX,KAAiB,KACjBI,KAAgB,KAEjB,OAASM,KAAA,UACT,OAAS,WAAc,gCACvB,OAAS,aAAgB,mCAEzB,OAAS,aAAgB,4BACzB,OAAS,cAAiB,oCAC1B,OAAS,eAAkB,qCAE3B,eAAeL",
|
|
6
6
|
"names": ["render", "html", "svg", "getFeature", "effectiveHtml", "strings", "values", "litStatic", "effectiveSvg", "litRender", "templateResult", "container", "options", "openUI5Enablement", "scopeTag", "tag", "tags", "suffix"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";import r from"./getEffectiveStyle.js";import{attachCustomCSSChange as l}from"./CustomStyle.js";const e=new Map;l(t=>{e.delete(`${t}_normal`)});const
|
|
1
|
+
"use strict";import r from"./getEffectiveStyle.js";import{attachCustomCSSChange as l}from"./CustomStyle.js";const e=new Map;l(t=>{e.delete(`${t}_normal`)});const s=t=>{const n=`${t.getMetadata().getTag()}_normal`;if(!e.has(n)){const a=r(t),o=new CSSStyleSheet;o.replaceSync(a),e.set(n,[o])}return e.get(n)};export default s;
|
|
2
2
|
//# sourceMappingURL=getConstructableStyle.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/theming/getConstructableStyle.ts"],
|
|
4
|
-
"sourcesContent": ["import getEffectiveStyle from \"./getEffectiveStyle.js\";\nimport { attachCustomCSSChange } from \"./CustomStyle.js\";\nimport UI5Element from \"../UI5Element.js\";\n\nconst constructableStyleMap = new Map<string, Array<CSSStyleSheet>>();\n\nattachCustomCSSChange((tag: string) => {\n\tconstructableStyleMap.delete(`${tag}_normal`); // there is custom CSS only for the component itself, not for its static area part\n});\n\n/**\n * Returns (and caches) a constructable style sheet for a web component class\n * Note: Chrome\n * @param ElementClass\n * @returns {*}\n */\nconst getConstructableStyle = (ElementClass: typeof UI5Element) => {\n\tconst tag = ElementClass.getMetadata().getTag();\n\tconst key = `${tag}_normal`;\n\n\tif (!constructableStyleMap.has(key)) {\n\t\tconst styleContent = getEffectiveStyle(ElementClass);\n\t\tconst style = new CSSStyleSheet();\n\t\tstyle.replaceSync(styleContent);\n\t\tconstructableStyleMap.set(key, [style]);\n\t}\n\n\treturn constructableStyleMap.get(key)!;\n};\n\nexport default getConstructableStyle;\n"],
|
|
4
|
+
"sourcesContent": ["import getEffectiveStyle from \"./getEffectiveStyle.js\";\nimport { attachCustomCSSChange } from \"./CustomStyle.js\";\nimport type UI5Element from \"../UI5Element.js\";\n\nconst constructableStyleMap = new Map<string, Array<CSSStyleSheet>>();\n\nattachCustomCSSChange((tag: string) => {\n\tconstructableStyleMap.delete(`${tag}_normal`); // there is custom CSS only for the component itself, not for its static area part\n});\n\n/**\n * Returns (and caches) a constructable style sheet for a web component class\n * Note: Chrome\n * @param ElementClass\n * @returns {*}\n */\nconst getConstructableStyle = (ElementClass: typeof UI5Element) => {\n\tconst tag = ElementClass.getMetadata().getTag();\n\tconst key = `${tag}_normal`;\n\n\tif (!constructableStyleMap.has(key)) {\n\t\tconst styleContent = getEffectiveStyle(ElementClass);\n\t\tconst style = new CSSStyleSheet();\n\t\tstyle.replaceSync(styleContent);\n\t\tconstructableStyleMap.set(key, [style]);\n\t}\n\n\treturn constructableStyleMap.get(key)!;\n};\n\nexport default getConstructableStyle;\n"],
|
|
5
5
|
"mappings": "aAAA,OAAOA,MAAuB,yBAC9B,OAAS,yBAAAC,MAA6B,mBAGtC,MAAMC,EAAwB,IAAI,IAElCD,EAAuBE,GAAgB,CACtCD,EAAsB,OAAO,GAAGC,CAAG,SAAS,CAC7C,CAAC,EAQD,MAAMC,EAAyBC,GAAoC,CAElE,MAAMC,EAAM,GADAD,EAAa,YAAY,EAAE,OAAO,CAC5B,UAElB,GAAI,CAACH,EAAsB,IAAII,CAAG,EAAG,CACpC,MAAMC,EAAeP,EAAkBK,CAAY,EAC7CG,EAAQ,IAAI,cAClBA,EAAM,YAAYD,CAAY,EAC9BL,EAAsB,IAAII,EAAK,CAACE,CAAK,CAAC,CACvC,CAEA,OAAON,EAAsB,IAAII,CAAG,CACrC,EAEA,eAAeF",
|
|
6
6
|
"names": ["getEffectiveStyle", "attachCustomCSSChange", "constructableStyleMap", "tag", "getConstructableStyle", "ElementClass", "key", "styleContent", "style"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";import{getCustomCSS as i,attachCustomCSSChange as f}from"./CustomStyle.js";import r from"./getStylesString.js";import{getFeature as
|
|
1
|
+
"use strict";import{getCustomCSS as i,attachCustomCSSChange as f}from"./CustomStyle.js";import r from"./getStylesString.js";import{getFeature as p}from"../FeaturesRegistry.js";const e=new Map;f(t=>{e.delete(`${t}_normal`)});const y=t=>{const o=t.getMetadata().getTag(),n=`${o}_normal`,s=p("OpenUI5Enablement");if(!e.has(n)){let l="";s&&(l=r(s.getBusyIndicatorStyles()));const a=i(o)||"",m=`${r(t.styles)} ${a} ${l}`;e.set(n,m)}return e.get(n)};export default y;
|
|
2
2
|
//# sourceMappingURL=getEffectiveStyle.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/theming/getEffectiveStyle.ts"],
|
|
4
|
-
"sourcesContent": ["import { getCustomCSS, attachCustomCSSChange } from \"./CustomStyle.js\";\nimport getStylesString from \"./getStylesString.js\";\nimport { getFeature } from \"../FeaturesRegistry.js\";\nimport type UI5Element from \"../UI5Element.js\";\nimport OpenUI5Enablement from \"../features/OpenUI5Enablement.js\";\n\nconst effectiveStyleMap = new Map<string, string>();\n\nattachCustomCSSChange((tag: string) => {\n\teffectiveStyleMap.delete(`${tag}_normal`); // there is custom CSS only for the component itself, not for its static area part\n});\n\nconst getEffectiveStyle = (ElementClass: typeof UI5Element) => {\n\tconst tag = ElementClass.getMetadata().getTag();\n\tconst key = `${tag}_normal`;\n\tconst openUI5Enablement = getFeature<typeof OpenUI5Enablement>(\"OpenUI5Enablement\");\n\n\tif (!effectiveStyleMap.has(key)) {\n\t\tlet busyIndicatorStyles = \"\";\n\n\t\tif (openUI5Enablement) {\n\t\t\tbusyIndicatorStyles = getStylesString(openUI5Enablement.getBusyIndicatorStyles());\n\t\t}\n\n\t\tconst customStyle = getCustomCSS(tag) || \"\";\n\t\tconst builtInStyles = getStylesString(ElementClass.styles);\n\n\t\tconst effectiveStyle = `${builtInStyles} ${customStyle} ${busyIndicatorStyles}`;\n\t\teffectiveStyleMap.set(key, effectiveStyle);\n\t}\n\n\treturn effectiveStyleMap.get(key)!; // The key is guaranteed to exist\n};\n\nexport default getEffectiveStyle;\n"],
|
|
4
|
+
"sourcesContent": ["import { getCustomCSS, attachCustomCSSChange } from \"./CustomStyle.js\";\nimport getStylesString from \"./getStylesString.js\";\nimport { getFeature } from \"../FeaturesRegistry.js\";\nimport type UI5Element from \"../UI5Element.js\";\nimport type OpenUI5Enablement from \"../features/OpenUI5Enablement.js\";\n\nconst effectiveStyleMap = new Map<string, string>();\n\nattachCustomCSSChange((tag: string) => {\n\teffectiveStyleMap.delete(`${tag}_normal`); // there is custom CSS only for the component itself, not for its static area part\n});\n\nconst getEffectiveStyle = (ElementClass: typeof UI5Element) => {\n\tconst tag = ElementClass.getMetadata().getTag();\n\tconst key = `${tag}_normal`;\n\tconst openUI5Enablement = getFeature<typeof OpenUI5Enablement>(\"OpenUI5Enablement\");\n\n\tif (!effectiveStyleMap.has(key)) {\n\t\tlet busyIndicatorStyles = \"\";\n\n\t\tif (openUI5Enablement) {\n\t\t\tbusyIndicatorStyles = getStylesString(openUI5Enablement.getBusyIndicatorStyles());\n\t\t}\n\n\t\tconst customStyle = getCustomCSS(tag) || \"\";\n\t\tconst builtInStyles = getStylesString(ElementClass.styles);\n\n\t\tconst effectiveStyle = `${builtInStyles} ${customStyle} ${busyIndicatorStyles}`;\n\t\teffectiveStyleMap.set(key, effectiveStyle);\n\t}\n\n\treturn effectiveStyleMap.get(key)!; // The key is guaranteed to exist\n};\n\nexport default getEffectiveStyle;\n"],
|
|
5
5
|
"mappings": "aAAA,OAAS,gBAAAA,EAAc,yBAAAC,MAA6B,mBACpD,OAAOC,MAAqB,uBAC5B,OAAS,cAAAC,MAAkB,yBAI3B,MAAMC,EAAoB,IAAI,IAE9BH,EAAuBI,GAAgB,CACtCD,EAAkB,OAAO,GAAGC,CAAG,SAAS,CACzC,CAAC,EAED,MAAMC,EAAqBC,GAAoC,CAC9D,MAAMF,EAAME,EAAa,YAAY,EAAE,OAAO,EACxCC,EAAM,GAAGH,CAAG,UACZI,EAAoBN,EAAqC,mBAAmB,EAElF,GAAI,CAACC,EAAkB,IAAII,CAAG,EAAG,CAChC,IAAIE,EAAsB,GAEtBD,IACHC,EAAsBR,EAAgBO,EAAkB,uBAAuB,CAAC,GAGjF,MAAME,EAAcX,EAAaK,CAAG,GAAK,GAGnCO,EAAiB,GAFDV,EAAgBK,EAAa,MAAM,CAElB,IAAII,CAAW,IAAID,CAAmB,GAC7EN,EAAkB,IAAII,EAAKI,CAAc,CAC1C,CAEA,OAAOR,EAAkB,IAAII,CAAG,CACjC,EAEA,eAAeF",
|
|
6
6
|
"names": ["getCustomCSS", "attachCustomCSSChange", "getStylesString", "getFeature", "effectiveStyleMap", "tag", "getEffectiveStyle", "ElementClass", "key", "openUI5Enablement", "busyIndicatorStyles", "customStyle", "effectiveStyle"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const r=new WeakMap,o=new WeakMap,u={attributes:!0,childList:!0,characterData:!0,subtree:!0},v=e=>{const t=e;return t.accessibleNameRef?
|
|
1
|
+
"use strict";const r=new WeakMap,o=new WeakMap,u={attributes:!0,childList:!0,characterData:!0,subtree:!0},v=e=>{const t=e;return t.accessibleNameRef?m(e):t.accessibleName?t.accessibleName:void 0},m=e=>{const t=e.accessibleNameRef?.split(" ")??[],s=e.getRootNode();let l="";return t.forEach((a,c)=>{const n=s.querySelector(`[id='${a}']`),d=`${n&&n.textContent?n.textContent:""}`;d&&(l+=d,c<t.length-1&&(l+=" "))}),l},E=e=>{const t=new Set;return b(e).forEach(c=>{t.add(c)}),(e.accessibleNameRef?.split(" ")??[]).forEach(c=>{const n=g(e,c);n&&t.add(n)}),Array.from(t)},b=e=>{const t=e.getRootNode().querySelectorAll(`[for="${e.id}"]`);return Array.from(t)},g=(e,t)=>e.getRootNode().querySelector(`[id='${t}']`),M=e=>{const t=[];if(b(e).forEach(l=>{const a=l.textContent;a&&t.push(a)}),t.length)return t.join(" ")},k=e=>s=>{if(!(s&&s.type==="property"&&s.name==="accessibleNameRef"))return;const l=o.get(e);if(!l)return;const a=l.observedElements,c=E(e);a.forEach(n=>{c.includes(n)||i(l,n)}),c.forEach(n=>{a.includes(n)||(f(l,n),l.observedElements.push(n))}),l?.callback()},A=(e,t)=>{if(o.has(e))return;const s=E(e),l=k(e),a={host:e,observedElements:s,callback:t,invalidationCallback:l};o.set(e,a),e.attachInvalidate(l),s.forEach(c=>{f(a,c)}),t()},f=(e,t)=>{let s=r.get(t);if(!s){s={observer:null,callbacks:[]};const l=new MutationObserver(()=>{s.callbacks.forEach(n=>{n()});const c=document.getElementById(t.id);e.host.id===t.getAttribute("for")||c||i(e,t)});s.observer=l,l.observe(t,u),r.set(t,s)}s.callbacks.includes(e.callback)||s.callbacks.push(e.callback)},i=(e,t)=>{const s=r.get(t);s&&(s.callbacks=s.callbacks.filter(l=>l!==e.callback),s.callbacks.length||(s.observer?.disconnect(),r.delete(t))),e.observedElements=e.observedElements.filter(l=>l!==t)},T=e=>{const t=o.get(e);if(!t)return;[...t.observedElements].forEach(l=>{i(t,l)}),e.detachInvalidate(t.invalidationCallback),o.delete(e)};export{v as getEffectiveAriaLabelText,M as getAssociatedLabelForTexts,A as registerUI5Element,T as deregisterUI5Element,m as getAllAccessibleNameRefTexts};
|
|
2
2
|
//# sourceMappingURL=AriaLabelHelper.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/util/AriaLabelHelper.ts"],
|
|
4
|
-
"sourcesContent": ["import UI5Element
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import type UI5Element from \"../UI5Element.js\";\nimport type { ChangeInfo } from \"../UI5Element.js\";\n\ntype InvalidateCallback = (changeInfo: ChangeInfo) => void;\ntype MutationCallback = () => void;\ntype AssociatedElement = {\n\tobserver: MutationObserver | null;\n\tcallbacks: Array<MutationCallback>;\n};\ntype RegisteredElement = {\n\thost: UI5Element;\n\tobservedElements: Array<HTMLElement>;\n\tcallback: MutationCallback;\n\tinvalidationCallback: InvalidateCallback;\n};\n\nconst associatedElements = new WeakMap<HTMLElement, AssociatedElement>();\nconst registeredElements = new WeakMap<UI5Element, RegisteredElement>();\n\ntype AccessibleElement = HTMLElement & {\n\taccessibleNameRef?: string;\n\taccessibleName?: string;\n};\n\nconst observerOptions = {\n\tattributes: true,\n\tchildList: true,\n\tcharacterData: true,\n\tsubtree: true,\n};\n\nconst getEffectiveAriaLabelText = (el: HTMLElement) => {\n\tconst accessibleEl = el as AccessibleElement;\n\n\tif (!accessibleEl.accessibleNameRef) {\n\t\tif (accessibleEl.accessibleName) {\n\t\t\treturn accessibleEl.accessibleName;\n\t\t}\n\n\t\treturn undefined;\n\t}\n\n\treturn getAllAccessibleNameRefTexts(el);\n};\n\n/**\n *\n * @param {HTMLElement} el Defines the HTMLElement, for which you need to get all related texts\n */\nconst getAllAccessibleNameRefTexts = (el: HTMLElement) => {\n\tconst ids = (el as AccessibleElement).accessibleNameRef?.split(\" \") ?? [];\n\tconst owner = el.getRootNode() as HTMLElement;\n\tlet result = \"\";\n\n\tids.forEach((elementId: string, index: number) => {\n\t\tconst element = owner.querySelector(`[id='${elementId}']`);\n\t\tconst text = `${element && element.textContent ? element.textContent : \"\"}`;\n\t\tif (text) {\n\t\t\tresult += text;\n\t\t\tif (index < ids.length - 1) {\n\t\t\t\tresult += \" \";\n\t\t\t}\n\t\t}\n\t});\n\n\treturn result;\n};\n\nconst _getAllAssociatedElementsFromDOM = (el: UI5Element): Array<HTMLElement> => {\n\tconst set = new Set<HTMLElement>();\n\t// adding labels with attribute for matching the el.id\n\tconst labelsForAssociated = _getAssociatedLabels(el);\n\tlabelsForAssociated.forEach(itm => {\n\t\tset.add(itm);\n\t});\n\t// adding other elements that id is the same as accessibleNameRef value\n\tconst value = el[\"accessibleNameRef\" as keyof typeof el] as string;\n\tconst ids = value?.split(\" \") ?? [];\n\tids.forEach(id => {\n\t\tconst refEl = _getReferencedElementById(el, id);\n\t\tif (refEl) {\n\t\t\tset.add(refEl);\n\t\t}\n\t});\n\treturn Array.from(set);\n};\n\nconst _getAssociatedLabels = (el: HTMLElement): Array<HTMLElement> => {\n\tconst labels = (el.getRootNode() as HTMLElement).querySelectorAll<HTMLElement>(`[for=\"${el.id}\"]`);\n\treturn Array.from(labels);\n};\n\nconst _getReferencedElementById = (el: HTMLElement, elementId: string): HTMLElement | null => {\n\treturn (el.getRootNode() as HTMLElement).querySelector<HTMLElement>(`[id='${elementId}']`);\n};\n\n/**\n * @param {HTMLElement} el Defines the HTMLElement, for which you need to get all related \"label for\" texts\n */\nconst getAssociatedLabelForTexts = (el: HTMLElement) => {\n\tconst results: Array<string> = [];\n\tconst labels = _getAssociatedLabels(el);\n\n\tlabels.forEach((label: HTMLElement) => {\n\t\tconst labelText = label.textContent;\n\t\tlabelText && results.push(labelText);\n\t});\n\n\tif (results.length) {\n\t\treturn results.join(\" \");\n\t}\n\n\treturn undefined;\n};\n\nconst _createInvalidationCallback = (el: UI5Element) => {\n\tconst invalidationCallback = (changeInfo: ChangeInfo) => {\n\t\tif (!(changeInfo && changeInfo.type === \"property\" && changeInfo.name === \"accessibleNameRef\")) {\n\t\t\treturn;\n\t\t}\n\t\tconst registeredElement = registeredElements.get(el);\n\t\tif (!registeredElement) {\n\t\t\treturn;\n\t\t}\n\t\tconst oldAssociatedElements = registeredElement.observedElements;\n\t\tconst newAssociatedElements = _getAllAssociatedElementsFromDOM(el);\n\t\toldAssociatedElements.forEach(oldElement => {\n\t\t\tif (!newAssociatedElements.includes(oldElement)) {\n\t\t\t\t_removeObservedElementFromRegisteredElement(registeredElement, oldElement);\n\t\t\t}\n\t\t});\n\t\tnewAssociatedElements.forEach(newElement => {\n\t\t\tif (!oldAssociatedElements.includes(newElement)) {\n\t\t\t\t_addObservedElementToRegisteredElement(registeredElement, newElement);\n\t\t\t\tregisteredElement.observedElements.push(newElement);\n\t\t\t}\n\t\t});\n\t\tregisteredElement?.callback();\n\t};\n\treturn invalidationCallback;\n};\n\nconst registerUI5Element = (el: UI5Element, callback: MutationCallback) => {\n\tif (registeredElements.has(el)) {\n\t\treturn;\n\t}\n\tconst allAssociatedElements = _getAllAssociatedElementsFromDOM(el);\n\tconst invalidationCallback = _createInvalidationCallback(el);\n\tconst registeredElement = {\n\t\thost: el,\n\t\tobservedElements: allAssociatedElements,\n\t\tcallback,\n\t\tinvalidationCallback,\n\t};\n\tregisteredElements.set(el, registeredElement);\n\tel.attachInvalidate(invalidationCallback);\n\n\tallAssociatedElements.forEach((element: HTMLElement) => {\n\t\t_addObservedElementToRegisteredElement(registeredElement, element);\n\t});\n\tcallback();\n};\n\nconst _addObservedElementToRegisteredElement = (registeredElement: RegisteredElement, element: HTMLElement) => {\n\tlet associatedElement = associatedElements.get(element);\n\tif (!associatedElement) {\n\t\tassociatedElement = { observer: null, callbacks: [] };\n\t\tconst observer = new MutationObserver(() => {\n\t\t\tconst callbacks = (associatedElement as AssociatedElement).callbacks;\n\t\t\tcallbacks.forEach(callback => {\n\t\t\t\tcallback();\n\t\t\t});\n\t\t\tconst domEl = document.getElementById(element.id);\n\t\t\t// if no longer should be observed from this registeredElement, remove it\n\t\t\tif (!(registeredElement.host.id === element.getAttribute(\"for\") || domEl)) {\n\t\t\t\t_removeObservedElementFromRegisteredElement(registeredElement, element);\n\t\t\t}\n\t\t});\n\t\tassociatedElement.observer = observer;\n\t\tobserver.observe(element, observerOptions);\n\t\tassociatedElements.set(element, associatedElement);\n\t}\n\tif (!associatedElement.callbacks.includes(registeredElement.callback)) {\n\t\tassociatedElement.callbacks.push(registeredElement.callback);\n\t}\n};\n\nconst _removeObservedElementFromRegisteredElement = (registeredElement: RegisteredElement, element: HTMLElement) => {\n\tconst associatedElement = associatedElements.get(element);\n\tif (associatedElement) {\n\t\tassociatedElement.callbacks = associatedElement.callbacks.filter(itm => itm !== registeredElement.callback);\n\t\tif (!associatedElement.callbacks.length) {\n\t\t\tassociatedElement.observer?.disconnect();\n\t\t\tassociatedElements.delete(element);\n\t\t}\n\t}\n\tregisteredElement.observedElements = registeredElement.observedElements.filter(itm => itm !== element);\n};\n\nconst deregisterUI5Element = (el: UI5Element) => {\n\tconst registeredElement = registeredElements.get(el);\n\tif (!registeredElement) {\n\t\treturn;\n\t}\n\tconst oldObservedElements = [...registeredElement.observedElements];\n\toldObservedElements.forEach(observedElement => {\n\t\t_removeObservedElementFromRegisteredElement(registeredElement, observedElement);\n\t});\n\tel.detachInvalidate(registeredElement.invalidationCallback);\n\tregisteredElements.delete(el);\n};\n\nexport {\n\tgetEffectiveAriaLabelText,\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elText", "el", "accessibleEl", "getAllAccessibleNameRefTexts", "ids", "owner", "result", "elementId", "index", "element", "text", "_getAllAssociatedElementsFromDOM", "set", "_getAssociatedLabels", "itm", "id", "refEl", "_getReferencedElementById", "labels", "getAssociatedLabelForTexts", "results", "label", "labelText", "_createInvalidationCallback", "changeInfo", "registeredElement", "oldAssociatedElements", "newAssociatedElements", "oldElement", "_removeObservedElementFromRegisteredElement", "newElement", "_addObservedElementToRegisteredElement", "registerUI5Element", "callback", "allAssociatedElements", "invalidationCallback", "associatedElement", "observer", "domEl", "deregisterUI5Element", "observedElement"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";import
|
|
1
|
+
"use strict";import o from"./isElementTabbable.js";const b=t=>a([...t.children]),E=t=>{const n=a([...t.children]);return n.length?n[n.length-1]:null},a=(t,n)=>{const l=n||[];return t&&t.forEach(r=>{if(r.nodeType===Node.TEXT_NODE||r.nodeType===Node.COMMENT_NODE)return;const e=r;if(!e.hasAttribute("data-sap-no-tab-ref"))if(o(e)&&l.push(e),e.tagName==="SLOT")a(e.assignedNodes(),l);else{const s=e.shadowRoot?e.shadowRoot.children:e.children;a([...s],l)}}),l};export{b as getTabbableElements,E as getLastTabbableElement};
|
|
2
2
|
//# sourceMappingURL=TabbableElements.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/util/TabbableElements.ts"],
|
|
4
|
-
"sourcesContent": ["import isElementTabbable from \"./isElementTabbable.js\";\n\n/**\n * Returns the tabbable elements within the provided HTMLElement.\n *\n * @public\n * @param { HTMLElement } el the component to operate on (component that slots or contains within its shadow root the items the user navigates among)\n * @returns { Array<HTMLElement> } the tabbable elements\n */\nconst getTabbableElements = (el: HTMLElement): Array<HTMLElement> => {\n\treturn getTabbables([...el.children]);\n};\n\n/**\n * Returns the last tabbable element within the provided HTMLElement.\n *\n * @public\n * @param { HTMLElement } el the component to operate on (component that slots or contains within its shadow root the items the user navigates among)\n * @returns { HTMLElement | null } the last tabbable element or \"null\" if not found\n */\nconst getLastTabbableElement = (el: HTMLElement): HTMLElement | null => {\n\tconst tabbables = getTabbables([...el.children]);\n\treturn tabbables.length ? tabbables[tabbables.length - 1] : null;\n};\n\nconst getTabbables = (nodes: Array<Node>, tabbables?: Array<HTMLElement>): Array<HTMLElement> => {\n\tconst tabbableElements = tabbables || [];\n\n\tif (!nodes) {\n\t\treturn tabbableElements;\n\t}\n\n\tnodes.forEach(currentNode => {\n\t\tif (currentNode.nodeType === Node.TEXT_NODE || currentNode.nodeType === Node.COMMENT_NODE) {\n\t\t\treturn;\n\t\t}\n\n\t\
|
|
5
|
-
"mappings": "aAAA,OAAOA,MAAuB,yBAS9B,MAAMC,EAAuBC,GACrBC,EAAa,CAAC,GAAGD,EAAG,QAAQ,CAAC,EAU/BE,EAA0BF,GAAwC,CACvE,MAAMG,EAAYF,EAAa,CAAC,GAAGD,EAAG,QAAQ,CAAC,EAC/C,OAAOG,EAAU,OAASA,EAAUA,EAAU,OAAS,CAAC,EAAI,IAC7D,EAEMF,EAAe,CAACG,EAAoBD,IAAuD,CAChG,MAAME,EAAmBF,GAAa,CAAC,EAEvC,OAAKC,GAILA,EAAM,QAAQE,GAAe,CAC5B,GAAIA,EAAY,WAAa,KAAK,WAAaA,EAAY,WAAa,KAAK,aAC5E,OAGD,
|
|
6
|
-
"names": ["isElementTabbable", "getTabbableElements", "el", "getTabbables", "getLastTabbableElement", "tabbables", "nodes", "tabbableElements", "currentNode", "currentElement", "children"
|
|
4
|
+
"sourcesContent": ["import isElementTabbable from \"./isElementTabbable.js\";\n\n/**\n * Returns the tabbable elements within the provided HTMLElement.\n *\n * @public\n * @param { HTMLElement } el the component to operate on (component that slots or contains within its shadow root the items the user navigates among)\n * @returns { Array<HTMLElement> } the tabbable elements\n */\nconst getTabbableElements = (el: HTMLElement): Array<HTMLElement> => {\n\treturn getTabbables([...el.children]);\n};\n\n/**\n * Returns the last tabbable element within the provided HTMLElement.\n *\n * @public\n * @param { HTMLElement } el the component to operate on (component that slots or contains within its shadow root the items the user navigates among)\n * @returns { HTMLElement | null } the last tabbable element or \"null\" if not found\n */\nconst getLastTabbableElement = (el: HTMLElement): HTMLElement | null => {\n\tconst tabbables = getTabbables([...el.children]);\n\treturn tabbables.length ? tabbables[tabbables.length - 1] : null;\n};\n\nconst getTabbables = (nodes: Array<Node>, tabbables?: Array<HTMLElement>): Array<HTMLElement> => {\n\tconst tabbableElements = tabbables || [];\n\n\tif (!nodes) {\n\t\treturn tabbableElements;\n\t}\n\n\tnodes.forEach(currentNode => {\n\t\tif (currentNode.nodeType === Node.TEXT_NODE || currentNode.nodeType === Node.COMMENT_NODE) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst currentElement = currentNode as HTMLElement;\n\t\tif (currentElement.hasAttribute(\"data-sap-no-tab-ref\")) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (isElementTabbable(currentElement)) {\n\t\t\ttabbableElements.push(currentElement);\n\t\t}\n\n\t\tif (currentElement.tagName === \"SLOT\") {\n\t\t\tgetTabbables((currentElement as HTMLSlotElement).assignedNodes() as Array<HTMLElement>, tabbableElements);\n\t\t} else {\n\t\t\tconst children = currentElement.shadowRoot ? currentElement.shadowRoot.children : currentElement.children;\n\t\t\tgetTabbables([...children], tabbableElements);\n\t\t}\n\t});\n\n\treturn tabbableElements;\n};\n\nexport {\n\tgetTabbableElements,\n\tgetLastTabbableElement,\n};\n"],
|
|
5
|
+
"mappings": "aAAA,OAAOA,MAAuB,yBAS9B,MAAMC,EAAuBC,GACrBC,EAAa,CAAC,GAAGD,EAAG,QAAQ,CAAC,EAU/BE,EAA0BF,GAAwC,CACvE,MAAMG,EAAYF,EAAa,CAAC,GAAGD,EAAG,QAAQ,CAAC,EAC/C,OAAOG,EAAU,OAASA,EAAUA,EAAU,OAAS,CAAC,EAAI,IAC7D,EAEMF,EAAe,CAACG,EAAoBD,IAAuD,CAChG,MAAME,EAAmBF,GAAa,CAAC,EAEvC,OAAKC,GAILA,EAAM,QAAQE,GAAe,CAC5B,GAAIA,EAAY,WAAa,KAAK,WAAaA,EAAY,WAAa,KAAK,aAC5E,OAGD,MAAMC,EAAiBD,EACvB,GAAI,CAAAC,EAAe,aAAa,qBAAqB,EAQrD,GAJIT,EAAkBS,CAAc,GACnCF,EAAiB,KAAKE,CAAc,EAGjCA,EAAe,UAAY,OAC9BN,EAAcM,EAAmC,cAAc,EAAyBF,CAAgB,MAClG,CACN,MAAMG,EAAWD,EAAe,WAAaA,EAAe,WAAW,SAAWA,EAAe,SACjGN,EAAa,CAAC,GAAGO,CAAQ,EAAGH,CAAgB,CAC7C,CACD,CAAC,EAEMA,CACR,EAEA,OACCN,KAAA,oBACAG,KAAA",
|
|
6
|
+
"names": ["isElementTabbable", "getTabbableElements", "el", "getTabbables", "getLastTabbableElement", "tabbables", "nodes", "tabbableElements", "currentNode", "currentElement", "children"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";let e=null;const u=(o
|
|
1
|
+
"use strict";let e=null;const u=(t,o)=>{e&&clearTimeout(e),e=setTimeout(()=>{e=null,t()},o)};export default u;
|
|
2
2
|
//# sourceMappingURL=debounce.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/util/debounce.ts"],
|
|
4
|
-
"sourcesContent": ["import { Timeout } from \"../types.js\";\n\n/**\n * Delays function execution by given threshold.\n * @param fn {Function}\n * @param delay {Integer}\n */\nlet debounceInterval: Timeout | null = null;\n\nconst debounce = (fn: () => void, delay: number) => {\n\tdebounceInterval && clearTimeout(debounceInterval);\n\tdebounceInterval = setTimeout(() => {\n\t\tdebounceInterval = null;\n\t\tfn();\n\t}, delay);\n};\n\nexport default debounce;\n"],
|
|
4
|
+
"sourcesContent": ["import type { Timeout } from \"../types.js\";\n\n/**\n * Delays function execution by given threshold.\n * @param fn {Function}\n * @param delay {Integer}\n */\nlet debounceInterval: Timeout | null = null;\n\nconst debounce = (fn: () => void, delay: number) => {\n\tdebounceInterval && clearTimeout(debounceInterval);\n\tdebounceInterval = setTimeout(() => {\n\t\tdebounceInterval = null;\n\t\tfn();\n\t}, delay);\n};\n\nexport default debounce;\n"],
|
|
5
5
|
"mappings": "aAOA,IAAIA,EAAmC,KAEvC,MAAMC,EAAW,CAACC,EAAgBC,IAAkB,CACnDH,GAAoB,aAAaA,CAAgB,EACjDA,EAAmB,WAAW,IAAM,CACnCA,EAAmB,KACnBE,EAAG,CACJ,EAAGC,CAAK,CACT,EAEA,eAAeF",
|
|
6
6
|
"names": ["debounceInterval", "debounce", "fn", "delay"]
|
|
7
7
|
}
|