From a037b5584a5fedd40eda6e520d27d7d76f5b7d64 Mon Sep 17 00:00:00 2001 From: NicolasRichel Date: Fri, 4 Jun 2021 09:47:30 +0200 Subject: [PATCH] fix(ui): handle long text properly in models/files managers --- src/components/generic/text-box/TextBox.scss | 8 +++++ src/components/generic/text-box/TextBox.vue | 19 +++++----- .../specific/files/file-tree/FileTree.scss | 23 ++++++++---- .../file-tree-node/FileTreeNodeTemplate.vue | 12 ++++--- .../files/files-manager/FilesManager.scss | 4 +++ .../FilesManagerBreadcrumb.scss | 12 +++++++ .../FilesManagerBreadcrumb.vue | 32 ++++++++++++++--- .../file-name-cell/FileNameCell.vue | 6 ++-- .../files/folder-selector/FolderSelector.scss | 2 ++ .../files/folder-selector/FolderSelector.vue | 35 +++++++++++++------ .../models/models-table/ModelsTable.vue | 2 +- .../model-name-cell/ModelNameCell.vue | 8 ++--- 12 files changed, 118 insertions(+), 45 deletions(-) create mode 100644 src/components/specific/files/files-manager/files-manager-breadcrumb/FilesManagerBreadcrumb.scss diff --git a/src/components/generic/text-box/TextBox.scss b/src/components/generic/text-box/TextBox.scss index 84d9196df..408e84a2a 100644 --- a/src/components/generic/text-box/TextBox.scss +++ b/src/components/generic/text-box/TextBox.scss @@ -44,6 +44,14 @@ } } + &--tertiary-lightest { + background-color: $color-tertiary-lightest; + color: $color-primary; + &::before { + border-color: $color-tertiary-lightest transparent transparent; + } + } + &--top { top: -8px; left: 50%; diff --git a/src/components/generic/text-box/TextBox.vue b/src/components/generic/text-box/TextBox.vue index afe9508f4..fc7a99ba0 100644 --- a/src/components/generic/text-box/TextBox.vue +++ b/src/components/generic/text-box/TextBox.vue @@ -53,7 +53,10 @@ export default { tooltipColor: { type: String, default: "primary", - validator: value => ["primary", "secondary", "tertiary"].includes(value) + validator: value => + ["primary", "secondary", "tertiary", "tertiary-lightest"].includes( + value + ) } }, setup(props) { @@ -72,25 +75,25 @@ export default { const c = props.cutSymbol.length; const max = props.maxLength; if (max && max < l && max > c) { - let cutIndex, head, tail; + let cutIndex, + head = "", + tail = ""; switch (props.cutOn) { case "start": cutIndex = l - (max - c); tail = props.text.slice(cutIndex); - displayedText.value = `${props.cutSymbol}${tail}`; break; case "middle": cutIndex = (max - c) / 2; head = props.text.slice(0, Math.ceil(cutIndex)); tail = props.text.slice(l - Math.floor(cutIndex)); - displayedText.value = `${head}${props.cutSymbol}${tail}`; break; case "end": cutIndex = max - c; head = props.text.slice(0, cutIndex); - displayedText.value = `${head}${props.cutSymbol}`; break; } + displayedText.value = `${head}${props.cutSymbol}${tail}`; } else { displayedText.value = props.text; } @@ -98,12 +101,6 @@ export default { { immediate: true } ); - watch( - () => props.tooltipPosition, - () => {}, - { immediate: true } - ); - return { displayedText, showTooltip diff --git a/src/components/specific/files/file-tree/FileTree.scss b/src/components/specific/files/file-tree/FileTree.scss index 45160b368..5f23230da 100644 --- a/src/components/specific/files/file-tree/FileTree.scss +++ b/src/components/specific/files/file-tree/FileTree.scss @@ -12,13 +12,6 @@ color: $color-primary; cursor: pointer; - &__name, - &__icon-arrow, - &__icon-folder { - position: relative; - z-index: 1; - } - &__background { position: absolute; z-index: 0; @@ -30,9 +23,25 @@ transition: opacity 0.2s ease-out; } + &__name, + &__icon-arrow, + &__icon-folder { + position: relative; + z-index: 1; + } + + &__icon-arrow { + min-width: 13px; + } + &__icon-folder { + min-width: 18px; + } &__name { @include noselect; align-self: flex-end; + &:hover { + z-index: 2; + } } } diff --git a/src/components/specific/files/file-tree/file-tree-node/FileTreeNodeTemplate.vue b/src/components/specific/files/file-tree/file-tree-node/FileTreeNodeTemplate.vue index a9cb4e062..88613b90d 100644 --- a/src/components/specific/files/file-tree/file-tree-node/FileTreeNodeTemplate.vue +++ b/src/components/specific/files/file-tree/file-tree-node/FileTreeNodeTemplate.vue @@ -22,9 +22,11 @@ :name="showChildren ? 'folderOpen' : 'folder'" size="s" /> - - {{ file.name }} - +
@@ -39,10 +41,12 @@ import { inject, ref, watch } from "vue"; import { getDescendants } from "@/utils/file-structure"; // Components import BIMDataIcon from "@bimdata/design-system/dist/js/BIMDataComponents/vue3/BIMDataIcon.js"; +import TextBox from "@/components/generic/text-box/TextBox"; export default { components: { - BIMDataIcon + BIMDataIcon, + TextBox }, props: { file: { diff --git a/src/components/specific/files/files-manager/FilesManager.scss b/src/components/specific/files/files-manager/FilesManager.scss index 95c3a5ea3..8b2f1a811 100644 --- a/src/components/specific/files/files-manager/FilesManager.scss +++ b/src/components/specific/files/files-manager/FilesManager.scss @@ -2,6 +2,10 @@ position: relative; &:deep() { + .bimdata-card__submenu { + z-index: 5; + } + .bimdata-card__content { height: calc(100% - 35px - 26px); diff --git a/src/components/specific/files/files-manager/files-manager-breadcrumb/FilesManagerBreadcrumb.scss b/src/components/specific/files/files-manager/files-manager-breadcrumb/FilesManagerBreadcrumb.scss new file mode 100644 index 000000000..e0928e429 --- /dev/null +++ b/src/components/specific/files/files-manager/files-manager-breadcrumb/FilesManagerBreadcrumb.scss @@ -0,0 +1,12 @@ +.files-manager-breadcrumb { + &__path { + display: inline-flex; + align-items: center; + gap: $spacing-unit/2; + } + + &__file { + margin-left: $spacing-unit/2; + font-weight: bold; + } +} diff --git a/src/components/specific/files/files-manager/files-manager-breadcrumb/FilesManagerBreadcrumb.vue b/src/components/specific/files/files-manager/files-manager-breadcrumb/FilesManagerBreadcrumb.vue index ec22bc477..f0fe920e7 100644 --- a/src/components/specific/files/files-manager/files-manager-breadcrumb/FilesManagerBreadcrumb.vue +++ b/src/components/specific/files/files-manager/files-manager-breadcrumb/FilesManagerBreadcrumb.vue @@ -1,14 +1,33 @@ + + diff --git a/src/components/specific/files/files-table/file-name-cell/FileNameCell.vue b/src/components/specific/files/files-table/file-name-cell/FileNameCell.vue index ae486fa45..070ba1270 100644 --- a/src/components/specific/files/files-table/file-name-cell/FileNameCell.vue +++ b/src/components/specific/files/files-table/file-name-cell/FileNameCell.vue @@ -48,7 +48,7 @@ /> - {{ file.name }} +
@@ -64,6 +64,7 @@ import BIMDataIcon from "@bimdata/design-system/dist/js/BIMDataComponents/vue3/B import BIMDataInput from "@bimdata/design-system/dist/js/BIMDataComponents/vue3/BIMDataInput.js"; import BIMDataSpinner from "@bimdata/design-system/dist/js/BIMDataComponents/vue3/BIMDataSpinner.js"; import FileIcon from "@/components/generic/file-icon/FileIcon"; +import TextBox from "@/components/generic/text-box/TextBox"; export default { components: { @@ -71,7 +72,8 @@ export default { BIMDataIcon, BIMDataInput, BIMDataSpinner, - FileIcon + FileIcon, + TextBox }, props: { project: { diff --git a/src/components/specific/files/folder-selector/FolderSelector.scss b/src/components/specific/files/folder-selector/FolderSelector.scss index ab5521380..bad74b14c 100644 --- a/src/components/specific/files/folder-selector/FolderSelector.scss +++ b/src/components/specific/files/folder-selector/FolderSelector.scss @@ -16,12 +16,14 @@ gap: $spacing-unit; &__path { + display: block; line-height: 1rem; font-size: 0.8rem; color: $color-tertiary-dark; } &__name { + display: block; font-weight: bold; } diff --git a/src/components/specific/files/folder-selector/FolderSelector.vue b/src/components/specific/files/folder-selector/FolderSelector.vue index 57066c79b..7c3d8a7ec 100644 --- a/src/components/specific/files/folder-selector/FolderSelector.vue +++ b/src/components/specific/files/folder-selector/FolderSelector.vue @@ -12,12 +12,17 @@
-
- {{ folderPath.map(f => f.name).join(" > ") }} -
-
- {{ currentFolder.name }} -
+ +
- - {{ folder.name }} - + {{ $t("FolderSelector.selectedFolder") }}: - {{ selectedFolder ? selectedFolder.name : "" }} +