Skip to content

Commit

Permalink
fix(conditionBuilder): release review changes1 (#6133)
Browse files Browse the repository at this point in the history
* fix(conditionBuilder): release review changes1

* fix: data correction for sample data

---------

Co-authored-by: David Menendez <[email protected]>
Co-authored-by: Nandan Devadula <[email protected]>
  • Loading branch information
3 people authored Oct 21, 2024
1 parent 0c6740b commit d3f08bc
Show file tree
Hide file tree
Showing 10 changed files with 139 additions and 127 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,10 @@ $colors: (
/* stylelint-disable-next-line carbon/motion-easing-use */
transition: transform motion(exit, productive) $duration-fast-02;
}
.#{$block-class}__condition--interacting
.#{$block-class}__close-condition-wrapper {
z-index: 2;
}
}

.#{$block-class}__invalid-input {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ const ConditionBlock = (props: ConditionBlockProps) => {
onChange={(op) => onConnectorOperatorChange?.(op)}
/>
) : (
<div role="gridcell" />
''
)}

{isStatement && (
Expand Down Expand Up @@ -344,6 +344,7 @@ const ConditionBlock = (props: ConditionBlockProps) => {
renderIcon={Close}
className={`${blockClass}__close-condition`}
data-name="closeCondition"
wrapperClassName={`${blockClass}__close-condition-wrapper`}
/>
</span>
{/* </div> */}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ const ConditionConnector = ({
<ConditionBuilderButton label={operator} />
</span>
) : (
// <div className={className} {...rest}>

<ConditionBuilderItem
label={operator}
title={connectorText}
Expand All @@ -84,8 +82,6 @@ const ConditionConnector = ({
onChange={onChangeHandler}
/>
</ConditionBuilderItem>

// </div>
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ const ConditionBuilderContent = ({

const addConditionGroupHandler = () => {
const newGroup: ConditionGroup = {
statement: 'ifAll', // 'if|exclude if',
statement: 'ifAll',
groupOperator: 'and',
id: uuidv4(),
conditions: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ export const ItemOption = ({
);
};

const preventDefault = (evt) => evt.preventDefault();

if (!allOptions) {
return;
}
Expand All @@ -97,6 +99,7 @@ export const ItemOption = ({
labelText={clearSearchText}
closeButtonLabelText={clearSearchText}
onChange={onSearchChangeHandler}
onKeyDown={preventDefault}
/>
</div>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export const ItemOptionForValueField = ({
: [];

useEffect(() => {
//this commented code is kept as intentional. Alternate approach to pass async options instead of getOptions callback.
// if(rest['data-name'] == 'valueField'){
// const fetchData = async () => {
// const response = await config.options(conditionState);
Expand Down Expand Up @@ -153,6 +154,8 @@ export const ItemOptionForValueField = ({
? conditionState.property
: propertyText;
};
const preventDefault = (evt) => evt.preventDefault();

if (!allOptions) {
return <SelectSkeleton />;
}
Expand All @@ -165,6 +168,7 @@ export const ItemOptionForValueField = ({
labelText={clearSearchText}
closeButtonLabelText={clearSearchText}
onChange={onSearchChangeHandler}
onKeyDown={preventDefault}
/>
</div>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,25 @@ export const sampleDataStructure_Hierarchical = {
{
property: 'region',
operator: 'is',
value: 'IL',
value: { id: 'India', label: 'India' },
id: uuidv4(),
},
{
property: 'delivery',
operator: 'is',
value: 'processing',
value: { id: 'Processing', label: 'Processing' },
id: uuidv4(),
},
{
property: 'delivery',
operator: 'is',
value: 'processing',
value: { id: 'Processing', label: 'Processing' },
id: uuidv4(),
},
{
property: 'delivery',
operator: 'is',
value: 'processing',
value: { id: 'Processing', label: 'Processing' },
id: uuidv4(),
},
//group object repeats
Expand All @@ -48,25 +48,25 @@ export const sampleDataStructure_Hierarchical = {
{
property: 'region',
operator: 'is',
value: 'IL',
value: { id: 'India', label: 'India' },
id: uuidv4(),
},
{
property: 'delivery',
operator: 'is',
value: 'processing',
value: { id: 'Processing', label: 'Processing' },
id: uuidv4(),
},
{
property: 'delivery',
operator: 'is',
value: 'processing',
value: { id: 'Processing', label: 'Processing' },
id: uuidv4(),
},
{
property: 'delivery',
operator: 'is',
value: 'processing',
value: { id: 'Processing', label: 'Processing' },
id: uuidv4(),
},
//group object repeats
Expand All @@ -78,19 +78,19 @@ export const sampleDataStructure_Hierarchical = {
{
property: 'region',
operator: 'is',
value: 'IL',
value: { id: 'India', label: 'India' },
id: uuidv4(),
},
{
property: 'delivery',
operator: 'is',
value: 'processing',
value: { id: 'Processing', label: 'Processing' },
id: uuidv4(),
},
{
property: 'delivery',
operator: 'is',
value: 'processing',
value: { id: 'Processing', label: 'Processing' },
id: uuidv4(),
},
//group object repeats
Expand All @@ -108,13 +108,13 @@ export const sampleDataStructure_Hierarchical = {
{
property: 'continent',
operator: 'is',
value: 'Asia',
value: { id: 'Asia', label: 'Asia' },
id: uuidv4(),
},
{
property: 'region',
operator: 'is',
value: 'India',
value: { id: 'India', label: 'India' },
id: uuidv4(),
},
{
Expand Down Expand Up @@ -144,7 +144,7 @@ export const sampleDataStructure_nonHierarchical = {
id: 'Africa',
},
{
label: 'India',
label: { id: 'India', label: 'India' },
id: 'Ind',
},
],
Expand All @@ -153,7 +153,7 @@ export const sampleDataStructure_nonHierarchical = {
{
property: 'delivery',
operator: 'is',
value: 'processing',
value: { id: 'Processing', label: 'Processing' },
id: uuidv4(),
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
} from '@carbon/react/icons';
import CustomInput from './CustomInput';

//keeping this , an alternative way to give support for dynamic options.
//keeping this commented code intentionally ,which is an alternative way to give support for dynamic options.
//instead of supplying getOptions callback, we keep option property in inputConfig always as a async method instead to array as below.
// export const inputDataForAsyncOptions = {
// properties: [
Expand Down
Loading

0 comments on commit d3f08bc

Please sign in to comment.