@elastic/eui 95.11.0 → 95.12.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/README.md +1 -69
- package/es/components/basic_table/basic_table.js +39 -32
- package/es/components/datagrid/body/cell/data_grid_cell.js +121 -15
- package/es/components/datagrid/body/cell/data_grid_cell.styles.js +5 -2
- package/es/components/datagrid/body/data_grid_body_custom.js +5 -2
- package/es/components/datagrid/body/data_grid_body_virtualized.js +5 -2
- package/es/components/datagrid/body/footer/data_grid_footer_row.js +17 -9
- package/es/components/datagrid/body/header/data_grid_control_header_cell.js +5 -2
- package/es/components/datagrid/body/header/data_grid_header_cell.js +3 -1
- package/es/components/datagrid/body/header/data_grid_header_cell.styles.js +0 -2
- package/es/components/datagrid/body/header/data_grid_header_cell_wrapper.js +6 -3
- package/es/components/datagrid/body/header/data_grid_header_row.js +5 -1
- package/es/components/datagrid/data_grid.js +3 -3
- package/es/components/datagrid/data_grid.stories.utils.js +65 -29
- package/es/components/datagrid/utils/row_heights.js +9 -33
- package/es/components/date_picker/date_picker.js +1 -1
- package/es/components/provider/provider.js +16 -13
- package/es/components/provider/system_color_mode/index.js +9 -0
- package/es/components/provider/system_color_mode/system_color_mode_provider.js +49 -0
- package/es/components/resizable_container/resizable_button.js +9 -2
- package/es/components/resizable_container/resizable_button.styles.js +19 -6
- package/es/components/table/table_header_cell.js +10 -3
- package/es/components/table/table_header_cell_checkbox.js +5 -3
- package/es/components/table/table_row_cell.js +10 -3
- package/es/components/table/table_row_cell_checkbox.js +5 -3
- package/es/services/copy/index.js +10 -0
- package/es/services/copy/tabular_copy.js +103 -0
- package/es/services/index.js +1 -1
- package/eui.d.ts +162 -67
- package/i18ntokens.json +90 -90
- package/lib/components/basic_table/basic_table.js +38 -31
- package/lib/components/datagrid/body/cell/data_grid_cell.js +120 -14
- package/lib/components/datagrid/body/cell/data_grid_cell.styles.js +5 -2
- package/lib/components/datagrid/body/data_grid_body_custom.js +5 -2
- package/lib/components/datagrid/body/data_grid_body_virtualized.js +5 -2
- package/lib/components/datagrid/body/footer/data_grid_footer_row.js +13 -5
- package/lib/components/datagrid/body/header/data_grid_control_header_cell.js +5 -2
- package/lib/components/datagrid/body/header/data_grid_header_cell.js +3 -1
- package/lib/components/datagrid/body/header/data_grid_header_cell.styles.js +0 -2
- package/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.js +5 -2
- package/lib/components/datagrid/body/header/data_grid_header_row.js +5 -1
- package/lib/components/datagrid/data_grid.js +2 -2
- package/lib/components/datagrid/data_grid.stories.utils.js +66 -31
- package/lib/components/datagrid/utils/row_heights.js +8 -32
- package/lib/components/date_picker/date_picker.js +1 -1
- package/lib/components/provider/provider.js +16 -13
- package/lib/components/provider/system_color_mode/index.js +12 -0
- package/lib/components/provider/system_color_mode/system_color_mode_provider.js +54 -0
- package/lib/components/resizable_container/resizable_button.js +9 -2
- package/lib/components/resizable_container/resizable_button.styles.js +19 -6
- package/lib/components/table/table_header_cell.js +10 -3
- package/lib/components/table/table_header_cell_checkbox.js +5 -3
- package/lib/components/table/table_row_cell.js +10 -3
- package/lib/components/table/table_row_cell_checkbox.js +5 -3
- package/lib/services/copy/index.js +25 -0
- package/lib/services/copy/tabular_copy.js +111 -0
- package/lib/services/index.js +12 -8
- package/optimize/es/components/basic_table/basic_table.js +39 -32
- package/optimize/es/components/datagrid/body/cell/data_grid_cell.js +18 -14
- package/optimize/es/components/datagrid/body/cell/data_grid_cell.styles.js +5 -2
- package/optimize/es/components/datagrid/body/data_grid_body_custom.js +5 -2
- package/optimize/es/components/datagrid/body/data_grid_body_virtualized.js +5 -2
- package/optimize/es/components/datagrid/body/footer/data_grid_footer_row.js +17 -9
- package/optimize/es/components/datagrid/body/header/data_grid_control_header_cell.js +4 -2
- package/optimize/es/components/datagrid/body/header/data_grid_header_cell.js +3 -1
- package/optimize/es/components/datagrid/body/header/data_grid_header_cell.styles.js +0 -2
- package/optimize/es/components/datagrid/body/header/data_grid_header_cell_wrapper.js +5 -3
- package/optimize/es/components/datagrid/body/header/data_grid_header_row.js +5 -1
- package/optimize/es/components/datagrid/data_grid.js +3 -3
- package/optimize/es/components/datagrid/data_grid.stories.utils.js +65 -29
- package/optimize/es/components/datagrid/utils/row_heights.js +9 -33
- package/optimize/es/components/date_picker/date_picker.js +1 -1
- package/optimize/es/components/provider/provider.js +16 -13
- package/optimize/es/components/provider/system_color_mode/index.js +9 -0
- package/optimize/es/components/provider/system_color_mode/system_color_mode_provider.js +40 -0
- package/optimize/es/components/resizable_container/resizable_button.js +3 -2
- package/optimize/es/components/resizable_container/resizable_button.styles.js +19 -6
- package/optimize/es/components/table/table_header_cell.js +3 -2
- package/optimize/es/components/table/table_header_cell_checkbox.js +3 -2
- package/optimize/es/components/table/table_row_cell.js +4 -3
- package/optimize/es/components/table/table_row_cell_checkbox.js +3 -2
- package/optimize/es/services/copy/index.js +10 -0
- package/optimize/es/services/copy/tabular_copy.js +103 -0
- package/optimize/es/services/index.js +1 -1
- package/optimize/lib/components/basic_table/basic_table.js +38 -31
- package/optimize/lib/components/datagrid/body/cell/data_grid_cell.js +17 -13
- package/optimize/lib/components/datagrid/body/cell/data_grid_cell.styles.js +5 -2
- package/optimize/lib/components/datagrid/body/data_grid_body_custom.js +5 -2
- package/optimize/lib/components/datagrid/body/data_grid_body_virtualized.js +5 -2
- package/optimize/lib/components/datagrid/body/footer/data_grid_footer_row.js +13 -5
- package/optimize/lib/components/datagrid/body/header/data_grid_control_header_cell.js +4 -2
- package/optimize/lib/components/datagrid/body/header/data_grid_header_cell.js +3 -1
- package/optimize/lib/components/datagrid/body/header/data_grid_header_cell.styles.js +0 -2
- package/optimize/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.js +4 -2
- package/optimize/lib/components/datagrid/body/header/data_grid_header_row.js +5 -1
- package/optimize/lib/components/datagrid/data_grid.js +2 -2
- package/optimize/lib/components/datagrid/data_grid.stories.utils.js +70 -37
- package/optimize/lib/components/datagrid/utils/row_heights.js +8 -32
- package/optimize/lib/components/date_picker/date_picker.js +1 -1
- package/optimize/lib/components/provider/provider.js +16 -13
- package/optimize/lib/components/provider/system_color_mode/index.js +12 -0
- package/optimize/lib/components/provider/system_color_mode/system_color_mode_provider.js +47 -0
- package/optimize/lib/components/resizable_container/resizable_button.js +3 -2
- package/optimize/lib/components/resizable_container/resizable_button.styles.js +19 -6
- package/optimize/lib/components/table/table_header_cell.js +3 -2
- package/optimize/lib/components/table/table_header_cell_checkbox.js +3 -2
- package/optimize/lib/components/table/table_row_cell.js +4 -3
- package/optimize/lib/components/table/table_row_cell_checkbox.js +3 -2
- package/optimize/lib/services/copy/index.js +25 -0
- package/optimize/lib/services/copy/tabular_copy.js +111 -0
- package/optimize/lib/services/index.js +12 -8
- package/package.json +1 -1
- package/test-env/components/basic_table/basic_table.js +38 -31
- package/test-env/components/datagrid/body/cell/data_grid_cell.js +120 -14
- package/test-env/components/datagrid/body/cell/data_grid_cell.styles.js +5 -2
- package/test-env/components/datagrid/body/data_grid_body_custom.js +5 -2
- package/test-env/components/datagrid/body/data_grid_body_virtualized.js +5 -2
- package/test-env/components/datagrid/body/footer/data_grid_footer_row.js +13 -5
- package/test-env/components/datagrid/body/header/data_grid_control_header_cell.js +5 -2
- package/test-env/components/datagrid/body/header/data_grid_header_cell.js +3 -1
- package/test-env/components/datagrid/body/header/data_grid_header_cell.styles.js +0 -2
- package/test-env/components/datagrid/body/header/data_grid_header_cell_wrapper.js +5 -2
- package/test-env/components/datagrid/body/header/data_grid_header_row.js +5 -1
- package/test-env/components/datagrid/data_grid.js +2 -2
- package/test-env/components/datagrid/data_grid.stories.utils.js +70 -37
- package/test-env/components/datagrid/utils/row_heights.js +8 -32
- package/test-env/components/date_picker/date_picker.js +1 -1
- package/test-env/components/provider/provider.js +16 -13
- package/test-env/components/provider/system_color_mode/index.js +12 -0
- package/test-env/components/provider/system_color_mode/system_color_mode_provider.js +51 -0
- package/test-env/components/resizable_container/resizable_button.js +9 -2
- package/test-env/components/resizable_container/resizable_button.styles.js +19 -6
- package/test-env/components/table/table_header_cell.js +10 -3
- package/test-env/components/table/table_header_cell_checkbox.js +5 -3
- package/test-env/components/table/table_row_cell.js +10 -3
- package/test-env/components/table/table_row_cell_checkbox.js +5 -3
- package/test-env/services/copy/index.js +25 -0
- package/test-env/services/copy/tabular_copy.js +30 -0
- package/test-env/services/index.js +12 -8
- /package/es/services/{copy_to_clipboard.js → copy/copy_to_clipboard.js} +0 -0
- /package/lib/services/{copy_to_clipboard.js → copy/copy_to_clipboard.js} +0 -0
- /package/optimize/es/services/{copy_to_clipboard.js → copy/copy_to_clipboard.js} +0 -0
- /package/optimize/lib/services/{copy_to_clipboard.js → copy/copy_to_clipboard.js} +0 -0
- /package/test-env/services/{copy_to_clipboard.js → copy/copy_to_clipboard.js} +0 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "OverrideCopiedTabularContent", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _tabular_copy.OverrideCopiedTabularContent;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "copyToClipboard", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _copy_to_clipboard.copyToClipboard;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "tabularCopyMarkers", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function get() {
|
|
21
|
+
return _tabular_copy.tabularCopyMarkers;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
var _copy_to_clipboard = require("./copy_to_clipboard");
|
|
25
|
+
var _tabular_copy = require("./tabular_copy");
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.tabularCopyMarkers = exports.onTabularCopy = exports.OverrideCopiedTabularContent = exports.CHARS = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _react2 = require("@emotion/react");
|
|
10
|
+
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); }
|
|
11
|
+
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; }
|
|
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
|
+
* Clipboard text cleaning logic
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
// Special visually hidden unicode characters that we use to manually clean content
|
|
25
|
+
// and force our own newlines/horizontal tabs
|
|
26
|
+
var CHARS = exports.CHARS = {
|
|
27
|
+
NEWLINE: '↵',
|
|
28
|
+
TAB: '↦',
|
|
29
|
+
// Use multiple characters to reduce the chances of consumers also using these characters
|
|
30
|
+
TABULAR_CONTENT_BOUND: '𐘂𐘂',
|
|
31
|
+
NO_COPY_BOUND: '✄𐘗'
|
|
32
|
+
};
|
|
33
|
+
// This regex finds all content between two bounds
|
|
34
|
+
var noCopyBoundsRegex = new RegExp("".concat(CHARS.NO_COPY_BOUND, "[^").concat(CHARS.NO_COPY_BOUND, "]*").concat(CHARS.NO_COPY_BOUND), 'gs');
|
|
35
|
+
var hasCharsToReplace = function hasCharsToReplace(text) {
|
|
36
|
+
for (var _i = 0, _Object$values = Object.values(CHARS); _i < _Object$values.length; _i++) {
|
|
37
|
+
var char = _Object$values[_i];
|
|
38
|
+
if (text.indexOf(char) >= 0) return true;
|
|
39
|
+
}
|
|
40
|
+
return false;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// Strip all existing newlines and replace our special hidden characters
|
|
44
|
+
// with the desired spacing needed to paste cleanly into a spreadsheet
|
|
45
|
+
var onTabularCopy = exports.onTabularCopy = function onTabularCopy(event) {
|
|
46
|
+
var _window$getSelection;
|
|
47
|
+
if (!event.clipboardData) return;
|
|
48
|
+
var selectedText = (_window$getSelection = window.getSelection()) === null || _window$getSelection === void 0 ? void 0 : _window$getSelection.toString();
|
|
49
|
+
if (!selectedText || !hasCharsToReplace(selectedText)) return;
|
|
50
|
+
var amendedText = selectedText.split(CHARS.TABULAR_CONTENT_BOUND).map(function (text) {
|
|
51
|
+
return hasCharsToReplace(text) ? text.replace(/\r?\n/g, '') // remove all other newlines generated by content or block display
|
|
52
|
+
.replaceAll(CHARS.NEWLINE, '\n') // insert newline for each table/grid row
|
|
53
|
+
.replace(/\t/g, '') // remove tabs generated by content or automatically by <td> elements
|
|
54
|
+
.replaceAll(CHARS.TAB, "\t") // insert horizontal tab for each table/grid cell
|
|
55
|
+
.replace(noCopyBoundsRegex, '') // remove text that should not be copied (e.g. screen reader instructions)
|
|
56
|
+
: text;
|
|
57
|
+
}).join('');
|
|
58
|
+
event.clipboardData.setData('text/plain', amendedText);
|
|
59
|
+
event.preventDefault();
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* JSX utils for rendering the hidden marker characters
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
var VisuallyHide = function VisuallyHide(_ref) {
|
|
67
|
+
var children = _ref.children,
|
|
68
|
+
_ref$type = _ref.type,
|
|
69
|
+
type = _ref$type === void 0 ? 'true' : _ref$type;
|
|
70
|
+
return (
|
|
71
|
+
// Hides the characters to both sighted user and screen readers
|
|
72
|
+
// Sadly, we can't use `hidden` as that hides the chars from the clipboard as well
|
|
73
|
+
(0, _react2.jsx)("span", {
|
|
74
|
+
className: "euiScreenReaderOnly",
|
|
75
|
+
"aria-hidden": true,
|
|
76
|
+
"data-tabular-copy-marker": type
|
|
77
|
+
}, children)
|
|
78
|
+
);
|
|
79
|
+
};
|
|
80
|
+
var tabularCopyMarkers = exports.tabularCopyMarkers = {
|
|
81
|
+
hiddenTab: (0, _react2.jsx)(VisuallyHide, {
|
|
82
|
+
type: "tab"
|
|
83
|
+
}, CHARS.TAB),
|
|
84
|
+
hiddenNewline: (0, _react2.jsx)(VisuallyHide, {
|
|
85
|
+
type: "newline"
|
|
86
|
+
}, CHARS.NEWLINE),
|
|
87
|
+
hiddenWrapperBoundary: (0, _react2.jsx)(VisuallyHide, {
|
|
88
|
+
type: "boundary"
|
|
89
|
+
}, CHARS.TABULAR_CONTENT_BOUND),
|
|
90
|
+
hiddenNoCopyBoundary: (0, _react2.jsx)(VisuallyHide, {
|
|
91
|
+
type: "no-copy"
|
|
92
|
+
}, CHARS.NO_COPY_BOUND)
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Wrapper setup around table/grid tabular content we want to override/clean up on copy
|
|
97
|
+
*/
|
|
98
|
+
|
|
99
|
+
var OverrideCopiedTabularContent = exports.OverrideCopiedTabularContent = function OverrideCopiedTabularContent(_ref2) {
|
|
100
|
+
var children = _ref2.children;
|
|
101
|
+
(0, _react.useEffect)(function () {
|
|
102
|
+
// Chrome and webkit browsers work perfectly when passing `onTabularCopy` to a React
|
|
103
|
+
// `onCopy` prop, but sadly Firefox does not if copying more than just the table/grid
|
|
104
|
+
// (e.g. Ctrl+A). So we have to set up a global window event listener
|
|
105
|
+
window.document.addEventListener('copy', onTabularCopy);
|
|
106
|
+
// Note: Since onCopy is static, we don't have to worry about duplicate
|
|
107
|
+
// event listeners - it's automatically handled by the browser. See:
|
|
108
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Multiple_identical_event_listeners
|
|
109
|
+
}, []);
|
|
110
|
+
return (0, _react2.jsx)(_react.default.Fragment, null, tabularCopyMarkers.hiddenWrapperBoundary, children, tabularCopyMarkers.hiddenWrapperBoundary);
|
|
111
|
+
};
|
package/lib/services/index.js
CHANGED
|
@@ -59,7 +59,6 @@ var _exportNames = {
|
|
|
59
59
|
wcagContrastMin: true,
|
|
60
60
|
useColorPickerState: true,
|
|
61
61
|
useColorStopsState: true,
|
|
62
|
-
copyToClipboard: true,
|
|
63
62
|
dateFormatAliases: true,
|
|
64
63
|
formatAuto: true,
|
|
65
64
|
formatBoolean: true,
|
|
@@ -207,12 +206,6 @@ Object.defineProperty(exports, "colorPalette", {
|
|
|
207
206
|
return _color.colorPalette;
|
|
208
207
|
}
|
|
209
208
|
});
|
|
210
|
-
Object.defineProperty(exports, "copyToClipboard", {
|
|
211
|
-
enumerable: true,
|
|
212
|
-
get: function get() {
|
|
213
|
-
return _copy_to_clipboard.copyToClipboard;
|
|
214
|
-
}
|
|
215
|
-
});
|
|
216
209
|
Object.defineProperty(exports, "darken", {
|
|
217
210
|
enumerable: true,
|
|
218
211
|
get: function get() {
|
|
@@ -588,7 +581,18 @@ Object.keys(_console).forEach(function (key) {
|
|
|
588
581
|
}
|
|
589
582
|
});
|
|
590
583
|
});
|
|
591
|
-
var
|
|
584
|
+
var _copy = require("./copy");
|
|
585
|
+
Object.keys(_copy).forEach(function (key) {
|
|
586
|
+
if (key === "default" || key === "__esModule") return;
|
|
587
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
588
|
+
if (key in exports && exports[key] === _copy[key]) return;
|
|
589
|
+
Object.defineProperty(exports, key, {
|
|
590
|
+
enumerable: true,
|
|
591
|
+
get: function get() {
|
|
592
|
+
return _copy[key];
|
|
593
|
+
}
|
|
594
|
+
});
|
|
595
|
+
});
|
|
592
596
|
var _emotion = require("./emotion");
|
|
593
597
|
Object.keys(_emotion).forEach(function (key) {
|
|
594
598
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -24,7 +24,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
24
24
|
|
|
25
25
|
import React, { Component, Fragment } from 'react';
|
|
26
26
|
import classNames from 'classnames';
|
|
27
|
-
import { formatAuto, formatBoolean, formatDate, formatNumber, formatText, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, SortDirection, RenderWithEuiTheme } from '../../services';
|
|
27
|
+
import { formatAuto, formatBoolean, formatDate, formatNumber, formatText, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, SortDirection, RenderWithEuiTheme, OverrideCopiedTabularContent, tabularCopyMarkers } from '../../services';
|
|
28
28
|
import { isFunction } from '../../services/predicate';
|
|
29
29
|
import { get } from '../../services/objects';
|
|
30
30
|
import { EuiCheckbox } from '../form';
|
|
@@ -168,6 +168,10 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
168
168
|
});
|
|
169
169
|
});
|
|
170
170
|
});
|
|
171
|
+
_defineProperty(_this, "renderCopyChar", function (columnIndex) {
|
|
172
|
+
var isLastColumn = columnIndex === _this.props.columns.length - 1;
|
|
173
|
+
return isLastColumn ? tabularCopyMarkers.hiddenNewline : tabularCopyMarkers.hiddenTab;
|
|
174
|
+
});
|
|
171
175
|
_defineProperty(_this, "resolveColumnSortDirection", function (column) {
|
|
172
176
|
var sorting = _this.props.sorting;
|
|
173
177
|
var _ref5 = column,
|
|
@@ -368,13 +372,13 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
368
372
|
loading = _this$props3.loading;
|
|
369
373
|
return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(EuiTableHeaderMobile, {
|
|
370
374
|
responsiveBreakpoint: responsiveBreakpoint
|
|
371
|
-
}, this.renderSelectAll(true), this.renderTableMobileSort()), ___EmotionJSX(EuiTable, {
|
|
375
|
+
}, this.renderSelectAll(true), this.renderTableMobileSort()), ___EmotionJSX(OverrideCopiedTabularContent, null, ___EmotionJSX(EuiTable, {
|
|
372
376
|
id: this.tableId,
|
|
373
377
|
tableLayout: tableLayout,
|
|
374
378
|
responsiveBreakpoint: responsiveBreakpoint,
|
|
375
379
|
compressed: compressed,
|
|
376
380
|
css: loading && safariLoadingWorkaround
|
|
377
|
-
}, this.renderTableCaption(), this.renderTableHead(), this.renderTableBody(), this.renderTableFooter()));
|
|
381
|
+
}, this.renderTableCaption(), this.renderTableHead(), this.renderTableBody(), this.renderTableFooter())));
|
|
378
382
|
}
|
|
379
383
|
}, {
|
|
380
384
|
key: "renderTableMobileSort",
|
|
@@ -473,7 +477,7 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
473
477
|
return ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("caption", {
|
|
474
478
|
css: euiTableCaptionStyles,
|
|
475
479
|
className: "euiTableCaption"
|
|
476
|
-
}, ___EmotionJSX(EuiDelayRender, null, captionElement)));
|
|
480
|
+
}, tabularCopyMarkers.hiddenNoCopyBoundary, ___EmotionJSX(EuiDelayRender, null, captionElement), tabularCopyMarkers.hiddenNoCopyBoundary));
|
|
477
481
|
}
|
|
478
482
|
}, {
|
|
479
483
|
key: "renderTableHead",
|
|
@@ -485,7 +489,8 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
485
489
|
var headers = [];
|
|
486
490
|
if (selection) {
|
|
487
491
|
headers.push(___EmotionJSX(EuiTableHeaderCellCheckbox, {
|
|
488
|
-
key: "_selection_column_h"
|
|
492
|
+
key: "_selection_column_h",
|
|
493
|
+
append: this.renderCopyChar(-1)
|
|
489
494
|
}, this.renderSelectAll(false)));
|
|
490
495
|
}
|
|
491
496
|
columns.forEach(function (column, index) {
|
|
@@ -500,16 +505,20 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
500
505
|
readOnly = _ref8.readOnly,
|
|
501
506
|
description = _ref8.description;
|
|
502
507
|
var columnAlign = align || _this3.getAlignForDataType(dataType);
|
|
508
|
+
var sharedProps = {
|
|
509
|
+
width: width,
|
|
510
|
+
description: description,
|
|
511
|
+
mobileOptions: mobileOptions,
|
|
512
|
+
align: columnAlign,
|
|
513
|
+
append: _this3.renderCopyChar(index)
|
|
514
|
+
};
|
|
503
515
|
|
|
504
516
|
// actions column
|
|
505
517
|
if (column.actions) {
|
|
506
|
-
headers.push(___EmotionJSX(EuiTableHeaderCell, {
|
|
518
|
+
headers.push(___EmotionJSX(EuiTableHeaderCell, _extends({}, sharedProps, {
|
|
507
519
|
key: "_actions_h_".concat(index),
|
|
508
|
-
align: "right"
|
|
509
|
-
|
|
510
|
-
description: description,
|
|
511
|
-
mobileOptions: mobileOptions
|
|
512
|
-
}, name));
|
|
520
|
+
align: "right"
|
|
521
|
+
}), name));
|
|
513
522
|
return;
|
|
514
523
|
}
|
|
515
524
|
|
|
@@ -524,13 +533,9 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
524
533
|
_sorting.onSort = _this3.resolveColumnOnSort(column);
|
|
525
534
|
_sorting.readOnly = _this3.props.sorting.readOnly || readOnly;
|
|
526
535
|
}
|
|
527
|
-
headers.push(___EmotionJSX(EuiTableHeaderCell, _extends({
|
|
536
|
+
headers.push(___EmotionJSX(EuiTableHeaderCell, _extends({}, sharedProps, {
|
|
528
537
|
key: "_computed_column_h_".concat(index),
|
|
529
|
-
|
|
530
|
-
width: width,
|
|
531
|
-
mobileOptions: mobileOptions,
|
|
532
|
-
"data-test-subj": "tableHeaderCell_".concat(typeof name === 'string' ? name : '', "_").concat(index),
|
|
533
|
-
description: description
|
|
538
|
+
"data-test-subj": "tableHeaderCell_".concat(typeof name === 'string' ? name : '', "_").concat(index)
|
|
534
539
|
}, _sorting), name));
|
|
535
540
|
return;
|
|
536
541
|
}
|
|
@@ -553,13 +558,9 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
553
558
|
sorting.readOnly = _this3.props.sorting.readOnly || readOnly;
|
|
554
559
|
}
|
|
555
560
|
}
|
|
556
|
-
headers.push(___EmotionJSX(EuiTableHeaderCell, _extends({
|
|
561
|
+
headers.push(___EmotionJSX(EuiTableHeaderCell, _extends({}, sharedProps, {
|
|
557
562
|
key: "_data_h_".concat(String(field), "_").concat(index),
|
|
558
|
-
|
|
559
|
-
width: width,
|
|
560
|
-
mobileOptions: mobileOptions,
|
|
561
|
-
"data-test-subj": "tableHeaderCell_".concat(String(field), "_").concat(index),
|
|
562
|
-
description: description
|
|
563
|
+
"data-test-subj": "tableHeaderCell_".concat(String(field), "_").concat(index)
|
|
563
564
|
}, sorting), name));
|
|
564
565
|
});
|
|
565
566
|
return ___EmotionJSX(EuiTableHeader, null, headers);
|
|
@@ -725,7 +726,8 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
725
726
|
hasSelection: !!selection
|
|
726
727
|
}, ___EmotionJSX(EuiTableRowCell, {
|
|
727
728
|
colSpan: expandedRowColSpan,
|
|
728
|
-
textOnly: false
|
|
729
|
+
textOnly: false,
|
|
730
|
+
append: tabularCopyMarkers.hiddenNewline
|
|
729
731
|
}, itemIdToExpandedRowMap[itemId])) : undefined;
|
|
730
732
|
var rowPropsCallback = this.props.rowProps;
|
|
731
733
|
var rowProps = getRowProps(item, rowPropsCallback);
|
|
@@ -764,7 +766,8 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
764
766
|
}
|
|
765
767
|
};
|
|
766
768
|
return [___EmotionJSX(EuiTableRowCellCheckbox, {
|
|
767
|
-
key: key
|
|
769
|
+
key: key,
|
|
770
|
+
append: this.renderCopyChar(-1)
|
|
768
771
|
}, ___EmotionJSX(EuiI18n, {
|
|
769
772
|
token: "euiBasicTable.selectThisRow",
|
|
770
773
|
default: "Select row {index}",
|
|
@@ -833,7 +836,8 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
833
836
|
key: key,
|
|
834
837
|
align: "right",
|
|
835
838
|
textOnly: false,
|
|
836
|
-
hasActions: hasCustomActions ? 'custom' : true
|
|
839
|
+
hasActions: hasCustomActions ? 'custom' : true,
|
|
840
|
+
append: this.renderCopyChar(columnIndex)
|
|
837
841
|
}, ___EmotionJSX(ExpandedItemActions, {
|
|
838
842
|
actions: actualActions,
|
|
839
843
|
actionsDisabled: allDisabled,
|
|
@@ -851,7 +855,7 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
851
855
|
var contentRenderer = render || this.getRendererForDataType(dataType);
|
|
852
856
|
var value = get(item, field);
|
|
853
857
|
var content = contentRenderer(value, item);
|
|
854
|
-
return this.renderItemCell(item, column, key, content, setScopeRow);
|
|
858
|
+
return this.renderItemCell(item, column, columnIndex, key, content, setScopeRow);
|
|
855
859
|
}
|
|
856
860
|
}, {
|
|
857
861
|
key: "renderItemComputedCell",
|
|
@@ -860,11 +864,12 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
860
864
|
var key = "_computed_column_".concat(itemId, "_").concat(columnIndex);
|
|
861
865
|
var contentRenderer = render || this.getRendererForDataType();
|
|
862
866
|
var content = contentRenderer(item);
|
|
863
|
-
return this.renderItemCell(item, column, key, content, false);
|
|
867
|
+
return this.renderItemCell(item, column, columnIndex, key, content, false);
|
|
864
868
|
}
|
|
865
869
|
}, {
|
|
866
870
|
key: "renderItemCell",
|
|
867
|
-
value: function renderItemCell(item, column, key, content, setScopeRow) {
|
|
871
|
+
value: function renderItemCell(item, column, columnIndex, key, content, setScopeRow) {
|
|
872
|
+
var _mobileOptions$render, _mobileOptions$header;
|
|
868
873
|
var _ref11 = column,
|
|
869
874
|
align = _ref11.align,
|
|
870
875
|
render = _ref11.render,
|
|
@@ -888,10 +893,12 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
888
893
|
textOnly: textOnly || !render,
|
|
889
894
|
setScopeRow: setScopeRow,
|
|
890
895
|
mobileOptions: _objectSpread(_objectSpread({}, mobileOptions), {}, {
|
|
891
|
-
render: mobileOptions
|
|
892
|
-
header: mobileOptions
|
|
896
|
+
render: mobileOptions === null || mobileOptions === void 0 || (_mobileOptions$render = mobileOptions.render) === null || _mobileOptions$render === void 0 ? void 0 : _mobileOptions$render.call(mobileOptions, item),
|
|
897
|
+
header: (_mobileOptions$header = mobileOptions === null || mobileOptions === void 0 ? void 0 : mobileOptions.header) !== null && _mobileOptions$header !== void 0 ? _mobileOptions$header : name
|
|
893
898
|
})
|
|
894
|
-
}, cellProps, rest
|
|
899
|
+
}, cellProps, rest, {
|
|
900
|
+
append: this.renderCopyChar(columnIndex)
|
|
901
|
+
}), content);
|
|
895
902
|
}
|
|
896
903
|
}, {
|
|
897
904
|
key: "getRendererForDataType",
|
|
@@ -27,7 +27,7 @@ import classNames from 'classnames';
|
|
|
27
27
|
import React, { Component, createRef, memo, useMemo, forwardRef } from 'react';
|
|
28
28
|
import { createPortal } from 'react-dom';
|
|
29
29
|
import { IS_JEST_ENVIRONMENT } from '../../../../utils';
|
|
30
|
-
import { keys, useEuiMemoizedStyles } from '../../../../services';
|
|
30
|
+
import { keys, tabularCopyMarkers, useEuiMemoizedStyles } from '../../../../services';
|
|
31
31
|
import { EuiScreenReaderOnly } from '../../../accessibility';
|
|
32
32
|
import { useEuiI18n } from '../../../i18n';
|
|
33
33
|
import { EuiTextBlockTruncate } from '../../../text_truncate';
|
|
@@ -61,10 +61,7 @@ var EuiDataGridCellContent = /*#__PURE__*/memo(function (_ref) {
|
|
|
61
61
|
});
|
|
62
62
|
}, [cellHeightType, isControlColumn]);
|
|
63
63
|
var styles = useEuiMemoizedStyles(euiDataGridRowCellStyles);
|
|
64
|
-
var cssStyles = [styles.content.euiDataGridRowCell__content].concat(_toConsumableArray(isControlColumn ? [
|
|
65
|
-
// Control column cells should not be vertically centered (defaultHeight) except
|
|
66
|
-
// on single rows. They should be top-aligned for auto and lineCount heights
|
|
67
|
-
styles.content.controlColumn, cellHeightType === 'default' ? styles.content.defaultHeight : styles.content.autoHeight] : [
|
|
64
|
+
var cssStyles = [styles.content.euiDataGridRowCell__content].concat(_toConsumableArray(isControlColumn ? [styles.content.controlColumn, styles.content.autoHeight] : [
|
|
68
65
|
// Regular data cells should always inherit height from the row wrapper,
|
|
69
66
|
// except for auto height
|
|
70
67
|
cellHeightType === 'auto' ? styles.content.autoHeight : styles.content.defaultHeight]));
|
|
@@ -142,7 +139,7 @@ export var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
142
139
|
var lineCount = isSingleLine ? 1 : rowHeightUtils === null || rowHeightUtils === void 0 ? void 0 : rowHeightUtils.getLineCount(rowHeightOption);
|
|
143
140
|
if (lineCount) {
|
|
144
141
|
var shouldUseHeightsCache = rowHeightUtils === null || rowHeightUtils === void 0 ? void 0 : rowHeightUtils.isRowHeightOverride(rowIndex, rowHeightsOptions);
|
|
145
|
-
var height = rowHeightUtils.calculateHeightForLineCount(_this.cellContentsRef, lineCount
|
|
142
|
+
var height = rowHeightUtils.calculateHeightForLineCount(_this.cellContentsRef, lineCount);
|
|
146
143
|
if (shouldUseHeightsCache) {
|
|
147
144
|
var _this$props4 = _this.props,
|
|
148
145
|
columnId = _this$props4.columnId,
|
|
@@ -334,12 +331,12 @@ export var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
334
331
|
}, {
|
|
335
332
|
key: "componentDidUpdate",
|
|
336
333
|
value: function componentDidUpdate(prevProps) {
|
|
337
|
-
var _this$props$rowHeight, _prevProps$rowHeights, _this$props$rowHeight2, _this$props$rowHeight3, _this$props$style, _prevProps$style;
|
|
334
|
+
var _this$props$rowHeight, _prevProps$rowHeights, _this$props$rowHeight2, _prevProps$rowHeights2, _this$props$rowHeight3, _prevProps$rowHeights3, _this$props$gridStyle, _prevProps$gridStyles, _this$props$gridStyle2, _prevProps$gridStyles2, _this$props$rowHeight4, _this$props$rowHeight5, _this$props$style, _prevProps$style;
|
|
338
335
|
this.recalculateAutoHeight();
|
|
339
|
-
if (((_this$props$rowHeight = this.props.rowHeightsOptions) === null || _this$props$rowHeight === void 0 ? void 0 : _this$props$rowHeight.defaultHeight) !== ((_prevProps$rowHeights = prevProps.rowHeightsOptions) === null || _prevProps$rowHeights === void 0 ? void 0 : _prevProps$rowHeights.defaultHeight)) {
|
|
336
|
+
if (((_this$props$rowHeight = this.props.rowHeightsOptions) === null || _this$props$rowHeight === void 0 ? void 0 : _this$props$rowHeight.defaultHeight) !== ((_prevProps$rowHeights = prevProps.rowHeightsOptions) === null || _prevProps$rowHeights === void 0 ? void 0 : _prevProps$rowHeights.defaultHeight) || ((_this$props$rowHeight2 = this.props.rowHeightsOptions) === null || _this$props$rowHeight2 === void 0 || (_this$props$rowHeight2 = _this$props$rowHeight2.rowHeights) === null || _this$props$rowHeight2 === void 0 ? void 0 : _this$props$rowHeight2[this.props.rowIndex]) !== ((_prevProps$rowHeights2 = prevProps.rowHeightsOptions) === null || _prevProps$rowHeights2 === void 0 || (_prevProps$rowHeights2 = _prevProps$rowHeights2.rowHeights) === null || _prevProps$rowHeights2 === void 0 ? void 0 : _prevProps$rowHeights2[prevProps.rowIndex]) || ((_this$props$rowHeight3 = this.props.rowHeightsOptions) === null || _this$props$rowHeight3 === void 0 ? void 0 : _this$props$rowHeight3.lineHeight) !== ((_prevProps$rowHeights3 = prevProps.rowHeightsOptions) === null || _prevProps$rowHeights3 === void 0 ? void 0 : _prevProps$rowHeights3.lineHeight) || ((_this$props$gridStyle = this.props.gridStyles) === null || _this$props$gridStyle === void 0 ? void 0 : _this$props$gridStyle.fontSize) !== ((_prevProps$gridStyles = prevProps.gridStyles) === null || _prevProps$gridStyles === void 0 ? void 0 : _prevProps$gridStyles.fontSize) || ((_this$props$gridStyle2 = this.props.gridStyles) === null || _this$props$gridStyle2 === void 0 ? void 0 : _this$props$gridStyle2.cellPadding) !== ((_prevProps$gridStyles2 = prevProps.gridStyles) === null || _prevProps$gridStyles2 === void 0 ? void 0 : _prevProps$gridStyles2.cellPadding)) {
|
|
340
337
|
this.recalculateLineHeight();
|
|
341
338
|
}
|
|
342
|
-
if ((_this$props$
|
|
339
|
+
if ((_this$props$rowHeight4 = this.props.rowHeightUtils) !== null && _this$props$rowHeight4 !== void 0 && _this$props$rowHeight4.compensateForLayoutShift && (_this$props$rowHeight5 = this.props.rowHeightsOptions) !== null && _this$props$rowHeight5 !== void 0 && _this$props$rowHeight5.scrollAnchorRow && this.props.colIndex === 0 &&
|
|
343
340
|
// once per row
|
|
344
341
|
this.props.columnId === prevProps.columnId &&
|
|
345
342
|
// if this is still the same column
|
|
@@ -347,12 +344,12 @@ export var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
347
344
|
// if this is still the same row
|
|
348
345
|
((_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
|
|
349
346
|
) {
|
|
350
|
-
var _prevProps$style2, _this$props$style2, _this$props$
|
|
347
|
+
var _prevProps$style2, _this$props$style2, _this$props$rowHeight6;
|
|
351
348
|
var previousTop = parseFloat((_prevProps$style2 = prevProps.style) === null || _prevProps$style2 === void 0 ? void 0 : _prevProps$style2.top);
|
|
352
349
|
var currentTop = parseFloat((_this$props$style2 = this.props.style) === null || _this$props$style2 === void 0 ? void 0 : _this$props$style2.top);
|
|
353
350
|
|
|
354
351
|
// @ts-ignore We've already checked that this virtualization util is available above
|
|
355
|
-
this.props.rowHeightUtils.compensateForLayoutShift(this.props.rowIndex, currentTop - previousTop, (_this$props$
|
|
352
|
+
this.props.rowHeightUtils.compensateForLayoutShift(this.props.rowIndex, currentTop - previousTop, (_this$props$rowHeight6 = this.props.rowHeightsOptions) === null || _this$props$rowHeight6 === void 0 ? void 0 : _this$props$rowHeight6.scrollAnchorRow);
|
|
356
353
|
}
|
|
357
354
|
if (this.props.popoverContext.popoverIsOpen !== prevProps.popoverContext.popoverIsOpen || this.props.popoverContext.cellLocation !== prevProps.popoverContext.cellLocation || this.props.renderCellPopover !== prevProps.renderCellPopover) {
|
|
358
355
|
this.handleCellPopover();
|
|
@@ -364,6 +361,7 @@ export var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
364
361
|
}, {
|
|
365
362
|
key: "shouldComponentUpdate",
|
|
366
363
|
value: function shouldComponentUpdate(nextProps, nextState) {
|
|
364
|
+
var _nextProps$gridStyles, _this$props$gridStyle3, _nextProps$gridStyles2, _this$props$gridStyle4;
|
|
367
365
|
if (nextProps.rowIndex !== this.props.rowIndex) return true;
|
|
368
366
|
if (nextProps.visibleRowIndex !== this.props.visibleRowIndex) return true;
|
|
369
367
|
if (nextProps.colIndex !== this.props.colIndex) return true;
|
|
@@ -371,6 +369,8 @@ export var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
371
369
|
if (nextProps.columnType !== this.props.columnType) return true;
|
|
372
370
|
if (nextProps.width !== this.props.width) return true;
|
|
373
371
|
if (nextProps.rowHeightsOptions !== this.props.rowHeightsOptions) return true;
|
|
372
|
+
if (((_nextProps$gridStyles = nextProps.gridStyles) === null || _nextProps$gridStyles === void 0 ? void 0 : _nextProps$gridStyles.fontSize) !== ((_this$props$gridStyle3 = this.props.gridStyles) === null || _this$props$gridStyle3 === void 0 ? void 0 : _this$props$gridStyle3.fontSize)) return true;
|
|
373
|
+
if (((_nextProps$gridStyles2 = nextProps.gridStyles) === null || _nextProps$gridStyles2 === void 0 ? void 0 : _nextProps$gridStyles2.cellPadding) !== ((_this$props$gridStyle4 = this.props.gridStyles) === null || _this$props$gridStyle4 === void 0 ? void 0 : _this$props$gridStyle4.cellPadding)) return true;
|
|
374
374
|
if (nextProps.renderCellValue !== this.props.renderCellValue) return true;
|
|
375
375
|
if (nextProps.renderCellPopover !== this.props.renderCellPopover) return true;
|
|
376
376
|
if (nextProps.interactiveCellId !== this.props.interactiveCellId) return true;
|
|
@@ -416,6 +416,10 @@ export var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
416
416
|
var popoverIsOpen = this.isPopoverOpen();
|
|
417
417
|
var showCellActions = isExpandable && (popoverIsOpen || this.state.isFocused || this.state.isHovered);
|
|
418
418
|
var cellClasses = classNames('euiDataGridRowCell', _defineProperty(_defineProperty({}, "euiDataGridRowCell--".concat(columnType), columnType), 'euiDataGridRowCell--open', popoverIsOpen), className);
|
|
419
|
+
|
|
420
|
+
// classNames set by EuiDataGridCellWrapper
|
|
421
|
+
var isControlColumn = cellClasses.includes('euiDataGridRowCell--controlColumn');
|
|
422
|
+
var isLastColumn = cellClasses.includes('euiDataGridRowCell--lastColumn');
|
|
419
423
|
var ariaRowIndex = pagination ? visibleRowIndex + 1 + pagination.pageSize * pagination.pageIndex : visibleRowIndex + 1;
|
|
420
424
|
var _this$state$cellProps2 = this.state.cellProps,
|
|
421
425
|
_ = _this$state$cellProps2.isExpandable,
|
|
@@ -469,10 +473,10 @@ export var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
469
473
|
setCellContentsRef: this.setCellContentsRef,
|
|
470
474
|
rowHeight: rowHeight,
|
|
471
475
|
rowHeightUtils: rowHeightUtils,
|
|
472
|
-
isControlColumn:
|
|
476
|
+
isControlColumn: isControlColumn,
|
|
473
477
|
rowIndex: rowIndex,
|
|
474
478
|
colIndex: colIndex
|
|
475
|
-
}))), this.state.isFocused && ___EmotionJSX(CellScreenReaderDescription, {
|
|
479
|
+
}))), isLastColumn ? tabularCopyMarkers.hiddenNewline : tabularCopyMarkers.hiddenTab, this.state.isFocused && ___EmotionJSX(CellScreenReaderDescription, {
|
|
476
480
|
columnName: (column === null || column === void 0 ? void 0 : column.displayAsText) || this.props.columnId,
|
|
477
481
|
columnIndex: colIndex + 1,
|
|
478
482
|
rowIndex: ariaRowIndex,
|
|
@@ -551,6 +555,6 @@ var CellScreenReaderDescription = /*#__PURE__*/memo(function (_ref5) {
|
|
|
551
555
|
rowIndex: rowIndex
|
|
552
556
|
});
|
|
553
557
|
var enterKeyPrompt = useEuiI18n('euiDataGridCell.expansionEnterPrompt', 'Press the Enter key to expand this cell.');
|
|
554
|
-
return ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("p", null, " - ".concat(cellPosition).concat(canExpandCell ? ". ".concat(enterKeyPrompt) : '')));
|
|
558
|
+
return ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("p", null, tabularCopyMarkers.hiddenNoCopyBoundary, " - ".concat(cellPosition).concat(canExpandCell ? ". ".concat(enterKeyPrompt) : ''), tabularCopyMarkers.hiddenNoCopyBoundary));
|
|
555
559
|
});
|
|
556
560
|
CellScreenReaderDescription.displayName = 'CellScreenReaderDescription';
|
|
@@ -92,6 +92,7 @@ var _ref = process.env.NODE_ENV === "production" ? {
|
|
|
92
92
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
93
93
|
};
|
|
94
94
|
export var euiDataGridRowCellStyles = function euiDataGridRowCellStyles(euiThemeContext) {
|
|
95
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
95
96
|
var cellOutline = euiDataGridCellOutlineStyles(euiThemeContext);
|
|
96
97
|
var _euiDataGridCellOutli = euiDataGridCellOutlineSelectors(),
|
|
97
98
|
outlineSelectors = _euiDataGridCellOutli.outline;
|
|
@@ -99,9 +100,11 @@ export var euiDataGridRowCellStyles = function euiDataGridRowCellStyles(euiTheme
|
|
|
99
100
|
euiDataGridRowCell: /*#__PURE__*/css("position:relative;", outlineSelectors.show, "{", cellOutline.focusStyles, ";}", outlineSelectors.hover, "{", cellOutline.hoverStyles, ";}", outlineSelectors.focusTrapped, "{", cellOutline.hoverStyles, ";}&>[data-focus-lock-disabled]{", logicalCSS('height', '100%'), ";}&:where(.euiDataGridRowCell--numeric, .euiDataGridRowCell--currency){", logicalTextAlignCSS('right'), ";}&:where(.euiDataGridRowCell--uppercase){text-transform:uppercase;}&:where(.euiDataGridRowCell--lowercase){text-transform:lowercase;}&:where(.euiDataGridRowCell--capitalize){text-transform:capitalize;};label:euiDataGridRowCell;"),
|
|
100
101
|
content: {
|
|
101
102
|
euiDataGridRowCell__content: _ref,
|
|
102
|
-
controlColumn: /*#__PURE__*/css(logicalCSS('max-height', '100%'), " display:flex;align-items:center;;label:controlColumn;"),
|
|
103
103
|
autoHeight: /*#__PURE__*/css(logicalCSS('height', 'auto'), ";;label:autoHeight;"),
|
|
104
|
-
defaultHeight: /*#__PURE__*/css(logicalCSS('height', '100%'), ";;label:defaultHeight;")
|
|
104
|
+
defaultHeight: /*#__PURE__*/css(logicalCSS('height', '100%'), ";;label:defaultHeight;"),
|
|
105
|
+
// Control columns should be vertically centered with the *first line* of text
|
|
106
|
+
// for both single and multi-line heights (see https://github.com/elastic/eui/issues/7897)
|
|
107
|
+
controlColumn: /*#__PURE__*/css("display:inline-flex;align-items:start;gap:", euiTheme.size.xxs, ";vertical-align:-webkit-baseline-middle;vertical-align:-moz-middle-with-baseline;.euiDataGrid--fontSizeSmall &:where(.euiDataGridRowCell__content--defaultHeight){", logicalCSS('height', '100%'), " align-items:center;}.euiCheckbox:not(:has(label)){display:inline;.euiCheckbox__square{display:inline-flex;vertical-align:text-bottom;@supports (vertical-align: -moz-middle-with-baseline){vertical-align:sub;}}};label:controlColumn;")
|
|
105
108
|
}
|
|
106
109
|
};
|
|
107
110
|
};
|
|
@@ -89,6 +89,7 @@ export var EuiDataGridBodyCustomRender = function EuiDataGridBodyCustomRender(_r
|
|
|
89
89
|
columnWidths: columnWidths,
|
|
90
90
|
defaultColumnWidth: defaultColumnWidth,
|
|
91
91
|
setColumnWidth: setColumnWidth,
|
|
92
|
+
visibleColCount: visibleColCount,
|
|
92
93
|
setVisibleColumns: setVisibleColumns,
|
|
93
94
|
switchColumnPos: switchColumnPos,
|
|
94
95
|
sorting: sorting,
|
|
@@ -102,6 +103,7 @@ export var EuiDataGridBodyCustomRender = function EuiDataGridBodyCustomRender(_r
|
|
|
102
103
|
renderCellPopover: renderCellPopover,
|
|
103
104
|
rowIndex: visibleRows.visibleRowCount,
|
|
104
105
|
visibleRowIndex: visibleRows.visibleRowCount,
|
|
106
|
+
visibleColCount: visibleColCount,
|
|
105
107
|
interactiveCellId: interactiveCellId,
|
|
106
108
|
leadingControlColumns: leadingControlColumns,
|
|
107
109
|
trailingControlColumns: trailingControlColumns,
|
|
@@ -133,9 +135,10 @@ export var EuiDataGridBodyCustomRender = function EuiDataGridBodyCustomRender(_r
|
|
|
133
135
|
interactiveCellId: interactiveCellId,
|
|
134
136
|
setRowHeight: setRowHeight,
|
|
135
137
|
rowHeightsOptions: rowHeightsOptions,
|
|
136
|
-
rowHeightUtils: rowHeightUtils
|
|
138
|
+
rowHeightUtils: rowHeightUtils,
|
|
139
|
+
gridStyles: gridStyles
|
|
137
140
|
};
|
|
138
|
-
}, [schema, schemaDetectors, pagination, columns, leadingControlColumns, trailingControlColumns, visibleColCount, columnWidths, defaultColumnWidth, renderCellValue, cellContext, renderCellPopover, interactiveCellId, setRowHeight, rowHeightsOptions, rowHeightUtils]);
|
|
141
|
+
}, [schema, schemaDetectors, pagination, columns, leadingControlColumns, trailingControlColumns, visibleColCount, columnWidths, defaultColumnWidth, renderCellValue, cellContext, renderCellPopover, interactiveCellId, setRowHeight, rowHeightsOptions, rowHeightUtils, gridStyles]);
|
|
139
142
|
var Cell = useCallback(function (_ref2) {
|
|
140
143
|
var colIndex = _ref2.colIndex,
|
|
141
144
|
visibleRowIndex = _ref2.visibleRowIndex,
|
|
@@ -149,6 +149,7 @@ export var EuiDataGridBodyVirtualized = /*#__PURE__*/memo(function (_ref3) {
|
|
|
149
149
|
columnWidths: columnWidths,
|
|
150
150
|
defaultColumnWidth: defaultColumnWidth,
|
|
151
151
|
setColumnWidth: setColumnWidth,
|
|
152
|
+
visibleColCount: visibleColCount,
|
|
152
153
|
setVisibleColumns: setVisibleColumns,
|
|
153
154
|
switchColumnPos: switchColumnPos,
|
|
154
155
|
sorting: sorting,
|
|
@@ -163,6 +164,7 @@ export var EuiDataGridBodyVirtualized = /*#__PURE__*/memo(function (_ref3) {
|
|
|
163
164
|
renderCellPopover: renderCellPopover,
|
|
164
165
|
rowIndex: visibleRowCount,
|
|
165
166
|
visibleRowIndex: visibleRowCount,
|
|
167
|
+
visibleColCount: visibleColCount,
|
|
166
168
|
interactiveCellId: interactiveCellId,
|
|
167
169
|
leadingControlColumns: leadingControlColumns,
|
|
168
170
|
trailingControlColumns: trailingControlColumns,
|
|
@@ -285,9 +287,10 @@ export var EuiDataGridBodyVirtualized = /*#__PURE__*/memo(function (_ref3) {
|
|
|
285
287
|
rowHeightUtils: rowHeightUtils,
|
|
286
288
|
rowManager: rowManager,
|
|
287
289
|
pagination: pagination,
|
|
288
|
-
headerRowHeight: headerRowHeight
|
|
290
|
+
headerRowHeight: headerRowHeight,
|
|
291
|
+
gridStyles: gridStyles
|
|
289
292
|
};
|
|
290
|
-
}, [schemaDetectors, setRowHeight, leadingControlColumns, trailingControlColumns, columns, visibleColCount, schema, columnWidths, defaultColumnWidth, renderCellValue, cellContext, renderCellPopover, interactiveCellId, rowHeightsOptions, rowHeightUtils, rowManager, pagination, headerRowHeight]);
|
|
293
|
+
}, [schemaDetectors, setRowHeight, leadingControlColumns, trailingControlColumns, columns, visibleColCount, schema, columnWidths, defaultColumnWidth, renderCellValue, cellContext, renderCellPopover, interactiveCellId, rowHeightsOptions, rowHeightUtils, rowManager, pagination, headerRowHeight, gridStyles]);
|
|
291
294
|
var rowWrapperContextValue = useMemo(function () {
|
|
292
295
|
return {
|
|
293
296
|
headerRowHeight: headerRowHeight,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["leadingControlColumns", "trailingControlColumns", "columns", "schema", "columnWidths", "defaultColumnWidth", "className", "renderCellValue", "renderCellPopover", "rowIndex", "interactiveCellId", "data-test-subj", "visibleRowIndex", "gridStyles"];
|
|
3
|
+
var _excluded = ["leadingControlColumns", "trailingControlColumns", "columns", "schema", "columnWidths", "defaultColumnWidth", "className", "renderCellValue", "renderCellPopover", "rowIndex", "interactiveCellId", "data-test-subj", "visibleRowIndex", "visibleColCount", "gridStyles"];
|
|
4
4
|
/*
|
|
5
5
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
6
6
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -9,8 +9,8 @@ var _excluded = ["leadingControlColumns", "trailingControlColumns", "columns", "
|
|
|
9
9
|
* Side Public License, v 1.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import React, { forwardRef, memo, useContext } from 'react';
|
|
13
|
-
import
|
|
12
|
+
import React, { forwardRef, memo, useCallback, useContext } from 'react';
|
|
13
|
+
import classNames from 'classnames';
|
|
14
14
|
import { useEuiMemoizedStyles } from '../../../../services';
|
|
15
15
|
import { EuiDataGridCell, DataGridCellPopoverContext } from '../cell';
|
|
16
16
|
import { euiDataGridFooterStyles } from './data_grid_footer.styles';
|
|
@@ -33,19 +33,27 @@ var EuiDataGridFooterRow = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (
|
|
|
33
33
|
_dataTestSubj = _ref['data-test-subj'],
|
|
34
34
|
_ref$visibleRowIndex = _ref.visibleRowIndex,
|
|
35
35
|
visibleRowIndex = _ref$visibleRowIndex === void 0 ? rowIndex : _ref$visibleRowIndex,
|
|
36
|
+
visibleColCount = _ref.visibleColCount,
|
|
36
37
|
gridStyles = _ref.gridStyles,
|
|
37
38
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
38
39
|
var styles = useEuiMemoizedStyles(euiDataGridFooterStyles);
|
|
39
40
|
var cssStyles = [styles.euiDataGridFooter, gridStyles.stickyFooter && styles.sticky, gridStyles.footer === 'striped' ? visibleRowIndex % 2 !== 0 && styles.striped : styles[gridStyles.footer]];
|
|
40
|
-
var classes =
|
|
41
|
-
var dataTestSubj =
|
|
41
|
+
var classes = classNames('euiDataGridFooter', className);
|
|
42
|
+
var dataTestSubj = classNames('dataGridRow', 'dataGridFooterRow', _dataTestSubj);
|
|
43
|
+
var getCellClasses = useCallback(function (columnIndex, classes) {
|
|
44
|
+
return classNames('euiDataGridFooterCell', {
|
|
45
|
+
'euiDataGridRowCell--firstColumn': columnIndex === 0,
|
|
46
|
+
'euiDataGridRowCell--lastColumn': columnIndex === visibleColCount - 1
|
|
47
|
+
}, classes);
|
|
48
|
+
}, [visibleColCount]);
|
|
42
49
|
var popoverContext = useContext(DataGridCellPopoverContext);
|
|
43
50
|
var sharedCellProps = {
|
|
44
51
|
css: styles.euiDataGridFooterCell,
|
|
45
52
|
rowIndex: rowIndex,
|
|
46
53
|
visibleRowIndex: visibleRowIndex,
|
|
47
54
|
interactiveCellId: interactiveCellId,
|
|
48
|
-
popoverContext: popoverContext
|
|
55
|
+
popoverContext: popoverContext,
|
|
56
|
+
gridStyles: gridStyles
|
|
49
57
|
};
|
|
50
58
|
return ___EmotionJSX("div", _extends({
|
|
51
59
|
ref: ref,
|
|
@@ -65,7 +73,7 @@ var EuiDataGridFooterRow = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (
|
|
|
65
73
|
width: width,
|
|
66
74
|
renderCellValue: footerCellRender !== null && footerCellRender !== void 0 ? footerCellRender : renderEmpty,
|
|
67
75
|
isExpandable: false,
|
|
68
|
-
className:
|
|
76
|
+
className: getCellClasses(i, classNames('euiDataGridRowCell--controlColumn', footerCellProps === null || footerCellProps === void 0 ? void 0 : footerCellProps.className))
|
|
69
77
|
}));
|
|
70
78
|
}), columns.map(function (_ref3, i) {
|
|
71
79
|
var id = _ref3.id;
|
|
@@ -82,7 +90,7 @@ var EuiDataGridFooterRow = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (
|
|
|
82
90
|
renderCellValue: renderCellValue,
|
|
83
91
|
renderCellPopover: renderCellPopover,
|
|
84
92
|
isExpandable: true,
|
|
85
|
-
className:
|
|
93
|
+
className: getCellClasses(columnPosition)
|
|
86
94
|
}));
|
|
87
95
|
}), trailingControlColumns.map(function (_ref4, i) {
|
|
88
96
|
var id = _ref4.id,
|
|
@@ -97,7 +105,7 @@ var EuiDataGridFooterRow = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (
|
|
|
97
105
|
width: width,
|
|
98
106
|
renderCellValue: footerCellRender !== null && footerCellRender !== void 0 ? footerCellRender : renderEmpty,
|
|
99
107
|
isExpandable: false,
|
|
100
|
-
className:
|
|
108
|
+
className: getCellClasses(colIndex, classNames('euiDataGridRowCell--controlColumn', footerCellProps === null || footerCellProps === void 0 ? void 0 : footerCellProps.className))
|
|
101
109
|
}));
|
|
102
110
|
}));
|
|
103
111
|
}));
|