diff options
author | Sebastian <sebasjm@gmail.com> | 2023-11-20 12:38:16 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2023-11-20 12:38:16 -0300 |
commit | 6138846050563e0dca95b0b6d792776925e4c35f (patch) | |
tree | b33cd36acf4b38d3a016506d4f7fa681c83beb63 /packages/aml-backoffice-ui/src/handlers/InputArray.tsx | |
parent | 7ed3e78f790837479fc2bb2eb6ddc40c78ce59b5 (diff) |
new forms api
Diffstat (limited to 'packages/aml-backoffice-ui/src/handlers/InputArray.tsx')
-rw-r--r-- | packages/aml-backoffice-ui/src/handlers/InputArray.tsx | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/packages/aml-backoffice-ui/src/handlers/InputArray.tsx b/packages/aml-backoffice-ui/src/handlers/InputArray.tsx index 00379bed6..d229b35de 100644 --- a/packages/aml-backoffice-ui/src/handlers/InputArray.tsx +++ b/packages/aml-backoffice-ui/src/handlers/InputArray.tsx @@ -107,22 +107,24 @@ export function InputArray<T extends object, K extends keyof T>( /> ); })} - <div class="pt-2"> - <Option - label={"Add..." as TranslatedString} - isSelected={selectedIndex === list.length} - isLast - isFirst - disabled={ - selectedIndex !== undefined && selectedIndex !== list.length - } - onClick={() => { - setSelected( - selectedIndex === list.length ? undefined : list.length, - ); - }} - /> - </div> + {!state.disabled && + <div class="pt-2"> + <Option + label={"Add..." as TranslatedString} + isSelected={selectedIndex === list.length} + isLast + isFirst + disabled={ + selectedIndex !== undefined && selectedIndex !== list.length + } + onClick={() => { + setSelected( + selectedIndex === list.length ? undefined : list.length, + ); + }} + /> + </div> + } </div> {selectedIndex !== undefined && ( /** @@ -131,6 +133,7 @@ export function InputArray<T extends object, K extends keyof T>( */ <FormProvider initialValue={selected} + readOnly={state.disabled} computeFormState={(v) => { // current state is ignored // the state is defined by the parent form |