UBERF-60: updated inline presenters. (#3663)

Signed-off-by: Alexander Platov <sas_lord@mail.ru>
This commit is contained in:
Alexander Platov 2023-09-06 09:48:52 +03:00 committed by GitHub
parent b185e43881
commit a52b806e5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 168 additions and 133 deletions

View File

@ -324,7 +324,6 @@ export function createModel (builder: Builder): void {
sortingKey: '$lookup.attachedTo.name', sortingKey: '$lookup.attachedTo.name',
props: { props: {
_class: lead.mixin.Customer, _class: lead.mixin.Customer,
inline: true,
maxWidth: '10rem' maxWidth: '10rem'
} }
}, },

View File

@ -29,7 +29,6 @@ export default mergeIds(leadId, lead, {
Funnel: '' as IntlString, Funnel: '' as IntlString,
Funnels: '' as IntlString, Funnels: '' as IntlString,
LeadApplication: '' as IntlString, LeadApplication: '' as IntlString,
Lead: '' as IntlString,
Title: '' as IntlString, Title: '' as IntlString,
ManageFunnelStatuses: '' as IntlString, ManageFunnelStatuses: '' as IntlString,
GotoLeadApplication: '' as IntlString, GotoLeadApplication: '' as IntlString,

View File

@ -695,8 +695,7 @@ export function createModel (builder: Builder): void {
label: recruit.string.Talent, label: recruit.string.Talent,
sortingKey: '$lookup.attachedTo.name', sortingKey: '$lookup.attachedTo.name',
props: { props: {
_class: recruit.mixin.Candidate, _class: recruit.mixin.Candidate
inline: true
} }
}, },
{ key: 'attachments', displayProps: { key: 'attachments', suffix: true } }, { key: 'attachments', displayProps: { key: 'attachments', suffix: true } },
@ -712,7 +711,6 @@ export function createModel (builder: Builder): void {
key: '$lookup.space.company', key: '$lookup.space.company',
displayProps: { fixed: 'left', key: 'company' }, displayProps: { fixed: 'left', key: 'company' },
props: { props: {
inline: true,
maxWidth: '10rem' maxWidth: '10rem'
} }
}, },

View File

@ -91,21 +91,24 @@
&:not(.colorInherit) { &:not(.colorInherit) {
color: var(--theme-content-color); color: var(--theme-content-color);
} }
&.colorInherit { &.colorInherit,
&.inline {
color: inherit; color: inherit;
} }
&.inline { &.inline {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
text-decoration: none;
} }
&.noUnderline { &.noUnderline {
text-decoration: none;
&:not(.colorInherit) { &:not(.colorInherit) {
color: var(--theme-caption-color); color: var(--theme-caption-color);
} }
} }
&:not(.noUnderline) { &:not(.noUnderline, .inline) {
&:hover { &:hover {
text-decoration: underline; text-decoration: underline;
&:not(.colorInherit) { &:not(.colorInherit) {

View File

@ -278,6 +278,12 @@ input.search {
.flex-gap-1-5 { gap: .375rem; } .flex-gap-1-5 { gap: .375rem; }
.flex-gap-1 { gap: .25rem; } .flex-gap-1 { gap: .25rem; }
.flex-between-half-content > * {
flex-basis: 50%;
&:last-child { justify-content: flex-end; }
}
.flex-break { .flex-break {
flex-basis: 100%; flex-basis: 100%;
height: 0; height: 0;

View File

@ -208,7 +208,7 @@
<div class="message clear-mins"> <div class="message clear-mins">
<div class="header clear-mins"> <div class="header clear-mins">
{#if employee} {#if employee}
<EmployeePresenter value={employee} shouldShowAvatar={false} inline /> <EmployeePresenter value={employee} shouldShowAvatar={false} />
{/if} {/if}
<span>{getTime(message.createdOn ?? 0)}</span> <span>{getTime(message.createdOn ?? 0)}</span>
{#if message.editedOn} {#if message.editedOn}

View File

@ -29,16 +29,17 @@
{#if value} {#if value}
<DocNavLink {disabled} {inline} object={value} {accent} noUnderline={disabled}> <DocNavLink {disabled} {inline} object={value} {accent} noUnderline={disabled}>
<div {#if inline}
class="flex-presenter" <span class="antiMention" use:tooltip={{ label: getEmbeddedLabel(value.name) }}>
style:max-width={maxWidth} @{value.name}
class:inline-presenter={inline} </span>
use:tooltip={{ label: getEmbeddedLabel(value.name) }} {:else}
> <div class="flex-presenter" style:max-width={maxWidth} use:tooltip={{ label: getEmbeddedLabel(value.name) }}>
{#if !inline} {#if !inline}
<div class="icon circle"><Company size={'small'} /></div> <div class="icon circle"><Company size={'small'} /></div>
{/if} {/if}
<span class="overflow-label label" class:no-underline={disabled} class:fs-bold={accent}>{value.name}</span> <span class="overflow-label label" class:no-underline={disabled} class:fs-bold={accent}>{value.name}</span>
</div> </div>
{/if}
</DocNavLink> </DocNavLink>
{/if} {/if}

View File

@ -69,14 +69,18 @@
{#if value} {#if value}
<DocNavLink object={value} onClick={onEdit} {disabled} noUnderline={disabled} {inline} {colorInherit} {accent}> <DocNavLink object={value} onClick={onEdit} {disabled} noUnderline={disabled} {inline} {colorInherit} {accent}>
{#if inline}
<span class="antiMention" use:tooltip={disabled ? undefined : showTooltip}>
@{getName(client.getHierarchy(), value)}
</span>
{:else}
<span <span
use:tooltip={disabled ? undefined : showTooltip} use:tooltip={disabled ? undefined : showTooltip}
class="contentPresenter" class="contentPresenter"
class:text-base={enlargedText} class:text-base={enlargedText}
class:inline-presenter={inline}
style:max-width={maxWidth} style:max-width={maxWidth}
> >
{#if !inline && shouldShowAvatar} {#if shouldShowAvatar}
<span <span
class="eContentPresenterIcon" class="eContentPresenterIcon"
class:mr-2={shouldShowName && !enlargedText} class:mr-2={shouldShowName && !enlargedText}
@ -91,6 +95,7 @@
> >
{/if} {/if}
</span> </span>
{/if}
</DocNavLink> </DocNavLink>
{#if statusLabel} {#if statusLabel}
<span class="status"> <span class="status">
@ -128,10 +133,6 @@
align-items: center; align-items: center;
flex-wrap: nowrap; flex-wrap: nowrap;
&.inline-presenter {
display: inline-flex;
align-items: baseline;
}
.eContentPresenterIcon { .eContentPresenterIcon {
color: var(--theme-dark-color); color: var(--theme-dark-color);
} }

View File

@ -17,7 +17,8 @@
<script lang="ts"> <script lang="ts">
import { WithLookup } from '@hcengineering/core' import { WithLookup } from '@hcengineering/core'
import { Document } from '@hcengineering/document' import { Document } from '@hcengineering/document'
import { getPanelURI, Icon } from '@hcengineering/ui' import { tooltip, Icon } from '@hcengineering/ui'
import { DocNavLink } from '@hcengineering/view-resources'
import document from '../plugin' import document from '../plugin'
export let value: WithLookup<Document> export let value: WithLookup<Document>
@ -27,16 +28,17 @@
</script> </script>
{#if value} {#if value}
<a <DocNavLink {disabled} object={value} {inline} {accent} noUnderline={disabled} component={document.component.EditDoc}>
class="flex-presenter" {#if inline}
href="#{getPanelURI(document.component.EditDoc, value._id, value._class, 'content')}" <span class="antiMention" use:tooltip={{ label: document.string.Document }}>
class:inline-presenter={inline} @{value.name}-{value.version}
> </span>
{#if !inline} {:else}
<div class="icon"> <div class="icon">
<Icon icon={document.icon.Document} size={'small'} /> <Icon icon={document.icon.Document} size={'small'} />
</div> </div>
<span class="label nowrap" class:no-underline={disabled} class:fs-bold={accent}>{value.name}-{value.version}</span
>
{/if} {/if}
<span class="label nowrap" class:no-underline={disabled} class:fs-bold={accent}>{value.name}-{value.version}</span> </DocNavLink>
</a>
{/if} {/if}

View File

@ -16,6 +16,8 @@
<script lang="ts"> <script lang="ts">
import { Category } from '@hcengineering/inventory' import { Category } from '@hcengineering/inventory'
import { DocNavLink } from '@hcengineering/view-resources' import { DocNavLink } from '@hcengineering/view-resources'
import { tooltip } from '@hcengineering/ui'
import inventory from '../plugin'
export let value: Category export let value: Category
export let inline: boolean = false export let inline: boolean = false
@ -23,8 +25,12 @@
{#if value} {#if value}
<DocNavLink object={value} {inline}> <DocNavLink object={value} {inline}>
{#if inline}
<span class="antiMention" use:tooltip={{ label: inventory.string.Category }}>@{value.name}</span>
{:else}
<div class="flex-presenter overflow-label sm-tool-icon"> <div class="flex-presenter overflow-label sm-tool-icon">
{value.name} {value.name}
</div> </div>
{/if}
</DocNavLink> </DocNavLink>
{/if} {/if}

View File

@ -15,7 +15,7 @@
--> -->
<script lang="ts"> <script lang="ts">
import { Product } from '@hcengineering/inventory' import { Product } from '@hcengineering/inventory'
import { Icon } from '@hcengineering/ui' import { Icon, tooltip } from '@hcengineering/ui'
import { DocNavLink } from '@hcengineering/view-resources' import { DocNavLink } from '@hcengineering/view-resources'
import inventory from '../plugin' import inventory from '../plugin'
@ -25,11 +25,13 @@
{#if value} {#if value}
<DocNavLink {inline} object={value}> <DocNavLink {inline} object={value}>
<div class="flex-presenter" class:inline-presenter={inline}> {#if inline}
{#if !inline} <span class="antiMention" use:tooltip={{ label: inventory.string.Product }}>@{value.name}</span>
{:else}
<div class="flex-presenter">
<div class="icon"><Icon icon={inventory.icon.Products} size={'small'} /></div> <div class="icon"><Icon icon={inventory.icon.Products} size={'small'} /></div>
{/if}
<span class="label">{value.name}</span> <span class="label">{value.name}</span>
</div> </div>
{/if}
</DocNavLink> </DocNavLink>
{/if} {/if}

View File

@ -15,9 +15,9 @@
--> -->
<script lang="ts"> <script lang="ts">
import type { Lead } from '@hcengineering/lead' import type { Lead } from '@hcengineering/lead'
import { Icon } from '@hcengineering/ui' import { Icon, tooltip } from '@hcengineering/ui'
import { DocNavLink } from '@hcengineering/view-resources' import { DocNavLink } from '@hcengineering/view-resources'
import lead from '../plugin' import lead from '@hcengineering/lead'
export let value: Lead export let value: Lead
export let inline: boolean = false export let inline: boolean = false
@ -27,13 +27,13 @@
{#if value} {#if value}
<DocNavLink object={value} {inline} {disabled} noUnderline={disabled} {accent}> <DocNavLink object={value} {inline} {disabled} noUnderline={disabled} {accent}>
<div class="flex-presenter" class:inline-presenter={inline}> {#if inline}
{#if !inline} <span class="antiMention" use:tooltip={{ label: lead.string.Lead }}>@LEAD-{value.number}</span>
<div class="icon"> {:else}
<Icon icon={lead.icon.Lead} size={'small'} /> <div class="flex-presenter">
</div> <div class="icon"><Icon icon={lead.icon.Lead} size={'small'} /></div>
{/if}
<span class="label nowrap" class:no-underline={disabled} class:fs-bold={accent}>LEAD-{value.number}</span> <span class="label nowrap" class:no-underline={disabled} class:fs-bold={accent}>LEAD-{value.number}</span>
</div> </div>
{/if}
</DocNavLink> </DocNavLink>
{/if} {/if}

View File

@ -70,6 +70,7 @@ const lead = plugin(leadId, {
Customer: '' as Ref<Mixin<Customer>> Customer: '' as Ref<Mixin<Customer>>
}, },
string: { string: {
Lead: '' as IntlString,
ConfigLabel: '' as IntlString ConfigLabel: '' as IntlString
}, },
icon: { icon: {

View File

@ -17,7 +17,8 @@
import { getClient } from '@hcengineering/presentation' import { getClient } from '@hcengineering/presentation'
import type { Applicant } from '@hcengineering/recruit' import type { Applicant } from '@hcengineering/recruit'
import recruit from '@hcengineering/recruit' import recruit from '@hcengineering/recruit'
import { Icon } from '@hcengineering/ui' import recruitPlg from '../plugin'
import { Icon, tooltip } from '@hcengineering/ui'
import { DocNavLink } from '@hcengineering/view-resources' import { DocNavLink } from '@hcengineering/view-resources'
export let value: Applicant export let value: Applicant
@ -31,15 +32,19 @@
{#if value && shortLabel} {#if value && shortLabel}
<DocNavLink object={value} {inline} {disabled} noUnderline={disabled} {accent}> <DocNavLink object={value} {inline} {disabled} noUnderline={disabled} {accent}>
<div class="flex-presenter" class:inline-presenter={inline}> {#if inline}
{#if !inline} <span class="antiMention" use:tooltip={{ label: recruitPlg.string.Application }}>
@{#if shortLabel}{shortLabel}-{/if}{value.number}
</span>
{:else}
<div class="flex-presenter">
<div class="icon"> <div class="icon">
<Icon icon={recruit.icon.Application} size={'small'} /> <Icon icon={recruit.icon.Application} size={'small'} />
</div> </div>
{/if}
<span class="label nowrap" class:no-underline={disabled} class:fs-bold={accent}> <span class="label nowrap" class:no-underline={disabled} class:fs-bold={accent}>
{#if shortLabel}{shortLabel}-{/if}{value.number} {#if shortLabel}{shortLabel}-{/if}{value.number}
</span> </span>
</div> </div>
{/if}
</DocNavLink> </DocNavLink>
{/if} {/if}

View File

@ -50,7 +50,10 @@
<!-- svelte-ignore a11y-click-events-have-key-events --> <!-- svelte-ignore a11y-click-events-have-key-events -->
<div class="flex-col pt-3 pb-3 pr-4 pl-4" on:click={showCandidate}> <div class="flex-col pt-3 pb-3 pr-4 pl-4" on:click={showCandidate}>
{#if enabledConfig(config, 'space') || enabledConfig(config, 'company')} {#if enabledConfig(config, 'space') || enabledConfig(config, 'company')}
<div class="flex-between mb-3"> <div
class="flex-between gap-2 mb-3"
class:flex-between-half-content={enabledConfig(config, 'space') && company && enabledConfig(config, 'company')}
>
{#if enabledConfig(config, 'space')} {#if enabledConfig(config, 'space')}
<ObjectPresenter _class={recruit.class.Vacancy} objectId={object.space} value={object.$lookup?.space} /> <ObjectPresenter _class={recruit.class.Vacancy} objectId={object.space} value={object.$lookup?.space} />
{/if} {/if}
@ -118,7 +121,7 @@
<div class="flex-between"> <div class="flex-between">
<div class="flex-row-center gap-3 reverse mr-4"> <div class="flex-row-center gap-3 reverse mr-4">
{#if enabledConfig(config, '')} {#if enabledConfig(config, '')}
<ApplicationPresenter value={object} inline /> <ApplicationPresenter value={object} />
{/if} {/if}
{#if (object.attachments ?? 0) > 0 && enabledConfig(config, 'attachments')} {#if (object.attachments ?? 0) > 0 && enabledConfig(config, 'attachments')}
<AttachmentsPresenter value={object.attachments} {object} /> <AttachmentsPresenter value={object.attachments} {object} />

View File

@ -45,11 +45,15 @@
noUnderline={disabled} noUnderline={disabled}
component={recruit.component.EditVacancy} component={recruit.component.EditVacancy}
> >
<div class="flex-presenter" class:inline-presenter={inline} use:tooltip={{ label: getEmbeddedLabel(value.name) }}> {#if inline}
{#if !inline} <span class="antiMention" use:tooltip={{ label: recruit.string.Vacancy }}>
@{value.name}
</span>
{:else}
<div class="flex-presenter" use:tooltip={{ label: getEmbeddedLabel(value.name) }}>
<div class="icon"><Icon icon={recruit.icon.Vacancy} size={'small'} /></div> <div class="icon"><Icon icon={recruit.icon.Vacancy} size={'small'} /></div>
{/if}
<span class="label nowrap" class:no-underline={disabled} class:fs-bold={accent}>{value.name}</span> <span class="label nowrap" class:no-underline={disabled} class:fs-bold={accent}>{value.name}</span>
</div> </div>
{/if}
</DocNavLink> </DocNavLink>
{/if} {/if}

View File

@ -47,8 +47,11 @@
</script> </script>
<DocNavLink object={value} {onClick} {disabled} {noUnderline} {inline} {accent} component={view.component.EditDoc}> <DocNavLink object={value} {onClick} {disabled} {noUnderline} {inline} {accent} component={view.component.EditDoc}>
<span class="flex-presenter" class:inline-presenter={inline} class:list={kind === 'list'}> {#if inline}
{#if !inline && shouldShowAvatar} <span class="antiMention" use:tooltip={{ label: tracker.string.Component }}>@{label}</span>
{:else}
<span class="flex-presenter" class:list={kind === 'list'}>
{#if shouldShowAvatar}
<div class="icon" use:tooltip={{ label: tracker.string.Component }}> <div class="icon" use:tooltip={{ label: tracker.string.Component }}>
<Icon icon={tracker.icon.Component} size={'small'} /> <Icon icon={tracker.icon.Component} size={'small'} />
</div> </div>
@ -57,4 +60,5 @@
{label} {label}
</span> </span>
</span> </span>
{/if}
</DocNavLink> </DocNavLink>

View File

@ -58,8 +58,11 @@
component={tracker.component.EditIssue} component={tracker.component.EditIssue}
shrink={0} shrink={0}
> >
<span class="issuePresenterRoot" class:inline class:list={kind === 'list'} class:cursor-pointer={!disabled}> {#if inline}
{#if !inline && shouldShowAvatar} <span class="antiMention" use:tooltip={{ label: tracker.string.Issue }}>@{title}</span>
{:else}
<span class="issuePresenterRoot" class:list={kind === 'list'} class:cursor-pointer={!disabled}>
{#if shouldShowAvatar}
<div class="icon" use:tooltip={{ label: tracker.string.Issue }}> <div class="icon" use:tooltip={{ label: tracker.string.Issue }}>
<Icon icon={icon ?? tracker.icon.Issues} size={'small'} /> <Icon icon={icon ?? tracker.icon.Issues} size={'small'} />
</div> </div>
@ -69,6 +72,7 @@
<slot name="details" /> <slot name="details" />
</span> </span>
</span> </span>
{/if}
</DocNavLink> </DocNavLink>
{/if} {/if}
@ -92,18 +96,5 @@
margin-right: 0.5rem; margin-right: 0.5rem;
color: var(--theme-dark-color); color: var(--theme-dark-color);
} }
&.inline {
display: inline-flex;
align-items: baseline;
.icon {
transform: translateY(0.2rem);
}
.select-text {
font-weight: 500;
color: var(--theme-caption-color);
}
}
} }
</style> </style>

View File

@ -15,7 +15,13 @@
<script lang="ts"> <script lang="ts">
import { WithLookup } from '@hcengineering/core' import { WithLookup } from '@hcengineering/core'
import { Milestone } from '@hcengineering/tracker' import { Milestone } from '@hcengineering/tracker'
import { Icon, getPlatformAvatarColorDef, getPlatformAvatarColorForTextDef, themeStore } from '@hcengineering/ui' import {
Icon,
getPlatformAvatarColorDef,
getPlatformAvatarColorForTextDef,
themeStore,
tooltip
} from '@hcengineering/ui'
import { DocNavLink } from '@hcengineering/view-resources' import { DocNavLink } from '@hcengineering/view-resources'
import { createEventDispatcher, onMount } from 'svelte' import { createEventDispatcher, onMount } from 'svelte'
import tracker from '../../plugin' import tracker from '../../plugin'
@ -41,8 +47,11 @@
{#if value} {#if value}
<DocNavLink object={value} {disabled} {inline} {accent} noUnderline={disabled} {onClick}> <DocNavLink object={value} {disabled} {inline} {accent} noUnderline={disabled} {onClick}>
<div class="flex-presenter" class:inline-presenter={inline}> {#if inline}
{#if !inline && shouldShowAvatar} <span class="antiMention" use:tooltip={{ label: tracker.string.Milestone }}>@{value.label}</span>
{:else}
<div class="flex-presenter">
{#if shouldShowAvatar}
<div class="icon"> <div class="icon">
<Icon icon={tracker.icon.Milestone} size="small" /> <Icon icon={tracker.icon.Milestone} size="small" />
</div> </div>
@ -51,5 +60,6 @@
{value.label} {value.label}
</span> </span>
</div> </div>
{/if}
</DocNavLink> </DocNavLink>
{/if} {/if}

View File

@ -22,7 +22,7 @@
export let _class: Ref<Class<Doc>> | undefined = undefined export let _class: Ref<Class<Doc>> | undefined = undefined
export let value: Doc | RelatedDocument | undefined = undefined export let value: Doc | RelatedDocument | undefined = undefined
export let props: Record<string, any> = {} export let props: Record<string, any> = {}
export let inline: boolean = true export let inline: boolean = false
export let accent: boolean = false export let accent: boolean = false
export let shouldShowAvatar: boolean = true export let shouldShowAvatar: boolean = true
export let noUnderline: boolean = false export let noUnderline: boolean = false

View File

@ -58,7 +58,7 @@
if (attributeModel) { if (attributeModel) {
const breadcrumbsModel: BreadcrumbsModel = { const breadcrumbsModel: BreadcrumbsModel = {
component: attributeModel.presenter, component: attributeModel.presenter,
props: { inline: true, ...(attributeModel.props ?? {}), value: parent } props: { shouldShowAvatar: false, ...(attributeModel.props ?? {}), value: parent }
} }
models.push(breadcrumbsModel) models.push(breadcrumbsModel)