2021-08-07 14:49:14 +00:00
|
|
|
<!--
|
2022-04-28 12:03:10 +00:00
|
|
|
// Copyright © 2022 Hardcore Engineering Inc.
|
2021-08-07 14:49:14 +00:00
|
|
|
//
|
|
|
|
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License. You may
|
|
|
|
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
//
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
-->
|
|
|
|
<script lang="ts">
|
2022-09-21 08:08:25 +00:00
|
|
|
import { formatName, Person } from '@hcengineering/contact'
|
|
|
|
import { IntlString } from '@hcengineering/platform'
|
2022-04-08 18:05:49 +00:00
|
|
|
import PersonContent from './PersonContent.svelte'
|
2022-09-21 08:08:25 +00:00
|
|
|
import type { AnyComponent, AnySvelteComponent } from '@hcengineering/ui'
|
2021-08-07 14:49:14 +00:00
|
|
|
|
2022-06-07 08:57:05 +00:00
|
|
|
export let value: Person | null | undefined
|
2022-04-28 12:03:10 +00:00
|
|
|
export let inline = false
|
2022-08-25 03:11:10 +00:00
|
|
|
export let enlargedText = false
|
2022-04-28 12:03:10 +00:00
|
|
|
export let isInteractive = true
|
2022-05-12 07:05:26 +00:00
|
|
|
export let shouldShowAvatar = true
|
2022-04-08 18:05:49 +00:00
|
|
|
export let shouldShowName = true
|
|
|
|
export let shouldShowPlaceholder = false
|
2022-04-28 12:03:10 +00:00
|
|
|
export let defaultName: IntlString | undefined = undefined
|
2022-06-30 03:41:46 +00:00
|
|
|
export let tooltipLabels:
|
|
|
|
| {
|
|
|
|
personLabel?: IntlString
|
|
|
|
placeholderLabel?: IntlString
|
|
|
|
component?: AnySvelteComponent | AnyComponent
|
|
|
|
props?: any
|
|
|
|
}
|
|
|
|
| undefined = undefined
|
2022-04-28 12:03:10 +00:00
|
|
|
export let avatarSize: 'inline' | 'tiny' | 'x-small' | 'small' | 'medium' | 'large' | 'x-large' = 'x-small'
|
|
|
|
export let onEdit: ((event: MouseEvent) => void) | undefined = undefined
|
2021-08-07 14:49:14 +00:00
|
|
|
</script>
|
|
|
|
|
2022-04-08 18:05:49 +00:00
|
|
|
{#if value || shouldShowPlaceholder}
|
2022-06-07 04:10:34 +00:00
|
|
|
<PersonContent
|
|
|
|
showTooltip={tooltipLabels
|
|
|
|
? {
|
2022-06-30 03:41:46 +00:00
|
|
|
label: value ? tooltipLabels.personLabel : undefined,
|
|
|
|
component: value ? tooltipLabels.component : undefined,
|
|
|
|
props: value && tooltipLabels.personLabel ? { value: formatName(value.name) } : tooltipLabels.props
|
2022-06-07 04:10:34 +00:00
|
|
|
}
|
|
|
|
: undefined}
|
|
|
|
{value}
|
|
|
|
{inline}
|
|
|
|
{onEdit}
|
|
|
|
{avatarSize}
|
|
|
|
{defaultName}
|
|
|
|
{isInteractive}
|
|
|
|
{shouldShowAvatar}
|
|
|
|
{shouldShowName}
|
|
|
|
{shouldShowPlaceholder}
|
2022-08-25 03:11:10 +00:00
|
|
|
{enlargedText}
|
2022-06-07 04:10:34 +00:00
|
|
|
/>
|
2021-12-06 15:15:36 +00:00
|
|
|
{/if}
|