@elastic/eui 62.1.0 → 62.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/eui_charts_theme.js +330 -330
- package/dist/eui_charts_theme.js.map +1 -1
- package/es/components/datagrid/body/data_grid_body.js +11 -1
- package/es/components/datagrid/body/data_grid_cell.js +31 -3
- package/es/components/datagrid/data_grid.js +9 -1
- package/es/components/datagrid/utils/row_heights.js +33 -4
- package/es/components/description_list/description_list_description.js +2 -1
- package/es/components/description_list/description_list_title.js +2 -1
- package/es/components/popover/wrapping_popover.js +88 -45
- package/es/components/portal/portal.js +84 -38
- package/es/services/breakpoint/{currentEuiBreakpoint.js → current_breakpoint.js} +2 -12
- package/es/services/breakpoint/current_breakpoint_hook.js +20 -0
- package/es/services/breakpoint/index.js +2 -1
- package/es/services/breakpoint/useIsWithinBreakpoints.js +1 -1
- package/es/test/rtl/component_helpers.js +60 -1
- package/eui.d.ts +50 -150
- package/lib/components/datagrid/body/data_grid_body.js +11 -1
- package/lib/components/datagrid/body/data_grid_cell.js +31 -3
- package/lib/components/datagrid/data_grid.js +9 -1
- package/lib/components/datagrid/utils/row_heights.js +33 -4
- package/lib/components/popover/wrapping_popover.js +85 -44
- package/lib/components/portal/portal.js +87 -39
- package/lib/services/breakpoint/{currentEuiBreakpoint.js → current_breakpoint.js} +5 -16
- package/lib/services/breakpoint/current_breakpoint_hook.js +31 -0
- package/lib/services/breakpoint/index.js +17 -4
- package/lib/services/breakpoint/useIsWithinBreakpoints.js +2 -2
- package/lib/test/rtl/component_helpers.js +69 -3
- package/optimize/es/components/datagrid/body/data_grid_body.js +2 -0
- package/optimize/es/components/datagrid/body/data_grid_cell.js +13 -1
- package/optimize/es/components/datagrid/utils/row_heights.js +33 -4
- package/optimize/es/components/description_list/description_list_description.js +2 -1
- package/optimize/es/components/description_list/description_list_title.js +2 -1
- package/optimize/es/components/popover/wrapping_popover.js +79 -38
- package/optimize/es/components/portal/portal.js +66 -34
- package/optimize/es/services/breakpoint/{currentEuiBreakpoint.js → current_breakpoint.js} +2 -11
- package/optimize/es/services/breakpoint/current_breakpoint_hook.js +20 -0
- package/optimize/es/services/breakpoint/index.js +2 -1
- package/optimize/es/services/breakpoint/useIsWithinBreakpoints.js +1 -1
- package/optimize/es/test/rtl/component_helpers.js +60 -1
- package/optimize/lib/components/datagrid/body/data_grid_body.js +2 -0
- package/optimize/lib/components/datagrid/body/data_grid_cell.js +13 -1
- package/optimize/lib/components/datagrid/utils/row_heights.js +33 -4
- package/optimize/lib/components/popover/wrapping_popover.js +78 -38
- package/optimize/lib/components/portal/portal.js +65 -44
- package/optimize/lib/services/breakpoint/{currentEuiBreakpoint.js → current_breakpoint.js} +5 -18
- package/optimize/lib/services/breakpoint/current_breakpoint_hook.js +31 -0
- package/optimize/lib/services/breakpoint/index.js +17 -4
- package/optimize/lib/services/breakpoint/useIsWithinBreakpoints.js +2 -2
- package/optimize/lib/test/rtl/component_helpers.js +69 -3
- package/package.json +2 -2
- package/test-env/components/datagrid/body/data_grid_body.js +11 -1
- package/test-env/components/datagrid/body/data_grid_cell.js +31 -3
- package/test-env/components/datagrid/data_grid.js +9 -1
- package/test-env/components/datagrid/utils/row_heights.js +33 -4
- package/test-env/components/observer/resize_observer/resize_observer.js +43 -126
- package/test-env/components/popover/wrapping_popover.js +78 -38
- package/test-env/components/portal/portal.js +79 -45
- package/test-env/services/breakpoint/current_breakpoint.js +68 -0
- package/test-env/services/breakpoint/{currentEuiBreakpoint.js → current_breakpoint_hook.js} +3 -7
- package/test-env/services/breakpoint/index.js +17 -4
- package/test-env/services/breakpoint/useIsWithinBreakpoints.js +2 -2
- package/test-env/test/rtl/component_helpers.js +69 -3
|
@@ -9,9 +9,10 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
|
|
|
9
9
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
10
10
|
* Side Public License, v 1.
|
|
11
11
|
*/
|
|
12
|
+
import '@testing-library/jest-dom';
|
|
12
13
|
import { waitFor } from '@testing-library/react';
|
|
13
14
|
/**
|
|
14
|
-
* Ensure the EuiPopover being tested is open/closed before
|
|
15
|
+
* Ensure the EuiPopover being tested is open/closed before continuing
|
|
15
16
|
* Note: Because EuiPopover is portalled, we want to query `document`
|
|
16
17
|
* instead of the `container` returned by RTL's render()
|
|
17
18
|
*/
|
|
@@ -69,4 +70,62 @@ export var waitForEuiPopoverClose = /*#__PURE__*/function () {
|
|
|
69
70
|
return function waitForEuiPopoverClose() {
|
|
70
71
|
return _ref2.apply(this, arguments);
|
|
71
72
|
};
|
|
73
|
+
}();
|
|
74
|
+
/**
|
|
75
|
+
* Ensure the EuiToolTip being tested is open and visible before continuing
|
|
76
|
+
*/
|
|
77
|
+
|
|
78
|
+
export var waitForEuiToolTipVisible = /*#__PURE__*/function () {
|
|
79
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
|
|
80
|
+
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
81
|
+
while (1) {
|
|
82
|
+
switch (_context3.prev = _context3.next) {
|
|
83
|
+
case 0:
|
|
84
|
+
_context3.next = 2;
|
|
85
|
+
return waitFor(function () {
|
|
86
|
+
var tooltip = document.querySelector('.euiToolTipPopover');
|
|
87
|
+
expect(tooltip).toBeVisible();
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
case 2:
|
|
91
|
+
return _context3.abrupt("return", _context3.sent);
|
|
92
|
+
|
|
93
|
+
case 3:
|
|
94
|
+
case "end":
|
|
95
|
+
return _context3.stop();
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}, _callee3);
|
|
99
|
+
}));
|
|
100
|
+
|
|
101
|
+
return function waitForEuiToolTipVisible() {
|
|
102
|
+
return _ref3.apply(this, arguments);
|
|
103
|
+
};
|
|
104
|
+
}();
|
|
105
|
+
export var waitForEuiToolTipHidden = /*#__PURE__*/function () {
|
|
106
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() {
|
|
107
|
+
return regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
108
|
+
while (1) {
|
|
109
|
+
switch (_context4.prev = _context4.next) {
|
|
110
|
+
case 0:
|
|
111
|
+
_context4.next = 2;
|
|
112
|
+
return waitFor(function () {
|
|
113
|
+
var tooltip = document.querySelector('.euiToolTipPopover');
|
|
114
|
+
expect(tooltip).toBeNull();
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
case 2:
|
|
118
|
+
return _context4.abrupt("return", _context4.sent);
|
|
119
|
+
|
|
120
|
+
case 3:
|
|
121
|
+
case "end":
|
|
122
|
+
return _context4.stop();
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}, _callee4);
|
|
126
|
+
}));
|
|
127
|
+
|
|
128
|
+
return function waitForEuiToolTipHidden() {
|
|
129
|
+
return _ref4.apply(this, arguments);
|
|
130
|
+
};
|
|
72
131
|
}();
|
package/eui.d.ts
CHANGED
|
@@ -4368,7 +4368,7 @@ declare module '@elastic/eui/src/components/portal/portal' {
|
|
|
4368
4368
|
* NOTE: We can't test this component because Enzyme doesn't support rendering
|
|
4369
4369
|
* into portals.
|
|
4370
4370
|
*/
|
|
4371
|
-
import { ReactNode } from 'react';
|
|
4371
|
+
import { Component, ReactNode } from 'react';
|
|
4372
4372
|
interface InsertPositionsMap {
|
|
4373
4373
|
after: InsertPosition;
|
|
4374
4374
|
before: InsertPosition;
|
|
@@ -4386,7 +4386,14 @@ declare module '@elastic/eui/src/components/portal/portal' {
|
|
|
4386
4386
|
};
|
|
4387
4387
|
portalRef?: (ref: HTMLDivElement | null) => void;
|
|
4388
4388
|
}
|
|
4389
|
-
export
|
|
4389
|
+
export class EuiPortal extends Component<EuiPortalProps> {
|
|
4390
|
+
portalNode: HTMLDivElement | null;
|
|
4391
|
+
constructor(props: EuiPortalProps);
|
|
4392
|
+
componentDidMount(): void;
|
|
4393
|
+
componentWillUnmount(): void;
|
|
4394
|
+
updatePortalRef(ref: HTMLDivElement | null): void;
|
|
4395
|
+
render(): import("react").ReactPortal | null;
|
|
4396
|
+
}
|
|
4390
4397
|
export {};
|
|
4391
4398
|
|
|
4392
4399
|
}
|
|
@@ -5058,7 +5065,7 @@ declare module '@elastic/eui/src/components/popover/popover_footer' {
|
|
|
5058
5065
|
|
|
5059
5066
|
}
|
|
5060
5067
|
declare module '@elastic/eui/src/components/popover/wrapping_popover' {
|
|
5061
|
-
import {
|
|
5068
|
+
import { Component } from 'react';
|
|
5062
5069
|
import { Props as EuiPopoverProps } from '@elastic/eui/src/components/popover/popover';
|
|
5063
5070
|
export interface EuiWrappingPopoverProps extends EuiPopoverProps {
|
|
5064
5071
|
button: HTMLElement;
|
|
@@ -5068,7 +5075,15 @@ declare module '@elastic/eui/src/components/popover/wrapping_popover' {
|
|
|
5068
5075
|
* then the button element is moved into the popover dom.
|
|
5069
5076
|
* On unmount, the button is moved back to its original location.
|
|
5070
5077
|
*/
|
|
5071
|
-
export
|
|
5078
|
+
export class EuiWrappingPopover extends Component<EuiWrappingPopoverProps> {
|
|
5079
|
+
private portal;
|
|
5080
|
+
private anchor;
|
|
5081
|
+
componentDidMount(): void;
|
|
5082
|
+
componentWillUnmount(): void;
|
|
5083
|
+
setPortalRef: (node: HTMLElement | null) => void;
|
|
5084
|
+
setAnchorRef: (node: HTMLElement | null) => void;
|
|
5085
|
+
render(): JSX.Element;
|
|
5086
|
+
}
|
|
5072
5087
|
|
|
5073
5088
|
}
|
|
5074
5089
|
declare module '@elastic/eui/src/components/popover' {
|
|
@@ -6637,7 +6652,7 @@ declare module '@elastic/eui/src/services/throttle' {
|
|
|
6637
6652
|
export const throttle: (fn: (...args: any[]) => void, wait?: number) => (...args: any[]) => void;
|
|
6638
6653
|
|
|
6639
6654
|
}
|
|
6640
|
-
declare module '@elastic/eui/src/services/breakpoint/
|
|
6655
|
+
declare module '@elastic/eui/src/services/breakpoint/current_breakpoint' {
|
|
6641
6656
|
import React, { FunctionComponent } from 'react';
|
|
6642
6657
|
import { _EuiThemeBreakpoint } from '@elastic/eui/src/global_styling/variables/breakpoint'; type CurrentEuiBreakpoint = _EuiThemeBreakpoint | undefined;
|
|
6643
6658
|
export const CurrentEuiBreakpointContext: React.Context<CurrentEuiBreakpoint>;
|
|
@@ -6646,11 +6661,17 @@ declare module '@elastic/eui/src/services/breakpoint/currentEuiBreakpoint' {
|
|
|
6646
6661
|
* resize listener that returns the current breakpoint based on window width
|
|
6647
6662
|
*/
|
|
6648
6663
|
export const CurrentEuiBreakpointProvider: FunctionComponent;
|
|
6664
|
+
export {};
|
|
6665
|
+
|
|
6666
|
+
}
|
|
6667
|
+
declare module '@elastic/eui/src/services/breakpoint/current_breakpoint_hook' {
|
|
6649
6668
|
/**
|
|
6650
|
-
* Hook util / syntactical sugar
|
|
6669
|
+
* Hook util / syntactical sugar for useContext()
|
|
6670
|
+
*
|
|
6671
|
+
* This hook is in its own separate file to make mocking it
|
|
6672
|
+
* as a testenv easy for Jest unit tests
|
|
6651
6673
|
*/
|
|
6652
|
-
export const useCurrentEuiBreakpoint: () =>
|
|
6653
|
-
export {};
|
|
6674
|
+
export const useCurrentEuiBreakpoint: () => "s" | "xs" | "m" | "l" | "xl" | undefined;
|
|
6654
6675
|
|
|
6655
6676
|
}
|
|
6656
6677
|
declare module '@elastic/eui/src/services/breakpoint/useIsWithinBreakpoints' {
|
|
@@ -6670,7 +6691,8 @@ declare module '@elastic/eui/src/services/breakpoint/useIsWithinBreakpoints' {
|
|
|
6670
6691
|
}
|
|
6671
6692
|
declare module '@elastic/eui/src/services/breakpoint' {
|
|
6672
6693
|
export * from '@elastic/eui/src/services/breakpoint/breakpoint';
|
|
6673
|
-
export * from '@elastic/eui/src/services/breakpoint/
|
|
6694
|
+
export * from '@elastic/eui/src/services/breakpoint/current_breakpoint';
|
|
6695
|
+
export * from '@elastic/eui/src/services/breakpoint/current_breakpoint_hook';
|
|
6674
6696
|
export * from '@elastic/eui/src/services/breakpoint/useIsWithinBreakpoints';
|
|
6675
6697
|
|
|
6676
6698
|
}
|
|
@@ -9859,14 +9881,17 @@ declare module '@elastic/eui/src/components/datagrid/utils/sorting' {
|
|
|
9859
9881
|
}
|
|
9860
9882
|
declare module '@elastic/eui/src/components/datagrid/utils/row_heights' {
|
|
9861
9883
|
import { CSSProperties, MutableRefObject } from 'react';
|
|
9862
|
-
import {
|
|
9884
|
+
import { GridOnItemsRenderedProps } from 'react-window';
|
|
9885
|
+
import { EuiDataGridColumn, EuiDataGridRowHeightOption, EuiDataGridRowHeightsOptions, EuiDataGridScrollAnchorRow, EuiDataGridStyle, EuiDataGridStyleCellPaddings, ImperativeGridApi } from '@elastic/eui/src/components/datagrid/data_grid_types';
|
|
9863
9886
|
export const cellPaddingsMap: Record<EuiDataGridStyleCellPaddings, number>;
|
|
9864
9887
|
export const AUTO_HEIGHT = "auto";
|
|
9865
9888
|
export const DEFAULT_ROW_HEIGHT = 34;
|
|
9866
9889
|
export class RowHeightUtils {
|
|
9867
9890
|
private gridRef;
|
|
9891
|
+
private outerGridElementRef;
|
|
9892
|
+
private gridItemsRenderedRef;
|
|
9868
9893
|
private rerenderGridBodyRef;
|
|
9869
|
-
constructor(gridRef: MutableRefObject<ImperativeGridApi | null>, rerenderGridBodyRef: MutableRefObject<(() => void) | null>);
|
|
9894
|
+
constructor(gridRef: MutableRefObject<ImperativeGridApi | null>, outerGridElementRef: MutableRefObject<HTMLDivElement | null>, gridItemsRenderedRef: MutableRefObject<GridOnItemsRenderedProps | null>, rerenderGridBodyRef: MutableRefObject<(() => void) | null>);
|
|
9870
9895
|
getRowHeightOption(rowIndex: number, rowHeightsOptions?: EuiDataGridRowHeightsOptions): EuiDataGridRowHeightOption | undefined;
|
|
9871
9896
|
isRowHeightOverride(rowIndex: number, rowHeightsOptions?: EuiDataGridRowHeightsOptions): boolean;
|
|
9872
9897
|
getCalculatedHeight(heightOption: EuiDataGridRowHeightOption, defaultHeight: number, rowIndex?: number, isRowHeightOverride?: boolean): number;
|
|
@@ -9893,13 +9918,16 @@ declare module '@elastic/eui/src/components/datagrid/utils/row_heights' {
|
|
|
9893
9918
|
pruneHiddenColumnHeights(visibleColumns: EuiDataGridColumn[]): void;
|
|
9894
9919
|
resetRow(visibleRowIndex: number): void;
|
|
9895
9920
|
resetGrid(): void;
|
|
9921
|
+
compensateForLayoutShift(rowIndex: number, verticalLayoutShift: number, anchorRow: EuiDataGridScrollAnchorRow): void;
|
|
9896
9922
|
}
|
|
9897
9923
|
/**
|
|
9898
9924
|
* Hook for instantiating RowHeightUtils, setting internal class vars,
|
|
9899
9925
|
* and setting up various row-height-related side effects
|
|
9900
9926
|
*/
|
|
9901
|
-
export const useRowHeightUtils: ({ gridRef, gridStyles, columns, rowHeightsOptions, }: {
|
|
9927
|
+
export const useRowHeightUtils: ({ gridRef, outerGridElementRef, gridItemsRenderedRef, gridStyles, columns, rowHeightsOptions, }: {
|
|
9902
9928
|
gridRef: MutableRefObject<ImperativeGridApi | null>;
|
|
9929
|
+
outerGridElementRef: MutableRefObject<HTMLDivElement | null>;
|
|
9930
|
+
gridItemsRenderedRef: MutableRefObject<GridOnItemsRenderedProps | null>;
|
|
9903
9931
|
gridStyles: EuiDataGridStyle;
|
|
9904
9932
|
columns: EuiDataGridColumn[];
|
|
9905
9933
|
rowHeightsOptions?: EuiDataGridRowHeightsOptions | undefined;
|
|
@@ -10796,6 +10824,7 @@ declare module '@elastic/eui/src/components/datagrid/data_grid_types' {
|
|
|
10796
10824
|
width: number;
|
|
10797
10825
|
}
|
|
10798
10826
|
export type EuiDataGridOnColumnResizeHandler = (data: EuiDataGridOnColumnResizeData) => void;
|
|
10827
|
+
export type EuiDataGridScrollAnchorRow = 'start' | 'center' | undefined;
|
|
10799
10828
|
export type EuiDataGridRowHeightOption = number | 'auto' | ExclusiveUnion<{
|
|
10800
10829
|
lineCount: number;
|
|
10801
10830
|
}, {
|
|
@@ -10822,6 +10851,13 @@ declare module '@elastic/eui/src/components/datagrid/data_grid_types' {
|
|
|
10822
10851
|
* Can be used for, e.g. storing user `rowHeightsOptions` in a local storage object.
|
|
10823
10852
|
*/
|
|
10824
10853
|
onChange?: (rowHeightsOptions: EuiDataGridRowHeightsOptions) => void;
|
|
10854
|
+
/**
|
|
10855
|
+
* Optional indicator of the row that should be used as an anchor for vertical layout shift compensation.
|
|
10856
|
+
* When set to 'start' or 'center', the topmost or middle visible row will try
|
|
10857
|
+
* to compensate for changes in their top offsets by adjusting the grid's scroll
|
|
10858
|
+
* position.
|
|
10859
|
+
*/
|
|
10860
|
+
scrollAnchorRow?: EuiDataGridScrollAnchorRow;
|
|
10825
10861
|
}
|
|
10826
10862
|
export interface EuiDataGridRowManager {
|
|
10827
10863
|
getRow(args: {
|
|
@@ -12969,10 +13005,9 @@ declare module '@elastic/eui/src/components/description_list/description_list_co
|
|
|
12969
13005
|
declare module '@elastic/eui/src/components/description_list/description_list_title' {
|
|
12970
13006
|
import { HTMLAttributes, FunctionComponent } from 'react';
|
|
12971
13007
|
import { CommonProps } from '@elastic/eui/src/components/common';
|
|
12972
|
-
interface EuiDescriptionListTitleProps extends CommonProps, HTMLAttributes<HTMLElement> {
|
|
13008
|
+
export interface EuiDescriptionListTitleProps extends CommonProps, HTMLAttributes<HTMLElement> {
|
|
12973
13009
|
}
|
|
12974
13010
|
export const EuiDescriptionListTitle: FunctionComponent<EuiDescriptionListTitleProps>;
|
|
12975
|
-
export {};
|
|
12976
13011
|
|
|
12977
13012
|
}
|
|
12978
13013
|
declare module '@elastic/eui/src/components/description_list/description_list_description.styles' {
|
|
@@ -12999,10 +13034,9 @@ declare module '@elastic/eui/src/components/description_list/description_list_de
|
|
|
12999
13034
|
declare module '@elastic/eui/src/components/description_list/description_list_description' {
|
|
13000
13035
|
import { HTMLAttributes, FunctionComponent } from 'react';
|
|
13001
13036
|
import { CommonProps } from '@elastic/eui/src/components/common';
|
|
13002
|
-
interface EuiDescriptionListDescriptionProps extends CommonProps, HTMLAttributes<HTMLElement> {
|
|
13037
|
+
export interface EuiDescriptionListDescriptionProps extends CommonProps, HTMLAttributes<HTMLElement> {
|
|
13003
13038
|
}
|
|
13004
13039
|
export const EuiDescriptionListDescription: FunctionComponent<EuiDescriptionListDescriptionProps>;
|
|
13005
|
-
export {};
|
|
13006
13040
|
|
|
13007
13041
|
}
|
|
13008
13042
|
declare module '@elastic/eui/src/components/description_list/description_list.styles' {
|
|
@@ -19032,56 +19066,6 @@ declare module '@elastic/eui' {
|
|
|
19032
19066
|
export * from '@elastic/eui/src/themes';
|
|
19033
19067
|
export * from '@elastic/eui/src/global_styling';
|
|
19034
19068
|
|
|
19035
|
-
}
|
|
19036
|
-
declare module '@elastic/eui/src/test/internal/render_with_styles' {
|
|
19037
|
-
import { ReactElement } from 'react';
|
|
19038
|
-
/**
|
|
19039
|
-
* Use this function to add the `@emotion` Jest serializer to a single test.
|
|
19040
|
-
* The resulting snapshot will include the styles of elements in the component that use `@emotion` for styling.
|
|
19041
|
-
*
|
|
19042
|
-
* This function must be run outside of a `test` block:
|
|
19043
|
-
|
|
19044
|
-
```
|
|
19045
|
-
describe('EuiMark', () => {
|
|
19046
|
-
renderWithStyles(<EuiMark>Marked</EuiMark>);
|
|
19047
|
-
|
|
19048
|
-
test('is rendered', () => {});
|
|
19049
|
-
});
|
|
19050
|
-
```
|
|
19051
|
-
*/
|
|
19052
|
-
export const renderWithStyles: (component: ReactElement) => never;
|
|
19053
|
-
|
|
19054
|
-
}
|
|
19055
|
-
declare module '@elastic/eui/src/test/internal/render_custom_styles' {
|
|
19056
|
-
import { ReactElement } from 'react';
|
|
19057
|
-
/**
|
|
19058
|
-
* Use this test helper to quickly check that the component supports custom
|
|
19059
|
-
* `className`, `css`, and `style` properties.
|
|
19060
|
-
*
|
|
19061
|
-
* Example usage:
|
|
19062
|
-
*
|
|
19063
|
-
* shouldRenderCustomStyles(<EuiMark {...requiredProps} />Marked</EuiMark>);
|
|
19064
|
-
*/
|
|
19065
|
-
export const shouldRenderCustomStyles: (component: ReactElement) => void;
|
|
19066
|
-
|
|
19067
|
-
}
|
|
19068
|
-
declare module '@elastic/eui/src/test/internal/test_custom_hook' {
|
|
19069
|
-
|
|
19070
|
-
export const HookWrapper: (props: {
|
|
19071
|
-
hook?: Function;
|
|
19072
|
-
}) => JSX.Element;
|
|
19073
|
-
export const testCustomHook: <T>(hook?: Function | undefined, args?: unknown) => {
|
|
19074
|
-
return: T;
|
|
19075
|
-
getUpdatedState: () => T;
|
|
19076
|
-
updateHookArgs: (args: unknown) => void;
|
|
19077
|
-
};
|
|
19078
|
-
|
|
19079
|
-
}
|
|
19080
|
-
declare module '@elastic/eui/src/test/internal' {
|
|
19081
|
-
export * from '@elastic/eui/src/test/internal/render_with_styles';
|
|
19082
|
-
export * from '@elastic/eui/src/test/internal/render_custom_styles';
|
|
19083
|
-
export * from '@elastic/eui/src/test/internal/test_custom_hook';
|
|
19084
|
-
|
|
19085
19069
|
}
|
|
19086
19070
|
declare module '@elastic/eui/src/components/icon/assets/videoPlayer' {
|
|
19087
19071
|
import * as React from 'react';
|
|
@@ -23626,90 +23610,6 @@ declare module 'mdast-util-to-hast/lib/all' {
|
|
|
23626
23610
|
const all: (h: H, node: Node) => Node[];
|
|
23627
23611
|
export = all;
|
|
23628
23612
|
}
|
|
23629
|
-
declare module '@elastic/eui/src/test/rtl/component_helpers' {
|
|
23630
|
-
/**
|
|
23631
|
-
* Ensure the EuiPopover being tested is open/closed before contiuning
|
|
23632
|
-
* Note: Because EuiPopover is portalled, we want to query `document`
|
|
23633
|
-
* instead of the `container` returned by RTL's render()
|
|
23634
|
-
*/
|
|
23635
|
-
export const waitForEuiPopoverOpen: () => Promise<void>;
|
|
23636
|
-
export const waitForEuiPopoverClose: () => Promise<void>;
|
|
23637
|
-
|
|
23638
|
-
}
|
|
23639
|
-
declare module '@elastic/eui/src/test/rtl/data_test_subj_queries' {
|
|
23640
|
-
import { queryHelpers, Matcher, MatcherOptions } from '@testing-library/react'; const queryAllByTestSubject: (container: HTMLElement, id: Matcher, options?: MatcherOptions | undefined) => HTMLElement[]; const queryByTestSubject: queryHelpers.QueryBy<[Matcher]>, getAllByTestSubject: queryHelpers.GetAllBy<[Matcher]>, getByTestSubject: queryHelpers.GetBy<[Matcher]>, findAllByTestSubject: queryHelpers.FindAllBy<[Matcher]>, findByTestSubject: queryHelpers.FindBy<[Matcher]>;
|
|
23641
|
-
export { queryByTestSubject, queryAllByTestSubject, getByTestSubject, getAllByTestSubject, findAllByTestSubject, findByTestSubject, };
|
|
23642
|
-
|
|
23643
|
-
}
|
|
23644
|
-
declare module '@elastic/eui/src/test/rtl/custom_render' {
|
|
23645
|
-
import { ReactElement } from 'react';
|
|
23646
|
-
import { queries, RenderOptions, Screen } from '@testing-library/react';
|
|
23647
|
-
import * as dataTestSubjQueries from '@elastic/eui/src/test/rtl/data_test_subj_queries'; const customRender: (ui: ReactElement, { queries: renderQueries, ...options }?: RenderOptions) => import("@testing-library/react").RenderResult<{
|
|
23648
|
-
getByLabelText: typeof queries.getByLabelText;
|
|
23649
|
-
getAllByLabelText: typeof queries.getAllByLabelText;
|
|
23650
|
-
queryByLabelText: typeof queries.queryByLabelText;
|
|
23651
|
-
queryAllByLabelText: typeof queries.queryAllByLabelText;
|
|
23652
|
-
findByLabelText: typeof queries.findByLabelText;
|
|
23653
|
-
findAllByLabelText: typeof queries.findAllByLabelText;
|
|
23654
|
-
getByPlaceholderText: typeof queries.getByPlaceholderText;
|
|
23655
|
-
getAllByPlaceholderText: typeof queries.getAllByPlaceholderText;
|
|
23656
|
-
queryByPlaceholderText: typeof queries.queryByPlaceholderText;
|
|
23657
|
-
queryAllByPlaceholderText: typeof queries.queryAllByPlaceholderText;
|
|
23658
|
-
findByPlaceholderText: typeof queries.findByPlaceholderText;
|
|
23659
|
-
findAllByPlaceholderText: typeof queries.findAllByPlaceholderText;
|
|
23660
|
-
getByText: typeof queries.getByText;
|
|
23661
|
-
getAllByText: typeof queries.getAllByText;
|
|
23662
|
-
queryByText: typeof queries.queryByText;
|
|
23663
|
-
queryAllByText: typeof queries.queryAllByText;
|
|
23664
|
-
findByText: typeof queries.findByText;
|
|
23665
|
-
findAllByText: typeof queries.findAllByText;
|
|
23666
|
-
getByAltText: typeof queries.getByAltText;
|
|
23667
|
-
getAllByAltText: typeof queries.getAllByAltText;
|
|
23668
|
-
queryByAltText: typeof queries.queryByAltText;
|
|
23669
|
-
queryAllByAltText: typeof queries.queryAllByAltText;
|
|
23670
|
-
findByAltText: typeof queries.findByAltText;
|
|
23671
|
-
findAllByAltText: typeof queries.findAllByAltText;
|
|
23672
|
-
getByTitle: typeof queries.getByTitle;
|
|
23673
|
-
getAllByTitle: typeof queries.getAllByTitle;
|
|
23674
|
-
queryByTitle: typeof queries.queryByTitle;
|
|
23675
|
-
queryAllByTitle: typeof queries.queryAllByTitle;
|
|
23676
|
-
findByTitle: typeof queries.findByTitle;
|
|
23677
|
-
findAllByTitle: typeof queries.findAllByTitle;
|
|
23678
|
-
getByDisplayValue: typeof queries.getByDisplayValue;
|
|
23679
|
-
getAllByDisplayValue: typeof queries.getAllByDisplayValue;
|
|
23680
|
-
queryByDisplayValue: typeof queries.queryByDisplayValue;
|
|
23681
|
-
queryAllByDisplayValue: typeof queries.queryAllByDisplayValue;
|
|
23682
|
-
findByDisplayValue: typeof queries.findByDisplayValue;
|
|
23683
|
-
findAllByDisplayValue: typeof queries.findAllByDisplayValue;
|
|
23684
|
-
getByRole: typeof queries.getByRole;
|
|
23685
|
-
getAllByRole: typeof queries.getAllByRole;
|
|
23686
|
-
queryByRole: typeof queries.queryByRole;
|
|
23687
|
-
queryAllByRole: typeof queries.queryAllByRole;
|
|
23688
|
-
findByRole: typeof queries.findByRole;
|
|
23689
|
-
findAllByRole: typeof queries.findAllByRole;
|
|
23690
|
-
getByTestId: typeof queries.getByTestId;
|
|
23691
|
-
getAllByTestId: typeof queries.getAllByTestId;
|
|
23692
|
-
queryByTestId: typeof queries.queryByTestId;
|
|
23693
|
-
queryAllByTestId: typeof queries.queryAllByTestId;
|
|
23694
|
-
findByTestId: typeof queries.findByTestId;
|
|
23695
|
-
findAllByTestId: typeof queries.findAllByTestId;
|
|
23696
|
-
queryByTestSubject: import("@testing-library/react").QueryBy<[import("@testing-library/react").Matcher]>;
|
|
23697
|
-
queryAllByTestSubject: (container: HTMLElement, id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
|
|
23698
|
-
getByTestSubject: import("@testing-library/react").GetBy<[import("@testing-library/react").Matcher]>;
|
|
23699
|
-
getAllByTestSubject: import("@testing-library/react").GetAllBy<[import("@testing-library/react").Matcher]>;
|
|
23700
|
-
findAllByTestSubject: import("@testing-library/react").FindAllBy<[import("@testing-library/react").Matcher]>;
|
|
23701
|
-
findByTestSubject: import("@testing-library/react").FindBy<[import("@testing-library/react").Matcher]>;
|
|
23702
|
-
}, HTMLElement, HTMLElement>;
|
|
23703
|
-
export { customRender as render }; const customScreen: Screen<typeof queries & typeof dataTestSubjQueries>;
|
|
23704
|
-
export { customScreen as screen };
|
|
23705
|
-
|
|
23706
|
-
}
|
|
23707
|
-
declare module '@elastic/eui/src/test/rtl' {
|
|
23708
|
-
export * from '@elastic/eui/src/test/rtl/component_helpers';
|
|
23709
|
-
export { queryByTestSubject, queryAllByTestSubject, getByTestSubject, getAllByTestSubject, findAllByTestSubject, findByTestSubject, } from '@elastic/eui/src/test/rtl/data_test_subj_queries';
|
|
23710
|
-
export { render, screen } from '@elastic/eui/src/test/rtl/custom_render';
|
|
23711
|
-
|
|
23712
|
-
}
|
|
23713
23613
|
declare module '@elastic/eui/src/components/table/mobile' {
|
|
23714
23614
|
export { EuiTableHeaderMobile } from '@elastic/eui/src/components/table/mobile/table_header_mobile';
|
|
23715
23615
|
export type { EuiTableSortMobileProps } from '@elastic/eui/src/components/table/mobile/table_sort_mobile';
|
|
@@ -373,6 +373,8 @@ var EuiDataGridBody = function EuiDataGridBody(props) {
|
|
|
373
373
|
|
|
374
374
|
var rowHeightUtils = (0, _row_heights.useRowHeightUtils)({
|
|
375
375
|
gridRef: gridRef,
|
|
376
|
+
outerGridElementRef: outerGridRef,
|
|
377
|
+
gridItemsRenderedRef: gridItemsRendered,
|
|
376
378
|
gridStyles: gridStyles,
|
|
377
379
|
columns: columns,
|
|
378
380
|
rowHeightsOptions: rowHeightsOptions
|
|
@@ -1057,7 +1059,15 @@ EuiDataGridBody.propTypes = {
|
|
|
1057
1059
|
* Optional callback returning the current `rowHeightsOptions` when changes occur from user input (e.g. toolbar display controls).
|
|
1058
1060
|
* Can be used for, e.g. storing user `rowHeightsOptions` in a local storage object.
|
|
1059
1061
|
*/
|
|
1060
|
-
onChange: _propTypes.default.func
|
|
1062
|
+
onChange: _propTypes.default.func,
|
|
1063
|
+
|
|
1064
|
+
/**
|
|
1065
|
+
* Optional indicator of the row that should be used as an anchor for vertical layout shift compensation.
|
|
1066
|
+
* When set to 'start' or 'center', the topmost or middle visible row will try
|
|
1067
|
+
* to compensate for changes in their top offsets by adjusting the grid's scroll
|
|
1068
|
+
* position.
|
|
1069
|
+
*/
|
|
1070
|
+
scrollAnchorRow: _propTypes.default.oneOf(["start", "center", undefined])
|
|
1061
1071
|
}),
|
|
1062
1072
|
isFullScreen: _propTypes.default.bool.isRequired,
|
|
1063
1073
|
gridStyles: _propTypes.default.shape({
|
|
@@ -565,7 +565,15 @@ EuiDataGridCellContent.propTypes = {
|
|
|
565
565
|
* Optional callback returning the current `rowHeightsOptions` when changes occur from user input (e.g. toolbar display controls).
|
|
566
566
|
* Can be used for, e.g. storing user `rowHeightsOptions` in a local storage object.
|
|
567
567
|
*/
|
|
568
|
-
onChange: _propTypes.default.func
|
|
568
|
+
onChange: _propTypes.default.func,
|
|
569
|
+
|
|
570
|
+
/**
|
|
571
|
+
* Optional indicator of the row that should be used as an anchor for vertical layout shift compensation.
|
|
572
|
+
* When set to 'start' or 'center', the topmost or middle visible row will try
|
|
573
|
+
* to compensate for changes in their top offsets by adjusting the grid's scroll
|
|
574
|
+
* position.
|
|
575
|
+
*/
|
|
576
|
+
scrollAnchorRow: _propTypes.default.oneOf(["start", "center", undefined])
|
|
569
577
|
}),
|
|
570
578
|
rowHeightUtils: _propTypes.default.any,
|
|
571
579
|
pagination: _propTypes.default.shape({
|
|
@@ -935,7 +943,7 @@ var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
935
943
|
}, {
|
|
936
944
|
key: "componentDidUpdate",
|
|
937
945
|
value: function componentDidUpdate(prevProps) {
|
|
938
|
-
var _this$props$rowHeight, _prevProps$rowHeights;
|
|
946
|
+
var _this$props$rowHeight, _prevProps$rowHeights, _this$props$rowHeight2, _this$props$style, _prevProps$style;
|
|
939
947
|
|
|
940
948
|
this.recalculateAutoHeight();
|
|
941
949
|
|
|
@@ -943,6 +951,18 @@ var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
943
951
|
this.recalculateLineHeight();
|
|
944
952
|
}
|
|
945
953
|
|
|
954
|
+
if ((_this$props$rowHeight2 = this.props.rowHeightsOptions) !== null && _this$props$rowHeight2 !== void 0 && _this$props$rowHeight2.scrollAnchorRow && this.props.colIndex === 0 && // once per row
|
|
955
|
+
this.props.columnId === prevProps.columnId && // if this is still the same column
|
|
956
|
+
this.props.rowIndex === prevProps.rowIndex && // if this is still the same row
|
|
957
|
+
((_this$props$style = this.props.style) === null || _this$props$style === void 0 ? void 0 : _this$props$style.top) !== ((_prevProps$style = prevProps.style) === null || _prevProps$style === void 0 ? void 0 : _prevProps$style.top) // if the top position has changed
|
|
958
|
+
) {
|
|
959
|
+
var _prevProps$style2, _this$props$style2, _this$props$rowHeight3, _this$props$rowHeight4;
|
|
960
|
+
|
|
961
|
+
var previousTop = parseFloat((_prevProps$style2 = prevProps.style) === null || _prevProps$style2 === void 0 ? void 0 : _prevProps$style2.top);
|
|
962
|
+
var currentTop = parseFloat((_this$props$style2 = this.props.style) === null || _this$props$style2 === void 0 ? void 0 : _this$props$style2.top);
|
|
963
|
+
(_this$props$rowHeight3 = this.props.rowHeightUtils) === null || _this$props$rowHeight3 === void 0 ? void 0 : _this$props$rowHeight3.compensateForLayoutShift(this.props.rowIndex, currentTop - previousTop, (_this$props$rowHeight4 = this.props.rowHeightsOptions) === null || _this$props$rowHeight4 === void 0 ? void 0 : _this$props$rowHeight4.scrollAnchorRow);
|
|
964
|
+
}
|
|
965
|
+
|
|
946
966
|
if (this.props.popoverContext.popoverIsOpen !== prevProps.popoverContext.popoverIsOpen || this.props.popoverContext.cellLocation !== prevProps.popoverContext.cellLocation || this.props.renderCellPopover !== prevProps.renderCellPopover) {
|
|
947
967
|
this.handleCellPopover();
|
|
948
968
|
}
|
|
@@ -1592,7 +1612,15 @@ EuiDataGridCell.propTypes = {
|
|
|
1592
1612
|
* Optional callback returning the current `rowHeightsOptions` when changes occur from user input (e.g. toolbar display controls).
|
|
1593
1613
|
* Can be used for, e.g. storing user `rowHeightsOptions` in a local storage object.
|
|
1594
1614
|
*/
|
|
1595
|
-
onChange: _propTypes.default.func
|
|
1615
|
+
onChange: _propTypes.default.func,
|
|
1616
|
+
|
|
1617
|
+
/**
|
|
1618
|
+
* Optional indicator of the row that should be used as an anchor for vertical layout shift compensation.
|
|
1619
|
+
* When set to 'start' or 'center', the topmost or middle visible row will try
|
|
1620
|
+
* to compensate for changes in their top offsets by adjusting the grid's scroll
|
|
1621
|
+
* position.
|
|
1622
|
+
*/
|
|
1623
|
+
scrollAnchorRow: _propTypes.default.oneOf(["start", "center", undefined])
|
|
1596
1624
|
}),
|
|
1597
1625
|
rowHeightUtils: _propTypes.default.any,
|
|
1598
1626
|
rowManager: _propTypes.default.shape({
|
|
@@ -1282,7 +1282,15 @@ EuiDataGrid.propTypes = {
|
|
|
1282
1282
|
* Optional callback returning the current `rowHeightsOptions` when changes occur from user input (e.g. toolbar display controls).
|
|
1283
1283
|
* Can be used for, e.g. storing user `rowHeightsOptions` in a local storage object.
|
|
1284
1284
|
*/
|
|
1285
|
-
onChange: _propTypes.default.func
|
|
1285
|
+
onChange: _propTypes.default.func,
|
|
1286
|
+
|
|
1287
|
+
/**
|
|
1288
|
+
* Optional indicator of the row that should be used as an anchor for vertical layout shift compensation.
|
|
1289
|
+
* When set to 'start' or 'center', the topmost or middle visible row will try
|
|
1290
|
+
* to compensate for changes in their top offsets by adjusting the grid's scroll
|
|
1291
|
+
* position.
|
|
1292
|
+
*/
|
|
1293
|
+
scrollAnchorRow: _propTypes.default.oneOf(["start", "center", undefined])
|
|
1286
1294
|
})
|
|
1287
1295
|
};
|
|
1288
1296
|
EuiDataGrid.displayName = 'EuiDataGrid';
|
|
@@ -7,10 +7,10 @@ exports.useRowHeightUtils = exports.useDefaultRowHeight = exports.cellPaddingsMa
|
|
|
7
7
|
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
|
|
10
|
-
var _predicate = require("../../../services/predicate");
|
|
11
|
-
|
|
12
10
|
var _services = require("../../../services");
|
|
13
11
|
|
|
12
|
+
var _predicate = require("../../../services/predicate");
|
|
13
|
+
|
|
14
14
|
var _sorting = require("./sorting");
|
|
15
15
|
|
|
16
16
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
@@ -54,12 +54,14 @@ var DEFAULT_ROW_HEIGHT = 34;
|
|
|
54
54
|
exports.DEFAULT_ROW_HEIGHT = DEFAULT_ROW_HEIGHT;
|
|
55
55
|
|
|
56
56
|
var RowHeightUtils = /*#__PURE__*/function () {
|
|
57
|
-
function RowHeightUtils(gridRef, rerenderGridBodyRef) {
|
|
57
|
+
function RowHeightUtils(gridRef, outerGridElementRef, gridItemsRenderedRef, rerenderGridBodyRef) {
|
|
58
58
|
var _this = this;
|
|
59
59
|
|
|
60
60
|
_classCallCheck(this, RowHeightUtils);
|
|
61
61
|
|
|
62
62
|
this.gridRef = gridRef;
|
|
63
|
+
this.outerGridElementRef = outerGridElementRef;
|
|
64
|
+
this.gridItemsRenderedRef = gridItemsRenderedRef;
|
|
63
65
|
this.rerenderGridBodyRef = rerenderGridBodyRef;
|
|
64
66
|
|
|
65
67
|
_defineProperty(this, "styles", {
|
|
@@ -255,6 +257,31 @@ var RowHeightUtils = /*#__PURE__*/function () {
|
|
|
255
257
|
(_this$gridRef$current = this.gridRef.current) === null || _this$gridRef$current === void 0 ? void 0 : _this$gridRef$current.resetAfterRowIndex(this.lastUpdatedRow);
|
|
256
258
|
this.lastUpdatedRow = Infinity;
|
|
257
259
|
}
|
|
260
|
+
}, {
|
|
261
|
+
key: "compensateForLayoutShift",
|
|
262
|
+
value: function compensateForLayoutShift(rowIndex, verticalLayoutShift, anchorRow) {
|
|
263
|
+
var grid = this.gridRef.current;
|
|
264
|
+
var outerGridElement = this.outerGridElementRef.current;
|
|
265
|
+
var renderedItems = this.gridItemsRenderedRef.current;
|
|
266
|
+
|
|
267
|
+
if (grid == null || outerGridElement == null || renderedItems == null || anchorRow == null || !Number.isFinite(verticalLayoutShift)) {
|
|
268
|
+
return;
|
|
269
|
+
} // skip if the start row is the anchor row but it hasn't shifted
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
if (anchorRow === 'start' && renderedItems.visibleRowStartIndex !== rowIndex) {
|
|
273
|
+
return;
|
|
274
|
+
} // skip if the center row is the anchor row but it hasn't shifted
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
if (anchorRow === 'center' && Math.floor((renderedItems.visibleRowStopIndex - renderedItems.visibleRowStartIndex) / 2) !== rowIndex) {
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
grid.scrollTo({
|
|
282
|
+
scrollTop: outerGridElement.scrollTop + verticalLayoutShift
|
|
283
|
+
});
|
|
284
|
+
}
|
|
258
285
|
}]);
|
|
259
286
|
|
|
260
287
|
return RowHeightUtils;
|
|
@@ -269,13 +296,15 @@ exports.RowHeightUtils = RowHeightUtils;
|
|
|
269
296
|
|
|
270
297
|
var useRowHeightUtils = function useRowHeightUtils(_ref2) {
|
|
271
298
|
var gridRef = _ref2.gridRef,
|
|
299
|
+
outerGridElementRef = _ref2.outerGridElementRef,
|
|
300
|
+
gridItemsRenderedRef = _ref2.gridItemsRenderedRef,
|
|
272
301
|
gridStyles = _ref2.gridStyles,
|
|
273
302
|
columns = _ref2.columns,
|
|
274
303
|
rowHeightsOptions = _ref2.rowHeightsOptions;
|
|
275
304
|
var forceRenderRef = (0, _services.useLatest)((0, _services.useForceRender)());
|
|
276
305
|
|
|
277
306
|
var _useState = (0, _react.useState)(function () {
|
|
278
|
-
return new RowHeightUtils(gridRef, forceRenderRef);
|
|
307
|
+
return new RowHeightUtils(gridRef, outerGridElementRef, gridItemsRenderedRef, forceRenderRef);
|
|
279
308
|
}),
|
|
280
309
|
_useState2 = _slicedToArray(_useState, 1),
|
|
281
310
|
rowHeightUtils = _useState2[0]; // Forces a rerender whenever the row heights change, as this can cause the
|