fix: handle readonly in number presenter (#6026)

Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
Alexander Onnikov 2024-07-09 10:54:38 +07:00 committed by GitHub
parent 8e7212e4a9
commit 617c144daf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 2 deletions

View File

@ -21,9 +21,10 @@
export let onChange: ((value: number | undefined) => void) | undefined = undefined
export let placeholder: IntlString = getEmbeddedLabel(' ')
export let kind: 'no-border' | 'link' | 'button' = 'link'
export let readonly = false
</script>
{#if onChange !== undefined}
{#if onChange !== undefined && !readonly}
<NumberEditor {onChange} {value} {placeholder} {kind} />
{:else}
<span>{value || ''}</span>

View File

@ -430,7 +430,7 @@
this={attribute.presenter}
value={getValue(attribute, object)}
onChange={getOnChange(object, attribute)}
{...joinProps(attribute, object, $restrictionStore.readonly)}
{...joinProps(attribute, object, readonly || $restrictionStore.readonly)}
/>
</div>
</td>