Merge branch 'release' of https://github.com/appsmithorg/appsmith into release
This commit is contained in:
commit
ca47fe1123
|
|
@ -18,7 +18,7 @@ if (env === "PRODUCTION" || env === "STAGING") {
|
||||||
auto: true
|
auto: true
|
||||||
},
|
},
|
||||||
deploy: {
|
deploy: {
|
||||||
env: REACT_APP_SENTRY_ENVIRONMENT
|
env: process.env.REACT_APP_SENTRY_ENVIRONMENT
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ import {
|
||||||
DropdownOption,
|
DropdownOption,
|
||||||
ReactTableFilter,
|
ReactTableFilter,
|
||||||
} from "components/designSystems/appsmith/TableFilters";
|
} from "components/designSystems/appsmith/TableFilters";
|
||||||
|
import { RenderOptionWrapper } from "components/designSystems/appsmith/TableStyledWrappers";
|
||||||
import { debounce } from "lodash";
|
import { debounce } from "lodash";
|
||||||
|
|
||||||
const StyledRemoveIcon = styled(
|
const StyledRemoveIcon = styled(
|
||||||
|
|
@ -169,11 +170,35 @@ const operatorOptions: DropdownOption[] = [
|
||||||
{ label: "AND", value: OperatorTypes.AND, type: "" },
|
{ label: "AND", value: OperatorTypes.AND, type: "" },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const columnTypeNameMap: Record<ColumnTypes, string> = {
|
||||||
|
[ColumnTypes.TEXT]: "Text",
|
||||||
|
[ColumnTypes.VIDEO]: "Video",
|
||||||
|
[ColumnTypes.IMAGE]: "Image",
|
||||||
|
[ColumnTypes.NUMBER]: "Num",
|
||||||
|
[ColumnTypes.DATE]: "Date",
|
||||||
|
[ColumnTypes.CURRENCY]: "Curr",
|
||||||
|
[ColumnTypes.TIME]: "Time",
|
||||||
|
};
|
||||||
|
|
||||||
|
const RenderOption = (props: {
|
||||||
|
type: string;
|
||||||
|
title: string;
|
||||||
|
active: boolean;
|
||||||
|
}) => {
|
||||||
|
return (
|
||||||
|
<RenderOptionWrapper selected={props.active}>
|
||||||
|
<div className="title">{props.title}</div>
|
||||||
|
<div className="type">{columnTypeNameMap[props.type as ColumnTypes]}</div>
|
||||||
|
</RenderOptionWrapper>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
const RenderOptions = (props: {
|
const RenderOptions = (props: {
|
||||||
columns: DropdownOption[];
|
columns: DropdownOption[];
|
||||||
selectItem: (column: DropdownOption) => void;
|
selectItem: (column: DropdownOption) => void;
|
||||||
placeholder: string;
|
placeholder: string;
|
||||||
value?: string | Condition;
|
value?: string | Condition;
|
||||||
|
showType?: boolean;
|
||||||
className?: string;
|
className?: string;
|
||||||
}) => {
|
}) => {
|
||||||
const [selectedValue, selectValue] = useState(props.placeholder);
|
const [selectedValue, selectValue] = useState(props.placeholder);
|
||||||
|
|
@ -181,10 +206,19 @@ const RenderOptions = (props: {
|
||||||
sections: [
|
sections: [
|
||||||
{
|
{
|
||||||
options: props.columns.map((column: DropdownOption) => {
|
options: props.columns.map((column: DropdownOption) => {
|
||||||
|
const isActive = column.value === props.value;
|
||||||
return {
|
return {
|
||||||
content: column.label,
|
content: props.showType ? (
|
||||||
|
<RenderOption
|
||||||
|
title={column.label}
|
||||||
|
type={column.type}
|
||||||
|
active={isActive}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
column.label
|
||||||
|
),
|
||||||
value: column.value,
|
value: column.value,
|
||||||
active: column.value === props.value,
|
active: isActive,
|
||||||
onSelect: () => {
|
onSelect: () => {
|
||||||
selectValue(column.label);
|
selectValue(column.label);
|
||||||
props.selectItem(column);
|
props.selectItem(column);
|
||||||
|
|
@ -207,19 +241,19 @@ const RenderOptions = (props: {
|
||||||
skin: Skin.LIGHT,
|
skin: Skin.LIGHT,
|
||||||
};
|
};
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (props.value && configs.sections[0].options) {
|
if (props.value && props.columns) {
|
||||||
const selectedOptions = configs.sections[0].options.filter(
|
const selectedOptions = props.columns.filter(
|
||||||
i => i.value === props.value,
|
i => i.value === props.value,
|
||||||
);
|
);
|
||||||
if (selectedOptions && selectedOptions.length) {
|
if (selectedOptions && selectedOptions.length) {
|
||||||
selectValue(selectedOptions[0].content);
|
selectValue(selectedOptions[0].value);
|
||||||
} else {
|
} else {
|
||||||
selectValue(props.placeholder);
|
selectValue(props.placeholder);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
selectValue(props.placeholder);
|
selectValue(props.placeholder);
|
||||||
}
|
}
|
||||||
}, [props.value, props.placeholder, configs.sections]);
|
}, [props.value, props.placeholder, props.columns]);
|
||||||
return <CustomizedDropdown {...configs} />;
|
return <CustomizedDropdown {...configs} />;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -503,6 +537,7 @@ const Fields = (props: CascadeFieldProps & { state: CascadeFieldState }) => {
|
||||||
columns={props.columns}
|
columns={props.columns}
|
||||||
selectItem={selectColumn}
|
selectItem={selectColumn}
|
||||||
value={column}
|
value={column}
|
||||||
|
showType
|
||||||
placeholder="Attribute"
|
placeholder="Attribute"
|
||||||
className="t--table-filter-columns-dropdown"
|
className="t--table-filter-columns-dropdown"
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -340,3 +340,25 @@ export const TableIconWrapper = styled.div<{
|
||||||
export const SortIconWrapper = styled.div<{ rotate: string }>`
|
export const SortIconWrapper = styled.div<{ rotate: string }>`
|
||||||
transform: ${props => (props.rotate === "true" ? "rotate(180deg)" : "none")};
|
transform: ${props => (props.rotate === "true" ? "rotate(180deg)" : "none")};
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
export const RenderOptionWrapper = styled.div<{ selected: boolean }>`
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
width: 150px;
|
||||||
|
background: ${props => props.selected && Colors.GREEN};
|
||||||
|
position: relative;
|
||||||
|
.title {
|
||||||
|
color: ${props => (props.selected ? Colors.WHITE : Colors.OXFORD_BLUE)};
|
||||||
|
width: 120px;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
.type {
|
||||||
|
position: absolute;
|
||||||
|
left: 135px;
|
||||||
|
font-size: 12px !important;
|
||||||
|
color: ${props => (props.selected ? Colors.WHITE : Colors.BLUE_BAYOUX)};
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user