@elastic/eui 94.0.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/es/components/basic_table/basic_table.js +6 -2
- 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/eui.d.ts +5 -3
- package/i18ntokens.json +14 -14
- package/lib/components/basic_table/basic_table.js +6 -2
- 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/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/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/package.json +2 -2
- package/test-env/components/basic_table/basic_table.js +6 -2
- 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/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
|
@@ -1166,10 +1166,14 @@ EuiBasicTable.propTypes = {
|
|
|
1166
1166
|
*/
|
|
1167
1167
|
description: PropTypes.oneOfType([PropTypes.string.isRequired, PropTypes.func.isRequired]).isRequired,
|
|
1168
1168
|
/**
|
|
1169
|
-
* A handler function to execute the action
|
|
1169
|
+
* A handler function to execute the action. Passes back the current row
|
|
1170
|
+
* item as the first argument, and the originating React click event
|
|
1171
|
+
* as a second argument.
|
|
1170
1172
|
*/
|
|
1171
1173
|
/**
|
|
1172
|
-
* A handler function to execute the action
|
|
1174
|
+
* A handler function to execute the action. Passes back the current row
|
|
1175
|
+
* item as the first argument, and the originating React click event
|
|
1176
|
+
* as a second argument.
|
|
1173
1177
|
*/
|
|
1174
1178
|
onClick: PropTypes.func,
|
|
1175
1179
|
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,
|
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
|
/**
|
package/i18ntokens.json
CHANGED
|
@@ -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"
|
|
@@ -1175,10 +1175,14 @@ EuiBasicTable.propTypes = {
|
|
|
1175
1175
|
*/
|
|
1176
1176
|
description: _propTypes.default.oneOfType([_propTypes.default.string.isRequired, _propTypes.default.func.isRequired]).isRequired,
|
|
1177
1177
|
/**
|
|
1178
|
-
* A handler function to execute the action
|
|
1178
|
+
* A handler function to execute the action. Passes back the current row
|
|
1179
|
+
* item as the first argument, and the originating React click event
|
|
1180
|
+
* as a second argument.
|
|
1179
1181
|
*/
|
|
1180
1182
|
/**
|
|
1181
|
-
* A handler function to execute the action
|
|
1183
|
+
* A handler function to execute the action. Passes back the current row
|
|
1184
|
+
* item as the first argument, and the originating React click event
|
|
1185
|
+
* as a second argument.
|
|
1182
1186
|
*/
|
|
1183
1187
|
onClick: _propTypes.default.func,
|
|
1184
1188
|
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, {
|
|
@@ -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"));
|
|
@@ -684,10 +684,14 @@ EuiInMemoryTable.propTypes = {
|
|
|
684
684
|
*/
|
|
685
685
|
description: _propTypes.default.oneOfType([_propTypes.default.string.isRequired, _propTypes.default.func.isRequired]).isRequired,
|
|
686
686
|
/**
|
|
687
|
-
* 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.
|
|
688
690
|
*/
|
|
689
691
|
/**
|
|
690
|
-
* 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.
|
|
691
695
|
*/
|
|
692
696
|
onClick: _propTypes.default.func,
|
|
693
697
|
href: _propTypes.default.oneOfType([_propTypes.default.string.isRequired, _propTypes.default.func.isRequired]),
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.euiTableHeaderFooterCellStyles = exports.euiTableCellCheckboxStyles = void 0;
|
|
7
7
|
var _react = require("@emotion/react");
|
|
8
|
+
var _services = require("../../services");
|
|
8
9
|
var _global_styling = require("../../global_styling");
|
|
9
10
|
var _table = require("./table.styles");
|
|
10
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); }
|
|
@@ -20,7 +21,8 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
|
20
21
|
* Side Public License, v 1.
|
|
21
22
|
*/
|
|
22
23
|
var euiTableHeaderFooterCellStyles = function euiTableHeaderFooterCellStyles(euiThemeContext) {
|
|
23
|
-
var euiTheme = euiThemeContext.euiTheme
|
|
24
|
+
var euiTheme = euiThemeContext.euiTheme,
|
|
25
|
+
colorMode = euiThemeContext.colorMode;
|
|
24
26
|
|
|
25
27
|
// euiFontSize returns an object, so we keep object notation here to merge into css``
|
|
26
28
|
var sharedStyles = _objectSpread(_objectSpread({}, (0, _global_styling.euiFontSize)(euiThemeContext, 'xs')), {}, {
|
|
@@ -31,7 +33,10 @@ var euiTableHeaderFooterCellStyles = function euiTableHeaderFooterCellStyles(eui
|
|
|
31
33
|
return {
|
|
32
34
|
euiTableHeaderCell: /*#__PURE__*/(0, _react.css)(sharedStyles, ";;label:euiTableHeaderCell;"),
|
|
33
35
|
euiTableHeaderCell__content: /*#__PURE__*/(0, _react.css)("gap:", euiTheme.size.xs, ";;label:euiTableHeaderCell__content;"),
|
|
34
|
-
euiTableHeaderCell__button: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('width', '100%'), " font-weight:inherit
|
|
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;"),
|
|
35
40
|
euiTableFooterCell: /*#__PURE__*/(0, _react.css)(sharedStyles, " background-color:", euiTheme.colors.lightestShade, ";;label:euiTableFooterCell;")
|
|
36
41
|
};
|
|
37
42
|
};
|