@elastic/eui 94.0.0 → 94.1.0-backport.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/es/components/basic_table/basic_table.js +14 -7
- 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/in_memory_table.js +6 -2
- package/es/components/table/table_cells_shared.styles.js +7 -2
- package/es/components/table/table_header_cell.js +31 -33
- package/es/components/table/table_row_cell.styles.js +2 -2
- package/eui.d.ts +7 -5
- package/i18ntokens.json +24 -24
- package/lib/components/basic_table/basic_table.js +14 -7
- 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/in_memory_table.js +6 -2
- package/lib/components/table/table_cells_shared.styles.js +7 -2
- package/lib/components/table/table_header_cell.js +31 -33
- package/lib/components/table/table_row_cell.styles.js +1 -1
- package/optimize/es/components/basic_table/basic_table.js +8 -5
- 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/table/table_cells_shared.styles.js +7 -2
- package/optimize/es/components/table/table_header_cell.js +31 -33
- package/optimize/es/components/table/table_row_cell.styles.js +2 -2
- package/optimize/lib/components/basic_table/basic_table.js +8 -5
- 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/table/table_cells_shared.styles.js +7 -2
- package/optimize/lib/components/table/table_header_cell.js +31 -33
- package/optimize/lib/components/table/table_row_cell.styles.js +1 -1
- package/package.json +2 -2
- package/test-env/components/basic_table/basic_table.js +14 -7
- 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/in_memory_table.js +6 -2
- package/test-env/components/table/table_cells_shared.styles.js +7 -2
- package/test-env/components/table/table_header_cell.js +31 -33
- package/test-env/components/table/table_row_cell.styles.js +1 -1
- package/src/components/date_picker/react-datepicker/LICENSE +0 -21
- package/src/components/date_picker/react-datepicker/README.md +0 -168
- package/src/services/theme/README.md +0 -153
- package/src/test/README.md +0 -44
|
@@ -640,7 +640,7 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
640
640
|
content = items.map(function (item, index) {
|
|
641
641
|
// if there's pagination the item's index must be adjusted to the where it is in the whole dataset
|
|
642
642
|
var tableItemIndex = hasPagination(_this4.props) && _this4.pageSize > 0 ? _this4.props.pagination.pageIndex * _this4.pageSize + index : index;
|
|
643
|
-
return _this4.renderItemRow(item, tableItemIndex);
|
|
643
|
+
return _this4.renderItemRow(item, tableItemIndex, index);
|
|
644
644
|
});
|
|
645
645
|
}
|
|
646
646
|
return ___EmotionJSX(RenderWithEuiTheme, null, function (theme) {
|
|
@@ -682,7 +682,7 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
682
682
|
}
|
|
683
683
|
}, {
|
|
684
684
|
key: "renderItemRow",
|
|
685
|
-
value: function renderItemRow(item, rowIndex) {
|
|
685
|
+
value: function renderItemRow(item, rowIndex, displayedRowIndex) {
|
|
686
686
|
var _this5 = this;
|
|
687
687
|
var _this$props10 = this.props,
|
|
688
688
|
columns = _this$props10.columns,
|
|
@@ -697,7 +697,7 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
697
697
|
});
|
|
698
698
|
var rowSelectionDisabled = false;
|
|
699
699
|
if (selection) {
|
|
700
|
-
var _this$renderItemSelec = this.renderItemSelectionCell(itemId, item, selected),
|
|
700
|
+
var _this$renderItemSelec = this.renderItemSelectionCell(itemId, item, selected, displayedRowIndex),
|
|
701
701
|
_this$renderItemSelec2 = _slicedToArray(_this$renderItemSelec, 2),
|
|
702
702
|
checkboxCell = _this$renderItemSelec2[0],
|
|
703
703
|
isDisabled = _this$renderItemSelec2[1];
|
|
@@ -758,7 +758,7 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
758
758
|
}
|
|
759
759
|
}, {
|
|
760
760
|
key: "renderItemSelectionCell",
|
|
761
|
-
value: function renderItemSelectionCell(itemId, item, selected) {
|
|
761
|
+
value: function renderItemSelectionCell(itemId, item, selected, displayedRowIndex) {
|
|
762
762
|
var _this6 = this;
|
|
763
763
|
var selection = this.props.selection;
|
|
764
764
|
var key = "_selection_column_".concat(itemId);
|
|
@@ -782,7 +782,10 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
782
782
|
key: key
|
|
783
783
|
}, ___EmotionJSX(EuiI18n, {
|
|
784
784
|
token: "euiBasicTable.selectThisRow",
|
|
785
|
-
default: "Select
|
|
785
|
+
default: "Select row {index}",
|
|
786
|
+
values: {
|
|
787
|
+
index: displayedRowIndex + 1
|
|
788
|
+
}
|
|
786
789
|
}, function (selectThisRow) {
|
|
787
790
|
return ___EmotionJSX(EuiCheckbox, {
|
|
788
791
|
id: "".concat(_this6.tableId).concat(key, "-checkbox"),
|
|
@@ -1166,10 +1169,14 @@ EuiBasicTable.propTypes = {
|
|
|
1166
1169
|
*/
|
|
1167
1170
|
description: PropTypes.oneOfType([PropTypes.string.isRequired, PropTypes.func.isRequired]).isRequired,
|
|
1168
1171
|
/**
|
|
1169
|
-
* A handler function to execute the action
|
|
1172
|
+
* A handler function to execute the action. Passes back the current row
|
|
1173
|
+
* item as the first argument, and the originating React click event
|
|
1174
|
+
* as a second argument.
|
|
1170
1175
|
*/
|
|
1171
1176
|
/**
|
|
1172
|
-
* A handler function to execute the action
|
|
1177
|
+
* A handler function to execute the action. Passes back the current row
|
|
1178
|
+
* item as the first argument, and the originating React click event
|
|
1179
|
+
* as a second argument.
|
|
1173
1180
|
*/
|
|
1174
1181
|
onClick: PropTypes.func,
|
|
1175
1182
|
href: PropTypes.oneOfType([PropTypes.string.isRequired, PropTypes.func.isRequired]),
|
|
@@ -13,7 +13,6 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
import React, { useState, useCallback, useMemo } from 'react';
|
|
16
|
-
import { isString } from '../../services/predicate';
|
|
17
16
|
import { EuiContextMenuItem, EuiContextMenuPanel } from '../context_menu';
|
|
18
17
|
import { EuiPopover } from '../popover';
|
|
19
18
|
import { EuiButtonIcon } from '../button';
|
|
@@ -31,9 +30,8 @@ export var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
31
30
|
_useState2 = _slicedToArray(_useState, 2),
|
|
32
31
|
popoverOpen = _useState2[0],
|
|
33
32
|
setPopoverOpen = _useState2[1];
|
|
34
|
-
var
|
|
35
|
-
setPopoverOpen(false);
|
|
36
|
-
onClickAction === null || onClickAction === void 0 ? void 0 : onClickAction();
|
|
33
|
+
var closePopover = useCallback(function () {
|
|
34
|
+
return setPopoverOpen(false);
|
|
37
35
|
}, []);
|
|
38
36
|
var controls = useMemo(function () {
|
|
39
37
|
return actions.reduce(function (controls, action, index) {
|
|
@@ -52,16 +50,10 @@ export var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
52
50
|
key: index,
|
|
53
51
|
className: "euiBasicTable__collapsedCustomAction"
|
|
54
52
|
}, ___EmotionJSX("span", {
|
|
55
|
-
onClick:
|
|
56
|
-
return onClickItem();
|
|
57
|
-
}
|
|
53
|
+
onClick: closePopover
|
|
58
54
|
}, actionControl)));
|
|
59
55
|
} else {
|
|
60
|
-
var
|
|
61
|
-
var icon;
|
|
62
|
-
if (buttonIcon) {
|
|
63
|
-
icon = isString(buttonIcon) ? buttonIcon : buttonIcon(item);
|
|
64
|
-
}
|
|
56
|
+
var icon = action.icon ? callWithItemIfFunction(item)(action.icon) : undefined;
|
|
65
57
|
var buttonContent = callWithItemIfFunction(item)(action.name);
|
|
66
58
|
var toolTipContent = callWithItemIfFunction(item)(action.description);
|
|
67
59
|
var href = callWithItemIfFunction(item)(action.href);
|
|
@@ -76,10 +68,11 @@ export var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
76
68
|
target: target,
|
|
77
69
|
icon: icon,
|
|
78
70
|
"data-test-subj": dataTestSubj,
|
|
79
|
-
onClick: function onClick() {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
71
|
+
onClick: function onClick(event) {
|
|
72
|
+
event.persist();
|
|
73
|
+
_onClick === null || _onClick === void 0 ? void 0 : _onClick(item, event);
|
|
74
|
+
// Allow consumer events to prevent the popover from closing if necessary
|
|
75
|
+
if (!event.isPropagationStopped()) closePopover();
|
|
83
76
|
},
|
|
84
77
|
toolTipContent: toolTipContent,
|
|
85
78
|
toolTipProps: {
|
|
@@ -89,7 +82,7 @@ export var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
89
82
|
}
|
|
90
83
|
return controls;
|
|
91
84
|
}, []);
|
|
92
|
-
}, [actions, actionsDisabled, item,
|
|
85
|
+
}, [actions, actionsDisabled, item, closePopover]);
|
|
93
86
|
var popoverButton = ___EmotionJSX(EuiI18n, {
|
|
94
87
|
tokens: ['euiCollapsedItemActions.allActions', 'euiCollapsedItemActions.allActionsDisabled'],
|
|
95
88
|
defaults: ['All actions', 'Individual item actions are disabled when rows are being selected.']
|
|
@@ -126,9 +119,7 @@ export var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
126
119
|
id: "".concat(itemId, "-actions"),
|
|
127
120
|
isOpen: popoverOpen,
|
|
128
121
|
button: withTooltip || popoverButton,
|
|
129
|
-
closePopover:
|
|
130
|
-
return setPopoverOpen(false);
|
|
131
|
-
},
|
|
122
|
+
closePopover: closePopover,
|
|
132
123
|
panelPaddingSize: "none",
|
|
133
124
|
anchorPosition: "leftCenter"
|
|
134
125
|
}, ___EmotionJSX(EuiContextMenuPanel, {
|
|
@@ -6,8 +6,7 @@
|
|
|
6
6
|
* Side Public License, v 1.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import React from 'react';
|
|
10
|
-
import { isString } from '../../services/predicate';
|
|
9
|
+
import React, { useCallback } from 'react';
|
|
11
10
|
import { EuiButtonEmpty, EuiButtonIcon } from '../button';
|
|
12
11
|
import { EuiToolTip } from '../tool_tip';
|
|
13
12
|
import { useGeneratedHtmlId } from '../../services/accessibility';
|
|
@@ -22,26 +21,20 @@ export var DefaultItemAction = function DefaultItemAction(_ref) {
|
|
|
22
21
|
if (!action.onClick && !action.href) {
|
|
23
22
|
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"));
|
|
24
23
|
}
|
|
25
|
-
var onClick =
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
var buttonIcon = action.icon;
|
|
34
|
-
var icon;
|
|
35
|
-
if (buttonIcon) {
|
|
36
|
-
icon = isString(buttonIcon) ? buttonIcon : buttonIcon(item);
|
|
37
|
-
}
|
|
38
|
-
var button;
|
|
24
|
+
var onClick = useCallback(function (event) {
|
|
25
|
+
if (!action.onClick) return;
|
|
26
|
+
event.persist(); // TODO: Remove once React 16 support is dropped
|
|
27
|
+
action.onClick(item, event);
|
|
28
|
+
}, [action.onClick, item]);
|
|
29
|
+
var color = action.color ? callWithItemIfFunction(item)(action.color) : 'primary';
|
|
30
|
+
var icon = action.icon ? callWithItemIfFunction(item)(action.icon) : undefined;
|
|
39
31
|
var actionContent = callWithItemIfFunction(item)(action.name);
|
|
40
32
|
var tooltipContent = callWithItemIfFunction(item)(action.description);
|
|
41
33
|
var href = callWithItemIfFunction(item)(action.href);
|
|
42
34
|
var dataTestSubj = callWithItemIfFunction(item)(action['data-test-subj']);
|
|
43
35
|
var ariaLabelId = useGeneratedHtmlId();
|
|
44
36
|
var ariaLabelledBy;
|
|
37
|
+
var button;
|
|
45
38
|
if (action.type === 'icon') {
|
|
46
39
|
if (!icon) {
|
|
47
40
|
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"));
|
|
@@ -676,10 +676,14 @@ EuiInMemoryTable.propTypes = {
|
|
|
676
676
|
*/
|
|
677
677
|
description: PropTypes.oneOfType([PropTypes.string.isRequired, PropTypes.func.isRequired]).isRequired,
|
|
678
678
|
/**
|
|
679
|
-
* A handler function to execute the action
|
|
679
|
+
* A handler function to execute the action. Passes back the current row
|
|
680
|
+
* item as the first argument, and the originating React click event
|
|
681
|
+
* as a second argument.
|
|
680
682
|
*/
|
|
681
683
|
/**
|
|
682
|
-
* A handler function to execute the action
|
|
684
|
+
* A handler function to execute the action. Passes back the current row
|
|
685
|
+
* item as the first argument, and the originating React click event
|
|
686
|
+
* as a second argument.
|
|
683
687
|
*/
|
|
684
688
|
onClick: PropTypes.func,
|
|
685
689
|
href: PropTypes.oneOfType([PropTypes.string.isRequired, PropTypes.func.isRequired]),
|
|
@@ -13,10 +13,12 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
import { css } from '@emotion/react';
|
|
16
|
+
import { makeHighContrastColor, tintOrShade } from '../../services';
|
|
16
17
|
import { euiFontSize, logicalCSS, logicalTextAlignCSS } from '../../global_styling';
|
|
17
18
|
import { euiTableVariables } from './table.styles';
|
|
18
19
|
export var euiTableHeaderFooterCellStyles = function euiTableHeaderFooterCellStyles(euiThemeContext) {
|
|
19
|
-
var euiTheme = euiThemeContext.euiTheme
|
|
20
|
+
var euiTheme = euiThemeContext.euiTheme,
|
|
21
|
+
colorMode = euiThemeContext.colorMode;
|
|
20
22
|
|
|
21
23
|
// euiFontSize returns an object, so we keep object notation here to merge into css``
|
|
22
24
|
var sharedStyles = _objectSpread(_objectSpread({}, euiFontSize(euiThemeContext, 'xs')), {}, {
|
|
@@ -27,7 +29,10 @@ export var euiTableHeaderFooterCellStyles = function euiTableHeaderFooterCellSty
|
|
|
27
29
|
return {
|
|
28
30
|
euiTableHeaderCell: /*#__PURE__*/css(sharedStyles, ";;label:euiTableHeaderCell;"),
|
|
29
31
|
euiTableHeaderCell__content: /*#__PURE__*/css("gap:", euiTheme.size.xs, ";;label:euiTableHeaderCell__content;"),
|
|
30
|
-
euiTableHeaderCell__button: /*#__PURE__*/css(logicalCSS('width', '100%'), " font-weight:inherit
|
|
32
|
+
euiTableHeaderCell__button: /*#__PURE__*/css(logicalCSS('width', '100%'), " font-weight:inherit;line-height:inherit;.euiTableSortIcon--sortable{color:", makeHighContrastColor(
|
|
33
|
+
// Tint it arbitrarily high, the contrast util will take care of lowering back down to WCAG
|
|
34
|
+
tintOrShade(euiTheme.colors.subduedText, 0.9, colorMode), 3 // 3:1 ratio from https://www.w3.org/WAI/WCAG22/Understanding/non-text-contrast.html
|
|
35
|
+
)(euiTheme.colors.emptyShade), ";}&:hover,&:focus{color:", euiTheme.colors.primaryText, ";text-decoration:underline;.euiTableSortIcon--sortable{color:", euiTheme.colors.primaryText, ";}};label:euiTableHeaderCell__button;"),
|
|
31
36
|
euiTableFooterCell: /*#__PURE__*/css(sharedStyles, " background-color:", euiTheme.colors.lightestShade, ";;label:euiTableFooterCell;")
|
|
32
37
|
};
|
|
33
38
|
};
|
|
@@ -28,9 +28,9 @@ var CellContents = function CellContents(_ref) {
|
|
|
28
28
|
align = _ref.align,
|
|
29
29
|
description = _ref.description,
|
|
30
30
|
children = _ref.children,
|
|
31
|
+
canSort = _ref.canSort,
|
|
31
32
|
isSorted = _ref.isSorted,
|
|
32
|
-
isSortAscending = _ref.isSortAscending
|
|
33
|
-
showSortMsg = _ref.showSortMsg;
|
|
33
|
+
isSortAscending = _ref.isSortAscending;
|
|
34
34
|
return ___EmotionJSX(EuiTableCellContent, {
|
|
35
35
|
className: className,
|
|
36
36
|
align: align,
|
|
@@ -51,11 +51,16 @@ var CellContents = function CellContents(_ref) {
|
|
|
51
51
|
className: "eui-textTruncate"
|
|
52
52
|
}, children);
|
|
53
53
|
});
|
|
54
|
-
}), description && ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("span", null, description)),
|
|
54
|
+
}), description && ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("span", null, description)), isSorted ? ___EmotionJSX(EuiIcon, {
|
|
55
55
|
className: "euiTableSortIcon",
|
|
56
56
|
type: isSortAscending ? 'sortUp' : 'sortDown',
|
|
57
57
|
size: "m"
|
|
58
|
-
})
|
|
58
|
+
}) : canSort ? ___EmotionJSX(EuiIcon, {
|
|
59
|
+
className: "euiTableSortIcon euiTableSortIcon--sortable",
|
|
60
|
+
type: "sortable",
|
|
61
|
+
size: "m",
|
|
62
|
+
color: "subdued" // Tinted a bit further via CSS
|
|
63
|
+
}) : null);
|
|
59
64
|
};
|
|
60
65
|
export var EuiTableHeaderCell = function EuiTableHeaderCell(_ref2) {
|
|
61
66
|
var children = _ref2.children,
|
|
@@ -82,45 +87,38 @@ export var EuiTableHeaderCell = function EuiTableHeaderCell(_ref2) {
|
|
|
82
87
|
var CellComponent = children ? 'th' : 'td';
|
|
83
88
|
var cellScope = CellComponent === 'th' ? scope !== null && scope !== void 0 ? scope : 'col' : undefined; // `scope` is only valid on `th` elements
|
|
84
89
|
|
|
85
|
-
var
|
|
90
|
+
var canSort = !!(onSort && !readOnly);
|
|
91
|
+
var ariaSortValue;
|
|
92
|
+
if (isSorted) {
|
|
93
|
+
ariaSortValue = isSortAscending ? 'ascending' : 'descending';
|
|
94
|
+
} else if (canSort) {
|
|
95
|
+
ariaSortValue = 'none';
|
|
96
|
+
}
|
|
97
|
+
var cellContentsProps = {
|
|
86
98
|
css: styles.euiTableHeaderCell__content,
|
|
87
99
|
align: align,
|
|
88
100
|
description: description,
|
|
89
|
-
|
|
101
|
+
canSort: canSort,
|
|
90
102
|
isSorted: isSorted,
|
|
91
|
-
isSortAscending: isSortAscending
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
var buttonClasses = classNames('euiTableHeaderButton', {
|
|
95
|
-
'euiTableHeaderButton-isSorted': isSorted
|
|
96
|
-
});
|
|
97
|
-
var ariaSortValue = 'none';
|
|
98
|
-
if (isSorted) {
|
|
99
|
-
ariaSortValue = isSortAscending ? 'ascending' : 'descending';
|
|
100
|
-
}
|
|
101
|
-
return ___EmotionJSX(CellComponent, _extends({
|
|
102
|
-
css: styles.euiTableHeaderCell,
|
|
103
|
-
className: classes,
|
|
104
|
-
scope: cellScope,
|
|
105
|
-
role: "columnheader",
|
|
106
|
-
"aria-sort": ariaSortValue,
|
|
107
|
-
"aria-live": "polite",
|
|
108
|
-
style: inlineStyles
|
|
109
|
-
}, rest), onSort && !readOnly ? ___EmotionJSX("button", {
|
|
110
|
-
type: "button",
|
|
111
|
-
css: styles.euiTableHeaderCell__button,
|
|
112
|
-
className: buttonClasses,
|
|
113
|
-
onClick: onSort,
|
|
114
|
-
"data-test-subj": "tableHeaderSortButton"
|
|
115
|
-
}, cellContents) : cellContents);
|
|
116
|
-
}
|
|
103
|
+
isSortAscending: isSortAscending,
|
|
104
|
+
children: children
|
|
105
|
+
};
|
|
117
106
|
return ___EmotionJSX(CellComponent, _extends({
|
|
118
107
|
css: styles.euiTableHeaderCell,
|
|
119
108
|
className: classes,
|
|
120
109
|
scope: cellScope,
|
|
121
110
|
role: "columnheader",
|
|
111
|
+
"aria-sort": ariaSortValue,
|
|
122
112
|
style: inlineStyles
|
|
123
|
-
}, rest),
|
|
113
|
+
}, rest), canSort ? ___EmotionJSX("button", {
|
|
114
|
+
type: "button",
|
|
115
|
+
css: styles.euiTableHeaderCell__button,
|
|
116
|
+
className: classNames('euiTableHeaderButton', {
|
|
117
|
+
'euiTableHeaderButton-isSorted': isSorted
|
|
118
|
+
}),
|
|
119
|
+
onClick: onSort,
|
|
120
|
+
"data-test-subj": "tableHeaderSortButton"
|
|
121
|
+
}, ___EmotionJSX(CellContents, cellContentsProps)) : ___EmotionJSX(CellContents, cellContentsProps));
|
|
124
122
|
};
|
|
125
123
|
EuiTableHeaderCell.propTypes = {
|
|
126
124
|
className: PropTypes.string,
|
|
@@ -8,7 +8,7 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { css } from '@emotion/react';
|
|
11
|
-
import { euiCanAnimate, euiFontSize, euiTextTruncate, logicalCSS } from '../../global_styling';
|
|
11
|
+
import { euiCanAnimate, euiFontSize, euiTextTruncate, logicalCSS, logicalTextAlignCSS } from '../../global_styling';
|
|
12
12
|
import { euiTableVariables } from './table.styles';
|
|
13
13
|
var _ref = process.env.NODE_ENV === "production" ? {
|
|
14
14
|
name: "1amvdy6-bottom",
|
|
@@ -52,7 +52,7 @@ export var euiTableRowCellStyles = function euiTableRowCellStyles(euiThemeContex
|
|
|
52
52
|
var hasIcons = "line-height: 1;";
|
|
53
53
|
return {
|
|
54
54
|
euiTableRowCell: /*#__PURE__*/css("color:", euiTheme.colors.text, ";;label:euiTableRowCell;"),
|
|
55
|
-
rowHeader: /*#__PURE__*/css("font-weight:", euiTheme.font.weight.regular, ";;label:rowHeader;"),
|
|
55
|
+
rowHeader: /*#__PURE__*/css("font-weight:", euiTheme.font.weight.regular, ";", logicalTextAlignCSS('left'), ";;label:rowHeader;"),
|
|
56
56
|
isExpander: /*#__PURE__*/css(hasIcons, ";;label:isExpander;"),
|
|
57
57
|
hasActions: /*#__PURE__*/css(hasIcons, ";;label:hasActions;"),
|
|
58
58
|
// valign
|
package/eui.d.ts
CHANGED
|
@@ -22639,7 +22639,7 @@ declare module '@elastic/eui/src/components/tour' {
|
|
|
22639
22639
|
|
|
22640
22640
|
}
|
|
22641
22641
|
declare module '@elastic/eui/src/components/basic_table/action_types' {
|
|
22642
|
-
import { ReactElement, ReactNode } from 'react';
|
|
22642
|
+
import { ReactElement, ReactNode, MouseEvent } from 'react';
|
|
22643
22643
|
import { EuiIconType } from '@elastic/eui/src/components/icon/icon';
|
|
22644
22644
|
import { EuiButtonIconProps } from '@elastic/eui/src/components/button/button_icon/button_icon';
|
|
22645
22645
|
import { EuiButtonEmptyProps } from '@elastic/eui/src/components/button/button_empty';
|
|
@@ -22654,9 +22654,11 @@ declare module '@elastic/eui/src/components/basic_table/action_types' {
|
|
|
22654
22654
|
*/
|
|
22655
22655
|
description: string | ((item: T) => string);
|
|
22656
22656
|
/**
|
|
22657
|
-
* A handler function to execute the action
|
|
22657
|
+
* A handler function to execute the action. Passes back the current row
|
|
22658
|
+
* item as the first argument, and the originating React click event
|
|
22659
|
+
* as a second argument.
|
|
22658
22660
|
*/
|
|
22659
|
-
onClick?: (item: T) => void;
|
|
22661
|
+
onClick?: (item: T, event: MouseEvent) => void;
|
|
22660
22662
|
href?: string | ((item: T) => string);
|
|
22661
22663
|
target?: string;
|
|
22662
22664
|
/**
|
|
@@ -23132,8 +23134,8 @@ declare module '@elastic/eui/src/components/basic_table/basic_table' {
|
|
|
23132
23134
|
renderTableBody(): React.JSX.Element;
|
|
23133
23135
|
renderErrorMessage(error: string): React.JSX.Element;
|
|
23134
23136
|
renderEmptyMessage(): React.JSX.Element;
|
|
23135
|
-
renderItemRow(item: T, rowIndex: number): React.JSX.Element;
|
|
23136
|
-
renderItemSelectionCell(itemId: ItemId<T>, item: T, selected: boolean): (boolean | React.JSX.Element | undefined)[];
|
|
23137
|
+
renderItemRow(item: T, rowIndex: number, displayedRowIndex: number): React.JSX.Element;
|
|
23138
|
+
renderItemSelectionCell(itemId: ItemId<T>, item: T, selected: boolean, displayedRowIndex: number): (boolean | React.JSX.Element | undefined)[];
|
|
23137
23139
|
renderItemActionsCell(itemId: ItemIdResolved, item: T, column: EuiTableActionsColumnType<T>, columnIndex: number, hasCustomActions: boolean): React.JSX.Element;
|
|
23138
23140
|
renderItemFieldDataCell(itemId: ItemId<T>, item: T, column: EuiTableFieldDataColumnType<T>, columnIndex: number, setScopeRow: boolean): React.JSX.Element;
|
|
23139
23141
|
renderItemComputedCell(itemId: ItemId<T>, item: T, column: EuiTableComputedColumnType<T>, columnIndex: number): React.JSX.Element;
|
package/i18ntokens.json
CHANGED
|
@@ -127,18 +127,18 @@
|
|
|
127
127
|
},
|
|
128
128
|
{
|
|
129
129
|
"token": "euiBasicTable.selectThisRow",
|
|
130
|
-
"defString": "Select
|
|
130
|
+
"defString": "Select row {index}",
|
|
131
131
|
"highlighting": "string",
|
|
132
132
|
"loc": {
|
|
133
133
|
"start": {
|
|
134
|
-
"line":
|
|
134
|
+
"line": 1109,
|
|
135
135
|
"column": 8,
|
|
136
|
-
"index":
|
|
136
|
+
"index": 30781
|
|
137
137
|
},
|
|
138
138
|
"end": {
|
|
139
|
-
"line":
|
|
140
|
-
"column":
|
|
141
|
-
"index":
|
|
139
|
+
"line": 1113,
|
|
140
|
+
"column": 9,
|
|
141
|
+
"index": 30936
|
|
142
142
|
}
|
|
143
143
|
},
|
|
144
144
|
"filepath": "src/components/basic_table/basic_table.tsx"
|
|
@@ -149,14 +149,14 @@
|
|
|
149
149
|
"highlighting": "string",
|
|
150
150
|
"loc": {
|
|
151
151
|
"start": {
|
|
152
|
-
"line":
|
|
152
|
+
"line": 1339,
|
|
153
153
|
"column": 8,
|
|
154
|
-
"index":
|
|
154
|
+
"index": 37681
|
|
155
155
|
},
|
|
156
156
|
"end": {
|
|
157
|
-
"line":
|
|
157
|
+
"line": 1343,
|
|
158
158
|
"column": 9,
|
|
159
|
-
"index":
|
|
159
|
+
"index": 37840
|
|
160
160
|
}
|
|
161
161
|
},
|
|
162
162
|
"filepath": "src/components/basic_table/basic_table.tsx"
|
|
@@ -167,14 +167,14 @@
|
|
|
167
167
|
"highlighting": "string",
|
|
168
168
|
"loc": {
|
|
169
169
|
"start": {
|
|
170
|
-
"line":
|
|
170
|
+
"line": 110,
|
|
171
171
|
"column": 4,
|
|
172
|
-
"index":
|
|
172
|
+
"index": 3586
|
|
173
173
|
},
|
|
174
174
|
"end": {
|
|
175
|
-
"line":
|
|
175
|
+
"line": 119,
|
|
176
176
|
"column": 5,
|
|
177
|
-
"index":
|
|
177
|
+
"index": 3853
|
|
178
178
|
}
|
|
179
179
|
},
|
|
180
180
|
"filepath": "src/components/basic_table/collapsed_item_actions.tsx"
|
|
@@ -185,14 +185,14 @@
|
|
|
185
185
|
"highlighting": "string",
|
|
186
186
|
"loc": {
|
|
187
187
|
"start": {
|
|
188
|
-
"line":
|
|
188
|
+
"line": 110,
|
|
189
189
|
"column": 4,
|
|
190
|
-
"index":
|
|
190
|
+
"index": 3586
|
|
191
191
|
},
|
|
192
192
|
"end": {
|
|
193
|
-
"line":
|
|
193
|
+
"line": 119,
|
|
194
194
|
"column": 5,
|
|
195
|
-
"index":
|
|
195
|
+
"index": 3853
|
|
196
196
|
}
|
|
197
197
|
},
|
|
198
198
|
"filepath": "src/components/basic_table/collapsed_item_actions.tsx"
|
|
@@ -203,14 +203,14 @@
|
|
|
203
203
|
"highlighting": "string",
|
|
204
204
|
"loc": {
|
|
205
205
|
"start": {
|
|
206
|
-
"line":
|
|
206
|
+
"line": 136,
|
|
207
207
|
"column": 4,
|
|
208
|
-
"index":
|
|
208
|
+
"index": 4413
|
|
209
209
|
},
|
|
210
210
|
"end": {
|
|
211
|
-
"line":
|
|
211
|
+
"line": 136,
|
|
212
212
|
"column": 78,
|
|
213
|
-
"index":
|
|
213
|
+
"index": 4487
|
|
214
214
|
}
|
|
215
215
|
},
|
|
216
216
|
"filepath": "src/components/basic_table/collapsed_item_actions.tsx"
|
|
@@ -6595,12 +6595,12 @@
|
|
|
6595
6595
|
"start": {
|
|
6596
6596
|
"line": 77,
|
|
6597
6597
|
"column": 10,
|
|
6598
|
-
"index":
|
|
6598
|
+
"index": 2359
|
|
6599
6599
|
},
|
|
6600
6600
|
"end": {
|
|
6601
6601
|
"line": 81,
|
|
6602
6602
|
"column": 11,
|
|
6603
|
-
"index":
|
|
6603
|
+
"index": 2533
|
|
6604
6604
|
}
|
|
6605
6605
|
},
|
|
6606
6606
|
"filepath": "src/components/table/table_header_cell.tsx"
|
|
@@ -648,7 +648,7 @@ var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
648
648
|
content = items.map(function (item, index) {
|
|
649
649
|
// if there's pagination the item's index must be adjusted to the where it is in the whole dataset
|
|
650
650
|
var tableItemIndex = hasPagination(_this4.props) && _this4.pageSize > 0 ? _this4.props.pagination.pageIndex * _this4.pageSize + index : index;
|
|
651
|
-
return _this4.renderItemRow(item, tableItemIndex);
|
|
651
|
+
return _this4.renderItemRow(item, tableItemIndex, index);
|
|
652
652
|
});
|
|
653
653
|
}
|
|
654
654
|
return (0, _react2.jsx)(_services.RenderWithEuiTheme, null, function (theme) {
|
|
@@ -690,7 +690,7 @@ var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
690
690
|
}
|
|
691
691
|
}, {
|
|
692
692
|
key: "renderItemRow",
|
|
693
|
-
value: function renderItemRow(item, rowIndex) {
|
|
693
|
+
value: function renderItemRow(item, rowIndex, displayedRowIndex) {
|
|
694
694
|
var _this5 = this;
|
|
695
695
|
var _this$props10 = this.props,
|
|
696
696
|
columns = _this$props10.columns,
|
|
@@ -705,7 +705,7 @@ var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
705
705
|
});
|
|
706
706
|
var rowSelectionDisabled = false;
|
|
707
707
|
if (selection) {
|
|
708
|
-
var _this$renderItemSelec = this.renderItemSelectionCell(itemId, item, selected),
|
|
708
|
+
var _this$renderItemSelec = this.renderItemSelectionCell(itemId, item, selected, displayedRowIndex),
|
|
709
709
|
_this$renderItemSelec2 = _slicedToArray(_this$renderItemSelec, 2),
|
|
710
710
|
checkboxCell = _this$renderItemSelec2[0],
|
|
711
711
|
isDisabled = _this$renderItemSelec2[1];
|
|
@@ -766,7 +766,7 @@ var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
766
766
|
}
|
|
767
767
|
}, {
|
|
768
768
|
key: "renderItemSelectionCell",
|
|
769
|
-
value: function renderItemSelectionCell(itemId, item, selected) {
|
|
769
|
+
value: function renderItemSelectionCell(itemId, item, selected, displayedRowIndex) {
|
|
770
770
|
var _this6 = this;
|
|
771
771
|
var selection = this.props.selection;
|
|
772
772
|
var key = "_selection_column_".concat(itemId);
|
|
@@ -790,7 +790,10 @@ var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
790
790
|
key: key
|
|
791
791
|
}, (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
792
792
|
token: "euiBasicTable.selectThisRow",
|
|
793
|
-
default: "Select
|
|
793
|
+
default: "Select row {index}",
|
|
794
|
+
values: {
|
|
795
|
+
index: displayedRowIndex + 1
|
|
796
|
+
}
|
|
794
797
|
}, function (selectThisRow) {
|
|
795
798
|
return (0, _react2.jsx)(_form.EuiCheckbox, {
|
|
796
799
|
id: "".concat(_this6.tableId).concat(key, "-checkbox"),
|
|
@@ -1175,10 +1178,14 @@ EuiBasicTable.propTypes = {
|
|
|
1175
1178
|
*/
|
|
1176
1179
|
description: _propTypes.default.oneOfType([_propTypes.default.string.isRequired, _propTypes.default.func.isRequired]).isRequired,
|
|
1177
1180
|
/**
|
|
1178
|
-
* A handler function to execute the action
|
|
1181
|
+
* A handler function to execute the action. Passes back the current row
|
|
1182
|
+
* item as the first argument, and the originating React click event
|
|
1183
|
+
* as a second argument.
|
|
1179
1184
|
*/
|
|
1180
1185
|
/**
|
|
1181
|
-
* A handler function to execute the action
|
|
1186
|
+
* A handler function to execute the action. Passes back the current row
|
|
1187
|
+
* item as the first argument, and the originating React click event
|
|
1188
|
+
* as a second argument.
|
|
1182
1189
|
*/
|
|
1183
1190
|
onClick: _propTypes.default.func,
|
|
1184
1191
|
href: _propTypes.default.oneOfType([_propTypes.default.string.isRequired, _propTypes.default.func.isRequired]),
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.CollapsedItemActions = void 0;
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
var _predicate = require("../../services/predicate");
|
|
10
9
|
var _context_menu = require("../context_menu");
|
|
11
10
|
var _popover = require("../popover");
|
|
12
11
|
var _button = require("../button");
|
|
@@ -38,9 +37,8 @@ var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
38
37
|
_useState2 = _slicedToArray(_useState, 2),
|
|
39
38
|
popoverOpen = _useState2[0],
|
|
40
39
|
setPopoverOpen = _useState2[1];
|
|
41
|
-
var
|
|
42
|
-
setPopoverOpen(false);
|
|
43
|
-
onClickAction === null || onClickAction === void 0 ? void 0 : onClickAction();
|
|
40
|
+
var closePopover = (0, _react.useCallback)(function () {
|
|
41
|
+
return setPopoverOpen(false);
|
|
44
42
|
}, []);
|
|
45
43
|
var controls = (0, _react.useMemo)(function () {
|
|
46
44
|
return actions.reduce(function (controls, action, index) {
|
|
@@ -59,16 +57,10 @@ var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
59
57
|
key: index,
|
|
60
58
|
className: "euiBasicTable__collapsedCustomAction"
|
|
61
59
|
}, (0, _react2.jsx)("span", {
|
|
62
|
-
onClick:
|
|
63
|
-
return onClickItem();
|
|
64
|
-
}
|
|
60
|
+
onClick: closePopover
|
|
65
61
|
}, actionControl)));
|
|
66
62
|
} else {
|
|
67
|
-
var
|
|
68
|
-
var icon;
|
|
69
|
-
if (buttonIcon) {
|
|
70
|
-
icon = (0, _predicate.isString)(buttonIcon) ? buttonIcon : buttonIcon(item);
|
|
71
|
-
}
|
|
63
|
+
var icon = action.icon ? (0, _action_types.callWithItemIfFunction)(item)(action.icon) : undefined;
|
|
72
64
|
var buttonContent = (0, _action_types.callWithItemIfFunction)(item)(action.name);
|
|
73
65
|
var toolTipContent = (0, _action_types.callWithItemIfFunction)(item)(action.description);
|
|
74
66
|
var href = (0, _action_types.callWithItemIfFunction)(item)(action.href);
|
|
@@ -83,10 +75,11 @@ var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
83
75
|
target: target,
|
|
84
76
|
icon: icon,
|
|
85
77
|
"data-test-subj": dataTestSubj,
|
|
86
|
-
onClick: function onClick() {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
78
|
+
onClick: function onClick(event) {
|
|
79
|
+
event.persist();
|
|
80
|
+
_onClick === null || _onClick === void 0 ? void 0 : _onClick(item, event);
|
|
81
|
+
// Allow consumer events to prevent the popover from closing if necessary
|
|
82
|
+
if (!event.isPropagationStopped()) closePopover();
|
|
90
83
|
},
|
|
91
84
|
toolTipContent: toolTipContent,
|
|
92
85
|
toolTipProps: {
|
|
@@ -96,7 +89,7 @@ var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
96
89
|
}
|
|
97
90
|
return controls;
|
|
98
91
|
}, []);
|
|
99
|
-
}, [actions, actionsDisabled, item,
|
|
92
|
+
}, [actions, actionsDisabled, item, closePopover]);
|
|
100
93
|
var popoverButton = (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
101
94
|
tokens: ['euiCollapsedItemActions.allActions', 'euiCollapsedItemActions.allActionsDisabled'],
|
|
102
95
|
defaults: ['All actions', 'Individual item actions are disabled when rows are being selected.']
|
|
@@ -133,9 +126,7 @@ var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
133
126
|
id: "".concat(itemId, "-actions"),
|
|
134
127
|
isOpen: popoverOpen,
|
|
135
128
|
button: withTooltip || popoverButton,
|
|
136
|
-
closePopover:
|
|
137
|
-
return setPopoverOpen(false);
|
|
138
|
-
},
|
|
129
|
+
closePopover: closePopover,
|
|
139
130
|
panelPaddingSize: "none",
|
|
140
131
|
anchorPosition: "leftCenter"
|
|
141
132
|
}, (0, _react2.jsx)(_context_menu.EuiContextMenuPanel, {
|