diff --git a/src/i18n-keysets/dash.palette-background/en.json b/src/i18n-keysets/dash.palette-background/en.json index 14b9d08242..57037ba4ce 100644 --- a/src/i18n-keysets/dash.palette-background/en.json +++ b/src/i18n-keysets/dash.palette-background/en.json @@ -1,4 +1,5 @@ { + "tooltip_click-to-select": "Select value", "value_default": "Basic", "value_transparent": "Transparent" } diff --git a/src/i18n-keysets/dash.palette-background/ru.json b/src/i18n-keysets/dash.palette-background/ru.json index 381704bd17..36c038369a 100644 --- a/src/i18n-keysets/dash.palette-background/ru.json +++ b/src/i18n-keysets/dash.palette-background/ru.json @@ -1,4 +1,5 @@ { + "tooltip_click-to-select": "Выберите значение", "value_default": "Базовый", "value_transparent": "Прозрачный" } diff --git a/src/ui/components/DialogChartWidget/DialogChartWidget.tsx b/src/ui/components/DialogChartWidget/DialogChartWidget.tsx index 0e2e985364..f42e4edd86 100644 --- a/src/ui/components/DialogChartWidget/DialogChartWidget.tsx +++ b/src/ui/components/DialogChartWidget/DialogChartWidget.tsx @@ -395,6 +395,7 @@ class DialogChartWidget extends React.PureComponent< tabs: { [tabIndex]: { background: { + enabled: {$set: true}, color: {$set: color}, }, }, @@ -724,12 +725,10 @@ class DialogChartWidget extends React.PureComponent< > {i18n('dash.widget-dialog.edit', 'field_background-enable')} - {Boolean(background?.enabled) && ( - - )} + )} {enableFilteringSetting && this.renderFilteringCharts()} diff --git a/src/ui/components/DialogImageWidget/DialogImageWidget.tsx b/src/ui/components/DialogImageWidget/DialogImageWidget.tsx index aca648abc1..4125dfc766 100644 --- a/src/ui/components/DialogImageWidget/DialogImageWidget.tsx +++ b/src/ui/components/DialogImageWidget/DialogImageWidget.tsx @@ -162,12 +162,10 @@ export function DialogImageWidget(props: Props) { > {i18n('dash.widget-dialog.edit', 'field_background-enable')} - {data.background?.enabled && ( - updateData({background: {color}})} - /> - )} + updateData({background: {color, enabled: true}})} + /> diff --git a/src/ui/components/DialogTextWidget/DialogTextWidget.tsx b/src/ui/components/DialogTextWidget/DialogTextWidget.tsx index f4dfb899cf..ca48a1277a 100644 --- a/src/ui/components/DialogTextWidget/DialogTextWidget.tsx +++ b/src/ui/components/DialogTextWidget/DialogTextWidget.tsx @@ -98,12 +98,10 @@ class DialogTextWidget extends React.PureComponent {i18n('dash.dashkit-plugin-common.view', 'label_background-checkbox')} - {Boolean(hasBackground) && ( - - )} + { - this.setState({backgroundColor: color}); + this.setState({backgroundColor: color, hasBackground: true}); }; } diff --git a/src/ui/components/DialogTitleWidget/DialogTitleWidget.tsx b/src/ui/components/DialogTitleWidget/DialogTitleWidget.tsx index 0efc0448e0..9c3e1f711f 100644 --- a/src/ui/components/DialogTitleWidget/DialogTitleWidget.tsx +++ b/src/ui/components/DialogTitleWidget/DialogTitleWidget.tsx @@ -157,12 +157,10 @@ class DialogTitleWidget extends React.PureComponent< > {i18n('dash.dashkit-plugin-common.view', 'label_background-checkbox')} - {Boolean(hasBackground) && ( - - )} + { - this.setState({backgroundColor: color}); + this.setState({backgroundColor: color, hasBackground: true}); }; } diff --git a/src/ui/units/dash/containers/Dialogs/components/PaletteBackground/PaletteBackground.tsx b/src/ui/units/dash/containers/Dialogs/components/PaletteBackground/PaletteBackground.tsx index 7e1789bc14..04934235e7 100644 --- a/src/ui/units/dash/containers/Dialogs/components/PaletteBackground/PaletteBackground.tsx +++ b/src/ui/units/dash/containers/Dialogs/components/PaletteBackground/PaletteBackground.tsx @@ -2,7 +2,7 @@ import React from 'react'; import {ChartColumn} from '@gravity-ui/icons'; import type {PaletteOption} from '@gravity-ui/uikit'; -import {ActionTooltip, Icon, Palette, Popover} from '@gravity-ui/uikit'; +import {ActionTooltip, Icon, Palette, Popover, Tooltip} from '@gravity-ui/uikit'; import block from 'bem-cn-lite'; import {i18n} from 'i18n'; import {DashCommonQa} from 'shared'; @@ -21,25 +21,29 @@ const PALETTE_HINTS = { [CustomPaletteColors.NONE]: i18n('dash.palette-background', 'value_transparent'), } as const; -const ColorItem = ({ - color, - isSelected, - classNameMod, - isPreview, - qa, -}: { - color: string; - classNameMod?: string; - isSelected?: boolean; - isPreview?: boolean; - qa?: string; -}) => { +const ColorItem = React.forwardRef(function ColorItem( + { + color, + isSelected, + classNameMod, + isPreview, + qa, + }: { + color: string; + classNameMod?: string; + isSelected?: boolean; + isPreview?: boolean; + qa?: string; + }, + ref: React.ForwardedRef, +) { const isTransparent = color === CustomPaletteColors.NONE; const isLikeChartBg = color === CustomPaletteColors.LIKE_CHART; const mod = classNameMod ? {[classNameMod]: Boolean(classNameMod)} : {}; return ( ); -}; +}); const colors = [ 'var(--g-color-base-info-light)', @@ -133,15 +137,18 @@ export const PaletteBackground = (props: PaletteBackgroundProps) => { return ( } > - + + + ); };