@elastic/eui 76.0.2 → 76.2.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_theme_dark.css +37 -6
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +37 -6
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/color_picker/color_palette_picker/color_palette_picker.js +5 -6
- package/es/components/datagrid/body/data_grid_body.js +19 -395
- package/es/components/datagrid/body/data_grid_body_custom.js +908 -0
- package/es/components/datagrid/body/data_grid_body_virtualized.js +1031 -0
- package/es/components/datagrid/body/data_grid_cell.js +16 -12
- package/es/components/datagrid/body/data_grid_cell_popover.js +32 -12
- package/es/components/datagrid/body/data_grid_cell_wrapper.js +132 -0
- package/es/components/datagrid/body/header/data_grid_header_row.js +3 -2
- package/es/components/datagrid/data_grid.js +21 -5
- package/es/components/datagrid/data_grid_types.js +18 -1
- package/es/components/datagrid/utils/row_heights.js +111 -31
- package/es/components/date_picker/auto_refresh/auto_refresh.js +2 -1
- package/es/components/form/range/dual_range.js +14 -7
- package/es/components/form/range/range.js +10 -3
- package/es/components/form/super_select/super_select.js +21 -18
- package/es/components/form/super_select/super_select_control.js +7 -14
- package/es/components/selectable/selectable.js +59 -36
- package/es/components/selectable/selectable_list/selectable_list.js +1 -1
- package/es/components/suggest/suggest.js +3 -10
- package/eui.d.ts +253 -146
- package/i18ntokens.json +89 -57
- package/lib/components/color_picker/color_palette_picker/color_palette_picker.js +5 -6
- package/lib/components/datagrid/body/data_grid_body.js +19 -416
- package/lib/components/datagrid/body/data_grid_body_custom.js +927 -0
- package/lib/components/datagrid/body/data_grid_body_virtualized.js +1059 -0
- package/lib/components/datagrid/body/data_grid_cell.js +16 -12
- package/lib/components/datagrid/body/data_grid_cell_popover.js +35 -12
- package/lib/components/datagrid/body/data_grid_cell_wrapper.js +147 -0
- package/lib/components/datagrid/body/header/data_grid_header_row.js +4 -2
- package/lib/components/datagrid/data_grid.js +21 -4
- package/lib/components/datagrid/data_grid_types.js +22 -1
- package/lib/components/datagrid/utils/row_heights.js +116 -33
- package/lib/components/date_picker/auto_refresh/auto_refresh.js +2 -1
- package/lib/components/form/range/dual_range.js +14 -7
- package/lib/components/form/range/range.js +10 -3
- package/lib/components/form/super_select/super_select.js +21 -18
- package/lib/components/form/super_select/super_select_control.js +7 -16
- package/lib/components/selectable/selectable.js +59 -36
- package/lib/components/selectable/selectable_list/selectable_list.js +1 -1
- package/lib/components/suggest/suggest.js +3 -12
- package/optimize/es/components/datagrid/body/data_grid_body.js +17 -387
- package/optimize/es/components/datagrid/body/data_grid_body_custom.js +176 -0
- package/optimize/es/components/datagrid/body/data_grid_body_virtualized.js +311 -0
- package/optimize/es/components/datagrid/body/data_grid_cell.js +12 -9
- package/optimize/es/components/datagrid/body/data_grid_cell_popover.js +30 -12
- package/optimize/es/components/datagrid/body/data_grid_cell_wrapper.js +127 -0
- package/optimize/es/components/datagrid/body/header/data_grid_header_row.js +3 -2
- package/optimize/es/components/datagrid/data_grid.js +8 -5
- package/optimize/es/components/datagrid/data_grid_types.js +18 -1
- package/optimize/es/components/datagrid/utils/row_heights.js +100 -31
- package/optimize/es/components/date_picker/auto_refresh/auto_refresh.js +2 -1
- package/optimize/es/components/form/range/dual_range.js +14 -7
- package/optimize/es/components/form/range/range.js +10 -3
- package/optimize/es/components/form/super_select/super_select.js +16 -12
- package/optimize/es/components/form/super_select/super_select_control.js +7 -14
- package/optimize/es/components/selectable/selectable.js +50 -34
- package/optimize/es/components/selectable/selectable_list/selectable_list.js +1 -1
- package/optimize/es/components/suggest/suggest.js +3 -10
- package/optimize/lib/components/datagrid/body/data_grid_body.js +16 -409
- package/optimize/lib/components/datagrid/body/data_grid_body_custom.js +198 -0
- package/optimize/lib/components/datagrid/body/data_grid_body_virtualized.js +342 -0
- package/optimize/lib/components/datagrid/body/data_grid_cell.js +12 -9
- package/optimize/lib/components/datagrid/body/data_grid_cell_popover.js +33 -19
- package/optimize/lib/components/datagrid/body/data_grid_cell_wrapper.js +144 -0
- package/optimize/lib/components/datagrid/body/header/data_grid_header_row.js +4 -2
- package/optimize/lib/components/datagrid/data_grid.js +8 -4
- package/optimize/lib/components/datagrid/data_grid_types.js +22 -1
- package/optimize/lib/components/datagrid/utils/row_heights.js +103 -37
- package/optimize/lib/components/date_picker/auto_refresh/auto_refresh.js +2 -1
- package/optimize/lib/components/form/range/dual_range.js +14 -7
- package/optimize/lib/components/form/range/range.js +10 -3
- package/optimize/lib/components/form/super_select/super_select.js +16 -11
- package/optimize/lib/components/form/super_select/super_select_control.js +7 -16
- package/optimize/lib/components/selectable/selectable.js +50 -35
- package/optimize/lib/components/selectable/selectable_list/selectable_list.js +1 -1
- package/optimize/lib/components/suggest/suggest.js +3 -12
- package/package.json +1 -1
- package/src/components/datagrid/_data_grid.scss +7 -0
- package/src/components/datagrid/_data_grid_data_row.scss +1 -0
- package/src/components/datagrid/body/footer/_data_grid_footer_row.scss +1 -0
- package/src/components/datagrid/body/header/_data_grid_header_row.scss +1 -0
- package/src/components/form/super_select/_super_select_control.scss +4 -0
- package/src/components/selectable/selectable_list/_selectable_list.scss +10 -3
- package/src/themes/amsterdam/global_styling/mixins/_states.scss +17 -8
- package/test-env/components/color_picker/color_palette_picker/color_palette_picker.js +5 -6
- package/test-env/components/datagrid/body/data_grid_body.js +18 -415
- package/test-env/components/datagrid/body/data_grid_body_custom.js +908 -0
- package/test-env/components/datagrid/body/data_grid_body_virtualized.js +1057 -0
- package/test-env/components/datagrid/body/data_grid_cell.js +16 -12
- package/test-env/components/datagrid/body/data_grid_cell_popover.js +33 -19
- package/test-env/components/datagrid/body/data_grid_cell_wrapper.js +144 -0
- package/test-env/components/datagrid/body/header/data_grid_header_row.js +4 -2
- package/test-env/components/datagrid/data_grid.js +21 -4
- package/test-env/components/datagrid/data_grid_types.js +22 -1
- package/test-env/components/datagrid/utils/row_heights.js +103 -37
- package/test-env/components/date_picker/auto_refresh/auto_refresh.js +2 -1
- package/test-env/components/form/range/dual_range.js +14 -7
- package/test-env/components/form/range/range.js +10 -3
- package/test-env/components/form/super_select/super_select.js +21 -17
- package/test-env/components/form/super_select/super_select_control.js +7 -16
- package/test-env/components/selectable/selectable.js +58 -36
- package/test-env/components/selectable/selectable_list/selectable_list.js +1 -1
- package/test-env/components/suggest/suggest.js +3 -12
|
@@ -605,7 +605,7 @@ EuiDataGridCellContent.propTypes = {
|
|
|
605
605
|
*/
|
|
606
606
|
scrollAnchorRow: _propTypes.default.oneOf(["start", "center", undefined])
|
|
607
607
|
}),
|
|
608
|
-
rowHeightUtils: _propTypes.default.any,
|
|
608
|
+
rowHeightUtils: _propTypes.default.oneOfType([_propTypes.default.any.isRequired, _propTypes.default.any.isRequired]),
|
|
609
609
|
pagination: _propTypes.default.shape({
|
|
610
610
|
/**
|
|
611
611
|
* The index of the current page, starts at 0 for the first page
|
|
@@ -893,7 +893,8 @@ var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
893
893
|
if (_this.isPopoverOpen()) {
|
|
894
894
|
var _this$props$popoverCo2 = _this.props.popoverContext,
|
|
895
895
|
setPopoverAnchor = _this$props$popoverCo2.setPopoverAnchor,
|
|
896
|
-
setPopoverContent = _this$props$popoverCo2.setPopoverContent
|
|
896
|
+
setPopoverContent = _this$props$popoverCo2.setPopoverContent,
|
|
897
|
+
setCellPopoverProps = _this$props$popoverCo2.setCellPopoverProps; // Set popover anchor
|
|
897
898
|
|
|
898
899
|
var cellAnchorEl = _this.popoverAnchorRef.current;
|
|
899
900
|
setPopoverAnchor(cellAnchorEl); // Set popover contents with cell content
|
|
@@ -919,7 +920,8 @@ var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
919
920
|
cellActions: (0, _react2.jsx)(_data_grid_cell_actions.EuiDataGridCellPopoverActions, _extends({}, sharedProps, {
|
|
920
921
|
column: column
|
|
921
922
|
})),
|
|
922
|
-
DefaultCellPopover: _data_grid_cell_popover.DefaultCellPopover
|
|
923
|
+
DefaultCellPopover: _data_grid_cell_popover.DefaultCellPopover,
|
|
924
|
+
setCellPopoverProps: setCellPopoverProps
|
|
923
925
|
}), (0, _react2.jsx)(CellElement, _extends({}, sharedProps, {
|
|
924
926
|
setCellProps: _this.setCellProps,
|
|
925
927
|
isExpandable: true,
|
|
@@ -973,7 +975,7 @@ var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
973
975
|
}, {
|
|
974
976
|
key: "componentDidUpdate",
|
|
975
977
|
value: function componentDidUpdate(prevProps) {
|
|
976
|
-
var _this$props$rowHeight, _prevProps$rowHeights, _this$props$rowHeight2, _this$props$style, _prevProps$style;
|
|
978
|
+
var _this$props$rowHeight, _prevProps$rowHeights, _this$props$rowHeight2, _this$props$rowHeight3, _this$props$style, _prevProps$style;
|
|
977
979
|
|
|
978
980
|
this.recalculateAutoHeight();
|
|
979
981
|
|
|
@@ -981,16 +983,17 @@ var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
981
983
|
this.recalculateLineHeight();
|
|
982
984
|
}
|
|
983
985
|
|
|
984
|
-
if ((_this$props$rowHeight2 = this.props.
|
|
986
|
+
if ((_this$props$rowHeight2 = this.props.rowHeightUtils) !== null && _this$props$rowHeight2 !== void 0 && _this$props$rowHeight2.compensateForLayoutShift && (_this$props$rowHeight3 = this.props.rowHeightsOptions) !== null && _this$props$rowHeight3 !== void 0 && _this$props$rowHeight3.scrollAnchorRow && this.props.colIndex === 0 && // once per row
|
|
985
987
|
this.props.columnId === prevProps.columnId && // if this is still the same column
|
|
986
988
|
this.props.rowIndex === prevProps.rowIndex && // if this is still the same row
|
|
987
989
|
((_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
|
|
988
990
|
) {
|
|
989
|
-
var _prevProps$style2, _this$props$style2, _this$props$
|
|
991
|
+
var _prevProps$style2, _this$props$style2, _this$props$rowHeight4;
|
|
990
992
|
|
|
991
993
|
var previousTop = parseFloat((_prevProps$style2 = prevProps.style) === null || _prevProps$style2 === void 0 ? void 0 : _prevProps$style2.top);
|
|
992
|
-
var currentTop = parseFloat((_this$props$style2 = this.props.style) === null || _this$props$style2 === void 0 ? void 0 : _this$props$style2.top);
|
|
993
|
-
|
|
994
|
+
var currentTop = parseFloat((_this$props$style2 = this.props.style) === null || _this$props$style2 === void 0 ? void 0 : _this$props$style2.top); // @ts-ignore We've already checked that this virtualization util is available above
|
|
995
|
+
|
|
996
|
+
this.props.rowHeightUtils.compensateForLayoutShift(this.props.rowIndex, currentTop - previousTop, (_this$props$rowHeight4 = this.props.rowHeightsOptions) === null || _this$props$rowHeight4 === void 0 ? void 0 : _this$props$rowHeight4.scrollAnchorRow);
|
|
994
997
|
}
|
|
995
998
|
|
|
996
999
|
if (this.props.popoverContext.popoverIsOpen !== prevProps.popoverContext.popoverIsOpen || this.props.popoverContext.cellLocation !== prevProps.popoverContext.cellLocation || this.props.renderCellPopover !== prevProps.renderCellPopover) {
|
|
@@ -1080,8 +1083,8 @@ var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
1080
1083
|
});
|
|
1081
1084
|
|
|
1082
1085
|
cellProps.style = _objectSpread(_objectSpread({}, style), {}, {
|
|
1083
|
-
//
|
|
1084
|
-
top: 0,
|
|
1086
|
+
// set by react-window or the custom renderer
|
|
1087
|
+
top: style !== null && style !== void 0 && style.top ? 0 : undefined,
|
|
1085
1088
|
// The cell's row will handle top positioning
|
|
1086
1089
|
width: width,
|
|
1087
1090
|
// column width, can be undefined
|
|
@@ -1632,7 +1635,8 @@ EuiDataGridCell.propTypes = {
|
|
|
1632
1635
|
openCellPopover: _propTypes.default.func.isRequired,
|
|
1633
1636
|
closeCellPopover: _propTypes.default.func.isRequired,
|
|
1634
1637
|
setPopoverAnchor: _propTypes.default.func.isRequired,
|
|
1635
|
-
setPopoverContent: _propTypes.default.func.isRequired
|
|
1638
|
+
setPopoverContent: _propTypes.default.func.isRequired,
|
|
1639
|
+
setCellPopoverProps: _propTypes.default.func.isRequired
|
|
1636
1640
|
}).isRequired,
|
|
1637
1641
|
renderCellValue: _propTypes.default.oneOfType([_propTypes.default.func.isRequired, _propTypes.default.func.isRequired]).isRequired,
|
|
1638
1642
|
renderCellPopover: _propTypes.default.oneOfType([_propTypes.default.func.isRequired, _propTypes.default.func.isRequired]),
|
|
@@ -1675,7 +1679,7 @@ EuiDataGridCell.propTypes = {
|
|
|
1675
1679
|
*/
|
|
1676
1680
|
scrollAnchorRow: _propTypes.default.oneOf(["start", "center", undefined])
|
|
1677
1681
|
}),
|
|
1678
|
-
rowHeightUtils: _propTypes.default.any,
|
|
1682
|
+
rowHeightUtils: _propTypes.default.oneOfType([_propTypes.default.any.isRequired, _propTypes.default.any.isRequired]),
|
|
1679
1683
|
rowManager: _propTypes.default.shape({
|
|
1680
1684
|
getRow: _propTypes.default.func.isRequired
|
|
1681
1685
|
}),
|
|
@@ -9,6 +9,8 @@ exports.useCellPopover = exports.JsonPopoverContent = exports.DefaultCellPopover
|
|
|
9
9
|
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
|
|
12
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
+
|
|
12
14
|
var _services = require("../../../services");
|
|
13
15
|
|
|
14
16
|
var _popover = require("../../popover");
|
|
@@ -19,10 +21,20 @@ var _code = require("../../code");
|
|
|
19
21
|
|
|
20
22
|
var _react2 = require("@emotion/react");
|
|
21
23
|
|
|
24
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
+
|
|
22
26
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
27
|
|
|
24
28
|
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; }
|
|
25
29
|
|
|
30
|
+
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); }
|
|
31
|
+
|
|
32
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
33
|
+
|
|
34
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
35
|
+
|
|
36
|
+
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; }
|
|
37
|
+
|
|
26
38
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
27
39
|
|
|
28
40
|
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."); }
|
|
@@ -44,11 +56,14 @@ var DataGridCellPopoverContext = /*#__PURE__*/(0, _react.createContext)({
|
|
|
44
56
|
openCellPopover: function openCellPopover() {},
|
|
45
57
|
closeCellPopover: function closeCellPopover() {},
|
|
46
58
|
setPopoverAnchor: function setPopoverAnchor() {},
|
|
47
|
-
setPopoverContent: function setPopoverContent() {}
|
|
59
|
+
setPopoverContent: function setPopoverContent() {},
|
|
60
|
+
setCellPopoverProps: function setCellPopoverProps() {}
|
|
48
61
|
});
|
|
49
62
|
exports.DataGridCellPopoverContext = DataGridCellPopoverContext;
|
|
50
63
|
|
|
51
64
|
var useCellPopover = function useCellPopover() {
|
|
65
|
+
var _cellPopoverProps$pan;
|
|
66
|
+
|
|
52
67
|
// Current open state & cell location are handled here
|
|
53
68
|
var _useState = (0, _react.useState)(false),
|
|
54
69
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -72,7 +87,13 @@ var useCellPopover = function useCellPopover() {
|
|
|
72
87
|
var _useState7 = (0, _react.useState)(),
|
|
73
88
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
74
89
|
popoverContent = _useState8[0],
|
|
75
|
-
setPopoverContent = _useState8[1];
|
|
90
|
+
setPopoverContent = _useState8[1]; // Allow customization of most (not all) popover props by consumers
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
var _useState9 = (0, _react.useState)({}),
|
|
94
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
95
|
+
cellPopoverProps = _useState10[0],
|
|
96
|
+
setCellPopoverProps = _useState10[1];
|
|
76
97
|
|
|
77
98
|
var closeCellPopover = (0, _react.useCallback)(function () {
|
|
78
99
|
return setPopoverIsOpen(false);
|
|
@@ -102,20 +123,20 @@ var useCellPopover = function useCellPopover() {
|
|
|
102
123
|
openCellPopover: openCellPopover,
|
|
103
124
|
cellLocation: cellLocation,
|
|
104
125
|
setPopoverAnchor: setPopoverAnchor,
|
|
105
|
-
setPopoverContent: setPopoverContent
|
|
126
|
+
setPopoverContent: setPopoverContent,
|
|
127
|
+
setCellPopoverProps: setCellPopoverProps
|
|
106
128
|
}; // Note that this popover is rendered once at the top grid level, rather than one popover per cell
|
|
107
129
|
|
|
108
|
-
var cellPopover = popoverIsOpen && popoverAnchor && (0, _react2.jsx)(_popover.EuiWrappingPopover, {
|
|
130
|
+
var cellPopover = popoverIsOpen && popoverAnchor && (0, _react2.jsx)(_popover.EuiWrappingPopover, _extends({
|
|
109
131
|
isOpen: popoverIsOpen,
|
|
110
|
-
button: popoverAnchor,
|
|
111
132
|
display: "block",
|
|
112
133
|
hasArrow: false,
|
|
113
|
-
panelPaddingSize: "s"
|
|
114
|
-
|
|
115
|
-
panelProps: {
|
|
134
|
+
panelPaddingSize: "s"
|
|
135
|
+
}, cellPopoverProps, {
|
|
136
|
+
panelProps: _objectSpread({
|
|
116
137
|
'data-test-subj': 'euiDataGridExpansionPopover'
|
|
117
|
-
},
|
|
118
|
-
|
|
138
|
+
}, cellPopoverProps.panelProps || {}),
|
|
139
|
+
panelClassName: (0, _classnames.default)('euiDataGridRowCell__popover', cellPopoverProps.panelClassName, (_cellPopoverProps$pan = cellPopoverProps.panelProps) === null || _cellPopoverProps$pan === void 0 ? void 0 : _cellPopoverProps$pan.className),
|
|
119
140
|
onKeyDown: function onKeyDown(event) {
|
|
120
141
|
if (event.key === _services.keys.F2 || event.key === _services.keys.ESCAPE) {
|
|
121
142
|
event.preventDefault();
|
|
@@ -126,8 +147,10 @@ var useCellPopover = function useCellPopover() {
|
|
|
126
147
|
return popoverAnchor.parentElement.focus();
|
|
127
148
|
});
|
|
128
149
|
}
|
|
129
|
-
}
|
|
130
|
-
|
|
150
|
+
},
|
|
151
|
+
button: popoverAnchor,
|
|
152
|
+
closePopover: closeCellPopover
|
|
153
|
+
}), popoverContent);
|
|
131
154
|
return {
|
|
132
155
|
cellPopoverContext: cellPopoverContext,
|
|
133
156
|
cellPopover: cellPopover
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
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
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.Cell = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
+
|
|
14
|
+
var _sorting = require("../utils/sorting");
|
|
15
|
+
|
|
16
|
+
var _data_grid_cell_popover = require("./data_grid_cell_popover");
|
|
17
|
+
|
|
18
|
+
var _data_grid_cell = require("./data_grid_cell");
|
|
19
|
+
|
|
20
|
+
var _react2 = require("@emotion/react");
|
|
21
|
+
|
|
22
|
+
var _excluded = ["colIndex", "visibleRowIndex", "style", "schema", "schemaDetectors", "pagination", "columns", "leadingControlColumns", "trailingControlColumns", "visibleColCount", "columnWidths", "defaultColumnWidth", "renderCellValue", "renderCellPopover", "interactiveCellId", "setRowHeight", "rowHeightsOptions", "rowHeightUtils", "rowManager"];
|
|
23
|
+
|
|
24
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
+
|
|
26
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
27
|
+
|
|
28
|
+
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; }
|
|
29
|
+
|
|
30
|
+
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); }
|
|
31
|
+
|
|
32
|
+
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; }
|
|
33
|
+
|
|
34
|
+
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; }
|
|
35
|
+
|
|
36
|
+
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; }
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* A DRY wrapper used by both custom and virtualized grid cells.
|
|
40
|
+
* It grabs context, determines the type of cell being rendered
|
|
41
|
+
* (e.g. control vs data cell), & sets shared props between all cells
|
|
42
|
+
*/
|
|
43
|
+
var Cell = function Cell(_ref) {
|
|
44
|
+
var colIndex = _ref.colIndex,
|
|
45
|
+
visibleRowIndex = _ref.visibleRowIndex,
|
|
46
|
+
style = _ref.style,
|
|
47
|
+
schema = _ref.schema,
|
|
48
|
+
schemaDetectors = _ref.schemaDetectors,
|
|
49
|
+
pagination = _ref.pagination,
|
|
50
|
+
columns = _ref.columns,
|
|
51
|
+
leadingControlColumns = _ref.leadingControlColumns,
|
|
52
|
+
trailingControlColumns = _ref.trailingControlColumns,
|
|
53
|
+
visibleColCount = _ref.visibleColCount,
|
|
54
|
+
columnWidths = _ref.columnWidths,
|
|
55
|
+
defaultColumnWidth = _ref.defaultColumnWidth,
|
|
56
|
+
renderCellValue = _ref.renderCellValue,
|
|
57
|
+
renderCellPopover = _ref.renderCellPopover,
|
|
58
|
+
interactiveCellId = _ref.interactiveCellId,
|
|
59
|
+
setRowHeight = _ref.setRowHeight,
|
|
60
|
+
rowHeightsOptions = _ref.rowHeightsOptions,
|
|
61
|
+
rowHeightUtils = _ref.rowHeightUtils,
|
|
62
|
+
rowManager = _ref.rowManager,
|
|
63
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
64
|
+
|
|
65
|
+
var popoverContext = (0, _react.useContext)(_data_grid_cell_popover.DataGridCellPopoverContext);
|
|
66
|
+
|
|
67
|
+
var _useContext = (0, _react.useContext)(_sorting.DataGridSortingContext),
|
|
68
|
+
getCorrectRowIndex = _useContext.getCorrectRowIndex;
|
|
69
|
+
|
|
70
|
+
var cellContent;
|
|
71
|
+
var isFirstColumn = colIndex === 0;
|
|
72
|
+
var isLastColumn = colIndex === visibleColCount - 1;
|
|
73
|
+
var isLeadingControlColumn = colIndex < leadingControlColumns.length;
|
|
74
|
+
var isTrailingControlColumn = colIndex >= leadingControlColumns.length + columns.length;
|
|
75
|
+
var datacolIndex = colIndex - leadingControlColumns.length;
|
|
76
|
+
var column = columns[datacolIndex];
|
|
77
|
+
var columnId = column === null || column === void 0 ? void 0 : column.id;
|
|
78
|
+
var textTransform = (0, _react.useMemo)(function () {
|
|
79
|
+
var _schemaDetectors$filt;
|
|
80
|
+
|
|
81
|
+
return (_schemaDetectors$filt = schemaDetectors.filter(function (row) {
|
|
82
|
+
return column !== null && column !== void 0 && column.schema ? (column === null || column === void 0 ? void 0 : column.schema) === row.type : columnId === row.type;
|
|
83
|
+
})[0]) === null || _schemaDetectors$filt === void 0 ? void 0 : _schemaDetectors$filt.textTransform;
|
|
84
|
+
}, [columnId, column === null || column === void 0 ? void 0 : column.schema, schemaDetectors]);
|
|
85
|
+
var classes = (0, _classnames.default)(_defineProperty({
|
|
86
|
+
'euiDataGridRowCell--firstColumn': isFirstColumn,
|
|
87
|
+
'euiDataGridRowCell--lastColumn': isLastColumn,
|
|
88
|
+
'euiDataGridRowCell--controlColumn': isLeadingControlColumn || isTrailingControlColumn
|
|
89
|
+
}, "euiDataGridRowCell--".concat(textTransform), textTransform));
|
|
90
|
+
var sharedCellProps = {
|
|
91
|
+
rowIndex: getCorrectRowIndex(visibleRowIndex),
|
|
92
|
+
visibleRowIndex: visibleRowIndex,
|
|
93
|
+
colIndex: colIndex,
|
|
94
|
+
interactiveCellId: interactiveCellId,
|
|
95
|
+
className: classes,
|
|
96
|
+
style: style,
|
|
97
|
+
rowHeightsOptions: rowHeightsOptions,
|
|
98
|
+
rowHeightUtils: rowHeightUtils,
|
|
99
|
+
setRowHeight: isFirstColumn ? setRowHeight : undefined,
|
|
100
|
+
rowManager: rowManager,
|
|
101
|
+
popoverContext: popoverContext,
|
|
102
|
+
pagination: pagination
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
if (isLeadingControlColumn) {
|
|
106
|
+
var leadingColumn = leadingControlColumns[colIndex];
|
|
107
|
+
var id = leadingColumn.id,
|
|
108
|
+
rowCellRender = leadingColumn.rowCellRender;
|
|
109
|
+
cellContent = (0, _react2.jsx)(_data_grid_cell.EuiDataGridCell, _extends({}, sharedCellProps, {
|
|
110
|
+
columnId: id,
|
|
111
|
+
width: leadingColumn.width,
|
|
112
|
+
renderCellValue: rowCellRender,
|
|
113
|
+
isExpandable: false
|
|
114
|
+
}, rest));
|
|
115
|
+
} else if (isTrailingControlColumn) {
|
|
116
|
+
var columnOffset = columns.length + leadingControlColumns.length;
|
|
117
|
+
var trailingcolIndex = colIndex - columnOffset;
|
|
118
|
+
var trailingColumn = trailingControlColumns[trailingcolIndex];
|
|
119
|
+
var _id = trailingColumn.id,
|
|
120
|
+
_rowCellRender = trailingColumn.rowCellRender;
|
|
121
|
+
cellContent = (0, _react2.jsx)(_data_grid_cell.EuiDataGridCell, _extends({}, sharedCellProps, {
|
|
122
|
+
columnId: _id,
|
|
123
|
+
width: trailingColumn.width,
|
|
124
|
+
renderCellValue: _rowCellRender,
|
|
125
|
+
isExpandable: false
|
|
126
|
+
}, rest));
|
|
127
|
+
} else {
|
|
128
|
+
// this is a normal data cell
|
|
129
|
+
var columnType = schema[columnId] ? schema[columnId].columnType : null;
|
|
130
|
+
var isExpandable = column.isExpandable !== undefined ? column.isExpandable : true;
|
|
131
|
+
var width = columnWidths[columnId] || defaultColumnWidth;
|
|
132
|
+
cellContent = (0, _react2.jsx)(_data_grid_cell.EuiDataGridCell, _extends({}, sharedCellProps, {
|
|
133
|
+
columnId: columnId,
|
|
134
|
+
column: column,
|
|
135
|
+
columnType: columnType,
|
|
136
|
+
width: width || undefined,
|
|
137
|
+
renderCellValue: renderCellValue,
|
|
138
|
+
renderCellPopover: renderCellPopover,
|
|
139
|
+
interactiveCellId: interactiveCellId,
|
|
140
|
+
isExpandable: isExpandable
|
|
141
|
+
}, rest));
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return cellContent;
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
exports.Cell = Cell;
|
|
@@ -17,6 +17,8 @@ var _data_grid_control_header_cell = require("./data_grid_control_header_cell");
|
|
|
17
17
|
|
|
18
18
|
var _data_grid_header_cell = require("./data_grid_header_cell");
|
|
19
19
|
|
|
20
|
+
var _data_grid_types = require("../../data_grid_types");
|
|
21
|
+
|
|
20
22
|
var _react2 = require("@emotion/react");
|
|
21
23
|
|
|
22
24
|
var _excluded = ["leadingControlColumns", "trailingControlColumns", "columns", "schema", "schemaDetectors", "columnWidths", "defaultColumnWidth", "className", "setColumnWidth", "setVisibleColumns", "switchColumnPos", "headerIsInteractive", "data-test-subj"];
|
|
@@ -35,9 +37,9 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
35
37
|
|
|
36
38
|
var EuiDataGridHeaderRow = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
37
39
|
var _props$leadingControl = props.leadingControlColumns,
|
|
38
|
-
leadingControlColumns = _props$leadingControl === void 0 ?
|
|
40
|
+
leadingControlColumns = _props$leadingControl === void 0 ? _data_grid_types.emptyControlColumns : _props$leadingControl,
|
|
39
41
|
_props$trailingContro = props.trailingControlColumns,
|
|
40
|
-
trailingControlColumns = _props$trailingContro === void 0 ?
|
|
42
|
+
trailingControlColumns = _props$trailingContro === void 0 ? _data_grid_types.emptyControlColumns : _props$trailingContro,
|
|
41
43
|
columns = props.columns,
|
|
42
44
|
schema = props.schema,
|
|
43
45
|
schemaDetectors = props.schemaDetectors,
|
|
@@ -45,9 +45,11 @@ var _data_grid_schema = require("./utils/data_grid_schema");
|
|
|
45
45
|
|
|
46
46
|
var _ref = require("./utils/ref");
|
|
47
47
|
|
|
48
|
+
var _data_grid_types = require("./data_grid_types");
|
|
49
|
+
|
|
48
50
|
var _react2 = require("@emotion/react");
|
|
49
51
|
|
|
50
|
-
var _excluded = ["leadingControlColumns", "trailingControlColumns", "columns", "columnVisibility", "schemaDetectors", "rowCount", "renderCellValue", "renderCellPopover", "renderFooterCellValue", "className", "gridStyle", "toolbarVisibility", "pagination", "sorting", "inMemory", "onColumnResize", "minSizeForControls", "height", "width", "rowHeightsOptions", "virtualizationOptions"],
|
|
52
|
+
var _excluded = ["leadingControlColumns", "trailingControlColumns", "columns", "columnVisibility", "schemaDetectors", "rowCount", "renderCellValue", "renderCellPopover", "renderFooterCellValue", "className", "gridStyle", "toolbarVisibility", "pagination", "sorting", "inMemory", "onColumnResize", "minSizeForControls", "height", "width", "rowHeightsOptions", "virtualizationOptions", "renderCustomGridBody"],
|
|
51
53
|
_excluded2 = ["focusProps"];
|
|
52
54
|
|
|
53
55
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -121,9 +123,9 @@ var EuiDataGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
121
123
|
var _gridItemsRendered$cu;
|
|
122
124
|
|
|
123
125
|
var _props$leadingControl = props.leadingControlColumns,
|
|
124
|
-
leadingControlColumns = _props$leadingControl === void 0 ?
|
|
126
|
+
leadingControlColumns = _props$leadingControl === void 0 ? _data_grid_types.emptyControlColumns : _props$leadingControl,
|
|
125
127
|
_props$trailingContro = props.trailingControlColumns,
|
|
126
|
-
trailingControlColumns = _props$trailingContro === void 0 ?
|
|
128
|
+
trailingControlColumns = _props$trailingContro === void 0 ? _data_grid_types.emptyControlColumns : _props$trailingContro,
|
|
127
129
|
columns = props.columns,
|
|
128
130
|
columnVisibility = props.columnVisibility,
|
|
129
131
|
schemaDetectors = props.schemaDetectors,
|
|
@@ -144,6 +146,7 @@ var EuiDataGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
144
146
|
width = props.width,
|
|
145
147
|
_rowHeightsOptions = props.rowHeightsOptions,
|
|
146
148
|
virtualizationOptions = props.virtualizationOptions,
|
|
149
|
+
renderCustomGridBody = props.renderCustomGridBody,
|
|
147
150
|
rest = _objectWithoutProperties(props, _excluded);
|
|
148
151
|
/**
|
|
149
152
|
* Merge consumer settings with defaults
|
|
@@ -421,7 +424,8 @@ var EuiDataGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
421
424
|
gridWidth: gridWidth,
|
|
422
425
|
gridRef: gridRef,
|
|
423
426
|
gridItemsRendered: gridItemsRendered,
|
|
424
|
-
wrapperRef: contentRef
|
|
427
|
+
wrapperRef: contentRef,
|
|
428
|
+
renderCustomGridBody: renderCustomGridBody
|
|
425
429
|
})), pagination && props['aria-labelledby'] && (0, _react2.jsx)("p", {
|
|
426
430
|
id: ariaLabelledById,
|
|
427
431
|
hidden: true
|
|
@@ -1077,6 +1081,19 @@ EuiDataGrid.propTypes = {
|
|
|
1077
1081
|
*/
|
|
1078
1082
|
renderFooterCellValue: _propTypes.default.oneOfType([_propTypes.default.func.isRequired, _propTypes.default.func.isRequired]),
|
|
1079
1083
|
|
|
1084
|
+
/**
|
|
1085
|
+
* An optional function called to completely customize and control the rendering of
|
|
1086
|
+
* EuiDataGrid's body and cell placement. This can be used to, e.g. remove EuiDataGrid's
|
|
1087
|
+
* virtualization library, or roll your own.
|
|
1088
|
+
*
|
|
1089
|
+
* This component is **only** meant as an escape hatch for extremely custom use cases.
|
|
1090
|
+
*
|
|
1091
|
+
* Behind the scenes, this function is treated as a React component,
|
|
1092
|
+
* allowing hooks, context, and other React concepts to be used.
|
|
1093
|
+
* It receives #EuiDataGridCustomBodyProps as its only argument.
|
|
1094
|
+
*/
|
|
1095
|
+
renderCustomGridBody: _propTypes.default.func,
|
|
1096
|
+
|
|
1080
1097
|
/**
|
|
1081
1098
|
* Defines the initial style of the grid. Accepts a partial #EuiDataGridStyle object.
|
|
1082
1099
|
* Settings provided may be overwritten or merged with user defined preferences if `toolbarVisibility.showDisplaySelector.allowDensity = true` (which is the default).
|
|
@@ -2,4 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
|
-
});
|
|
5
|
+
});
|
|
6
|
+
exports.emptyControlColumns = void 0;
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
10
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
11
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
12
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
13
|
+
* Side Public License, v 1.
|
|
14
|
+
*/
|
|
15
|
+
// since react-window doesn't export a type with the imperative api only we can
|
|
16
|
+
// use this to omit the react-specific class component methods
|
|
17
|
+
// An array of [x,y] coordinates. Note that the `y` value expected internally is a `visibleRowIndex`
|
|
18
|
+
// Force either aria-label or aria-labelledby to be defined
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Props shared between renderCellValue and renderCellPopover
|
|
22
|
+
*/
|
|
23
|
+
// The empty control column array fallbacks need to be cached, or
|
|
24
|
+
// they'll cause rerendering/remount issues in memoized dependencies
|
|
25
|
+
var emptyControlColumns = [];
|
|
26
|
+
exports.emptyControlColumns = emptyControlColumns;
|