@elastic/eui 116.3.0 → 116.3.1-snapshot.1782148316870
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/avatar/avatar.js +4 -0
- package/es/components/avatar/avatar.styles.js +16 -16
- package/es/components/banner/banner.js +1 -2
- package/es/components/banner/banner.styles.js +1 -1
- package/es/components/basic_table/basic_table.js +35 -5
- package/es/components/basic_table/basic_table.styles.js +19 -1
- package/es/components/basic_table/in_memory_table.js +17 -0
- package/es/components/basic_table/index.js +2 -1
- package/es/components/basic_table/pagination_bar.js +19 -4
- package/es/components/basic_table/pagination_bar.styles.js +21 -0
- package/es/components/basic_table/panel.styles.js +14 -0
- package/es/components/basic_table/use_panel_props.js +28 -0
- package/es/components/date_picker/auto_refresh/refresh_interval.js +176 -229
- package/es/components/date_picker/date_picker.js +1 -1
- package/es/components/flyout/flyout.component.js +10 -6
- package/es/components/flyout/flyout_menu.js +122 -19
- package/es/components/flyout/flyout_menu.styles.js +2 -1
- package/es/components/flyout/manager/actions.js +20 -0
- package/es/components/flyout/manager/flyout_child.js +23 -1
- package/es/components/flyout/manager/flyout_managed.js +65 -19
- package/es/components/flyout/manager/hooks.js +1 -1
- package/es/components/flyout/manager/index.js +2 -2
- package/es/components/flyout/manager/reducer.js +32 -8
- package/es/components/flyout/manager/selectors.js +8 -2
- package/es/components/flyout/manager/store.js +35 -2
- package/es/components/flyout/use_flyout_menu.js +2 -2
- package/es/components/form/field_password/field_password.styles.js +1 -1
- package/es/components/form/field_search/field_search.styles.js +1 -1
- package/es/components/form/form.styles.js +1 -1
- package/es/components/form/form_control_layout/form_control_layout_icons.js +95 -143
- package/es/components/form/select/select.styles.js +1 -1
- package/es/components/form/text_area/text_area.styles.js +1 -1
- package/es/components/form/validatable_control/validatable_control.js +8 -55
- package/es/components/table/mobile/table_sort_mobile.js +64 -103
- package/es/components/table/store/use_unique_column_id.js +25 -0
- package/es/components/table/table_header_cell.js +7 -8
- package/es/components/table/table_header_cell_checkbox.js +5 -6
- package/es/components/tool_tip/tool_tip.js +61 -30
- package/es/components/tool_tip/tool_tip_anchor.js +5 -5
- package/es/components/tool_tip/tool_tip_manager.js +27 -2
- package/eui.d.ts +679 -530
- package/i18ntokens.json +810 -738
- package/lib/components/avatar/avatar.js +4 -0
- package/lib/components/avatar/avatar.styles.js +16 -16
- package/lib/components/banner/banner.js +1 -2
- package/lib/components/banner/banner.styles.js +1 -1
- package/lib/components/basic_table/basic_table.js +34 -4
- package/lib/components/basic_table/basic_table.styles.js +19 -1
- package/lib/components/basic_table/in_memory_table.js +17 -0
- package/lib/components/basic_table/index.js +8 -1
- package/lib/components/basic_table/pagination_bar.js +19 -4
- package/lib/components/basic_table/pagination_bar.styles.js +26 -0
- package/lib/components/basic_table/panel.styles.js +20 -0
- package/lib/components/basic_table/use_panel_props.js +33 -0
- package/lib/components/date_picker/auto_refresh/refresh_interval.js +175 -229
- package/lib/components/date_picker/date_picker.js +1 -1
- package/lib/components/flyout/flyout.component.js +10 -6
- package/lib/components/flyout/flyout_menu.js +120 -19
- package/lib/components/flyout/flyout_menu.styles.js +2 -1
- package/lib/components/flyout/manager/actions.js +21 -1
- package/lib/components/flyout/manager/flyout_child.js +23 -1
- package/lib/components/flyout/manager/flyout_managed.js +41 -17
- package/lib/components/flyout/manager/hooks.js +6 -0
- package/lib/components/flyout/manager/index.js +12 -0
- package/lib/components/flyout/manager/reducer.js +31 -7
- package/lib/components/flyout/manager/selectors.js +9 -3
- package/lib/components/flyout/manager/store.js +34 -1
- package/lib/components/flyout/use_flyout_menu.js +2 -2
- package/lib/components/form/field_password/field_password.styles.js +1 -1
- package/lib/components/form/field_search/field_search.styles.js +1 -1
- package/lib/components/form/form.styles.js +1 -1
- package/lib/components/form/form_control_layout/form_control_layout_icons.js +95 -145
- package/lib/components/form/select/select.styles.js +1 -1
- package/lib/components/form/text_area/text_area.styles.js +1 -1
- package/lib/components/form/validatable_control/validatable_control.js +7 -52
- package/lib/components/table/mobile/table_sort_mobile.js +71 -108
- package/lib/components/table/store/use_unique_column_id.js +34 -0
- package/lib/components/table/table_header_cell.js +7 -8
- package/lib/components/table/table_header_cell_checkbox.js +5 -6
- package/lib/components/tool_tip/tool_tip.js +59 -29
- package/lib/components/tool_tip/tool_tip_anchor.js +5 -5
- package/lib/components/tool_tip/tool_tip_manager.js +27 -2
- package/optimize/es/components/avatar/avatar.js +4 -0
- package/optimize/es/components/avatar/avatar.styles.js +16 -16
- package/optimize/es/components/banner/banner.js +1 -2
- package/optimize/es/components/banner/banner.styles.js +1 -1
- package/optimize/es/components/basic_table/basic_table.js +18 -5
- package/optimize/es/components/basic_table/basic_table.styles.js +19 -1
- package/optimize/es/components/basic_table/index.js +2 -1
- package/optimize/es/components/basic_table/pagination_bar.js +19 -4
- package/optimize/es/components/basic_table/pagination_bar.styles.js +21 -0
- package/optimize/es/components/basic_table/panel.styles.js +14 -0
- package/optimize/es/components/basic_table/use_panel_props.js +28 -0
- package/optimize/es/components/date_picker/auto_refresh/refresh_interval.js +172 -196
- package/optimize/es/components/date_picker/date_picker.js +1 -1
- package/optimize/es/components/flyout/flyout.component.js +10 -6
- package/optimize/es/components/flyout/flyout_menu.js +99 -18
- package/optimize/es/components/flyout/flyout_menu.styles.js +2 -1
- package/optimize/es/components/flyout/manager/actions.js +20 -0
- package/optimize/es/components/flyout/manager/flyout_managed.js +42 -18
- package/optimize/es/components/flyout/manager/hooks.js +1 -1
- package/optimize/es/components/flyout/manager/index.js +2 -2
- package/optimize/es/components/flyout/manager/reducer.js +32 -8
- package/optimize/es/components/flyout/manager/selectors.js +8 -2
- package/optimize/es/components/flyout/manager/store.js +35 -2
- package/optimize/es/components/flyout/use_flyout_menu.js +2 -2
- package/optimize/es/components/form/field_password/field_password.styles.js +1 -1
- package/optimize/es/components/form/field_search/field_search.styles.js +1 -1
- package/optimize/es/components/form/form.styles.js +1 -1
- package/optimize/es/components/form/form_control_layout/form_control_layout_icons.js +96 -115
- package/optimize/es/components/form/select/select.styles.js +1 -1
- package/optimize/es/components/form/text_area/text_area.styles.js +1 -1
- package/optimize/es/components/form/validatable_control/validatable_control.js +7 -48
- package/optimize/es/components/table/mobile/table_sort_mobile.js +59 -82
- package/optimize/es/components/table/store/use_unique_column_id.js +25 -0
- package/optimize/es/components/table/table_header_cell.js +7 -8
- package/optimize/es/components/table/table_header_cell_checkbox.js +5 -6
- package/optimize/es/components/tool_tip/tool_tip.js +58 -30
- package/optimize/es/components/tool_tip/tool_tip_anchor.js +5 -5
- package/optimize/es/components/tool_tip/tool_tip_manager.js +27 -2
- package/optimize/lib/components/avatar/avatar.js +4 -0
- package/optimize/lib/components/avatar/avatar.styles.js +16 -16
- package/optimize/lib/components/banner/banner.js +1 -2
- package/optimize/lib/components/banner/banner.styles.js +1 -1
- package/optimize/lib/components/basic_table/basic_table.js +17 -4
- package/optimize/lib/components/basic_table/basic_table.styles.js +19 -1
- package/optimize/lib/components/basic_table/index.js +8 -1
- package/optimize/lib/components/basic_table/pagination_bar.js +19 -4
- package/optimize/lib/components/basic_table/pagination_bar.styles.js +26 -0
- package/optimize/lib/components/basic_table/panel.styles.js +20 -0
- package/optimize/lib/components/basic_table/use_panel_props.js +33 -0
- package/optimize/lib/components/date_picker/auto_refresh/refresh_interval.js +170 -194
- package/optimize/lib/components/date_picker/date_picker.js +1 -1
- package/optimize/lib/components/flyout/flyout.component.js +10 -6
- package/optimize/lib/components/flyout/flyout_menu.js +98 -18
- package/optimize/lib/components/flyout/flyout_menu.styles.js +2 -1
- package/optimize/lib/components/flyout/manager/actions.js +21 -1
- package/optimize/lib/components/flyout/manager/flyout_managed.js +41 -17
- package/optimize/lib/components/flyout/manager/hooks.js +6 -0
- package/optimize/lib/components/flyout/manager/index.js +12 -0
- package/optimize/lib/components/flyout/manager/reducer.js +31 -7
- package/optimize/lib/components/flyout/manager/selectors.js +9 -3
- package/optimize/lib/components/flyout/manager/store.js +34 -1
- package/optimize/lib/components/flyout/use_flyout_menu.js +2 -2
- package/optimize/lib/components/form/field_password/field_password.styles.js +1 -1
- package/optimize/lib/components/form/field_search/field_search.styles.js +1 -1
- package/optimize/lib/components/form/form.styles.js +1 -1
- package/optimize/lib/components/form/form_control_layout/form_control_layout_icons.js +96 -117
- package/optimize/lib/components/form/select/select.styles.js +1 -1
- package/optimize/lib/components/form/text_area/text_area.styles.js +1 -1
- package/optimize/lib/components/form/validatable_control/validatable_control.js +6 -49
- package/optimize/lib/components/table/mobile/table_sort_mobile.js +61 -83
- package/optimize/lib/components/table/store/use_unique_column_id.js +34 -0
- package/optimize/lib/components/table/table_header_cell.js +7 -8
- package/optimize/lib/components/table/table_header_cell_checkbox.js +5 -6
- package/optimize/lib/components/tool_tip/tool_tip.js +57 -29
- package/optimize/lib/components/tool_tip/tool_tip_anchor.js +5 -5
- package/optimize/lib/components/tool_tip/tool_tip_manager.js +27 -2
- package/package.json +8 -5
- package/test-env/components/avatar/avatar.js +4 -0
- package/test-env/components/avatar/avatar.styles.js +16 -16
- package/test-env/components/banner/banner.js +1 -2
- package/test-env/components/banner/banner.styles.js +1 -1
- package/test-env/components/basic_table/basic_table.js +34 -4
- package/test-env/components/basic_table/basic_table.styles.js +19 -1
- package/test-env/components/basic_table/in_memory_table.js +17 -0
- package/test-env/components/basic_table/index.js +8 -1
- package/test-env/components/basic_table/pagination_bar.js +19 -4
- package/test-env/components/basic_table/pagination_bar.styles.js +26 -0
- package/test-env/components/basic_table/panel.styles.js +20 -0
- package/test-env/components/basic_table/use_panel_props.js +33 -0
- package/test-env/components/date_picker/auto_refresh/refresh_interval.js +170 -220
- package/test-env/components/date_picker/date_picker.js +1 -1
- package/test-env/components/flyout/flyout.component.js +10 -6
- package/test-env/components/flyout/flyout_menu.js +121 -19
- package/test-env/components/flyout/flyout_menu.styles.js +2 -1
- package/test-env/components/flyout/manager/actions.js +21 -1
- package/test-env/components/flyout/manager/flyout_child.js +23 -1
- package/test-env/components/flyout/manager/flyout_managed.js +41 -17
- package/test-env/components/flyout/manager/hooks.js +6 -0
- package/test-env/components/flyout/manager/index.js +12 -0
- package/test-env/components/flyout/manager/reducer.js +31 -7
- package/test-env/components/flyout/manager/selectors.js +9 -3
- package/test-env/components/flyout/manager/store.js +34 -1
- package/test-env/components/flyout/use_flyout_menu.js +2 -2
- package/test-env/components/form/field_password/field_password.styles.js +1 -1
- package/test-env/components/form/field_search/field_search.styles.js +1 -1
- package/test-env/components/form/form.styles.js +1 -1
- package/test-env/components/form/form_control_layout/form_control_layout_icons.js +95 -139
- package/test-env/components/form/select/select.styles.js +1 -1
- package/test-env/components/form/text_area/text_area.styles.js +1 -1
- package/test-env/components/form/validatable_control/validatable_control.js +6 -48
- package/test-env/components/table/mobile/table_sort_mobile.js +61 -98
- package/test-env/components/table/store/use_unique_column_id.js +34 -0
- package/test-env/components/table/table_header_cell.js +7 -8
- package/test-env/components/table/table_header_cell_checkbox.js +5 -6
- package/test-env/components/tool_tip/tool_tip.js +57 -29
- package/test-env/components/tool_tip/tool_tip_anchor.js +5 -5
- package/test-env/components/tool_tip/tool_tip_manager.js +27 -2
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
4
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
5
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
6
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
7
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
8
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
9
4
|
var _excluded = ["ref", "side"];
|
|
10
|
-
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
11
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
12
5
|
/*
|
|
13
6
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
14
7
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -17,8 +10,8 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
17
10
|
* Side Public License, v 1.
|
|
18
11
|
*/
|
|
19
12
|
|
|
20
|
-
import React
|
|
21
|
-
import {
|
|
13
|
+
import React from 'react';
|
|
14
|
+
import { useEuiTheme } from '../../../services';
|
|
22
15
|
import { EuiIcon } from '../../icon';
|
|
23
16
|
import { EuiLoadingSpinner } from '../../loading';
|
|
24
17
|
import { EuiFormControlLayoutClearButton } from './form_control_layout_clear_button';
|
|
@@ -29,111 +22,99 @@ export var ICON_SIDES = ['left', 'right'];
|
|
|
29
22
|
export var isIconShape = function isIconShape(icon) {
|
|
30
23
|
return !!icon && icon.hasOwnProperty('type');
|
|
31
24
|
};
|
|
32
|
-
export var EuiFormControlLayoutIcons =
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
25
|
+
export var EuiFormControlLayoutIcons = function EuiFormControlLayoutIcons(_ref) {
|
|
26
|
+
var _ref$side = _ref.side,
|
|
27
|
+
side = _ref$side === void 0 ? 'left' : _ref$side,
|
|
28
|
+
_ref$iconsPosition = _ref.iconsPosition,
|
|
29
|
+
iconsPosition = _ref$iconsPosition === void 0 ? 'absolute' : _ref$iconsPosition,
|
|
30
|
+
compressed = _ref.compressed,
|
|
31
|
+
isDisabled = _ref.isDisabled,
|
|
32
|
+
icon = _ref.icon,
|
|
33
|
+
clear = _ref.clear,
|
|
34
|
+
isLoading = _ref.isLoading,
|
|
35
|
+
isInvalid = _ref.isInvalid,
|
|
36
|
+
isDropdown = _ref.isDropdown;
|
|
37
|
+
var euiThemeContext = useEuiTheme();
|
|
38
|
+
var styles = euiFormControlLayoutIconsStyles(euiThemeContext);
|
|
39
|
+
var cssStyles = [styles.euiFormControlLayoutIcons, compressed ? styles.compressed : styles.uncompressed].concat(_toConsumableArray(iconsPosition === 'absolute' ? [styles.position.absolute.absolute, compressed ? styles.position.absolute.compressed[side] : styles.position.absolute.uncompressed[side]] : [styles.position.static.static, compressed ? styles.position.static.compressed : styles.position.static.uncompressed]), [isDisabled && styles.disabled]);
|
|
40
|
+
return ___EmotionJSX("div", {
|
|
41
|
+
css: cssStyles,
|
|
42
|
+
className: "euiFormControlLayoutIcons"
|
|
43
|
+
}, ___EmotionJSX(ClearButton, {
|
|
44
|
+
clear: clear,
|
|
45
|
+
isDisabled: isDisabled
|
|
46
|
+
}), ___EmotionJSX(LoadingSpinner, {
|
|
47
|
+
isLoading: isLoading
|
|
48
|
+
}), ___EmotionJSX(InvalidIcon, {
|
|
49
|
+
isInvalid: isInvalid
|
|
50
|
+
}), ___EmotionJSX(CustomIcon, {
|
|
51
|
+
icon: icon,
|
|
52
|
+
isDisabled: isDisabled
|
|
53
|
+
}), ___EmotionJSX(DropdownIcon, {
|
|
54
|
+
isDropdown: isDropdown,
|
|
55
|
+
isDisabled: isDisabled
|
|
56
|
+
}));
|
|
57
|
+
};
|
|
58
|
+
var CustomIcon = function CustomIcon(_ref2) {
|
|
59
|
+
var icon = _ref2.icon,
|
|
60
|
+
isDisabled = _ref2.isDisabled;
|
|
61
|
+
if (!icon) {
|
|
62
|
+
return null;
|
|
36
63
|
}
|
|
37
|
-
_inherits(EuiFormControlLayoutIcons, _Component);
|
|
38
|
-
return _createClass(EuiFormControlLayoutIcons, [{
|
|
39
|
-
key: "render",
|
|
40
|
-
value: function render() {
|
|
41
|
-
var _this$props = this.props,
|
|
42
|
-
_this$props$side = _this$props.side,
|
|
43
|
-
side = _this$props$side === void 0 ? 'left' : _this$props$side,
|
|
44
|
-
_this$props$iconsPosi = _this$props.iconsPosition,
|
|
45
|
-
iconsPosition = _this$props$iconsPosi === void 0 ? 'absolute' : _this$props$iconsPosi,
|
|
46
|
-
compressed = _this$props.compressed,
|
|
47
|
-
isDisabled = _this$props.isDisabled;
|
|
48
|
-
var customIcon = this.renderCustomIcon();
|
|
49
|
-
var loadingSpinner = this.renderLoadingSpinner();
|
|
50
|
-
var clearButton = this.renderClearButton();
|
|
51
|
-
var invalidIcon = this.renderInvalidIcon();
|
|
52
|
-
var dropdownIcon = this.renderDropdownIcon();
|
|
53
|
-
return ___EmotionJSX(RenderWithEuiStylesMemoizer, null, function (stylesMemoizer) {
|
|
54
|
-
var styles = stylesMemoizer(euiFormControlLayoutIconsStyles);
|
|
55
|
-
var cssStyles = [styles.euiFormControlLayoutIcons, compressed ? styles.compressed : styles.uncompressed].concat(_toConsumableArray(iconsPosition === 'absolute' ? [styles.position.absolute.absolute, compressed ? styles.position.absolute.compressed[side] : styles.position.absolute.uncompressed[side]] : [styles.position.static.static, compressed ? styles.position.static.compressed : styles.position.static.uncompressed]), [isDisabled && styles.disabled]);
|
|
56
|
-
return ___EmotionJSX("div", {
|
|
57
|
-
css: cssStyles,
|
|
58
|
-
className: "euiFormControlLayoutIcons"
|
|
59
|
-
}, clearButton, loadingSpinner, invalidIcon, customIcon, dropdownIcon);
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
}, {
|
|
63
|
-
key: "renderCustomIcon",
|
|
64
|
-
value: function renderCustomIcon() {
|
|
65
|
-
var _this$props2 = this.props,
|
|
66
|
-
icon = _this$props2.icon,
|
|
67
|
-
isDisabled = _this$props2.isDisabled;
|
|
68
|
-
if (!icon) {
|
|
69
|
-
return null;
|
|
70
|
-
}
|
|
71
64
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
var isInvalid = this.props.isInvalid;
|
|
129
|
-
if (!isInvalid) {
|
|
130
|
-
return null;
|
|
131
|
-
}
|
|
132
|
-
return ___EmotionJSX(EuiIcon, {
|
|
133
|
-
size: "m",
|
|
134
|
-
color: "danger",
|
|
135
|
-
type: "warning"
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
}]);
|
|
139
|
-
}(Component);
|
|
65
|
+
// Normalize the icon to an object if it's a string.
|
|
66
|
+
var iconProps = isIconShape(icon) ? icon : {
|
|
67
|
+
type: icon
|
|
68
|
+
};
|
|
69
|
+
var iconRef = iconProps.ref,
|
|
70
|
+
side = iconProps.side,
|
|
71
|
+
iconRest = _objectWithoutProperties(iconProps, _excluded);
|
|
72
|
+
return ___EmotionJSX(EuiFormControlLayoutCustomIcon, _extends({
|
|
73
|
+
size: "m",
|
|
74
|
+
disabled: isDisabled,
|
|
75
|
+
iconRef: iconRef
|
|
76
|
+
}, iconRest));
|
|
77
|
+
};
|
|
78
|
+
var DropdownIcon = function DropdownIcon(_ref3) {
|
|
79
|
+
var isDropdown = _ref3.isDropdown,
|
|
80
|
+
isDisabled = _ref3.isDisabled;
|
|
81
|
+
if (!isDropdown) {
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
return ___EmotionJSX(EuiFormControlLayoutCustomIcon, {
|
|
85
|
+
size: "m",
|
|
86
|
+
disabled: isDisabled,
|
|
87
|
+
type: "chevronSingleDown"
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
var LoadingSpinner = function LoadingSpinner(_ref4) {
|
|
91
|
+
var isLoading = _ref4.isLoading;
|
|
92
|
+
if (!isLoading) {
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
return ___EmotionJSX(EuiLoadingSpinner, {
|
|
96
|
+
size: "m"
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
var ClearButton = function ClearButton(_ref5) {
|
|
100
|
+
var clear = _ref5.clear,
|
|
101
|
+
isDisabled = _ref5.isDisabled;
|
|
102
|
+
if (!clear) {
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
return ___EmotionJSX(EuiFormControlLayoutClearButton, _extends({
|
|
106
|
+
size: "m",
|
|
107
|
+
disabled: isDisabled
|
|
108
|
+
}, clear));
|
|
109
|
+
};
|
|
110
|
+
var InvalidIcon = function InvalidIcon(_ref6) {
|
|
111
|
+
var isInvalid = _ref6.isInvalid;
|
|
112
|
+
if (!isInvalid) {
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
return ___EmotionJSX(EuiIcon, {
|
|
116
|
+
size: "m",
|
|
117
|
+
color: "danger",
|
|
118
|
+
type: "warning"
|
|
119
|
+
});
|
|
120
|
+
};
|
|
@@ -12,7 +12,7 @@ export var euiSelectStyles = function euiSelectStyles(euiThemeContext) {
|
|
|
12
12
|
var formStyles = euiFormControlStyles(euiThemeContext);
|
|
13
13
|
var formVariables = euiFormVariables(euiThemeContext);
|
|
14
14
|
return {
|
|
15
|
-
euiSelect: /*#__PURE__*/css("appearance:none;", formStyles.shared, " &:invalid{", formStyles.invalid, ";}&:focus{", formStyles.focus, ";}&:disabled{", formStyles.disabled, ";}&[readOnly]{", formStyles.readOnly, ";}&:autofill{", formStyles.autoFill, ";};label:euiSelect;"),
|
|
15
|
+
euiSelect: /*#__PURE__*/css("appearance:none;", formStyles.shared, " &:is(:invalid, [aria-invalid='true']){", formStyles.invalid, ";}&:focus{", formStyles.focus, ";}&:disabled{", formStyles.disabled, ";}&[readOnly]{", formStyles.readOnly, ";}&:autofill{", formStyles.autoFill, ";};label:euiSelect;"),
|
|
16
16
|
// Skip the css() on the default height to avoid generating a className
|
|
17
17
|
uncompressed: formStyles.uncompressed,
|
|
18
18
|
compressed: /*#__PURE__*/css(formStyles.compressed, ";label:compressed;"),
|
|
@@ -47,7 +47,7 @@ export var euiTextAreaStyles = function euiTextAreaStyles(euiThemeContext) {
|
|
|
47
47
|
var formStyles = euiFormControlStyles(euiThemeContext);
|
|
48
48
|
var formVars = euiFormVariables(euiThemeContext);
|
|
49
49
|
return {
|
|
50
|
-
euiTextArea: /*#__PURE__*/css(formStyles.shared, "line-height:", euiTheme.font.lineHeightMultiplier, ";/* <textarea>s default to 'inline-block', which causes an extra 2-3px of\n * unnecessary height within its parent 'block' form control wrapper.\n * @see https://stackoverflow.com/a/27536461/4294462 */display:block;&:invalid{", formStyles.invalid, ";}&:focus{", formStyles.focus, ";}&:disabled{", formStyles.disabled, ";}&[readOnly]{", formStyles.readOnly, ";}&:autofill{", formStyles.autoFill, ";};label:euiTextArea;"),
|
|
50
|
+
euiTextArea: /*#__PURE__*/css(formStyles.shared, "line-height:", euiTheme.font.lineHeightMultiplier, ";/* <textarea>s default to 'inline-block', which causes an extra 2-3px of\n * unnecessary height within its parent 'block' form control wrapper.\n * @see https://stackoverflow.com/a/27536461/4294462 */display:block;&:is(:invalid, [aria-invalid='true']){", formStyles.invalid, ";}&:focus{", formStyles.focus, ";}&:disabled{", formStyles.disabled, ";}&[readOnly]{", formStyles.readOnly, ";}&:autofill{", formStyles.autoFill, ";};label:euiTextArea;"),
|
|
51
51
|
resize: {
|
|
52
52
|
vertical: _ref4,
|
|
53
53
|
horizontal: _ref3,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
1
|
/*
|
|
3
2
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
4
3
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -7,42 +6,24 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
7
6
|
* Side Public License, v 1.
|
|
8
7
|
*/
|
|
9
8
|
|
|
10
|
-
import { Children, cloneElement,
|
|
11
|
-
function isMutableRef(ref) {
|
|
12
|
-
return ref != null && ref.hasOwnProperty('current');
|
|
13
|
-
}
|
|
9
|
+
import { Children, cloneElement, useEffect } from 'react';
|
|
14
10
|
|
|
15
11
|
/**
|
|
16
12
|
* The `EuiValidatableControl` component should be used in scenarios where
|
|
17
13
|
* we can render the validated `<input>` as its direct child.
|
|
14
|
+
*
|
|
15
|
+
* It flags the underlying control as invalid via `aria-invalid`, which EUI form
|
|
16
|
+
* controls use to render their invalid styling. Note that it intentionally does
|
|
17
|
+
* *not* hook into the native constraint validation API (`setCustomValidity`) -
|
|
18
|
+
* `isInvalid` is a presentational prop, and tying it to native validity would
|
|
19
|
+
* block native form submission and surface a non-localized native error tooltip.
|
|
18
20
|
*/
|
|
19
21
|
|
|
20
22
|
export var EuiValidatableControl = function EuiValidatableControl(_ref) {
|
|
21
23
|
var isInvalid = _ref.isInvalid,
|
|
22
24
|
children = _ref.children;
|
|
23
|
-
// Note that this must be state and not a ref to cause a rerender/set invalid state on initial mount
|
|
24
|
-
var _useState = useState(null),
|
|
25
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
26
|
-
control = _useState2[0],
|
|
27
|
-
setControl = _useState2[1];
|
|
28
25
|
var child = Children.only(children);
|
|
29
|
-
var childRef = child.ref;
|
|
30
|
-
var replacedRef = useCallback(function (element) {
|
|
31
|
-
setControl(element);
|
|
32
|
-
|
|
33
|
-
// Call the original ref, if any
|
|
34
|
-
if (typeof childRef === 'function') {
|
|
35
|
-
childRef(element);
|
|
36
|
-
} else if (isMutableRef(childRef)) {
|
|
37
|
-
childRef.current = element;
|
|
38
|
-
}
|
|
39
|
-
}, [childRef]);
|
|
40
|
-
useSetControlValidity({
|
|
41
|
-
controlEl: control,
|
|
42
|
-
isInvalid: isInvalid
|
|
43
|
-
});
|
|
44
26
|
return /*#__PURE__*/cloneElement(child, {
|
|
45
|
-
ref: replacedRef,
|
|
46
27
|
'aria-invalid': isInvalid || child.props['aria-invalid']
|
|
47
28
|
});
|
|
48
29
|
};
|
|
@@ -56,10 +37,6 @@ export var EuiValidatableControl = function EuiValidatableControl(_ref) {
|
|
|
56
37
|
export var useEuiValidatableControl = function useEuiValidatableControl(_ref2) {
|
|
57
38
|
var isInvalid = _ref2.isInvalid,
|
|
58
39
|
controlEl = _ref2.controlEl;
|
|
59
|
-
useSetControlValidity({
|
|
60
|
-
controlEl: controlEl,
|
|
61
|
-
isInvalid: isInvalid
|
|
62
|
-
});
|
|
63
40
|
useEffect(function () {
|
|
64
41
|
if (!controlEl) return;
|
|
65
42
|
if (typeof isInvalid === 'boolean') {
|
|
@@ -68,22 +45,4 @@ export var useEuiValidatableControl = function useEuiValidatableControl(_ref2) {
|
|
|
68
45
|
controlEl.removeAttribute('aria-invalid');
|
|
69
46
|
}
|
|
70
47
|
}, [isInvalid, controlEl]);
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Internal `setCustomValidity` helper
|
|
75
|
-
*/
|
|
76
|
-
var useSetControlValidity = function useSetControlValidity(_ref3) {
|
|
77
|
-
var controlEl = _ref3.controlEl,
|
|
78
|
-
isInvalid = _ref3.isInvalid;
|
|
79
|
-
useEffect(function () {
|
|
80
|
-
if (controlEl == null || typeof controlEl.setCustomValidity !== 'function') {
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
if (isInvalid) {
|
|
84
|
-
controlEl.setCustomValidity('Invalid');
|
|
85
|
-
} else {
|
|
86
|
-
controlEl.setCustomValidity('');
|
|
87
|
-
}
|
|
88
|
-
}, [isInvalid, controlEl]);
|
|
89
48
|
};
|
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
4
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
5
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
8
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
4
|
var _excluded = ["className", "anchorPosition", "items"];
|
|
10
|
-
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
11
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
12
5
|
/*
|
|
13
6
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
14
7
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -17,7 +10,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
17
10
|
* Side Public License, v 1.
|
|
18
11
|
*/
|
|
19
12
|
|
|
20
|
-
import React, {
|
|
13
|
+
import React, { useState } from 'react';
|
|
21
14
|
import classNames from 'classnames';
|
|
22
15
|
import { EuiButtonEmpty } from '../../button/button_empty';
|
|
23
16
|
import { EuiPopover } from '../../popover';
|
|
@@ -25,77 +18,61 @@ import { EuiContextMenuPanel } from '../../context_menu';
|
|
|
25
18
|
import { EuiI18n } from '../../i18n';
|
|
26
19
|
import { EuiTableSortMobileItem } from './table_sort_mobile_item';
|
|
27
20
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
21
|
+
// Aligns the button to the right even when it's the only element present
|
|
22
|
+
var euiTableSortMobileStyles = {
|
|
23
|
+
marginInlineStart: 'auto',
|
|
24
|
+
label: 'euiTableSortMobile'
|
|
25
|
+
};
|
|
26
|
+
export var EuiTableSortMobile = function EuiTableSortMobile(_ref) {
|
|
27
|
+
var className = _ref.className,
|
|
28
|
+
anchorPosition = _ref.anchorPosition,
|
|
29
|
+
items = _ref.items,
|
|
30
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
31
|
+
var _useState = useState(false),
|
|
32
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
33
|
+
isPopoverOpen = _useState2[0],
|
|
34
|
+
setIsPopoverOpen = _useState2[1];
|
|
35
|
+
var classes = classNames('euiTableSortMobile', className);
|
|
36
|
+
var onButtonClick = function onButtonClick() {
|
|
37
|
+
setIsPopoverOpen(function (isOpen) {
|
|
38
|
+
return !isOpen;
|
|
38
39
|
});
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
isOpen: this.state.isPopoverOpen,
|
|
79
|
-
closePopover: this.closePopover,
|
|
80
|
-
anchorPosition: anchorPosition || 'downRight',
|
|
81
|
-
panelPaddingSize: "none"
|
|
82
|
-
}, rest), ___EmotionJSX(EuiContextMenuPanel, {
|
|
83
|
-
style: {
|
|
84
|
-
minWidth: 200
|
|
85
|
-
},
|
|
86
|
-
items: items && items.length ? items.map(function (item) {
|
|
87
|
-
return ___EmotionJSX(EuiTableSortMobileItem, {
|
|
88
|
-
key: item.key,
|
|
89
|
-
onSort: item.onSort,
|
|
90
|
-
isSorted: item.isSorted,
|
|
91
|
-
isSortAscending: item.isSortAscending
|
|
92
|
-
}, item.name);
|
|
93
|
-
}) : undefined
|
|
94
|
-
}));
|
|
95
|
-
return ___EmotionJSX("div", {
|
|
96
|
-
className: classes,
|
|
97
|
-
css: this.euiTableSortMobileStyles
|
|
98
|
-
}, mobileSortPopover);
|
|
99
|
-
}
|
|
100
|
-
}]);
|
|
101
|
-
}(Component);
|
|
40
|
+
};
|
|
41
|
+
var closePopover = function closePopover() {
|
|
42
|
+
setIsPopoverOpen(false);
|
|
43
|
+
};
|
|
44
|
+
var mobileSortButton = ___EmotionJSX(EuiButtonEmpty, {
|
|
45
|
+
iconType: "chevronSingleDown",
|
|
46
|
+
iconSide: "right",
|
|
47
|
+
onClick: onButtonClick,
|
|
48
|
+
flush: "right",
|
|
49
|
+
size: "xs"
|
|
50
|
+
}, ___EmotionJSX(EuiI18n, {
|
|
51
|
+
token: "euiTableSortMobile.sorting",
|
|
52
|
+
default: "Sorting"
|
|
53
|
+
}));
|
|
54
|
+
var mobileSortPopover = ___EmotionJSX(EuiPopover, _extends({
|
|
55
|
+
button: mobileSortButton,
|
|
56
|
+
isOpen: isPopoverOpen,
|
|
57
|
+
closePopover: closePopover,
|
|
58
|
+
anchorPosition: anchorPosition || 'downRight',
|
|
59
|
+
panelPaddingSize: "none"
|
|
60
|
+
}, rest), ___EmotionJSX(EuiContextMenuPanel, {
|
|
61
|
+
style: {
|
|
62
|
+
minWidth: 200
|
|
63
|
+
},
|
|
64
|
+
items: items !== null && items !== void 0 && items.length ? items.map(function (item) {
|
|
65
|
+
return ___EmotionJSX(EuiTableSortMobileItem, {
|
|
66
|
+
key: item.key,
|
|
67
|
+
onSort: item.onSort,
|
|
68
|
+
isSorted: item.isSorted,
|
|
69
|
+
isSortAscending: item.isSortAscending
|
|
70
|
+
}, item.name);
|
|
71
|
+
}) : undefined
|
|
72
|
+
}));
|
|
73
|
+
return ___EmotionJSX("div", {
|
|
74
|
+
className: classes,
|
|
75
|
+
css: euiTableSortMobileStyles
|
|
76
|
+
}, mobileSortPopover);
|
|
77
|
+
};
|
|
78
|
+
EuiTableSortMobile.displayName = 'EuiTableSortMobile';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
4
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
5
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
6
|
+
* Side Public License, v 1.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import React, { useId, useRef } from 'react';
|
|
10
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
11
|
+
var useEuiTableStoreUniqueColumnIdFallback = function useEuiTableStoreUniqueColumnIdFallback() {
|
|
12
|
+
var ref = useRef(uuidv4());
|
|
13
|
+
return ref.current;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Returns a stable unique column ID to be used when registering columns.
|
|
18
|
+
* It uses `React.useId()` when available and falls back to UUID v4 on React 17.
|
|
19
|
+
*
|
|
20
|
+
* This is needed so that static `uuid` mocks don't break column registration
|
|
21
|
+
* (at least in React 18+; in older versions this function would need
|
|
22
|
+
* to be mocked to return something unique, but stable).
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
export var useEuiTableStoreUniqueColumnId = 'useId' in React ? useId : useEuiTableStoreUniqueColumnIdFallback;
|
|
@@ -15,7 +15,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
15
15
|
import React, { useEffect, useCallback, useRef } from 'react';
|
|
16
16
|
import classNames from 'classnames';
|
|
17
17
|
import { useEuiMemoizedStyles, LEFT_ALIGNMENT } from '../../services';
|
|
18
|
-
import { useGeneratedHtmlId } from '../../services/accessibility/html_id_generator';
|
|
19
18
|
import { EuiI18n } from '../i18n';
|
|
20
19
|
import { EuiScreenReaderOnly } from '../accessibility';
|
|
21
20
|
import { EuiIcon } from '../icon';
|
|
@@ -27,6 +26,7 @@ import { EuiTableCellContent } from './_table_cell_content';
|
|
|
27
26
|
import { euiTableHeaderFooterCellStyles, _useEuiTableStickyCellStyles } from './table_cells_shared.styles';
|
|
28
27
|
import { useEuiTableColumnDataStore } from './store/provider';
|
|
29
28
|
import { useEuiTableWithinStickyHeader } from './sticky_header';
|
|
29
|
+
import { useEuiTableStoreUniqueColumnId } from './store/use_unique_column_id';
|
|
30
30
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
31
31
|
var CellContents = function CellContents(_ref) {
|
|
32
32
|
var className = _ref.className,
|
|
@@ -104,7 +104,7 @@ export var EuiTableHeaderCell = function EuiTableHeaderCell(_ref2) {
|
|
|
104
104
|
sticky = _ref2.sticky,
|
|
105
105
|
rest = _objectWithoutProperties(_ref2, _excluded);
|
|
106
106
|
var selfRef = useRef(null);
|
|
107
|
-
var
|
|
107
|
+
var storeCellId = useEuiTableStoreUniqueColumnId();
|
|
108
108
|
var store = useEuiTableColumnDataStore();
|
|
109
109
|
var isWithinStickyHeader = useEuiTableWithinStickyHeader();
|
|
110
110
|
var styles = useEuiMemoizedStyles(euiTableHeaderFooterCellStyles);
|
|
@@ -169,15 +169,15 @@ export var EuiTableHeaderCell = function EuiTableHeaderCell(_ref2) {
|
|
|
169
169
|
if (!entry) {
|
|
170
170
|
return;
|
|
171
171
|
}
|
|
172
|
-
store.updateColumnWidth(
|
|
173
|
-
}, [store,
|
|
172
|
+
store.updateColumnWidth(storeCellId, entry.contentRect.width);
|
|
173
|
+
}, [store, storeCellId]);
|
|
174
174
|
useEffect(function () {
|
|
175
175
|
// Don't register the column inside the sticky header as the original
|
|
176
176
|
// column is already registered. This would cause an infinite loop.
|
|
177
177
|
if (isWithinStickyHeader || !selfRef.current || !renderHeaderCellRef.current) {
|
|
178
178
|
return;
|
|
179
179
|
}
|
|
180
|
-
var unregisterColumn = store.registerColumn(
|
|
180
|
+
var unregisterColumn = store.registerColumn(storeCellId, {
|
|
181
181
|
renderHeaderCellRef: renderHeaderCellRef,
|
|
182
182
|
// getBoundingClientRect is not the cheapest, but we call it only once
|
|
183
183
|
currentWidth: selfRef.current.getBoundingClientRect().width
|
|
@@ -199,8 +199,7 @@ export var EuiTableHeaderCell = function EuiTableHeaderCell(_ref2) {
|
|
|
199
199
|
unregisterColumn();
|
|
200
200
|
(_resizeObserver = resizeObserver) === null || _resizeObserver === void 0 || _resizeObserver.disconnect();
|
|
201
201
|
};
|
|
202
|
-
|
|
203
|
-
}, [store, internalCellId, isWithinStickyHeader]);
|
|
202
|
+
}, [store, isWithinStickyHeader, handleResize, storeCellId]);
|
|
204
203
|
|
|
205
204
|
// Notify the store on every render so the sticky header stays in sync.
|
|
206
205
|
// React's reconciliation will efficiently handle any duplicate renders.
|
|
@@ -215,7 +214,7 @@ export var EuiTableHeaderCell = function EuiTableHeaderCell(_ref2) {
|
|
|
215
214
|
if (!selfRef.current) {
|
|
216
215
|
return;
|
|
217
216
|
}
|
|
218
|
-
store.updateColumn(
|
|
217
|
+
store.updateColumn(storeCellId, {
|
|
219
218
|
renderHeaderCellRef: renderHeaderCellRef
|
|
220
219
|
});
|
|
221
220
|
});
|
|
@@ -12,11 +12,11 @@ var _excluded = ["children", "className", "scope", "style", "width", "minWidth",
|
|
|
12
12
|
import React, { useEffect, useRef } from 'react';
|
|
13
13
|
import classNames from 'classnames';
|
|
14
14
|
import { useEuiMemoizedStyles } from '../../services';
|
|
15
|
-
import { useGeneratedHtmlId } from '../../services/accessibility/html_id_generator';
|
|
16
15
|
import { resolveWidthPropsAsStyle } from './utils';
|
|
17
16
|
import { euiTableCellCheckboxStyles } from './table_cells_shared.styles';
|
|
18
17
|
import { useEuiTableColumnDataStore } from './store/provider';
|
|
19
18
|
import { useEuiTableWithinStickyHeader } from './sticky_header';
|
|
19
|
+
import { useEuiTableStoreUniqueColumnId } from './store/use_unique_column_id';
|
|
20
20
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
21
21
|
export var EuiTableHeaderCellCheckbox = function EuiTableHeaderCellCheckbox(props) {
|
|
22
22
|
var children = props.children,
|
|
@@ -29,7 +29,7 @@ export var EuiTableHeaderCellCheckbox = function EuiTableHeaderCellCheckbox(prop
|
|
|
29
29
|
maxWidth = props.maxWidth,
|
|
30
30
|
append = props.append,
|
|
31
31
|
rest = _objectWithoutProperties(props, _excluded);
|
|
32
|
-
var
|
|
32
|
+
var storeCellId = useEuiTableStoreUniqueColumnId();
|
|
33
33
|
var store = useEuiTableColumnDataStore();
|
|
34
34
|
var isWithinStickyHeader = useEuiTableWithinStickyHeader();
|
|
35
35
|
var styles = useEuiMemoizedStyles(euiTableCellCheckboxStyles);
|
|
@@ -56,21 +56,20 @@ export var EuiTableHeaderCellCheckbox = function EuiTableHeaderCellCheckbox(prop
|
|
|
56
56
|
if (isWithinStickyHeader) {
|
|
57
57
|
return;
|
|
58
58
|
}
|
|
59
|
-
var unregisterColumn = store.registerColumn(
|
|
59
|
+
var unregisterColumn = store.registerColumn(storeCellId, {
|
|
60
60
|
renderHeaderCellRef: renderHeaderCellRef
|
|
61
61
|
});
|
|
62
62
|
return function () {
|
|
63
63
|
unregisterColumn();
|
|
64
64
|
};
|
|
65
|
-
|
|
66
|
-
}, [store, internalCellId, isWithinStickyHeader]);
|
|
65
|
+
}, [store, isWithinStickyHeader, storeCellId]);
|
|
67
66
|
useEffect(function () {
|
|
68
67
|
// Notify the store on every render so the sticky header stays in sync.
|
|
69
68
|
// React's reconciliation will efficiently handle any duplicate renders.
|
|
70
69
|
if (isWithinStickyHeader) {
|
|
71
70
|
return;
|
|
72
71
|
}
|
|
73
|
-
store.updateColumn(
|
|
72
|
+
store.updateColumn(storeCellId, {
|
|
74
73
|
renderHeaderCellRef: renderHeaderCellRef
|
|
75
74
|
});
|
|
76
75
|
});
|