@elastic/eui 91.3.0 → 91.3.1
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 +20 -17
- package/es/components/basic_table/collapsed_item_actions.js +14 -15
- package/es/components/basic_table/expanded_item_actions.js +4 -4
- package/es/components/datagrid/body/header/data_grid_header_cell.js +3 -3
- package/eui.d.ts +5 -4
- package/i18ntokens.json +63 -45
- package/lib/components/basic_table/basic_table.js +20 -17
- package/lib/components/basic_table/collapsed_item_actions.js +14 -15
- package/lib/components/basic_table/expanded_item_actions.js +4 -4
- package/lib/components/datagrid/body/header/data_grid_header_cell.js +3 -3
- package/optimize/es/components/basic_table/basic_table.js +20 -17
- package/optimize/es/components/basic_table/collapsed_item_actions.js +14 -15
- package/optimize/es/components/basic_table/expanded_item_actions.js +4 -4
- package/optimize/es/components/datagrid/body/header/data_grid_header_cell.js +3 -3
- package/optimize/lib/components/basic_table/basic_table.js +20 -17
- package/optimize/lib/components/basic_table/collapsed_item_actions.js +14 -15
- package/optimize/lib/components/basic_table/expanded_item_actions.js +4 -4
- package/optimize/lib/components/datagrid/body/header/data_grid_header_cell.js +3 -3
- package/package.json +2 -4
- package/test-env/components/basic_table/basic_table.js +20 -17
- package/test-env/components/basic_table/collapsed_item_actions.js +14 -15
- package/test-env/components/basic_table/expanded_item_actions.js +4 -4
- package/test-env/components/datagrid/body/header/data_grid_header_cell.js +3 -3
|
@@ -133,7 +133,8 @@ var EuiDataGridHeaderCell = function EuiDataGridHeaderCell(_ref) {
|
|
|
133
133
|
});
|
|
134
134
|
},
|
|
135
135
|
"aria-describedby": "".concat(sortingAriaId, " ").concat(actionsAriaId),
|
|
136
|
-
ref: actionsButtonRef
|
|
136
|
+
ref: actionsButtonRef,
|
|
137
|
+
"data-test-subj": "dataGridHeaderCellActionButton-".concat(id)
|
|
137
138
|
}, cellContent, (0, _react2.jsx)(_popover.EuiPopover, _extends({
|
|
138
139
|
display: "block",
|
|
139
140
|
panelPaddingSize: "none",
|
|
@@ -155,8 +156,7 @@ var EuiDataGridHeaderCell = function EuiDataGridHeaderCell(_ref) {
|
|
|
155
156
|
}, (0, _react2.jsx)(_icon.EuiIcon, {
|
|
156
157
|
type: "boxesVertical",
|
|
157
158
|
size: "s",
|
|
158
|
-
color: "text"
|
|
159
|
-
"data-test-subj": "dataGridHeaderCellActionButton-".concat(id)
|
|
159
|
+
color: "text"
|
|
160
160
|
})),
|
|
161
161
|
isOpen: isPopoverOpen,
|
|
162
162
|
closePopover: function closePopover() {
|
|
@@ -798,19 +798,22 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
798
798
|
}, {
|
|
799
799
|
key: "renderItemActionsCell",
|
|
800
800
|
value: function renderItemActionsCell(itemId, item, column, columnIndex) {
|
|
801
|
-
|
|
802
|
-
var
|
|
803
|
-
return _this7.state.selection.length === 0 && (!action.enabled || action.enabled(item));
|
|
804
|
-
};
|
|
801
|
+
// Disable all actions if any row(s) are selected
|
|
802
|
+
var allDisabled = this.state.selection.length > 0;
|
|
805
803
|
var actualActions = column.actions.filter(function (action) {
|
|
806
804
|
return !action.available || action.available(item);
|
|
807
805
|
});
|
|
808
806
|
if (actualActions.length > 2) {
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
}
|
|
813
|
-
|
|
807
|
+
if (allDisabled) {
|
|
808
|
+
// If all actions are disabled, do not show any actions but the popover toggle
|
|
809
|
+
actualActions = [];
|
|
810
|
+
} else {
|
|
811
|
+
// if any of the actions `isPrimary`, add them inline as well, but only the first 2
|
|
812
|
+
var primaryActions = actualActions.filter(function (o) {
|
|
813
|
+
return o.isPrimary;
|
|
814
|
+
});
|
|
815
|
+
actualActions = primaryActions.slice(0, 2);
|
|
816
|
+
}
|
|
814
817
|
|
|
815
818
|
// if we have more than 1 action, we don't show them all in the cell, instead we
|
|
816
819
|
// put them all in a popover tool. This effectively means we can only have a maximum
|
|
@@ -823,18 +826,18 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
823
826
|
render: function render(item) {
|
|
824
827
|
return ___EmotionJSX(CollapsedItemActions, {
|
|
825
828
|
actions: column.actions,
|
|
829
|
+
actionsDisabled: allDisabled,
|
|
826
830
|
itemId: itemId,
|
|
827
|
-
item: item
|
|
828
|
-
actionEnabled: actionEnabled
|
|
831
|
+
item: item
|
|
829
832
|
});
|
|
830
833
|
}
|
|
831
834
|
});
|
|
832
835
|
}
|
|
833
836
|
var tools = ___EmotionJSX(ExpandedItemActions, {
|
|
834
837
|
actions: actualActions,
|
|
838
|
+
actionsDisabled: allDisabled,
|
|
835
839
|
itemId: itemId,
|
|
836
|
-
item: item
|
|
837
|
-
actionEnabled: actionEnabled
|
|
840
|
+
item: item
|
|
838
841
|
});
|
|
839
842
|
var key = "record_actions_".concat(itemId, "_").concat(columnIndex);
|
|
840
843
|
return ___EmotionJSX(EuiTableRowCell, {
|
|
@@ -921,7 +924,7 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
921
924
|
}, {
|
|
922
925
|
key: "renderPaginationBar",
|
|
923
926
|
value: function renderPaginationBar() {
|
|
924
|
-
var
|
|
927
|
+
var _this7 = this;
|
|
925
928
|
var _this$props11 = this.props,
|
|
926
929
|
error = _this$props11.error,
|
|
927
930
|
pagination = _this$props11.pagination,
|
|
@@ -940,9 +943,9 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
940
943
|
}, function (tablePagination) {
|
|
941
944
|
return ___EmotionJSX(PaginationBar, {
|
|
942
945
|
pagination: pagination,
|
|
943
|
-
onPageSizeChange:
|
|
944
|
-
onPageChange:
|
|
945
|
-
"aria-controls":
|
|
946
|
+
onPageSizeChange: _this7.onPageSizeChange.bind(_this7),
|
|
947
|
+
onPageChange: _this7.onPageChange.bind(_this7),
|
|
948
|
+
"aria-controls": _this7.tableId,
|
|
946
949
|
"aria-label": tablePagination
|
|
947
950
|
});
|
|
948
951
|
});
|
|
@@ -20,16 +20,12 @@ export var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
20
20
|
var actions = _ref.actions,
|
|
21
21
|
itemId = _ref.itemId,
|
|
22
22
|
item = _ref.item,
|
|
23
|
-
|
|
23
|
+
actionsDisabled = _ref.actionsDisabled,
|
|
24
24
|
className = _ref.className;
|
|
25
25
|
var _useState = useState(false),
|
|
26
26
|
_useState2 = _slicedToArray(_useState, 2),
|
|
27
27
|
popoverOpen = _useState2[0],
|
|
28
28
|
setPopoverOpen = _useState2[1];
|
|
29
|
-
var _useState3 = useState(true),
|
|
30
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
31
|
-
allDisabled = _useState4[0],
|
|
32
|
-
setAllDisabled = _useState4[1];
|
|
33
29
|
var onClickItem = useCallback(function (onClickAction) {
|
|
34
30
|
setPopoverOpen(false);
|
|
35
31
|
onClickAction === null || onClickAction === void 0 ? void 0 : onClickAction();
|
|
@@ -39,8 +35,7 @@ export var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
39
35
|
var _action$available, _action$available2;
|
|
40
36
|
var available = (_action$available = (_action$available2 = action.available) === null || _action$available2 === void 0 ? void 0 : _action$available2.call(action, item)) !== null && _action$available !== void 0 ? _action$available : true;
|
|
41
37
|
if (!available) return controls;
|
|
42
|
-
var enabled =
|
|
43
|
-
if (enabled) setAllDisabled(false);
|
|
38
|
+
var enabled = action.enabled == null || action.enabled(item);
|
|
44
39
|
if (isCustomItemAction(action)) {
|
|
45
40
|
var customAction = action;
|
|
46
41
|
var actionControl = customAction.render(item, enabled);
|
|
@@ -71,7 +66,7 @@ export var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
71
66
|
controls.push(___EmotionJSX(EuiContextMenuItem, {
|
|
72
67
|
key: index,
|
|
73
68
|
className: "euiBasicTable__collapsedAction",
|
|
74
|
-
disabled: !enabled,
|
|
69
|
+
disabled: !enabled && !actionsDisabled,
|
|
75
70
|
href: href,
|
|
76
71
|
target: target,
|
|
77
72
|
icon: icon,
|
|
@@ -89,17 +84,21 @@ export var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
89
84
|
}
|
|
90
85
|
return controls;
|
|
91
86
|
}, []);
|
|
92
|
-
}, [actions,
|
|
87
|
+
}, [actions, actionsDisabled, item, onClickItem]);
|
|
93
88
|
var popoverButton = ___EmotionJSX(EuiI18n, {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}, function (
|
|
89
|
+
tokens: ['euiCollapsedItemActions.allActions', 'euiCollapsedItemActions.allActionsDisabled'],
|
|
90
|
+
defaults: ['All actions', 'Individual item actions are disabled when rows are being selected.']
|
|
91
|
+
}, function (_ref2) {
|
|
92
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
93
|
+
allActions = _ref3[0],
|
|
94
|
+
allActionsDisabled = _ref3[1];
|
|
97
95
|
return ___EmotionJSX(EuiButtonIcon, {
|
|
98
96
|
className: className,
|
|
99
|
-
"aria-label": allActions,
|
|
97
|
+
"aria-label": actionsDisabled ? allActionsDisabled : allActions,
|
|
98
|
+
title: actionsDisabled ? allActionsDisabled : undefined,
|
|
100
99
|
iconType: "boxesHorizontal",
|
|
101
100
|
color: "text",
|
|
102
|
-
isDisabled:
|
|
101
|
+
isDisabled: actionsDisabled,
|
|
103
102
|
onClick: function onClick() {
|
|
104
103
|
return setPopoverOpen(function (isOpen) {
|
|
105
104
|
return !isOpen;
|
|
@@ -108,7 +107,7 @@ export var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
108
107
|
"data-test-subj": "euiCollapsedItemActionsButton"
|
|
109
108
|
});
|
|
110
109
|
});
|
|
111
|
-
var withTooltip = !
|
|
110
|
+
var withTooltip = !actionsDisabled && ___EmotionJSX(EuiI18n, {
|
|
112
111
|
token: "euiCollapsedItemActions.allActions",
|
|
113
112
|
default: "All actions"
|
|
114
113
|
}, function (allActions) {
|
|
@@ -16,7 +16,7 @@ export var ExpandedItemActions = function ExpandedItemActions(_ref) {
|
|
|
16
16
|
var actions = _ref.actions,
|
|
17
17
|
itemId = _ref.itemId,
|
|
18
18
|
item = _ref.item,
|
|
19
|
-
|
|
19
|
+
actionsDisabled = _ref.actionsDisabled,
|
|
20
20
|
className = _ref.className;
|
|
21
21
|
var moreThanThree = actions.length > 2;
|
|
22
22
|
return ___EmotionJSX(React.Fragment, null, actions.reduce(function (tools, action, index) {
|
|
@@ -24,7 +24,7 @@ export var ExpandedItemActions = function ExpandedItemActions(_ref) {
|
|
|
24
24
|
if (!available) {
|
|
25
25
|
return tools;
|
|
26
26
|
}
|
|
27
|
-
var enabled =
|
|
27
|
+
var enabled = action.enabled == null || action.enabled(item);
|
|
28
28
|
var key = "item_action_".concat(itemId, "_").concat(index);
|
|
29
29
|
var classes = classNames(className, {
|
|
30
30
|
expandedItemActions__completelyHide: moreThanThree && index < 2
|
|
@@ -36,7 +36,7 @@ export var ExpandedItemActions = function ExpandedItemActions(_ref) {
|
|
|
36
36
|
className: classes,
|
|
37
37
|
index: index,
|
|
38
38
|
action: action,
|
|
39
|
-
enabled: enabled,
|
|
39
|
+
enabled: enabled && !actionsDisabled,
|
|
40
40
|
item: item
|
|
41
41
|
}));
|
|
42
42
|
} else {
|
|
@@ -44,7 +44,7 @@ export var ExpandedItemActions = function ExpandedItemActions(_ref) {
|
|
|
44
44
|
key: key,
|
|
45
45
|
className: classes,
|
|
46
46
|
action: action,
|
|
47
|
-
enabled: enabled,
|
|
47
|
+
enabled: enabled && !actionsDisabled,
|
|
48
48
|
item: item
|
|
49
49
|
}));
|
|
50
50
|
}
|
|
@@ -117,7 +117,8 @@ export var EuiDataGridHeaderCell = function EuiDataGridHeaderCell(_ref) {
|
|
|
117
117
|
});
|
|
118
118
|
},
|
|
119
119
|
"aria-describedby": "".concat(sortingAriaId, " ").concat(actionsAriaId),
|
|
120
|
-
ref: actionsButtonRef
|
|
120
|
+
ref: actionsButtonRef,
|
|
121
|
+
"data-test-subj": "dataGridHeaderCellActionButton-".concat(id)
|
|
121
122
|
}, cellContent, ___EmotionJSX(EuiPopover, _extends({
|
|
122
123
|
display: "block",
|
|
123
124
|
panelPaddingSize: "none",
|
|
@@ -139,8 +140,7 @@ export var EuiDataGridHeaderCell = function EuiDataGridHeaderCell(_ref) {
|
|
|
139
140
|
}, ___EmotionJSX(EuiIcon, {
|
|
140
141
|
type: "boxesVertical",
|
|
141
142
|
size: "s",
|
|
142
|
-
color: "text"
|
|
143
|
-
"data-test-subj": "dataGridHeaderCellActionButton-".concat(id)
|
|
143
|
+
color: "text"
|
|
144
144
|
})),
|
|
145
145
|
isOpen: isPopoverOpen,
|
|
146
146
|
closePopover: function closePopover() {
|
|
@@ -807,19 +807,22 @@ var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
807
807
|
}, {
|
|
808
808
|
key: "renderItemActionsCell",
|
|
809
809
|
value: function renderItemActionsCell(itemId, item, column, columnIndex) {
|
|
810
|
-
|
|
811
|
-
var
|
|
812
|
-
return _this7.state.selection.length === 0 && (!action.enabled || action.enabled(item));
|
|
813
|
-
};
|
|
810
|
+
// Disable all actions if any row(s) are selected
|
|
811
|
+
var allDisabled = this.state.selection.length > 0;
|
|
814
812
|
var actualActions = column.actions.filter(function (action) {
|
|
815
813
|
return !action.available || action.available(item);
|
|
816
814
|
});
|
|
817
815
|
if (actualActions.length > 2) {
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
}
|
|
822
|
-
|
|
816
|
+
if (allDisabled) {
|
|
817
|
+
// If all actions are disabled, do not show any actions but the popover toggle
|
|
818
|
+
actualActions = [];
|
|
819
|
+
} else {
|
|
820
|
+
// if any of the actions `isPrimary`, add them inline as well, but only the first 2
|
|
821
|
+
var primaryActions = actualActions.filter(function (o) {
|
|
822
|
+
return o.isPrimary;
|
|
823
|
+
});
|
|
824
|
+
actualActions = primaryActions.slice(0, 2);
|
|
825
|
+
}
|
|
823
826
|
|
|
824
827
|
// if we have more than 1 action, we don't show them all in the cell, instead we
|
|
825
828
|
// put them all in a popover tool. This effectively means we can only have a maximum
|
|
@@ -832,18 +835,18 @@ var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
832
835
|
render: function render(item) {
|
|
833
836
|
return (0, _react2.jsx)(_collapsed_item_actions.CollapsedItemActions, {
|
|
834
837
|
actions: column.actions,
|
|
838
|
+
actionsDisabled: allDisabled,
|
|
835
839
|
itemId: itemId,
|
|
836
|
-
item: item
|
|
837
|
-
actionEnabled: actionEnabled
|
|
840
|
+
item: item
|
|
838
841
|
});
|
|
839
842
|
}
|
|
840
843
|
});
|
|
841
844
|
}
|
|
842
845
|
var tools = (0, _react2.jsx)(_expanded_item_actions.ExpandedItemActions, {
|
|
843
846
|
actions: actualActions,
|
|
847
|
+
actionsDisabled: allDisabled,
|
|
844
848
|
itemId: itemId,
|
|
845
|
-
item: item
|
|
846
|
-
actionEnabled: actionEnabled
|
|
849
|
+
item: item
|
|
847
850
|
});
|
|
848
851
|
var key = "record_actions_".concat(itemId, "_").concat(columnIndex);
|
|
849
852
|
return (0, _react2.jsx)(_table.EuiTableRowCell, {
|
|
@@ -930,7 +933,7 @@ var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
930
933
|
}, {
|
|
931
934
|
key: "renderPaginationBar",
|
|
932
935
|
value: function renderPaginationBar() {
|
|
933
|
-
var
|
|
936
|
+
var _this7 = this;
|
|
934
937
|
var _this$props11 = this.props,
|
|
935
938
|
error = _this$props11.error,
|
|
936
939
|
pagination = _this$props11.pagination,
|
|
@@ -949,9 +952,9 @@ var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
949
952
|
}, function (tablePagination) {
|
|
950
953
|
return (0, _react2.jsx)(_pagination_bar.PaginationBar, {
|
|
951
954
|
pagination: pagination,
|
|
952
|
-
onPageSizeChange:
|
|
953
|
-
onPageChange:
|
|
954
|
-
"aria-controls":
|
|
955
|
+
onPageSizeChange: _this7.onPageSizeChange.bind(_this7),
|
|
956
|
+
onPageChange: _this7.onPageChange.bind(_this7),
|
|
957
|
+
"aria-controls": _this7.tableId,
|
|
955
958
|
"aria-label": tablePagination
|
|
956
959
|
});
|
|
957
960
|
});
|
|
@@ -30,16 +30,12 @@ var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
30
30
|
var actions = _ref.actions,
|
|
31
31
|
itemId = _ref.itemId,
|
|
32
32
|
item = _ref.item,
|
|
33
|
-
|
|
33
|
+
actionsDisabled = _ref.actionsDisabled,
|
|
34
34
|
className = _ref.className;
|
|
35
35
|
var _useState = (0, _react.useState)(false),
|
|
36
36
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
37
37
|
popoverOpen = _useState2[0],
|
|
38
38
|
setPopoverOpen = _useState2[1];
|
|
39
|
-
var _useState3 = (0, _react.useState)(true),
|
|
40
|
-
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
41
|
-
allDisabled = _useState4[0],
|
|
42
|
-
setAllDisabled = _useState4[1];
|
|
43
39
|
var onClickItem = (0, _react.useCallback)(function (onClickAction) {
|
|
44
40
|
setPopoverOpen(false);
|
|
45
41
|
onClickAction === null || onClickAction === void 0 ? void 0 : onClickAction();
|
|
@@ -49,8 +45,7 @@ var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
49
45
|
var _action$available, _action$available2;
|
|
50
46
|
var available = (_action$available = (_action$available2 = action.available) === null || _action$available2 === void 0 ? void 0 : _action$available2.call(action, item)) !== null && _action$available !== void 0 ? _action$available : true;
|
|
51
47
|
if (!available) return controls;
|
|
52
|
-
var enabled =
|
|
53
|
-
if (enabled) setAllDisabled(false);
|
|
48
|
+
var enabled = action.enabled == null || action.enabled(item);
|
|
54
49
|
if ((0, _action_types.isCustomItemAction)(action)) {
|
|
55
50
|
var customAction = action;
|
|
56
51
|
var actionControl = customAction.render(item, enabled);
|
|
@@ -81,7 +76,7 @@ var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
81
76
|
controls.push((0, _react2.jsx)(_context_menu.EuiContextMenuItem, {
|
|
82
77
|
key: index,
|
|
83
78
|
className: "euiBasicTable__collapsedAction",
|
|
84
|
-
disabled: !enabled,
|
|
79
|
+
disabled: !enabled && !actionsDisabled,
|
|
85
80
|
href: href,
|
|
86
81
|
target: target,
|
|
87
82
|
icon: icon,
|
|
@@ -99,17 +94,21 @@ var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
99
94
|
}
|
|
100
95
|
return controls;
|
|
101
96
|
}, []);
|
|
102
|
-
}, [actions,
|
|
97
|
+
}, [actions, actionsDisabled, item, onClickItem]);
|
|
103
98
|
var popoverButton = (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}, function (
|
|
99
|
+
tokens: ['euiCollapsedItemActions.allActions', 'euiCollapsedItemActions.allActionsDisabled'],
|
|
100
|
+
defaults: ['All actions', 'Individual item actions are disabled when rows are being selected.']
|
|
101
|
+
}, function (_ref2) {
|
|
102
|
+
var _ref3 = (0, _slicedToArray2.default)(_ref2, 2),
|
|
103
|
+
allActions = _ref3[0],
|
|
104
|
+
allActionsDisabled = _ref3[1];
|
|
107
105
|
return (0, _react2.jsx)(_button.EuiButtonIcon, {
|
|
108
106
|
className: className,
|
|
109
|
-
"aria-label": allActions,
|
|
107
|
+
"aria-label": actionsDisabled ? allActionsDisabled : allActions,
|
|
108
|
+
title: actionsDisabled ? allActionsDisabled : undefined,
|
|
110
109
|
iconType: "boxesHorizontal",
|
|
111
110
|
color: "text",
|
|
112
|
-
isDisabled:
|
|
111
|
+
isDisabled: actionsDisabled,
|
|
113
112
|
onClick: function onClick() {
|
|
114
113
|
return setPopoverOpen(function (isOpen) {
|
|
115
114
|
return !isOpen;
|
|
@@ -118,7 +117,7 @@ var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
118
117
|
"data-test-subj": "euiCollapsedItemActionsButton"
|
|
119
118
|
});
|
|
120
119
|
});
|
|
121
|
-
var withTooltip = !
|
|
120
|
+
var withTooltip = !actionsDisabled && (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
122
121
|
token: "euiCollapsedItemActions.allActions",
|
|
123
122
|
default: "All actions"
|
|
124
123
|
}, function (allActions) {
|
|
@@ -23,7 +23,7 @@ var ExpandedItemActions = function ExpandedItemActions(_ref) {
|
|
|
23
23
|
var actions = _ref.actions,
|
|
24
24
|
itemId = _ref.itemId,
|
|
25
25
|
item = _ref.item,
|
|
26
|
-
|
|
26
|
+
actionsDisabled = _ref.actionsDisabled,
|
|
27
27
|
className = _ref.className;
|
|
28
28
|
var moreThanThree = actions.length > 2;
|
|
29
29
|
return (0, _react2.jsx)(_react.default.Fragment, null, actions.reduce(function (tools, action, index) {
|
|
@@ -31,7 +31,7 @@ var ExpandedItemActions = function ExpandedItemActions(_ref) {
|
|
|
31
31
|
if (!available) {
|
|
32
32
|
return tools;
|
|
33
33
|
}
|
|
34
|
-
var enabled =
|
|
34
|
+
var enabled = action.enabled == null || action.enabled(item);
|
|
35
35
|
var key = "item_action_".concat(itemId, "_").concat(index);
|
|
36
36
|
var classes = (0, _classnames.default)(className, {
|
|
37
37
|
expandedItemActions__completelyHide: moreThanThree && index < 2
|
|
@@ -43,7 +43,7 @@ var ExpandedItemActions = function ExpandedItemActions(_ref) {
|
|
|
43
43
|
className: classes,
|
|
44
44
|
index: index,
|
|
45
45
|
action: action,
|
|
46
|
-
enabled: enabled,
|
|
46
|
+
enabled: enabled && !actionsDisabled,
|
|
47
47
|
item: item
|
|
48
48
|
}));
|
|
49
49
|
} else {
|
|
@@ -51,7 +51,7 @@ var ExpandedItemActions = function ExpandedItemActions(_ref) {
|
|
|
51
51
|
key: key,
|
|
52
52
|
className: classes,
|
|
53
53
|
action: action,
|
|
54
|
-
enabled: enabled,
|
|
54
|
+
enabled: enabled && !actionsDisabled,
|
|
55
55
|
item: item
|
|
56
56
|
}));
|
|
57
57
|
}
|
|
@@ -125,7 +125,8 @@ var EuiDataGridHeaderCell = function EuiDataGridHeaderCell(_ref) {
|
|
|
125
125
|
});
|
|
126
126
|
},
|
|
127
127
|
"aria-describedby": "".concat(sortingAriaId, " ").concat(actionsAriaId),
|
|
128
|
-
ref: actionsButtonRef
|
|
128
|
+
ref: actionsButtonRef,
|
|
129
|
+
"data-test-subj": "dataGridHeaderCellActionButton-".concat(id)
|
|
129
130
|
}, cellContent, (0, _react2.jsx)(_popover.EuiPopover, (0, _extends2.default)({
|
|
130
131
|
display: "block",
|
|
131
132
|
panelPaddingSize: "none",
|
|
@@ -147,8 +148,7 @@ var EuiDataGridHeaderCell = function EuiDataGridHeaderCell(_ref) {
|
|
|
147
148
|
}, (0, _react2.jsx)(_icon.EuiIcon, {
|
|
148
149
|
type: "boxesVertical",
|
|
149
150
|
size: "s",
|
|
150
|
-
color: "text"
|
|
151
|
-
"data-test-subj": "dataGridHeaderCellActionButton-".concat(id)
|
|
151
|
+
color: "text"
|
|
152
152
|
})),
|
|
153
153
|
isOpen: isPopoverOpen,
|
|
154
154
|
closePopover: function closePopover() {
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elastic/eui",
|
|
3
3
|
"description": "Elastic UI Component Library",
|
|
4
|
-
"version": "91.3.
|
|
4
|
+
"version": "91.3.1",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "lib",
|
|
7
7
|
"module": "es",
|
|
8
8
|
"types": "eui.d.ts",
|
|
9
|
-
"docker_image": "20.
|
|
9
|
+
"docker_image": "20.10.0",
|
|
10
10
|
"engines": {
|
|
11
11
|
"node": "16.x || 18.x || >=20.x"
|
|
12
12
|
},
|
|
@@ -16,8 +16,6 @@
|
|
|
16
16
|
],
|
|
17
17
|
"scripts": {
|
|
18
18
|
"start": "cross-env BABEL_MODULES=false webpack serve --config=src-docs/webpack.config.js",
|
|
19
|
-
"test-docker": "node ./scripts/test-docker.js",
|
|
20
|
-
"test-a11y-docker": "node ./scripts/test-a11y-docker.js",
|
|
21
19
|
"build-docs": "cross-env BABEL_MODULES=false cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=4096 webpack --config=src-docs/webpack.config.js",
|
|
22
20
|
"build": "yarn extract-i18n-strings && node ./scripts/compile-clean.js && node ./scripts/compile-eui.js && yarn compile-scss",
|
|
23
21
|
"build-pack": "yarn build && npm pack",
|
|
@@ -808,19 +808,22 @@ var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
808
808
|
}, {
|
|
809
809
|
key: "renderItemActionsCell",
|
|
810
810
|
value: function renderItemActionsCell(itemId, item, column, columnIndex) {
|
|
811
|
-
|
|
812
|
-
var
|
|
813
|
-
return _this7.state.selection.length === 0 && (!action.enabled || action.enabled(item));
|
|
814
|
-
};
|
|
811
|
+
// Disable all actions if any row(s) are selected
|
|
812
|
+
var allDisabled = this.state.selection.length > 0;
|
|
815
813
|
var actualActions = column.actions.filter(function (action) {
|
|
816
814
|
return !action.available || action.available(item);
|
|
817
815
|
});
|
|
818
816
|
if (actualActions.length > 2) {
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
}
|
|
823
|
-
|
|
817
|
+
if (allDisabled) {
|
|
818
|
+
// If all actions are disabled, do not show any actions but the popover toggle
|
|
819
|
+
actualActions = [];
|
|
820
|
+
} else {
|
|
821
|
+
// if any of the actions `isPrimary`, add them inline as well, but only the first 2
|
|
822
|
+
var primaryActions = actualActions.filter(function (o) {
|
|
823
|
+
return o.isPrimary;
|
|
824
|
+
});
|
|
825
|
+
actualActions = primaryActions.slice(0, 2);
|
|
826
|
+
}
|
|
824
827
|
|
|
825
828
|
// if we have more than 1 action, we don't show them all in the cell, instead we
|
|
826
829
|
// put them all in a popover tool. This effectively means we can only have a maximum
|
|
@@ -833,18 +836,18 @@ var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
833
836
|
render: function render(item) {
|
|
834
837
|
return (0, _react2.jsx)(_collapsed_item_actions.CollapsedItemActions, {
|
|
835
838
|
actions: column.actions,
|
|
839
|
+
actionsDisabled: allDisabled,
|
|
836
840
|
itemId: itemId,
|
|
837
|
-
item: item
|
|
838
|
-
actionEnabled: actionEnabled
|
|
841
|
+
item: item
|
|
839
842
|
});
|
|
840
843
|
}
|
|
841
844
|
});
|
|
842
845
|
}
|
|
843
846
|
var tools = (0, _react2.jsx)(_expanded_item_actions.ExpandedItemActions, {
|
|
844
847
|
actions: actualActions,
|
|
848
|
+
actionsDisabled: allDisabled,
|
|
845
849
|
itemId: itemId,
|
|
846
|
-
item: item
|
|
847
|
-
actionEnabled: actionEnabled
|
|
850
|
+
item: item
|
|
848
851
|
});
|
|
849
852
|
var key = "record_actions_".concat(itemId, "_").concat(columnIndex);
|
|
850
853
|
return (0, _react2.jsx)(_table.EuiTableRowCell, {
|
|
@@ -931,7 +934,7 @@ var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
931
934
|
}, {
|
|
932
935
|
key: "renderPaginationBar",
|
|
933
936
|
value: function renderPaginationBar() {
|
|
934
|
-
var
|
|
937
|
+
var _this7 = this;
|
|
935
938
|
var _this$props11 = this.props,
|
|
936
939
|
error = _this$props11.error,
|
|
937
940
|
pagination = _this$props11.pagination,
|
|
@@ -950,9 +953,9 @@ var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
950
953
|
}, function (tablePagination) {
|
|
951
954
|
return (0, _react2.jsx)(_pagination_bar.PaginationBar, {
|
|
952
955
|
pagination: pagination,
|
|
953
|
-
onPageSizeChange:
|
|
954
|
-
onPageChange:
|
|
955
|
-
"aria-controls":
|
|
956
|
+
onPageSizeChange: _this7.onPageSizeChange.bind(_this7),
|
|
957
|
+
onPageChange: _this7.onPageChange.bind(_this7),
|
|
958
|
+
"aria-controls": _this7.tableId,
|
|
956
959
|
"aria-label": tablePagination
|
|
957
960
|
});
|
|
958
961
|
});
|
|
@@ -30,16 +30,12 @@ var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
30
30
|
var actions = _ref.actions,
|
|
31
31
|
itemId = _ref.itemId,
|
|
32
32
|
item = _ref.item,
|
|
33
|
-
|
|
33
|
+
actionsDisabled = _ref.actionsDisabled,
|
|
34
34
|
className = _ref.className;
|
|
35
35
|
var _useState = (0, _react.useState)(false),
|
|
36
36
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
37
37
|
popoverOpen = _useState2[0],
|
|
38
38
|
setPopoverOpen = _useState2[1];
|
|
39
|
-
var _useState3 = (0, _react.useState)(true),
|
|
40
|
-
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
41
|
-
allDisabled = _useState4[0],
|
|
42
|
-
setAllDisabled = _useState4[1];
|
|
43
39
|
var onClickItem = (0, _react.useCallback)(function (onClickAction) {
|
|
44
40
|
setPopoverOpen(false);
|
|
45
41
|
onClickAction === null || onClickAction === void 0 ? void 0 : onClickAction();
|
|
@@ -49,8 +45,7 @@ var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
49
45
|
var _action$available, _action$available2;
|
|
50
46
|
var available = (_action$available = (_action$available2 = action.available) === null || _action$available2 === void 0 ? void 0 : _action$available2.call(action, item)) !== null && _action$available !== void 0 ? _action$available : true;
|
|
51
47
|
if (!available) return controls;
|
|
52
|
-
var enabled =
|
|
53
|
-
if (enabled) setAllDisabled(false);
|
|
48
|
+
var enabled = action.enabled == null || action.enabled(item);
|
|
54
49
|
if ((0, _action_types.isCustomItemAction)(action)) {
|
|
55
50
|
var customAction = action;
|
|
56
51
|
var actionControl = customAction.render(item, enabled);
|
|
@@ -81,7 +76,7 @@ var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
81
76
|
controls.push((0, _react2.jsx)(_context_menu.EuiContextMenuItem, {
|
|
82
77
|
key: index,
|
|
83
78
|
className: "euiBasicTable__collapsedAction",
|
|
84
|
-
disabled: !enabled,
|
|
79
|
+
disabled: !enabled && !actionsDisabled,
|
|
85
80
|
href: href,
|
|
86
81
|
target: target,
|
|
87
82
|
icon: icon,
|
|
@@ -99,17 +94,21 @@ var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
99
94
|
}
|
|
100
95
|
return controls;
|
|
101
96
|
}, []);
|
|
102
|
-
}, [actions,
|
|
97
|
+
}, [actions, actionsDisabled, item, onClickItem]);
|
|
103
98
|
var popoverButton = (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}, function (
|
|
99
|
+
tokens: ['euiCollapsedItemActions.allActions', 'euiCollapsedItemActions.allActionsDisabled'],
|
|
100
|
+
defaults: ['All actions', 'Individual item actions are disabled when rows are being selected.']
|
|
101
|
+
}, function (_ref2) {
|
|
102
|
+
var _ref3 = (0, _slicedToArray2.default)(_ref2, 2),
|
|
103
|
+
allActions = _ref3[0],
|
|
104
|
+
allActionsDisabled = _ref3[1];
|
|
107
105
|
return (0, _react2.jsx)(_button.EuiButtonIcon, {
|
|
108
106
|
className: className,
|
|
109
|
-
"aria-label": allActions,
|
|
107
|
+
"aria-label": actionsDisabled ? allActionsDisabled : allActions,
|
|
108
|
+
title: actionsDisabled ? allActionsDisabled : undefined,
|
|
110
109
|
iconType: "boxesHorizontal",
|
|
111
110
|
color: "text",
|
|
112
|
-
isDisabled:
|
|
111
|
+
isDisabled: actionsDisabled,
|
|
113
112
|
onClick: function onClick() {
|
|
114
113
|
return setPopoverOpen(function (isOpen) {
|
|
115
114
|
return !isOpen;
|
|
@@ -118,7 +117,7 @@ var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
118
117
|
"data-test-subj": "euiCollapsedItemActionsButton"
|
|
119
118
|
});
|
|
120
119
|
});
|
|
121
|
-
var withTooltip = !
|
|
120
|
+
var withTooltip = !actionsDisabled && (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
122
121
|
token: "euiCollapsedItemActions.allActions",
|
|
123
122
|
default: "All actions"
|
|
124
123
|
}, function (allActions) {
|
|
@@ -23,7 +23,7 @@ var ExpandedItemActions = function ExpandedItemActions(_ref) {
|
|
|
23
23
|
var actions = _ref.actions,
|
|
24
24
|
itemId = _ref.itemId,
|
|
25
25
|
item = _ref.item,
|
|
26
|
-
|
|
26
|
+
actionsDisabled = _ref.actionsDisabled,
|
|
27
27
|
className = _ref.className;
|
|
28
28
|
var moreThanThree = actions.length > 2;
|
|
29
29
|
return (0, _react2.jsx)(_react.default.Fragment, null, actions.reduce(function (tools, action, index) {
|
|
@@ -31,7 +31,7 @@ var ExpandedItemActions = function ExpandedItemActions(_ref) {
|
|
|
31
31
|
if (!available) {
|
|
32
32
|
return tools;
|
|
33
33
|
}
|
|
34
|
-
var enabled =
|
|
34
|
+
var enabled = action.enabled == null || action.enabled(item);
|
|
35
35
|
var key = "item_action_".concat(itemId, "_").concat(index);
|
|
36
36
|
var classes = (0, _classnames.default)(className, {
|
|
37
37
|
expandedItemActions__completelyHide: moreThanThree && index < 2
|
|
@@ -43,7 +43,7 @@ var ExpandedItemActions = function ExpandedItemActions(_ref) {
|
|
|
43
43
|
className: classes,
|
|
44
44
|
index: index,
|
|
45
45
|
action: action,
|
|
46
|
-
enabled: enabled,
|
|
46
|
+
enabled: enabled && !actionsDisabled,
|
|
47
47
|
item: item
|
|
48
48
|
}));
|
|
49
49
|
} else {
|
|
@@ -51,7 +51,7 @@ var ExpandedItemActions = function ExpandedItemActions(_ref) {
|
|
|
51
51
|
key: key,
|
|
52
52
|
className: classes,
|
|
53
53
|
action: action,
|
|
54
|
-
enabled: enabled,
|
|
54
|
+
enabled: enabled && !actionsDisabled,
|
|
55
55
|
item: item
|
|
56
56
|
}));
|
|
57
57
|
}
|