@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
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
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); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.DefaultItemAction = void 0;
|
|
7
|
-
var _react =
|
|
8
|
-
var _predicate = require("../../services/predicate");
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _button = require("../button");
|
|
10
10
|
var _tool_tip = require("../tool_tip");
|
|
11
11
|
var _accessibility = require("../../services/accessibility");
|
|
12
12
|
var _accessibility2 = require("../accessibility");
|
|
13
13
|
var _action_types = require("./action_types");
|
|
14
14
|
var _react2 = require("@emotion/react");
|
|
15
|
-
function
|
|
15
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
16
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
16
17
|
/*
|
|
17
18
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
18
19
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -29,26 +30,20 @@ var DefaultItemAction = function DefaultItemAction(_ref) {
|
|
|
29
30
|
if (!action.onClick && !action.href) {
|
|
30
31
|
throw new Error("Cannot render item action [".concat(action.name, "]. Missing required 'onClick' callback\n or 'href' string. If you want to provide a custom action control, make sure to define the 'render' callback"));
|
|
31
32
|
}
|
|
32
|
-
var onClick =
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
var buttonIcon = action.icon;
|
|
41
|
-
var icon;
|
|
42
|
-
if (buttonIcon) {
|
|
43
|
-
icon = (0, _predicate.isString)(buttonIcon) ? buttonIcon : buttonIcon(item);
|
|
44
|
-
}
|
|
45
|
-
var button;
|
|
33
|
+
var onClick = (0, _react.useCallback)(function (event) {
|
|
34
|
+
if (!action.onClick) return;
|
|
35
|
+
event.persist(); // TODO: Remove once React 16 support is dropped
|
|
36
|
+
action.onClick(item, event);
|
|
37
|
+
}, [action.onClick, item]);
|
|
38
|
+
var color = action.color ? (0, _action_types.callWithItemIfFunction)(item)(action.color) : 'primary';
|
|
39
|
+
var icon = action.icon ? (0, _action_types.callWithItemIfFunction)(item)(action.icon) : undefined;
|
|
46
40
|
var actionContent = (0, _action_types.callWithItemIfFunction)(item)(action.name);
|
|
47
41
|
var tooltipContent = (0, _action_types.callWithItemIfFunction)(item)(action.description);
|
|
48
42
|
var href = (0, _action_types.callWithItemIfFunction)(item)(action.href);
|
|
49
43
|
var dataTestSubj = (0, _action_types.callWithItemIfFunction)(item)(action['data-test-subj']);
|
|
50
44
|
var ariaLabelId = (0, _accessibility.useGeneratedHtmlId)();
|
|
51
45
|
var ariaLabelledBy;
|
|
46
|
+
var button;
|
|
52
47
|
if (action.type === 'icon') {
|
|
53
48
|
if (!icon) {
|
|
54
49
|
throw new Error("Cannot render item action [".concat(action.name, "]. It is configured to render as an icon but no\n icon is provided. Make sure to set the 'icon' property of the action"));
|
|
@@ -25,7 +25,6 @@ var ExpandedItemActions = function ExpandedItemActions(_ref) {
|
|
|
25
25
|
item = _ref.item,
|
|
26
26
|
actionsDisabled = _ref.actionsDisabled,
|
|
27
27
|
className = _ref.className;
|
|
28
|
-
var moreThanThree = actions.length > 2;
|
|
29
28
|
return (0, _react2.jsx)(_react.default.Fragment, null, actions.reduce(function (tools, action, index) {
|
|
30
29
|
var available = action.available ? action.available(item) : true;
|
|
31
30
|
if (!available) {
|
|
@@ -34,7 +33,7 @@ var ExpandedItemActions = function ExpandedItemActions(_ref) {
|
|
|
34
33
|
var enabled = action.enabled == null || action.enabled(item);
|
|
35
34
|
var key = "item_action_".concat(itemId, "_").concat(index);
|
|
36
35
|
var classes = (0, _classnames.default)(className, {
|
|
37
|
-
|
|
36
|
+
'euiBasicTableAction-showOnHover': action.showOnHover
|
|
38
37
|
});
|
|
39
38
|
if ((0, _action_types.isCustomItemAction)(action)) {
|
|
40
39
|
// custom action has a render function
|
|
@@ -17,7 +17,7 @@ var _component_defaults = require("../provider/component_defaults");
|
|
|
17
17
|
var _react2 = require("@emotion/react");
|
|
18
18
|
var _excluded = ["schema"],
|
|
19
19
|
_excluded2 = ["onChange"],
|
|
20
|
-
_excluded3 = ["columns", "loading", "message", "error", "selection", "
|
|
20
|
+
_excluded3 = ["columns", "loading", "message", "error", "selection", "compressed", "pagination", "sorting", "itemIdToExpandedRowMap", "itemId", "rowProps", "cellProps", "tableLayout", "items", "search", "searchFormat", "onTableChange", "executeQueryOptions", "allowNeutralSort", "childrenBetween"];
|
|
21
21
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
22
22
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
23
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -385,8 +385,6 @@ var EuiInMemoryTable = /*#__PURE__*/function (_Component) {
|
|
|
385
385
|
message = _this$props2.message,
|
|
386
386
|
error = _this$props2.error,
|
|
387
387
|
selection = _this$props2.selection,
|
|
388
|
-
isSelectable = _this$props2.isSelectable,
|
|
389
|
-
hasActions = _this$props2.hasActions,
|
|
390
388
|
compressed = _this$props2.compressed,
|
|
391
389
|
hasPagination = _this$props2.pagination,
|
|
392
390
|
hasSorting = _this$props2.sorting,
|
|
@@ -443,8 +441,6 @@ var EuiInMemoryTable = /*#__PURE__*/function (_Component) {
|
|
|
443
441
|
pagination: pagination,
|
|
444
442
|
sorting: sorting,
|
|
445
443
|
selection: selection,
|
|
446
|
-
isSelectable: isSelectable,
|
|
447
|
-
hasActions: hasActions,
|
|
448
444
|
onChange: this.onTableChange,
|
|
449
445
|
error: error,
|
|
450
446
|
loading: loading,
|
|
@@ -524,7 +520,6 @@ var EuiInMemoryTable = /*#__PURE__*/function (_Component) {
|
|
|
524
520
|
exports.EuiInMemoryTable = EuiInMemoryTable;
|
|
525
521
|
_defineProperty(EuiInMemoryTable, "contextType", _component_defaults.EuiComponentDefaultsContext);
|
|
526
522
|
_defineProperty(EuiInMemoryTable, "defaultProps", {
|
|
527
|
-
responsive: true,
|
|
528
523
|
tableLayout: 'fixed',
|
|
529
524
|
searchFormat: 'eql'
|
|
530
525
|
});
|
|
@@ -595,16 +590,22 @@ EuiInMemoryTable.propTypes = {
|
|
|
595
590
|
* Defines whether the user can sort on this column. If a function is provided, this function returns the value to sort against
|
|
596
591
|
*/
|
|
597
592
|
sortable: _propTypes.default.oneOfType([_propTypes.default.bool.isRequired, _propTypes.default.func.isRequired]),
|
|
598
|
-
isExpander: _propTypes.default.bool,
|
|
599
593
|
/**
|
|
600
|
-
*
|
|
601
|
-
*
|
|
594
|
+
* Disables the user's ability to change the sort, but will still
|
|
595
|
+
* show the current sort direction in the column header
|
|
602
596
|
*/
|
|
603
|
-
|
|
597
|
+
readOnly: _propTypes.default.bool,
|
|
604
598
|
/**
|
|
605
599
|
* Defines the horizontal alignment of the column
|
|
600
|
+
* @default left
|
|
606
601
|
*/
|
|
607
602
|
align: _propTypes.default.any,
|
|
603
|
+
/**
|
|
604
|
+
* Creates a text wrapper around cell content that helps word break or truncate
|
|
605
|
+
* long text correctly.
|
|
606
|
+
* @default true
|
|
607
|
+
*/
|
|
608
|
+
textOnly: _propTypes.default.bool,
|
|
608
609
|
/**
|
|
609
610
|
* Indicates whether this column should truncate overflowing text content.
|
|
610
611
|
* - Set to `true` to enable single-line truncation.
|
|
@@ -614,6 +615,10 @@ EuiInMemoryTable.propTypes = {
|
|
|
614
615
|
truncateText: _propTypes.default.oneOfType([_propTypes.default.bool.isRequired, _propTypes.default.shape({
|
|
615
616
|
lines: _propTypes.default.number.isRequired
|
|
616
617
|
}).isRequired]),
|
|
618
|
+
/**
|
|
619
|
+
* Allows configuring custom render options or appearances for column cells
|
|
620
|
+
* when the table responsively collapses into a mobile-friendly view
|
|
621
|
+
*/
|
|
617
622
|
mobileOptions: _propTypes.default.shape({
|
|
618
623
|
render: _propTypes.default.func
|
|
619
624
|
}),
|
|
@@ -626,48 +631,31 @@ EuiInMemoryTable.propTypes = {
|
|
|
626
631
|
*/
|
|
627
632
|
footer: _propTypes.default.oneOfType([_propTypes.default.string.isRequired, _propTypes.default.element.isRequired, _propTypes.default.func.isRequired]),
|
|
628
633
|
/**
|
|
629
|
-
*
|
|
634
|
+
* If passing `itemIdToExpandedRowMap` to your table, set this flag to `true`
|
|
635
|
+
* for the custom column or cell used to toggle the expanded row.
|
|
630
636
|
*/
|
|
631
|
-
|
|
637
|
+
isExpander: _propTypes.default.bool,
|
|
632
638
|
className: _propTypes.default.string,
|
|
633
639
|
"aria-label": _propTypes.default.string,
|
|
634
640
|
"data-test-subj": _propTypes.default.string,
|
|
635
641
|
css: _propTypes.default.any
|
|
636
642
|
}).isRequired, _propTypes.default.shape({
|
|
643
|
+
className: _propTypes.default.string,
|
|
644
|
+
"aria-label": _propTypes.default.string,
|
|
645
|
+
"data-test-subj": _propTypes.default.string,
|
|
646
|
+
css: _propTypes.default.any,
|
|
637
647
|
/**
|
|
638
|
-
|
|
639
|
-
|
|
648
|
+
* A function that computes the value for each item and renders it
|
|
649
|
+
*/
|
|
640
650
|
render: _propTypes.default.func.isRequired,
|
|
641
651
|
/**
|
|
642
|
-
|
|
643
|
-
|
|
652
|
+
* The display name of the column
|
|
653
|
+
*/
|
|
644
654
|
name: _propTypes.default.node,
|
|
645
655
|
/**
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
/**
|
|
650
|
-
* If provided, allows this column to be sorted on. Must return the value to sort against.
|
|
651
|
-
*/
|
|
652
|
-
sortable: _propTypes.default.func,
|
|
653
|
-
/**
|
|
654
|
-
* A CSS width property. Hints for the required width of the column
|
|
655
|
-
*/
|
|
656
|
-
width: _propTypes.default.string,
|
|
657
|
-
/**
|
|
658
|
-
* Indicates whether this column should truncate its content when it doesn't fit
|
|
659
|
-
*/
|
|
660
|
-
truncateText: _propTypes.default.bool,
|
|
661
|
-
isExpander: _propTypes.default.bool,
|
|
662
|
-
align: _propTypes.default.any,
|
|
663
|
-
/**
|
|
664
|
-
* Disables the user's ability to change the sort but still shows the current direction
|
|
665
|
-
*/
|
|
666
|
-
readOnly: _propTypes.default.bool,
|
|
667
|
-
className: _propTypes.default.string,
|
|
668
|
-
"aria-label": _propTypes.default.string,
|
|
669
|
-
"data-test-subj": _propTypes.default.string,
|
|
670
|
-
css: _propTypes.default.any
|
|
656
|
+
* If provided, allows this column to be sorted on. Must return the value to sort against.
|
|
657
|
+
*/
|
|
658
|
+
sortable: _propTypes.default.func
|
|
671
659
|
}).isRequired, _propTypes.default.shape({
|
|
672
660
|
/**
|
|
673
661
|
* An array of one of the objects: #DefaultItemAction or #CustomItemAction
|
|
@@ -696,10 +684,14 @@ EuiInMemoryTable.propTypes = {
|
|
|
696
684
|
*/
|
|
697
685
|
description: _propTypes.default.oneOfType([_propTypes.default.string.isRequired, _propTypes.default.func.isRequired]).isRequired,
|
|
698
686
|
/**
|
|
699
|
-
* A handler function to execute the action
|
|
687
|
+
* A handler function to execute the action. Passes back the current row
|
|
688
|
+
* item as the first argument, and the originating React click event
|
|
689
|
+
* as a second argument.
|
|
700
690
|
*/
|
|
701
691
|
/**
|
|
702
|
-
* A handler function to execute the action
|
|
692
|
+
* A handler function to execute the action. Passes back the current row
|
|
693
|
+
* item as the first argument, and the originating React click event
|
|
694
|
+
* as a second argument.
|
|
703
695
|
*/
|
|
704
696
|
onClick: _propTypes.default.func,
|
|
705
697
|
href: _propTypes.default.oneOfType([_propTypes.default.string.isRequired, _propTypes.default.func.isRequired]),
|
|
@@ -718,8 +710,33 @@ EuiInMemoryTable.propTypes = {
|
|
|
718
710
|
* A callback function that determines whether the action is enabled
|
|
719
711
|
*/
|
|
720
712
|
enabled: _propTypes.default.func,
|
|
721
|
-
isPrimary: _propTypes.default.bool,
|
|
722
713
|
"data-test-subj": _propTypes.default.oneOfType([_propTypes.default.string.isRequired, _propTypes.default.func.isRequired]),
|
|
714
|
+
/**
|
|
715
|
+
* If more than 3 actions are passed, 2 primary actions will show (on hover)
|
|
716
|
+
* next to an expansion menu of all actions.
|
|
717
|
+
*
|
|
718
|
+
* On mobile, primary actions will be tucked away in the expansion menu for space.
|
|
719
|
+
*/
|
|
720
|
+
/**
|
|
721
|
+
* If more than 3 actions are passed, 2 primary actions will show (on hover)
|
|
722
|
+
* next to an expansion menu of all actions.
|
|
723
|
+
*
|
|
724
|
+
* On mobile, primary actions will be tucked away in the expansion menu for space.
|
|
725
|
+
*/
|
|
726
|
+
isPrimary: _propTypes.default.bool,
|
|
727
|
+
/**
|
|
728
|
+
* Allows only showing the action on mouse hover or keyboard focus.
|
|
729
|
+
* If more than 3 actions are passed, this will always be true for `isPrimary` actions.
|
|
730
|
+
*
|
|
731
|
+
* Has no effect on mobile, or if `hasActions` is not set.
|
|
732
|
+
*/
|
|
733
|
+
/**
|
|
734
|
+
* Allows only showing the action on mouse hover or keyboard focus.
|
|
735
|
+
* If more than 3 actions are passed, this will always be true for `isPrimary` actions.
|
|
736
|
+
*
|
|
737
|
+
* Has no effect on mobile, or if `hasActions` is not set.
|
|
738
|
+
*/
|
|
739
|
+
showOnHover: _propTypes.default.bool,
|
|
723
740
|
/**
|
|
724
741
|
* Associates an icon with the button
|
|
725
742
|
*/
|
|
@@ -736,21 +753,12 @@ EuiInMemoryTable.propTypes = {
|
|
|
736
753
|
/**
|
|
737
754
|
* A callback that defines whether the action is enabled
|
|
738
755
|
*/
|
|
739
|
-
enabled: _propTypes.default.func
|
|
740
|
-
isPrimary: _propTypes.default.bool
|
|
756
|
+
enabled: _propTypes.default.func
|
|
741
757
|
}).isRequired]).isRequired).isRequired,
|
|
742
758
|
/**
|
|
743
759
|
* The display name of the column
|
|
744
760
|
*/
|
|
745
|
-
name: _propTypes.default.node
|
|
746
|
-
/**
|
|
747
|
-
* A description of the column (will be presented as a title over the column header
|
|
748
|
-
*/
|
|
749
|
-
description: _propTypes.default.string,
|
|
750
|
-
/**
|
|
751
|
-
* A CSS width property. Hints for the required width of the column
|
|
752
|
-
*/
|
|
753
|
-
width: _propTypes.default.string
|
|
761
|
+
name: _propTypes.default.node
|
|
754
762
|
}).isRequired]).isRequired),
|
|
755
763
|
/**
|
|
756
764
|
* Error message to display
|
|
@@ -773,9 +781,6 @@ EuiInMemoryTable.propTypes = {
|
|
|
773
781
|
* Indicates which column should be used as the identifying cell in each row. Should match a "field" prop in FieldDataColumn
|
|
774
782
|
*/
|
|
775
783
|
rowHeader: _propTypes.default.string,
|
|
776
|
-
hasActions: _propTypes.default.bool,
|
|
777
|
-
isExpandable: _propTypes.default.bool,
|
|
778
|
-
isSelectable: _propTypes.default.bool,
|
|
779
784
|
/**
|
|
780
785
|
* Provides an infinite loading indicator
|
|
781
786
|
*/
|
|
@@ -783,13 +788,6 @@ EuiInMemoryTable.propTypes = {
|
|
|
783
788
|
* Provides an infinite loading indicator
|
|
784
789
|
*/
|
|
785
790
|
loading: _propTypes.default.bool,
|
|
786
|
-
/**
|
|
787
|
-
* If true, will convert table to cards in mobile view
|
|
788
|
-
*/
|
|
789
|
-
/**
|
|
790
|
-
* If true, will convert table to cards in mobile view
|
|
791
|
-
*/
|
|
792
|
-
responsive: _propTypes.default.bool,
|
|
793
791
|
/**
|
|
794
792
|
* Applied to `EuiTableRow`
|
|
795
793
|
*/
|
|
@@ -839,19 +837,6 @@ EuiInMemoryTable.propTypes = {
|
|
|
839
837
|
* Sets the table-layout CSS property. Note that auto tableLayout prevents truncateText from working properly.
|
|
840
838
|
*/
|
|
841
839
|
tableLayout: _propTypes.default.oneOf(["fixed", "auto"]),
|
|
842
|
-
/**
|
|
843
|
-
* Applied to table cells. Any cell using a render function will set this to be false.
|
|
844
|
-
*
|
|
845
|
-
* Creates a text wrapper around cell content that helps word break or truncate
|
|
846
|
-
* long text correctly.
|
|
847
|
-
*/
|
|
848
|
-
/**
|
|
849
|
-
* Applied to table cells. Any cell using a render function will set this to be false.
|
|
850
|
-
*
|
|
851
|
-
* Creates a text wrapper around cell content that helps word break or truncate
|
|
852
|
-
* long text correctly.
|
|
853
|
-
*/
|
|
854
|
-
textOnly: _propTypes.default.bool,
|
|
855
840
|
message: _propTypes.default.node,
|
|
856
841
|
/**
|
|
857
842
|
* Configures #Search.
|
|
@@ -63,7 +63,13 @@ EuiComponentDefaultsProvider.propTypes = {
|
|
|
63
63
|
*
|
|
64
64
|
* These defaults will be inherited all table and grid components that utilize EuiTablePagination.
|
|
65
65
|
*/
|
|
66
|
-
EuiTablePagination: _propTypes.default.any
|
|
66
|
+
EuiTablePagination: _propTypes.default.any,
|
|
67
|
+
/**
|
|
68
|
+
* Provide a global configuration for EuiTable's `responsiveBreakpoint` prop. Defaults to `'s'`.
|
|
69
|
+
*
|
|
70
|
+
* Defaults will be inherited by all `EuiBasicTable`s and `EuiInMemoryTable`s.
|
|
71
|
+
*/
|
|
72
|
+
EuiTable: _propTypes.default.any
|
|
67
73
|
})
|
|
68
74
|
};
|
|
69
75
|
var useComponentDefaults = function useComponentDefaults() {
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
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); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.EuiTableCellContent = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
+
var _services = require("../../services");
|
|
12
|
+
var _predicate = require("../../services/predicate");
|
|
13
|
+
var _text_truncate = require("../text_truncate");
|
|
14
|
+
var _responsive_context = require("./mobile/responsive_context");
|
|
15
|
+
var _table_cell_content = require("./_table_cell_content.styles");
|
|
16
|
+
var _react2 = require("@emotion/react");
|
|
17
|
+
var _excluded = ["children", "className", "align", "textOnly", "truncateText", "hasActions"];
|
|
18
|
+
/*
|
|
19
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
20
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
21
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
22
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
23
|
+
* Side Public License, v 1.
|
|
24
|
+
*/
|
|
25
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
26
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
27
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
28
|
+
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); }
|
|
29
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
30
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
31
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
32
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
33
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
34
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
35
|
+
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; }
|
|
36
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
37
|
+
var EuiTableCellContent = function EuiTableCellContent(_ref) {
|
|
38
|
+
var children = _ref.children,
|
|
39
|
+
className = _ref.className,
|
|
40
|
+
_ref$align = _ref.align,
|
|
41
|
+
align = _ref$align === void 0 ? _services.LEFT_ALIGNMENT : _ref$align,
|
|
42
|
+
textOnly = _ref.textOnly,
|
|
43
|
+
_ref$truncateText = _ref.truncateText,
|
|
44
|
+
truncateText = _ref$truncateText === void 0 ? false : _ref$truncateText,
|
|
45
|
+
hasActions = _ref.hasActions,
|
|
46
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
47
|
+
var isResponsive = (0, _responsive_context.useEuiTableIsResponsive)();
|
|
48
|
+
var styles = (0, _services.useEuiMemoizedStyles)(_table_cell_content.euiTableCellContentStyles);
|
|
49
|
+
var cssStyles = [styles.euiTableCellContent, styles[align], truncateText === true && styles.truncateText, truncateText === false && styles.wrapText].concat(_toConsumableArray(hasActions ? [styles.hasActions.actions, !isResponsive && styles.hasActions.desktop, isResponsive && hasActions !== 'custom' && styles.hasActions.mobile] : []));
|
|
50
|
+
var classes = (0, _classnames.default)('euiTableCellContent', className);
|
|
51
|
+
var renderedChildren = (0, _react.useMemo)(function () {
|
|
52
|
+
var textClasses = 'euiTableCellContent__text';
|
|
53
|
+
if ((0, _predicate.isObject)(truncateText) && truncateText.lines) {
|
|
54
|
+
return (0, _react2.jsx)(_text_truncate.EuiTextBlockTruncate, {
|
|
55
|
+
lines: truncateText.lines,
|
|
56
|
+
cloneElement: true
|
|
57
|
+
}, (0, _react2.jsx)("span", {
|
|
58
|
+
className: textClasses
|
|
59
|
+
}, children));
|
|
60
|
+
}
|
|
61
|
+
if (textOnly === true || truncateText === true) {
|
|
62
|
+
return (0, _react2.jsx)("span", {
|
|
63
|
+
className: textClasses
|
|
64
|
+
}, children);
|
|
65
|
+
}
|
|
66
|
+
return children;
|
|
67
|
+
}, [children, textOnly, truncateText]);
|
|
68
|
+
return (0, _react2.jsx)("div", _extends({
|
|
69
|
+
css: cssStyles,
|
|
70
|
+
className: classes
|
|
71
|
+
}, rest), renderedChildren);
|
|
72
|
+
};
|
|
73
|
+
exports.EuiTableCellContent = EuiTableCellContent;
|
|
74
|
+
EuiTableCellContent.propTypes = {
|
|
75
|
+
className: _propTypes.default.string,
|
|
76
|
+
"aria-label": _propTypes.default.string,
|
|
77
|
+
"data-test-subj": _propTypes.default.string,
|
|
78
|
+
css: _propTypes.default.any,
|
|
79
|
+
truncateText: _propTypes.default.oneOfType([_propTypes.default.oneOfType([_propTypes.default.bool.isRequired, _propTypes.default.shape({
|
|
80
|
+
lines: _propTypes.default.number.isRequired
|
|
81
|
+
}).isRequired]).isRequired, _propTypes.default.oneOf([null])])
|
|
82
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.euiTableCellContentStyles = 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 _ref = process.env.NODE_ENV === "production" ? {
|
|
17
|
+
name: "1t1ptlc-mobile",
|
|
18
|
+
styles: "flex-direction:column;padding:0;label:mobile;"
|
|
19
|
+
} : {
|
|
20
|
+
name: "1t1ptlc-mobile",
|
|
21
|
+
styles: "flex-direction:column;padding:0;label:mobile;",
|
|
22
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
23
|
+
};
|
|
24
|
+
var _ref2 = process.env.NODE_ENV === "production" ? {
|
|
25
|
+
name: "o9tdjd-desktop",
|
|
26
|
+
styles: "flex-wrap:wrap;label:desktop;"
|
|
27
|
+
} : {
|
|
28
|
+
name: "o9tdjd-desktop",
|
|
29
|
+
styles: "flex-wrap:wrap;label:desktop;",
|
|
30
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
31
|
+
};
|
|
32
|
+
var _ref3 = process.env.NODE_ENV === "production" ? {
|
|
33
|
+
name: "1x3x3jh-center",
|
|
34
|
+
styles: "justify-content:center;text-align:center;label:center;"
|
|
35
|
+
} : {
|
|
36
|
+
name: "1x3x3jh-center",
|
|
37
|
+
styles: "justify-content:center;text-align:center;label:center;",
|
|
38
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
39
|
+
};
|
|
40
|
+
var _ref4 = process.env.NODE_ENV === "production" ? {
|
|
41
|
+
name: "1vsid2d-euiTableCellContent",
|
|
42
|
+
styles: "display:flex;align-items:center;label:euiTableCellContent;"
|
|
43
|
+
} : {
|
|
44
|
+
name: "1vsid2d-euiTableCellContent",
|
|
45
|
+
styles: "display:flex;align-items:center;label:euiTableCellContent;",
|
|
46
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
47
|
+
};
|
|
48
|
+
var euiTableCellContentStyles = function euiTableCellContentStyles(_ref5) {
|
|
49
|
+
var euiTheme = _ref5.euiTheme;
|
|
50
|
+
return {
|
|
51
|
+
euiTableCellContent: _ref4,
|
|
52
|
+
// Align
|
|
53
|
+
left: null,
|
|
54
|
+
// Default, no CSS needed
|
|
55
|
+
right: /*#__PURE__*/(0, _react.css)("justify-content:flex-end;", (0, _global_styling.logicalTextAlignCSS)('right'), ";;label:right;"),
|
|
56
|
+
center: _ref3,
|
|
57
|
+
// Text wrapping
|
|
58
|
+
truncateText: /*#__PURE__*/(0, _react.css)((0, _global_styling.euiTextTruncate)(), ".euiTableCellContent__text{overflow:hidden;text-overflow:ellipsis;};label:truncateText;"),
|
|
59
|
+
wrapText: /*#__PURE__*/(0, _react.css)((0, _global_styling.euiTextBreakWord)(), ";;label:wrapText;"),
|
|
60
|
+
// Action cells
|
|
61
|
+
hasActions: {
|
|
62
|
+
actions: /*#__PURE__*/(0, _react.css)("gap:", euiTheme.size.s, ";;label:actions;"),
|
|
63
|
+
desktop: _ref2,
|
|
64
|
+
mobile: _ref
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
exports.euiTableCellContentStyles = euiTableCellContentStyles;
|
|
@@ -33,12 +33,6 @@ Object.defineProperty(exports, "EuiTableHeader", {
|
|
|
33
33
|
return _table_header.EuiTableHeader;
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
|
-
Object.defineProperty(exports, "EuiTableHeaderButton", {
|
|
37
|
-
enumerable: true,
|
|
38
|
-
get: function get() {
|
|
39
|
-
return _table_header_button.EuiTableHeaderButton;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
36
|
Object.defineProperty(exports, "EuiTableHeaderCell", {
|
|
43
37
|
enumerable: true,
|
|
44
38
|
get: function get() {
|
|
@@ -98,7 +92,6 @@ var _table_body = require("./table_body");
|
|
|
98
92
|
var _table_footer = require("./table_footer");
|
|
99
93
|
var _table_footer_cell = require("./table_footer_cell");
|
|
100
94
|
var _table_header = require("./table_header");
|
|
101
|
-
var _table_header_button = require("./table_header_button");
|
|
102
95
|
var _table_header_cell = require("./table_header_cell");
|
|
103
96
|
var _table_header_cell_checkbox = require("./table_header_cell_checkbox");
|
|
104
97
|
var _table_pagination = require("./table_pagination");
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useIsEuiTableResponsive = exports.useEuiTableIsResponsive = exports.EuiTableIsResponsiveContext = exports.DEFAULT_TABLE_BREAKPOINT = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _services = require("../../../services");
|
|
9
|
+
var _component_defaults = require("../../provider/component_defaults");
|
|
10
|
+
/*
|
|
11
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
12
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
13
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
14
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
15
|
+
* Side Public License, v 1.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
var DEFAULT_TABLE_BREAKPOINT = 'm';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Used by parent/top-level table components to determine isResponsive state
|
|
22
|
+
* based on the passed breakpoint
|
|
23
|
+
*/
|
|
24
|
+
exports.DEFAULT_TABLE_BREAKPOINT = DEFAULT_TABLE_BREAKPOINT;
|
|
25
|
+
var useIsEuiTableResponsive = function useIsEuiTableResponsive(componentProp) {
|
|
26
|
+
var _useComponentDefaults, _ref;
|
|
27
|
+
var componentDefault = (_useComponentDefaults = (0, _component_defaults.useComponentDefaults)().EuiTable) === null || _useComponentDefaults === void 0 ? void 0 : _useComponentDefaults.responsiveBreakpoint;
|
|
28
|
+
var breakpoint = (_ref = componentProp !== null && componentProp !== void 0 ? componentProp : componentDefault) !== null && _ref !== void 0 ? _ref : DEFAULT_TABLE_BREAKPOINT;
|
|
29
|
+
var isBoolean = typeof breakpoint === 'boolean';
|
|
30
|
+
|
|
31
|
+
// Note: we're using `!useIsWithinMinBreakpoint` here instead of `useIsWithinMaxBreakpoint`
|
|
32
|
+
// because it more accurately reflects the single breakpoint at which tables collapse
|
|
33
|
+
var isResponsive = !(0, _services.useIsWithinMinBreakpoint)(isBoolean ? '' : breakpoint);
|
|
34
|
+
return isBoolean ? breakpoint : isResponsive;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Context set by parent table components
|
|
39
|
+
* Hook used by cells to fetch parent isResponsive state
|
|
40
|
+
*/
|
|
41
|
+
exports.useIsEuiTableResponsive = useIsEuiTableResponsive;
|
|
42
|
+
var EuiTableIsResponsiveContext = /*#__PURE__*/(0, _react.createContext)(false);
|
|
43
|
+
exports.EuiTableIsResponsiveContext = EuiTableIsResponsiveContext;
|
|
44
|
+
var useEuiTableIsResponsive = function useEuiTableIsResponsive() {
|
|
45
|
+
return (0, _react.useContext)(EuiTableIsResponsiveContext);
|
|
46
|
+
};
|
|
47
|
+
exports.useEuiTableIsResponsive = useEuiTableIsResponsive;
|
|
@@ -7,8 +7,11 @@ exports.EuiTableHeaderMobile = 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("./responsive_context");
|
|
12
|
+
var _table_header_mobile = require("./table_header_mobile.styles");
|
|
10
13
|
var _react2 = require("@emotion/react");
|
|
11
|
-
var _excluded = ["children", "className"];
|
|
14
|
+
var _excluded = ["children", "className", "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
|
|
@@ -23,11 +26,15 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
23
26
|
var EuiTableHeaderMobile = function EuiTableHeaderMobile(_ref) {
|
|
24
27
|
var children = _ref.children,
|
|
25
28
|
className = _ref.className,
|
|
29
|
+
responsiveBreakpoint = _ref.responsiveBreakpoint,
|
|
26
30
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
31
|
+
var isResponsive = (0, _responsive_context.useIsEuiTableResponsive)(responsiveBreakpoint);
|
|
32
|
+
var styles = (0, _services.useEuiMemoizedStyles)(_table_header_mobile.euiTableHeaderMobileStyles);
|
|
27
33
|
var classes = (0, _classnames.default)('euiTableHeaderMobile', className);
|
|
28
|
-
return (0, _react2.jsx)("div", _extends({
|
|
29
|
-
className: classes
|
|
30
|
-
|
|
34
|
+
return isResponsive ? (0, _react2.jsx)("div", _extends({
|
|
35
|
+
className: classes,
|
|
36
|
+
css: styles.euiTableHeaderMobile
|
|
37
|
+
}, rest), children) : null;
|
|
31
38
|
};
|
|
32
39
|
exports.EuiTableHeaderMobile = EuiTableHeaderMobile;
|
|
33
40
|
EuiTableHeaderMobile.propTypes = {
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.euiTableHeaderMobileStyles = void 0;
|
|
7
|
+
var _react = require("@emotion/react");
|
|
8
|
+
/*
|
|
9
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
10
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
11
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
12
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
13
|
+
* Side Public License, v 1.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
var euiTableHeaderMobileStyles = function euiTableHeaderMobileStyles(_ref) {
|
|
17
|
+
var euiTheme = _ref.euiTheme;
|
|
18
|
+
return {
|
|
19
|
+
euiTableHeaderMobile: /*#__PURE__*/(0, _react.css)("display:flex;justify-content:space-between;align-items:baseline;padding-block:", euiTheme.size.s, ";;label:euiTableHeaderMobile;")
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
exports.euiTableHeaderMobileStyles = euiTableHeaderMobileStyles;
|