@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
|
@@ -27,67 +27,108 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
27
27
|
|
|
28
28
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
29
29
|
|
|
30
|
-
function
|
|
30
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
31
31
|
|
|
32
|
-
function
|
|
32
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
33
33
|
|
|
34
|
-
function
|
|
34
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
35
35
|
|
|
36
|
-
function
|
|
36
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
37
37
|
|
|
38
|
-
function
|
|
38
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
39
39
|
|
|
40
|
-
function
|
|
40
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
41
41
|
|
|
42
|
-
function
|
|
42
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
43
43
|
|
|
44
|
-
function
|
|
44
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
45
|
+
|
|
46
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
47
|
+
|
|
48
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
49
|
+
|
|
50
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
51
|
+
|
|
52
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
53
|
+
|
|
54
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
45
55
|
|
|
46
56
|
/**
|
|
47
57
|
* Injects the EuiPopover next to the button via EuiPortal
|
|
48
58
|
* then the button element is moved into the popover dom.
|
|
49
59
|
* On unmount, the button is moved back to its original location.
|
|
50
60
|
*/
|
|
51
|
-
var EuiWrappingPopover = function
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
setPortal = _useState4[1];
|
|
64
|
-
|
|
65
|
-
(0, _react.useEffect)(function () {
|
|
66
|
-
if (anchor) {
|
|
67
|
-
// move the button into the popover DOM
|
|
68
|
-
anchor.insertAdjacentElement('beforebegin', button);
|
|
61
|
+
var EuiWrappingPopover = /*#__PURE__*/function (_Component) {
|
|
62
|
+
_inherits(EuiWrappingPopover, _Component);
|
|
63
|
+
|
|
64
|
+
var _super = _createSuper(EuiWrappingPopover);
|
|
65
|
+
|
|
66
|
+
function EuiWrappingPopover() {
|
|
67
|
+
var _this;
|
|
68
|
+
|
|
69
|
+
_classCallCheck(this, EuiWrappingPopover);
|
|
70
|
+
|
|
71
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
72
|
+
args[_key] = arguments[_key];
|
|
69
73
|
}
|
|
70
74
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
76
|
+
|
|
77
|
+
_defineProperty(_assertThisInitialized(_this), "portal", null);
|
|
78
|
+
|
|
79
|
+
_defineProperty(_assertThisInitialized(_this), "anchor", null);
|
|
80
|
+
|
|
81
|
+
_defineProperty(_assertThisInitialized(_this), "setPortalRef", function (node) {
|
|
82
|
+
_this.portal = node;
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
_defineProperty(_assertThisInitialized(_this), "setAnchorRef", function (node) {
|
|
86
|
+
_this.anchor = node;
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
return _this;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
_createClass(EuiWrappingPopover, [{
|
|
93
|
+
key: "componentDidMount",
|
|
94
|
+
value: function componentDidMount() {
|
|
95
|
+
if (this.anchor) {
|
|
96
|
+
this.anchor.insertAdjacentElement('beforebegin', this.props.button);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}, {
|
|
100
|
+
key: "componentWillUnmount",
|
|
101
|
+
value: function componentWillUnmount() {
|
|
102
|
+
if (this.props.button.parentNode) {
|
|
103
|
+
if (this.portal) {
|
|
104
|
+
this.portal.insertAdjacentElement('beforebegin', this.props.button);
|
|
105
|
+
}
|
|
75
106
|
}
|
|
76
|
-
};
|
|
77
|
-
}, [anchor, button, portal]);
|
|
78
|
-
return (0, _react2.jsx)(_portal.EuiPortal, {
|
|
79
|
-
portalRef: setPortal,
|
|
80
|
-
insert: {
|
|
81
|
-
sibling: button,
|
|
82
|
-
position: 'after'
|
|
83
107
|
}
|
|
84
|
-
},
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
108
|
+
}, {
|
|
109
|
+
key: "render",
|
|
110
|
+
value: function render() {
|
|
111
|
+
var _this$props = this.props,
|
|
112
|
+
button = _this$props.button,
|
|
113
|
+
rest = _objectWithoutProperties(_this$props, _excluded);
|
|
114
|
+
|
|
115
|
+
return (0, _react2.jsx)(_portal.EuiPortal, {
|
|
116
|
+
portalRef: this.setPortalRef,
|
|
117
|
+
insert: {
|
|
118
|
+
sibling: this.props.button,
|
|
119
|
+
position: 'after'
|
|
120
|
+
}
|
|
121
|
+
}, (0, _react2.jsx)(_popover.EuiPopover, _extends({}, rest, {
|
|
122
|
+
button: (0, _react2.jsx)("div", {
|
|
123
|
+
ref: this.setAnchorRef,
|
|
124
|
+
className: "euiWrappingPopover__anchor"
|
|
125
|
+
})
|
|
126
|
+
})));
|
|
127
|
+
}
|
|
128
|
+
}]);
|
|
129
|
+
|
|
130
|
+
return EuiWrappingPopover;
|
|
131
|
+
}(_react.Component);
|
|
91
132
|
|
|
92
133
|
exports.EuiWrappingPopover = EuiWrappingPopover;
|
|
93
134
|
EuiWrappingPopover.propTypes = {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
@@ -7,23 +9,35 @@ exports.insertPositions = exports.INSERT_POSITIONS = exports.EuiPortal = void 0;
|
|
|
7
9
|
|
|
8
10
|
var _react = require("react");
|
|
9
11
|
|
|
12
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
+
|
|
10
14
|
var _reactDom = require("react-dom");
|
|
11
15
|
|
|
12
16
|
var _common = require("../common");
|
|
13
17
|
|
|
14
|
-
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
+
|
|
20
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
21
|
+
|
|
22
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
23
|
+
|
|
24
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
15
25
|
|
|
16
|
-
function
|
|
26
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
17
27
|
|
|
18
|
-
function
|
|
28
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
19
29
|
|
|
20
|
-
function
|
|
30
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
21
31
|
|
|
22
|
-
function
|
|
32
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
23
33
|
|
|
24
|
-
function
|
|
34
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
25
35
|
|
|
26
|
-
function
|
|
36
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
37
|
+
|
|
38
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
39
|
+
|
|
40
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
27
41
|
|
|
28
42
|
var insertPositions = {
|
|
29
43
|
after: 'afterend',
|
|
@@ -33,47 +47,81 @@ exports.insertPositions = insertPositions;
|
|
|
33
47
|
var INSERT_POSITIONS = (0, _common.keysOf)(insertPositions);
|
|
34
48
|
exports.INSERT_POSITIONS = INSERT_POSITIONS;
|
|
35
49
|
|
|
36
|
-
var EuiPortal = function
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
50
|
+
var EuiPortal = /*#__PURE__*/function (_Component) {
|
|
51
|
+
_inherits(EuiPortal, _Component);
|
|
52
|
+
|
|
53
|
+
var _super = _createSuper(EuiPortal);
|
|
54
|
+
|
|
55
|
+
function EuiPortal(props) {
|
|
56
|
+
var _this;
|
|
40
57
|
|
|
41
|
-
|
|
42
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
43
|
-
portalNode = _useState2[0],
|
|
44
|
-
setPortalNode = _useState2[1]; // pull `sibling` and `position` out of insert in case their wrapping object is recreated every render
|
|
58
|
+
_classCallCheck(this, EuiPortal);
|
|
45
59
|
|
|
60
|
+
_this = _super.call(this, props);
|
|
46
61
|
|
|
47
|
-
|
|
48
|
-
sibling = _ref2.sibling,
|
|
49
|
-
position = _ref2.position;
|
|
62
|
+
_defineProperty(_assertThisInitialized(_this), "portalNode", null);
|
|
50
63
|
|
|
51
|
-
|
|
52
|
-
var portalNode = document.createElement('div');
|
|
53
|
-
portalNode.dataset.euiportal = 'true';
|
|
54
|
-
setPortalNode(portalNode);
|
|
64
|
+
if (typeof window === 'undefined') return _possibleConstructorReturn(_this); // Prevent SSR errors
|
|
55
65
|
|
|
56
|
-
|
|
66
|
+
var insert = _this.props.insert;
|
|
67
|
+
_this.portalNode = document.createElement('div');
|
|
68
|
+
_this.portalNode.dataset.euiportal = 'true';
|
|
69
|
+
|
|
70
|
+
if (insert == null) {
|
|
57
71
|
// no insertion defined, append to body
|
|
58
|
-
document.body.appendChild(portalNode);
|
|
72
|
+
document.body.appendChild(_this.portalNode);
|
|
59
73
|
} else {
|
|
60
74
|
// inserting before or after an element
|
|
61
|
-
sibling.
|
|
75
|
+
var sibling = insert.sibling,
|
|
76
|
+
position = insert.position;
|
|
77
|
+
sibling.insertAdjacentElement(insertPositions[position], _this.portalNode);
|
|
62
78
|
}
|
|
63
79
|
|
|
64
|
-
return
|
|
65
|
-
|
|
66
|
-
|
|
80
|
+
return _this;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
_createClass(EuiPortal, [{
|
|
84
|
+
key: "componentDidMount",
|
|
85
|
+
value: function componentDidMount() {
|
|
86
|
+
this.updatePortalRef(this.portalNode);
|
|
87
|
+
}
|
|
88
|
+
}, {
|
|
89
|
+
key: "componentWillUnmount",
|
|
90
|
+
value: function componentWillUnmount() {
|
|
91
|
+
var _this$portalNode;
|
|
92
|
+
|
|
93
|
+
if ((_this$portalNode = this.portalNode) !== null && _this$portalNode !== void 0 && _this$portalNode.parentNode) {
|
|
94
|
+
this.portalNode.parentNode.removeChild(this.portalNode);
|
|
67
95
|
}
|
|
68
|
-
};
|
|
69
|
-
}, [sibling, position]);
|
|
70
|
-
(0, _services.useUpdateEffect)(function () {
|
|
71
|
-
portalRef === null || portalRef === void 0 ? void 0 : portalRef(portalNode);
|
|
72
|
-
return function () {
|
|
73
|
-
portalRef === null || portalRef === void 0 ? void 0 : portalRef(null);
|
|
74
|
-
};
|
|
75
|
-
}, [portalNode, portalRef]);
|
|
76
|
-
return portalNode == null ? null : /*#__PURE__*/(0, _reactDom.createPortal)(children, portalNode);
|
|
77
|
-
};
|
|
78
96
|
|
|
79
|
-
|
|
97
|
+
this.updatePortalRef(null);
|
|
98
|
+
}
|
|
99
|
+
}, {
|
|
100
|
+
key: "updatePortalRef",
|
|
101
|
+
value: function updatePortalRef(ref) {
|
|
102
|
+
if (this.props.portalRef) {
|
|
103
|
+
this.props.portalRef(ref);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}, {
|
|
107
|
+
key: "render",
|
|
108
|
+
value: function render() {
|
|
109
|
+
return this.portalNode ? /*#__PURE__*/(0, _reactDom.createPortal)(this.props.children, this.portalNode) : null;
|
|
110
|
+
}
|
|
111
|
+
}]);
|
|
112
|
+
|
|
113
|
+
return EuiPortal;
|
|
114
|
+
}(_react.Component);
|
|
115
|
+
|
|
116
|
+
exports.EuiPortal = EuiPortal;
|
|
117
|
+
EuiPortal.propTypes = {
|
|
118
|
+
/**
|
|
119
|
+
* ReactNode to render as this component's content
|
|
120
|
+
*/
|
|
121
|
+
children: _propTypes.default.node.isRequired,
|
|
122
|
+
insert: _propTypes.default.shape({
|
|
123
|
+
sibling: _propTypes.default.any.isRequired,
|
|
124
|
+
position: _propTypes.default.oneOf(["before", "after"]).isRequired
|
|
125
|
+
}),
|
|
126
|
+
portalRef: _propTypes.default.func
|
|
127
|
+
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
|
-
exports.
|
|
8
|
+
exports.CurrentEuiBreakpointProvider = exports.CurrentEuiBreakpointContext = void 0;
|
|
7
9
|
|
|
8
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
11
|
|
|
@@ -19,8 +21,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
19
21
|
|
|
20
22
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
23
|
|
|
22
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
23
|
-
|
|
24
24
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
25
25
|
|
|
26
26
|
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."); }
|
|
@@ -47,7 +47,7 @@ var CurrentEuiBreakpointProvider = function CurrentEuiBreakpointProvider(_ref) {
|
|
|
47
47
|
var _useEuiTheme = (0, _theme.useEuiTheme)(),
|
|
48
48
|
breakpoints = _useEuiTheme.euiTheme.breakpoint;
|
|
49
49
|
|
|
50
|
-
var _useState = (0, _react.useState)(
|
|
50
|
+
var _useState = (0, _react.useState)(typeof window !== 'undefined' ? (0, _breakpoint.getBreakpoint)(window.innerWidth, breakpoints) : undefined),
|
|
51
51
|
_useState2 = _slicedToArray(_useState, 2),
|
|
52
52
|
currentBreakpoint = _useState2[0],
|
|
53
53
|
setCurrentBreakpoint = _useState2[1];
|
|
@@ -65,16 +65,5 @@ var CurrentEuiBreakpointProvider = function CurrentEuiBreakpointProvider(_ref) {
|
|
|
65
65
|
value: currentBreakpoint
|
|
66
66
|
}, children);
|
|
67
67
|
};
|
|
68
|
-
/**
|
|
69
|
-
* Hook util / syntactical sugar
|
|
70
|
-
*/
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
exports.CurrentEuiBreakpointProvider = CurrentEuiBreakpointProvider;
|
|
74
|
-
|
|
75
|
-
var useCurrentEuiBreakpoint = function useCurrentEuiBreakpoint() {
|
|
76
|
-
var currentBreakpoint = (0, _react.useContext)(CurrentEuiBreakpointContext);
|
|
77
|
-
return currentBreakpoint;
|
|
78
|
-
};
|
|
79
68
|
|
|
80
|
-
exports.
|
|
69
|
+
exports.CurrentEuiBreakpointProvider = CurrentEuiBreakpointProvider;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useCurrentEuiBreakpoint = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
|
|
10
|
+
var _current_breakpoint = require("./current_breakpoint");
|
|
11
|
+
|
|
12
|
+
/*
|
|
13
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
14
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
15
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
16
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
17
|
+
* Side Public License, v 1.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Hook util / syntactical sugar for useContext()
|
|
22
|
+
*
|
|
23
|
+
* This hook is in its own separate file to make mocking it
|
|
24
|
+
* as a testenv easy for Jest unit tests
|
|
25
|
+
*/
|
|
26
|
+
var useCurrentEuiBreakpoint = function useCurrentEuiBreakpoint() {
|
|
27
|
+
var currentBreakpoint = (0, _react.useContext)(_current_breakpoint.CurrentEuiBreakpointContext);
|
|
28
|
+
return currentBreakpoint;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
exports.useCurrentEuiBreakpoint = useCurrentEuiBreakpoint;
|
|
@@ -17,15 +17,28 @@ Object.keys(_breakpoint).forEach(function (key) {
|
|
|
17
17
|
});
|
|
18
18
|
});
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _current_breakpoint = require("./current_breakpoint");
|
|
21
21
|
|
|
22
|
-
Object.keys(
|
|
22
|
+
Object.keys(_current_breakpoint).forEach(function (key) {
|
|
23
23
|
if (key === "default" || key === "__esModule") return;
|
|
24
|
-
if (key in exports && exports[key] ===
|
|
24
|
+
if (key in exports && exports[key] === _current_breakpoint[key]) return;
|
|
25
25
|
Object.defineProperty(exports, key, {
|
|
26
26
|
enumerable: true,
|
|
27
27
|
get: function get() {
|
|
28
|
-
return
|
|
28
|
+
return _current_breakpoint[key];
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
var _current_breakpoint_hook = require("./current_breakpoint_hook");
|
|
34
|
+
|
|
35
|
+
Object.keys(_current_breakpoint_hook).forEach(function (key) {
|
|
36
|
+
if (key === "default" || key === "__esModule") return;
|
|
37
|
+
if (key in exports && exports[key] === _current_breakpoint_hook[key]) return;
|
|
38
|
+
Object.defineProperty(exports, key, {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
get: function get() {
|
|
41
|
+
return _current_breakpoint_hook[key];
|
|
29
42
|
}
|
|
30
43
|
});
|
|
31
44
|
});
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useIsWithinBreakpoints = void 0;
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _current_breakpoint_hook = require("./current_breakpoint_hook");
|
|
9
9
|
|
|
10
10
|
/*
|
|
11
11
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
@@ -27,7 +27,7 @@ var _currentEuiBreakpoint = require("./currentEuiBreakpoint");
|
|
|
27
27
|
*/
|
|
28
28
|
var useIsWithinBreakpoints = function useIsWithinBreakpoints(sizes) {
|
|
29
29
|
var isResponsive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
30
|
-
var currentBreakpoint = (0,
|
|
30
|
+
var currentBreakpoint = (0, _current_breakpoint_hook.useCurrentEuiBreakpoint)();
|
|
31
31
|
return currentBreakpoint && isResponsive ? sizes.includes(currentBreakpoint) : false;
|
|
32
32
|
};
|
|
33
33
|
|
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.waitForEuiPopoverOpen = exports.waitForEuiPopoverClose = void 0;
|
|
6
|
+
exports.waitForEuiToolTipVisible = exports.waitForEuiToolTipHidden = exports.waitForEuiPopoverOpen = exports.waitForEuiPopoverClose = void 0;
|
|
7
|
+
|
|
8
|
+
require("@testing-library/jest-dom");
|
|
7
9
|
|
|
8
10
|
var _react = require("@testing-library/react");
|
|
9
11
|
|
|
@@ -12,7 +14,7 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
|
|
|
12
14
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
13
15
|
|
|
14
16
|
/**
|
|
15
|
-
* Ensure the EuiPopover being tested is open/closed before
|
|
17
|
+
* Ensure the EuiPopover being tested is open/closed before continuing
|
|
16
18
|
* Note: Because EuiPopover is portalled, we want to query `document`
|
|
17
19
|
* instead of the `container` returned by RTL's render()
|
|
18
20
|
*/
|
|
@@ -73,5 +75,69 @@ var waitForEuiPopoverClose = /*#__PURE__*/function () {
|
|
|
73
75
|
return _ref2.apply(this, arguments);
|
|
74
76
|
};
|
|
75
77
|
}();
|
|
78
|
+
/**
|
|
79
|
+
* Ensure the EuiToolTip being tested is open and visible before continuing
|
|
80
|
+
*/
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
exports.waitForEuiPopoverClose = waitForEuiPopoverClose;
|
|
84
|
+
|
|
85
|
+
var waitForEuiToolTipVisible = /*#__PURE__*/function () {
|
|
86
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
|
|
87
|
+
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
88
|
+
while (1) {
|
|
89
|
+
switch (_context3.prev = _context3.next) {
|
|
90
|
+
case 0:
|
|
91
|
+
_context3.next = 2;
|
|
92
|
+
return (0, _react.waitFor)(function () {
|
|
93
|
+
var tooltip = document.querySelector('.euiToolTipPopover');
|
|
94
|
+
expect(tooltip).toBeVisible();
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
case 2:
|
|
98
|
+
return _context3.abrupt("return", _context3.sent);
|
|
99
|
+
|
|
100
|
+
case 3:
|
|
101
|
+
case "end":
|
|
102
|
+
return _context3.stop();
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}, _callee3);
|
|
106
|
+
}));
|
|
107
|
+
|
|
108
|
+
return function waitForEuiToolTipVisible() {
|
|
109
|
+
return _ref3.apply(this, arguments);
|
|
110
|
+
};
|
|
111
|
+
}();
|
|
112
|
+
|
|
113
|
+
exports.waitForEuiToolTipVisible = waitForEuiToolTipVisible;
|
|
114
|
+
|
|
115
|
+
var waitForEuiToolTipHidden = /*#__PURE__*/function () {
|
|
116
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() {
|
|
117
|
+
return regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
118
|
+
while (1) {
|
|
119
|
+
switch (_context4.prev = _context4.next) {
|
|
120
|
+
case 0:
|
|
121
|
+
_context4.next = 2;
|
|
122
|
+
return (0, _react.waitFor)(function () {
|
|
123
|
+
var tooltip = document.querySelector('.euiToolTipPopover');
|
|
124
|
+
expect(tooltip).toBeNull();
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
case 2:
|
|
128
|
+
return _context4.abrupt("return", _context4.sent);
|
|
129
|
+
|
|
130
|
+
case 3:
|
|
131
|
+
case "end":
|
|
132
|
+
return _context4.stop();
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}, _callee4);
|
|
136
|
+
}));
|
|
137
|
+
|
|
138
|
+
return function waitForEuiToolTipHidden() {
|
|
139
|
+
return _ref4.apply(this, arguments);
|
|
140
|
+
};
|
|
141
|
+
}();
|
|
76
142
|
|
|
77
|
-
exports.
|
|
143
|
+
exports.waitForEuiToolTipHidden = waitForEuiToolTipHidden;
|
|
@@ -320,6 +320,8 @@ export var EuiDataGridBody = function EuiDataGridBody(props) {
|
|
|
320
320
|
|
|
321
321
|
var rowHeightUtils = useRowHeightUtils({
|
|
322
322
|
gridRef: gridRef,
|
|
323
|
+
outerGridElementRef: outerGridRef,
|
|
324
|
+
gridItemsRenderedRef: gridItemsRendered,
|
|
323
325
|
gridStyles: gridStyles,
|
|
324
326
|
columns: columns,
|
|
325
327
|
rowHeightsOptions: rowHeightsOptions
|
|
@@ -408,7 +408,7 @@ export var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
408
408
|
}, {
|
|
409
409
|
key: "componentDidUpdate",
|
|
410
410
|
value: function componentDidUpdate(prevProps) {
|
|
411
|
-
var _this$props$rowHeight, _prevProps$rowHeights;
|
|
411
|
+
var _this$props$rowHeight, _prevProps$rowHeights, _this$props$rowHeight2, _this$props$style, _prevProps$style;
|
|
412
412
|
|
|
413
413
|
this.recalculateAutoHeight();
|
|
414
414
|
|
|
@@ -416,6 +416,18 @@ export var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
416
416
|
this.recalculateLineHeight();
|
|
417
417
|
}
|
|
418
418
|
|
|
419
|
+
if ((_this$props$rowHeight2 = this.props.rowHeightsOptions) !== null && _this$props$rowHeight2 !== void 0 && _this$props$rowHeight2.scrollAnchorRow && this.props.colIndex === 0 && // once per row
|
|
420
|
+
this.props.columnId === prevProps.columnId && // if this is still the same column
|
|
421
|
+
this.props.rowIndex === prevProps.rowIndex && // if this is still the same row
|
|
422
|
+
((_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
|
|
423
|
+
) {
|
|
424
|
+
var _prevProps$style2, _this$props$style2, _this$props$rowHeight3, _this$props$rowHeight4;
|
|
425
|
+
|
|
426
|
+
var previousTop = parseFloat((_prevProps$style2 = prevProps.style) === null || _prevProps$style2 === void 0 ? void 0 : _prevProps$style2.top);
|
|
427
|
+
var currentTop = parseFloat((_this$props$style2 = this.props.style) === null || _this$props$style2 === void 0 ? void 0 : _this$props$style2.top);
|
|
428
|
+
(_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);
|
|
429
|
+
}
|
|
430
|
+
|
|
419
431
|
if (this.props.popoverContext.popoverIsOpen !== prevProps.popoverContext.popoverIsOpen || this.props.popoverContext.cellLocation !== prevProps.popoverContext.cellLocation || this.props.renderCellPopover !== prevProps.renderCellPopover) {
|
|
420
432
|
this.handleCellPopover();
|
|
421
433
|
}
|