Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct various popup menu glitches #717

Merged
merged 10 commits into from
Dec 7, 2022
50 changes: 26 additions & 24 deletions assets/diagram-js.css
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@
--palette-background-color: var(--color-grey-225-10-97);
--palette-border-color: var(--color-grey-225-10-75);

--popup-font-size: 14px;
--popup-header-entry-selected-color: var(--color-blue-205-100-50);
--popup-header-separator-color: var(--color-grey-225-10-75);
--popup-header-font-weight: bolder;
--popup-background-color: var(--color-white);
--popup-border-color: var(--color-grey-225-10-75);
--popup-shadow-color: var(--color-grey-225-10-80);
Expand Down Expand Up @@ -536,12 +537,13 @@ marker.djs-dragger tspan {
box-shadow: 0px 2px 10px var(--popup-shadow-color);
min-width: 120px;
outline: none;
font-size: var(--popup-font-size);
}

.djs-popup-search input {
width: 100%;
box-sizing: border-box;
font-size: 14px;
font-size: var(--popup-font-size);
padding: 3px 6px;
border-radius: 2px;
border: solid 1px var(--popup-search-border-color);
Expand All @@ -562,7 +564,6 @@ marker.djs-dragger tspan {
}

.djs-popup-header .entry {
font-size: 19.5px;
border-radius: 2px;
}

Expand All @@ -579,11 +580,10 @@ marker.djs-dragger tspan {
}

.djs-popup-title {
font-size: 14px;
font-weight: 500;
font-size: var(--popup-font-size);
font-weight: var(--popup-header-font-weight);
flex: 1;
margin: 0;
width: max-content;
}

.djs-popup-search {
Expand Down Expand Up @@ -620,19 +620,26 @@ marker.djs-dragger tspan {
padding: 5px 7px;
cursor: default;
border-radius: 4px;
font-size: 14px;
}

.djs-popup-body .entry-header {
font-weight: 500;
font-weight: var(--popup-header-font-weight);
color: var(--popup-entry-title-color);
padding-left: 0;
}

.djs-popup [class*="icon"] .djs-popup-label,
.djs-popup-label:not(:first-child) {
margin-left: .5rem;
}

.djs-popup [class*="icon"]:before,
.djs-popup-entry-icon {
width: 16px;
margin-right: 0.5rem;
margin-bottom: -0.2rem;
width: 1em;
height: 1em;
display: inline-block;
font-size: 1.4em;
vertical-align: middle;
}

.djs-popup-body .entry-header:not(:first-child) {
Expand Down Expand Up @@ -666,10 +673,15 @@ marker.djs-dragger tspan {
color: var(--popup-description-color);
}

.djs-popup-entry-name,
.djs-popup-label,
.djs-popup-entry-description {
line-height: 1.4em;
display: block;
}

.djs-popup-title,
.djs-popup-label,
.djs-popup-entry-description,
.djs-popup .entry-header {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
Expand All @@ -686,15 +698,6 @@ marker.djs-dragger tspan {
overflow: hidden;
}

.djs-popup-entry-name[class^="bpmn-icon-"]:before,
.djs-popup-entry-name[class*=" bpmn-icon-"]:before,
.djs-popup-entry-icon {
display: inline-block;
font-size: 1.4em;
vertical-align: middle;
margin-right: 0.5rem;
}

.djs-popup-body {
flex-direction: column;
width: auto;
Expand All @@ -711,13 +714,12 @@ marker.djs-dragger tspan {

.djs-popup *::-webkit-scrollbar-track {
box-shadow: none;
background: transparent1;
background: transparent;
margin: 0;
padding: 5px;
}

.djs-popup-no-results {
font-size: 14px;
padding: 0 12px 12px 12px;
color: var(--popup-no-results-color);
}
Expand Down
13 changes: 9 additions & 4 deletions lib/features/popup-menu/PopupMenuComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,18 +184,23 @@ export default function PopupMenuComponent(props) {
>
${ displayHeader && html`
<div class="djs-popup-header">
<h3 class="djs-popup-title">${ title }</h3>
<h3 class="djs-popup-title" title=${ title }>${ title }</h3>
${ headerEntries.map(entry => html`
<span
class=${ getHeaderClasses(entry, entry === selectedEntry) }
onClick=${ event => onSelect(event, entry) }
title=${ entry.title }
title=${ entry.title || entry.label }
data-id=${ entry.id }
onMouseEnter=${ () => setSelectedEntry(entry) }
onMouseLeave=${ () => setSelectedEntry(null) }
>
${ entry.imageUrl ? html`<img src=${ entry.imageUrl } />` : null }
${ entry.label ? entry.label : null }
${ entry.imageUrl ? html`
<img class="djs-popup-entry-icon" src=${ entry.imageUrl } />
` : null }

${ entry.label ? html`
<span class="djs-popup-label">${ entry.label }</span>
` : null }
</span>
`) }
</div>
Expand Down
17 changes: 10 additions & 7 deletions lib/features/popup-menu/PopupMenuItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,28 @@ export default function PopupMenuItem(props) {
onClick
} = props;

const createImage = imageUrl => {
return html`<img src=${ imageUrl } class="djs-popup-entry-icon" />`;
};

return html`
<li
class=${ classNames('entry', { selected }) }
data-id=${ entry.id }
title=${ entry.title || entry.label }
onClick=${ onClick }
onMouseEnter=${ onMouseEnter }
onMouseLeave=${ onMouseLeave }
>
<div class="djs-popup-entry-content">
<span
class=${ classNames('djs-popup-entry-name', entry.className) }
title=${ entry.label || entry.name }
>
${ entry.imageUrl ? createImage(entry.imageUrl) : null }
${ entry.label || entry.name }
${ entry.imageUrl ? html`
<img class="djs-popup-entry-icon" src=${ entry.imageUrl } />
` : null }

${ entry.label ? html`
<span class="djs-popup-label">
${ entry.label }
</span>
` : null }
</span>
${ entry.description && html`
<span
Expand Down
2 changes: 1 addition & 1 deletion lib/features/popup-menu/PopupMenuList.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default function PopupMenuList(props) {
<div class="djs-popup-results" ref=${ resultsRef }>
${ groups.map(group => html`
${ group.name && html`
<div key=${ group.id } class="entry-header">
<div key=${ group.id } class="entry-header" title=${ group.name }>
${ group.name }
</div>
` }
Expand Down
Loading