Skip to content

Commit

Permalink
fix: handle readonly in number presenter (#6026)
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Onnikov <[email protected]>
  • Loading branch information
aonnikov authored Jul 9, 2024
1 parent 8e7212e commit 617c144
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion plugins/view-resources/src/components/NumberPresenter.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion plugins/view-resources/src/components/Table.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 617c144

Please sign in to comment.