mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-23 11:31:57 +03:00
replace isEditable with readonly (#2925)
Signed-off-by: Ruslan Bayandinov <wazsone@ya.ru>
This commit is contained in:
parent
da22bf802d
commit
cf7fdb7f16
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
export let object: Doc
|
export let object: Doc
|
||||||
export let label: IntlString
|
export let label: IntlString
|
||||||
export let isEditable: boolean = true
|
export let readonly: boolean = false
|
||||||
export let attr: AnyAttribute | undefined = undefined
|
export let attr: AnyAttribute | undefined = undefined
|
||||||
|
|
||||||
let items: TagReference[] = []
|
let items: TagReference[] = []
|
||||||
@ -21,7 +21,7 @@
|
|||||||
items = result
|
items = result
|
||||||
})
|
})
|
||||||
async function tagsHandler (evt: MouseEvent): Promise<void> {
|
async function tagsHandler (evt: MouseEvent): Promise<void> {
|
||||||
if (!isEditable) return
|
if (readonly) return
|
||||||
showPopup(TagsEditorPopup, { object }, getEventPopupPositionElement(evt))
|
showPopup(TagsEditorPopup, { object }, getEventPopupPositionElement(evt))
|
||||||
}
|
}
|
||||||
async function removeTag (tag: Ref<TagElement>): Promise<void> {
|
async function removeTag (tag: Ref<TagElement>): Promise<void> {
|
||||||
@ -34,10 +34,16 @@
|
|||||||
<div class="flex-row-center flex-wrap">
|
<div class="flex-row-center flex-wrap">
|
||||||
{#each items as value}
|
{#each items as value}
|
||||||
<div class="step-container">
|
<div class="step-container">
|
||||||
<TagReferencePresenter {attr} {value} {isEditable} kind={'labels'} on:remove={(res) => removeTag(res.detail)} />
|
<TagReferencePresenter
|
||||||
|
{attr}
|
||||||
|
{value}
|
||||||
|
isEditable={!readonly}
|
||||||
|
kind={'labels'}
|
||||||
|
on:remove={(res) => removeTag(res.detail)}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
{#if isEditable}
|
{#if !readonly}
|
||||||
<div class="step-container">
|
<div class="step-container">
|
||||||
<button class="tag-button" on:click|stopPropagation={tagsHandler}>
|
<button class="tag-button" on:click|stopPropagation={tagsHandler}>
|
||||||
<div class="icon"><Icon icon={IconAdd} size={'full'} /></div>
|
<div class="icon"><Icon icon={IconAdd} size={'full'} /></div>
|
||||||
@ -46,7 +52,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{:else if isEditable}
|
{:else if !readonly}
|
||||||
<button class="tag-button" style="width: min-content" on:click|stopPropagation={tagsHandler}>
|
<button class="tag-button" style="width: min-content" on:click|stopPropagation={tagsHandler}>
|
||||||
<div class="icon"><Icon icon={IconAdd} size={'full'} /></div>
|
<div class="icon"><Icon icon={IconAdd} size={'full'} /></div>
|
||||||
<span class="overflow-label label"><Label {label} /></span>
|
<span class="overflow-label label"><Label {label} /></span>
|
||||||
|
Loading…
Reference in New Issue
Block a user