diff --git a/frontend/src/js/common/components/IndexPrefix.ts b/frontend/src/js/common/components/IndexPrefix.ts new file mode 100644 index 0000000000..75766760b1 --- /dev/null +++ b/frontend/src/js/common/components/IndexPrefix.ts @@ -0,0 +1,11 @@ +import styled from "@emotion/styled"; + +export const IndexPrefix = styled("span")` + display: inline-block; + margin-right: 7px; + border-radius: ${({ theme }) => theme.borderRadius}; + background-color: ${({ theme }) => theme.col.blueGrayVeryLight}; + padding: 3px; + line-height: 1; + font-size: ${({ theme }) => theme.font.tiny}; +`; diff --git a/frontend/src/js/form-components/InputDateRange.tsx b/frontend/src/js/form-components/InputDateRange.tsx index 85840afa65..d6c2384d92 100644 --- a/frontend/src/js/form-components/InputDateRange.tsx +++ b/frontend/src/js/form-components/InputDateRange.tsx @@ -3,6 +3,7 @@ import styled from "@emotion/styled"; import React, { FC, ReactNode } from "react"; import { useTranslation } from "react-i18next"; +import { IndexPrefix } from "../common/components/IndexPrefix"; import { formatDateFromState, parseDate, @@ -35,7 +36,7 @@ const StyledLabel = styled(Label)<{ large?: boolean }>` `} `; -const StyledLabeled = styled(Labeled)` +const SxLabeled = styled(Labeled)` &:first-of-type { margin-right: 10px; margin-bottom: 10px; @@ -44,6 +45,7 @@ const StyledLabeled = styled(Labeled)` interface PropsT { label?: ReactNode; + indexPrefix?: number; labelSuffix?: ReactNode; className?: string; inline?: boolean; @@ -73,6 +75,7 @@ const InputDateRange: FC = ({ inline, center, label, + indexPrefix, autoFocus, labelSuffix, input: { value, onChange }, @@ -133,13 +136,14 @@ const InputDateRange: FC = ({ {label && ( + {exists(indexPrefix) && # {indexPrefix}} {label} {labelSuffix && labelSuffix} )} - + = ({ autoFocus, }} /> - - + + = ({ } onBlur={(e) => applyDate("max", e.target.value, displayDateFormat)} /> - + ); diff --git a/frontend/src/js/form-components/InputMultiSelect.tsx b/frontend/src/js/form-components/InputMultiSelect.tsx index e078472c6e..b023474fa7 100644 --- a/frontend/src/js/form-components/InputMultiSelect.tsx +++ b/frontend/src/js/form-components/InputMultiSelect.tsx @@ -78,6 +78,7 @@ export interface MultiSelectInputProps { export interface InputMultiSelectProps { label?: string; + indexPrefix?: number; options: SelectOptionT[]; disabled?: boolean; tooltip?: string; @@ -200,6 +201,7 @@ const InputMultiSelect: FC = (props) => { {props.tooltip && } } + indexPrefix={props.indexPrefix} > {hasTooManyValues && ( ` interface Props extends InputProps { label: string; + indexPrefix?: number; inputType?: string; money?: boolean; className?: string; @@ -39,6 +40,7 @@ const InputPlain = ( label={props.label} tinyLabel={props.tinyLabel} largeLabel={props.large} + indexPrefix={props.indexPrefix} > { moneyRange?: boolean; label: string; + indexPrefix?: number; unit?: string; limits?: { min?: number; @@ -72,6 +73,7 @@ const InputRange = ({ placeholder, disabled, label, + indexPrefix, unit, tooltip, onSwitchMode, @@ -123,6 +125,7 @@ const InputRange = ({ diff --git a/frontend/src/js/form-components/InputRangeHeader.tsx b/frontend/src/js/form-components/InputRangeHeader.tsx index ce9a45eb5a..417708ba80 100644 --- a/frontend/src/js/form-components/InputRangeHeader.tsx +++ b/frontend/src/js/form-components/InputRangeHeader.tsx @@ -1,11 +1,14 @@ import styled from "@emotion/styled"; import React, { FC } from "react"; +import { IndexPrefix } from "../common/components/IndexPrefix"; +import { exists } from "../common/helpers/exists"; import InfoTooltip from "../tooltip/InfoTooltip"; interface PropsT { className?: string; label: string; + indexPrefix?: number; unit?: string; tooltip?: string; disabled?: boolean; @@ -15,10 +18,13 @@ const Container = styled("p")<{ disabled?: boolean }>` font-size: ${({ theme }) => theme.font.sm}; margin: 6px 0 3px; color: ${({ theme, disabled }) => (disabled ? theme.col.gray : "initial")}; + display: flex; + align-items: center; `; const InputRangeHeader: FC = ({ label, + indexPrefix, unit, className, tooltip, @@ -26,6 +32,7 @@ const InputRangeHeader: FC = ({ }) => { return ( + {exists(indexPrefix) && # {indexPrefix}} {label} {unit && ` ( ${unit} )`} {tooltip && } diff --git a/frontend/src/js/form-components/InputSelect.tsx b/frontend/src/js/form-components/InputSelect.tsx index afe9357609..a5cf72eac5 100644 --- a/frontend/src/js/form-components/InputSelect.tsx +++ b/frontend/src/js/form-components/InputSelect.tsx @@ -11,6 +11,7 @@ import ReactSelect from "./ReactSelect"; interface PropsT { className?: string; label?: string; + indexPrefix?: number; options: SelectOptionT[]; disabled?: boolean; small?: boolean; @@ -30,6 +31,7 @@ const InputSelect = ({ small, input, label, + indexPrefix, options, disabled, selectProps, @@ -50,6 +52,7 @@ const InputSelect = ({ className={className} disabled={disabled} valueChanged={!isEmpty(input.value) && input.value !== input.defaultValue} + indexPrefix={indexPrefix} label={ <> {!!label && label} diff --git a/frontend/src/js/form-components/Label.tsx b/frontend/src/js/form-components/Label.tsx index 8d288ad4f1..4bb0a5b742 100644 --- a/frontend/src/js/form-components/Label.tsx +++ b/frontend/src/js/form-components/Label.tsx @@ -3,14 +3,14 @@ import styled from "@emotion/styled"; const Label = styled("span")<{ tiny?: boolean; large?: boolean; - inline?: boolean; disabled?: boolean; fullWidth?: boolean; }>` font-size: ${({ theme, tiny, large }) => large ? theme.font.md : tiny ? theme.font.xs : theme.font.sm}; - display: ${({ inline }) => (inline ? "inline-block" : "block")}; - margin: ${({ inline }) => (inline ? "0" : "6px 0 3px")}; + display: flex; + align-items: center; + margin: 6px 0 3px; color: ${({ theme, disabled }) => (disabled ? theme.col.gray : "initial")}; width: ${({ fullWidth }) => (fullWidth ? "100%" : "inherit")}; `; diff --git a/frontend/src/js/form-components/Labeled.tsx b/frontend/src/js/form-components/Labeled.tsx index fcb6ff2a06..df7afafa10 100644 --- a/frontend/src/js/form-components/Labeled.tsx +++ b/frontend/src/js/form-components/Labeled.tsx @@ -2,6 +2,9 @@ import { css } from "@emotion/react"; import styled from "@emotion/styled"; import React, { ReactNode } from "react"; +import { IndexPrefix } from "../common/components/IndexPrefix"; +import { exists } from "../common/helpers/exists"; + import Label from "./Label"; const Root = styled("label")<{ fullWidth?: boolean }>` @@ -17,6 +20,7 @@ const Root = styled("label")<{ fullWidth?: boolean }>` interface Props { label: ReactNode; + indexPrefix?: number; className?: string; tinyLabel?: boolean; largeLabel?: boolean; @@ -25,6 +29,7 @@ interface Props { } const Labeled = ({ + indexPrefix, className, fullWidth, label, @@ -35,6 +40,7 @@ const Labeled = ({ return ( {children} diff --git a/frontend/src/js/query-node-editor/ContentCell.tsx b/frontend/src/js/query-node-editor/ContentCell.tsx index 68852a4e39..e8ed4eefcc 100644 --- a/frontend/src/js/query-node-editor/ContentCell.tsx +++ b/frontend/src/js/query-node-editor/ContentCell.tsx @@ -12,11 +12,11 @@ const Root = styled("div")` const Content = styled("div")` flex-grow: 1; - padding: 6px 10px; + padding: 3px 10px; `; const Headline = styled(Heading4)` - margin: 12px 10px 0; + margin: 14px 10px 0; `; interface PropsT { diff --git a/frontend/src/js/query-node-editor/ResolvableMultiSelect.tsx b/frontend/src/js/query-node-editor/ResolvableMultiSelect.tsx index 57a955e1ba..c824c4d508 100644 --- a/frontend/src/js/query-node-editor/ResolvableMultiSelect.tsx +++ b/frontend/src/js/query-node-editor/ResolvableMultiSelect.tsx @@ -24,6 +24,7 @@ interface PropsT { context: FilterContextT; label: string; + indexPrefix?: number; options: SelectOptionT[]; disabled?: boolean; tooltip?: string; @@ -40,6 +41,7 @@ const ResolvableMultiSelect: FC = ({ context, input, label, + indexPrefix, options, disabled, allowDropFile, @@ -146,6 +148,7 @@ const ResolvableMultiSelect: FC = ({ isLoading={isLoading || loading} startLoadingThreshold={startLoadingThreshold} disabled={disabled} + indexPrefix={indexPrefix} onLoad={onLoad} onDropFile={onDropFile} allowDropFile={allowDropFile} diff --git a/frontend/src/js/query-node-editor/TableFilters.tsx b/frontend/src/js/query-node-editor/TableFilters.tsx index a0dbe186f7..fa54a19c1c 100644 --- a/frontend/src/js/query-node-editor/TableFilters.tsx +++ b/frontend/src/js/query-node-editor/TableFilters.tsx @@ -52,6 +52,7 @@ const TableFilters = (props: PropsT) => { case "SELECT": return ( { return ( { case "BIG_MULTI_SELECT": return ( { case "INTEGER_RANGE": return ( { case "REAL_RANGE": return ( { case "MONEY_RANGE": return ( { case "STRING": return (