Allow to disable creation in special view (#2865)

Signed-off-by: Denis Bunakalya <denis.bunakalya@xored.com>
This commit is contained in:
Denis Bunakalya 2023-04-04 05:49:15 +03:00 committed by GitHub
parent 15c082e62f
commit c6e00595d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -45,6 +45,7 @@
export let createLabel: IntlString | undefined
export let createComponent: AnyComponent | undefined
export let createComponentProps: Record<string, any> = {}
export let isCreationDisabled = false
export let descriptor: Ref<ViewletDescriptor> | undefined = undefined
export let baseQuery: DocumentQuery<Doc> = {}
@ -116,7 +117,14 @@
</div>
<div class="ac-header-full" class:secondRow={twoRows}>
{#if createLabel && createComponent}
<Button label={createLabel} icon={IconAdd} kind={'primary'} size={'small'} on:click={() => showCreateDialog()} />
<Button
label={createLabel}
icon={IconAdd}
kind={'primary'}
size={'small'}
disabled={isCreationDisabled}
on:click={() => showCreateDialog()}
/>
{/if}
<ViewletSettingButton bind:viewOptions {viewlet} />
</div>