@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
|
@@ -810,19 +810,22 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
810
810
|
}, {
|
|
811
811
|
key: "renderItemActionsCell",
|
|
812
812
|
value: function renderItemActionsCell(itemId, item, column, columnIndex) {
|
|
813
|
-
|
|
814
|
-
var
|
|
815
|
-
return _this7.state.selection.length === 0 && (!action.enabled || action.enabled(item));
|
|
816
|
-
};
|
|
813
|
+
// Disable all actions if any row(s) are selected
|
|
814
|
+
var allDisabled = this.state.selection.length > 0;
|
|
817
815
|
var actualActions = column.actions.filter(function (action) {
|
|
818
816
|
return !action.available || action.available(item);
|
|
819
817
|
});
|
|
820
818
|
if (actualActions.length > 2) {
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
}
|
|
825
|
-
|
|
819
|
+
if (allDisabled) {
|
|
820
|
+
// If all actions are disabled, do not show any actions but the popover toggle
|
|
821
|
+
actualActions = [];
|
|
822
|
+
} else {
|
|
823
|
+
// if any of the actions `isPrimary`, add them inline as well, but only the first 2
|
|
824
|
+
var primaryActions = actualActions.filter(function (o) {
|
|
825
|
+
return o.isPrimary;
|
|
826
|
+
});
|
|
827
|
+
actualActions = primaryActions.slice(0, 2);
|
|
828
|
+
}
|
|
826
829
|
|
|
827
830
|
// if we have more than 1 action, we don't show them all in the cell, instead we
|
|
828
831
|
// put them all in a popover tool. This effectively means we can only have a maximum
|
|
@@ -835,18 +838,18 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
835
838
|
render: function render(item) {
|
|
836
839
|
return ___EmotionJSX(CollapsedItemActions, {
|
|
837
840
|
actions: column.actions,
|
|
841
|
+
actionsDisabled: allDisabled,
|
|
838
842
|
itemId: itemId,
|
|
839
|
-
item: item
|
|
840
|
-
actionEnabled: actionEnabled
|
|
843
|
+
item: item
|
|
841
844
|
});
|
|
842
845
|
}
|
|
843
846
|
});
|
|
844
847
|
}
|
|
845
848
|
var tools = ___EmotionJSX(ExpandedItemActions, {
|
|
846
849
|
actions: actualActions,
|
|
850
|
+
actionsDisabled: allDisabled,
|
|
847
851
|
itemId: itemId,
|
|
848
|
-
item: item
|
|
849
|
-
actionEnabled: actionEnabled
|
|
852
|
+
item: item
|
|
850
853
|
});
|
|
851
854
|
var key = "record_actions_".concat(itemId, "_").concat(columnIndex);
|
|
852
855
|
return ___EmotionJSX(EuiTableRowCell, {
|
|
@@ -933,7 +936,7 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
933
936
|
}, {
|
|
934
937
|
key: "renderPaginationBar",
|
|
935
938
|
value: function renderPaginationBar() {
|
|
936
|
-
var
|
|
939
|
+
var _this7 = this;
|
|
937
940
|
var _this$props11 = this.props,
|
|
938
941
|
error = _this$props11.error,
|
|
939
942
|
pagination = _this$props11.pagination,
|
|
@@ -952,9 +955,9 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
952
955
|
}, function (tablePagination) {
|
|
953
956
|
return ___EmotionJSX(PaginationBar, {
|
|
954
957
|
pagination: pagination,
|
|
955
|
-
onPageSizeChange:
|
|
956
|
-
onPageChange:
|
|
957
|
-
"aria-controls":
|
|
958
|
+
onPageSizeChange: _this7.onPageSizeChange.bind(_this7),
|
|
959
|
+
onPageChange: _this7.onPageChange.bind(_this7),
|
|
960
|
+
"aria-controls": _this7.tableId,
|
|
958
961
|
"aria-label": tablePagination
|
|
959
962
|
});
|
|
960
963
|
});
|
|
@@ -25,16 +25,12 @@ export var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
25
25
|
var actions = _ref.actions,
|
|
26
26
|
itemId = _ref.itemId,
|
|
27
27
|
item = _ref.item,
|
|
28
|
-
|
|
28
|
+
actionsDisabled = _ref.actionsDisabled,
|
|
29
29
|
className = _ref.className;
|
|
30
30
|
var _useState = useState(false),
|
|
31
31
|
_useState2 = _slicedToArray(_useState, 2),
|
|
32
32
|
popoverOpen = _useState2[0],
|
|
33
33
|
setPopoverOpen = _useState2[1];
|
|
34
|
-
var _useState3 = useState(true),
|
|
35
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
36
|
-
allDisabled = _useState4[0],
|
|
37
|
-
setAllDisabled = _useState4[1];
|
|
38
34
|
var onClickItem = useCallback(function (onClickAction) {
|
|
39
35
|
setPopoverOpen(false);
|
|
40
36
|
onClickAction === null || onClickAction === void 0 ? void 0 : onClickAction();
|
|
@@ -44,8 +40,7 @@ export var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
44
40
|
var _action$available, _action$available2;
|
|
45
41
|
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;
|
|
46
42
|
if (!available) return controls;
|
|
47
|
-
var enabled =
|
|
48
|
-
if (enabled) setAllDisabled(false);
|
|
43
|
+
var enabled = action.enabled == null || action.enabled(item);
|
|
49
44
|
if (isCustomItemAction(action)) {
|
|
50
45
|
var customAction = action;
|
|
51
46
|
var actionControl = customAction.render(item, enabled);
|
|
@@ -76,7 +71,7 @@ export var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
76
71
|
controls.push(___EmotionJSX(EuiContextMenuItem, {
|
|
77
72
|
key: index,
|
|
78
73
|
className: "euiBasicTable__collapsedAction",
|
|
79
|
-
disabled: !enabled,
|
|
74
|
+
disabled: !enabled && !actionsDisabled,
|
|
80
75
|
href: href,
|
|
81
76
|
target: target,
|
|
82
77
|
icon: icon,
|
|
@@ -94,17 +89,21 @@ export var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
94
89
|
}
|
|
95
90
|
return controls;
|
|
96
91
|
}, []);
|
|
97
|
-
}, [actions,
|
|
92
|
+
}, [actions, actionsDisabled, item, onClickItem]);
|
|
98
93
|
var popoverButton = ___EmotionJSX(EuiI18n, {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}, function (
|
|
94
|
+
tokens: ['euiCollapsedItemActions.allActions', 'euiCollapsedItemActions.allActionsDisabled'],
|
|
95
|
+
defaults: ['All actions', 'Individual item actions are disabled when rows are being selected.']
|
|
96
|
+
}, function (_ref2) {
|
|
97
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
98
|
+
allActions = _ref3[0],
|
|
99
|
+
allActionsDisabled = _ref3[1];
|
|
102
100
|
return ___EmotionJSX(EuiButtonIcon, {
|
|
103
101
|
className: className,
|
|
104
|
-
"aria-label": allActions,
|
|
102
|
+
"aria-label": actionsDisabled ? allActionsDisabled : allActions,
|
|
103
|
+
title: actionsDisabled ? allActionsDisabled : undefined,
|
|
105
104
|
iconType: "boxesHorizontal",
|
|
106
105
|
color: "text",
|
|
107
|
-
isDisabled:
|
|
106
|
+
isDisabled: actionsDisabled,
|
|
108
107
|
onClick: function onClick() {
|
|
109
108
|
return setPopoverOpen(function (isOpen) {
|
|
110
109
|
return !isOpen;
|
|
@@ -113,7 +112,7 @@ export var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
113
112
|
"data-test-subj": "euiCollapsedItemActionsButton"
|
|
114
113
|
});
|
|
115
114
|
});
|
|
116
|
-
var withTooltip = !
|
|
115
|
+
var withTooltip = !actionsDisabled && ___EmotionJSX(EuiI18n, {
|
|
117
116
|
token: "euiCollapsedItemActions.allActions",
|
|
118
117
|
default: "All actions"
|
|
119
118
|
}, 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
|
}
|
|
@@ -126,7 +126,8 @@ export var EuiDataGridHeaderCell = function EuiDataGridHeaderCell(_ref) {
|
|
|
126
126
|
});
|
|
127
127
|
},
|
|
128
128
|
"aria-describedby": "".concat(sortingAriaId, " ").concat(actionsAriaId),
|
|
129
|
-
ref: actionsButtonRef
|
|
129
|
+
ref: actionsButtonRef,
|
|
130
|
+
"data-test-subj": "dataGridHeaderCellActionButton-".concat(id)
|
|
130
131
|
}, cellContent, ___EmotionJSX(EuiPopover, _extends({
|
|
131
132
|
display: "block",
|
|
132
133
|
panelPaddingSize: "none",
|
|
@@ -148,8 +149,7 @@ export var EuiDataGridHeaderCell = function EuiDataGridHeaderCell(_ref) {
|
|
|
148
149
|
}, ___EmotionJSX(EuiIcon, {
|
|
149
150
|
type: "boxesVertical",
|
|
150
151
|
size: "s",
|
|
151
|
-
color: "text"
|
|
152
|
-
"data-test-subj": "dataGridHeaderCellActionButton-".concat(id)
|
|
152
|
+
color: "text"
|
|
153
153
|
})),
|
|
154
154
|
isOpen: isPopoverOpen,
|
|
155
155
|
closePopover: function closePopover() {
|
package/eui.d.ts
CHANGED
|
@@ -22089,10 +22089,10 @@ declare module '@elastic/eui/src/components/basic_table/collapsed_item_actions'
|
|
|
22089
22089
|
actions: Array<Action<T>>;
|
|
22090
22090
|
item: T;
|
|
22091
22091
|
itemId: ItemIdResolved;
|
|
22092
|
-
|
|
22092
|
+
actionsDisabled: boolean;
|
|
22093
22093
|
className?: string;
|
|
22094
22094
|
}
|
|
22095
|
-
export const CollapsedItemActions: <T extends {}>({ actions, itemId, item,
|
|
22095
|
+
export const CollapsedItemActions: <T extends {}>({ actions, itemId, item, actionsDisabled, className, }: CollapsedItemActionsProps<T>) => React.JSX.Element;
|
|
22096
22096
|
|
|
22097
22097
|
}
|
|
22098
22098
|
declare module '@elastic/eui/src/components/basic_table/default_item_action' {
|
|
@@ -22128,10 +22128,10 @@ declare module '@elastic/eui/src/components/basic_table/expanded_item_actions' {
|
|
|
22128
22128
|
actions: Array<Action<T>>;
|
|
22129
22129
|
itemId: ItemIdResolved;
|
|
22130
22130
|
item: T;
|
|
22131
|
-
|
|
22131
|
+
actionsDisabled: boolean;
|
|
22132
22132
|
className?: string;
|
|
22133
22133
|
}
|
|
22134
|
-
export const ExpandedItemActions: <T extends {}>({ actions, itemId, item,
|
|
22134
|
+
export const ExpandedItemActions: <T extends {}>({ actions, itemId, item, actionsDisabled, className, }: ExpandedItemActionsProps<T>) => ReactElement;
|
|
22135
22135
|
|
|
22136
22136
|
}
|
|
22137
22137
|
declare module '@elastic/eui/src/components/basic_table/basic_table.styles' {
|
|
@@ -28736,6 +28736,7 @@ declare module '@elastic/eui' {
|
|
|
28736
28736
|
"euiBasicTable.selectThisRow": any;
|
|
28737
28737
|
"euiBasicTable.tablePagination": any;
|
|
28738
28738
|
"euiCollapsedItemActions.allActions": any;
|
|
28739
|
+
"euiCollapsedItemActions.allActionsDisabled": any;
|
|
28739
28740
|
"euiBottomBar.screenReaderHeading": any;
|
|
28740
28741
|
"euiBottomBar.customScreenReaderAnnouncement": any;
|
|
28741
28742
|
"euiBottomBar.screenReaderAnnouncement": any;
|
package/i18ntokens.json
CHANGED
|
@@ -149,14 +149,14 @@
|
|
|
149
149
|
"highlighting": "string",
|
|
150
150
|
"loc": {
|
|
151
151
|
"start": {
|
|
152
|
-
"line":
|
|
152
|
+
"line": 1357,
|
|
153
153
|
"column": 8,
|
|
154
|
-
"index":
|
|
154
|
+
"index": 37727
|
|
155
155
|
},
|
|
156
156
|
"end": {
|
|
157
|
-
"line":
|
|
157
|
+
"line": 1361,
|
|
158
158
|
"column": 9,
|
|
159
|
-
"index":
|
|
159
|
+
"index": 37886
|
|
160
160
|
}
|
|
161
161
|
},
|
|
162
162
|
"filepath": "src/components/basic_table/basic_table.tsx"
|
|
@@ -167,14 +167,32 @@
|
|
|
167
167
|
"highlighting": "string",
|
|
168
168
|
"loc": {
|
|
169
169
|
"start": {
|
|
170
|
-
"line":
|
|
170
|
+
"line": 115,
|
|
171
171
|
"column": 4,
|
|
172
|
-
"index":
|
|
172
|
+
"index": 3596
|
|
173
173
|
},
|
|
174
174
|
"end": {
|
|
175
|
-
"line":
|
|
176
|
-
"column":
|
|
177
|
-
"index":
|
|
175
|
+
"line": 124,
|
|
176
|
+
"column": 5,
|
|
177
|
+
"index": 3863
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
"filepath": "src/components/basic_table/collapsed_item_actions.tsx"
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
"token": "euiCollapsedItemActions.allActionsDisabled",
|
|
184
|
+
"defString": "Individual item actions are disabled when rows are being selected.",
|
|
185
|
+
"highlighting": "string",
|
|
186
|
+
"loc": {
|
|
187
|
+
"start": {
|
|
188
|
+
"line": 115,
|
|
189
|
+
"column": 4,
|
|
190
|
+
"index": 3596
|
|
191
|
+
},
|
|
192
|
+
"end": {
|
|
193
|
+
"line": 124,
|
|
194
|
+
"column": 5,
|
|
195
|
+
"index": 3863
|
|
178
196
|
}
|
|
179
197
|
},
|
|
180
198
|
"filepath": "src/components/basic_table/collapsed_item_actions.tsx"
|
|
@@ -185,14 +203,14 @@
|
|
|
185
203
|
"highlighting": "string",
|
|
186
204
|
"loc": {
|
|
187
205
|
"start": {
|
|
188
|
-
"line":
|
|
206
|
+
"line": 141,
|
|
189
207
|
"column": 4,
|
|
190
|
-
"index":
|
|
208
|
+
"index": 4423
|
|
191
209
|
},
|
|
192
210
|
"end": {
|
|
193
|
-
"line":
|
|
211
|
+
"line": 141,
|
|
194
212
|
"column": 78,
|
|
195
|
-
"index":
|
|
213
|
+
"index": 4497
|
|
196
214
|
}
|
|
197
215
|
},
|
|
198
216
|
"filepath": "src/components/basic_table/collapsed_item_actions.tsx"
|
|
@@ -1085,14 +1103,14 @@
|
|
|
1085
1103
|
"highlighting": "string",
|
|
1086
1104
|
"loc": {
|
|
1087
1105
|
"start": {
|
|
1088
|
-
"line":
|
|
1106
|
+
"line": 189,
|
|
1089
1107
|
"column": 12,
|
|
1090
|
-
"index":
|
|
1108
|
+
"index": 5809
|
|
1091
1109
|
},
|
|
1092
1110
|
"end": {
|
|
1093
|
-
"line":
|
|
1111
|
+
"line": 192,
|
|
1094
1112
|
"column": 14,
|
|
1095
|
-
"index":
|
|
1113
|
+
"index": 5950
|
|
1096
1114
|
}
|
|
1097
1115
|
},
|
|
1098
1116
|
"filepath": "src/components/datagrid/body/header/data_grid_header_cell.tsx"
|
|
@@ -1103,14 +1121,14 @@
|
|
|
1103
1121
|
"highlighting": "string",
|
|
1104
1122
|
"loc": {
|
|
1105
1123
|
"start": {
|
|
1106
|
-
"line":
|
|
1124
|
+
"line": 256,
|
|
1107
1125
|
"column": 16,
|
|
1108
|
-
"index":
|
|
1126
|
+
"index": 7795
|
|
1109
1127
|
},
|
|
1110
1128
|
"end": {
|
|
1111
|
-
"line":
|
|
1129
|
+
"line": 260,
|
|
1112
1130
|
"column": 18,
|
|
1113
|
-
"index":
|
|
1131
|
+
"index": 7969
|
|
1114
1132
|
}
|
|
1115
1133
|
},
|
|
1116
1134
|
"filepath": "src/components/datagrid/body/header/data_grid_header_cell.tsx"
|
|
@@ -1121,14 +1139,14 @@
|
|
|
1121
1139
|
"highlighting": "string",
|
|
1122
1140
|
"loc": {
|
|
1123
1141
|
"start": {
|
|
1124
|
-
"line":
|
|
1142
|
+
"line": 264,
|
|
1125
1143
|
"column": 16,
|
|
1126
|
-
"index":
|
|
1144
|
+
"index": 8047
|
|
1127
1145
|
},
|
|
1128
1146
|
"end": {
|
|
1129
|
-
"line":
|
|
1147
|
+
"line": 268,
|
|
1130
1148
|
"column": 18,
|
|
1131
|
-
"index":
|
|
1149
|
+
"index": 8223
|
|
1132
1150
|
}
|
|
1133
1151
|
},
|
|
1134
1152
|
"filepath": "src/components/datagrid/body/header/data_grid_header_cell.tsx"
|
|
@@ -1139,14 +1157,14 @@
|
|
|
1139
1157
|
"highlighting": "string",
|
|
1140
1158
|
"loc": {
|
|
1141
1159
|
"start": {
|
|
1142
|
-
"line":
|
|
1160
|
+
"line": 274,
|
|
1143
1161
|
"column": 16,
|
|
1144
|
-
"index":
|
|
1162
|
+
"index": 8369
|
|
1145
1163
|
},
|
|
1146
1164
|
"end": {
|
|
1147
|
-
"line":
|
|
1165
|
+
"line": 279,
|
|
1148
1166
|
"column": 18,
|
|
1149
|
-
"index":
|
|
1167
|
+
"index": 8597
|
|
1150
1168
|
}
|
|
1151
1169
|
},
|
|
1152
1170
|
"filepath": "src/components/datagrid/body/header/data_grid_header_cell.tsx"
|
|
@@ -1157,14 +1175,14 @@
|
|
|
1157
1175
|
"highlighting": "string",
|
|
1158
1176
|
"loc": {
|
|
1159
1177
|
"start": {
|
|
1160
|
-
"line":
|
|
1178
|
+
"line": 283,
|
|
1161
1179
|
"column": 16,
|
|
1162
|
-
"index":
|
|
1180
|
+
"index": 8675
|
|
1163
1181
|
},
|
|
1164
1182
|
"end": {
|
|
1165
|
-
"line":
|
|
1183
|
+
"line": 288,
|
|
1166
1184
|
"column": 18,
|
|
1167
|
-
"index":
|
|
1185
|
+
"index": 8905
|
|
1168
1186
|
}
|
|
1169
1187
|
},
|
|
1170
1188
|
"filepath": "src/components/datagrid/body/header/data_grid_header_cell.tsx"
|
|
@@ -1175,14 +1193,14 @@
|
|
|
1175
1193
|
"highlighting": "string",
|
|
1176
1194
|
"loc": {
|
|
1177
1195
|
"start": {
|
|
1178
|
-
"line":
|
|
1196
|
+
"line": 294,
|
|
1179
1197
|
"column": 16,
|
|
1180
|
-
"index":
|
|
1198
|
+
"index": 9034
|
|
1181
1199
|
},
|
|
1182
1200
|
"end": {
|
|
1183
|
-
"line":
|
|
1201
|
+
"line": 299,
|
|
1184
1202
|
"column": 18,
|
|
1185
|
-
"index":
|
|
1203
|
+
"index": 9272
|
|
1186
1204
|
}
|
|
1187
1205
|
},
|
|
1188
1206
|
"filepath": "src/components/datagrid/body/header/data_grid_header_cell.tsx"
|
|
@@ -1193,14 +1211,14 @@
|
|
|
1193
1211
|
"highlighting": "string",
|
|
1194
1212
|
"loc": {
|
|
1195
1213
|
"start": {
|
|
1196
|
-
"line":
|
|
1214
|
+
"line": 303,
|
|
1197
1215
|
"column": 16,
|
|
1198
|
-
"index":
|
|
1216
|
+
"index": 9350
|
|
1199
1217
|
},
|
|
1200
1218
|
"end": {
|
|
1201
|
-
"line":
|
|
1219
|
+
"line": 308,
|
|
1202
1220
|
"column": 18,
|
|
1203
|
-
"index":
|
|
1221
|
+
"index": 9590
|
|
1204
1222
|
}
|
|
1205
1223
|
},
|
|
1206
1224
|
"filepath": "src/components/datagrid/body/header/data_grid_header_cell.tsx"
|
|
@@ -1211,14 +1229,14 @@
|
|
|
1211
1229
|
"highlighting": "string",
|
|
1212
1230
|
"loc": {
|
|
1213
1231
|
"start": {
|
|
1214
|
-
"line":
|
|
1232
|
+
"line": 373,
|
|
1215
1233
|
"column": 6,
|
|
1216
|
-
"index":
|
|
1234
|
+
"index": 11436
|
|
1217
1235
|
},
|
|
1218
1236
|
"end": {
|
|
1219
|
-
"line":
|
|
1237
|
+
"line": 376,
|
|
1220
1238
|
"column": 8,
|
|
1221
|
-
"index":
|
|
1239
|
+
"index": 11629
|
|
1222
1240
|
}
|
|
1223
1241
|
},
|
|
1224
1242
|
"filepath": "src/components/datagrid/body/header/data_grid_header_cell.tsx"
|
|
@@ -818,19 +818,22 @@ var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
818
818
|
}, {
|
|
819
819
|
key: "renderItemActionsCell",
|
|
820
820
|
value: function renderItemActionsCell(itemId, item, column, columnIndex) {
|
|
821
|
-
|
|
822
|
-
var
|
|
823
|
-
return _this7.state.selection.length === 0 && (!action.enabled || action.enabled(item));
|
|
824
|
-
};
|
|
821
|
+
// Disable all actions if any row(s) are selected
|
|
822
|
+
var allDisabled = this.state.selection.length > 0;
|
|
825
823
|
var actualActions = column.actions.filter(function (action) {
|
|
826
824
|
return !action.available || action.available(item);
|
|
827
825
|
});
|
|
828
826
|
if (actualActions.length > 2) {
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
}
|
|
833
|
-
|
|
827
|
+
if (allDisabled) {
|
|
828
|
+
// If all actions are disabled, do not show any actions but the popover toggle
|
|
829
|
+
actualActions = [];
|
|
830
|
+
} else {
|
|
831
|
+
// if any of the actions `isPrimary`, add them inline as well, but only the first 2
|
|
832
|
+
var primaryActions = actualActions.filter(function (o) {
|
|
833
|
+
return o.isPrimary;
|
|
834
|
+
});
|
|
835
|
+
actualActions = primaryActions.slice(0, 2);
|
|
836
|
+
}
|
|
834
837
|
|
|
835
838
|
// if we have more than 1 action, we don't show them all in the cell, instead we
|
|
836
839
|
// put them all in a popover tool. This effectively means we can only have a maximum
|
|
@@ -843,18 +846,18 @@ var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
843
846
|
render: function render(item) {
|
|
844
847
|
return (0, _react2.jsx)(_collapsed_item_actions.CollapsedItemActions, {
|
|
845
848
|
actions: column.actions,
|
|
849
|
+
actionsDisabled: allDisabled,
|
|
846
850
|
itemId: itemId,
|
|
847
|
-
item: item
|
|
848
|
-
actionEnabled: actionEnabled
|
|
851
|
+
item: item
|
|
849
852
|
});
|
|
850
853
|
}
|
|
851
854
|
});
|
|
852
855
|
}
|
|
853
856
|
var tools = (0, _react2.jsx)(_expanded_item_actions.ExpandedItemActions, {
|
|
854
857
|
actions: actualActions,
|
|
858
|
+
actionsDisabled: allDisabled,
|
|
855
859
|
itemId: itemId,
|
|
856
|
-
item: item
|
|
857
|
-
actionEnabled: actionEnabled
|
|
860
|
+
item: item
|
|
858
861
|
});
|
|
859
862
|
var key = "record_actions_".concat(itemId, "_").concat(columnIndex);
|
|
860
863
|
return (0, _react2.jsx)(_table.EuiTableRowCell, {
|
|
@@ -941,7 +944,7 @@ var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
941
944
|
}, {
|
|
942
945
|
key: "renderPaginationBar",
|
|
943
946
|
value: function renderPaginationBar() {
|
|
944
|
-
var
|
|
947
|
+
var _this7 = this;
|
|
945
948
|
var _this$props11 = this.props,
|
|
946
949
|
error = _this$props11.error,
|
|
947
950
|
pagination = _this$props11.pagination,
|
|
@@ -960,9 +963,9 @@ var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
960
963
|
}, function (tablePagination) {
|
|
961
964
|
return (0, _react2.jsx)(_pagination_bar.PaginationBar, {
|
|
962
965
|
pagination: pagination,
|
|
963
|
-
onPageSizeChange:
|
|
964
|
-
onPageChange:
|
|
965
|
-
"aria-controls":
|
|
966
|
+
onPageSizeChange: _this7.onPageSizeChange.bind(_this7),
|
|
967
|
+
onPageChange: _this7.onPageChange.bind(_this7),
|
|
968
|
+
"aria-controls": _this7.tableId,
|
|
966
969
|
"aria-label": tablePagination
|
|
967
970
|
});
|
|
968
971
|
});
|
|
@@ -32,16 +32,12 @@ var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
32
32
|
var actions = _ref.actions,
|
|
33
33
|
itemId = _ref.itemId,
|
|
34
34
|
item = _ref.item,
|
|
35
|
-
|
|
35
|
+
actionsDisabled = _ref.actionsDisabled,
|
|
36
36
|
className = _ref.className;
|
|
37
37
|
var _useState = (0, _react.useState)(false),
|
|
38
38
|
_useState2 = _slicedToArray(_useState, 2),
|
|
39
39
|
popoverOpen = _useState2[0],
|
|
40
40
|
setPopoverOpen = _useState2[1];
|
|
41
|
-
var _useState3 = (0, _react.useState)(true),
|
|
42
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
43
|
-
allDisabled = _useState4[0],
|
|
44
|
-
setAllDisabled = _useState4[1];
|
|
45
41
|
var onClickItem = (0, _react.useCallback)(function (onClickAction) {
|
|
46
42
|
setPopoverOpen(false);
|
|
47
43
|
onClickAction === null || onClickAction === void 0 ? void 0 : onClickAction();
|
|
@@ -51,8 +47,7 @@ var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
51
47
|
var _action$available, _action$available2;
|
|
52
48
|
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;
|
|
53
49
|
if (!available) return controls;
|
|
54
|
-
var enabled =
|
|
55
|
-
if (enabled) setAllDisabled(false);
|
|
50
|
+
var enabled = action.enabled == null || action.enabled(item);
|
|
56
51
|
if ((0, _action_types.isCustomItemAction)(action)) {
|
|
57
52
|
var customAction = action;
|
|
58
53
|
var actionControl = customAction.render(item, enabled);
|
|
@@ -83,7 +78,7 @@ var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
83
78
|
controls.push((0, _react2.jsx)(_context_menu.EuiContextMenuItem, {
|
|
84
79
|
key: index,
|
|
85
80
|
className: "euiBasicTable__collapsedAction",
|
|
86
|
-
disabled: !enabled,
|
|
81
|
+
disabled: !enabled && !actionsDisabled,
|
|
87
82
|
href: href,
|
|
88
83
|
target: target,
|
|
89
84
|
icon: icon,
|
|
@@ -101,17 +96,21 @@ var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
101
96
|
}
|
|
102
97
|
return controls;
|
|
103
98
|
}, []);
|
|
104
|
-
}, [actions,
|
|
99
|
+
}, [actions, actionsDisabled, item, onClickItem]);
|
|
105
100
|
var popoverButton = (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}, function (
|
|
101
|
+
tokens: ['euiCollapsedItemActions.allActions', 'euiCollapsedItemActions.allActionsDisabled'],
|
|
102
|
+
defaults: ['All actions', 'Individual item actions are disabled when rows are being selected.']
|
|
103
|
+
}, function (_ref2) {
|
|
104
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
105
|
+
allActions = _ref3[0],
|
|
106
|
+
allActionsDisabled = _ref3[1];
|
|
109
107
|
return (0, _react2.jsx)(_button.EuiButtonIcon, {
|
|
110
108
|
className: className,
|
|
111
|
-
"aria-label": allActions,
|
|
109
|
+
"aria-label": actionsDisabled ? allActionsDisabled : allActions,
|
|
110
|
+
title: actionsDisabled ? allActionsDisabled : undefined,
|
|
112
111
|
iconType: "boxesHorizontal",
|
|
113
112
|
color: "text",
|
|
114
|
-
isDisabled:
|
|
113
|
+
isDisabled: actionsDisabled,
|
|
115
114
|
onClick: function onClick() {
|
|
116
115
|
return setPopoverOpen(function (isOpen) {
|
|
117
116
|
return !isOpen;
|
|
@@ -120,7 +119,7 @@ var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
120
119
|
"data-test-subj": "euiCollapsedItemActionsButton"
|
|
121
120
|
});
|
|
122
121
|
});
|
|
123
|
-
var withTooltip = !
|
|
122
|
+
var withTooltip = !actionsDisabled && (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
124
123
|
token: "euiCollapsedItemActions.allActions",
|
|
125
124
|
default: "All actions"
|
|
126
125
|
}, 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
|
}
|