Skip to content

Commit

Permalink
fix(action-bar): restore "bottom-actions" slot functionality. #7534
Browse files Browse the repository at this point in the history
  • Loading branch information
driskull committed Aug 16, 2023
1 parent 4336635 commit 404b472
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ export class ActionBar

@State() hasActionsEnd = false;

@State() hasBottomActions = false;

@State() expandTooltip: HTMLCalciteTooltipElement;

@Watch("effectiveLocale")
Expand Down Expand Up @@ -305,7 +307,9 @@ export class ActionBar
this.setGroupLayout(actionGroups);

const groupCount =
this.hasActionsEnd || !expandDisabled ? actionGroups.length + 1 : actionGroups.length;
this.hasActionsEnd || this.hasBottomActions || !expandDisabled
? actionGroups.length + 1
: actionGroups.length;

const { actionHeight, actionWidth } = geActionDimensions(actions);

Expand Down Expand Up @@ -355,6 +359,10 @@ export class ActionBar
this.hasActionsEnd = slotChangeHasAssignedElement(event);
};

handleBottomActionsSlotChange = (event: Event): void => {
this.hasBottomActions = slotChangeHasAssignedElement(event);
};

handleTooltipSlotChange = (event: Event): void => {
const tooltips = slotChangeGetAssignedElements(event).filter((el) =>
el?.matches("calcite-tooltip")
Expand Down Expand Up @@ -390,12 +398,12 @@ export class ActionBar
return (
<calcite-action-group
class={CSS.actionGroupEnd}
hidden={this.expandDisabled && !this.hasActionsEnd}
hidden={this.expandDisabled && !(this.hasActionsEnd || this.hasBottomActions)}
layout={layout}
scale={scale}
>
<slot name={SLOTS.actionsEnd} onSlotchange={this.handleActionsEndSlotChange} />
<slot name={SLOTS.bottomActions} onSlotchange={this.handleActionsEndSlotChange} />
<slot name={SLOTS.bottomActions} onSlotchange={this.handleBottomActionsSlotChange} />
<slot name={SLOTS.expandTooltip} onSlotchange={this.handleTooltipSlotChange} />
{expandToggleNode}
</calcite-action-group>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ export const CSS = {

export const SLOTS = {
actionsEnd: "actions-end",
bottomActions: "actions-end",
bottomActions: "bottom-actions",
expandTooltip: "expand-tooltip",
};

0 comments on commit 404b472

Please sign in to comment.