@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
|
@@ -7,26 +7,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.EuiTabbedContent = exports.AUTOFOCUS = void 0;
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
11
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
12
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
14
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
15
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
16
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
17
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
18
|
-
var _services = require("../../../services");
|
|
19
13
|
var _tabs = require("../tabs");
|
|
20
14
|
var _tab = require("../tab");
|
|
15
|
+
var _services = require("../../../services");
|
|
21
16
|
var _react2 = require("@emotion/react");
|
|
22
|
-
var _excluded = ["className", "expand", "initialSelectedTab", "onTabClick", "selectedTab", "size", "tabs"
|
|
17
|
+
var _excluded = ["autoFocus", "className", "expand", "initialSelectedTab", "onTabClick", "selectedTab", "size", "tabs"],
|
|
23
18
|
_excluded2 = ["id", "name", "content"];
|
|
24
|
-
|
|
25
|
-
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
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
27
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
28
|
-
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
29
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /*
|
|
19
|
+
/*
|
|
30
20
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
31
21
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
32
22
|
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
@@ -36,126 +26,92 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
36
26
|
/**
|
|
37
27
|
* Marked as const so type is `['initial', 'selected']` instead of `string[]`
|
|
38
28
|
*/
|
|
29
|
+
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); }
|
|
30
|
+
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; }
|
|
39
31
|
var AUTOFOCUS = exports.AUTOFOCUS = ['initial', 'selected'];
|
|
40
|
-
var EuiTabbedContent = exports.EuiTabbedContent =
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
if (!externalSelectedTab) {
|
|
82
|
-
_this.setState({
|
|
83
|
-
selectedTabId: selectedTab.id
|
|
84
|
-
}, function () {
|
|
85
|
-
_this.focusTab();
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
var initialSelectedTab = props.initialSelectedTab,
|
|
90
|
-
_selectedTab = props.selectedTab,
|
|
91
|
-
tabs = props.tabs;
|
|
32
|
+
var EuiTabbedContent = exports.EuiTabbedContent = function EuiTabbedContent(_ref) {
|
|
33
|
+
var _ref$autoFocus = _ref.autoFocus,
|
|
34
|
+
autoFocus = _ref$autoFocus === void 0 ? 'initial' : _ref$autoFocus,
|
|
35
|
+
className = _ref.className,
|
|
36
|
+
expand = _ref.expand,
|
|
37
|
+
initialSelectedTab = _ref.initialSelectedTab,
|
|
38
|
+
onTabClick = _ref.onTabClick,
|
|
39
|
+
externalSelectedTab = _ref.selectedTab,
|
|
40
|
+
size = _ref.size,
|
|
41
|
+
tabs = _ref.tabs,
|
|
42
|
+
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
43
|
+
var rootId = (0, _services.useGeneratedHtmlId)();
|
|
44
|
+
var tabsRef = (0, _react.useRef)(null);
|
|
45
|
+
var inFocusRef = (0, _react.useRef)(false);
|
|
46
|
+
var _useState = (0, _react.useState)(function () {
|
|
47
|
+
return externalSelectedTab ? undefined : (initialSelectedTab === null || initialSelectedTab === void 0 ? void 0 : initialSelectedTab.id) || tabs[0].id;
|
|
48
|
+
}),
|
|
49
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
50
|
+
selectedTabId = _useState2[0],
|
|
51
|
+
setSelectedTabId = _useState2[1];
|
|
52
|
+
var focusTab = function focusTab(id) {
|
|
53
|
+
var _tabsRef$current;
|
|
54
|
+
var targetTab = (_tabsRef$current = tabsRef.current) === null || _tabsRef$current === void 0 ? void 0 : _tabsRef$current.querySelector("#".concat(id));
|
|
55
|
+
targetTab === null || targetTab === void 0 || targetTab.focus();
|
|
56
|
+
};
|
|
57
|
+
var initializeFocus = function initializeFocus() {
|
|
58
|
+
if (!inFocusRef.current && autoFocus === 'selected') {
|
|
59
|
+
inFocusRef.current = true;
|
|
60
|
+
focusTab(selectedTabId);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
var removeFocus = function removeFocus(blurEvent) {
|
|
64
|
+
// only set inFocus to false if the wrapping div doesn't contain the now-focusing element
|
|
65
|
+
var currentTarget = blurEvent.currentTarget;
|
|
66
|
+
var relatedTarget = blurEvent.relatedTarget;
|
|
67
|
+
if (currentTarget.contains(relatedTarget) === false) {
|
|
68
|
+
inFocusRef.current = false;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
var handleTabClick = function handleTabClick(tab) {
|
|
72
|
+
onTabClick === null || onTabClick === void 0 || onTabClick(tab);
|
|
92
73
|
|
|
93
74
|
// Only track selection state if it's not controlled externally.
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
75
|
+
if (!externalSelectedTab) {
|
|
76
|
+
setSelectedTabId(tab.id);
|
|
77
|
+
focusTab(tab.id);
|
|
97
78
|
}
|
|
98
|
-
|
|
99
|
-
selectedTabId: selectedTabId,
|
|
100
|
-
inFocus: false
|
|
101
|
-
};
|
|
102
|
-
return _this;
|
|
103
|
-
}
|
|
104
|
-
(0, _inherits2.default)(EuiTabbedContent, _Component);
|
|
105
|
-
return (0, _createClass2.default)(EuiTabbedContent, [{
|
|
106
|
-
key: "render",
|
|
107
|
-
value: function render() {
|
|
108
|
-
var _this2 = this;
|
|
109
|
-
var _this$props2 = this.props,
|
|
110
|
-
className = _this$props2.className,
|
|
111
|
-
expand = _this$props2.expand,
|
|
112
|
-
initialSelectedTab = _this$props2.initialSelectedTab,
|
|
113
|
-
onTabClick = _this$props2.onTabClick,
|
|
114
|
-
externalSelectedTab = _this$props2.selectedTab,
|
|
115
|
-
size = _this$props2.size,
|
|
116
|
-
tabs = _this$props2.tabs,
|
|
117
|
-
autoFocus = _this$props2.autoFocus,
|
|
118
|
-
rest = (0, _objectWithoutProperties2.default)(_this$props2, _excluded);
|
|
79
|
+
};
|
|
119
80
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
81
|
+
// Allow the consumer to control tab selection.
|
|
82
|
+
var selectedTab = externalSelectedTab || tabs.find(function (tab) {
|
|
83
|
+
return tab.id === selectedTabId;
|
|
84
|
+
}) || tabs[0]; // Fall back to the first tab if a selected tab can't be found
|
|
124
85
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
}]);
|
|
158
|
-
}(_react.Component);
|
|
159
|
-
(0, _defineProperty2.default)(EuiTabbedContent, "defaultProps", {
|
|
160
|
-
autoFocus: 'initial'
|
|
161
|
-
});
|
|
86
|
+
var selectedTabContent = selectedTab.content,
|
|
87
|
+
selectedTabContentId = selectedTab.id;
|
|
88
|
+
return (0, _react2.jsx)("div", (0, _extends2.default)({
|
|
89
|
+
className: className
|
|
90
|
+
}, rest), (0, _react2.jsx)(_tabs.EuiTabs, {
|
|
91
|
+
ref: tabsRef,
|
|
92
|
+
expand: expand,
|
|
93
|
+
size: size,
|
|
94
|
+
onFocus: initializeFocus,
|
|
95
|
+
onBlur: removeFocus
|
|
96
|
+
}, tabs.map(function (tab) {
|
|
97
|
+
var id = tab.id,
|
|
98
|
+
name = tab.name,
|
|
99
|
+
content = tab.content,
|
|
100
|
+
tabProps = (0, _objectWithoutProperties2.default)(tab, _excluded2);
|
|
101
|
+
return (0, _react2.jsx)(_tab.EuiTab, (0, _extends2.default)({
|
|
102
|
+
key: id,
|
|
103
|
+
id: id
|
|
104
|
+
}, tabProps, {
|
|
105
|
+
onClick: function onClick() {
|
|
106
|
+
return handleTabClick(tab);
|
|
107
|
+
},
|
|
108
|
+
isSelected: tab === selectedTab,
|
|
109
|
+
"aria-controls": rootId
|
|
110
|
+
}), name);
|
|
111
|
+
})), (0, _react2.jsx)("div", {
|
|
112
|
+
role: "tabpanel",
|
|
113
|
+
id: rootId,
|
|
114
|
+
"aria-labelledby": selectedTabContentId
|
|
115
|
+
}, selectedTabContent));
|
|
116
|
+
};
|
|
117
|
+
EuiTabbedContent.displayName = 'EuiTabbedContent';
|
|
@@ -18,7 +18,7 @@ var _utils = require("./utils");
|
|
|
18
18
|
var _text_truncate = require("./text_truncate.styles");
|
|
19
19
|
var _react2 = require("@emotion/react");
|
|
20
20
|
var _excluded = ["width", "onResize"],
|
|
21
|
-
_excluded2 = ["width", "children", "text", "truncation", "truncationOffset", "truncationPosition", "ellipsis", "calculationDelayMs", "containerRef", "className"],
|
|
21
|
+
_excluded2 = ["width", "children", "text", "truncation", "truncationOffset", "truncationPosition", "ellipsis", "calculationDelayMs", "containerRef", "className", "toolTipProps"],
|
|
22
22
|
_excluded3 = ["onResize"];
|
|
23
23
|
/*
|
|
24
24
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
@@ -54,6 +54,7 @@ var EuiTextTruncateWithWidth = function EuiTextTruncateWithWidth(_ref2) {
|
|
|
54
54
|
calculationDelayMs = _ref2.calculationDelayMs,
|
|
55
55
|
containerRef = _ref2.containerRef,
|
|
56
56
|
className = _ref2.className,
|
|
57
|
+
toolTipProps = _ref2.toolTipProps,
|
|
57
58
|
rest = (0, _objectWithoutProperties2.default)(_ref2, _excluded2);
|
|
58
59
|
// Note: This needs to be a state and not a ref to trigger a rerender on mount
|
|
59
60
|
var _useState = (0, _react.useState)(null),
|
|
@@ -155,11 +156,11 @@ var EuiTextTruncateWithWidth = function EuiTextTruncateWithWidth(_ref2) {
|
|
|
155
156
|
className: "euiTextTruncate__fullText",
|
|
156
157
|
"data-test-subj": "fullText"
|
|
157
158
|
}, children ? children(text) : text));
|
|
158
|
-
return isTruncating ? (0, _react2.jsx)(_tool_tip.EuiToolTip, {
|
|
159
|
+
return isTruncating ? (0, _react2.jsx)(_tool_tip.EuiToolTip, (0, _extends2.default)({
|
|
159
160
|
content: text,
|
|
160
161
|
disableScreenReaderOutput: true,
|
|
161
162
|
display: "block"
|
|
162
|
-
}, content) : content;
|
|
163
|
+
}, toolTipProps), content) : content;
|
|
163
164
|
};
|
|
164
165
|
var EuiTextTruncateWithResizeObserver = function EuiTextTruncateWithResizeObserver(_ref3) {
|
|
165
166
|
var _onResize = _ref3.onResize,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elastic/eui",
|
|
3
3
|
"description": "Elastic UI Component Library",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "123.0.0",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "lib",
|
|
7
7
|
"module": "es",
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"@cypress/react18": "^2.0.0",
|
|
112
112
|
"@cypress/webpack-dev-server": "^1.7.0",
|
|
113
113
|
"@elastic/datemath": "^5.0.3",
|
|
114
|
-
"@elastic/eslint-plugin-eui": "3.
|
|
114
|
+
"@elastic/eslint-plugin-eui": "3.2.0",
|
|
115
115
|
"@elastic/eui-illustrations": "1.1.0",
|
|
116
116
|
"@elastic/eui-theme-borealis": "8.1.0",
|
|
117
117
|
"@emotion/babel-plugin": "^11.11.0",
|
|
@@ -25,7 +25,8 @@ var _row_heights = require("../utils/row_heights");
|
|
|
25
25
|
var _scrolling = require("../utils/scrolling");
|
|
26
26
|
var _utils = require("../../../utils");
|
|
27
27
|
var _react2 = require("@emotion/react");
|
|
28
|
-
var _excluded = ["children", "style"]
|
|
28
|
+
var _excluded = ["children", "style"],
|
|
29
|
+
_excluded2 = ["onScroll"];
|
|
29
30
|
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); }
|
|
30
31
|
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; }
|
|
31
32
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -85,40 +86,96 @@ var InnerElement = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwar
|
|
|
85
86
|
}, rest), headerRow, children), footerRow);
|
|
86
87
|
}));
|
|
87
88
|
InnerElement.displayName = 'EuiDataGridInnerElement';
|
|
88
|
-
var
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
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
|
-
|
|
89
|
+
var DataGridOuterElementContext = /*#__PURE__*/(0, _react.createContext)({
|
|
90
|
+
scrollPositionRef: {
|
|
91
|
+
current: null
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
var clampScrollOffset = function clampScrollOffset(offset, max) {
|
|
95
|
+
return Math.max(0, Math.min(offset, max));
|
|
96
|
+
};
|
|
97
|
+
var OuterElement = /*#__PURE__*/(0, _react.forwardRef)(function (_ref3, ref) {
|
|
98
|
+
var onScroll = _ref3.onScroll,
|
|
99
|
+
rest = (0, _objectWithoutProperties2.default)(_ref3, _excluded2);
|
|
100
|
+
var _useContext2 = (0, _react.useContext)(DataGridOuterElementContext),
|
|
101
|
+
_useContext2$outerEle = _useContext2.outerElementType,
|
|
102
|
+
Element = _useContext2$outerEle === void 0 ? 'div' : _useContext2$outerEle,
|
|
103
|
+
direction = _useContext2.direction,
|
|
104
|
+
scrollPositionRef = _useContext2.scrollPositionRef;
|
|
105
|
+
|
|
106
|
+
// react-window compares the raw scroll offsets against its own clamped
|
|
107
|
+
// offsets, and flags the grid as scrolling (setting `pointer-events: none`
|
|
108
|
+
// on the inner element) whenever they differ. Firefox can report a
|
|
109
|
+
// `scrollTop` above the maximum at fractional device pixel ratios, which
|
|
110
|
+
// makes every scroll event at the bottom of the grid look like a scroll,
|
|
111
|
+
// so hovered cells lose the pointer and tooltips repeatedly open and close.
|
|
112
|
+
var onScrollIfMoved = (0, _react.useCallback)(function (event) {
|
|
113
|
+
if (direction !== 'rtl') {
|
|
114
|
+
var _event$currentTarget = event.currentTarget,
|
|
115
|
+
scrollTop = _event$currentTarget.scrollTop,
|
|
116
|
+
scrollLeft = _event$currentTarget.scrollLeft,
|
|
117
|
+
scrollHeight = _event$currentTarget.scrollHeight,
|
|
118
|
+
scrollWidth = _event$currentTarget.scrollWidth,
|
|
119
|
+
clientHeight = _event$currentTarget.clientHeight,
|
|
120
|
+
clientWidth = _event$currentTarget.clientWidth;
|
|
121
|
+
var scrollPosition = {
|
|
122
|
+
scrollTop: clampScrollOffset(scrollTop, scrollHeight - clientHeight),
|
|
123
|
+
scrollLeft: clampScrollOffset(scrollLeft, scrollWidth - clientWidth)
|
|
124
|
+
};
|
|
125
|
+
var previousScrollPosition = scrollPositionRef.current;
|
|
126
|
+
if (previousScrollPosition && scrollPosition.scrollTop === previousScrollPosition.scrollTop && scrollPosition.scrollLeft === previousScrollPosition.scrollLeft) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
// react-window may not have rendered the previous event's position
|
|
130
|
+
// yet, so the ref must reflect every forwarded event, not only the
|
|
131
|
+
// positions react-window reports back through its `onScroll` prop.
|
|
132
|
+
scrollPositionRef.current = scrollPosition;
|
|
133
|
+
}
|
|
134
|
+
onScroll(event);
|
|
135
|
+
}, [onScroll, direction, scrollPositionRef]);
|
|
136
|
+
return (0, _react2.jsx)(Element, (0, _extends2.default)({
|
|
137
|
+
ref: ref,
|
|
138
|
+
onScroll: onScrollIfMoved
|
|
139
|
+
}, rest));
|
|
140
|
+
});
|
|
141
|
+
OuterElement.propTypes = {
|
|
142
|
+
onScroll: _propTypes.default.any.isRequired
|
|
143
|
+
};
|
|
144
|
+
OuterElement.displayName = 'EuiDataGridOuterElement';
|
|
145
|
+
var EuiDataGridBodyVirtualized = exports.EuiDataGridBodyVirtualized = /*#__PURE__*/(0, _react.memo)(function (_ref4) {
|
|
146
|
+
var leadingControlColumns = _ref4.leadingControlColumns,
|
|
147
|
+
trailingControlColumns = _ref4.trailingControlColumns,
|
|
148
|
+
columns = _ref4.columns,
|
|
149
|
+
visibleColCount = _ref4.visibleColCount,
|
|
150
|
+
schema = _ref4.schema,
|
|
151
|
+
schemaDetectors = _ref4.schemaDetectors,
|
|
152
|
+
rowCount = _ref4.rowCount,
|
|
153
|
+
_ref4$visibleRows = _ref4.visibleRows,
|
|
154
|
+
startRow = _ref4$visibleRows.startRow,
|
|
155
|
+
endRow = _ref4$visibleRows.endRow,
|
|
156
|
+
visibleRowCount = _ref4$visibleRows.visibleRowCount,
|
|
157
|
+
renderCellValue = _ref4.renderCellValue,
|
|
158
|
+
cellContext = _ref4.cellContext,
|
|
159
|
+
renderCellPopover = _ref4.renderCellPopover,
|
|
160
|
+
renderFooterCellValue = _ref4.renderFooterCellValue,
|
|
161
|
+
interactiveCellId = _ref4.interactiveCellId,
|
|
162
|
+
pagination = _ref4.pagination,
|
|
163
|
+
sorting = _ref4.sorting,
|
|
164
|
+
setVisibleColumns = _ref4.setVisibleColumns,
|
|
165
|
+
switchColumnPos = _ref4.switchColumnPos,
|
|
166
|
+
onColumnResize = _ref4.onColumnResize,
|
|
167
|
+
rowHeightsOptions = _ref4.rowHeightsOptions,
|
|
168
|
+
virtualizationOptions = _ref4.virtualizationOptions,
|
|
169
|
+
isFullScreen = _ref4.isFullScreen,
|
|
170
|
+
gridStyles = _ref4.gridStyles,
|
|
171
|
+
gridWidth = _ref4.gridWidth,
|
|
172
|
+
gridRef = _ref4.gridRef,
|
|
173
|
+
gridItemsRendered = _ref4.gridItemsRendered,
|
|
174
|
+
wrapperRef = _ref4.wrapperRef,
|
|
175
|
+
className = _ref4.className,
|
|
176
|
+
canDragAndDropColumns = _ref4.canDragAndDropColumns,
|
|
177
|
+
_ref4$showHeader = _ref4.showHeader,
|
|
178
|
+
showHeader = _ref4$showHeader === void 0 ? true : _ref4$showHeader;
|
|
122
179
|
/**
|
|
123
180
|
* Grid refs & observers
|
|
124
181
|
*/
|
|
@@ -314,7 +371,30 @@ var EuiDataGridBodyVirtualized = exports.EuiDataGridBodyVirtualized = /*#__PURE_
|
|
|
314
371
|
footerRow: footerRow
|
|
315
372
|
};
|
|
316
373
|
}, [headerRowHeight, headerRow, footerRow, showHeader]);
|
|
374
|
+
var scrollPositionRef = (0, _react.useRef)(null);
|
|
375
|
+
var outerElementContextValue = (0, _react.useMemo)(function () {
|
|
376
|
+
return {
|
|
377
|
+
outerElementType: virtualizationOptions === null || virtualizationOptions === void 0 ? void 0 : virtualizationOptions.outerElementType,
|
|
378
|
+
direction: virtualizationOptions === null || virtualizationOptions === void 0 ? void 0 : virtualizationOptions.direction,
|
|
379
|
+
scrollPositionRef: scrollPositionRef
|
|
380
|
+
};
|
|
381
|
+
}, [virtualizationOptions === null || virtualizationOptions === void 0 ? void 0 : virtualizationOptions.outerElementType, virtualizationOptions === null || virtualizationOptions === void 0 ? void 0 : virtualizationOptions.direction]);
|
|
317
382
|
var onScroll = (0, _react.useCallback)(function (args) {
|
|
383
|
+
var element = outerGridRef.current;
|
|
384
|
+
// `scrollTo` reports the requested offset, which can sit past the
|
|
385
|
+
// end. Storing that would replace the clamped position already
|
|
386
|
+
// taken from the DOM. Leave the ref unchanged instead of writing
|
|
387
|
+
// the clamped value: a scroll event that has not arrived yet still
|
|
388
|
+
// differs from the previous position and is forwarded.
|
|
389
|
+
var topInRange = element == null || args.scrollTop === clampScrollOffset(args.scrollTop, element.scrollHeight - element.clientHeight);
|
|
390
|
+
var leftInRange = element == null || args.scrollLeft === clampScrollOffset(args.scrollLeft, element.scrollWidth - element.clientWidth);
|
|
391
|
+
if (topInRange && leftInRange) {
|
|
392
|
+
scrollPositionRef.current = {
|
|
393
|
+
scrollTop: args.scrollTop,
|
|
394
|
+
scrollLeft: args.scrollLeft
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
|
|
318
398
|
// check only if a callback is passed
|
|
319
399
|
if (typeof (virtualizationOptions === null || virtualizationOptions === void 0 ? void 0 : virtualizationOptions.onScroll) !== 'function') return;
|
|
320
400
|
var enhancedArgs = _objectSpread(_objectSpread({}, args), {}, {
|
|
@@ -358,10 +438,13 @@ var EuiDataGridBodyVirtualized = exports.EuiDataGridBodyVirtualized = /*#__PURE_
|
|
|
358
438
|
}, [outerGridRef, virtualizationOptions]);
|
|
359
439
|
return _utils.IS_JEST_ENVIRONMENT || finalWidth > 0 ? (0, _react2.jsx)(DataGridWrapperRowsContext.Provider, {
|
|
360
440
|
value: rowWrapperContextValue
|
|
441
|
+
}, (0, _react2.jsx)(DataGridOuterElementContext.Provider, {
|
|
442
|
+
value: outerElementContextValue
|
|
361
443
|
}, (0, _react2.jsx)(_reactWindow.VariableSizeGrid, (0, _extends2.default)({}, virtualizationOptions, {
|
|
362
444
|
ref: gridRef,
|
|
363
445
|
className: (0, _classnames.default)('euiDataGrid__virtualized', className, virtualizationOptions === null || virtualizationOptions === void 0 ? void 0 : virtualizationOptions.className),
|
|
364
446
|
onItemsRendered: onItemsRendered,
|
|
447
|
+
outerElementType: OuterElement,
|
|
365
448
|
innerElementType: InnerElement,
|
|
366
449
|
outerRef: outerGridRef,
|
|
367
450
|
innerRef: innerGridRef,
|
|
@@ -373,7 +456,7 @@ var EuiDataGridBodyVirtualized = exports.EuiDataGridBodyVirtualized = /*#__PURE_
|
|
|
373
456
|
itemData: itemData,
|
|
374
457
|
rowCount: _utils.IS_JEST_ENVIRONMENT || headerRowHeight > 0 || showHeader === false && innerGridRef.current ? visibleRowCount : 0,
|
|
375
458
|
onScroll: onScroll
|
|
376
|
-
}), Cell), scrollBorderOverlay) : null;
|
|
459
|
+
}), Cell)), scrollBorderOverlay) : null;
|
|
377
460
|
});
|
|
378
461
|
EuiDataGridBodyVirtualized.propTypes = {
|
|
379
462
|
leadingControlColumns: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
@@ -298,7 +298,10 @@ var useRowHeightUtils = exports.useRowHeightUtils = function useRowHeightUtils(_
|
|
|
298
298
|
if (forceRenderRef.current == null) {
|
|
299
299
|
return;
|
|
300
300
|
}
|
|
301
|
-
requestAnimationFrame(forceRenderRef.current);
|
|
301
|
+
var frameId = requestAnimationFrame(forceRenderRef.current);
|
|
302
|
+
return function () {
|
|
303
|
+
return cancelAnimationFrame(frameId);
|
|
304
|
+
};
|
|
302
305
|
}, [// Effects that should cause rerendering
|
|
303
306
|
rowHeightsOptions === null || rowHeightsOptions === void 0 ? void 0 : rowHeightsOptions.defaultHeight, rowHeightsOptions === null || rowHeightsOptions === void 0 ? void 0 : rowHeightsOptions.rowHeights,
|
|
304
307
|
// Dependencies
|