Skip to content

Commit 259e15f

Browse files
authored
Merge pull request #3546 from czwe-01/thulasizwe/en/dropdown-tag
Thulasizwe/en/dropdown tag
2 parents ca3ac70 + 6eaa916 commit 259e15f

File tree

6 files changed

+14
-12
lines changed

6 files changed

+14
-12
lines changed

shesha-reactjs/src/components/dropdown/dropdown.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export const Dropdown: FC<IDropdownProps> = ({
3030
style,
3131
size,
3232
showIcon,
33-
solidColor = true,
33+
solidColor,
3434
showItemName,
3535
allowClear = true,
3636
displayStyle,
@@ -79,6 +79,7 @@ export const Dropdown: FC<IDropdownProps> = ({
7979
color: item?.color,
8080
icon: item?.icon,
8181
data: item?.data,
82+
description: item?.description,
8283
};
8384
}, [incomeValueFunc]);
8485

@@ -104,6 +105,7 @@ export const Dropdown: FC<IDropdownProps> = ({
104105
data: outcomeValueFunc(fetchedItem, args),
105106
color: fetchedItem?.color,
106107
icon: fetchedItem?.icon,
108+
description: fetchedItem?.description,
107109
};
108110
}, [labelCustomJs, outcomeValueFunc, incomeValueFunc]);
109111

@@ -198,7 +200,7 @@ export const Dropdown: FC<IDropdownProps> = ({
198200
return <ReflistTag
199201
key={option?.value}
200202
value={option?.value}
201-
tooltip={option?.description}
203+
description={option?.description}
202204
color={option?.color}
203205
icon={option?.icon}
204206
showIcon={showIcon}
@@ -229,7 +231,7 @@ export const Dropdown: FC<IDropdownProps> = ({
229231
const option = options.find((o) => o.value === props.value);
230232
return <ReflistTag
231233
value={option?.value}
232-
tooltip={option?.description}
234+
description={option?.description}
233235
color={option?.color}
234236
icon={option?.icon}
235237
showIcon={showIcon}

shesha-reactjs/src/components/readOnlyDisplayFormItem/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export const ReadOnlyDisplayFormItem: FC<IReadOnlyDisplayFormItemProps> = (props
8383
icon={value?.icon}
8484
showIcon={showIcon}
8585
tagStyle={style}
86-
tooltip={value?.description}
86+
description={value?.description}
8787
solidColor={solidColor}
8888
showItemName={showItemName}
8989
label={displayName}
@@ -107,7 +107,7 @@ export const ReadOnlyDisplayFormItem: FC<IReadOnlyDisplayFormItemProps> = (props
107107
value={value}
108108
color={color}
109109
icon={icon}
110-
tooltip={description}
110+
description={description}
111111
showIcon={showIcon}
112112
tagStyle={style}
113113
solidColor={solidColor}

shesha-reactjs/src/components/refListDropDown/genericRefListDropDown.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ export const GenericRefListDropDown = <TValue,>(props: IGenericRefListDropDownPr
166166
return <ReflistTag
167167
key={option?.value}
168168
value={option?.value}
169-
tooltip={option?.description}
169+
description={option?.description}
170170
color={option?.color}
171171
icon={option?.icon}
172172
showIcon={showIcon}
@@ -197,7 +197,7 @@ export const GenericRefListDropDown = <TValue,>(props: IGenericRefListDropDownPr
197197
const option = options.find((o) => o.value === props.value);
198198
return <ReflistTag
199199
value={option?.value}
200-
tooltip={option?.description}
200+
description={option?.description}
201201
color={option?.color}
202202
icon={option?.icon}
203203
showIcon={showIcon}

shesha-reactjs/src/components/refListDropDown/reflistTag.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { Icon } from '../readOnlyDisplayFormItem';
66

77
interface IReflistTagProps {
88
value?: string | number;
9-
tooltip?: string;
9+
description?: string;
1010
color?: string;
1111
icon?: string | React.ReactNode;
1212
showIcon?: boolean;
@@ -16,7 +16,7 @@ interface IReflistTagProps {
1616
label?: string | React.ReactNode;
1717
placement?: TooltipProps['placement'];
1818
}
19-
function ReflistTag({ value, tooltip, color, icon, showIcon, tagStyle, solidColor, showItemName, label, placement = 'right' }: IReflistTagProps) {
19+
function ReflistTag({ value, description, color, icon, showIcon, tagStyle, solidColor, showItemName, label, placement = 'right' }: IReflistTagProps) {
2020

2121
const memoizedColor = !solidColor
2222
? color?.toLowerCase()
@@ -25,7 +25,7 @@ function ReflistTag({ value, tooltip, color, icon, showIcon, tagStyle, solidColo
2525
const labelToRender = typeof label === 'string' ? label.toUpperCase() : label;
2626

2727
return (
28-
<Tooltip title={tooltip} placement={placement as TooltipProps['placement']} style={{ cursor: 'pointer' }}>
28+
<Tooltip title={showItemName ? description : (description || labelToRender)} placement={placement as TooltipProps['placement']} style={{ cursor: 'pointer', zIndex: 2 }}>
2929
<Tag
3030
key={value}
3131
color={memoizedColor}

shesha-reactjs/src/designer-components/iconPicker/iconPickerWrapper.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export const IconPickerWrapper: FC<IconPickerWrapperProps> = (props) => {
6868
const iconValue = finalValue ?? defaultValue;
6969

7070
return (
71-
<div style={(defaultValue || value) ? { display: 'grid', placeItems: textAlign, width: '100%' } : {}}>
71+
<div style={(defaultValue || value) ? { display: 'grid', placeItems: textAlign } : {}}>
7272
<Tooltip title={props?.description}>
7373
<div
7474
style={{

shesha-reactjs/src/designer-components/inputComponent/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ export const InputComponent: FC<Omit<ISettingsInputProps, 'hidden'>> = (props) =
132132
case 'switch':
133133
/*Handle cases where defaultValue is used in place of defaultChecked*/
134134
return <Switch disabled={readOnly} size='small'
135-
defaultChecked={defaultChecked ?? defaultValue} onChange={onChange} defaultValue={defaultValue} value={value} />;
135+
defaultChecked={defaultChecked ?? defaultValue} onChange={onChange} value={value} />;
136136
case 'numberField':
137137
return <InputNumber
138138
placeholder={placeholder}

0 commit comments

Comments
 (0)