Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"name": "firstName",
"label": "First Name",
"type": "input",
"isPII": true
"isPII": true,
"isDisabled": true
},
{
"name": "lastName",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ type ItemBase = {
required?: { value: boolean; message: string } | boolean;
maxLength?: { value: number; message: string };
validate?: (data: any) => string | boolean;
isDisabled?: boolean;
} & IsPIIFlag;

type NonSaveable = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type UseFormFromDefinition = {
};
};

const alwaysEnabled = () => true;
const alwaysEnabled = (item: FormItemDefinition) => !((item as any).isDisabled ?? false);

const useCreateFormFromDefinition = ({
definition,
Expand Down
2 changes: 1 addition & 1 deletion plugin-hrm-form/src/components/forms/inputGenerator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
formItemDefinition,
parentsPath,
updateCallback,
isItemEnabled = () => true,
isItemEnabled = (item) => !((item as any).isDisabled ?? false),

Check failure on line 53 in plugin-hrm-form/src/components/forms/inputGenerator.tsx

View workflow job for this annotation

GitHub Actions / flex-ci / lint

Replace `(item)` with `item`
initialValue,
customHandlers,
htmlElRef = null,
Expand Down
Loading