From 99519d3d8edc93da0ecb4bdb8c9fd2823ddbd7eb Mon Sep 17 00:00:00 2001 From: daZepelin <63473480+daZepelin@users.noreply.github.com> Date: Thu, 27 Jul 2023 12:44:08 +0300 Subject: [PATCH] feat(web/dialog): precision prop for number input (#372) * feat(web/input): added precision prop for number input * fix(web/input): added missing disabled prop to checkbox * fix(web/input): correct icon for debug data * fix(web/input): remove step prop from typings * fix(web/debug): remove step prop --- web/src/features/dev/debug/input.ts | 8 ++++++++ web/src/features/dialog/components/fields/checkbox.tsx | 1 + web/src/features/dialog/components/fields/number.tsx | 1 + web/src/typings/dialog.ts | 1 + 4 files changed, 11 insertions(+) diff --git a/web/src/features/dev/debug/input.ts b/web/src/features/dev/debug/input.ts index 35424c3..b7c9341 100644 --- a/web/src/features/dev/debug/input.ts +++ b/web/src/features/dev/debug/input.ts @@ -40,6 +40,14 @@ export const debugInput = () => { max: 10, icon: 'receipt', }, + { + type: 'number', + label: 'Price', + default: 6.5, + min: 0, + max: 10, + icon: 'receipt', + }, { type: 'slider', label: 'Slide bar', diff --git a/web/src/features/dialog/components/fields/checkbox.tsx b/web/src/features/dialog/components/fields/checkbox.tsx index aadeaf2..55a6ca5 100644 --- a/web/src/features/dialog/components/fields/checkbox.tsx +++ b/web/src/features/dialog/components/fields/checkbox.tsx @@ -16,6 +16,7 @@ const CheckboxField: React.FC = (props) => { required={props.row.required} label={props.row.label} defaultChecked={props.row.checked} + disabled={props.row.disabled} /> ); }; diff --git a/web/src/features/dialog/components/fields/number.tsx b/web/src/features/dialog/components/fields/number.tsx index 82e45d6..3738320 100644 --- a/web/src/features/dialog/components/fields/number.tsx +++ b/web/src/features/dialog/components/fields/number.tsx @@ -30,6 +30,7 @@ const NumberField: React.FC = (props) => { defaultValue={props.row.default} min={props.row.min} max={props.row.max} + precision={props.row.precision} disabled={props.row.disabled} icon={props.row.icon && } withAsterisk={props.row.required} diff --git a/web/src/typings/dialog.ts b/web/src/typings/dialog.ts index 8ab0cd7..b66359f 100644 --- a/web/src/typings/dialog.ts +++ b/web/src/typings/dialog.ts @@ -40,6 +40,7 @@ export interface ISelect extends BaseField<'select' | 'multi-select', string | s } export interface INumber extends BaseField<'number', number> { + precision?: number; min?: number; max?: number; }