package.dist.ListItemBase.js.map Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of webcomponents Show documentation
Show all versions of webcomponents Show documentation
UI5 Web Components: webcomponents.main
The newest version!
{"version":3,"file":"ListItemBase.js","sourceRoot":"","sources":["../src/ListItemBase.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,UAAU,MAAM,4CAA4C,CAAC;AACpE,OAAO,aAAa,MAAM,0DAA0D,CAAC;AACrF,OAAO,SAAS,MAAM,sDAAsD,CAAC;AAC7E,OAAO,QAAQ,MAAM,qDAAqD,CAAC;AAC3E,OAAO,KAAK,MAAM,kDAAkD,CAAC;AAGrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uDAAuD,CAAC;AAC5F,OAAO,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAC;AACnE,OAAO,EACN,OAAO,EACP,OAAO,EACP,SAAS,EACT,aAAa,GACb,MAAM,sCAAsC,CAAC;AAC9C,OAAO,gBAAgB,MAAM,uDAAuD,CAAC;AACrF,OAAO,EAAE,YAAY,EAAE,MAAM,8CAA8C,CAAC;AAE5E,SAAS;AACT,OAAO,MAAM,MAAM,wCAAwC,CAAC;AAC5D,OAAO,sBAAsB,MAAM,4CAA4C,CAAC;AAQhF;;;;;;;;GAQG;AAUH,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,UAAU;IAArC;;QACC;;;;WAIG;QAEH,aAAQ,GAAG,KAAK,CAAC;QAEjB;;;;;WAKG;QAEH,YAAO,GAAG,KAAK,CAAC;QAEhB;;;UAGE;QAEF,cAAS,GAAG,KAAK,CAAC;QAKlB;;;;;;;UAOE;QAEF,aAAQ,GAAG,KAAK,CAAC;QAEjB;;;WAGG;QAEH,YAAO,GAAG,KAAK,CAAC;QAEhB;;;WAGG;QAEH,eAAU,GAAG,KAAK,CAAC;IAwIpB,CAAC;IAtIA,UAAU;QACT,IAAI,SAAS,EAAE,EAAE;YAChB,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE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AAY,CA2LjB;AAED,eAAe,YAAY,CAAC","sourcesContent":["import UI5Element from \"@ui5/webcomponents-base/dist/UI5Element.js\";\nimport customElement from \"@ui5/webcomponents-base/dist/decorators/customElement.js\";\nimport litRender from \"@ui5/webcomponents-base/dist/renderer/LitRenderer.js\";\nimport property from \"@ui5/webcomponents-base/dist/decorators/property.js\";\nimport event from \"@ui5/webcomponents-base/dist/decorators/event.js\";\nimport type { ITabbable } from \"@ui5/webcomponents-base/dist/delegate/ItemNavigation.js\";\nimport type { ClassMap } from \"@ui5/webcomponents-base/dist/types.js\";\nimport { getTabbableElements } from \"@ui5/webcomponents-base/dist/util/TabbableElements.js\";\nimport { isDesktop } from \"@ui5/webcomponents-base/dist/Device.js\";\nimport {\n\tisEnter,\n\tisSpace,\n\tisTabNext,\n\tisTabPrevious,\n} from \"@ui5/webcomponents-base/dist/Keys.js\";\nimport getActiveElement from \"@ui5/webcomponents-base/dist/util/getActiveElement.js\";\nimport { getEventMark } from \"@ui5/webcomponents-base/dist/MarkedEvents.js\";\n\n// Styles\nimport styles from \"./generated/themes/ListItemBase.css.js\";\nimport draggableElementStyles from \"./generated/themes/DraggableElement.css.js\";\n\ntype ListItemBasePressEventDetail = {\n\titem: ListItemBase,\n\tselected: boolean,\n\tkey: string,\n}\n\n/**\n * @class\n * A class to serve as a foundation\n * for the `ListItem` and `ListItemGroupHeader` classes.\n * @constructor\n * @abstract\n * @extends UI5Element\n * @public\n */\n@customElement({\n\trenderer: litRender,\n\tstyles: [styles, draggableElementStyles],\n})\n@event(\"_request-tabindex-change\")\n@event(\"_press\")\n@event(\"_focused\")\n@event(\"_forward-after\")\n@event(\"_forward-before\")\nclass ListItemBase extends UI5Element implements ITabbable {\n\t/**\n\t * Defines the selected state of the component.\n\t * @default false\n\t * @private\n\t */\n\t@property({ type: Boolean })\n\tselected = false;\n\n\t/**\n\t * Defines whether the item is movable.\n\t * @default false\n\t * @private\n\t * @since 2.0.0\n\t */\n\t@property({ type: Boolean })\n\tmovable = false;\n\n\t/**\n\t* Defines if the list item should display its bottom border.\n\t* @private\n\t*/\n\t@property({ type: Boolean })\n\thasBorder = false;\n\n\t@property()\n\tforcedTabIndex?: string;\n\n\t/**\n\t* Defines whether `ui5-li` is in disabled state.\n\t*\n\t* **Note:** A disabled `ui5-li` is noninteractive.\n\t* @default false\n\t* @protected\n\t* @since 1.0.0-rc.12\n\t*/\n\t@property({ type: Boolean })\n\tdisabled = false;\n\n\t/**\n\t * Indicates if the element is on focus\n\t * @private\n\t */\n\t@property({ type: Boolean })\n\tfocused = false;\n\n\t/**\n\t * Indicates if the list item is actionable, e.g has hover and pressed effects.\n\t * @private\n\t */\n\t@property({ type: Boolean })\n\tactionable = false;\n\n\tonEnterDOM() {\n\t\tif (isDesktop()) {\n\t\t\tthis.setAttribute(\"desktop\", \"\");\n\t\t}\n\t}\n\n\tonBeforeRendering(): void {\n\t\tthis.actionable = true;\n\t}\n\n\t_onfocusin(e: FocusEvent) {\n\t\tthis.fireEvent(\"_request-tabindex-change\", e);\n\t\tif (e.target !== this.getFocusDomRef()) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.fireEvent(\"_focused\", e);\n\t}\n\n\t_onkeydown(e: KeyboardEvent) {\n\t\tif (isTabNext(e)) {\n\t\t\treturn this._handleTabNext(e);\n\t\t}\n\n\t\tif (isTabPrevious(e)) {\n\t\t\treturn this._handleTabPrevious(e);\n\t\t}\n\n\t\tif (getEventMark(e) === \"button\") {\n\t\t\treturn;\n\t\t}\n\n\t\tif (isSpace(e)) {\n\t\t\te.preventDefault();\n\t\t}\n\n\t\tif (isEnter(e)) {\n\t\t\tthis.fireItemPress(e);\n\t\t}\n\t}\n\n\t_onkeyup(e: KeyboardEvent) {\n\t\tif (getEventMark(e) === \"button\") {\n\t\t\treturn;\n\t\t}\n\t\tif (isSpace(e)) {\n\t\t\tthis.fireItemPress(e);\n\t\t}\n\t}\n\n\t_onclick(e: MouseEvent) {\n\t\tif (getEventMark(e) === \"button\") {\n\t\t\treturn;\n\t\t}\n\t\tthis.fireItemPress(e);\n\t}\n\n\tfireItemPress(e: Event) {\n\t\tif (this.disabled || !this._pressable) {\n\t\t\treturn;\n\t\t}\n\t\tif (isEnter(e as KeyboardEvent)) {\n\t\t\te.preventDefault();\n\t\t}\n\t\tthis.fireEvent(\"_press\", { item: this, selected: this.selected, key: (e as KeyboardEvent).key });\n\t}\n\n\t_handleTabNext(e: KeyboardEvent) {\n\t\tif (this.shouldForwardTabAfter()) {\n\t\t\tif (!this.fireEvent(\"_forward-after\", {}, true)) {\n\t\t\t\te.preventDefault();\n\t\t\t}\n\t\t}\n\t}\n\n\t_handleTabPrevious(e: KeyboardEvent) {\n\t\tconst target = e.target as HTMLElement;\n\n\t\tif (this.shouldForwardTabBefore(target)) {\n\t\t\tthis.fireEvent(\"_forward-before\");\n\t\t}\n\t}\n\n\t/**\n\t * Determines if th current list item either has no tabbable content or\n\t * [Tab] is performed onto the last tabbale content item.\n\t */\n\tshouldForwardTabAfter() {\n\t\tconst aContent = getTabbableElements(this.getFocusDomRef()!);\n\n\t\treturn aContent.length === 0 || (aContent[aContent.length - 1] === getActiveElement());\n\t}\n\n\t/**\n\t * Determines if the current list item is target of [SHIFT+TAB].\n\t */\n\tshouldForwardTabBefore(target: HTMLElement) {\n\t\treturn this.getFocusDomRef() === target;\n\t}\n\n\tget classes(): ClassMap {\n\t\treturn {\n\t\t\tmain: {\n\t\t\t\t\"ui5-li-root\": true,\n\t\t\t\t\"ui5-li--focusable\": this._focusable,\n\t\t\t},\n\t\t};\n\t}\n\n\tget _ariaDisabled() {\n\t\treturn this.disabled ? true : undefined;\n\t}\n\n\tget _focusable() {\n\t\treturn !this.disabled;\n\t}\n\n\tget _pressable() {\n\t\treturn true;\n\t}\n\n\tget hasConfigurableMode() {\n\t\treturn false;\n\t}\n\n\tget _effectiveTabIndex() {\n\t\tif (!this._focusable) {\n\t\t\treturn -1;\n\t\t}\n\t\tif (this.selected) {\n\t\t\treturn 0;\n\t\t}\n\t\treturn this.forcedTabIndex;\n\t}\n}\n\nexport default ListItemBase;\n\nexport type {\n\tListItemBasePressEventDetail,\n};\n"]}