-
Notifications
You must be signed in to change notification settings - Fork 273
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ui5-table): action header cell is added
- Loading branch information
Showing
20 changed files
with
374 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,7 @@ | ||
{{#if _popin}} | ||
{{#if _popinText}} | ||
{{_popinText}} | ||
<span class="popin-colon">{{_i18nPopinColon}}</span> | ||
{{else if _popinHeader}} | ||
{{_popinHeader}} | ||
<span class="popin-colon">{{_i18nPopinColon}}</span> | ||
{{/if}} | ||
<slot></slot> | ||
{{else}} | ||
<slot></slot> | ||
{{/if}} | ||
{{#each _popinHeaderNodes}} | ||
{{this}} | ||
{{/each}} | ||
<span class="popin-colon">{{_i18nPopinColon}}</span> | ||
{{/if}} | ||
<slot></slot> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
<slot></slot> | ||
<slot name="action"></slot> | ||
<slot></slot> | ||
{{#if _sortIcon}} | ||
<ui5-icon name="{{_sortIcon}}"></ui5-icon> | ||
{{/if}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { customElement, i18n } from "@ui5/webcomponents-base/dist/decorators.js"; | ||
import TableHeaderCellActionBase from "./TableHeaderCellActionBase.js"; | ||
import { TABLE_GENERATED_BY_AI } from "./generated/i18n/i18n-defaults.js"; | ||
import type I18nBundle from "@ui5/webcomponents-base/dist/i18nBundle.js"; | ||
import "@ui5/webcomponents-icons/dist/ai.js"; | ||
|
||
/** | ||
* @class | ||
* | ||
* ### Overview | ||
* | ||
* The `ui5-table-header-cell-action-ai` component defines a dedicated AI action for the table column. | ||
* | ||
* ### ES6 Module Import | ||
* | ||
* `import "@ui5/webcomponents/dist/TableHeaderCellActionAI.js";` | ||
* | ||
* @constructor | ||
* @extends TableHeaderCellActionBase | ||
* @since 2.7.0 | ||
* @public | ||
*/ | ||
@customElement({ tag: "ui5-table-header-cell-action-ai" }) | ||
|
||
class TableHeaderCellActionAI extends TableHeaderCellActionBase { | ||
@i18n("@ui5/webcomponents") | ||
static i18nBundle: I18nBundle; | ||
|
||
getRenderInfo() { | ||
return { | ||
icon: "ai", | ||
tooltip: TableHeaderCellActionAI.i18nBundle.getText(TABLE_GENERATED_BY_AI), | ||
}; | ||
} | ||
} | ||
|
||
TableHeaderCellActionAI.define(); | ||
|
||
export default TableHeaderCellActionAI; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<ui5-button | ||
icon="{{_icon}}" | ||
tooltip="{{_tooltip}}" | ||
@click={{_onClick}} | ||
design="Transparent"> | ||
</ui5-button> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js"; | ||
import { customElement, eventStrict } from "@ui5/webcomponents-base/dist/decorators.js"; | ||
import litRender from "@ui5/webcomponents-base/dist/renderer/LitRenderer.js"; | ||
import TableHeaderCellActionBaseTemplate from "./generated/templates/TableHeaderCellActionBaseTemplate.lit.js"; | ||
import TableHeaderCellActionBaseStyles from "./generated/themes/TableHeaderCellActionBase.css.js"; | ||
import Button from "./Button.js"; | ||
import type TableCell from "./TableCell.js"; | ||
|
||
/** | ||
* @class | ||
* The `TableHeaderCellActionBase` class serves as a foundation for table header cell actions. | ||
* @constructor | ||
* @abstract | ||
* @extends UI5Element | ||
* @since 2.7.0 | ||
* @public | ||
*/ | ||
@customElement({ | ||
renderer: litRender, | ||
styles: TableHeaderCellActionBaseStyles, | ||
template: TableHeaderCellActionBaseTemplate, | ||
dependencies: [Button], | ||
}) | ||
|
||
/** | ||
* Fired when an action is clicked. | ||
* | ||
* @public | ||
* @since 2.7.0 | ||
*/ | ||
@eventStrict("click", { | ||
bubbles: false, | ||
}) | ||
|
||
abstract class TableHeaderCellActionBase extends UI5Element { | ||
eventDetails!: { | ||
"click": void | ||
} | ||
|
||
abstract getRenderInfo(): { | ||
icon: string; | ||
tooltip: string; | ||
}; | ||
|
||
onBeforeRendering() { | ||
this.toggleAttribute("_popin", !this.parentElement); | ||
} | ||
|
||
_onClick(e: MouseEvent) { | ||
const action = this.parentElement ? this : ((this.getRootNode() as ShadowRoot).host as TableCell)._headerCell.action[0] as this; | ||
action.fireDecoratorEvent("click"); | ||
e.stopPropagation(); | ||
} | ||
|
||
get _tooltip() { | ||
return this.getRenderInfo().tooltip; | ||
} | ||
|
||
get _icon() { | ||
return this.getRenderInfo().icon; | ||
} | ||
} | ||
|
||
export default TableHeaderCellActionBase; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.