Skip to content

Commit

Permalink
[Lens] fix onChange annotation date picker closing the whole config f…
Browse files Browse the repository at this point in the history
…lyout (#139688)
  • Loading branch information
mbondyra committed Aug 30, 2022
1 parent 213496d commit b70775d
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,8 @@ import {
EuiFlexItem,
EuiFocusTrap,
} from '@elastic/eui';

import { i18n } from '@kbn/i18n';

/**
* The dimension container is set up to close when it detects a click outside it.
* Use this CSS class to exclude particular elements from this behavior.
*/
export const DONT_CLOSE_DIMENSION_CONTAINER_ON_CLICK_CLASS =
'lensDontCloseDimensionContainerOnClick';
import { DONT_CLOSE_DIMENSION_CONTAINER_ON_CLICK_CLASS } from '../../../utils';

function fromExcludedClickTarget(event: Event) {
for (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
ReactExpressionRendererProps,
ReactExpressionRendererType,
} from '@kbn/expressions-plugin/public';
import { DONT_CLOSE_DIMENSION_CONTAINER_ON_CLICK_CLASS } from '../../utils';
import {
Datasource,
Visualization,
Expand Down Expand Up @@ -63,7 +64,6 @@ import {
applyChanges,
selectStagedActiveData,
} from '../../state_management';
import { DONT_CLOSE_DIMENSION_CONTAINER_ON_CLICK_CLASS } from './config_panel/dimension_container';

const MAX_SUGGESTIONS_DISPLAYED = 5;
const LOCAL_STORAGE_SUGGESTIONS_PANEL = 'LENS_SUGGESTIONS_PANEL_HIDDEN';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,8 @@ import {
DatasourceStates,
} from '../../../state_management';
import type { LensInspector } from '../../../lens_inspector_service';
import { inferTimeField } from '../../../utils';
import { inferTimeField, DONT_CLOSE_DIMENSION_CONTAINER_ON_CLICK_CLASS } from '../../../utils';
import { setChangesApplied } from '../../../state_management/lens_slice';
import { DONT_CLOSE_DIMENSION_CONTAINER_ON_CLICK_CLASS } from '../config_panel/dimension_container';

export interface WorkspacePanelProps {
visualizationMap: VisualizationMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { EuiPageContent, EuiFlexGroup, EuiFlexItem, EuiButton } from '@elastic/e
import classNames from 'classnames';
import { FormattedMessage } from '@kbn/i18n-react';
import { DatasourceMap, FramePublicAPI, VisualizationMap } from '../../../types';
import { DONT_CLOSE_DIMENSION_CONTAINER_ON_CLICK_CLASS } from '../../../utils';
import { NativeRenderer } from '../../../native_renderer';
import { ChartSwitch } from './chart_switch';
import { WarningsPopover } from './warnings_popover';
Expand All @@ -27,7 +28,6 @@ import {
selectAutoApplyEnabled,
} from '../../../state_management';
import { WorkspaceTitle } from './title';
import { DONT_CLOSE_DIMENSION_CONTAINER_ON_CLICK_CLASS } from '../config_panel/dimension_container';

export const AUTO_APPLY_DISABLED_STORAGE_KEY = 'autoApplyDisabled';

Expand Down
7 changes: 7 additions & 0 deletions x-pack/plugins/lens/public/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,3 +185,10 @@ export function inferTimeField(
})
.find(Boolean);
}

/**
* The dimension container is set up to close when it detects a click outside it.
* Use this CSS class to exclude particular elements from this behavior.
*/
export const DONT_CLOSE_DIMENSION_CONTAINER_ON_CLICK_CLASS =
'lensDontCloseDimensionContainerOnClick';
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import {
import Color from 'color';
import { getDataLayers } from '../../visualization_helpers';
import { FormatFactory } from '../../../../../common';
import { DONT_CLOSE_DIMENSION_CONTAINER_ON_CLICK_CLASS } from '../../../../utils';
import {
DimensionEditorSection,
NameInput,
Expand Down Expand Up @@ -473,6 +474,7 @@ const ConfigPanelRangeDatePicker = ({
}
>
<EuiDatePicker
calendarClassName={DONT_CLOSE_DIMENSION_CONTAINER_ON_CLICK_CLASS}
fullWidth
showTimeSelect
selected={value}
Expand All @@ -483,6 +485,7 @@ const ConfigPanelRangeDatePicker = ({
</EuiFormControlLayout>
) : (
<EuiDatePicker
calendarClassName={DONT_CLOSE_DIMENSION_CONTAINER_ON_CLICK_CLASS}
fullWidth
showTimeSelect
selected={value}
Expand Down

0 comments on commit b70775d

Please sign in to comment.