From d1004277c6f5eb092054333a8c86f5aa978fca5f Mon Sep 17 00:00:00 2001 From: Christian Kienle Date: Tue, 18 Jun 2019 16:05:56 +0200 Subject: [PATCH] feat: scrollable product menu --- .../Layout/ShellBar/ShellBarProductMenu.vue | 27 +++++------- src/components/MenuPopover/MenuPopover.vue | 18 ++++++++ src/docs/components/d-markdown.vue | 19 +++++++- src/docs/components/doc/prop-doc.vue | 4 +- src/docs/pages/Shell Bar/3-products.vue | 43 ++++++++++++++++--- src/docs/pages/Table/index.js | 2 +- 6 files changed, 86 insertions(+), 27 deletions(-) diff --git a/src/components/Layout/ShellBar/ShellBarProductMenu.vue b/src/components/Layout/ShellBar/ShellBarProductMenu.vue index 32e814f8..bf5292c6 100644 --- a/src/components/Layout/ShellBar/ShellBarProductMenu.vue +++ b/src/components/Layout/ShellBar/ShellBarProductMenu.vue @@ -1,6 +1,12 @@ - + diff --git a/src/components/MenuPopover/MenuPopover.vue b/src/components/MenuPopover/MenuPopover.vue index 584d26ed..40e7d94a 100644 --- a/src/components/MenuPopover/MenuPopover.vue +++ b/src/components/MenuPopover/MenuPopover.vue @@ -28,6 +28,21 @@ import FdPopover from "./../Popover/Popover.vue"; export default { name: "FdMenuPopover", components: { FdPopover, FdMenu }, + props: { + // Imagine the following scenario: + // 1. A user clicks on the control – a menu is displayed. + // 2. Now the user is using arrow.down to highlight the first + // menu item. + // 3. Now the user clicks outside of the menu. + // 4. User opens the menu again. + // Sometimes you want the highlighted (but not selected item) + // to remaing highlighted. Sometimes not (product menu). + // This prop can be used to adjust exactly that. + discardHighlight: { + type: Boolean, + default: false + } + }, methods: { getPopover() { return this.$refs.popover; @@ -52,6 +67,9 @@ export default { // Misc updateVisible(visible) { this.visible_ = visible; + if (this.discardHighlight) { + this.highlightedId = null; + } }, handleMenuSelect(item) { this.$emit("select", item); diff --git a/src/docs/components/d-markdown.vue b/src/docs/components/d-markdown.vue index bf833d13..0aa92624 100644 --- a/src/docs/components/d-markdown.vue +++ b/src/docs/components/d-markdown.vue @@ -1,5 +1,5 @@ + + diff --git a/src/docs/components/doc/prop-doc.vue b/src/docs/components/doc/prop-doc.vue index 5d92ce46..4c8b0f43 100644 --- a/src/docs/components/doc/prop-doc.vue +++ b/src/docs/components/doc/prop-doc.vue @@ -36,13 +36,13 @@ export default { return this.typeDesc.length > 0; }, renderedTypeDescription() { - return this.typeDesc.join("\n\n"); + return this.typeDesc.join("\n"); }, defaultValue_() { return this.defaultValue != null ? this.defaultValue : "–"; }, renderedDescription() { - return this.describe.join("\n\n"); + return this.describe.join("\n"); } }, props: { diff --git a/src/docs/pages/Shell Bar/3-products.vue b/src/docs/pages/Shell Bar/3-products.vue index 704dbb26..b3a822fc 100644 --- a/src/docs/pages/Shell Bar/3-products.vue +++ b/src/docs/pages/Shell Bar/3-products.vue @@ -22,13 +22,42 @@ Application A - - Application B - - - A very long application name - even longer than the product - title. - + Sample Application No 1 + Sample Application No 1 + Sample Application No 1 + Sample Application No 2 + Sample Application No 2 + Sample Application No 2 + Sample Application No 3 + Sample Application No 3 + Sample Application No 3 + Sample Application No 4 + Sample Application No 4 + Sample Application No 4 + Sample Application No 5 + Sample Application No 5 + Sample Application No 5 + Sample Application No 6 + Sample Application No 6 + Sample Application No 6 + Sample Application No 7 + Sample Application No 7 + Sample Application No 7 + Sample Application No 8 + Sample Application No 8 + Sample Application No 8 + Sample Application No 9 + Sample Application No 9 + Sample Application No 9 + Sample Application No 10 + Sample Application No 10 + Sample Application No 10 + Sample Application No 11 + Sample Application No 11 + Sample Application No 11 + Sample Application No 12 + Sample Application No 12 + Sample Application No 12 diff --git a/src/docs/pages/Table/index.js b/src/docs/pages/Table/index.js index 6f0ba1c4..05b3ac02 100644 --- a/src/docs/pages/Table/index.js +++ b/src/docs/pages/Table/index.js @@ -1,3 +1,3 @@ export default { - relatedComponents: ["fd-table-cell", "fd-table-row", "fd-table-cell"] + relatedComponents: ["fd-table", "fd-table-cell", "fd-table-row"] };