@elastic/eui 122.1.0 → 123.0.0
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-icons.json +94 -94
- package/es/components/datagrid/body/data_grid_body_virtualized.js +119 -36
- package/es/components/datagrid/utils/row_heights.js +4 -1
- package/es/components/flyout/flyout.component.js +129 -55
- package/es/components/flyout/flyout_menu/action_button.js +15 -21
- package/es/components/flyout/flyout_menu/flyout_menu.js +40 -46
- package/es/components/flyout/manager/flyout_managed.js +24 -6
- package/es/components/form/described_form_group/described_form_group.js +17 -4
- package/es/components/tabs/tabbed_content/tabbed_content.js +93 -138
- package/es/components/text_truncate/text_truncate.js +9 -4
- package/eui.d.ts +32 -58
- package/lib/components/datagrid/body/data_grid_body_virtualized.js +119 -36
- package/lib/components/datagrid/utils/row_heights.js +4 -1
- package/lib/components/flyout/flyout.component.js +134 -62
- package/lib/components/flyout/flyout_menu/action_button.js +18 -23
- package/lib/components/flyout/flyout_menu/flyout_menu.js +40 -46
- package/lib/components/flyout/manager/flyout_managed.js +23 -5
- package/lib/components/form/described_form_group/described_form_group.js +19 -3
- package/lib/components/tabs/tabbed_content/tabbed_content.js +98 -142
- package/lib/components/text_truncate/text_truncate.js +9 -4
- package/optimize/es/components/datagrid/body/data_grid_body_virtualized.js +116 -36
- package/optimize/es/components/datagrid/utils/row_heights.js +4 -1
- package/optimize/es/components/flyout/flyout.component.js +124 -50
- package/optimize/es/components/flyout/flyout_menu/action_button.js +14 -21
- package/optimize/es/components/flyout/manager/flyout_managed.js +24 -6
- package/optimize/es/components/form/described_form_group/described_form_group.js +17 -4
- package/optimize/es/components/tabs/tabbed_content/tabbed_content.js +87 -131
- package/optimize/es/components/text_truncate/text_truncate.js +4 -3
- package/optimize/lib/components/datagrid/body/data_grid_body_virtualized.js +116 -36
- package/optimize/lib/components/datagrid/utils/row_heights.js +4 -1
- package/optimize/lib/components/flyout/flyout.component.js +123 -49
- package/optimize/lib/components/flyout/flyout_menu/action_button.js +14 -22
- package/optimize/lib/components/flyout/manager/flyout_managed.js +23 -5
- package/optimize/lib/components/form/described_form_group/described_form_group.js +19 -3
- package/optimize/lib/components/tabs/tabbed_content/tabbed_content.js +87 -131
- package/optimize/lib/components/text_truncate/text_truncate.js +4 -3
- package/package.json +2 -2
- package/test-env/components/datagrid/body/data_grid_body_virtualized.js +119 -36
- package/test-env/components/datagrid/utils/row_heights.js +4 -1
- package/test-env/components/flyout/flyout.component.js +123 -49
- package/test-env/components/flyout/flyout_menu/action_button.js +14 -22
- package/test-env/components/flyout/flyout_menu/flyout_menu.js +40 -46
- package/test-env/components/flyout/manager/flyout_managed.js +23 -5
- package/test-env/components/form/described_form_group/described_form_group.js +19 -3
- package/test-env/components/tabs/tabbed_content/tabbed_content.js +88 -132
- package/test-env/components/text_truncate/text_truncate.js +9 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var _excluded = ["width", "onResize"],
|
|
2
|
-
_excluded2 = ["width", "children", "text", "truncation", "truncationOffset", "truncationPosition", "ellipsis", "calculationDelayMs", "containerRef", "className"],
|
|
2
|
+
_excluded2 = ["width", "children", "text", "truncation", "truncationOffset", "truncationPosition", "ellipsis", "calculationDelayMs", "containerRef", "className", "toolTipProps"],
|
|
3
3
|
_excluded3 = ["onResize"];
|
|
4
4
|
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
5
5
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -105,7 +105,11 @@ EuiTextTruncate.propTypes = {
|
|
|
105
105
|
* fonts are done loading or layout is done shifting or settling. Adding a delay
|
|
106
106
|
* may help resolve any rendering issues.
|
|
107
107
|
*/
|
|
108
|
-
calculationDelayMs: PropTypes.number
|
|
108
|
+
calculationDelayMs: PropTypes.number,
|
|
109
|
+
/**
|
|
110
|
+
* Placement of the tooltip that shows the full text while truncating.
|
|
111
|
+
*/
|
|
112
|
+
toolTipProps: PropTypes.any
|
|
109
113
|
};
|
|
110
114
|
var EuiTextTruncateWithWidth = function EuiTextTruncateWithWidth(_ref2) {
|
|
111
115
|
var width = _ref2.width,
|
|
@@ -121,6 +125,7 @@ var EuiTextTruncateWithWidth = function EuiTextTruncateWithWidth(_ref2) {
|
|
|
121
125
|
calculationDelayMs = _ref2.calculationDelayMs,
|
|
122
126
|
containerRef = _ref2.containerRef,
|
|
123
127
|
className = _ref2.className,
|
|
128
|
+
toolTipProps = _ref2.toolTipProps,
|
|
124
129
|
rest = _objectWithoutProperties(_ref2, _excluded2);
|
|
125
130
|
// Note: This needs to be a state and not a ref to trigger a rerender on mount
|
|
126
131
|
var _useState = useState(null),
|
|
@@ -222,11 +227,11 @@ var EuiTextTruncateWithWidth = function EuiTextTruncateWithWidth(_ref2) {
|
|
|
222
227
|
className: "euiTextTruncate__fullText",
|
|
223
228
|
"data-test-subj": "fullText"
|
|
224
229
|
}, children ? children(text) : text));
|
|
225
|
-
return isTruncating ? ___EmotionJSX(EuiToolTip, {
|
|
230
|
+
return isTruncating ? ___EmotionJSX(EuiToolTip, _extends({
|
|
226
231
|
content: text,
|
|
227
232
|
disableScreenReaderOutput: true,
|
|
228
233
|
display: "block"
|
|
229
|
-
}, content) : content;
|
|
234
|
+
}, toolTipProps), content) : content;
|
|
230
235
|
};
|
|
231
236
|
EuiTextTruncateWithWidth.propTypes = {
|
|
232
237
|
width: PropTypes.number.isRequired,
|
package/eui.d.ts
CHANGED
|
@@ -9551,7 +9551,8 @@ declare module '@elastic/eui/src/components/text_truncate/text_truncate.styles'
|
|
|
9551
9551
|
}
|
|
9552
9552
|
declare module '@elastic/eui/src/components/text_truncate/text_truncate' {
|
|
9553
9553
|
import { HTMLAttributes, FunctionComponent, ReactNode } from 'react';
|
|
9554
|
-
import type { CommonProps } from '@elastic/eui/src/components/common';
|
|
9554
|
+
import type { CommonProps } from '@elastic/eui/src/components/common';
|
|
9555
|
+
import { EuiToolTipProps } from '@elastic/eui/src/components/tool_tip'; const TRUNCATION_TYPES: readonly ["end", "start", "startEnd", "middle"];
|
|
9555
9556
|
export type EuiTextTruncationTypes = (typeof TRUNCATION_TYPES)[number];
|
|
9556
9557
|
export type EuiTextTruncateProps = Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'onResize'> & CommonProps & {
|
|
9557
9558
|
/**
|
|
@@ -9617,6 +9618,10 @@ declare module '@elastic/eui/src/components/text_truncate/text_truncate' {
|
|
|
9617
9618
|
* may help resolve any rendering issues.
|
|
9618
9619
|
*/
|
|
9619
9620
|
calculationDelayMs?: number;
|
|
9621
|
+
/**
|
|
9622
|
+
* Placement of the tooltip that shows the full text while truncating.
|
|
9623
|
+
*/
|
|
9624
|
+
toolTipProps?: Pick<EuiToolTipProps, 'position' | 'offset' | 'repositionOnScroll'>;
|
|
9620
9625
|
};
|
|
9621
9626
|
export const EuiTextTruncate: FunctionComponent<EuiTextTruncateProps>;
|
|
9622
9627
|
export {};
|
|
@@ -10907,11 +10912,11 @@ declare module '@elastic/eui/src/components/button/split_button' {
|
|
|
10907
10912
|
|
|
10908
10913
|
}
|
|
10909
10914
|
declare module '@elastic/eui/src/components/button' {
|
|
10910
|
-
export type { EuiButtonColor, EuiButtonSize, EuiButtonProps } from '@elastic/eui/src/components/button/button';
|
|
10915
|
+
export type { EuiButtonColor, EuiButtonSize, EuiButtonProps, EuiButtonPropsForAnchor, EuiButtonPropsForButton, } from '@elastic/eui/src/components/button/button';
|
|
10911
10916
|
export { COLORS, EuiButton } from '@elastic/eui/src/components/button/button';
|
|
10912
10917
|
export type { EuiButtonEmptyProps, EuiButtonEmptySizes } from '@elastic/eui/src/components/button/button_empty';
|
|
10913
10918
|
export { EuiButtonEmpty } from '@elastic/eui/src/components/button/button_empty';
|
|
10914
|
-
export type { EuiButtonIconProps, EuiButtonIconPropsForButton, } from '@elastic/eui/src/components/button/button_icon';
|
|
10919
|
+
export type { EuiButtonIconProps, EuiButtonIconPropsForAnchor, EuiButtonIconPropsForButton, } from '@elastic/eui/src/components/button/button_icon';
|
|
10915
10920
|
export { EuiButtonIcon } from '@elastic/eui/src/components/button/button_icon';
|
|
10916
10921
|
export type { EuiButtonGroupOptionProps, EuiButtonGroupProps, EuiButtonGroupChildrenProps, } from '@elastic/eui/src/components/button/button_group';
|
|
10917
10922
|
export { EuiButtonGroup } from '@elastic/eui/src/components/button/button_group';
|
|
@@ -18049,9 +18054,9 @@ declare module '@elastic/eui/src/components/table' {
|
|
|
18049
18054
|
|
|
18050
18055
|
}
|
|
18051
18056
|
declare module '@elastic/eui/src/components/flyout/flyout_menu/types' {
|
|
18052
|
-
import { HTMLAttributes } from 'react';
|
|
18053
|
-
import { EuiButtonProps } from '@elastic/eui/src/components/button';
|
|
18054
|
-
import { CommonProps, PropsForAnchor } from '@elastic/eui/src/components/common';
|
|
18057
|
+
import { HTMLAttributes, MouseEventHandler } from 'react';
|
|
18058
|
+
import { EuiButtonIconPropsForAnchor, EuiButtonIconPropsForButton, EuiButtonProps } from '@elastic/eui/src/components/button';
|
|
18059
|
+
import { CommonProps, DataAttributeProps, PropsForAnchor } from '@elastic/eui/src/components/common';
|
|
18055
18060
|
import { EuiToolTipProps } from '@elastic/eui/src/components/tool_tip';
|
|
18056
18061
|
import type { IconType } from '@elastic/eui/src/components/icon';
|
|
18057
18062
|
export type EuiFlyoutMenuBackButtonProps = Pick<PropsForAnchor<EuiButtonProps>, 'aria-label' | 'data-test-subj' | 'onClick'>;
|
|
@@ -18105,31 +18110,28 @@ declare module '@elastic/eui/src/components/flyout/flyout_menu/types' {
|
|
|
18105
18110
|
* Custom action item for the flyout menu component
|
|
18106
18111
|
* @deprecated Use `EuiFlyoutMenuAction` with the `trailingActions` prop instead.
|
|
18107
18112
|
*/
|
|
18108
|
-
export interface EuiFlyoutMenuCustomAction {
|
|
18113
|
+
export interface EuiFlyoutMenuCustomAction extends DataAttributeProps {
|
|
18109
18114
|
iconType: string;
|
|
18110
18115
|
onClick: () => void;
|
|
18111
18116
|
'aria-label': string;
|
|
18112
18117
|
}
|
|
18113
18118
|
/**
|
|
18114
|
-
*
|
|
18119
|
+
* The menu bar sets these props itself so every action looks the same.
|
|
18115
18120
|
*/
|
|
18116
|
-
|
|
18121
|
+
type EuiFlyoutMenuOwnedActionProps = 'color' | 'size' | 'display' | 'iconSize' | 'isSelected';
|
|
18122
|
+
type EuiFlyoutMenuActionProps = DataAttributeProps & {
|
|
18117
18123
|
/**
|
|
18118
|
-
*
|
|
18124
|
+
* Aria label for the action button
|
|
18119
18125
|
*/
|
|
18120
|
-
|
|
18126
|
+
'aria-label': string;
|
|
18121
18127
|
/**
|
|
18122
18128
|
* onClick handler for the action button
|
|
18123
18129
|
*/
|
|
18124
|
-
onClick?:
|
|
18125
|
-
/**
|
|
18126
|
-
* Aria label for the action button
|
|
18127
|
-
*/
|
|
18128
|
-
'aria-label': string;
|
|
18130
|
+
onClick?: MouseEventHandler<HTMLElement>;
|
|
18129
18131
|
/**
|
|
18130
|
-
*
|
|
18131
|
-
* When
|
|
18132
|
-
*
|
|
18132
|
+
* Tooltip text shown on hover or focus.
|
|
18133
|
+
* When the action is disabled, also set `hasAriaDisabled`. This keeps
|
|
18134
|
+
* the button focusable so the tooltip remains reachable.
|
|
18133
18135
|
*/
|
|
18134
18136
|
toolTipContent?: EuiToolTipProps['content'];
|
|
18135
18137
|
/**
|
|
@@ -18137,26 +18139,13 @@ declare module '@elastic/eui/src/components/flyout/flyout_menu/types' {
|
|
|
18137
18139
|
* Only used when `toolTipContent` is also provided.
|
|
18138
18140
|
*/
|
|
18139
18141
|
toolTipProps?: Partial<Omit<EuiToolTipProps, 'content' | 'children'>>;
|
|
18140
|
-
|
|
18141
|
-
|
|
18142
|
-
|
|
18143
|
-
|
|
18144
|
-
|
|
18145
|
-
|
|
18146
|
-
|
|
18147
|
-
*/
|
|
18148
|
-
isLoading?: boolean;
|
|
18149
|
-
/**
|
|
18150
|
-
* Renders the action as an anchor tag with the given URL, allowing users to
|
|
18151
|
-
* right-click and open in a new tab. When `isDisabled` or `isLoading` is
|
|
18152
|
-
* `true`, the element renders as a `<button>` regardless of this prop.
|
|
18153
|
-
*/
|
|
18154
|
-
href?: string;
|
|
18155
|
-
/**
|
|
18156
|
-
* Target for the anchor tag. Only used when `href` is provided.
|
|
18157
|
-
*/
|
|
18158
|
-
target?: string;
|
|
18159
|
-
}
|
|
18142
|
+
};
|
|
18143
|
+
/**
|
|
18144
|
+
* An action item for the `leadingActions` or `trailingActions` slots of the flyout menu.
|
|
18145
|
+
*
|
|
18146
|
+
* Accepts any {@link EuiButtonIcon} prop except those the menu bar sets itself.
|
|
18147
|
+
*/
|
|
18148
|
+
export type EuiFlyoutMenuAction = (Omit<EuiButtonIconPropsForAnchor, EuiFlyoutMenuOwnedActionProps | 'aria-label' | 'children' | 'onClick'> & EuiFlyoutMenuActionProps) | (Omit<EuiButtonIconPropsForButton, EuiFlyoutMenuOwnedActionProps | 'aria-label' | 'children' | 'onClick'> & EuiFlyoutMenuActionProps);
|
|
18160
18149
|
/**
|
|
18161
18150
|
* Props for EuiFlyoutMenu
|
|
18162
18151
|
*/
|
|
@@ -18228,6 +18217,7 @@ declare module '@elastic/eui/src/components/flyout/flyout_menu/types' {
|
|
|
18228
18217
|
*/
|
|
18229
18218
|
pagination?: EuiFlyoutMenuPagination;
|
|
18230
18219
|
};
|
|
18220
|
+
export {};
|
|
18231
18221
|
|
|
18232
18222
|
}
|
|
18233
18223
|
declare module '@elastic/eui/src/components/flyout/const' {
|
|
@@ -28629,7 +28619,7 @@ declare module '@elastic/eui/src/components/tabs/tab' {
|
|
|
28629
28619
|
|
|
28630
28620
|
}
|
|
28631
28621
|
declare module '@elastic/eui/src/components/tabs/tabbed_content/tabbed_content' {
|
|
28632
|
-
import
|
|
28622
|
+
import { HTMLAttributes, ReactNode, FunctionComponent } from 'react';
|
|
28633
28623
|
import { EuiTabsSizes } from '@elastic/eui/src/components/tabs/tabs';
|
|
28634
28624
|
import { EuiTabProps } from '@elastic/eui/src/components/tabs/tab';
|
|
28635
28625
|
import { CommonProps } from '@elastic/eui/src/components/common';
|
|
@@ -28642,10 +28632,6 @@ declare module '@elastic/eui/src/components/tabs/tabbed_content/tabbed_content'
|
|
|
28642
28632
|
name: ReactNode;
|
|
28643
28633
|
content: ReactNode;
|
|
28644
28634
|
}
|
|
28645
|
-
interface EuiTabbedContentState {
|
|
28646
|
-
selectedTabId: string | undefined;
|
|
28647
|
-
inFocus: boolean;
|
|
28648
|
-
}
|
|
28649
28635
|
export type EuiTabbedContentProps = CommonProps & Omit<HTMLAttributes<HTMLDivElement>, 'autoFocus'> & {
|
|
28650
28636
|
/**
|
|
28651
28637
|
* When tabbing into the tabs, set the focus on `initial` for the first tab,
|
|
@@ -28674,20 +28660,7 @@ declare module '@elastic/eui/src/components/tabs/tabbed_content/tabbed_content'
|
|
|
28674
28660
|
*/
|
|
28675
28661
|
tabs: EuiTabbedContentTab[];
|
|
28676
28662
|
};
|
|
28677
|
-
export
|
|
28678
|
-
static defaultProps: {
|
|
28679
|
-
autoFocus: EuiTabbedContentProps['autoFocus'];
|
|
28680
|
-
};
|
|
28681
|
-
private readonly rootId;
|
|
28682
|
-
private readonly tabsRef;
|
|
28683
|
-
constructor(props: EuiTabbedContentProps);
|
|
28684
|
-
focusTab: () => void;
|
|
28685
|
-
initializeFocus: () => void;
|
|
28686
|
-
removeFocus: (blurEvent: FocusEvent<HTMLDivElement>) => void;
|
|
28687
|
-
onTabClick: (selectedTab: EuiTabbedContentTab) => void;
|
|
28688
|
-
render(): React.JSX.Element;
|
|
28689
|
-
}
|
|
28690
|
-
export {};
|
|
28663
|
+
export const EuiTabbedContent: FunctionComponent<EuiTabbedContentProps>;
|
|
28691
28664
|
|
|
28692
28665
|
}
|
|
28693
28666
|
declare module '@elastic/eui/src/components/tabs/tabbed_content' {
|
|
@@ -34566,6 +34539,7 @@ declare module '@elastic/eui/src/components/selectable/selectable_list/selectabl
|
|
|
34566
34539
|
truncationOffset?: number;
|
|
34567
34540
|
truncationPosition?: number;
|
|
34568
34541
|
calculationDelayMs?: number;
|
|
34542
|
+
toolTipProps?: Pick<import ("@elastic/eui/src/components").EuiToolTipProps, "position" | "offset" | "repositionOnScroll">;
|
|
34569
34543
|
} | undefined;
|
|
34570
34544
|
renderSearchedText: (text: string, truncationProps?: EuiSelectableOptionsListProps["truncationProps"]) => React.JSX.Element;
|
|
34571
34545
|
renderTruncatedText: (text: string, truncationProps?: EuiSelectableOptionsListProps["truncationProps"]) => React.JSX.Element;
|
|
@@ -20,7 +20,8 @@ var _row_heights = require("../utils/row_heights");
|
|
|
20
20
|
var _scrolling = require("../utils/scrolling");
|
|
21
21
|
var _utils = require("../../../utils");
|
|
22
22
|
var _react2 = require("@emotion/react");
|
|
23
|
-
var _excluded = ["children", "style"]
|
|
23
|
+
var _excluded = ["children", "style"],
|
|
24
|
+
_excluded2 = ["onScroll"];
|
|
24
25
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
25
26
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
26
27
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -88,40 +89,96 @@ var InnerElement = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwar
|
|
|
88
89
|
}, rest), headerRow, children), footerRow);
|
|
89
90
|
}));
|
|
90
91
|
InnerElement.displayName = 'EuiDataGridInnerElement';
|
|
91
|
-
var
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
92
|
+
var DataGridOuterElementContext = /*#__PURE__*/(0, _react.createContext)({
|
|
93
|
+
scrollPositionRef: {
|
|
94
|
+
current: null
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
var clampScrollOffset = function clampScrollOffset(offset, max) {
|
|
98
|
+
return Math.max(0, Math.min(offset, max));
|
|
99
|
+
};
|
|
100
|
+
var OuterElement = /*#__PURE__*/(0, _react.forwardRef)(function (_ref3, ref) {
|
|
101
|
+
var onScroll = _ref3.onScroll,
|
|
102
|
+
rest = _objectWithoutProperties(_ref3, _excluded2);
|
|
103
|
+
var _useContext2 = (0, _react.useContext)(DataGridOuterElementContext),
|
|
104
|
+
_useContext2$outerEle = _useContext2.outerElementType,
|
|
105
|
+
Element = _useContext2$outerEle === void 0 ? 'div' : _useContext2$outerEle,
|
|
106
|
+
direction = _useContext2.direction,
|
|
107
|
+
scrollPositionRef = _useContext2.scrollPositionRef;
|
|
108
|
+
|
|
109
|
+
// react-window compares the raw scroll offsets against its own clamped
|
|
110
|
+
// offsets, and flags the grid as scrolling (setting `pointer-events: none`
|
|
111
|
+
// on the inner element) whenever they differ. Firefox can report a
|
|
112
|
+
// `scrollTop` above the maximum at fractional device pixel ratios, which
|
|
113
|
+
// makes every scroll event at the bottom of the grid look like a scroll,
|
|
114
|
+
// so hovered cells lose the pointer and tooltips repeatedly open and close.
|
|
115
|
+
var onScrollIfMoved = (0, _react.useCallback)(function (event) {
|
|
116
|
+
if (direction !== 'rtl') {
|
|
117
|
+
var _event$currentTarget = event.currentTarget,
|
|
118
|
+
scrollTop = _event$currentTarget.scrollTop,
|
|
119
|
+
scrollLeft = _event$currentTarget.scrollLeft,
|
|
120
|
+
scrollHeight = _event$currentTarget.scrollHeight,
|
|
121
|
+
scrollWidth = _event$currentTarget.scrollWidth,
|
|
122
|
+
clientHeight = _event$currentTarget.clientHeight,
|
|
123
|
+
clientWidth = _event$currentTarget.clientWidth;
|
|
124
|
+
var scrollPosition = {
|
|
125
|
+
scrollTop: clampScrollOffset(scrollTop, scrollHeight - clientHeight),
|
|
126
|
+
scrollLeft: clampScrollOffset(scrollLeft, scrollWidth - clientWidth)
|
|
127
|
+
};
|
|
128
|
+
var previousScrollPosition = scrollPositionRef.current;
|
|
129
|
+
if (previousScrollPosition && scrollPosition.scrollTop === previousScrollPosition.scrollTop && scrollPosition.scrollLeft === previousScrollPosition.scrollLeft) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
// react-window may not have rendered the previous event's position
|
|
133
|
+
// yet, so the ref must reflect every forwarded event, not only the
|
|
134
|
+
// positions react-window reports back through its `onScroll` prop.
|
|
135
|
+
scrollPositionRef.current = scrollPosition;
|
|
136
|
+
}
|
|
137
|
+
onScroll(event);
|
|
138
|
+
}, [onScroll, direction, scrollPositionRef]);
|
|
139
|
+
return (0, _react2.jsx)(Element, _extends({
|
|
140
|
+
ref: ref,
|
|
141
|
+
onScroll: onScrollIfMoved
|
|
142
|
+
}, rest));
|
|
143
|
+
});
|
|
144
|
+
OuterElement.propTypes = {
|
|
145
|
+
onScroll: _propTypes.default.any.isRequired
|
|
146
|
+
};
|
|
147
|
+
OuterElement.displayName = 'EuiDataGridOuterElement';
|
|
148
|
+
var EuiDataGridBodyVirtualized = exports.EuiDataGridBodyVirtualized = /*#__PURE__*/(0, _react.memo)(function (_ref4) {
|
|
149
|
+
var leadingControlColumns = _ref4.leadingControlColumns,
|
|
150
|
+
trailingControlColumns = _ref4.trailingControlColumns,
|
|
151
|
+
columns = _ref4.columns,
|
|
152
|
+
visibleColCount = _ref4.visibleColCount,
|
|
153
|
+
schema = _ref4.schema,
|
|
154
|
+
schemaDetectors = _ref4.schemaDetectors,
|
|
155
|
+
rowCount = _ref4.rowCount,
|
|
156
|
+
_ref4$visibleRows = _ref4.visibleRows,
|
|
157
|
+
startRow = _ref4$visibleRows.startRow,
|
|
158
|
+
endRow = _ref4$visibleRows.endRow,
|
|
159
|
+
visibleRowCount = _ref4$visibleRows.visibleRowCount,
|
|
160
|
+
renderCellValue = _ref4.renderCellValue,
|
|
161
|
+
cellContext = _ref4.cellContext,
|
|
162
|
+
renderCellPopover = _ref4.renderCellPopover,
|
|
163
|
+
renderFooterCellValue = _ref4.renderFooterCellValue,
|
|
164
|
+
interactiveCellId = _ref4.interactiveCellId,
|
|
165
|
+
pagination = _ref4.pagination,
|
|
166
|
+
sorting = _ref4.sorting,
|
|
167
|
+
setVisibleColumns = _ref4.setVisibleColumns,
|
|
168
|
+
switchColumnPos = _ref4.switchColumnPos,
|
|
169
|
+
onColumnResize = _ref4.onColumnResize,
|
|
170
|
+
rowHeightsOptions = _ref4.rowHeightsOptions,
|
|
171
|
+
virtualizationOptions = _ref4.virtualizationOptions,
|
|
172
|
+
isFullScreen = _ref4.isFullScreen,
|
|
173
|
+
gridStyles = _ref4.gridStyles,
|
|
174
|
+
gridWidth = _ref4.gridWidth,
|
|
175
|
+
gridRef = _ref4.gridRef,
|
|
176
|
+
gridItemsRendered = _ref4.gridItemsRendered,
|
|
177
|
+
wrapperRef = _ref4.wrapperRef,
|
|
178
|
+
className = _ref4.className,
|
|
179
|
+
canDragAndDropColumns = _ref4.canDragAndDropColumns,
|
|
180
|
+
_ref4$showHeader = _ref4.showHeader,
|
|
181
|
+
showHeader = _ref4$showHeader === void 0 ? true : _ref4$showHeader;
|
|
125
182
|
/**
|
|
126
183
|
* Grid refs & observers
|
|
127
184
|
*/
|
|
@@ -317,7 +374,30 @@ var EuiDataGridBodyVirtualized = exports.EuiDataGridBodyVirtualized = /*#__PURE_
|
|
|
317
374
|
footerRow: footerRow
|
|
318
375
|
};
|
|
319
376
|
}, [headerRowHeight, headerRow, footerRow, showHeader]);
|
|
377
|
+
var scrollPositionRef = (0, _react.useRef)(null);
|
|
378
|
+
var outerElementContextValue = (0, _react.useMemo)(function () {
|
|
379
|
+
return {
|
|
380
|
+
outerElementType: virtualizationOptions === null || virtualizationOptions === void 0 ? void 0 : virtualizationOptions.outerElementType,
|
|
381
|
+
direction: virtualizationOptions === null || virtualizationOptions === void 0 ? void 0 : virtualizationOptions.direction,
|
|
382
|
+
scrollPositionRef: scrollPositionRef
|
|
383
|
+
};
|
|
384
|
+
}, [virtualizationOptions === null || virtualizationOptions === void 0 ? void 0 : virtualizationOptions.outerElementType, virtualizationOptions === null || virtualizationOptions === void 0 ? void 0 : virtualizationOptions.direction]);
|
|
320
385
|
var onScroll = (0, _react.useCallback)(function (args) {
|
|
386
|
+
var element = outerGridRef.current;
|
|
387
|
+
// `scrollTo` reports the requested offset, which can sit past the
|
|
388
|
+
// end. Storing that would replace the clamped position already
|
|
389
|
+
// taken from the DOM. Leave the ref unchanged instead of writing
|
|
390
|
+
// the clamped value: a scroll event that has not arrived yet still
|
|
391
|
+
// differs from the previous position and is forwarded.
|
|
392
|
+
var topInRange = element == null || args.scrollTop === clampScrollOffset(args.scrollTop, element.scrollHeight - element.clientHeight);
|
|
393
|
+
var leftInRange = element == null || args.scrollLeft === clampScrollOffset(args.scrollLeft, element.scrollWidth - element.clientWidth);
|
|
394
|
+
if (topInRange && leftInRange) {
|
|
395
|
+
scrollPositionRef.current = {
|
|
396
|
+
scrollTop: args.scrollTop,
|
|
397
|
+
scrollLeft: args.scrollLeft
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
|
|
321
401
|
// check only if a callback is passed
|
|
322
402
|
if (typeof (virtualizationOptions === null || virtualizationOptions === void 0 ? void 0 : virtualizationOptions.onScroll) !== 'function') return;
|
|
323
403
|
var enhancedArgs = _objectSpread(_objectSpread({}, args), {}, {
|
|
@@ -361,10 +441,13 @@ var EuiDataGridBodyVirtualized = exports.EuiDataGridBodyVirtualized = /*#__PURE_
|
|
|
361
441
|
}, [outerGridRef, virtualizationOptions]);
|
|
362
442
|
return _utils.IS_JEST_ENVIRONMENT || finalWidth > 0 ? (0, _react2.jsx)(DataGridWrapperRowsContext.Provider, {
|
|
363
443
|
value: rowWrapperContextValue
|
|
444
|
+
}, (0, _react2.jsx)(DataGridOuterElementContext.Provider, {
|
|
445
|
+
value: outerElementContextValue
|
|
364
446
|
}, (0, _react2.jsx)(_reactWindow.VariableSizeGrid, _extends({}, virtualizationOptions, {
|
|
365
447
|
ref: gridRef,
|
|
366
448
|
className: (0, _classnames.default)('euiDataGrid__virtualized', className, virtualizationOptions === null || virtualizationOptions === void 0 ? void 0 : virtualizationOptions.className),
|
|
367
449
|
onItemsRendered: onItemsRendered,
|
|
450
|
+
outerElementType: OuterElement,
|
|
368
451
|
innerElementType: InnerElement,
|
|
369
452
|
outerRef: outerGridRef,
|
|
370
453
|
innerRef: innerGridRef,
|
|
@@ -376,7 +459,7 @@ var EuiDataGridBodyVirtualized = exports.EuiDataGridBodyVirtualized = /*#__PURE_
|
|
|
376
459
|
itemData: itemData,
|
|
377
460
|
rowCount: _utils.IS_JEST_ENVIRONMENT || headerRowHeight > 0 || showHeader === false && innerGridRef.current ? visibleRowCount : 0,
|
|
378
461
|
onScroll: onScroll
|
|
379
|
-
}), Cell), scrollBorderOverlay) : null;
|
|
462
|
+
}), Cell)), scrollBorderOverlay) : null;
|
|
380
463
|
});
|
|
381
464
|
EuiDataGridBodyVirtualized.propTypes = {
|
|
382
465
|
leadingControlColumns: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
@@ -309,7 +309,10 @@ var useRowHeightUtils = exports.useRowHeightUtils = function useRowHeightUtils(_
|
|
|
309
309
|
if (forceRenderRef.current == null) {
|
|
310
310
|
return;
|
|
311
311
|
}
|
|
312
|
-
requestAnimationFrame(forceRenderRef.current);
|
|
312
|
+
var frameId = requestAnimationFrame(forceRenderRef.current);
|
|
313
|
+
return function () {
|
|
314
|
+
return cancelAnimationFrame(frameId);
|
|
315
|
+
};
|
|
313
316
|
}, [// Effects that should cause rerendering
|
|
314
317
|
rowHeightsOptions === null || rowHeightsOptions === void 0 ? void 0 : rowHeightsOptions.defaultHeight, rowHeightsOptions === null || rowHeightsOptions === void 0 ? void 0 : rowHeightsOptions.rowHeights,
|
|
315
318
|
// Dependencies
|