From 4f69c7c5c1b885731de325b13baa9207338afe15 Mon Sep 17 00:00:00 2001 From: davidxd33 Date: Thu, 27 Oct 2022 03:17:53 -0400 Subject: [PATCH] feat(interface/dialog): disabled row property (#142) * feat(interface/dialog): readonly, disabled flags * Update TS prop types * refactor(web/input): remove read only property Co-authored-by: davidxd33 --- package/client/resource/interface/input.ts | 1 + resource/interface/client/input.lua | 1 + web/src/features/dialog/components/input.tsx | 1 + web/src/features/dialog/components/number.tsx | 1 + web/src/features/dialog/components/select.tsx | 2 ++ web/src/features/dialog/components/slider.tsx | 1 + web/src/interfaces/dialog.ts | 5 +++++ 7 files changed, 12 insertions(+) diff --git a/package/client/resource/interface/input.ts b/package/client/resource/interface/input.ts index 9455636..9226cd7 100644 --- a/package/client/resource/interface/input.ts +++ b/package/client/resource/interface/input.ts @@ -9,6 +9,7 @@ interface InputDialogRowProps { iconColor?: string; placeholder?: string; default?: string | number; + disabled?: boolean; checked?: boolean; min?: number; max?: number; diff --git a/resource/interface/client/input.lua b/resource/interface/client/input.lua index 2491138..b84e703 100644 --- a/resource/interface/client/input.lua +++ b/resource/interface/client/input.lua @@ -9,6 +9,7 @@ local input ---@field iconColor? string ---@field placeholder? string ---@field default? string | number +---@field disabled? boolean ---@field checked? boolean ---@field min? number ---@field max? number diff --git a/web/src/features/dialog/components/input.tsx b/web/src/features/dialog/components/input.tsx index 2ecfc4e..09de9dd 100644 --- a/web/src/features/dialog/components/input.tsx +++ b/web/src/features/dialog/components/input.tsx @@ -29,6 +29,7 @@ const InputField: React.FC = (props) => { placeholder={props.row.placeholder} defaultValue={props.row.default} type={!props.row.password || props.passwordStates[props.index] ? 'text' : 'password'} + isDisabled={props.row.disabled} /> {props.row.password && ( = (props) => { defaultValue={props.row.default} min={props.row.min} max={props.row.max} + isDisabled={props.row.disabled} > {props.row.icon && ( } /> diff --git a/web/src/features/dialog/components/select.tsx b/web/src/features/dialog/components/select.tsx index 513ec28..733babf 100644 --- a/web/src/features/dialog/components/select.tsx +++ b/web/src/features/dialog/components/select.tsx @@ -25,6 +25,8 @@ const SelectField: React.FC = (props) => {