From 617c144dafc9b1ff4498313651c39d57e592acac Mon Sep 17 00:00:00 2001 From: Alexander Onnikov Date: Tue, 9 Jul 2024 10:54:38 +0700 Subject: [PATCH] fix: handle readonly in number presenter (#6026) Signed-off-by: Alexander Onnikov --- plugins/view-resources/src/components/NumberPresenter.svelte | 3 ++- plugins/view-resources/src/components/Table.svelte | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/view-resources/src/components/NumberPresenter.svelte b/plugins/view-resources/src/components/NumberPresenter.svelte index d36de7514f..fd174c279d 100644 --- a/plugins/view-resources/src/components/NumberPresenter.svelte +++ b/plugins/view-resources/src/components/NumberPresenter.svelte @@ -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 -{#if onChange !== undefined} +{#if onChange !== undefined && !readonly} {:else} {value || ''} diff --git a/plugins/view-resources/src/components/Table.svelte b/plugins/view-resources/src/components/Table.svelte index ecf6fe2a20..efff426c7c 100644 --- a/plugins/view-resources/src/components/Table.svelte +++ b/plugins/view-resources/src/components/Table.svelte @@ -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)} />