Fix Channels editor (#1756)

Signed-off-by: Alexander Platov <sas_lord@mail.ru>
This commit is contained in:
Alexander Platov 2022-05-15 07:50:13 +03:00 committed by GitHub
parent 8bf582475f
commit b8e8edebbc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 40 additions and 20 deletions

View File

@ -1,11 +1,11 @@
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
// It should be published with your NPM package. It should not be tracked by Git.
{
"tsdocVersion": "0.12",
"toolPackages": [
{
"packageName": "@microsoft/api-extractor",
"packageVersion": "7.23.0"
}
]
}
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
// It should be published with your NPM package. It should not be tracked by Git.
{
"tsdocVersion": "0.12",
"toolPackages": [
{
"packageName": "@microsoft/api-extractor",
"packageVersion": "7.23.0"
}
]
}

View File

@ -23,7 +23,8 @@
IconBlueCheck,
registerFocus,
createFocusManager,
IconArrowRight
IconArrowRight,
IconEdit
} from '@anticrm/ui'
import IconCopy from './icons/Copy.svelte'
import { FocusHandler } from '@anticrm/ui'
@ -31,8 +32,8 @@
export let value: string = ''
export let placeholder: IntlString
export let editable: boolean = false
export let integration: boolean = false
export let editable: boolean | undefined = undefined
export let openable: boolean = false
const dispatch = createEventDispatcher()
let input: HTMLInputElement
@ -74,7 +75,7 @@
</script>
<FocusHandler manager={mgr} />
{#if editable}
{#if editable && editable === true}
<div class="editor-container buttons-group xsmall-gap">
<div class="cover-channel" class:show class:copied={label === plugin.string.Copied} data-tooltip={lTraslate}>
<input
@ -145,11 +146,22 @@
}}
on:click={copyChannel}
/>
{#if integration}
{#if editable !== undefined}
<Button
focusIndex={4}
kind={'transparent'}
size={'small'}
icon={IconEdit}
on:click={() => {
dispatch('update', 'edit')
}}
/>
{/if}
{#if openable}
<Button
focusIndex={5}
kind={'transparent'}
size={'small'}
icon={IconArrowRight}
on:click={() => {
dispatch('update', 'open')

View File

@ -38,7 +38,7 @@
import ChannelEditor from './ChannelEditor.svelte'
export let value: AttachedData<Channel>[] | Channel | null
export let editable: boolean = false
export let editable: boolean | undefined = undefined
export let kind: ButtonKind = 'no-border'
export let size: ButtonSize = 'small'
export let length: 'short' | 'full' = 'full'
@ -224,11 +224,19 @@
{#each displayItems as item, i}
<Tooltip
component={opened !== i ? ChannelEditor : undefined}
props={{ value: item.value, placeholder: item.placeholder, editable: false, integration: item.integration }}
props={{
value: item.value,
placeholder: item.placeholder,
editable: editable !== undefined ? false : undefined,
openable: item.presenter ?? false
}}
onUpdate={(result) => {
if (result.detail === 'open') {
closeTooltip()
dispatch('open', item)
} else if (result.detail === 'edit') {
closeTooltip()
editChannel(btns[i], i, item)
}
}}
>

View File

@ -26,7 +26,7 @@
export let attachedTo: Ref<Doc>
export let attachedClass: Ref<Class<Doc>>
export let integrations: Set<Ref<Doc>> | undefined = undefined
export let editable = true
export let editable: boolean | undefined = true
export let allowOpen = true
export let focusIndex = -1

View File

@ -21,7 +21,7 @@
export let value: Channel[] | Channel | null
export let editable = false
export let editable: boolean | undefined = undefined
export let kind: ButtonKind = 'link-bordered'
export let size: ButtonSize = 'small'
export let length: 'short' | 'full' = 'short'