@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
package/README.md
CHANGED
|
@@ -1,69 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
# Elastic UI Framework
|
|
4
|
-
|
|
5
|
-
**The Elastic UI Framework is a collection of React UI components for quickly building user interfaces at Elastic.**
|
|
6
|
-
|
|
7
|
-
Check out our [full documentation site][docs] which contains many examples of components in the EUI framework aesthetic, and how to use them in your products. Our FAQ below covers common usage questions — for other general questions regarding EUI, check out the [Discussions tab](https://github.com/elastic/eui/discussions).
|
|
8
|
-
|
|
9
|
-
> [!NOTE]
|
|
10
|
-
> We're in the process of migrating this repository to a monorepo structure. You can find `@elastic/eui` files in the [packages/eui](https://github.com/elastic/eui/tree/main/packages/eui) directory.
|
|
11
|
-
|
|
12
|
-
## Frequently Asked Questions
|
|
13
|
-
|
|
14
|
-
### What is the Elastic UI Framework?
|
|
15
|
-
|
|
16
|
-
The Elastic UI Framework (EUI) is a design library in use at Elastic to build React applications that need to share our branding and aesthetics. It distributes typed UI React components and static assets for use in building web layouts. Alongside the React components, we ship theme & style utilities that can be used independently on their own.
|
|
17
|
-
|
|
18
|
-
The primary goal of this library is to provide reusable UI components that can be used throughout Elastic's web products. As React components, they remove CSS from the process of building UIs. As a single source of truth, the framework allows our designers to make changes to our aesthetic directly in the code. And unit test coverage for the UI components allows us to deliver a stable "API for user interfaces".
|
|
19
|
-
|
|
20
|
-
### Can I use EUI?
|
|
21
|
-
|
|
22
|
-
Please see Elastic's licensing FAQ: [I’m using EUI or Elastic Charts in my application outside of Kibana, how does this affect me?][licensing-faq]
|
|
23
|
-
|
|
24
|
-
### Why is EUI open source?
|
|
25
|
-
|
|
26
|
-
Many of Elastic's products are open source and rely upon this library to function. The Elastic UI Framework began as a folder of code in Kibana and we decided it could be used beyond that codebase. It exists as an independent library so that patterns can be shared across teams and design standards can be scaled across our organization. Since most of our products are open source, we treat this one similarly as far as public publishing and conversation even if its usage tends to focus more inward towards Elastic itself.
|
|
27
|
-
|
|
28
|
-
### What is the versioning, release, and upgrade strategy?
|
|
29
|
-
|
|
30
|
-
We use [semver](https://semver.org/) for versioning and use that to denote breaking changes in EUI upgrades. Traditionally we consider API changes in our prop names or existing component functionality to be a reason for a breaking change, but do not track the renaming of CSS selectors, mixins or other style changes under this same rigor.
|
|
31
|
-
|
|
32
|
-
Traditionally releases are made weekly against whatever is in the `main` branch and you can upgrade from NPM as you see fit.
|
|
33
|
-
|
|
34
|
-
### Can I contribute to EUI?
|
|
35
|
-
|
|
36
|
-
Yes! We welcome community-contributed PRs, especially around feature requests that the EUI team may not have bandwidth to carry out alone. You can find documentation around creating and submitting new components in [our wiki](wiki/contributing-to-eui/).
|
|
37
|
-
|
|
38
|
-
### What about reporting bugs and feature requests?
|
|
39
|
-
|
|
40
|
-
Bug reports and feature requests are most welcome, but our roadmap and prioritization are driven primarily by [internal Elastic usage](wiki/contributing-to-eui#how-we-assign-work-and-define-our-roadmap).
|
|
41
|
-
|
|
42
|
-
Please note that in order to keep our backlog manageable and focused on tasks we intend to complete, feature requests & tech debt issues that are inactive for a year will be auto-closed (bugs will remain open if determined to be reproducible and valid).
|
|
43
|
-
|
|
44
|
-
This activity counter can be soft reset by commenting on the issue directly, but please do so mindfully. We would ask that you proactively let the EUI team know why this request matters to you or how it impacts you or your users, in order to help us prioritize accordingly.
|
|
45
|
-
|
|
46
|
-
The EUI team, like everyone else, has a finite amount of time and resources, and it is not humanly possible for us to implement every task or feature requested of us. However, that's where the beauty of open source comes in - if your request is important to you, we strongly encourage you to [contribute code directly to EUI](wiki/contributing-to-eui/) that addresses your issue or request!
|
|
47
|
-
|
|
48
|
-
<!-- TODO: Delete this question once the Emotion migration is complete -->
|
|
49
|
-
### What is the status of EUI's theming?
|
|
50
|
-
|
|
51
|
-
The EUI library was previously built upon Sass and is in the process of migrating to CSS-in-JS (specifically [Emotion](https://emotion.sh)). While this work is in progress, we ask for your patience with our in-between state in areas such as documentation and setup.
|
|
52
|
-
|
|
53
|
-
If you're a Kibana developer with questions around CSS-in-JS usage in Kibana, please check out our [FAQ discussion](https://github.com/elastic/eui/discussions/6828)!
|
|
54
|
-
|
|
55
|
-
## Wiki
|
|
56
|
-
|
|
57
|
-
Our wiki docs contain instructions and guidelines on multiple areas of EUI usage and development that are too detailed for an initial README. For more information, see:
|
|
58
|
-
|
|
59
|
-
- [Consuming EUI](wiki/consuming-eui)
|
|
60
|
-
- [Contributing to EUI](wiki/contributing-to-eui/)
|
|
61
|
-
- [Running EUI locally](wiki/contributing-to-eui/running-eui-locally.md)
|
|
62
|
-
|
|
63
|
-
## License
|
|
64
|
-
|
|
65
|
-
[Dual-licensed under Elastic v2 and Server Side Public License, v1][license]. See Elastic's [licensing FAQ][licensing-faq] for details.
|
|
66
|
-
|
|
67
|
-
[license]: LICENSE.txt
|
|
68
|
-
[licensing-faq]: https://www.elastic.co/pricing/faq/licensing#im-using-eui-or-elastic-charts-in-my-application-outside-of-kibana-how-does-this-affect-me
|
|
69
|
-
[docs]: https://elastic.github.io/eui/
|
|
1
|
+
## See [the top-level repo README](../../#readme) and [wiki](../../wiki) for more information on consuming and contributing to EUI.
|
|
@@ -40,7 +40,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
40
40
|
import React, { Component, Fragment } from 'react';
|
|
41
41
|
import PropTypes from "prop-types";
|
|
42
42
|
import classNames from 'classnames';
|
|
43
|
-
import { formatAuto, formatBoolean, formatDate, formatNumber, formatText, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, SortDirection, RenderWithEuiTheme } from '../../services';
|
|
43
|
+
import { formatAuto, formatBoolean, formatDate, formatNumber, formatText, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, SortDirection, RenderWithEuiTheme, OverrideCopiedTabularContent, tabularCopyMarkers } from '../../services';
|
|
44
44
|
import { isFunction } from '../../services/predicate';
|
|
45
45
|
import { get } from '../../services/objects';
|
|
46
46
|
import { EuiCheckbox } from '../form';
|
|
@@ -184,6 +184,10 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
184
184
|
});
|
|
185
185
|
});
|
|
186
186
|
});
|
|
187
|
+
_defineProperty(_this, "renderCopyChar", function (columnIndex) {
|
|
188
|
+
var isLastColumn = columnIndex === _this.props.columns.length - 1;
|
|
189
|
+
return isLastColumn ? tabularCopyMarkers.hiddenNewline : tabularCopyMarkers.hiddenTab;
|
|
190
|
+
});
|
|
187
191
|
_defineProperty(_this, "resolveColumnSortDirection", function (column) {
|
|
188
192
|
var sorting = _this.props.sorting;
|
|
189
193
|
var _ref5 = column,
|
|
@@ -384,13 +388,13 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
384
388
|
loading = _this$props3.loading;
|
|
385
389
|
return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(EuiTableHeaderMobile, {
|
|
386
390
|
responsiveBreakpoint: responsiveBreakpoint
|
|
387
|
-
}, this.renderSelectAll(true), this.renderTableMobileSort()), ___EmotionJSX(EuiTable, {
|
|
391
|
+
}, this.renderSelectAll(true), this.renderTableMobileSort()), ___EmotionJSX(OverrideCopiedTabularContent, null, ___EmotionJSX(EuiTable, {
|
|
388
392
|
id: this.tableId,
|
|
389
393
|
tableLayout: tableLayout,
|
|
390
394
|
responsiveBreakpoint: responsiveBreakpoint,
|
|
391
395
|
compressed: compressed,
|
|
392
396
|
css: loading && safariLoadingWorkaround
|
|
393
|
-
}, this.renderTableCaption(), this.renderTableHead(), this.renderTableBody(), this.renderTableFooter()));
|
|
397
|
+
}, this.renderTableCaption(), this.renderTableHead(), this.renderTableBody(), this.renderTableFooter())));
|
|
394
398
|
}
|
|
395
399
|
}, {
|
|
396
400
|
key: "renderTableMobileSort",
|
|
@@ -489,7 +493,7 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
489
493
|
return ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("caption", {
|
|
490
494
|
css: euiTableCaptionStyles,
|
|
491
495
|
className: "euiTableCaption"
|
|
492
|
-
}, ___EmotionJSX(EuiDelayRender, null, captionElement)));
|
|
496
|
+
}, tabularCopyMarkers.hiddenNoCopyBoundary, ___EmotionJSX(EuiDelayRender, null, captionElement), tabularCopyMarkers.hiddenNoCopyBoundary));
|
|
493
497
|
}
|
|
494
498
|
}, {
|
|
495
499
|
key: "renderTableHead",
|
|
@@ -501,7 +505,8 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
501
505
|
var headers = [];
|
|
502
506
|
if (selection) {
|
|
503
507
|
headers.push(___EmotionJSX(EuiTableHeaderCellCheckbox, {
|
|
504
|
-
key: "_selection_column_h"
|
|
508
|
+
key: "_selection_column_h",
|
|
509
|
+
append: this.renderCopyChar(-1)
|
|
505
510
|
}, this.renderSelectAll(false)));
|
|
506
511
|
}
|
|
507
512
|
columns.forEach(function (column, index) {
|
|
@@ -516,16 +521,20 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
516
521
|
readOnly = _ref8.readOnly,
|
|
517
522
|
description = _ref8.description;
|
|
518
523
|
var columnAlign = align || _this3.getAlignForDataType(dataType);
|
|
524
|
+
var sharedProps = {
|
|
525
|
+
width: width,
|
|
526
|
+
description: description,
|
|
527
|
+
mobileOptions: mobileOptions,
|
|
528
|
+
align: columnAlign,
|
|
529
|
+
append: _this3.renderCopyChar(index)
|
|
530
|
+
};
|
|
519
531
|
|
|
520
532
|
// actions column
|
|
521
533
|
if (column.actions) {
|
|
522
|
-
headers.push(___EmotionJSX(EuiTableHeaderCell, {
|
|
534
|
+
headers.push(___EmotionJSX(EuiTableHeaderCell, _extends({}, sharedProps, {
|
|
523
535
|
key: "_actions_h_".concat(index),
|
|
524
|
-
align: "right"
|
|
525
|
-
|
|
526
|
-
description: description,
|
|
527
|
-
mobileOptions: mobileOptions
|
|
528
|
-
}, name));
|
|
536
|
+
align: "right"
|
|
537
|
+
}), name));
|
|
529
538
|
return;
|
|
530
539
|
}
|
|
531
540
|
|
|
@@ -540,13 +549,9 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
540
549
|
_sorting.onSort = _this3.resolveColumnOnSort(column);
|
|
541
550
|
_sorting.readOnly = _this3.props.sorting.readOnly || readOnly;
|
|
542
551
|
}
|
|
543
|
-
headers.push(___EmotionJSX(EuiTableHeaderCell, _extends({
|
|
552
|
+
headers.push(___EmotionJSX(EuiTableHeaderCell, _extends({}, sharedProps, {
|
|
544
553
|
key: "_computed_column_h_".concat(index),
|
|
545
|
-
|
|
546
|
-
width: width,
|
|
547
|
-
mobileOptions: mobileOptions,
|
|
548
|
-
"data-test-subj": "tableHeaderCell_".concat(typeof name === 'string' ? name : '', "_").concat(index),
|
|
549
|
-
description: description
|
|
554
|
+
"data-test-subj": "tableHeaderCell_".concat(typeof name === 'string' ? name : '', "_").concat(index)
|
|
550
555
|
}, _sorting), name));
|
|
551
556
|
return;
|
|
552
557
|
}
|
|
@@ -569,13 +574,9 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
569
574
|
sorting.readOnly = _this3.props.sorting.readOnly || readOnly;
|
|
570
575
|
}
|
|
571
576
|
}
|
|
572
|
-
headers.push(___EmotionJSX(EuiTableHeaderCell, _extends({
|
|
577
|
+
headers.push(___EmotionJSX(EuiTableHeaderCell, _extends({}, sharedProps, {
|
|
573
578
|
key: "_data_h_".concat(String(field), "_").concat(index),
|
|
574
|
-
|
|
575
|
-
width: width,
|
|
576
|
-
mobileOptions: mobileOptions,
|
|
577
|
-
"data-test-subj": "tableHeaderCell_".concat(String(field), "_").concat(index),
|
|
578
|
-
description: description
|
|
579
|
+
"data-test-subj": "tableHeaderCell_".concat(String(field), "_").concat(index)
|
|
579
580
|
}, sorting), name));
|
|
580
581
|
});
|
|
581
582
|
return ___EmotionJSX(EuiTableHeader, null, headers);
|
|
@@ -741,7 +742,8 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
741
742
|
hasSelection: !!selection
|
|
742
743
|
}, ___EmotionJSX(EuiTableRowCell, {
|
|
743
744
|
colSpan: expandedRowColSpan,
|
|
744
|
-
textOnly: false
|
|
745
|
+
textOnly: false,
|
|
746
|
+
append: tabularCopyMarkers.hiddenNewline
|
|
745
747
|
}, itemIdToExpandedRowMap[itemId])) : undefined;
|
|
746
748
|
var rowPropsCallback = this.props.rowProps;
|
|
747
749
|
var rowProps = getRowProps(item, rowPropsCallback);
|
|
@@ -780,7 +782,8 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
780
782
|
}
|
|
781
783
|
};
|
|
782
784
|
return [___EmotionJSX(EuiTableRowCellCheckbox, {
|
|
783
|
-
key: key
|
|
785
|
+
key: key,
|
|
786
|
+
append: this.renderCopyChar(-1)
|
|
784
787
|
}, ___EmotionJSX(EuiI18n, {
|
|
785
788
|
token: "euiBasicTable.selectThisRow",
|
|
786
789
|
default: "Select row {index}",
|
|
@@ -849,7 +852,8 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
849
852
|
key: key,
|
|
850
853
|
align: "right",
|
|
851
854
|
textOnly: false,
|
|
852
|
-
hasActions: hasCustomActions ? 'custom' : true
|
|
855
|
+
hasActions: hasCustomActions ? 'custom' : true,
|
|
856
|
+
append: this.renderCopyChar(columnIndex)
|
|
853
857
|
}, ___EmotionJSX(ExpandedItemActions, {
|
|
854
858
|
actions: actualActions,
|
|
855
859
|
actionsDisabled: allDisabled,
|
|
@@ -867,7 +871,7 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
867
871
|
var contentRenderer = render || this.getRendererForDataType(dataType);
|
|
868
872
|
var value = get(item, field);
|
|
869
873
|
var content = contentRenderer(value, item);
|
|
870
|
-
return this.renderItemCell(item, column, key, content, setScopeRow);
|
|
874
|
+
return this.renderItemCell(item, column, columnIndex, key, content, setScopeRow);
|
|
871
875
|
}
|
|
872
876
|
}, {
|
|
873
877
|
key: "renderItemComputedCell",
|
|
@@ -876,11 +880,12 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
876
880
|
var key = "_computed_column_".concat(itemId, "_").concat(columnIndex);
|
|
877
881
|
var contentRenderer = render || this.getRendererForDataType();
|
|
878
882
|
var content = contentRenderer(item);
|
|
879
|
-
return this.renderItemCell(item, column, key, content, false);
|
|
883
|
+
return this.renderItemCell(item, column, columnIndex, key, content, false);
|
|
880
884
|
}
|
|
881
885
|
}, {
|
|
882
886
|
key: "renderItemCell",
|
|
883
|
-
value: function renderItemCell(item, column, key, content, setScopeRow) {
|
|
887
|
+
value: function renderItemCell(item, column, columnIndex, key, content, setScopeRow) {
|
|
888
|
+
var _mobileOptions$render, _mobileOptions$header;
|
|
884
889
|
var _ref11 = column,
|
|
885
890
|
align = _ref11.align,
|
|
886
891
|
render = _ref11.render,
|
|
@@ -904,10 +909,12 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
904
909
|
textOnly: textOnly || !render,
|
|
905
910
|
setScopeRow: setScopeRow,
|
|
906
911
|
mobileOptions: _objectSpread(_objectSpread({}, mobileOptions), {}, {
|
|
907
|
-
render: mobileOptions
|
|
908
|
-
header: mobileOptions
|
|
912
|
+
render: mobileOptions === null || mobileOptions === void 0 || (_mobileOptions$render = mobileOptions.render) === null || _mobileOptions$render === void 0 ? void 0 : _mobileOptions$render.call(mobileOptions, item),
|
|
913
|
+
header: (_mobileOptions$header = mobileOptions === null || mobileOptions === void 0 ? void 0 : mobileOptions.header) !== null && _mobileOptions$header !== void 0 ? _mobileOptions$header : name
|
|
909
914
|
})
|
|
910
|
-
}, cellProps, rest
|
|
915
|
+
}, cellProps, rest, {
|
|
916
|
+
append: this.renderCopyChar(columnIndex)
|
|
917
|
+
}), content);
|
|
911
918
|
}
|
|
912
919
|
}, {
|
|
913
920
|
key: "getRendererForDataType",
|
|
@@ -40,7 +40,7 @@ import PropTypes from "prop-types";
|
|
|
40
40
|
import React, { Component, createRef, memo, useMemo, forwardRef } from 'react';
|
|
41
41
|
import { createPortal } from 'react-dom';
|
|
42
42
|
import { IS_JEST_ENVIRONMENT } from '../../../../utils';
|
|
43
|
-
import { keys, useEuiMemoizedStyles } from '../../../../services';
|
|
43
|
+
import { keys, tabularCopyMarkers, useEuiMemoizedStyles } from '../../../../services';
|
|
44
44
|
import { EuiScreenReaderOnly } from '../../../accessibility';
|
|
45
45
|
import { useEuiI18n } from '../../../i18n';
|
|
46
46
|
import { EuiTextBlockTruncate } from '../../../text_truncate';
|
|
@@ -74,10 +74,7 @@ var EuiDataGridCellContent = /*#__PURE__*/memo(function (_ref) {
|
|
|
74
74
|
});
|
|
75
75
|
}, [cellHeightType, isControlColumn]);
|
|
76
76
|
var styles = useEuiMemoizedStyles(euiDataGridRowCellStyles);
|
|
77
|
-
var cssStyles = [styles.content.euiDataGridRowCell__content].concat(_toConsumableArray(isControlColumn ? [
|
|
78
|
-
// Control column cells should not be vertically centered (defaultHeight) except
|
|
79
|
-
// on single rows. They should be top-aligned for auto and lineCount heights
|
|
80
|
-
styles.content.controlColumn, cellHeightType === 'default' ? styles.content.defaultHeight : styles.content.autoHeight] : [
|
|
77
|
+
var cssStyles = [styles.content.euiDataGridRowCell__content].concat(_toConsumableArray(isControlColumn ? [styles.content.controlColumn, styles.content.autoHeight] : [
|
|
81
78
|
// Regular data cells should always inherit height from the row wrapper,
|
|
82
79
|
// except for auto height
|
|
83
80
|
cellHeightType === 'auto' ? styles.content.autoHeight : styles.content.defaultHeight]));
|
|
@@ -541,6 +538,57 @@ EuiDataGridCellContent.propTypes = {
|
|
|
541
538
|
}),
|
|
542
539
|
rowHeightUtils: PropTypes.oneOfType([PropTypes.any.isRequired, PropTypes.any.isRequired]),
|
|
543
540
|
pagination: PropTypes.any,
|
|
541
|
+
gridStyles: PropTypes.shape({
|
|
542
|
+
/**
|
|
543
|
+
* Size of fonts used within the row and column cells
|
|
544
|
+
* @default m
|
|
545
|
+
*/
|
|
546
|
+
fontSize: PropTypes.oneOf(["s", "m", "l"]),
|
|
547
|
+
/**
|
|
548
|
+
* Defines the padding with the row and column cells
|
|
549
|
+
* @default m
|
|
550
|
+
*/
|
|
551
|
+
cellPadding: PropTypes.oneOf(["s", "m", "l"]),
|
|
552
|
+
/**
|
|
553
|
+
* Border used for the row and column cells
|
|
554
|
+
* @default all
|
|
555
|
+
*/
|
|
556
|
+
border: PropTypes.oneOf(["all", "horizontal", "none"]),
|
|
557
|
+
/**
|
|
558
|
+
* If set to true, rows will alternate zebra striping for clarity
|
|
559
|
+
* @default false
|
|
560
|
+
*/
|
|
561
|
+
stripes: PropTypes.bool,
|
|
562
|
+
/**
|
|
563
|
+
* Visual style for the column headers. Recommendation is to use the `underline` style in times when #EuiDataGrid `toolbarVisibility` is set to `false`.
|
|
564
|
+
* @default shade
|
|
565
|
+
*/
|
|
566
|
+
header: PropTypes.oneOf(["shade", "underline"]),
|
|
567
|
+
/**
|
|
568
|
+
* Visual style for the column footers.
|
|
569
|
+
* @default overline
|
|
570
|
+
*/
|
|
571
|
+
footer: PropTypes.oneOf(["shade", "overline", "striped"]),
|
|
572
|
+
/**
|
|
573
|
+
* If set to true, the footer row will be sticky
|
|
574
|
+
* @default true
|
|
575
|
+
*/
|
|
576
|
+
stickyFooter: PropTypes.bool,
|
|
577
|
+
/**
|
|
578
|
+
* Will define what visual style to show on row hover
|
|
579
|
+
* @default hover
|
|
580
|
+
*/
|
|
581
|
+
rowHover: PropTypes.oneOf(["highlight", "none"]),
|
|
582
|
+
/**
|
|
583
|
+
* Optionally pass custom classes to highlight or customize certain rows
|
|
584
|
+
*/
|
|
585
|
+
rowClasses: PropTypes.shape({}),
|
|
586
|
+
/**
|
|
587
|
+
* Optional callback returning the current `gridStyle` config when changes occur from user input (e.g. toolbar display controls).
|
|
588
|
+
* Can be used for, e.g. storing user `gridStyle` in a local storage object.
|
|
589
|
+
*/
|
|
590
|
+
onChange: PropTypes.func
|
|
591
|
+
}).isRequired,
|
|
544
592
|
setCellProps: PropTypes.func.isRequired,
|
|
545
593
|
setCellContentsRef: PropTypes.func.isRequired,
|
|
546
594
|
isExpanded: PropTypes.bool.isRequired,
|
|
@@ -608,7 +656,7 @@ export var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
608
656
|
var lineCount = isSingleLine ? 1 : rowHeightUtils === null || rowHeightUtils === void 0 ? void 0 : rowHeightUtils.getLineCount(rowHeightOption);
|
|
609
657
|
if (lineCount) {
|
|
610
658
|
var shouldUseHeightsCache = rowHeightUtils === null || rowHeightUtils === void 0 ? void 0 : rowHeightUtils.isRowHeightOverride(rowIndex, rowHeightsOptions);
|
|
611
|
-
var height = rowHeightUtils.calculateHeightForLineCount(_this.cellContentsRef, lineCount
|
|
659
|
+
var height = rowHeightUtils.calculateHeightForLineCount(_this.cellContentsRef, lineCount);
|
|
612
660
|
if (shouldUseHeightsCache) {
|
|
613
661
|
var _this$props4 = _this.props,
|
|
614
662
|
columnId = _this$props4.columnId,
|
|
@@ -800,12 +848,12 @@ export var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
800
848
|
}, {
|
|
801
849
|
key: "componentDidUpdate",
|
|
802
850
|
value: function componentDidUpdate(prevProps) {
|
|
803
|
-
var _this$props$rowHeight, _prevProps$rowHeights, _this$props$rowHeight2, _this$props$rowHeight3, _this$props$style, _prevProps$style;
|
|
851
|
+
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;
|
|
804
852
|
this.recalculateAutoHeight();
|
|
805
|
-
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)) {
|
|
853
|
+
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)) {
|
|
806
854
|
this.recalculateLineHeight();
|
|
807
855
|
}
|
|
808
|
-
if ((_this$props$
|
|
856
|
+
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 &&
|
|
809
857
|
// once per row
|
|
810
858
|
this.props.columnId === prevProps.columnId &&
|
|
811
859
|
// if this is still the same column
|
|
@@ -813,12 +861,12 @@ export var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
813
861
|
// if this is still the same row
|
|
814
862
|
((_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
|
|
815
863
|
) {
|
|
816
|
-
var _prevProps$style2, _this$props$style2, _this$props$
|
|
864
|
+
var _prevProps$style2, _this$props$style2, _this$props$rowHeight6;
|
|
817
865
|
var previousTop = parseFloat((_prevProps$style2 = prevProps.style) === null || _prevProps$style2 === void 0 ? void 0 : _prevProps$style2.top);
|
|
818
866
|
var currentTop = parseFloat((_this$props$style2 = this.props.style) === null || _this$props$style2 === void 0 ? void 0 : _this$props$style2.top);
|
|
819
867
|
|
|
820
868
|
// @ts-ignore We've already checked that this virtualization util is available above
|
|
821
|
-
this.props.rowHeightUtils.compensateForLayoutShift(this.props.rowIndex, currentTop - previousTop, (_this$props$
|
|
869
|
+
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);
|
|
822
870
|
}
|
|
823
871
|
if (this.props.popoverContext.popoverIsOpen !== prevProps.popoverContext.popoverIsOpen || this.props.popoverContext.cellLocation !== prevProps.popoverContext.cellLocation || this.props.renderCellPopover !== prevProps.renderCellPopover) {
|
|
824
872
|
this.handleCellPopover();
|
|
@@ -830,6 +878,7 @@ export var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
830
878
|
}, {
|
|
831
879
|
key: "shouldComponentUpdate",
|
|
832
880
|
value: function shouldComponentUpdate(nextProps, nextState) {
|
|
881
|
+
var _nextProps$gridStyles, _this$props$gridStyle3, _nextProps$gridStyles2, _this$props$gridStyle4;
|
|
833
882
|
if (nextProps.rowIndex !== this.props.rowIndex) return true;
|
|
834
883
|
if (nextProps.visibleRowIndex !== this.props.visibleRowIndex) return true;
|
|
835
884
|
if (nextProps.colIndex !== this.props.colIndex) return true;
|
|
@@ -837,6 +886,8 @@ export var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
837
886
|
if (nextProps.columnType !== this.props.columnType) return true;
|
|
838
887
|
if (nextProps.width !== this.props.width) return true;
|
|
839
888
|
if (nextProps.rowHeightsOptions !== this.props.rowHeightsOptions) return true;
|
|
889
|
+
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;
|
|
890
|
+
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;
|
|
840
891
|
if (nextProps.renderCellValue !== this.props.renderCellValue) return true;
|
|
841
892
|
if (nextProps.renderCellPopover !== this.props.renderCellPopover) return true;
|
|
842
893
|
if (nextProps.interactiveCellId !== this.props.interactiveCellId) return true;
|
|
@@ -882,6 +933,10 @@ export var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
882
933
|
var popoverIsOpen = this.isPopoverOpen();
|
|
883
934
|
var showCellActions = isExpandable && (popoverIsOpen || this.state.isFocused || this.state.isHovered);
|
|
884
935
|
var cellClasses = classNames('euiDataGridRowCell', _defineProperty(_defineProperty({}, "euiDataGridRowCell--".concat(columnType), columnType), 'euiDataGridRowCell--open', popoverIsOpen), className);
|
|
936
|
+
|
|
937
|
+
// classNames set by EuiDataGridCellWrapper
|
|
938
|
+
var isControlColumn = cellClasses.includes('euiDataGridRowCell--controlColumn');
|
|
939
|
+
var isLastColumn = cellClasses.includes('euiDataGridRowCell--lastColumn');
|
|
885
940
|
var ariaRowIndex = pagination ? visibleRowIndex + 1 + pagination.pageSize * pagination.pageIndex : visibleRowIndex + 1;
|
|
886
941
|
var _this$state$cellProps2 = this.state.cellProps,
|
|
887
942
|
_ = _this$state$cellProps2.isExpandable,
|
|
@@ -935,10 +990,10 @@ export var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
935
990
|
setCellContentsRef: this.setCellContentsRef,
|
|
936
991
|
rowHeight: rowHeight,
|
|
937
992
|
rowHeightUtils: rowHeightUtils,
|
|
938
|
-
isControlColumn:
|
|
993
|
+
isControlColumn: isControlColumn,
|
|
939
994
|
rowIndex: rowIndex,
|
|
940
995
|
colIndex: colIndex
|
|
941
|
-
}))), this.state.isFocused && ___EmotionJSX(CellScreenReaderDescription, {
|
|
996
|
+
}))), isLastColumn ? tabularCopyMarkers.hiddenNewline : tabularCopyMarkers.hiddenTab, this.state.isFocused && ___EmotionJSX(CellScreenReaderDescription, {
|
|
942
997
|
columnName: (column === null || column === void 0 ? void 0 : column.displayAsText) || this.props.columnId,
|
|
943
998
|
columnIndex: colIndex + 1,
|
|
944
999
|
rowIndex: ariaRowIndex,
|
|
@@ -1346,7 +1401,58 @@ EuiDataGridCell.propTypes = {
|
|
|
1346
1401
|
rowManager: PropTypes.shape({
|
|
1347
1402
|
getRow: PropTypes.func.isRequired
|
|
1348
1403
|
}),
|
|
1349
|
-
pagination: PropTypes.any
|
|
1404
|
+
pagination: PropTypes.any,
|
|
1405
|
+
gridStyles: PropTypes.shape({
|
|
1406
|
+
/**
|
|
1407
|
+
* Size of fonts used within the row and column cells
|
|
1408
|
+
* @default m
|
|
1409
|
+
*/
|
|
1410
|
+
fontSize: PropTypes.oneOf(["s", "m", "l"]),
|
|
1411
|
+
/**
|
|
1412
|
+
* Defines the padding with the row and column cells
|
|
1413
|
+
* @default m
|
|
1414
|
+
*/
|
|
1415
|
+
cellPadding: PropTypes.oneOf(["s", "m", "l"]),
|
|
1416
|
+
/**
|
|
1417
|
+
* Border used for the row and column cells
|
|
1418
|
+
* @default all
|
|
1419
|
+
*/
|
|
1420
|
+
border: PropTypes.oneOf(["all", "horizontal", "none"]),
|
|
1421
|
+
/**
|
|
1422
|
+
* If set to true, rows will alternate zebra striping for clarity
|
|
1423
|
+
* @default false
|
|
1424
|
+
*/
|
|
1425
|
+
stripes: PropTypes.bool,
|
|
1426
|
+
/**
|
|
1427
|
+
* Visual style for the column headers. Recommendation is to use the `underline` style in times when #EuiDataGrid `toolbarVisibility` is set to `false`.
|
|
1428
|
+
* @default shade
|
|
1429
|
+
*/
|
|
1430
|
+
header: PropTypes.oneOf(["shade", "underline"]),
|
|
1431
|
+
/**
|
|
1432
|
+
* Visual style for the column footers.
|
|
1433
|
+
* @default overline
|
|
1434
|
+
*/
|
|
1435
|
+
footer: PropTypes.oneOf(["shade", "overline", "striped"]),
|
|
1436
|
+
/**
|
|
1437
|
+
* If set to true, the footer row will be sticky
|
|
1438
|
+
* @default true
|
|
1439
|
+
*/
|
|
1440
|
+
stickyFooter: PropTypes.bool,
|
|
1441
|
+
/**
|
|
1442
|
+
* Will define what visual style to show on row hover
|
|
1443
|
+
* @default hover
|
|
1444
|
+
*/
|
|
1445
|
+
rowHover: PropTypes.oneOf(["highlight", "none"]),
|
|
1446
|
+
/**
|
|
1447
|
+
* Optionally pass custom classes to highlight or customize certain rows
|
|
1448
|
+
*/
|
|
1449
|
+
rowClasses: PropTypes.shape({}),
|
|
1450
|
+
/**
|
|
1451
|
+
* Optional callback returning the current `gridStyle` config when changes occur from user input (e.g. toolbar display controls).
|
|
1452
|
+
* Can be used for, e.g. storing user `gridStyle` in a local storage object.
|
|
1453
|
+
*/
|
|
1454
|
+
onChange: PropTypes.func
|
|
1455
|
+
}).isRequired
|
|
1350
1456
|
};
|
|
1351
1457
|
var RenderCellInRow = /*#__PURE__*/memo(function (_ref2) {
|
|
1352
1458
|
var row = _ref2.row,
|
|
@@ -1418,7 +1524,7 @@ var CellScreenReaderDescription = /*#__PURE__*/memo(function (_ref5) {
|
|
|
1418
1524
|
rowIndex: rowIndex
|
|
1419
1525
|
});
|
|
1420
1526
|
var enterKeyPrompt = useEuiI18n('euiDataGridCell.expansionEnterPrompt', 'Press the Enter key to expand this cell.');
|
|
1421
|
-
return ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("p", null, " - ".concat(cellPosition).concat(canExpandCell ? ". ".concat(enterKeyPrompt) : '')));
|
|
1527
|
+
return ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("p", null, tabularCopyMarkers.hiddenNoCopyBoundary, " - ".concat(cellPosition).concat(canExpandCell ? ". ".concat(enterKeyPrompt) : ''), tabularCopyMarkers.hiddenNoCopyBoundary));
|
|
1422
1528
|
});
|
|
1423
1529
|
CellScreenReaderDescription.propTypes = {
|
|
1424
1530
|
columnName: PropTypes.string.isRequired,
|
|
@@ -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
|
};
|
|
@@ -102,6 +102,7 @@ export var EuiDataGridBodyCustomRender = function EuiDataGridBodyCustomRender(_r
|
|
|
102
102
|
columnWidths: columnWidths,
|
|
103
103
|
defaultColumnWidth: defaultColumnWidth,
|
|
104
104
|
setColumnWidth: setColumnWidth,
|
|
105
|
+
visibleColCount: visibleColCount,
|
|
105
106
|
setVisibleColumns: setVisibleColumns,
|
|
106
107
|
switchColumnPos: switchColumnPos,
|
|
107
108
|
sorting: sorting,
|
|
@@ -115,6 +116,7 @@ export var EuiDataGridBodyCustomRender = function EuiDataGridBodyCustomRender(_r
|
|
|
115
116
|
renderCellPopover: renderCellPopover,
|
|
116
117
|
rowIndex: visibleRows.visibleRowCount,
|
|
117
118
|
visibleRowIndex: visibleRows.visibleRowCount,
|
|
119
|
+
visibleColCount: visibleColCount,
|
|
118
120
|
interactiveCellId: interactiveCellId,
|
|
119
121
|
leadingControlColumns: leadingControlColumns,
|
|
120
122
|
trailingControlColumns: trailingControlColumns,
|
|
@@ -146,9 +148,10 @@ export var EuiDataGridBodyCustomRender = function EuiDataGridBodyCustomRender(_r
|
|
|
146
148
|
interactiveCellId: interactiveCellId,
|
|
147
149
|
setRowHeight: setRowHeight,
|
|
148
150
|
rowHeightsOptions: rowHeightsOptions,
|
|
149
|
-
rowHeightUtils: rowHeightUtils
|
|
151
|
+
rowHeightUtils: rowHeightUtils,
|
|
152
|
+
gridStyles: gridStyles
|
|
150
153
|
};
|
|
151
|
-
}, [schema, schemaDetectors, pagination, columns, leadingControlColumns, trailingControlColumns, visibleColCount, columnWidths, defaultColumnWidth, renderCellValue, cellContext, renderCellPopover, interactiveCellId, setRowHeight, rowHeightsOptions, rowHeightUtils]);
|
|
154
|
+
}, [schema, schemaDetectors, pagination, columns, leadingControlColumns, trailingControlColumns, visibleColCount, columnWidths, defaultColumnWidth, renderCellValue, cellContext, renderCellPopover, interactiveCellId, setRowHeight, rowHeightsOptions, rowHeightUtils, gridStyles]);
|
|
152
155
|
var Cell = useCallback(function (_ref2) {
|
|
153
156
|
var colIndex = _ref2.colIndex,
|
|
154
157
|
visibleRowIndex = _ref2.visibleRowIndex,
|
|
@@ -154,6 +154,7 @@ export var EuiDataGridBodyVirtualized = /*#__PURE__*/memo(function (_ref3) {
|
|
|
154
154
|
columnWidths: columnWidths,
|
|
155
155
|
defaultColumnWidth: defaultColumnWidth,
|
|
156
156
|
setColumnWidth: setColumnWidth,
|
|
157
|
+
visibleColCount: visibleColCount,
|
|
157
158
|
setVisibleColumns: setVisibleColumns,
|
|
158
159
|
switchColumnPos: switchColumnPos,
|
|
159
160
|
sorting: sorting,
|
|
@@ -168,6 +169,7 @@ export var EuiDataGridBodyVirtualized = /*#__PURE__*/memo(function (_ref3) {
|
|
|
168
169
|
renderCellPopover: renderCellPopover,
|
|
169
170
|
rowIndex: visibleRowCount,
|
|
170
171
|
visibleRowIndex: visibleRowCount,
|
|
172
|
+
visibleColCount: visibleColCount,
|
|
171
173
|
interactiveCellId: interactiveCellId,
|
|
172
174
|
leadingControlColumns: leadingControlColumns,
|
|
173
175
|
trailingControlColumns: trailingControlColumns,
|
|
@@ -290,9 +292,10 @@ export var EuiDataGridBodyVirtualized = /*#__PURE__*/memo(function (_ref3) {
|
|
|
290
292
|
rowHeightUtils: rowHeightUtils,
|
|
291
293
|
rowManager: rowManager,
|
|
292
294
|
pagination: pagination,
|
|
293
|
-
headerRowHeight: headerRowHeight
|
|
295
|
+
headerRowHeight: headerRowHeight,
|
|
296
|
+
gridStyles: gridStyles
|
|
294
297
|
};
|
|
295
|
-
}, [schemaDetectors, setRowHeight, leadingControlColumns, trailingControlColumns, columns, visibleColCount, schema, columnWidths, defaultColumnWidth, renderCellValue, cellContext, renderCellPopover, interactiveCellId, rowHeightsOptions, rowHeightUtils, rowManager, pagination, headerRowHeight]);
|
|
298
|
+
}, [schemaDetectors, setRowHeight, leadingControlColumns, trailingControlColumns, columns, visibleColCount, schema, columnWidths, defaultColumnWidth, renderCellValue, cellContext, renderCellPopover, interactiveCellId, rowHeightsOptions, rowHeightUtils, rowManager, pagination, headerRowHeight, gridStyles]);
|
|
296
299
|
var rowWrapperContextValue = useMemo(function () {
|
|
297
300
|
return {
|
|
298
301
|
headerRowHeight: headerRowHeight,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["leadingControlColumns", "trailingControlColumns", "columns", "schema", "columnWidths", "defaultColumnWidth", "className", "renderCellValue", "renderCellPopover", "rowIndex", "interactiveCellId", "data-test-subj", "visibleRowIndex", "gridStyles"];
|
|
1
|
+
var _excluded = ["leadingControlColumns", "trailingControlColumns", "columns", "schema", "columnWidths", "defaultColumnWidth", "className", "renderCellValue", "renderCellPopover", "rowIndex", "interactiveCellId", "data-test-subj", "visibleRowIndex", "visibleColCount", "gridStyles"];
|
|
2
2
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
3
|
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
4
4
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
|
|
@@ -10,8 +10,8 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t =
|
|
|
10
10
|
* Side Public License, v 1.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import React, { forwardRef, memo, useContext } from 'react';
|
|
14
|
-
import
|
|
13
|
+
import React, { forwardRef, memo, useCallback, useContext } from 'react';
|
|
14
|
+
import classNames from 'classnames';
|
|
15
15
|
import { useEuiMemoizedStyles } from '../../../../services';
|
|
16
16
|
import { EuiDataGridCell, DataGridCellPopoverContext } from '../cell';
|
|
17
17
|
import { euiDataGridFooterStyles } from './data_grid_footer.styles';
|
|
@@ -34,19 +34,27 @@ var EuiDataGridFooterRow = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (
|
|
|
34
34
|
_dataTestSubj = _ref['data-test-subj'],
|
|
35
35
|
_ref$visibleRowIndex = _ref.visibleRowIndex,
|
|
36
36
|
visibleRowIndex = _ref$visibleRowIndex === void 0 ? rowIndex : _ref$visibleRowIndex,
|
|
37
|
+
visibleColCount = _ref.visibleColCount,
|
|
37
38
|
gridStyles = _ref.gridStyles,
|
|
38
39
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
39
40
|
var styles = useEuiMemoizedStyles(euiDataGridFooterStyles);
|
|
40
41
|
var cssStyles = [styles.euiDataGridFooter, gridStyles.stickyFooter && styles.sticky, gridStyles.footer === 'striped' ? visibleRowIndex % 2 !== 0 && styles.striped : styles[gridStyles.footer]];
|
|
41
|
-
var classes =
|
|
42
|
-
var dataTestSubj =
|
|
42
|
+
var classes = classNames('euiDataGridFooter', className);
|
|
43
|
+
var dataTestSubj = classNames('dataGridRow', 'dataGridFooterRow', _dataTestSubj);
|
|
44
|
+
var getCellClasses = useCallback(function (columnIndex, classes) {
|
|
45
|
+
return classNames('euiDataGridFooterCell', {
|
|
46
|
+
'euiDataGridRowCell--firstColumn': columnIndex === 0,
|
|
47
|
+
'euiDataGridRowCell--lastColumn': columnIndex === visibleColCount - 1
|
|
48
|
+
}, classes);
|
|
49
|
+
}, [visibleColCount]);
|
|
43
50
|
var popoverContext = useContext(DataGridCellPopoverContext);
|
|
44
51
|
var sharedCellProps = {
|
|
45
52
|
css: styles.euiDataGridFooterCell,
|
|
46
53
|
rowIndex: rowIndex,
|
|
47
54
|
visibleRowIndex: visibleRowIndex,
|
|
48
55
|
interactiveCellId: interactiveCellId,
|
|
49
|
-
popoverContext: popoverContext
|
|
56
|
+
popoverContext: popoverContext,
|
|
57
|
+
gridStyles: gridStyles
|
|
50
58
|
};
|
|
51
59
|
return ___EmotionJSX("div", _extends({
|
|
52
60
|
ref: ref,
|
|
@@ -66,7 +74,7 @@ var EuiDataGridFooterRow = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (
|
|
|
66
74
|
width: width,
|
|
67
75
|
renderCellValue: footerCellRender !== null && footerCellRender !== void 0 ? footerCellRender : renderEmpty,
|
|
68
76
|
isExpandable: false,
|
|
69
|
-
className:
|
|
77
|
+
className: getCellClasses(i, classNames('euiDataGridRowCell--controlColumn', footerCellProps === null || footerCellProps === void 0 ? void 0 : footerCellProps.className))
|
|
70
78
|
}));
|
|
71
79
|
}), columns.map(function (_ref3, i) {
|
|
72
80
|
var id = _ref3.id;
|
|
@@ -83,7 +91,7 @@ var EuiDataGridFooterRow = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (
|
|
|
83
91
|
renderCellValue: renderCellValue,
|
|
84
92
|
renderCellPopover: renderCellPopover,
|
|
85
93
|
isExpandable: true,
|
|
86
|
-
className:
|
|
94
|
+
className: getCellClasses(columnPosition)
|
|
87
95
|
}));
|
|
88
96
|
}), trailingControlColumns.map(function (_ref4, i) {
|
|
89
97
|
var id = _ref4.id,
|
|
@@ -98,7 +106,7 @@ var EuiDataGridFooterRow = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (
|
|
|
98
106
|
width: width,
|
|
99
107
|
renderCellValue: footerCellRender !== null && footerCellRender !== void 0 ? footerCellRender : renderEmpty,
|
|
100
108
|
isExpandable: false,
|
|
101
|
-
className:
|
|
109
|
+
className: getCellClasses(colIndex, classNames('euiDataGridRowCell--controlColumn', footerCellProps === null || footerCellProps === void 0 ? void 0 : footerCellProps.className))
|
|
102
110
|
}));
|
|
103
111
|
}));
|
|
104
112
|
}));
|