@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,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
@@ -9,12 +8,7 @@ exports.isIconShape = exports.ICON_SIDES = exports.EuiFormControlLayoutIcons = v
|
|
|
9
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
9
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
10
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
12
|
-
var
|
|
13
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
14
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
15
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
16
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
17
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _react = _interopRequireDefault(require("react"));
|
|
18
12
|
var _services = require("../../../services");
|
|
19
13
|
var _icon = require("../../icon");
|
|
20
14
|
var _loading = require("../../loading");
|
|
@@ -23,10 +17,7 @@ var _form_control_layout_custom_icon = require("./form_control_layout_custom_ico
|
|
|
23
17
|
var _form_control_layout_icons = require("./form_control_layout_icons.styles");
|
|
24
18
|
var _react2 = require("@emotion/react");
|
|
25
19
|
var _excluded = ["ref", "side"];
|
|
26
|
-
|
|
27
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
28
|
-
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
29
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /*
|
|
20
|
+
/*
|
|
30
21
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
31
22
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
32
23
|
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
@@ -37,111 +28,99 @@ var ICON_SIDES = exports.ICON_SIDES = ['left', 'right'];
|
|
|
37
28
|
var isIconShape = exports.isIconShape = function isIconShape(icon) {
|
|
38
29
|
return !!icon && icon.hasOwnProperty('type');
|
|
39
30
|
};
|
|
40
|
-
var EuiFormControlLayoutIcons = exports.EuiFormControlLayoutIcons =
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
31
|
+
var EuiFormControlLayoutIcons = exports.EuiFormControlLayoutIcons = function EuiFormControlLayoutIcons(_ref) {
|
|
32
|
+
var _ref$side = _ref.side,
|
|
33
|
+
side = _ref$side === void 0 ? 'left' : _ref$side,
|
|
34
|
+
_ref$iconsPosition = _ref.iconsPosition,
|
|
35
|
+
iconsPosition = _ref$iconsPosition === void 0 ? 'absolute' : _ref$iconsPosition,
|
|
36
|
+
compressed = _ref.compressed,
|
|
37
|
+
isDisabled = _ref.isDisabled,
|
|
38
|
+
icon = _ref.icon,
|
|
39
|
+
clear = _ref.clear,
|
|
40
|
+
isLoading = _ref.isLoading,
|
|
41
|
+
isInvalid = _ref.isInvalid,
|
|
42
|
+
isDropdown = _ref.isDropdown;
|
|
43
|
+
var euiThemeContext = (0, _services.useEuiTheme)();
|
|
44
|
+
var styles = (0, _form_control_layout_icons.euiFormControlLayoutIconsStyles)(euiThemeContext);
|
|
45
|
+
var cssStyles = [styles.euiFormControlLayoutIcons, compressed ? styles.compressed : styles.uncompressed].concat((0, _toConsumableArray2.default)(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]);
|
|
46
|
+
return (0, _react2.jsx)("div", {
|
|
47
|
+
css: cssStyles,
|
|
48
|
+
className: "euiFormControlLayoutIcons"
|
|
49
|
+
}, (0, _react2.jsx)(ClearButton, {
|
|
50
|
+
clear: clear,
|
|
51
|
+
isDisabled: isDisabled
|
|
52
|
+
}), (0, _react2.jsx)(LoadingSpinner, {
|
|
53
|
+
isLoading: isLoading
|
|
54
|
+
}), (0, _react2.jsx)(InvalidIcon, {
|
|
55
|
+
isInvalid: isInvalid
|
|
56
|
+
}), (0, _react2.jsx)(CustomIcon, {
|
|
57
|
+
icon: icon,
|
|
58
|
+
isDisabled: isDisabled
|
|
59
|
+
}), (0, _react2.jsx)(DropdownIcon, {
|
|
60
|
+
isDropdown: isDropdown,
|
|
61
|
+
isDisabled: isDisabled
|
|
62
|
+
}));
|
|
63
|
+
};
|
|
64
|
+
var CustomIcon = function CustomIcon(_ref2) {
|
|
65
|
+
var icon = _ref2.icon,
|
|
66
|
+
isDisabled = _ref2.isDisabled;
|
|
67
|
+
if (!icon) {
|
|
68
|
+
return null;
|
|
44
69
|
}
|
|
45
|
-
(0, _inherits2.default)(EuiFormControlLayoutIcons, _Component);
|
|
46
|
-
return (0, _createClass2.default)(EuiFormControlLayoutIcons, [{
|
|
47
|
-
key: "render",
|
|
48
|
-
value: function render() {
|
|
49
|
-
var _this$props = this.props,
|
|
50
|
-
_this$props$side = _this$props.side,
|
|
51
|
-
side = _this$props$side === void 0 ? 'left' : _this$props$side,
|
|
52
|
-
_this$props$iconsPosi = _this$props.iconsPosition,
|
|
53
|
-
iconsPosition = _this$props$iconsPosi === void 0 ? 'absolute' : _this$props$iconsPosi,
|
|
54
|
-
compressed = _this$props.compressed,
|
|
55
|
-
isDisabled = _this$props.isDisabled;
|
|
56
|
-
var customIcon = this.renderCustomIcon();
|
|
57
|
-
var loadingSpinner = this.renderLoadingSpinner();
|
|
58
|
-
var clearButton = this.renderClearButton();
|
|
59
|
-
var invalidIcon = this.renderInvalidIcon();
|
|
60
|
-
var dropdownIcon = this.renderDropdownIcon();
|
|
61
|
-
return (0, _react2.jsx)(_services.RenderWithEuiStylesMemoizer, null, function (stylesMemoizer) {
|
|
62
|
-
var styles = stylesMemoizer(_form_control_layout_icons.euiFormControlLayoutIconsStyles);
|
|
63
|
-
var cssStyles = [styles.euiFormControlLayoutIcons, compressed ? styles.compressed : styles.uncompressed].concat((0, _toConsumableArray2.default)(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]);
|
|
64
|
-
return (0, _react2.jsx)("div", {
|
|
65
|
-
css: cssStyles,
|
|
66
|
-
className: "euiFormControlLayoutIcons"
|
|
67
|
-
}, clearButton, loadingSpinner, invalidIcon, customIcon, dropdownIcon);
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
}, {
|
|
71
|
-
key: "renderCustomIcon",
|
|
72
|
-
value: function renderCustomIcon() {
|
|
73
|
-
var _this$props2 = this.props,
|
|
74
|
-
icon = _this$props2.icon,
|
|
75
|
-
isDisabled = _this$props2.isDisabled;
|
|
76
|
-
if (!icon) {
|
|
77
|
-
return null;
|
|
78
|
-
}
|
|
79
70
|
|
|
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
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
var isInvalid = this.props.isInvalid;
|
|
137
|
-
if (!isInvalid) {
|
|
138
|
-
return null;
|
|
139
|
-
}
|
|
140
|
-
return (0, _react2.jsx)(_icon.EuiIcon, {
|
|
141
|
-
size: "m",
|
|
142
|
-
color: "danger",
|
|
143
|
-
type: "warning"
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
}]);
|
|
147
|
-
}(_react.Component);
|
|
71
|
+
// Normalize the icon to an object if it's a string.
|
|
72
|
+
var iconProps = isIconShape(icon) ? icon : {
|
|
73
|
+
type: icon
|
|
74
|
+
};
|
|
75
|
+
var iconRef = iconProps.ref,
|
|
76
|
+
side = iconProps.side,
|
|
77
|
+
iconRest = (0, _objectWithoutProperties2.default)(iconProps, _excluded);
|
|
78
|
+
return (0, _react2.jsx)(_form_control_layout_custom_icon.EuiFormControlLayoutCustomIcon, (0, _extends2.default)({
|
|
79
|
+
size: "m",
|
|
80
|
+
disabled: isDisabled,
|
|
81
|
+
iconRef: iconRef
|
|
82
|
+
}, iconRest));
|
|
83
|
+
};
|
|
84
|
+
var DropdownIcon = function DropdownIcon(_ref3) {
|
|
85
|
+
var isDropdown = _ref3.isDropdown,
|
|
86
|
+
isDisabled = _ref3.isDisabled;
|
|
87
|
+
if (!isDropdown) {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
return (0, _react2.jsx)(_form_control_layout_custom_icon.EuiFormControlLayoutCustomIcon, {
|
|
91
|
+
size: "m",
|
|
92
|
+
disabled: isDisabled,
|
|
93
|
+
type: "chevronSingleDown"
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
var LoadingSpinner = function LoadingSpinner(_ref4) {
|
|
97
|
+
var isLoading = _ref4.isLoading;
|
|
98
|
+
if (!isLoading) {
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
return (0, _react2.jsx)(_loading.EuiLoadingSpinner, {
|
|
102
|
+
size: "m"
|
|
103
|
+
});
|
|
104
|
+
};
|
|
105
|
+
var ClearButton = function ClearButton(_ref5) {
|
|
106
|
+
var clear = _ref5.clear,
|
|
107
|
+
isDisabled = _ref5.isDisabled;
|
|
108
|
+
if (!clear) {
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
return (0, _react2.jsx)(_form_control_layout_clear_button.EuiFormControlLayoutClearButton, (0, _extends2.default)({
|
|
112
|
+
size: "m",
|
|
113
|
+
disabled: isDisabled
|
|
114
|
+
}, clear));
|
|
115
|
+
};
|
|
116
|
+
var InvalidIcon = function InvalidIcon(_ref6) {
|
|
117
|
+
var isInvalid = _ref6.isInvalid;
|
|
118
|
+
if (!isInvalid) {
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
return (0, _react2.jsx)(_icon.EuiIcon, {
|
|
122
|
+
size: "m",
|
|
123
|
+
color: "danger",
|
|
124
|
+
type: "warning"
|
|
125
|
+
});
|
|
126
|
+
};
|
|
@@ -18,7 +18,7 @@ var euiSelectStyles = exports.euiSelectStyles = function euiSelectStyles(euiThem
|
|
|
18
18
|
var formStyles = (0, _form.euiFormControlStyles)(euiThemeContext);
|
|
19
19
|
var formVariables = (0, _form.euiFormVariables)(euiThemeContext);
|
|
20
20
|
return {
|
|
21
|
-
euiSelect: /*#__PURE__*/(0, _react.css)("appearance:none;", formStyles.shared, " &:invalid{", formStyles.invalid, ";}&:focus{", formStyles.focus, ";}&:disabled{", formStyles.disabled, ";}&[readOnly]{", formStyles.readOnly, ";}&:autofill{", formStyles.autoFill, ";};label:euiSelect;"),
|
|
21
|
+
euiSelect: /*#__PURE__*/(0, _react.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;"),
|
|
22
22
|
// Skip the css() on the default height to avoid generating a className
|
|
23
23
|
uncompressed: formStyles.uncompressed,
|
|
24
24
|
compressed: /*#__PURE__*/(0, _react.css)(formStyles.compressed, ";label:compressed;"),
|
|
@@ -51,7 +51,7 @@ var euiTextAreaStyles = exports.euiTextAreaStyles = function euiTextAreaStyles(e
|
|
|
51
51
|
var formStyles = (0, _form.euiFormControlStyles)(euiThemeContext);
|
|
52
52
|
var formVars = (0, _form.euiFormVariables)(euiThemeContext);
|
|
53
53
|
return {
|
|
54
|
-
euiTextArea: /*#__PURE__*/(0, _react.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;"),
|
|
54
|
+
euiTextArea: /*#__PURE__*/(0, _react.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;"),
|
|
55
55
|
resize: {
|
|
56
56
|
vertical: _ref4,
|
|
57
57
|
horizontal: _ref3,
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.useEuiValidatableControl = exports.EuiValidatableControl = void 0;
|
|
8
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
7
|
var _react = require("react");
|
|
10
8
|
/*
|
|
11
9
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
@@ -15,41 +13,22 @@ var _react = require("react");
|
|
|
15
13
|
* Side Public License, v 1.
|
|
16
14
|
*/
|
|
17
15
|
|
|
18
|
-
function isMutableRef(ref) {
|
|
19
|
-
return ref != null && ref.hasOwnProperty('current');
|
|
20
|
-
}
|
|
21
|
-
|
|
22
16
|
/**
|
|
23
17
|
* The `EuiValidatableControl` component should be used in scenarios where
|
|
24
18
|
* we can render the validated `<input>` as its direct child.
|
|
19
|
+
*
|
|
20
|
+
* It flags the underlying control as invalid via `aria-invalid`, which EUI form
|
|
21
|
+
* controls use to render their invalid styling. Note that it intentionally does
|
|
22
|
+
* *not* hook into the native constraint validation API (`setCustomValidity`) -
|
|
23
|
+
* `isInvalid` is a presentational prop, and tying it to native validity would
|
|
24
|
+
* block native form submission and surface a non-localized native error tooltip.
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
27
|
var EuiValidatableControl = exports.EuiValidatableControl = function EuiValidatableControl(_ref) {
|
|
28
28
|
var isInvalid = _ref.isInvalid,
|
|
29
29
|
children = _ref.children;
|
|
30
|
-
// Note that this must be state and not a ref to cause a rerender/set invalid state on initial mount
|
|
31
|
-
var _useState = (0, _react.useState)(null),
|
|
32
|
-
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
33
|
-
control = _useState2[0],
|
|
34
|
-
setControl = _useState2[1];
|
|
35
30
|
var child = _react.Children.only(children);
|
|
36
|
-
var childRef = child.ref;
|
|
37
|
-
var replacedRef = (0, _react.useCallback)(function (element) {
|
|
38
|
-
setControl(element);
|
|
39
|
-
|
|
40
|
-
// Call the original ref, if any
|
|
41
|
-
if (typeof childRef === 'function') {
|
|
42
|
-
childRef(element);
|
|
43
|
-
} else if (isMutableRef(childRef)) {
|
|
44
|
-
childRef.current = element;
|
|
45
|
-
}
|
|
46
|
-
}, [childRef]);
|
|
47
|
-
useSetControlValidity({
|
|
48
|
-
controlEl: control,
|
|
49
|
-
isInvalid: isInvalid
|
|
50
|
-
});
|
|
51
31
|
return /*#__PURE__*/(0, _react.cloneElement)(child, {
|
|
52
|
-
ref: replacedRef,
|
|
53
32
|
'aria-invalid': isInvalid || child.props['aria-invalid']
|
|
54
33
|
});
|
|
55
34
|
};
|
|
@@ -63,10 +42,6 @@ var EuiValidatableControl = exports.EuiValidatableControl = function EuiValidata
|
|
|
63
42
|
var useEuiValidatableControl = exports.useEuiValidatableControl = function useEuiValidatableControl(_ref2) {
|
|
64
43
|
var isInvalid = _ref2.isInvalid,
|
|
65
44
|
controlEl = _ref2.controlEl;
|
|
66
|
-
useSetControlValidity({
|
|
67
|
-
controlEl: controlEl,
|
|
68
|
-
isInvalid: isInvalid
|
|
69
|
-
});
|
|
70
45
|
(0, _react.useEffect)(function () {
|
|
71
46
|
if (!controlEl) return;
|
|
72
47
|
if (typeof isInvalid === 'boolean') {
|
|
@@ -75,22 +50,4 @@ var useEuiValidatableControl = exports.useEuiValidatableControl = function useEu
|
|
|
75
50
|
controlEl.removeAttribute('aria-invalid');
|
|
76
51
|
}
|
|
77
52
|
}, [isInvalid, controlEl]);
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Internal `setCustomValidity` helper
|
|
82
|
-
*/
|
|
83
|
-
var useSetControlValidity = function useSetControlValidity(_ref3) {
|
|
84
|
-
var controlEl = _ref3.controlEl,
|
|
85
|
-
isInvalid = _ref3.isInvalid;
|
|
86
|
-
(0, _react.useEffect)(function () {
|
|
87
|
-
if (controlEl == null || typeof controlEl.setCustomValidity !== 'function') {
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
if (isInvalid) {
|
|
91
|
-
controlEl.setCustomValidity('Invalid');
|
|
92
|
-
} else {
|
|
93
|
-
controlEl.setCustomValidity('');
|
|
94
|
-
}
|
|
95
|
-
}, [isInvalid, controlEl]);
|
|
96
53
|
};
|
|
@@ -7,13 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.EuiTableSortMobile = void 0;
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
11
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
12
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
14
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
15
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
16
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
17
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
18
13
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
19
14
|
var _button_empty = require("../../button/button_empty");
|
|
@@ -23,87 +18,70 @@ var _i18n = require("../../i18n");
|
|
|
23
18
|
var _table_sort_mobile_item = require("./table_sort_mobile_item");
|
|
24
19
|
var _react2 = require("@emotion/react");
|
|
25
20
|
var _excluded = ["className", "anchorPosition", "items"];
|
|
26
|
-
|
|
27
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
28
|
-
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
29
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /*
|
|
21
|
+
/*
|
|
30
22
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
31
23
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
32
24
|
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
33
25
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
34
26
|
* Side Public License, v 1.
|
|
35
27
|
*/
|
|
36
|
-
var
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
(0,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
});
|
|
57
|
-
// Aligns the button to the right even when it's the only element present
|
|
58
|
-
(0, _defineProperty2.default)(_this, "euiTableSortMobileStyles", {
|
|
59
|
-
marginInlineStart: 'auto',
|
|
60
|
-
label: 'euiTableSortMobile'
|
|
28
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
29
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
30
|
+
// Aligns the button to the right even when it's the only element present
|
|
31
|
+
var euiTableSortMobileStyles = {
|
|
32
|
+
marginInlineStart: 'auto',
|
|
33
|
+
label: 'euiTableSortMobile'
|
|
34
|
+
};
|
|
35
|
+
var EuiTableSortMobile = exports.EuiTableSortMobile = function EuiTableSortMobile(_ref) {
|
|
36
|
+
var className = _ref.className,
|
|
37
|
+
anchorPosition = _ref.anchorPosition,
|
|
38
|
+
items = _ref.items,
|
|
39
|
+
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
40
|
+
var _useState = (0, _react.useState)(false),
|
|
41
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
42
|
+
isPopoverOpen = _useState2[0],
|
|
43
|
+
setIsPopoverOpen = _useState2[1];
|
|
44
|
+
var classes = (0, _classnames.default)('euiTableSortMobile', className);
|
|
45
|
+
var onButtonClick = function onButtonClick() {
|
|
46
|
+
setIsPopoverOpen(function (isOpen) {
|
|
47
|
+
return !isOpen;
|
|
61
48
|
});
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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
|
-
}) : undefined
|
|
102
|
-
}));
|
|
103
|
-
return (0, _react2.jsx)("div", {
|
|
104
|
-
className: classes,
|
|
105
|
-
css: this.euiTableSortMobileStyles
|
|
106
|
-
}, mobileSortPopover);
|
|
107
|
-
}
|
|
108
|
-
}]);
|
|
109
|
-
}(_react.Component);
|
|
49
|
+
};
|
|
50
|
+
var closePopover = function closePopover() {
|
|
51
|
+
setIsPopoverOpen(false);
|
|
52
|
+
};
|
|
53
|
+
var mobileSortButton = (0, _react2.jsx)(_button_empty.EuiButtonEmpty, {
|
|
54
|
+
iconType: "chevronSingleDown",
|
|
55
|
+
iconSide: "right",
|
|
56
|
+
onClick: onButtonClick,
|
|
57
|
+
flush: "right",
|
|
58
|
+
size: "xs"
|
|
59
|
+
}, (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
60
|
+
token: "euiTableSortMobile.sorting",
|
|
61
|
+
default: "Sorting"
|
|
62
|
+
}));
|
|
63
|
+
var mobileSortPopover = (0, _react2.jsx)(_popover.EuiPopover, (0, _extends2.default)({
|
|
64
|
+
button: mobileSortButton,
|
|
65
|
+
isOpen: isPopoverOpen,
|
|
66
|
+
closePopover: closePopover,
|
|
67
|
+
anchorPosition: anchorPosition || 'downRight',
|
|
68
|
+
panelPaddingSize: "none"
|
|
69
|
+
}, rest), (0, _react2.jsx)(_context_menu.EuiContextMenuPanel, {
|
|
70
|
+
style: {
|
|
71
|
+
minWidth: 200
|
|
72
|
+
},
|
|
73
|
+
items: items !== null && items !== void 0 && items.length ? items.map(function (item) {
|
|
74
|
+
return (0, _react2.jsx)(_table_sort_mobile_item.EuiTableSortMobileItem, {
|
|
75
|
+
key: item.key,
|
|
76
|
+
onSort: item.onSort,
|
|
77
|
+
isSorted: item.isSorted,
|
|
78
|
+
isSortAscending: item.isSortAscending
|
|
79
|
+
}, item.name);
|
|
80
|
+
}) : undefined
|
|
81
|
+
}));
|
|
82
|
+
return (0, _react2.jsx)("div", {
|
|
83
|
+
className: classes,
|
|
84
|
+
css: euiTableSortMobileStyles
|
|
85
|
+
}, mobileSortPopover);
|
|
86
|
+
};
|
|
87
|
+
EuiTableSortMobile.displayName = 'EuiTableSortMobile';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useEuiTableStoreUniqueColumnId = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _uuid = require("uuid");
|
|
10
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
11
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
12
|
+
/*
|
|
13
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
14
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
15
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
16
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
17
|
+
* Side Public License, v 1.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
var useEuiTableStoreUniqueColumnIdFallback = function useEuiTableStoreUniqueColumnIdFallback() {
|
|
21
|
+
var ref = (0, _react.useRef)((0, _uuid.v4)());
|
|
22
|
+
return ref.current;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Returns a stable unique column ID to be used when registering columns.
|
|
27
|
+
* It uses `React.useId()` when available and falls back to UUID v4 on React 17.
|
|
28
|
+
*
|
|
29
|
+
* This is needed so that static `uuid` mocks don't break column registration
|
|
30
|
+
* (at least in React 18+; in older versions this function would need
|
|
31
|
+
* to be mocked to return something unique, but stable).
|
|
32
|
+
* @internal
|
|
33
|
+
*/
|
|
34
|
+
var useEuiTableStoreUniqueColumnId = exports.useEuiTableStoreUniqueColumnId = 'useId' in _react.default ? _react.useId : useEuiTableStoreUniqueColumnIdFallback;
|
|
@@ -12,7 +12,6 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
12
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
13
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
14
14
|
var _services = require("../../services");
|
|
15
|
-
var _html_id_generator = require("../../services/accessibility/html_id_generator");
|
|
16
15
|
var _i18n = require("../i18n");
|
|
17
16
|
var _accessibility = require("../accessibility");
|
|
18
17
|
var _icon = require("../icon");
|
|
@@ -24,6 +23,7 @@ var _table_cell_content = require("./_table_cell_content");
|
|
|
24
23
|
var _table_cells_shared = require("./table_cells_shared.styles");
|
|
25
24
|
var _provider = require("./store/provider");
|
|
26
25
|
var _sticky_header = require("./sticky_header");
|
|
26
|
+
var _use_unique_column_id = require("./store/use_unique_column_id");
|
|
27
27
|
var _react2 = require("@emotion/react");
|
|
28
28
|
var _excluded = ["children", "align", "onSort", "isSorted", "isSortAscending", "className", "scope", "mobileOptions", "width", "minWidth", "maxWidth", "style", "readOnly", "tooltipProps", "description", "append", "sticky"];
|
|
29
29
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
@@ -112,7 +112,7 @@ var EuiTableHeaderCell = exports.EuiTableHeaderCell = function EuiTableHeaderCel
|
|
|
112
112
|
sticky = _ref2.sticky,
|
|
113
113
|
rest = (0, _objectWithoutProperties2.default)(_ref2, _excluded);
|
|
114
114
|
var selfRef = (0, _react.useRef)(null);
|
|
115
|
-
var
|
|
115
|
+
var storeCellId = (0, _use_unique_column_id.useEuiTableStoreUniqueColumnId)();
|
|
116
116
|
var store = (0, _provider.useEuiTableColumnDataStore)();
|
|
117
117
|
var isWithinStickyHeader = (0, _sticky_header.useEuiTableWithinStickyHeader)();
|
|
118
118
|
var styles = (0, _services.useEuiMemoizedStyles)(_table_cells_shared.euiTableHeaderFooterCellStyles);
|
|
@@ -177,15 +177,15 @@ var EuiTableHeaderCell = exports.EuiTableHeaderCell = function EuiTableHeaderCel
|
|
|
177
177
|
if (!entry) {
|
|
178
178
|
return;
|
|
179
179
|
}
|
|
180
|
-
store.updateColumnWidth(
|
|
181
|
-
}, [store,
|
|
180
|
+
store.updateColumnWidth(storeCellId, entry.contentRect.width);
|
|
181
|
+
}, [store, storeCellId]);
|
|
182
182
|
(0, _react.useEffect)(function () {
|
|
183
183
|
// Don't register the column inside the sticky header as the original
|
|
184
184
|
// column is already registered. This would cause an infinite loop.
|
|
185
185
|
if (isWithinStickyHeader || !selfRef.current || !renderHeaderCellRef.current) {
|
|
186
186
|
return;
|
|
187
187
|
}
|
|
188
|
-
var unregisterColumn = store.registerColumn(
|
|
188
|
+
var unregisterColumn = store.registerColumn(storeCellId, {
|
|
189
189
|
renderHeaderCellRef: renderHeaderCellRef,
|
|
190
190
|
// getBoundingClientRect is not the cheapest, but we call it only once
|
|
191
191
|
currentWidth: selfRef.current.getBoundingClientRect().width
|
|
@@ -207,8 +207,7 @@ var EuiTableHeaderCell = exports.EuiTableHeaderCell = function EuiTableHeaderCel
|
|
|
207
207
|
unregisterColumn();
|
|
208
208
|
(_resizeObserver = resizeObserver) === null || _resizeObserver === void 0 || _resizeObserver.disconnect();
|
|
209
209
|
};
|
|
210
|
-
|
|
211
|
-
}, [store, internalCellId, isWithinStickyHeader]);
|
|
210
|
+
}, [store, isWithinStickyHeader, handleResize, storeCellId]);
|
|
212
211
|
|
|
213
212
|
// Notify the store on every render so the sticky header stays in sync.
|
|
214
213
|
// React's reconciliation will efficiently handle any duplicate renders.
|
|
@@ -223,7 +222,7 @@ var EuiTableHeaderCell = exports.EuiTableHeaderCell = function EuiTableHeaderCel
|
|
|
223
222
|
if (!selfRef.current) {
|
|
224
223
|
return;
|
|
225
224
|
}
|
|
226
|
-
store.updateColumn(
|
|
225
|
+
store.updateColumn(storeCellId, {
|
|
227
226
|
renderHeaderCellRef: renderHeaderCellRef
|
|
228
227
|
});
|
|
229
228
|
});
|