Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[GEN-2209]: fix delete button logic in input lists (#2186)
This pull request includes several changes to improve the behavior of input components in the `frontend/webapp/reuseable-components` directory. The main focus is on ensuring that the delete button functionality is consistent and that input validation is properly handled. Improvements to input validation and delete button functionality: * [`frontend/webapp/reuseable-components/input-list/index.tsx`](diffhunk://#diff-a00687e99957ec5d2b28432fc1959a9819b6f87371692a0bef21cf567bea7bfdL1-R2): Added the `isEmpty` utility function and modified the logic to disable the delete button when there is only one row and all inputs are empty. The `autoFocus` attribute was also updated to use `isEmpty`. [[1]](diffhunk://#diff-a00687e99957ec5d2b28432fc1959a9819b6f87371692a0bef21cf567bea7bfdL1-R2) [[2]](diffhunk://#diff-a00687e99957ec5d2b28432fc1959a9819b6f87371692a0bef21cf567bea7bfdR108-R110) [[3]](diffhunk://#diff-a00687e99957ec5d2b28432fc1959a9819b6f87371692a0bef21cf567bea7bfdL117-R129) * [`frontend/webapp/reuseable-components/input-table/index.tsx`](diffhunk://#diff-511aed49818334957716043c1273ee4e2a4c6bdc789f95e3cc2958f4cf603a1eL1-L5): Included the `isEmpty` utility function and updated the logic to disable the delete button under similar conditions as the input list. The `autoFocus` attribute was adjusted accordingly. [[1]](diffhunk://#diff-511aed49818334957716043c1273ee4e2a4c6bdc789f95e3cc2958f4cf603a1eL1-L5) [[2]](diffhunk://#diff-511aed49818334957716043c1273ee4e2a4c6bdc789f95e3cc2958f4cf603a1eL109-R111) [[3]](diffhunk://#diff-511aed49818334957716043c1273ee4e2a4c6bdc789f95e3cc2958f4cf603a1eL144-R145) [[4]](diffhunk://#diff-511aed49818334957716043c1273ee4e2a4c6bdc789f95e3cc2958f4cf603a1eL153-R163) * [`frontend/webapp/reuseable-components/key-value-input-list/index.tsx`](diffhunk://#diff-be0b643b1628d8036777fd4a042b1d241af86dd5035bfe9548a3b58b0dd0d327L1-R2): Integrated the `isEmpty` utility function and modified the delete button logic to ensure it is disabled when appropriate. The `autoFocus` and `hasError` attributes were also updated to use `isEmpty`. [[1]](diffhunk://#diff-be0b643b1628d8036777fd4a042b1d241af86dd5035bfe9548a3b58b0dd0d327L1-R2) [[2]](diffhunk://#diff-be0b643b1628d8036777fd4a042b1d241af86dd5035bfe9548a3b58b0dd0d327L80-R81) [[3]](diffhunk://#diff-be0b643b1628d8036777fd4a042b1d241af86dd5035bfe9548a3b58b0dd0d327R116-R118) [[4]](diffhunk://#diff-be0b643b1628d8036777fd4a042b1d241af86dd5035bfe9548a3b58b0dd0d327L130-R132) [[5]](diffhunk://#diff-be0b643b1628d8036777fd4a042b1d241af86dd5035bfe9548a3b58b0dd0d327L139-R154)
- Loading branch information