Skip to content
Closed
Changes from 2 commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
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
7 changes: 7 additions & 0 deletions app/client/src/widgets/BaseInputWidget/component/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,12 @@ class BaseInputComponent extends React.Component<
const locale = this.props.shouldUseLocale ? getLocale() : undefined;
const leftIcon = this.getLeftIcon();
const conditionalProps: Record<string, number> = {};
const ICON_ALIGN_RIGHT = 'right';
const rightElement = (
this.props.iconAlign === ICON_ALIGN_RIGHT && this.props.iconName
? <Tag icon={this.props.iconName} />
: undefined
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tip

Codebase Verification

Ensure rightElement Consistency Across All Input Components

It appears that rightElement is utilized in multiple input components, including MultiSelectWidgetV2, SingleSelectTreeWidget, MultiSelectTreeWidget, and InputWidget. Please verify that the icon alignment changes applied to the numeric input are consistently implemented across all these input types to maintain uniform behavior throughout the application.

Analysis chain

Pop quiz time! Let's think about our other input types.

You've done a great job fixing the icon alignment for numeric inputs. But remember, in our class, we have many types of inputs. Can you show me how this change affects other input types?

Let's do a little homework to make sure our fix works for all input types:

After running these tests, please review the results and ensure that the icon alignment is consistent across all input types. If not, consider applying a similar fix to other input type implementations.

Also applies to: 574-574


Great effort on running the initial checks! It looks like rg didn't recognize the typescript file type. Let's adjust our approach to ensure we cover all TypeScript files properly.

Please run the following scripts to verify the rightElement usage across all input types:

Once you've executed these scripts, please share the results so we can ensure that the icon alignment is consistently applied across all input types. This will help maintain the reliability and uniformity of our component.


Let's refine our approach to ensure we effectively check the rightElement usage across all input types.

Please run the following scripts to accurately target .ts and .tsx files without relying on the --type flag:

Once you've executed these scripts, please share the results so we can ensure that the icon alignment is consistently applied across all input types. This adjustment will help maintain the reliability and uniformity of our component.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if the rightElement logic is applied consistently across all input types

# Test: Search for other input type implementations
echo "Searching for other input type implementations:"
rg --type typescript "private \w+InputComponent" app/client/src/widgets/BaseInputWidget/component/index.tsx

# Test: Check if rightElement is used in other input type implementations
echo "Checking if rightElement is used in other input type implementations:"
rg --type typescript "rightElement[=:]" app/client/src/widgets/BaseInputWidget/component/index.tsx

Length of output: 534


Script:

# Description: Check if the rightElement logic is applied consistently across all input types

# Test: Search for other input type implementations by targeting .ts and .tsx files
echo "Searching for other input type implementations:"
rg --type-add 'ts=**/*.{ts,tsx}' --type ts "private \w+InputComponent" app/client/src/widgets/BaseInputWidget/component/index.tsx

# Test: Check if rightElement is used in other input type implementations
echo "Checking if rightElement is used in other input type implementations:"
rg --type-add 'ts=**/*.{ts,tsx}' --type ts "rightElement[=:]" app/client/src/widgets/BaseInputWidget/component/index.tsx

Length of output: 628


Script:

#!/bin/bash
# Description: Check if the rightElement logic is applied consistently across all input types

# Test: Search for other input type implementations by targeting .ts and .tsx files
echo "Searching for other input type implementations:"
rg "private \w+InputComponent" $(fd --extension ts --extension tsx app/client/src/widgets/BaseInputWidget/component/index.tsx)

# Test: Check if rightElement is used in other input type implementations
echo "Checking if rightElement is used in other input type implementations:"
rg "rightElement[=:]" $(fd --extension ts --extension tsx app/client/src/widgets/BaseInputWidget/component/index.tsx)

Length of output: 1986


if (!isNil(this.props.maxNum)) {
conditionalProps.max = this.props.maxNum;
Expand Down Expand Up @@ -565,6 +571,7 @@ class BaseInputComponent extends React.Component<
onKeyUp={this.onKeyUp}
onValueChange={this.onNumberChange}
placeholder={this.props.placeholder}
rightElement={rightElement}
stepSize={this.props.stepSize}
value={this.props.value}
{...conditionalProps}
Expand Down