@elastic/eui 93.6.0 → 94.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/eui_theme_dark.css +0 -765
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +0 -765
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/basic_table/basic_table.js +117 -131
- package/es/components/basic_table/basic_table.styles.js +3 -17
- package/es/components/basic_table/expanded_item_actions.js +1 -2
- package/es/components/basic_table/in_memory_table.js +57 -76
- package/es/components/provider/component_defaults/component_defaults.js +7 -1
- package/es/components/table/_table_cell_content.js +72 -0
- package/es/components/table/_table_cell_content.styles.js +63 -0
- package/es/components/table/index.js +0 -1
- package/es/components/table/mobile/responsive_context.js +37 -0
- package/es/components/table/mobile/table_header_mobile.js +11 -4
- package/es/components/table/mobile/table_header_mobile.styles.js +15 -0
- package/es/components/table/mobile/table_sort_mobile.js +12 -3
- package/es/components/table/table.js +23 -13
- package/es/components/table/table.styles.js +102 -0
- package/es/components/table/table_cells_shared.styles.js +47 -0
- package/es/components/table/table_footer_cell.js +12 -12
- package/es/components/table/table_header_cell.js +36 -51
- package/es/components/table/table_header_cell_checkbox.js +6 -2
- package/es/components/table/table_row.js +18 -6
- package/es/components/table/table_row.styles.js +78 -0
- package/es/components/table/table_row_cell.js +65 -91
- package/es/components/table/table_row_cell.styles.js +89 -0
- package/es/components/table/table_row_cell_checkbox.js +7 -0
- package/eui.d.ts +662 -507
- package/i18ntokens.json +40 -40
- package/lib/components/basic_table/basic_table.js +116 -130
- package/lib/components/basic_table/basic_table.styles.js +5 -20
- package/lib/components/basic_table/expanded_item_actions.js +1 -2
- package/lib/components/basic_table/in_memory_table.js +57 -76
- package/lib/components/provider/component_defaults/component_defaults.js +7 -1
- package/lib/components/table/_table_cell_content.js +82 -0
- package/lib/components/table/_table_cell_content.styles.js +68 -0
- package/lib/components/table/index.js +0 -7
- package/lib/components/table/mobile/responsive_context.js +47 -0
- package/lib/components/table/mobile/table_header_mobile.js +11 -4
- package/lib/components/table/mobile/table_header_mobile.styles.js +22 -0
- package/lib/components/table/mobile/table_sort_mobile.js +12 -3
- package/lib/components/table/table.js +23 -13
- package/lib/components/table/table.styles.js +109 -0
- package/lib/components/table/table_cells_shared.styles.js +53 -0
- package/lib/components/table/table_footer_cell.js +11 -11
- package/lib/components/table/table_header_cell.js +36 -51
- package/lib/components/table/table_header_cell_checkbox.js +6 -2
- package/lib/components/table/table_row.js +17 -5
- package/lib/components/table/table_row.styles.js +84 -0
- package/lib/components/table/table_row_cell.js +64 -92
- package/lib/components/table/table_row_cell.styles.js +94 -0
- package/lib/components/table/table_row_cell_checkbox.js +7 -0
- package/optimize/es/components/basic_table/basic_table.js +56 -59
- package/optimize/es/components/basic_table/basic_table.styles.js +3 -17
- package/optimize/es/components/basic_table/expanded_item_actions.js +1 -2
- package/optimize/es/components/basic_table/in_memory_table.js +1 -6
- package/optimize/es/components/table/_table_cell_content.js +56 -0
- package/optimize/es/components/table/_table_cell_content.styles.js +63 -0
- package/optimize/es/components/table/index.js +0 -1
- package/optimize/es/components/table/mobile/responsive_context.js +37 -0
- package/optimize/es/components/table/mobile/table_header_mobile.js +11 -4
- package/optimize/es/components/table/mobile/table_header_mobile.styles.js +15 -0
- package/optimize/es/components/table/mobile/table_sort_mobile.js +7 -1
- package/optimize/es/components/table/table.js +13 -12
- package/optimize/es/components/table/table.styles.js +102 -0
- package/optimize/es/components/table/table_cells_shared.styles.js +44 -0
- package/optimize/es/components/table/table_footer_cell.js +12 -12
- package/optimize/es/components/table/table_header_cell.js +35 -37
- package/optimize/es/components/table/table_header_cell_checkbox.js +6 -2
- package/optimize/es/components/table/table_row.js +10 -2
- package/optimize/es/components/table/table_row.styles.js +78 -0
- package/optimize/es/components/table/table_row_cell.js +49 -80
- package/optimize/es/components/table/table_row_cell.styles.js +89 -0
- package/optimize/es/components/table/table_row_cell_checkbox.js +7 -0
- package/optimize/lib/components/basic_table/basic_table.js +55 -58
- package/optimize/lib/components/basic_table/basic_table.styles.js +5 -20
- package/optimize/lib/components/basic_table/expanded_item_actions.js +1 -2
- package/optimize/lib/components/basic_table/in_memory_table.js +1 -6
- package/optimize/lib/components/table/_table_cell_content.js +66 -0
- package/optimize/lib/components/table/_table_cell_content.styles.js +68 -0
- package/optimize/lib/components/table/index.js +0 -7
- package/optimize/lib/components/table/mobile/responsive_context.js +47 -0
- package/optimize/lib/components/table/mobile/table_header_mobile.js +11 -4
- package/optimize/lib/components/table/mobile/table_header_mobile.styles.js +22 -0
- package/optimize/lib/components/table/mobile/table_sort_mobile.js +7 -1
- package/optimize/lib/components/table/table.js +13 -12
- package/optimize/lib/components/table/table.styles.js +109 -0
- package/optimize/lib/components/table/table_cells_shared.styles.js +51 -0
- package/optimize/lib/components/table/table_footer_cell.js +11 -11
- package/optimize/lib/components/table/table_header_cell.js +35 -37
- package/optimize/lib/components/table/table_header_cell_checkbox.js +6 -2
- package/optimize/lib/components/table/table_row.js +9 -1
- package/optimize/lib/components/table/table_row.styles.js +85 -0
- package/optimize/lib/components/table/table_row_cell.js +48 -82
- package/optimize/lib/components/table/table_row_cell.styles.js +94 -0
- package/optimize/lib/components/table/table_row_cell_checkbox.js +7 -0
- package/package.json +1 -1
- package/src/components/index.scss +0 -1
- package/test-env/components/basic_table/basic_table.js +112 -129
- package/test-env/components/basic_table/basic_table.styles.js +5 -20
- package/test-env/components/basic_table/expanded_item_actions.js +1 -2
- package/test-env/components/basic_table/in_memory_table.js +57 -76
- package/test-env/components/provider/component_defaults/component_defaults.js +7 -1
- package/test-env/components/table/_table_cell_content.js +76 -0
- package/test-env/components/table/_table_cell_content.styles.js +68 -0
- package/test-env/components/table/index.js +0 -7
- package/test-env/components/table/mobile/responsive_context.js +47 -0
- package/test-env/components/table/mobile/table_header_mobile.js +11 -4
- package/test-env/components/table/mobile/table_header_mobile.styles.js +22 -0
- package/test-env/components/table/mobile/table_sort_mobile.js +12 -3
- package/test-env/components/table/table.js +23 -13
- package/test-env/components/table/table.styles.js +109 -0
- package/test-env/components/table/table_cells_shared.styles.js +51 -0
- package/test-env/components/table/table_footer_cell.js +11 -11
- package/test-env/components/table/table_header_cell.js +36 -51
- package/test-env/components/table/table_header_cell_checkbox.js +6 -2
- package/test-env/components/table/table_row.js +17 -5
- package/test-env/components/table/table_row.styles.js +85 -0
- package/test-env/components/table/table_row_cell.js +59 -93
- package/test-env/components/table/table_row_cell.styles.js +94 -0
- package/test-env/components/table/table_row_cell_checkbox.js +7 -0
- package/es/components/table/table_header_button.js +0 -52
- package/lib/components/table/table_header_button.js +0 -59
- package/optimize/es/components/table/table_header_button.js +0 -43
- package/optimize/lib/components/table/table_header_button.js +0 -50
- package/src/components/table/_index.scss +0 -7
- package/src/components/table/_mixins.scss +0 -20
- package/src/components/table/_responsive.scss +0 -211
- package/src/components/table/_table.scss +0 -241
- package/src/components/table/_variables.scss +0 -17
- package/src/components/table/mobile/_index.scss +0 -1
- package/src/components/table/mobile/_mobile.scss +0 -17
- package/test-env/components/table/table_header_button.js +0 -58
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
2
|
+
/*
|
|
3
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
4
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
5
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
6
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
7
|
+
* Side Public License, v 1.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { css } from '@emotion/react';
|
|
11
|
+
import { euiFontSize, euiNumberFormat, logicalCSS, mathWithUnits } from '../../global_styling';
|
|
12
|
+
export var euiTableVariables = function euiTableVariables(_ref4) {
|
|
13
|
+
var euiTheme = _ref4.euiTheme;
|
|
14
|
+
var cellContentPadding = euiTheme.size.s;
|
|
15
|
+
var compressedCellContentPadding = euiTheme.size.xs;
|
|
16
|
+
var mobileSizes = {
|
|
17
|
+
actions: {
|
|
18
|
+
width: euiTheme.size.xxl,
|
|
19
|
+
offset: mathWithUnits(cellContentPadding, function (x) {
|
|
20
|
+
return x * 2;
|
|
21
|
+
})
|
|
22
|
+
},
|
|
23
|
+
checkbox: {
|
|
24
|
+
width: mathWithUnits([euiTheme.size.xl, euiTheme.size.xs], function (x, y) {
|
|
25
|
+
return x + y;
|
|
26
|
+
}),
|
|
27
|
+
offset: mathWithUnits(cellContentPadding, function (x) {
|
|
28
|
+
return x / 2;
|
|
29
|
+
})
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
var checkboxSize = euiTheme.size.xl;
|
|
33
|
+
return {
|
|
34
|
+
cellContentPadding: cellContentPadding,
|
|
35
|
+
compressedCellContentPadding: compressedCellContentPadding,
|
|
36
|
+
mobileSizes: mobileSizes,
|
|
37
|
+
checkboxSize: checkboxSize
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
var _ref = process.env.NODE_ENV === "production" ? {
|
|
41
|
+
name: "gt2v1c-mobile",
|
|
42
|
+
styles: "thead{display:none;}tfoot{display:none;};label:mobile;"
|
|
43
|
+
} : {
|
|
44
|
+
name: "gt2v1c-mobile",
|
|
45
|
+
styles: "thead{display:none;}tfoot{display:none;};label:mobile;",
|
|
46
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
47
|
+
};
|
|
48
|
+
var _ref2 = process.env.NODE_ENV === "production" ? {
|
|
49
|
+
name: "18uoljc-auto",
|
|
50
|
+
styles: "table-layout:auto;label:auto;"
|
|
51
|
+
} : {
|
|
52
|
+
name: "18uoljc-auto",
|
|
53
|
+
styles: "table-layout:auto;label:auto;",
|
|
54
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
55
|
+
};
|
|
56
|
+
var _ref3 = process.env.NODE_ENV === "production" ? {
|
|
57
|
+
name: "1fm6zfw-fixed",
|
|
58
|
+
styles: "table-layout:fixed;label:fixed;"
|
|
59
|
+
} : {
|
|
60
|
+
name: "1fm6zfw-fixed",
|
|
61
|
+
styles: "table-layout:fixed;label:fixed;",
|
|
62
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
63
|
+
};
|
|
64
|
+
export var euiTableStyles = function euiTableStyles(euiThemeContext) {
|
|
65
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
66
|
+
var _euiTableVariables = euiTableVariables(euiThemeContext),
|
|
67
|
+
cellContentPadding = _euiTableVariables.cellContentPadding,
|
|
68
|
+
compressedCellContentPadding = _euiTableVariables.compressedCellContentPadding;
|
|
69
|
+
return {
|
|
70
|
+
euiTable: /*#__PURE__*/css(euiNumberFormat(euiThemeContext), " ", logicalCSS('width', '100%'), " border:none;border-collapse:collapse;background-color:", euiTheme.colors.emptyShade, ";;label:euiTable;"),
|
|
71
|
+
layout: {
|
|
72
|
+
fixed: _ref3,
|
|
73
|
+
auto: _ref2
|
|
74
|
+
},
|
|
75
|
+
/**
|
|
76
|
+
* 1. The padding on the `.euiTableCellContent` div allows the ellipsis to show if the
|
|
77
|
+
* content is truncated. If the padding was on the cell, the ellipsis would be cropped.
|
|
78
|
+
* 2. The `:where()` selector sets the specificity to 0, allowing consumers to more easily
|
|
79
|
+
* override our CSS if needed
|
|
80
|
+
*/
|
|
81
|
+
uncompressed: /*#__PURE__*/css("font-size:", euiFontSize(euiThemeContext, 's').fontSize, ";line-height:", euiFontSize(euiThemeContext, 'm').lineHeight, ";& :where(.euiTableCellContent){padding:", cellContentPadding, ";};label:uncompressed;"),
|
|
82
|
+
compressed: /*#__PURE__*/css(euiFontSize(euiThemeContext, 'xs'), "& :where(.euiTableCellContent){padding:", compressedCellContentPadding, ";};label:compressed;"),
|
|
83
|
+
/**
|
|
84
|
+
* Responsive/mobile vs desktop styles
|
|
85
|
+
* Individual row/cells handle their own desktop vs mobile styles
|
|
86
|
+
*/
|
|
87
|
+
desktop: /*#__PURE__*/css(";label:desktop;"),
|
|
88
|
+
mobile: _ref
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
// The table caption needs to not be absolutely positioned, because for some reason
|
|
93
|
+
// it causes weird layout issues/double borders when used within a <table>
|
|
94
|
+
// Also needs to be !important to override euiScreenReaderOnly absolute positioning
|
|
95
|
+
export var euiTableCaptionStyles = process.env.NODE_ENV === "production" ? {
|
|
96
|
+
name: "1hnio98-euiTableCaptionStyles",
|
|
97
|
+
styles: "position:relative!important;label:euiTableCaptionStyles;"
|
|
98
|
+
} : {
|
|
99
|
+
name: "1hnio98-euiTableCaptionStyles",
|
|
100
|
+
styles: "position:relative!important;label:euiTableCaptionStyles;",
|
|
101
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
102
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
/*
|
|
5
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
6
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
7
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
8
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
9
|
+
* Side Public License, v 1.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { css } from '@emotion/react';
|
|
13
|
+
import { euiFontSize, logicalCSS, logicalTextAlignCSS } from '../../global_styling';
|
|
14
|
+
import { euiTableVariables } from './table.styles';
|
|
15
|
+
export var euiTableHeaderFooterCellStyles = function euiTableHeaderFooterCellStyles(euiThemeContext) {
|
|
16
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
17
|
+
|
|
18
|
+
// euiFontSize returns an object, so we keep object notation here to merge into css``
|
|
19
|
+
var sharedStyles = _objectSpread(_objectSpread({}, euiFontSize(euiThemeContext, 'xs')), {}, {
|
|
20
|
+
fontWeight: euiTheme.font.weight.semiBold,
|
|
21
|
+
color: euiTheme.colors.title,
|
|
22
|
+
verticalAlign: 'middle'
|
|
23
|
+
});
|
|
24
|
+
return {
|
|
25
|
+
euiTableHeaderCell: /*#__PURE__*/css(sharedStyles, ";;label:euiTableHeaderCell;"),
|
|
26
|
+
euiTableHeaderCell__content: /*#__PURE__*/css("gap:", euiTheme.size.xs, ";;label:euiTableHeaderCell__content;"),
|
|
27
|
+
euiTableHeaderCell__button: /*#__PURE__*/css(logicalCSS('width', '100%'), " font-weight:inherit;&:hover,&:focus{color:", euiTheme.colors.primaryText, ";text-decoration:underline;};label:euiTableHeaderCell__button;"),
|
|
28
|
+
euiTableFooterCell: /*#__PURE__*/css(sharedStyles, " background-color:", euiTheme.colors.lightestShade, ";;label:euiTableFooterCell;")
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export var euiTableCellCheckboxStyles = function euiTableCellCheckboxStyles(euiThemeContext) {
|
|
32
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
33
|
+
var _euiTableVariables = euiTableVariables(euiThemeContext),
|
|
34
|
+
cellContentPadding = _euiTableVariables.cellContentPadding,
|
|
35
|
+
mobileSizes = _euiTableVariables.mobileSizes,
|
|
36
|
+
checkboxSize = _euiTableVariables.checkboxSize;
|
|
37
|
+
var sharedCheckboxStyles = "\n ".concat(logicalCSS('width', checkboxSize), "\n vertical-align: middle;\n ");
|
|
38
|
+
return {
|
|
39
|
+
euiTableHeaderCellCheckbox: /*#__PURE__*/css(sharedCheckboxStyles, logicalTextAlignCSS('left'), ";;label:euiTableHeaderCellCheckbox;"),
|
|
40
|
+
euiTableRowCellCheckbox: /*#__PURE__*/css(sharedCheckboxStyles, ";;label:euiTableRowCellCheckbox;"),
|
|
41
|
+
desktop: /*#__PURE__*/css(logicalCSS('border-vertical', euiTheme.border.thin), ";;label:desktop;"),
|
|
42
|
+
mobile: /*#__PURE__*/css("position:absolute;", logicalCSS('top', cellContentPadding), " ", logicalCSS('left', mobileSizes.checkbox.offset), ";;label:mobile;")
|
|
43
|
+
};
|
|
44
|
+
};
|
|
@@ -11,8 +11,10 @@ var _excluded = ["children", "align", "className", "width", "style"];
|
|
|
11
11
|
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import classNames from 'classnames';
|
|
14
|
-
import {
|
|
14
|
+
import { useEuiMemoizedStyles, LEFT_ALIGNMENT } from '../../services';
|
|
15
15
|
import { resolveWidthAsStyle } from './utils';
|
|
16
|
+
import { EuiTableCellContent } from './_table_cell_content';
|
|
17
|
+
import { euiTableHeaderFooterCellStyles } from './table_cells_shared.styles';
|
|
16
18
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
17
19
|
export var EuiTableFooterCell = function EuiTableFooterCell(_ref) {
|
|
18
20
|
var children = _ref.children,
|
|
@@ -23,17 +25,15 @@ export var EuiTableFooterCell = function EuiTableFooterCell(_ref) {
|
|
|
23
25
|
style = _ref.style,
|
|
24
26
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
25
27
|
var classes = classNames('euiTableFooterCell', className);
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
'euiTableCellContent--alignCenter': align === CENTER_ALIGNMENT
|
|
29
|
-
});
|
|
30
|
-
var styleObj = resolveWidthAsStyle(style, width);
|
|
28
|
+
var inlineStyles = resolveWidthAsStyle(style, width);
|
|
29
|
+
var styles = useEuiMemoizedStyles(euiTableHeaderFooterCellStyles);
|
|
31
30
|
return ___EmotionJSX("td", _extends({
|
|
31
|
+
css: styles.euiTableFooterCell,
|
|
32
32
|
className: classes,
|
|
33
|
-
style:
|
|
34
|
-
}, rest), ___EmotionJSX(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}, children))
|
|
33
|
+
style: inlineStyles
|
|
34
|
+
}, rest), ___EmotionJSX(EuiTableCellContent, {
|
|
35
|
+
align: align,
|
|
36
|
+
truncateText: true,
|
|
37
|
+
textOnly: true
|
|
38
|
+
}, children));
|
|
39
39
|
};
|
|
@@ -11,22 +11,29 @@ var _excluded = ["children", "align", "onSort", "isSorted", "isSortAscending", "
|
|
|
11
11
|
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import classNames from 'classnames';
|
|
14
|
+
import { useEuiMemoizedStyles, LEFT_ALIGNMENT } from '../../services';
|
|
15
|
+
import { EuiI18n } from '../i18n';
|
|
14
16
|
import { EuiScreenReaderOnly } from '../accessibility';
|
|
15
17
|
import { EuiIcon } from '../icon';
|
|
16
|
-
import { resolveWidthAsStyle } from './utils';
|
|
17
18
|
import { EuiInnerText } from '../inner_text';
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
19
|
+
import { resolveWidthAsStyle } from './utils';
|
|
20
|
+
import { useEuiTableIsResponsive } from './mobile/responsive_context';
|
|
21
|
+
import { EuiTableCellContent } from './_table_cell_content';
|
|
22
|
+
import { euiTableHeaderFooterCellStyles } from './table_cells_shared.styles';
|
|
20
23
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
21
24
|
var CellContents = function CellContents(_ref) {
|
|
22
25
|
var className = _ref.className,
|
|
26
|
+
align = _ref.align,
|
|
23
27
|
description = _ref.description,
|
|
24
28
|
children = _ref.children,
|
|
25
29
|
isSorted = _ref.isSorted,
|
|
26
30
|
isSortAscending = _ref.isSortAscending,
|
|
27
31
|
showSortMsg = _ref.showSortMsg;
|
|
28
|
-
return ___EmotionJSX(
|
|
29
|
-
className: className
|
|
32
|
+
return ___EmotionJSX(EuiTableCellContent, {
|
|
33
|
+
className: className,
|
|
34
|
+
align: align,
|
|
35
|
+
textOnly: false,
|
|
36
|
+
truncateText: null
|
|
30
37
|
}, ___EmotionJSX(EuiInnerText, null, function (ref, innerText) {
|
|
31
38
|
return ___EmotionJSX(EuiI18n, {
|
|
32
39
|
token: "euiTableHeaderCell.titleTextWithDesc",
|
|
@@ -39,7 +46,7 @@ var CellContents = function CellContents(_ref) {
|
|
|
39
46
|
return ___EmotionJSX("span", {
|
|
40
47
|
title: description ? titleTextWithDesc : innerText,
|
|
41
48
|
ref: ref,
|
|
42
|
-
className: "
|
|
49
|
+
className: "eui-textTruncate"
|
|
43
50
|
}, children);
|
|
44
51
|
});
|
|
45
52
|
}), description && ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("span", null, description)), showSortMsg && isSorted && ___EmotionJSX(EuiIcon, {
|
|
@@ -57,27 +64,30 @@ export var EuiTableHeaderCell = function EuiTableHeaderCell(_ref2) {
|
|
|
57
64
|
isSortAscending = _ref2.isSortAscending,
|
|
58
65
|
className = _ref2.className,
|
|
59
66
|
scope = _ref2.scope,
|
|
60
|
-
|
|
61
|
-
mobileOptions = _ref2$mobileOptions === void 0 ? {
|
|
62
|
-
show: true
|
|
63
|
-
} : _ref2$mobileOptions,
|
|
67
|
+
mobileOptions = _ref2.mobileOptions,
|
|
64
68
|
width = _ref2.width,
|
|
65
69
|
style = _ref2.style,
|
|
66
70
|
readOnly = _ref2.readOnly,
|
|
67
71
|
description = _ref2.description,
|
|
68
72
|
rest = _objectWithoutProperties(_ref2, _excluded);
|
|
69
|
-
var
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
});
|
|
77
|
-
var styleObj = resolveWidthAsStyle(style, width);
|
|
73
|
+
var styles = useEuiMemoizedStyles(euiTableHeaderFooterCellStyles);
|
|
74
|
+
var isResponsive = useEuiTableIsResponsive();
|
|
75
|
+
var hideForDesktop = !isResponsive && (mobileOptions === null || mobileOptions === void 0 ? void 0 : mobileOptions.only);
|
|
76
|
+
var hideForMobile = isResponsive && (mobileOptions === null || mobileOptions === void 0 ? void 0 : mobileOptions.show) === false;
|
|
77
|
+
if (hideForDesktop || hideForMobile) return null;
|
|
78
|
+
var classes = classNames('euiTableHeaderCell', className);
|
|
79
|
+
var inlineStyles = resolveWidthAsStyle(style, width);
|
|
78
80
|
var CellComponent = children ? 'th' : 'td';
|
|
79
81
|
var cellScope = CellComponent === 'th' ? scope !== null && scope !== void 0 ? scope : 'col' : undefined; // `scope` is only valid on `th` elements
|
|
80
82
|
|
|
83
|
+
var cellContents = ___EmotionJSX(CellContents, {
|
|
84
|
+
css: styles.euiTableHeaderCell__content,
|
|
85
|
+
align: align,
|
|
86
|
+
description: description,
|
|
87
|
+
showSortMsg: true,
|
|
88
|
+
isSorted: isSorted,
|
|
89
|
+
isSortAscending: isSortAscending
|
|
90
|
+
}, children);
|
|
81
91
|
if (onSort || isSorted) {
|
|
82
92
|
var buttonClasses = classNames('euiTableHeaderButton', {
|
|
83
93
|
'euiTableHeaderButton-isSorted': isSorted
|
|
@@ -86,39 +96,27 @@ export var EuiTableHeaderCell = function EuiTableHeaderCell(_ref2) {
|
|
|
86
96
|
if (isSorted) {
|
|
87
97
|
ariaSortValue = isSortAscending ? 'ascending' : 'descending';
|
|
88
98
|
}
|
|
89
|
-
var cellContents = ___EmotionJSX(CellContents, {
|
|
90
|
-
className: contentClasses,
|
|
91
|
-
description: description,
|
|
92
|
-
showSortMsg: true,
|
|
93
|
-
children: children,
|
|
94
|
-
isSorted: isSorted,
|
|
95
|
-
isSortAscending: isSortAscending
|
|
96
|
-
});
|
|
97
99
|
return ___EmotionJSX(CellComponent, _extends({
|
|
100
|
+
css: styles.euiTableHeaderCell,
|
|
98
101
|
className: classes,
|
|
99
102
|
scope: cellScope,
|
|
100
103
|
role: "columnheader",
|
|
101
104
|
"aria-sort": ariaSortValue,
|
|
102
105
|
"aria-live": "polite",
|
|
103
|
-
style:
|
|
106
|
+
style: inlineStyles
|
|
104
107
|
}, rest), onSort && !readOnly ? ___EmotionJSX("button", {
|
|
105
108
|
type: "button",
|
|
109
|
+
css: styles.euiTableHeaderCell__button,
|
|
106
110
|
className: buttonClasses,
|
|
107
111
|
onClick: onSort,
|
|
108
112
|
"data-test-subj": "tableHeaderSortButton"
|
|
109
113
|
}, cellContents) : cellContents);
|
|
110
114
|
}
|
|
111
115
|
return ___EmotionJSX(CellComponent, _extends({
|
|
116
|
+
css: styles.euiTableHeaderCell,
|
|
112
117
|
className: classes,
|
|
113
118
|
scope: cellScope,
|
|
114
119
|
role: "columnheader",
|
|
115
|
-
style:
|
|
116
|
-
}, rest),
|
|
117
|
-
className: contentClasses,
|
|
118
|
-
description: description,
|
|
119
|
-
showSortMsg: false,
|
|
120
|
-
children: children,
|
|
121
|
-
isSorted: isSorted,
|
|
122
|
-
isSortAscending: isSortAscending
|
|
123
|
-
}));
|
|
120
|
+
style: inlineStyles
|
|
121
|
+
}, rest), cellContents);
|
|
124
122
|
};
|
|
@@ -11,7 +11,9 @@ var _excluded = ["children", "className", "scope", "style", "width"];
|
|
|
11
11
|
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import classNames from 'classnames';
|
|
14
|
+
import { useEuiMemoizedStyles } from '../../services';
|
|
14
15
|
import { resolveWidthAsStyle } from './utils';
|
|
16
|
+
import { euiTableCellCheckboxStyles } from './table_cells_shared.styles';
|
|
15
17
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
16
18
|
export var EuiTableHeaderCellCheckbox = function EuiTableHeaderCellCheckbox(_ref) {
|
|
17
19
|
var children = _ref.children,
|
|
@@ -22,11 +24,13 @@ export var EuiTableHeaderCellCheckbox = function EuiTableHeaderCellCheckbox(_ref
|
|
|
22
24
|
width = _ref.width,
|
|
23
25
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
24
26
|
var classes = classNames('euiTableHeaderCellCheckbox', className);
|
|
25
|
-
var
|
|
27
|
+
var styles = useEuiMemoizedStyles(euiTableCellCheckboxStyles);
|
|
28
|
+
var inlineStyles = resolveWidthAsStyle(style, width);
|
|
26
29
|
return ___EmotionJSX("th", _extends({
|
|
30
|
+
css: styles.euiTableHeaderCellCheckbox,
|
|
27
31
|
className: classes,
|
|
28
32
|
scope: scope,
|
|
29
|
-
style:
|
|
33
|
+
style: inlineStyles
|
|
30
34
|
}, rest), ___EmotionJSX("div", {
|
|
31
35
|
className: "euiTableCellContent"
|
|
32
36
|
}, children));
|
|
@@ -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 = ["children", "className", "isSelected", "isSelectable", "hasActions", "isExpandedRow", "isExpandable", "onClick"];
|
|
3
|
+
var _excluded = ["children", "className", "hasSelection", "isSelected", "isSelectable", "hasActions", "isExpandedRow", "isExpandable", "onClick"];
|
|
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
|
|
@@ -11,11 +11,14 @@ var _excluded = ["children", "className", "isSelected", "isSelectable", "hasActi
|
|
|
11
11
|
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import classNames from 'classnames';
|
|
14
|
-
import { keys } from '../../services';
|
|
14
|
+
import { keys, useEuiMemoizedStyles } from '../../services';
|
|
15
|
+
import { useEuiTableIsResponsive } from './mobile/responsive_context';
|
|
16
|
+
import { euiTableRowStyles } from './table_row.styles';
|
|
15
17
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
16
18
|
export var EuiTableRow = function EuiTableRow(_ref) {
|
|
17
19
|
var children = _ref.children,
|
|
18
20
|
className = _ref.className,
|
|
21
|
+
hasSelection = _ref.hasSelection,
|
|
19
22
|
isSelected = _ref.isSelected,
|
|
20
23
|
isSelectable = _ref.isSelectable,
|
|
21
24
|
hasActions = _ref.hasActions,
|
|
@@ -23,6 +26,9 @@ export var EuiTableRow = function EuiTableRow(_ref) {
|
|
|
23
26
|
isExpandable = _ref.isExpandable,
|
|
24
27
|
onClick = _ref.onClick,
|
|
25
28
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
29
|
+
var isResponsive = useEuiTableIsResponsive();
|
|
30
|
+
var styles = useEuiMemoizedStyles(euiTableRowStyles);
|
|
31
|
+
var cssStyles = isResponsive ? [styles.euiTableRow, styles.mobile.mobile, isSelected && styles.mobile.selected, isExpandedRow && styles.mobile.expanded, (hasActions === true || isExpandable || isExpandedRow) && styles.mobile.hasRightColumn, hasSelection && styles.mobile.hasLeftColumn] : [styles.euiTableRow, styles.desktop.desktop, isSelected && styles.desktop.selected, isExpandedRow && styles.desktop.expanded, onClick && styles.desktop.clickable, isExpandedRow && hasSelection && styles.desktop.checkboxOffset];
|
|
26
32
|
var classes = classNames('euiTableRow', className, {
|
|
27
33
|
'euiTableRow-isSelectable': isSelectable,
|
|
28
34
|
'euiTableRow-isSelected': isSelected,
|
|
@@ -33,6 +39,7 @@ export var EuiTableRow = function EuiTableRow(_ref) {
|
|
|
33
39
|
});
|
|
34
40
|
if (!onClick) {
|
|
35
41
|
return ___EmotionJSX("tr", _extends({
|
|
42
|
+
css: cssStyles,
|
|
36
43
|
className: classes
|
|
37
44
|
}, rest), children);
|
|
38
45
|
}
|
|
@@ -47,6 +54,7 @@ export var EuiTableRow = function EuiTableRow(_ref) {
|
|
|
47
54
|
}
|
|
48
55
|
};
|
|
49
56
|
return ___EmotionJSX("tr", _extends({
|
|
57
|
+
css: cssStyles,
|
|
50
58
|
className: classes,
|
|
51
59
|
onClick: onClick,
|
|
52
60
|
onKeyDown: onKeyDown,
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
+
var _templateObject;
|
|
3
|
+
/*
|
|
4
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
5
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
6
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
7
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
8
|
+
* Side Public License, v 1.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { css, keyframes } from '@emotion/react';
|
|
12
|
+
import { tint, shade, transparentize } from '../../services';
|
|
13
|
+
import { euiCanAnimate, euiBackgroundColor, logicalCSS } from '../../global_styling';
|
|
14
|
+
import { euiShadow } from '../../themes/amsterdam/global_styling/mixins';
|
|
15
|
+
import { euiTableVariables } from './table.styles';
|
|
16
|
+
export var euiTableRowStyles = function euiTableRowStyles(euiThemeContext) {
|
|
17
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
18
|
+
var rowColors = _rowColorVariables(euiThemeContext);
|
|
19
|
+
var expandedAnimationCss = _expandedRowAnimation(euiThemeContext);
|
|
20
|
+
var _euiTableVariables = euiTableVariables(euiThemeContext),
|
|
21
|
+
cellContentPadding = _euiTableVariables.cellContentPadding,
|
|
22
|
+
mobileSizes = _euiTableVariables.mobileSizes,
|
|
23
|
+
checkboxSize = _euiTableVariables.checkboxSize;
|
|
24
|
+
return {
|
|
25
|
+
euiTableRow: /*#__PURE__*/css(";label:euiTableRow;"),
|
|
26
|
+
desktop: {
|
|
27
|
+
desktop: /*#__PURE__*/css("&:hover{background-color:", rowColors.hover, ";};label:desktop;"),
|
|
28
|
+
expanded: /*#__PURE__*/css("background-color:", rowColors.hover, ";", expandedAnimationCss, ";;label:expanded;"),
|
|
29
|
+
clickable: /*#__PURE__*/css("&:hover{background-color:", rowColors.clickable.hover, ";cursor:pointer;}&:focus{background-color:", rowColors.clickable.focus, ";};label:clickable;"),
|
|
30
|
+
selected: /*#__PURE__*/css("&,&+.euiTableRow-isExpandedRow{background-color:", rowColors.selected.color, ";}&:hover,&:hover+.euiTableRow-isExpandedRow{background-color:", rowColors.selected.hover, ";};label:selected;"),
|
|
31
|
+
// Offset expanded & selectable rows by the checkbox width to line up content with the 2nd column
|
|
32
|
+
// Set on the `<td>` because padding can't be applied to `<tr>` elements directly
|
|
33
|
+
checkboxOffset: /*#__PURE__*/css(".euiTableRowCell:first-child{", logicalCSS('padding-left', checkboxSize), ";};label:checkboxOffset;")
|
|
34
|
+
},
|
|
35
|
+
mobile: {
|
|
36
|
+
mobile: /*#__PURE__*/css("position:relative;display:flex;flex-wrap:wrap;padding:", cellContentPadding, ";", logicalCSS('margin-bottom', cellContentPadding), euiShadow(euiThemeContext, 's'), " background-color:", euiBackgroundColor(euiThemeContext, 'plain'), ";border-radius:", euiTheme.border.radius.medium, ";;label:mobile;"),
|
|
37
|
+
selected: /*#__PURE__*/css("&,&+.euiTableRow-isExpandedRow{background-color:", rowColors.selected.color, ";};label:selected;"),
|
|
38
|
+
/**
|
|
39
|
+
* Left column offset (no border)
|
|
40
|
+
* Used for selection checkbox, which will be absolutely positioned
|
|
41
|
+
*/
|
|
42
|
+
hasLeftColumn: /*#__PURE__*/css(logicalCSS('padding-left', mobileSizes.checkbox.width), ";;label:hasLeftColumn;"),
|
|
43
|
+
/**
|
|
44
|
+
* Right column styles + border
|
|
45
|
+
* Used for cell actions and row expander arrow
|
|
46
|
+
*/
|
|
47
|
+
hasRightColumn: /*#__PURE__*/css(logicalCSS('padding-right', mobileSizes.actions.width), " &::after{content:'';position:absolute;", logicalCSS('vertical', 0), " ", logicalCSS('right', mobileSizes.actions.width), " ", logicalCSS('width', euiTheme.border.width.thin), " background-color:", euiTheme.border.color, ";};label:hasRightColumn;"),
|
|
48
|
+
/**
|
|
49
|
+
* Bottom of card - expanded rows
|
|
50
|
+
*/
|
|
51
|
+
expanded: /*#__PURE__*/css(logicalCSS('margin-top', "-".concat(mobileSizes.actions.offset)), logicalCSS('padding-left', cellContentPadding), " ", logicalCSS('border-top', euiTheme.border.thin), " ", logicalCSS('border-top-left-radius', 0), " ", logicalCSS('border-top-right-radius', 0), " .euiTableRowCell{", logicalCSS('width', '100%'), ";}", expandedAnimationCss, ";;label:expanded;")
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
var _expandedRowAnimation = function _expandedRowAnimation(_ref) {
|
|
56
|
+
var euiTheme = _ref.euiTheme;
|
|
57
|
+
// Do not attempt to animate to height auto - down that road dragons lie
|
|
58
|
+
// @see https://github.com/elastic/eui/pull/6826
|
|
59
|
+
var expandRow = keyframes(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n 0% {\n opacity: 0;\n transform: translateY(-", ");\n }\n 100% {\n opacity: 1;\n transform: translateY(0);\n }\n "])), euiTheme.size.m);
|
|
60
|
+
|
|
61
|
+
// Animation must be on the contents div inside, not the row itself
|
|
62
|
+
return /*#__PURE__*/css(euiCanAnimate, "{.euiTableCellContent{animation:", euiTheme.animation.fast, " ", euiTheme.animation.resistance, " 1 normal none ", expandRow, ";}}");
|
|
63
|
+
};
|
|
64
|
+
var _rowColorVariables = function _rowColorVariables(_ref2) {
|
|
65
|
+
var euiTheme = _ref2.euiTheme,
|
|
66
|
+
colorMode = _ref2.colorMode;
|
|
67
|
+
return {
|
|
68
|
+
hover: colorMode === 'DARK' ? euiTheme.colors.lightestShade : tint(euiTheme.colors.lightestShade, 0.5),
|
|
69
|
+
selected: {
|
|
70
|
+
color: colorMode === 'DARK' ? shade(euiTheme.colors.primary, 0.7) : tint(euiTheme.colors.primary, 0.96),
|
|
71
|
+
hover: colorMode === 'DARK' ? shade(euiTheme.colors.primary, 0.75) : tint(euiTheme.colors.primary, 0.9)
|
|
72
|
+
},
|
|
73
|
+
clickable: {
|
|
74
|
+
hover: transparentize(euiTheme.colors.primary, 0.05),
|
|
75
|
+
focus: transparentize(euiTheme.colors.primary, 0.1)
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["align", "children", "className", "truncateText", "setScopeRow", "
|
|
5
|
+
var _excluded = ["align", "children", "className", "truncateText", "setScopeRow", "textOnly", "hasActions", "isExpander", "style", "width", "valign", "mobileOptions"];
|
|
5
6
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
6
7
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
7
8
|
/*
|
|
@@ -12,22 +13,21 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
12
13
|
* Side Public License, v 1.
|
|
13
14
|
*/
|
|
14
15
|
|
|
15
|
-
import React
|
|
16
|
+
import React from 'react';
|
|
16
17
|
import classNames from 'classnames';
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import { EuiTextBlockTruncate } from '../text_truncate';
|
|
18
|
+
import { useEuiMemoizedStyles, LEFT_ALIGNMENT } from '../../services';
|
|
19
|
+
import { useEuiTableIsResponsive } from './mobile/responsive_context';
|
|
20
20
|
import { resolveWidthAsStyle } from './utils';
|
|
21
|
+
import { EuiTableCellContent } from './_table_cell_content';
|
|
22
|
+
import { euiTableRowCellStyles } from './table_row_cell.styles';
|
|
21
23
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
22
24
|
export var EuiTableRowCell = function EuiTableRowCell(_ref) {
|
|
23
|
-
var _mobileOptions$showOn, _mobileOptions$trunca;
|
|
24
25
|
var _ref$align = _ref.align,
|
|
25
26
|
align = _ref$align === void 0 ? LEFT_ALIGNMENT : _ref$align,
|
|
26
27
|
children = _ref.children,
|
|
27
28
|
className = _ref.className,
|
|
28
29
|
truncateText = _ref.truncateText,
|
|
29
30
|
setScopeRow = _ref.setScopeRow,
|
|
30
|
-
showOnHover = _ref.showOnHover,
|
|
31
31
|
_ref$textOnly = _ref.textOnly,
|
|
32
32
|
textOnly = _ref$textOnly === void 0 ? true : _ref$textOnly,
|
|
33
33
|
hasActions = _ref.hasActions,
|
|
@@ -36,87 +36,56 @@ export var EuiTableRowCell = function EuiTableRowCell(_ref) {
|
|
|
36
36
|
width = _ref.width,
|
|
37
37
|
_ref$valign = _ref.valign,
|
|
38
38
|
valign = _ref$valign === void 0 ? 'middle' : _ref$valign,
|
|
39
|
-
|
|
40
|
-
mobileOptions = _ref$mobileOptions === void 0 ? {
|
|
41
|
-
show: true
|
|
42
|
-
} : _ref$mobileOptions,
|
|
39
|
+
mobileOptions = _ref.mobileOptions,
|
|
43
40
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
44
|
-
var
|
|
41
|
+
var isResponsive = useEuiTableIsResponsive();
|
|
42
|
+
var styles = useEuiMemoizedStyles(euiTableRowCellStyles);
|
|
43
|
+
var cssStyles = [styles.euiTableRowCell, setScopeRow && styles.rowHeader, isExpander && styles.isExpander, hasActions && styles.hasActions, styles[valign]].concat(_toConsumableArray(isResponsive ? [styles.mobile.mobile, (mobileOptions === null || mobileOptions === void 0 ? void 0 : mobileOptions.enlarge) && styles.mobile.enlarge, hasActions === 'custom' && styles.mobile.customActions, hasActions === true && styles.mobile.actions, isExpander && styles.mobile.expander] : [styles.desktop.desktop, hasActions && styles.desktop.actions]));
|
|
44
|
+
var cellClasses = classNames('euiTableRowCell', className, {
|
|
45
45
|
'euiTableRowCell--hasActions': hasActions,
|
|
46
|
-
'euiTableRowCell--isExpander': isExpander
|
|
47
|
-
'euiTableRowCell--hideForDesktop': mobileOptions.only,
|
|
48
|
-
'euiTableRowCell--enlargeForMobile': mobileOptions.enlarge
|
|
49
|
-
}, "euiTableRowCell--".concat(valign), valign));
|
|
50
|
-
var contentClasses = classNames('euiTableCellContent', className, {
|
|
51
|
-
'euiTableCellContent--alignRight': align === RIGHT_ALIGNMENT,
|
|
52
|
-
'euiTableCellContent--alignCenter': align === CENTER_ALIGNMENT,
|
|
53
|
-
'euiTableCellContent--showOnHover': showOnHover,
|
|
54
|
-
'euiTableCellContent--truncateText': truncateText === true,
|
|
55
|
-
// We're doing this rigamarole instead of creating `euiTableCellContent--textOnly` for BWC
|
|
56
|
-
// purposes for the time-being.
|
|
57
|
-
'euiTableCellContent--overflowingContent': textOnly !== true
|
|
46
|
+
'euiTableRowCell--isExpander': isExpander
|
|
58
47
|
});
|
|
59
|
-
var
|
|
60
|
-
|
|
61
|
-
'euiTableCellContent--alignCenter': mobileOptions.align === CENTER_ALIGNMENT || align === CENTER_ALIGNMENT,
|
|
62
|
-
'euiTableCellContent--showOnHover': (_mobileOptions$showOn = mobileOptions.showOnHover) !== null && _mobileOptions$showOn !== void 0 ? _mobileOptions$showOn : showOnHover,
|
|
63
|
-
'euiTableCellContent--truncateText': (_mobileOptions$trunca = mobileOptions.truncateText) !== null && _mobileOptions$trunca !== void 0 ? _mobileOptions$trunca : truncateText,
|
|
64
|
-
// We're doing this rigamarole instead of creating `euiTableCellContent--textOnly` for BWC
|
|
65
|
-
// purposes for the time-being.
|
|
66
|
-
'euiTableCellContent--overflowingContent': mobileOptions.textOnly !== true || textOnly !== true
|
|
67
|
-
});
|
|
68
|
-
var childClasses = classNames({
|
|
69
|
-
euiTableCellContent__text: textOnly === true,
|
|
70
|
-
euiTableCellContent__hoverItem: showOnHover
|
|
71
|
-
});
|
|
72
|
-
var widthValue = useIsWithinBreakpoints(['xs', 's']) && mobileOptions.width ? mobileOptions.width : width;
|
|
48
|
+
var widthValue = isResponsive ? hasActions || isExpander ? undefined // On mobile, actions are shifted to a right column via CSS
|
|
49
|
+
: mobileOptions === null || mobileOptions === void 0 ? void 0 : mobileOptions.width : width;
|
|
73
50
|
var styleObj = resolveWidthAsStyle(style, widthValue);
|
|
74
|
-
var modifyChildren = useCallback(function (children) {
|
|
75
|
-
var modifiedChildren = children;
|
|
76
|
-
if (textOnly === true) {
|
|
77
|
-
modifiedChildren = ___EmotionJSX("span", {
|
|
78
|
-
className: childClasses
|
|
79
|
-
}, children);
|
|
80
|
-
} else if ( /*#__PURE__*/React.isValidElement(children)) {
|
|
81
|
-
modifiedChildren = React.Children.map(children, function (child) {
|
|
82
|
-
return /*#__PURE__*/React.cloneElement(child, {
|
|
83
|
-
className: classNames(child.props.className, childClasses)
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
if (isObject(truncateText) && truncateText.lines) {
|
|
88
|
-
modifiedChildren = ___EmotionJSX(EuiTextBlockTruncate, {
|
|
89
|
-
lines: truncateText.lines,
|
|
90
|
-
cloneElement: true
|
|
91
|
-
}, modifiedChildren);
|
|
92
|
-
}
|
|
93
|
-
return modifiedChildren;
|
|
94
|
-
}, [childClasses, textOnly, truncateText]);
|
|
95
|
-
var childrenNode = modifyChildren(children);
|
|
96
|
-
var hideForMobileClasses = 'euiTableRowCell--hideForMobile';
|
|
97
|
-
var showForMobileClasses = 'euiTableRowCell--hideForDesktop';
|
|
98
51
|
var Element = setScopeRow ? 'th' : 'td';
|
|
99
52
|
var sharedProps = _objectSpread({
|
|
100
53
|
scope: setScopeRow ? 'row' : undefined,
|
|
101
|
-
style: styleObj
|
|
54
|
+
style: styleObj,
|
|
55
|
+
css: cssStyles
|
|
102
56
|
}, rest);
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
57
|
+
var sharedContentProps = {
|
|
58
|
+
align: align,
|
|
59
|
+
textOnly: textOnly,
|
|
60
|
+
truncateText: truncateText,
|
|
61
|
+
hasActions: hasActions || isExpander
|
|
62
|
+
};
|
|
63
|
+
if (isResponsive) {
|
|
64
|
+
// Mobile view
|
|
65
|
+
if ((mobileOptions === null || mobileOptions === void 0 ? void 0 : mobileOptions.show) === false) {
|
|
66
|
+
return null;
|
|
67
|
+
} else {
|
|
68
|
+
var _mobileOptions$align, _mobileOptions$trunca, _mobileOptions$textOn;
|
|
69
|
+
return ___EmotionJSX(Element, _extends({
|
|
70
|
+
className: cellClasses
|
|
71
|
+
}, sharedProps), (mobileOptions === null || mobileOptions === void 0 ? void 0 : mobileOptions.header) && ___EmotionJSX("div", {
|
|
72
|
+
className: "euiTableRowCell__mobileHeader",
|
|
73
|
+
css: styles.euiTableRowCell__mobileHeader
|
|
74
|
+
}, mobileOptions.header), ___EmotionJSX(EuiTableCellContent, _extends({}, sharedContentProps, {
|
|
75
|
+
align: (_mobileOptions$align = mobileOptions === null || mobileOptions === void 0 ? void 0 : mobileOptions.align) !== null && _mobileOptions$align !== void 0 ? _mobileOptions$align : 'left' // Default to left aligned mobile cells, unless consumers specifically set an alignment for mobile
|
|
76
|
+
,
|
|
77
|
+
truncateText: (_mobileOptions$trunca = mobileOptions === null || mobileOptions === void 0 ? void 0 : mobileOptions.truncateText) !== null && _mobileOptions$trunca !== void 0 ? _mobileOptions$trunca : truncateText,
|
|
78
|
+
textOnly: (_mobileOptions$textOn = mobileOptions === null || mobileOptions === void 0 ? void 0 : mobileOptions.textOnly) !== null && _mobileOptions$textOn !== void 0 ? _mobileOptions$textOn : textOnly
|
|
79
|
+
}), (mobileOptions === null || mobileOptions === void 0 ? void 0 : mobileOptions.render) || children));
|
|
80
|
+
}
|
|
109
81
|
} else {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}, childrenNode)) : ___EmotionJSX("div", {
|
|
119
|
-
className: contentClasses
|
|
120
|
-
}, childrenNode));
|
|
82
|
+
// Desktop view
|
|
83
|
+
if (mobileOptions !== null && mobileOptions !== void 0 && mobileOptions.only) {
|
|
84
|
+
return null;
|
|
85
|
+
} else {
|
|
86
|
+
return ___EmotionJSX(Element, _extends({
|
|
87
|
+
className: cellClasses
|
|
88
|
+
}, sharedProps), ___EmotionJSX(EuiTableCellContent, sharedContentProps, children));
|
|
89
|
+
}
|
|
121
90
|
}
|
|
122
91
|
};
|