diff --git a/src/i18n-keysets/dash.dialogs-common.edit/en.json b/src/i18n-keysets/dash.dialogs-common.edit/en.json index db0fcba7f5..7e84ebf635 100644 --- a/src/i18n-keysets/dash.dialogs-common.edit/en.json +++ b/src/i18n-keysets/dash.dialogs-common.edit/en.json @@ -1,3 +1,4 @@ { - "button_back": "Back" + "button_back": "Back", + "title_widget-settings": "Widget settings" } diff --git a/src/i18n-keysets/dash.dialogs-common.edit/ru.json b/src/i18n-keysets/dash.dialogs-common.edit/ru.json index e87a861332..824f2c624b 100644 --- a/src/i18n-keysets/dash.dialogs-common.edit/ru.json +++ b/src/i18n-keysets/dash.dialogs-common.edit/ru.json @@ -1,3 +1,4 @@ { - "button_back": "Назад" + "button_back": "Назад", + "title_widget-settings": "Настройки виджета" } 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/i18n-keysets/dash.title-dialog.edit/en.json b/src/i18n-keysets/dash.title-dialog.edit/en.json index 1ec4f0ad40..3e5faa31de 100644 --- a/src/i18n-keysets/dash.title-dialog.edit/en.json +++ b/src/i18n-keysets/dash.title-dialog.edit/en.json @@ -4,6 +4,7 @@ "button_save": "Save", "context_fill-title": "Enter title", "field_show-in-toc": "Display in contents", + "label_size": "Size", "label_title": "Title", "toast_required-field": "The field cannot be empty", "value_default": "Title" diff --git a/src/i18n-keysets/dash.title-dialog.edit/ru.json b/src/i18n-keysets/dash.title-dialog.edit/ru.json index 871e1fe5f6..9e78db8459 100644 --- a/src/i18n-keysets/dash.title-dialog.edit/ru.json +++ b/src/i18n-keysets/dash.title-dialog.edit/ru.json @@ -4,6 +4,7 @@ "button_save": "Сохранить", "context_fill-title": "Введите заголовок", "field_show-in-toc": "Отображать в оглавлении", + "label_size": "Размер", "label_title": "Заголовок", "toast_required-field": "Поле должно быть заполнено", "value_default": "Заголовок" diff --git a/src/shared/types/dash.ts b/src/shared/types/dash.ts index e0c78bcf4e..01d5af00f4 100644 --- a/src/shared/types/dash.ts +++ b/src/shared/types/dash.ts @@ -122,7 +122,6 @@ export type DashTabItem = type BackgroundSettings = { color: string; - enabled: boolean; }; export interface DashTabItemBase { diff --git a/src/shared/types/utility-types.ts b/src/shared/types/utility-types.ts index 35d9e84b77..a897b0b5e7 100644 --- a/src/shared/types/utility-types.ts +++ b/src/shared/types/utility-types.ts @@ -40,3 +40,5 @@ export type NonNullableBy = Omit & NoUndefinedField< type ObjectKeys = `${Exclude}`; export const objectKeys = Object.keys as (value: T) => Array>; + +export type ValueOf = T[keyof T]; diff --git a/src/ui/components/DashKit/plugins/Image/Image.tsx b/src/ui/components/DashKit/plugins/Image/Image.tsx index 0bf4ad729e..3affd35294 100644 --- a/src/ui/components/DashKit/plugins/Image/Image.tsx +++ b/src/ui/components/DashKit/plugins/Image/Image.tsx @@ -4,6 +4,7 @@ import type {Plugin, PluginWidgetProps} from '@gravity-ui/dashkit'; import block from 'bem-cn-lite'; import type {DashTabItemImage} from 'shared'; import {DashTabItemType} from 'shared'; +import {CustomPaletteColors} from 'ui/units/dash/containers/Dialogs/components/PaletteBackground/PaletteBackground'; import {useBeforeLoad} from '../../../../hooks/useBeforeLoad'; import {getPreparedWrapSettings} from '../../utils'; @@ -31,7 +32,7 @@ function PluginImage(props: Props, _ref?: React.LegacyRef) { w: null, }; const backgroundEnabled = Boolean( - background?.enabled && background?.color && background?.color !== 'transparent', + background?.color && background?.color !== CustomPaletteColors.NONE, ); const {classMod, style} = React.useMemo(() => { return getPreparedWrapSettings(backgroundEnabled, background?.color); diff --git a/src/ui/components/DashKit/plugins/Text/Text.tsx b/src/ui/components/DashKit/plugins/Text/Text.tsx index c10ede5e3a..c770026728 100644 --- a/src/ui/components/DashKit/plugins/Text/Text.tsx +++ b/src/ui/components/DashKit/plugins/Text/Text.tsx @@ -12,6 +12,7 @@ import { } from 'ui/components/DashKit/utils'; import {YFM_MARKDOWN_CLASSNAME} from 'ui/constants/yfm'; import {usePrevious} from 'ui/hooks'; +import {CustomPaletteColors} from 'ui/units/dash/containers/Dialogs/components/PaletteBackground/PaletteBackground'; import {useBeforeLoad} from '../../../../hooks/useBeforeLoad'; import {YfmWrapper} from '../../../YfmWrapper/YfmWrapper'; @@ -149,9 +150,7 @@ const textPlugin = { const data = props.data as DashTabItemText['data']; const showBgColor = Boolean( - data.background?.enabled && - data.background?.color && - data.background?.color !== 'transparent', + data.background?.color && data.background?.color !== CustomPaletteColors.NONE, ); const {classMod, style} = getPreparedWrapSettings(showBgColor, data.background?.color); @@ -186,7 +185,6 @@ const textPlugin = { currentLayout.w, classMod, data.background?.color, - data.background?.enabled, ]); /** diff --git a/src/ui/components/DashKit/plugins/Title/Title.tsx b/src/ui/components/DashKit/plugins/Title/Title.tsx index 8c1b58cce8..13e5a681ed 100644 --- a/src/ui/components/DashKit/plugins/Title/Title.tsx +++ b/src/ui/components/DashKit/plugins/Title/Title.tsx @@ -13,6 +13,7 @@ import { adjustWidgetLayout as dashkitAdjustWidgetLayout, getPreparedWrapSettings, } from 'ui/components/DashKit/utils'; +import {CustomPaletteColors} from 'ui/units/dash/containers/Dialogs/components/PaletteBackground/PaletteBackground'; import {useBeforeLoad} from '../../../../hooks/useBeforeLoad'; import {RendererWrapper} from '../RendererWrapper/RendererWrapper'; @@ -95,9 +96,7 @@ const titlePlugin: PluginTitle = { const content = ; const showBgColor = Boolean( - data.background?.enabled && - data.background?.color && - data.background?.color !== 'transparent', + data.background?.color && data.background?.color !== CustomPaletteColors.NONE, ); const {classMod, style} = getPreparedWrapSettings(showBgColor, data.background?.color); @@ -119,7 +118,6 @@ const titlePlugin: PluginTitle = { currentLayout.w, classMod, data.background?.color, - data.background?.enabled, data.size, data.text, ]); @@ -159,7 +157,6 @@ const titlePlugin: PluginTitle = { currentLayout.w, data.text, data.size, - data.background?.enabled, calculateAnchor, showAnchor, ]); diff --git a/src/ui/components/DialogChartWidget/DialogChartWidget.scss b/src/ui/components/DialogChartWidget/DialogChartWidget.scss index f16c7a214d..9b7cfd2533 100644 --- a/src/ui/components/DialogChartWidget/DialogChartWidget.scss +++ b/src/ui/components/DialogChartWidget/DialogChartWidget.scss @@ -40,21 +40,23 @@ flex-direction: column; } - &__help-tooltip { - line-height: 16px; - margin-left: 5px; - } - &__navigation-input-container { display: grid; grid-auto-rows: 40px; align-items: center; } - &__textarea-wrapper { - display: flex; + &__textarea { height: 80px; - padding: 6px 0; + width: 330px; + } + + &__row { + margin-bottom: var(--g-spacing-2); + } + + &__checkbox { + margin-block-start: var(--g-spacing-2); } .widget-item-dialog__line { @@ -82,12 +84,6 @@ align-items: center; } - &__input { - width: 330px; - margin-right: 10px; - display: inline-flex; - } - &__add-param-button { margin-left: 175px; } @@ -116,17 +112,6 @@ } } - &__caption { - &_inactive { - opacity: 0.3; - } - } - - &__caption-text { - position: relative; - top: 1px; - } - &__error { color: var(--g-color-text-danger); padding: 10px; diff --git a/src/ui/components/DialogChartWidget/DialogChartWidget.tsx b/src/ui/components/DialogChartWidget/DialogChartWidget.tsx index 71072c27ff..4e771bb0a8 100644 --- a/src/ui/components/DialogChartWidget/DialogChartWidget.tsx +++ b/src/ui/components/DialogChartWidget/DialogChartWidget.tsx @@ -1,7 +1,7 @@ import React from 'react'; -import {HelpPopover} from '@gravity-ui/components'; -import {Checkbox, Dialog, Link, Popup, TextArea, TextInput} from '@gravity-ui/uikit'; +import {FormRow, HelpPopover} from '@gravity-ui/components'; +import {Checkbox, Dialog, Link, Popup, Text, TextArea, TextInput} from '@gravity-ui/uikit'; import block from 'bem-cn-lite'; import {i18n} from 'i18n'; import type {CustomCommands, Spec} from 'immutability-helper'; @@ -62,21 +62,6 @@ const isWidgetTypeWithAutoHeight = (widgetType?: WidgetKind) => { ); }; -type LineProps = { - className?: string; - caption: React.ReactNode; - children?: React.ReactNode; -}; - -function Line(props: LineProps) { - return ( -
-
{props.caption}
-
{props.children}
-
- ); -} - type AfterSettingsWidgetCallback = ((selectedWidgetType: WidgetKind) => void) | null; export interface DialogChartWidgetFeatureProps { @@ -122,6 +107,11 @@ type DialogChartWidgetState = { hierarchies?: HierarchyField[]; }; +const INPUT_FILTERING_ID = 'chartFilteringField'; +const INPUT_NAME_ID = 'chartNameField'; +const INPUT_DESCRIPTION_ID = 'chartDescriptionField'; +const INPUT_AUTOHEIGHT_ID = 'chartAutoheightField'; + // TODO: put in defaultPath navigation key from entry class DialogChartWidget extends React.PureComponent< DialogChartWidgetProps, @@ -141,7 +131,6 @@ class DialogChartWidget extends React.PureComponent< isDefault: true, description: '', background: { - enabled: false, color: 'transparent', }, }, @@ -365,29 +354,6 @@ class DialogChartWidget extends React.PureComponent< }); }; - handleBackgroundEnabledChanged = () => { - const {data, tabIndex} = this.state; - - if (!data.tabs[tabIndex].background) { - data.tabs[tabIndex].background = { - enabled: false, - color: 'transparent', - }; - } - - this.setState({ - data: update(data, { - tabs: { - [tabIndex]: { - background: { - enabled: {$set: !data.tabs[tabIndex].background?.enabled}, - }, - }, - }, - }), - }); - }; - handleBackgroundColorSelected = (color: string) => { const {data, tabIndex} = this.state; @@ -551,32 +517,32 @@ class DialogChartWidget extends React.PureComponent< canUseFiltration && data.tabs[tabIndex].enableActionParams, ); - const caption = ( -
- - {i18n('dash.widget-dialog.edit', 'label_filtering-other-charts')} - - -
+ const helpPopover = ( + ); return ( - +
- {i18n('dash.widget-dialog.edit', 'field_enable-filtering-other-charts')} - + /> {this.getHierarchyWarning()}
-
+ ); }; @@ -591,27 +557,24 @@ class DialogChartWidget extends React.PureComponent< changeNavigationPath, } = this.props; - const autoHeightCheckboxCaption = ( -
- - {i18n('dash.widget-dialog.edit', 'field_autoheight')} - - -
+ const autoHeightHelpPopover = ( + ); const {title, chartId, description, autoHeight, background} = data.tabs[tabIndex]; return ( - + )} - - +
- - -
-