Skip to content

Commit

Permalink
Merged in r2-2827-insight-fixes (pull request #6762)
Browse files Browse the repository at this point in the history
R2-2827: Wrapping insight filters
  • Loading branch information
jtoliver-quoin committed Apr 11, 2024
2 parents 99e0840 + 8023a1d commit 696aea2
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 46 deletions.
15 changes: 2 additions & 13 deletions app/javascript/components/form/components/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -128,21 +128,10 @@

:global [dir="rtl"] .MuiAutocomplete-endAdornment {
right: initial !important;
margin-left: 9px !important;
left: 0;
left: 9px !important;
}

:global .MuiAutocomplete-endAdornment {
position: relative !important;
margin-right: 9px !important;
right: 9px !important;
left: initial !important;
right: 0 !important;
}

:global .MuiAutocomplete-inputRoot {
display: flex;
}

:global .MuiAutocomplete-inputRoot input {
padding: 9.5px !important;
}
9 changes: 2 additions & 7 deletions app/javascript/components/form/fields/select-input.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -214,13 +214,8 @@ const SelectInput = ({ commonInputProps, metaInputProps, options: allOptions, fo
return <TextField {...inputParams} label={<InputLabel tooltip={tooltip} text={label} />} {...rest} />;
};

const renderTags = (value, getTagProps) => (
<div>
{value.map((option, index) => (
<Chip label={optionLabel(option)} {...getTagProps({ index })} disabled={disabled} />
))}
</div>
);
const renderTags = (value, getTagProps) =>
value.map((option, index) => <Chip label={optionLabel(option)} {...getTagProps({ index })} disabled={disabled} />);

const getOptionDisabled = option => {
if (option?.disabled) {
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/components/insights-filters/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ const Component = ({ moduleID, id, subReport, toggleControls }) => {
<form noValidate onSubmit={formMethods.handleSubmit(submit)}>
<div className={css.container}>
<div className={css.dateControlGroup}>{filterInputs(DATE_CONTROLS_GROUP)}</div>
{filterInputs()}
<div className={css.filters}>{filterInputs()}</div>
</div>
<div className={css.actions}>
<div>
Expand Down
13 changes: 12 additions & 1 deletion app/javascript/components/insights-filters/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@
}
}

.filters {
display: flex;
gap: var(--sp-2);
flex-wrap: wrap;

& > div {
width: calc(50% - var(--sp-1));
margin: 0;
}
}

.actions {
display: flex;
width: 25em;
Expand All @@ -26,9 +37,9 @@
.dateControlGroup {
display: flex;
flex-wrap: wrap;
flex: 2 !important;
gap: var(--sp-1);
justify-content: space-between;
flex: 1;

& > div {
margin: 0;
Expand Down
45 changes: 21 additions & 24 deletions app/javascript/components/searchable-select/component.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,31 +48,28 @@ const SearchableSelect = ({
return defaultValues || defaultEmptyValue;
})();

const renderTags = (value, getTagProps) => (
<div>
{value.map((option, index) => {
const { onDelete, ...rest } = { ...getTagProps({ index }) };
const chipProps = {
...(isDisabled || { onDelete }),
...rest,
classes: {
...(mode.isShow && {
disabled: css.disabledChip
})
}
};
const renderTags = (value, getTagProps) =>
value.map((option, index) => {
const { onDelete, ...rest } = { ...getTagProps({ index }) };
const chipProps = {
...(isDisabled || { onDelete }),
...rest,
classes: {
...(mode.isShow && {
disabled: css.disabledChip
})
}
};

return (
<Chip
size="small"
label={optionLabel(option, options, optionIdKey, optionLabelKey)}
{...chipProps}
disabled={isDisabled}
/>
);
})}
</div>
);
return (
<Chip
size="small"
label={optionLabel(option, options, optionIdKey, optionLabelKey)}
{...chipProps}
disabled={isDisabled}
/>
);
});

const getSelectedOptions = (option, selected) => optionEquality(option, selected, optionIdKey);
const getOptionLabel = option => optionLabel(option, options, optionIdKey, optionLabelKey);
Expand Down

0 comments on commit 696aea2

Please sign in to comment.