@elastic/eui 93.6.0 → 94.1.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 +123 -133
- package/es/components/basic_table/basic_table.styles.js +3 -17
- package/es/components/basic_table/collapsed_item_actions.js +11 -20
- package/es/components/basic_table/default_item_action.js +9 -16
- package/es/components/basic_table/expanded_item_actions.js +1 -2
- package/es/components/basic_table/in_memory_table.js +63 -78
- 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 +52 -0
- package/es/components/table/table_footer_cell.js +12 -12
- package/es/components/table/table_header_cell.js +58 -75
- 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 +667 -510
- package/i18ntokens.json +52 -52
- package/lib/components/basic_table/basic_table.js +122 -132
- package/lib/components/basic_table/basic_table.styles.js +5 -20
- package/lib/components/basic_table/collapsed_item_actions.js +11 -20
- package/lib/components/basic_table/default_item_action.js +12 -17
- package/lib/components/basic_table/expanded_item_actions.js +1 -2
- package/lib/components/basic_table/in_memory_table.js +63 -78
- 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 +58 -0
- package/lib/components/table/table_footer_cell.js +11 -11
- package/lib/components/table/table_header_cell.js +58 -75
- 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/collapsed_item_actions.js +11 -20
- package/optimize/es/components/basic_table/default_item_action.js +9 -16
- 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 +49 -0
- package/optimize/es/components/table/table_footer_cell.js +12 -12
- package/optimize/es/components/table/table_header_cell.js +57 -61
- 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/collapsed_item_actions.js +11 -20
- package/optimize/lib/components/basic_table/default_item_action.js +12 -17
- 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 +56 -0
- package/optimize/lib/components/table/table_footer_cell.js +11 -11
- package/optimize/lib/components/table/table_header_cell.js +57 -61
- 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 +2 -2
- package/src/components/index.scss +0 -1
- package/test-env/components/basic_table/basic_table.js +118 -131
- package/test-env/components/basic_table/basic_table.styles.js +5 -20
- package/test-env/components/basic_table/collapsed_item_actions.js +11 -20
- package/test-env/components/basic_table/default_item_action.js +12 -17
- package/test-env/components/basic_table/expanded_item_actions.js +1 -2
- package/test-env/components/basic_table/in_memory_table.js +63 -78
- 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 +56 -0
- package/test-env/components/table/table_footer_cell.js +11 -11
- package/test-env/components/table/table_header_cell.js +58 -75
- 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/date_picker/react-datepicker/LICENSE +0 -21
- package/src/components/date_picker/react-datepicker/README.md +0 -168
- 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/src/services/theme/README.md +0 -153
- package/src/test/README.md +0 -44
- package/test-env/components/table/table_header_button.js +0 -58
|
@@ -63,6 +63,11 @@ var EuiTableSortMobile = /*#__PURE__*/function (_Component) {
|
|
|
63
63
|
isPopoverOpen: false
|
|
64
64
|
});
|
|
65
65
|
});
|
|
66
|
+
// Aligns the button to the right even when it's the only element present
|
|
67
|
+
_defineProperty(_assertThisInitialized(_this), "euiTableSortMobileStyles", {
|
|
68
|
+
marginInlineStart: 'auto',
|
|
69
|
+
label: 'euiTableSortMobile'
|
|
70
|
+
});
|
|
66
71
|
return _this;
|
|
67
72
|
}
|
|
68
73
|
_createClass(EuiTableSortMobile, [{
|
|
@@ -104,7 +109,8 @@ var EuiTableSortMobile = /*#__PURE__*/function (_Component) {
|
|
|
104
109
|
}) : undefined
|
|
105
110
|
}));
|
|
106
111
|
return (0, _react2.jsx)("div", {
|
|
107
|
-
className: classes
|
|
112
|
+
className: classes,
|
|
113
|
+
css: this.euiTableSortMobileStyles
|
|
108
114
|
}, mobileSortPopover);
|
|
109
115
|
}
|
|
110
116
|
}]);
|
|
@@ -112,7 +118,6 @@ var EuiTableSortMobile = /*#__PURE__*/function (_Component) {
|
|
|
112
118
|
}(_react.Component);
|
|
113
119
|
exports.EuiTableSortMobile = EuiTableSortMobile;
|
|
114
120
|
EuiTableSortMobile.propTypes = {
|
|
115
|
-
className: _propTypes.default.string,
|
|
116
121
|
anchorPosition: _propTypes.default.any,
|
|
117
122
|
items: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
118
123
|
name: _propTypes.default.node.isRequired,
|
|
@@ -120,5 +125,9 @@ EuiTableSortMobile.propTypes = {
|
|
|
120
125
|
onSort: _propTypes.default.func,
|
|
121
126
|
isSorted: _propTypes.default.bool,
|
|
122
127
|
isSortAscending: _propTypes.default.bool
|
|
123
|
-
}).isRequired)
|
|
128
|
+
}).isRequired),
|
|
129
|
+
className: _propTypes.default.string,
|
|
130
|
+
"aria-label": _propTypes.default.string,
|
|
131
|
+
"data-test-subj": _propTypes.default.string,
|
|
132
|
+
css: _propTypes.default.any
|
|
124
133
|
};
|
|
@@ -7,8 +7,11 @@ exports.EuiTable = void 0;
|
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
+
var _services = require("../../services");
|
|
11
|
+
var _responsive_context = require("./mobile/responsive_context");
|
|
12
|
+
var _table = require("./table.styles");
|
|
10
13
|
var _react2 = require("@emotion/react");
|
|
11
|
-
var _excluded = ["children", "className", "compressed", "tableLayout", "
|
|
14
|
+
var _excluded = ["children", "className", "compressed", "tableLayout", "responsiveBreakpoint"];
|
|
12
15
|
/*
|
|
13
16
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
14
17
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -20,32 +23,39 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
20
23
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
21
24
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
22
25
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
23
|
-
var tableLayoutToClassMap = {
|
|
24
|
-
fixed: null,
|
|
25
|
-
auto: 'euiTable--auto'
|
|
26
|
-
};
|
|
27
26
|
var EuiTable = function EuiTable(_ref) {
|
|
28
27
|
var children = _ref.children,
|
|
29
28
|
className = _ref.className,
|
|
30
29
|
compressed = _ref.compressed,
|
|
31
30
|
_ref$tableLayout = _ref.tableLayout,
|
|
32
31
|
tableLayout = _ref$tableLayout === void 0 ? 'fixed' : _ref$tableLayout,
|
|
33
|
-
|
|
34
|
-
responsive = _ref$responsive === void 0 ? true : _ref$responsive,
|
|
32
|
+
responsiveBreakpoint = _ref.responsiveBreakpoint,
|
|
35
33
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
36
|
-
var
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
var isResponsive = (0, _responsive_context.useIsEuiTableResponsive)(responsiveBreakpoint);
|
|
35
|
+
var classes = (0, _classnames.default)('euiTable', className);
|
|
36
|
+
var styles = (0, _services.useEuiMemoizedStyles)(_table.euiTableStyles);
|
|
37
|
+
var cssStyles = [styles.euiTable, styles.layout[tableLayout], (!compressed || isResponsive) && styles.uncompressed, compressed && !isResponsive && styles.compressed, isResponsive ? styles.mobile : styles.desktop];
|
|
40
38
|
return (0, _react2.jsx)("table", _extends({
|
|
41
39
|
tabIndex: -1,
|
|
40
|
+
css: cssStyles,
|
|
42
41
|
className: classes
|
|
43
|
-
}, rest),
|
|
42
|
+
}, rest), (0, _react2.jsx)(_responsive_context.EuiTableIsResponsiveContext.Provider, {
|
|
43
|
+
value: isResponsive
|
|
44
|
+
}, children));
|
|
44
45
|
};
|
|
45
46
|
exports.EuiTable = EuiTable;
|
|
46
47
|
EuiTable.propTypes = {
|
|
47
48
|
compressed: _propTypes.default.bool,
|
|
48
|
-
|
|
49
|
+
/**
|
|
50
|
+
* Named breakpoint. Below this size, the table will collapse
|
|
51
|
+
* into responsive cards.
|
|
52
|
+
*
|
|
53
|
+
* Pass `false` to never collapse to a mobile view, or inversely,
|
|
54
|
+
* `true` to always render mobile-friendly cards.
|
|
55
|
+
*
|
|
56
|
+
* @default m
|
|
57
|
+
*/
|
|
58
|
+
responsiveBreakpoint: _propTypes.default.oneOfType([_propTypes.default.any.isRequired, _propTypes.default.bool.isRequired]),
|
|
49
59
|
/**
|
|
50
60
|
* Sets the table-layout CSS property
|
|
51
61
|
*/
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.euiTableVariables = exports.euiTableStyles = exports.euiTableCaptionStyles = void 0;
|
|
7
|
+
var _react = require("@emotion/react");
|
|
8
|
+
var _global_styling = require("../../global_styling");
|
|
9
|
+
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)."; } /*
|
|
10
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
11
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
12
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
13
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
14
|
+
* Side Public License, v 1.
|
|
15
|
+
*/
|
|
16
|
+
var euiTableVariables = function euiTableVariables(_ref4) {
|
|
17
|
+
var euiTheme = _ref4.euiTheme;
|
|
18
|
+
var cellContentPadding = euiTheme.size.s;
|
|
19
|
+
var compressedCellContentPadding = euiTheme.size.xs;
|
|
20
|
+
var mobileSizes = {
|
|
21
|
+
actions: {
|
|
22
|
+
width: euiTheme.size.xxl,
|
|
23
|
+
offset: (0, _global_styling.mathWithUnits)(cellContentPadding, function (x) {
|
|
24
|
+
return x * 2;
|
|
25
|
+
})
|
|
26
|
+
},
|
|
27
|
+
checkbox: {
|
|
28
|
+
width: (0, _global_styling.mathWithUnits)([euiTheme.size.xl, euiTheme.size.xs], function (x, y) {
|
|
29
|
+
return x + y;
|
|
30
|
+
}),
|
|
31
|
+
offset: (0, _global_styling.mathWithUnits)(cellContentPadding, function (x) {
|
|
32
|
+
return x / 2;
|
|
33
|
+
})
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
var checkboxSize = euiTheme.size.xl;
|
|
37
|
+
return {
|
|
38
|
+
cellContentPadding: cellContentPadding,
|
|
39
|
+
compressedCellContentPadding: compressedCellContentPadding,
|
|
40
|
+
mobileSizes: mobileSizes,
|
|
41
|
+
checkboxSize: checkboxSize
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
exports.euiTableVariables = euiTableVariables;
|
|
45
|
+
var _ref = process.env.NODE_ENV === "production" ? {
|
|
46
|
+
name: "gt2v1c-mobile",
|
|
47
|
+
styles: "thead{display:none;}tfoot{display:none;};label:mobile;"
|
|
48
|
+
} : {
|
|
49
|
+
name: "gt2v1c-mobile",
|
|
50
|
+
styles: "thead{display:none;}tfoot{display:none;};label:mobile;",
|
|
51
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
52
|
+
};
|
|
53
|
+
var _ref2 = process.env.NODE_ENV === "production" ? {
|
|
54
|
+
name: "18uoljc-auto",
|
|
55
|
+
styles: "table-layout:auto;label:auto;"
|
|
56
|
+
} : {
|
|
57
|
+
name: "18uoljc-auto",
|
|
58
|
+
styles: "table-layout:auto;label:auto;",
|
|
59
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
60
|
+
};
|
|
61
|
+
var _ref3 = process.env.NODE_ENV === "production" ? {
|
|
62
|
+
name: "1fm6zfw-fixed",
|
|
63
|
+
styles: "table-layout:fixed;label:fixed;"
|
|
64
|
+
} : {
|
|
65
|
+
name: "1fm6zfw-fixed",
|
|
66
|
+
styles: "table-layout:fixed;label:fixed;",
|
|
67
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
68
|
+
};
|
|
69
|
+
var euiTableStyles = function euiTableStyles(euiThemeContext) {
|
|
70
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
71
|
+
var _euiTableVariables = euiTableVariables(euiThemeContext),
|
|
72
|
+
cellContentPadding = _euiTableVariables.cellContentPadding,
|
|
73
|
+
compressedCellContentPadding = _euiTableVariables.compressedCellContentPadding;
|
|
74
|
+
return {
|
|
75
|
+
euiTable: /*#__PURE__*/(0, _react.css)((0, _global_styling.euiNumberFormat)(euiThemeContext), " ", (0, _global_styling.logicalCSS)('width', '100%'), " border:none;border-collapse:collapse;background-color:", euiTheme.colors.emptyShade, ";;label:euiTable;"),
|
|
76
|
+
layout: {
|
|
77
|
+
fixed: _ref3,
|
|
78
|
+
auto: _ref2
|
|
79
|
+
},
|
|
80
|
+
/**
|
|
81
|
+
* 1. The padding on the `.euiTableCellContent` div allows the ellipsis to show if the
|
|
82
|
+
* content is truncated. If the padding was on the cell, the ellipsis would be cropped.
|
|
83
|
+
* 2. The `:where()` selector sets the specificity to 0, allowing consumers to more easily
|
|
84
|
+
* override our CSS if needed
|
|
85
|
+
*/
|
|
86
|
+
uncompressed: /*#__PURE__*/(0, _react.css)("font-size:", (0, _global_styling.euiFontSize)(euiThemeContext, 's').fontSize, ";line-height:", (0, _global_styling.euiFontSize)(euiThemeContext, 'm').lineHeight, ";& :where(.euiTableCellContent){padding:", cellContentPadding, ";};label:uncompressed;"),
|
|
87
|
+
compressed: /*#__PURE__*/(0, _react.css)((0, _global_styling.euiFontSize)(euiThemeContext, 'xs'), "& :where(.euiTableCellContent){padding:", compressedCellContentPadding, ";};label:compressed;"),
|
|
88
|
+
/**
|
|
89
|
+
* Responsive/mobile vs desktop styles
|
|
90
|
+
* Individual row/cells handle their own desktop vs mobile styles
|
|
91
|
+
*/
|
|
92
|
+
desktop: /*#__PURE__*/(0, _react.css)(";label:desktop;"),
|
|
93
|
+
mobile: _ref
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
// The table caption needs to not be absolutely positioned, because for some reason
|
|
98
|
+
// it causes weird layout issues/double borders when used within a <table>
|
|
99
|
+
// Also needs to be !important to override euiScreenReaderOnly absolute positioning
|
|
100
|
+
exports.euiTableStyles = euiTableStyles;
|
|
101
|
+
var euiTableCaptionStyles = process.env.NODE_ENV === "production" ? {
|
|
102
|
+
name: "1hnio98-euiTableCaptionStyles",
|
|
103
|
+
styles: "position:relative!important;label:euiTableCaptionStyles;"
|
|
104
|
+
} : {
|
|
105
|
+
name: "1hnio98-euiTableCaptionStyles",
|
|
106
|
+
styles: "position:relative!important;label:euiTableCaptionStyles;",
|
|
107
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
108
|
+
};
|
|
109
|
+
exports.euiTableCaptionStyles = euiTableCaptionStyles;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.euiTableHeaderFooterCellStyles = exports.euiTableCellCheckboxStyles = void 0;
|
|
7
|
+
var _react = require("@emotion/react");
|
|
8
|
+
var _services = require("../../services");
|
|
9
|
+
var _global_styling = require("../../global_styling");
|
|
10
|
+
var _table = require("./table.styles");
|
|
11
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
12
|
+
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; }
|
|
13
|
+
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; }
|
|
14
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
15
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
16
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } /*
|
|
17
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
18
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
19
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
20
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
21
|
+
* Side Public License, v 1.
|
|
22
|
+
*/
|
|
23
|
+
var euiTableHeaderFooterCellStyles = function euiTableHeaderFooterCellStyles(euiThemeContext) {
|
|
24
|
+
var euiTheme = euiThemeContext.euiTheme,
|
|
25
|
+
colorMode = euiThemeContext.colorMode;
|
|
26
|
+
|
|
27
|
+
// euiFontSize returns an object, so we keep object notation here to merge into css``
|
|
28
|
+
var sharedStyles = _objectSpread(_objectSpread({}, (0, _global_styling.euiFontSize)(euiThemeContext, 'xs')), {}, {
|
|
29
|
+
fontWeight: euiTheme.font.weight.semiBold,
|
|
30
|
+
color: euiTheme.colors.title,
|
|
31
|
+
verticalAlign: 'middle'
|
|
32
|
+
});
|
|
33
|
+
return {
|
|
34
|
+
euiTableHeaderCell: /*#__PURE__*/(0, _react.css)(sharedStyles, ";;label:euiTableHeaderCell;"),
|
|
35
|
+
euiTableHeaderCell__content: /*#__PURE__*/(0, _react.css)("gap:", euiTheme.size.xs, ";;label:euiTableHeaderCell__content;"),
|
|
36
|
+
euiTableHeaderCell__button: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('width', '100%'), " font-weight:inherit;line-height:inherit;.euiTableSortIcon--sortable{color:", (0, _services.makeHighContrastColor)(
|
|
37
|
+
// Tint it arbitrarily high, the contrast util will take care of lowering back down to WCAG
|
|
38
|
+
(0, _services.tintOrShade)(euiTheme.colors.subduedText, 0.9, colorMode), 3 // 3:1 ratio from https://www.w3.org/WAI/WCAG22/Understanding/non-text-contrast.html
|
|
39
|
+
)(euiTheme.colors.emptyShade), ";}&:hover,&:focus{color:", euiTheme.colors.primaryText, ";text-decoration:underline;.euiTableSortIcon--sortable{color:", euiTheme.colors.primaryText, ";}};label:euiTableHeaderCell__button;"),
|
|
40
|
+
euiTableFooterCell: /*#__PURE__*/(0, _react.css)(sharedStyles, " background-color:", euiTheme.colors.lightestShade, ";;label:euiTableFooterCell;")
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
exports.euiTableHeaderFooterCellStyles = euiTableHeaderFooterCellStyles;
|
|
44
|
+
var euiTableCellCheckboxStyles = function euiTableCellCheckboxStyles(euiThemeContext) {
|
|
45
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
46
|
+
var _euiTableVariables = (0, _table.euiTableVariables)(euiThemeContext),
|
|
47
|
+
cellContentPadding = _euiTableVariables.cellContentPadding,
|
|
48
|
+
mobileSizes = _euiTableVariables.mobileSizes,
|
|
49
|
+
checkboxSize = _euiTableVariables.checkboxSize;
|
|
50
|
+
var sharedCheckboxStyles = "\n ".concat((0, _global_styling.logicalCSS)('width', checkboxSize), "\n vertical-align: middle;\n ");
|
|
51
|
+
return {
|
|
52
|
+
euiTableHeaderCellCheckbox: /*#__PURE__*/(0, _react.css)(sharedCheckboxStyles, (0, _global_styling.logicalTextAlignCSS)('left'), ";;label:euiTableHeaderCellCheckbox;"),
|
|
53
|
+
euiTableRowCellCheckbox: /*#__PURE__*/(0, _react.css)(sharedCheckboxStyles, ";;label:euiTableRowCellCheckbox;"),
|
|
54
|
+
desktop: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('border-vertical', euiTheme.border.thin), ";;label:desktop;"),
|
|
55
|
+
mobile: /*#__PURE__*/(0, _react.css)("position:absolute;", (0, _global_styling.logicalCSS)('top', cellContentPadding), " ", (0, _global_styling.logicalCSS)('left', mobileSizes.checkbox.offset), ";;label:mobile;")
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
exports.euiTableCellCheckboxStyles = euiTableCellCheckboxStyles;
|
|
@@ -9,6 +9,8 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
9
9
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
10
|
var _services = require("../../services");
|
|
11
11
|
var _utils = require("./utils");
|
|
12
|
+
var _table_cell_content = require("./_table_cell_content");
|
|
13
|
+
var _table_cells_shared = require("./table_cells_shared.styles");
|
|
12
14
|
var _react2 = require("@emotion/react");
|
|
13
15
|
var _excluded = ["children", "align", "className", "width", "style"];
|
|
14
16
|
/*
|
|
@@ -31,19 +33,17 @@ var EuiTableFooterCell = function EuiTableFooterCell(_ref) {
|
|
|
31
33
|
style = _ref.style,
|
|
32
34
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
33
35
|
var classes = (0, _classnames.default)('euiTableFooterCell', className);
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
'euiTableCellContent--alignCenter': align === _services.CENTER_ALIGNMENT
|
|
37
|
-
});
|
|
38
|
-
var styleObj = (0, _utils.resolveWidthAsStyle)(style, width);
|
|
36
|
+
var inlineStyles = (0, _utils.resolveWidthAsStyle)(style, width);
|
|
37
|
+
var styles = (0, _services.useEuiMemoizedStyles)(_table_cells_shared.euiTableHeaderFooterCellStyles);
|
|
39
38
|
return (0, _react2.jsx)("td", _extends({
|
|
39
|
+
css: styles.euiTableFooterCell,
|
|
40
40
|
className: classes,
|
|
41
|
-
style:
|
|
42
|
-
}, rest), (0, _react2.jsx)(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}, children))
|
|
41
|
+
style: inlineStyles
|
|
42
|
+
}, rest), (0, _react2.jsx)(_table_cell_content.EuiTableCellContent, {
|
|
43
|
+
align: align,
|
|
44
|
+
truncateText: true,
|
|
45
|
+
textOnly: true
|
|
46
|
+
}, children));
|
|
47
47
|
};
|
|
48
48
|
exports.EuiTableFooterCell = EuiTableFooterCell;
|
|
49
49
|
EuiTableFooterCell.propTypes = {
|
|
@@ -7,12 +7,15 @@ exports.EuiTableHeaderCell = void 0;
|
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
+
var _services = require("../../services");
|
|
11
|
+
var _i18n = require("../i18n");
|
|
10
12
|
var _accessibility = require("../accessibility");
|
|
11
13
|
var _icon = require("../icon");
|
|
12
|
-
var _utils = require("./utils");
|
|
13
14
|
var _inner_text = require("../inner_text");
|
|
14
|
-
var
|
|
15
|
-
var
|
|
15
|
+
var _utils = require("./utils");
|
|
16
|
+
var _responsive_context = require("./mobile/responsive_context");
|
|
17
|
+
var _table_cell_content = require("./_table_cell_content");
|
|
18
|
+
var _table_cells_shared = require("./table_cells_shared.styles");
|
|
16
19
|
var _react2 = require("@emotion/react");
|
|
17
20
|
var _excluded = ["children", "align", "onSort", "isSorted", "isSortAscending", "className", "scope", "mobileOptions", "width", "style", "readOnly", "description"];
|
|
18
21
|
/*
|
|
@@ -28,13 +31,17 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
28
31
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
29
32
|
var CellContents = function CellContents(_ref) {
|
|
30
33
|
var className = _ref.className,
|
|
34
|
+
align = _ref.align,
|
|
31
35
|
description = _ref.description,
|
|
32
36
|
children = _ref.children,
|
|
37
|
+
canSort = _ref.canSort,
|
|
33
38
|
isSorted = _ref.isSorted,
|
|
34
|
-
isSortAscending = _ref.isSortAscending
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
39
|
+
isSortAscending = _ref.isSortAscending;
|
|
40
|
+
return (0, _react2.jsx)(_table_cell_content.EuiTableCellContent, {
|
|
41
|
+
className: className,
|
|
42
|
+
align: align,
|
|
43
|
+
textOnly: false,
|
|
44
|
+
truncateText: null
|
|
38
45
|
}, (0, _react2.jsx)(_inner_text.EuiInnerText, null, function (ref, innerText) {
|
|
39
46
|
return (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
40
47
|
token: "euiTableHeaderCell.titleTextWithDesc",
|
|
@@ -47,14 +54,19 @@ var CellContents = function CellContents(_ref) {
|
|
|
47
54
|
return (0, _react2.jsx)("span", {
|
|
48
55
|
title: description ? titleTextWithDesc : innerText,
|
|
49
56
|
ref: ref,
|
|
50
|
-
className: "
|
|
57
|
+
className: "eui-textTruncate"
|
|
51
58
|
}, children);
|
|
52
59
|
});
|
|
53
|
-
}), description && (0, _react2.jsx)(_accessibility.EuiScreenReaderOnly, null, (0, _react2.jsx)("span", null, description)),
|
|
60
|
+
}), description && (0, _react2.jsx)(_accessibility.EuiScreenReaderOnly, null, (0, _react2.jsx)("span", null, description)), isSorted ? (0, _react2.jsx)(_icon.EuiIcon, {
|
|
54
61
|
className: "euiTableSortIcon",
|
|
55
62
|
type: isSortAscending ? 'sortUp' : 'sortDown',
|
|
56
63
|
size: "m"
|
|
57
|
-
}))
|
|
64
|
+
}) : canSort ? (0, _react2.jsx)(_icon.EuiIcon, {
|
|
65
|
+
className: "euiTableSortIcon euiTableSortIcon--sortable",
|
|
66
|
+
type: "sortable",
|
|
67
|
+
size: "m",
|
|
68
|
+
color: "subdued" // Tinted a bit further via CSS
|
|
69
|
+
}) : null);
|
|
58
70
|
};
|
|
59
71
|
var EuiTableHeaderCell = function EuiTableHeaderCell(_ref2) {
|
|
60
72
|
var children = _ref2.children,
|
|
@@ -65,70 +77,54 @@ var EuiTableHeaderCell = function EuiTableHeaderCell(_ref2) {
|
|
|
65
77
|
isSortAscending = _ref2.isSortAscending,
|
|
66
78
|
className = _ref2.className,
|
|
67
79
|
scope = _ref2.scope,
|
|
68
|
-
|
|
69
|
-
mobileOptions = _ref2$mobileOptions === void 0 ? {
|
|
70
|
-
show: true
|
|
71
|
-
} : _ref2$mobileOptions,
|
|
80
|
+
mobileOptions = _ref2.mobileOptions,
|
|
72
81
|
width = _ref2.width,
|
|
73
82
|
style = _ref2.style,
|
|
74
83
|
readOnly = _ref2.readOnly,
|
|
75
84
|
description = _ref2.description,
|
|
76
85
|
rest = _objectWithoutProperties(_ref2, _excluded);
|
|
77
|
-
var
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
});
|
|
85
|
-
var styleObj = (0, _utils.resolveWidthAsStyle)(style, width);
|
|
86
|
+
var styles = (0, _services.useEuiMemoizedStyles)(_table_cells_shared.euiTableHeaderFooterCellStyles);
|
|
87
|
+
var isResponsive = (0, _responsive_context.useEuiTableIsResponsive)();
|
|
88
|
+
var hideForDesktop = !isResponsive && (mobileOptions === null || mobileOptions === void 0 ? void 0 : mobileOptions.only);
|
|
89
|
+
var hideForMobile = isResponsive && (mobileOptions === null || mobileOptions === void 0 ? void 0 : mobileOptions.show) === false;
|
|
90
|
+
if (hideForDesktop || hideForMobile) return null;
|
|
91
|
+
var classes = (0, _classnames.default)('euiTableHeaderCell', className);
|
|
92
|
+
var inlineStyles = (0, _utils.resolveWidthAsStyle)(style, width);
|
|
86
93
|
var CellComponent = children ? 'th' : 'td';
|
|
87
94
|
var cellScope = CellComponent === 'th' ? scope !== null && scope !== void 0 ? scope : 'col' : undefined; // `scope` is only valid on `th` elements
|
|
88
95
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
ariaSortValue = isSortAscending ? 'ascending' : 'descending';
|
|
96
|
-
}
|
|
97
|
-
var cellContents = (0, _react2.jsx)(CellContents, {
|
|
98
|
-
className: contentClasses,
|
|
99
|
-
description: description,
|
|
100
|
-
showSortMsg: true,
|
|
101
|
-
children: children,
|
|
102
|
-
isSorted: isSorted,
|
|
103
|
-
isSortAscending: isSortAscending
|
|
104
|
-
});
|
|
105
|
-
return (0, _react2.jsx)(CellComponent, _extends({
|
|
106
|
-
className: classes,
|
|
107
|
-
scope: cellScope,
|
|
108
|
-
role: "columnheader",
|
|
109
|
-
"aria-sort": ariaSortValue,
|
|
110
|
-
"aria-live": "polite",
|
|
111
|
-
style: styleObj
|
|
112
|
-
}, rest), onSort && !readOnly ? (0, _react2.jsx)("button", {
|
|
113
|
-
type: "button",
|
|
114
|
-
className: buttonClasses,
|
|
115
|
-
onClick: onSort,
|
|
116
|
-
"data-test-subj": "tableHeaderSortButton"
|
|
117
|
-
}, cellContents) : cellContents);
|
|
96
|
+
var canSort = !!(onSort && !readOnly);
|
|
97
|
+
var ariaSortValue;
|
|
98
|
+
if (isSorted) {
|
|
99
|
+
ariaSortValue = isSortAscending ? 'ascending' : 'descending';
|
|
100
|
+
} else if (canSort) {
|
|
101
|
+
ariaSortValue = 'none';
|
|
118
102
|
}
|
|
103
|
+
var cellContentsProps = {
|
|
104
|
+
css: styles.euiTableHeaderCell__content,
|
|
105
|
+
align: align,
|
|
106
|
+
description: description,
|
|
107
|
+
canSort: canSort,
|
|
108
|
+
isSorted: isSorted,
|
|
109
|
+
isSortAscending: isSortAscending,
|
|
110
|
+
children: children
|
|
111
|
+
};
|
|
119
112
|
return (0, _react2.jsx)(CellComponent, _extends({
|
|
113
|
+
css: styles.euiTableHeaderCell,
|
|
120
114
|
className: classes,
|
|
121
115
|
scope: cellScope,
|
|
122
116
|
role: "columnheader",
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
117
|
+
"aria-sort": ariaSortValue,
|
|
118
|
+
style: inlineStyles
|
|
119
|
+
}, rest), canSort ? (0, _react2.jsx)("button", {
|
|
120
|
+
type: "button",
|
|
121
|
+
css: styles.euiTableHeaderCell__button,
|
|
122
|
+
className: (0, _classnames.default)('euiTableHeaderButton', {
|
|
123
|
+
'euiTableHeaderButton-isSorted': isSorted
|
|
124
|
+
}),
|
|
125
|
+
onClick: onSort,
|
|
126
|
+
"data-test-subj": "tableHeaderSortButton"
|
|
127
|
+
}, (0, _react2.jsx)(CellContents, cellContentsProps)) : (0, _react2.jsx)(CellContents, cellContentsProps));
|
|
132
128
|
};
|
|
133
129
|
exports.EuiTableHeaderCell = EuiTableHeaderCell;
|
|
134
130
|
EuiTableHeaderCell.propTypes = {
|
|
@@ -139,20 +135,7 @@ EuiTableHeaderCell.propTypes = {
|
|
|
139
135
|
align: _propTypes.default.any,
|
|
140
136
|
isSortAscending: _propTypes.default.bool,
|
|
141
137
|
isSorted: _propTypes.default.bool,
|
|
142
|
-
|
|
143
|
-
* Mobile options for displaying differently at small screens
|
|
144
|
-
*/
|
|
145
|
-
mobileOptions: _propTypes.default.shape({
|
|
146
|
-
/**
|
|
147
|
-
* If false, will not render the column at all for mobile
|
|
148
|
-
*/
|
|
149
|
-
show: _propTypes.default.bool,
|
|
150
|
-
/**
|
|
151
|
-
* Only show for mobile? If true, will not render the column at all
|
|
152
|
-
* for desktop
|
|
153
|
-
*/
|
|
154
|
-
only: _propTypes.default.bool
|
|
155
|
-
}),
|
|
138
|
+
mobileOptions: _propTypes.default.any,
|
|
156
139
|
onSort: _propTypes.default.func,
|
|
157
140
|
scope: _propTypes.default.oneOf(["col", "row", "colgroup", "rowgroup"]),
|
|
158
141
|
width: _propTypes.default.oneOfType([_propTypes.default.string.isRequired, _propTypes.default.number.isRequired]),
|
|
@@ -7,7 +7,9 @@ exports.EuiTableHeaderCellCheckbox = void 0;
|
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
+
var _services = require("../../services");
|
|
10
11
|
var _utils = require("./utils");
|
|
12
|
+
var _table_cells_shared = require("./table_cells_shared.styles");
|
|
11
13
|
var _react2 = require("@emotion/react");
|
|
12
14
|
var _excluded = ["children", "className", "scope", "style", "width"];
|
|
13
15
|
/*
|
|
@@ -30,11 +32,13 @@ var EuiTableHeaderCellCheckbox = function EuiTableHeaderCellCheckbox(_ref) {
|
|
|
30
32
|
width = _ref.width,
|
|
31
33
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
32
34
|
var classes = (0, _classnames.default)('euiTableHeaderCellCheckbox', className);
|
|
33
|
-
var
|
|
35
|
+
var styles = (0, _services.useEuiMemoizedStyles)(_table_cells_shared.euiTableCellCheckboxStyles);
|
|
36
|
+
var inlineStyles = (0, _utils.resolveWidthAsStyle)(style, width);
|
|
34
37
|
return (0, _react2.jsx)("th", _extends({
|
|
38
|
+
css: styles.euiTableHeaderCellCheckbox,
|
|
35
39
|
className: classes,
|
|
36
40
|
scope: scope,
|
|
37
|
-
style:
|
|
41
|
+
style: inlineStyles
|
|
38
42
|
}, rest), (0, _react2.jsx)("div", {
|
|
39
43
|
className: "euiTableCellContent"
|
|
40
44
|
}, children));
|
|
@@ -8,8 +8,10 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
10
|
var _services = require("../../services");
|
|
11
|
+
var _responsive_context = require("./mobile/responsive_context");
|
|
12
|
+
var _table_row = require("./table_row.styles");
|
|
11
13
|
var _react2 = require("@emotion/react");
|
|
12
|
-
var _excluded = ["children", "className", "isSelected", "isSelectable", "hasActions", "isExpandedRow", "isExpandable", "onClick"];
|
|
14
|
+
var _excluded = ["children", "className", "hasSelection", "isSelected", "isSelectable", "hasActions", "isExpandedRow", "isExpandable", "onClick"];
|
|
13
15
|
/*
|
|
14
16
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
15
17
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -24,6 +26,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
24
26
|
var EuiTableRow = function EuiTableRow(_ref) {
|
|
25
27
|
var children = _ref.children,
|
|
26
28
|
className = _ref.className,
|
|
29
|
+
hasSelection = _ref.hasSelection,
|
|
27
30
|
isSelected = _ref.isSelected,
|
|
28
31
|
isSelectable = _ref.isSelectable,
|
|
29
32
|
hasActions = _ref.hasActions,
|
|
@@ -31,6 +34,9 @@ var EuiTableRow = function EuiTableRow(_ref) {
|
|
|
31
34
|
isExpandable = _ref.isExpandable,
|
|
32
35
|
onClick = _ref.onClick,
|
|
33
36
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
37
|
+
var isResponsive = (0, _responsive_context.useEuiTableIsResponsive)();
|
|
38
|
+
var styles = (0, _services.useEuiMemoizedStyles)(_table_row.euiTableRowStyles);
|
|
39
|
+
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];
|
|
34
40
|
var classes = (0, _classnames.default)('euiTableRow', className, {
|
|
35
41
|
'euiTableRow-isSelectable': isSelectable,
|
|
36
42
|
'euiTableRow-isSelected': isSelected,
|
|
@@ -41,6 +47,7 @@ var EuiTableRow = function EuiTableRow(_ref) {
|
|
|
41
47
|
});
|
|
42
48
|
if (!onClick) {
|
|
43
49
|
return (0, _react2.jsx)("tr", _extends({
|
|
50
|
+
css: cssStyles,
|
|
44
51
|
className: classes
|
|
45
52
|
}, rest), children);
|
|
46
53
|
}
|
|
@@ -55,6 +62,7 @@ var EuiTableRow = function EuiTableRow(_ref) {
|
|
|
55
62
|
}
|
|
56
63
|
};
|
|
57
64
|
return (0, _react2.jsx)("tr", _extends({
|
|
65
|
+
css: cssStyles,
|
|
58
66
|
className: classes,
|
|
59
67
|
onClick: onClick,
|
|
60
68
|
onKeyDown: onKeyDown,
|
|
@@ -70,7 +78,11 @@ EuiTableRow.propTypes = {
|
|
|
70
78
|
css: _propTypes.default.any,
|
|
71
79
|
/**
|
|
72
80
|
* Indicates if the table has a single column of checkboxes for selecting
|
|
73
|
-
* rows (
|
|
81
|
+
* rows (used for mobile styling)
|
|
82
|
+
*/
|
|
83
|
+
hasSelection: _propTypes.default.bool,
|
|
84
|
+
/**
|
|
85
|
+
* Indicates that the current row's checkbox is selectable / not disabled
|
|
74
86
|
*/
|
|
75
87
|
isSelectable: _propTypes.default.bool,
|
|
76
88
|
/**
|
|
@@ -78,10 +90,10 @@ EuiTableRow.propTypes = {
|
|
|
78
90
|
*/
|
|
79
91
|
isSelected: _propTypes.default.bool,
|
|
80
92
|
/**
|
|
81
|
-
* Indicates if the table has a dedicated column for
|
|
82
|
-
* (
|
|
93
|
+
* Indicates if the table has a dedicated column for actions
|
|
94
|
+
* (used for mobile styling and desktop action hover behavior)
|
|
83
95
|
*/
|
|
84
|
-
hasActions: _propTypes.default.bool,
|
|
96
|
+
hasActions: _propTypes.default.oneOfType([_propTypes.default.bool.isRequired, _propTypes.default.oneOf(["custom"])]),
|
|
85
97
|
/**
|
|
86
98
|
* Indicates if the row will have an expanded row
|
|
87
99
|
*/
|