diff --git a/addon/components/content-panel.hbs b/addon/components/content-panel.hbs index 8fea000..ccb2811 100644 --- a/addon/components/content-panel.hbs +++ b/addon/components/content-panel.hbs @@ -44,19 +44,61 @@
- {{#if @prefixTitleRight}} -
- {{@prefixTitleRight}} -
- {{/if}} - {{#if @titleStatusRight}} - - - + {{#if @titleRightSideComponent}} + {{component @titleRightSideComponent context=@titleRightSideComponentContext}} + {{else}} + {{#if @prefixTitleRight}} +
+ {{@prefixTitleRight}} +
+ {{/if}} + {{#if @titleStatusRight}} + + {{#if @titleStatusRightText}} + + {{@titleStatusRightText}} + + {{else}} + + {{/if}} + + {{/if}} + {{#each @actionButtons as |button|}} +
diff --git a/addon/components/content-panel.js b/addon/components/content-panel.js index 621185f..b5d4fdd 100644 --- a/addon/components/content-panel.js +++ b/addon/components/content-panel.js @@ -26,4 +26,18 @@ export default class ContentPanelComponent extends Component { @action close() { this.isOpen = false; } + + @action onDropdownItemClick(action, dd) { + if (typeof dd.actions === 'object' && typeof dd.actions.close === 'function') { + dd.actions.close(); + } + + if (typeof action.fn === 'function') { + action.fn(action.context); + } + + if (typeof action.onClick === 'function') { + action.onClick(action.context); + } + } } diff --git a/addon/components/dropdown-button.hbs b/addon/components/dropdown-button.hbs index 1fee8d8..4d5cfcc 100644 --- a/addon/components/dropdown-button.hbs +++ b/addon/components/dropdown-button.hbs @@ -1,4 +1,4 @@ - + {{#if @buttonComponent}} {{component @buttonComponent buttonComponentArgs=this.buttonComponentArgs text=@text class=(concat @buttonClass (if dd.isOpen ' dd-is-open')) wrapperClass=@buttonWrapperClass type=this.type active=@active size=this.buttonSize isLoading=@isLoading disabled=@disabled textClass=@textClass helpText=@helpText tooltipPlacement=@tooltipPlacement img=@img imgClass=@imgClass alt=@alt}} diff --git a/addon/components/dropdown-button.js b/addon/components/dropdown-button.js index e05af6a..e951bc3 100644 --- a/addon/components/dropdown-button.js +++ b/addon/components/dropdown-button.js @@ -1,5 +1,5 @@ import Component from '@glimmer/component'; -import { computed } from '@ember/object'; +import { computed, action } from '@ember/object'; import { isBlank } from '@ember/utils'; export default class DropdownButtonComponent extends Component { @@ -32,4 +32,15 @@ export default class DropdownButtonComponent extends Component { return isBlank(buttonComponentArgs) || typeof buttonComponentArgs !== 'object' ? {} : buttonComponentArgs; } + + /** + * Trigger callback when dropdown button node is inserted to dom. + * + * @memberof DropdownButtonComponent + */ + @action onInsert() { + if (typeof this.args.onInsert === 'function') { + this.args.onInsert(...arguments); + } + } } diff --git a/addon/components/layout/sidebar/item.hbs b/addon/components/layout/sidebar/item.hbs index f1ddc0f..8669837 100644 --- a/addon/components/layout/sidebar/item.hbs +++ b/addon/components/layout/sidebar/item.hbs @@ -1,8 +1,58 @@ - +
{{#if @icon}} {{/if}}
{{yield}}
+
\ No newline at end of file diff --git a/addon/components/layout/sidebar/item.js b/addon/components/layout/sidebar/item.js index 211b1dd..ea6f28a 100644 --- a/addon/components/layout/sidebar/item.js +++ b/addon/components/layout/sidebar/item.js @@ -9,6 +9,7 @@ export default class LayoutSidebarItemComponent extends Component { @service router; @service hostRouter; @tracked active; + @tracked dropdownButtonNode; constructor() { super(...arguments); @@ -41,6 +42,11 @@ export default class LayoutSidebarItemComponent extends Component { } @action onClick(event) { + if (this.isPointerWithinDropdownButton(event)) { + event.preventDefault(); + return; + } + const { url, target, route, model, onClick, options } = this.args; const router = this.getRouter(); const anchor = event.target?.closest('a'); @@ -78,6 +84,36 @@ export default class LayoutSidebarItemComponent extends Component { } } + @action onDropdownItemClick(action, dd) { + if (typeof dd.actions === 'object' && typeof dd.actions.close === 'function') { + dd.actions.close(); + } + + if (typeof action.fn === 'function') { + action.fn(action.context); + } + + if (typeof action.onClick === 'function') { + action.onClick(action.context); + } + } + + @action onInsert(dropdownButtonNode) { + this.dropdownButtonNode = dropdownButtonNode; + + if (typeof this.args.onDropdownButtonInsert === 'function') { + this.args.onDropdownButtonInsert(...arguments); + } + } + + isPointerWithinDropdownButton({ target }) { + if (this.dropdownButtonNode) { + return this.dropdownButtonNode.contains(target); + } + + return false; + } + getRouter() { return this.router ?? this.hostRouter; } diff --git a/addon/components/layout/sidebar/panel.hbs b/addon/components/layout/sidebar/panel.hbs index 3d59b90..c2abddb 100644 --- a/addon/components/layout/sidebar/panel.hbs +++ b/addon/components/layout/sidebar/panel.hbs @@ -1,3 +1,3 @@ - + {{yield}} \ No newline at end of file diff --git a/addon/helpers/is-dd-item-visible.js b/addon/helpers/is-dd-item-visible.js index 11b3d91..34ec373 100644 --- a/addon/helpers/is-dd-item-visible.js +++ b/addon/helpers/is-dd-item-visible.js @@ -1,7 +1,8 @@ import { helper } from '@ember/component/helper'; +import { isNone } from '@ember/utils'; -export default helper(function isDdItemVisible([row, isVisible]) { - if (!isVisible) { +export default helper(function isDdItemVisible([context, isVisible]) { + if (isNone(context) || !isVisible) { return true; } @@ -10,7 +11,7 @@ export default helper(function isDdItemVisible([row, isVisible]) { } if (typeof isVisible === 'function') { - return isVisible(row); + return isVisible(context); } return true; diff --git a/addon/styles/components/panel.css b/addon/styles/components/panel.css index 1f589b6..8c47106 100644 --- a/addon/styles/components/panel.css +++ b/addon/styles/components/panel.css @@ -53,3 +53,38 @@ #serviceContainer.developers-console-service .content-panel > .content-panel-header:not(.min-h-0) { min-height: 75px; } + +.next-content-panel > .next-content-panel-header > .next-content-panel-header-right .next-content-panel-status-badge { + display: flex; + align-items: center; + flex-direction: row; +} + +.next-content-panel > .next-content-panel-header > .next-content-panel-header-right .next-content-panel-status-badge > span { + font-size: 10px; + padding: 0.25rem; + line-height: 1; + font-weight: 600; + border-radius: 0.35rem; + @apply shadow-sm; +} + +.next-content-panel a.next-nav-item.next-nav-item-with-dropdown .next-nav-item-dropdown-button, +.next-content-panel a.next-nav-item.next-nav-item-with-dropdown .next-nav-item-dropdown-button button { + cursor: default; +} + +.next-content-panel a.next-nav-item.next-nav-item-with-dropdown .next-nav-item-dropdown-button button:hover { + background-color: initial; +} + +.next-content-panel a.next-nav-item.next-nav-item-with-dropdown .next-nav-item-dropdown-button button.btn { + padding-top: 0.15rem; + padding-bottom: 0.15rem; + font-size: 10px; + margin-right: -0.5rem; + line-height: 0.5; +} +.next-content-panel a.next-nav-item.next-nav-item-with-dropdown { + overflow: visible; +}