@elastic/eui 90.0.0 → 91.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/eui_charts_theme.js +1 -15
- package/dist/eui_charts_theme.js.map +1 -1
- package/dist/eui_theme_dark.css +112 -80
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +112 -80
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/accordion/accordion.js +13 -2
- package/es/components/accordion/accordion_children/accordion_children.js +4 -3
- package/es/components/breadcrumbs/breadcrumb.js +5 -5
- package/es/components/breadcrumbs/breadcrumbs.js +5 -5
- package/es/components/button/button_display/_button_display.js +1 -1
- package/es/components/button/button_group/button_group.js +8 -10
- package/es/components/button/button_group/button_group_button.js +8 -51
- package/es/components/button/button_group/button_group_button.styles.js +2 -12
- package/es/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +8 -0
- package/es/components/collapsible_nav_beta/collapsible_nav_group/collapsible_nav_group.js +8 -3
- package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_group.js +7 -3
- package/es/components/combo_box/combo_box.js +7 -5
- package/es/components/combo_box/combo_box_input/combo_box_input.js +107 -65
- package/es/components/combo_box/combo_box_input/combo_box_pill.js +8 -18
- package/es/components/combo_box/combo_box_options_list/combo_box_options_list.js +6 -6
- package/es/components/combo_box/utils.js +23 -0
- package/es/components/control_bar/control_bar.js +5 -5
- package/es/components/datagrid/body/header/data_grid_header_cell.js +1 -1
- package/es/components/datagrid/controls/column_selector.js +5 -6
- package/es/components/datagrid/controls/column_sorting.js +6 -9
- package/es/components/datagrid/controls/display_selector.js +21 -16
- package/es/components/datagrid/data_grid.js +3 -864
- package/es/components/date_picker/super_date_picker/date_popover/absolute_tab.js +92 -26
- package/es/components/date_picker/super_date_picker/date_popover/date_popover_button.js +1 -1
- package/es/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.js +1 -2
- package/es/components/date_picker/super_date_picker/super_date_picker.js +19 -0
- package/es/components/facet/facet_button.js +1 -1
- package/es/components/filter_group/filter_group.styles.js +1 -1
- package/es/components/header/header_breadcrumbs/header_breadcrumbs.js +5 -5
- package/es/components/header/header_links/header_links.js +5 -5
- package/es/components/i18n/i18n.js +1 -0
- package/es/components/page/page_header/page_header_content.js +5 -5
- package/es/components/popover/input_popover.js +1 -1
- package/es/components/popover/popover.js +15 -27
- package/es/components/popover/popover_arrow/_popover_arrow.styles.js +2 -4
- package/es/components/popover/popover_panel/_popover_panel.js +2 -6
- package/es/components/popover/popover_panel/_popover_panel.styles.js +6 -1
- package/es/components/selectable/selectable_templates/selectable_template_sitewide.js +13 -11
- package/es/components/toast/global_toast_list.js +11 -1
- package/es/components/tour/tour_step.js +5 -5
- package/es/global_styling/mixins/_states.js +4 -1
- package/es/services/color/eui_palettes.js +0 -6
- package/es/services/color/index.js +1 -1
- package/es/services/hooks/useCombinedRefs.js +16 -9
- package/es/services/index.js +1 -2
- package/es/test/rtl/component_helpers.d.ts +2 -0
- package/es/test/rtl/component_helpers.js +40 -1
- package/eui.d.ts +96 -82
- package/i18ntokens.json +199 -181
- package/lib/components/accordion/accordion.js +13 -2
- package/lib/components/accordion/accordion_children/accordion_children.js +4 -3
- package/lib/components/breadcrumbs/breadcrumb.js +5 -5
- package/lib/components/button/button_display/_button_display.js +1 -1
- package/lib/components/button/button_group/button_group.js +7 -9
- package/lib/components/button/button_group/button_group_button.js +8 -51
- package/lib/components/button/button_group/button_group_button.styles.js +2 -12
- package/lib/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +8 -0
- package/lib/components/collapsible_nav_beta/collapsible_nav_group/collapsible_nav_group.js +7 -2
- package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_group.js +6 -2
- package/lib/components/combo_box/combo_box.js +7 -5
- package/lib/components/combo_box/combo_box_input/combo_box_input.js +107 -65
- package/lib/components/combo_box/combo_box_input/combo_box_pill.js +8 -18
- package/lib/components/combo_box/combo_box_options_list/combo_box_options_list.js +6 -6
- package/lib/components/combo_box/utils.js +31 -0
- package/lib/components/datagrid/body/header/data_grid_header_cell.js +1 -1
- package/lib/components/datagrid/controls/column_selector.js +5 -6
- package/lib/components/datagrid/controls/column_sorting.js +5 -8
- package/lib/components/datagrid/controls/display_selector.js +21 -16
- package/lib/components/datagrid/data_grid.js +2 -863
- package/lib/components/date_picker/super_date_picker/date_popover/absolute_tab.js +91 -26
- package/lib/components/date_picker/super_date_picker/date_popover/date_popover_button.js +1 -1
- package/lib/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.js +1 -2
- package/lib/components/date_picker/super_date_picker/super_date_picker.js +19 -0
- package/lib/components/facet/facet_button.js +1 -1
- package/lib/components/filter_group/filter_group.styles.js +1 -1
- package/lib/components/i18n/i18n.js +1 -0
- package/lib/components/popover/input_popover.js +1 -1
- package/lib/components/popover/popover.js +29 -35
- package/lib/components/popover/popover_arrow/_popover_arrow.styles.js +1 -3
- package/lib/components/popover/popover_panel/_popover_panel.js +2 -1
- package/lib/components/popover/popover_panel/_popover_panel.styles.js +6 -1
- package/lib/components/selectable/selectable_templates/selectable_template_sitewide.js +12 -10
- package/lib/components/toast/global_toast_list.js +11 -1
- package/lib/global_styling/mixins/_states.js +4 -1
- package/lib/services/color/eui_palettes.js +1 -8
- package/lib/services/color/index.js +0 -7
- package/lib/services/hooks/useCombinedRefs.js +19 -10
- package/lib/services/index.js +0 -15
- package/lib/test/rtl/component_helpers.d.ts +2 -0
- package/lib/test/rtl/component_helpers.js +41 -3
- package/optimize/es/components/accordion/accordion.js +5 -2
- package/optimize/es/components/accordion/accordion_children/accordion_children.js +4 -3
- package/optimize/es/components/button/button_group/button_group.js +7 -8
- package/optimize/es/components/button/button_group/button_group_button.js +6 -38
- package/optimize/es/components/button/button_group/button_group_button.styles.js +2 -12
- package/optimize/es/components/collapsible_nav_beta/collapsible_nav_group/collapsible_nav_group.js +8 -3
- package/optimize/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_group.js +7 -3
- package/optimize/es/components/combo_box/combo_box.js +7 -5
- package/optimize/es/components/combo_box/combo_box_input/combo_box_input.js +107 -65
- package/optimize/es/components/combo_box/combo_box_input/combo_box_pill.js +8 -17
- package/optimize/es/components/combo_box/combo_box_options_list/combo_box_options_list.js +6 -6
- package/optimize/es/components/combo_box/utils.js +23 -0
- package/optimize/es/components/datagrid/body/header/data_grid_header_cell.js +1 -1
- package/optimize/es/components/datagrid/controls/column_selector.js +5 -6
- package/optimize/es/components/datagrid/controls/column_sorting.js +6 -9
- package/optimize/es/components/datagrid/controls/display_selector.js +21 -16
- package/optimize/es/components/datagrid/data_grid.js +3 -3
- package/optimize/es/components/date_picker/super_date_picker/date_popover/absolute_tab.js +87 -26
- package/optimize/es/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.js +1 -2
- package/optimize/es/components/filter_group/filter_group.styles.js +1 -1
- package/optimize/es/components/i18n/i18n.js +1 -0
- package/optimize/es/components/popover/input_popover.js +1 -1
- package/optimize/es/components/popover/popover.js +10 -22
- package/optimize/es/components/popover/popover_arrow/_popover_arrow.styles.js +2 -4
- package/optimize/es/components/popover/popover_panel/_popover_panel.js +2 -1
- package/optimize/es/components/popover/popover_panel/_popover_panel.styles.js +6 -1
- package/optimize/es/components/selectable/selectable_templates/selectable_template_sitewide.js +13 -11
- package/optimize/es/components/toast/global_toast_list.js +1 -1
- package/optimize/es/global_styling/mixins/_states.js +4 -1
- package/optimize/es/services/color/eui_palettes.js +0 -6
- package/optimize/es/services/color/index.js +1 -1
- package/optimize/es/services/hooks/useCombinedRefs.js +16 -9
- package/optimize/es/services/index.js +1 -2
- package/optimize/es/test/rtl/component_helpers.d.ts +2 -0
- package/optimize/es/test/rtl/component_helpers.js +40 -1
- package/optimize/lib/components/accordion/accordion.js +5 -2
- package/optimize/lib/components/accordion/accordion_children/accordion_children.js +4 -3
- package/optimize/lib/components/button/button_group/button_group.js +6 -7
- package/optimize/lib/components/button/button_group/button_group_button.js +6 -38
- package/optimize/lib/components/button/button_group/button_group_button.styles.js +2 -12
- package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_group/collapsible_nav_group.js +7 -2
- package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_group.js +6 -2
- package/optimize/lib/components/combo_box/combo_box.js +7 -5
- package/optimize/lib/components/combo_box/combo_box_input/combo_box_input.js +107 -65
- package/optimize/lib/components/combo_box/combo_box_input/combo_box_pill.js +8 -17
- package/optimize/lib/components/combo_box/combo_box_options_list/combo_box_options_list.js +6 -6
- package/optimize/lib/components/combo_box/utils.js +31 -0
- package/optimize/lib/components/datagrid/body/header/data_grid_header_cell.js +1 -1
- package/optimize/lib/components/datagrid/controls/column_selector.js +5 -6
- package/optimize/lib/components/datagrid/controls/column_sorting.js +5 -8
- package/optimize/lib/components/datagrid/controls/display_selector.js +21 -16
- package/optimize/lib/components/datagrid/data_grid.js +2 -2
- package/optimize/lib/components/date_picker/super_date_picker/date_popover/absolute_tab.js +86 -26
- package/optimize/lib/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.js +1 -2
- package/optimize/lib/components/filter_group/filter_group.styles.js +1 -1
- package/optimize/lib/components/i18n/i18n.js +1 -0
- package/optimize/lib/components/popover/input_popover.js +1 -1
- package/optimize/lib/components/popover/popover.js +24 -35
- package/optimize/lib/components/popover/popover_arrow/_popover_arrow.styles.js +1 -3
- package/optimize/lib/components/popover/popover_panel/_popover_panel.js +2 -1
- package/optimize/lib/components/popover/popover_panel/_popover_panel.styles.js +6 -1
- package/optimize/lib/components/selectable/selectable_templates/selectable_template_sitewide.js +12 -10
- package/optimize/lib/components/toast/global_toast_list.js +1 -1
- package/optimize/lib/global_styling/mixins/_states.js +4 -1
- package/optimize/lib/services/color/eui_palettes.js +1 -8
- package/optimize/lib/services/color/index.js +0 -7
- package/optimize/lib/services/hooks/useCombinedRefs.js +19 -10
- package/optimize/lib/services/index.js +0 -15
- package/optimize/lib/test/rtl/component_helpers.d.ts +2 -0
- package/optimize/lib/test/rtl/component_helpers.js +41 -3
- package/package.json +10 -10
- package/src/components/combo_box/_combo_box.scss +46 -14
- package/src/components/combo_box/combo_box_input/_combo_box_pill.scss +0 -17
- package/src/components/combo_box/combo_box_input/_index.scss +0 -2
- package/src/components/datagrid/_data_grid_data_row.scss +1 -2
- package/src/components/date_picker/super_date_picker/date_popover/_absolute_tab.scss +21 -0
- package/src/components/date_picker/super_date_picker/quick_select_popover/_quick_select_popover.scss +0 -4
- package/src/components/form/form_control_layout/_form_control_layout.scss +0 -1
- package/src/global_styling/variables/_typography.scss +2 -2
- package/test-env/components/accordion/accordion.js +13 -2
- package/test-env/components/accordion/accordion_children/accordion_children.js +4 -3
- package/test-env/components/breadcrumbs/breadcrumb.js +5 -5
- package/test-env/components/button/button_display/_button_display.js +1 -1
- package/test-env/components/button/button_group/button_group.js +7 -9
- package/test-env/components/button/button_group/button_group_button.js +8 -51
- package/test-env/components/button/button_group/button_group_button.styles.js +2 -12
- package/test-env/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +8 -0
- package/test-env/components/collapsible_nav_beta/collapsible_nav_group/collapsible_nav_group.js +7 -2
- package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_group.js +6 -2
- package/test-env/components/combo_box/combo_box.js +7 -5
- package/test-env/components/combo_box/combo_box_input/combo_box_input.js +107 -65
- package/test-env/components/combo_box/combo_box_input/combo_box_pill.js +8 -18
- package/test-env/components/combo_box/combo_box_options_list/combo_box_options_list.js +6 -6
- package/test-env/components/combo_box/utils.js +31 -0
- package/test-env/components/datagrid/body/header/data_grid_header_cell.js +1 -1
- package/test-env/components/datagrid/controls/column_selector.js +5 -6
- package/test-env/components/datagrid/controls/column_sorting.js +5 -8
- package/test-env/components/datagrid/controls/display_selector.js +21 -16
- package/test-env/components/datagrid/data_grid.js +2 -863
- package/test-env/components/date_picker/super_date_picker/date_popover/absolute_tab.js +86 -26
- package/test-env/components/date_picker/super_date_picker/date_popover/date_popover_button.js +1 -1
- package/test-env/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.js +1 -2
- package/test-env/components/date_picker/super_date_picker/super_date_picker.js +19 -0
- package/test-env/components/facet/facet_button.js +1 -1
- package/test-env/components/filter_group/filter_group.styles.js +1 -1
- package/test-env/components/i18n/i18n.js +1 -0
- package/test-env/components/popover/input_popover.js +1 -1
- package/test-env/components/popover/popover.js +29 -35
- package/test-env/components/popover/popover_arrow/_popover_arrow.styles.js +1 -3
- package/test-env/components/popover/popover_panel/_popover_panel.js +2 -1
- package/test-env/components/popover/popover_panel/_popover_panel.styles.js +6 -1
- package/test-env/components/selectable/selectable_templates/selectable_template_sitewide.js +12 -10
- package/test-env/components/toast/global_toast_list.js +11 -1
- package/test-env/global_styling/mixins/_states.js +4 -1
- package/test-env/services/color/eui_palettes.js +1 -8
- package/test-env/services/color/index.js +0 -7
- package/test-env/services/hooks/useCombinedRefs.js +19 -10
- package/test-env/services/index.js +0 -15
- package/test-env/test/rtl/component_helpers.js +41 -3
- package/es/services/random.js +0 -94
- package/es/services/utils.js +0 -25
- package/es/test/patch_random.js +0 -18
- package/lib/services/random.js +0 -100
- package/lib/services/utils.js +0 -35
- package/lib/test/patch_random.js +0 -25
- package/optimize/es/services/random.js +0 -85
- package/optimize/es/services/utils.js +0 -25
- package/optimize/es/test/patch_random.js +0 -18
- package/optimize/lib/services/random.js +0 -91
- package/optimize/lib/services/utils.js +0 -35
- package/optimize/lib/test/patch_random.js +0 -25
- package/src/components/combo_box/combo_box_input/_combo_box_input.scss +0 -12
- package/src/components/combo_box/combo_box_input/_combo_box_placeholder.scss +0 -11
- package/test-env/services/random.js +0 -91
- package/test-env/services/utils.js +0 -35
- package/test-env/test/patch_random.js +0 -25
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var _excluded = ["key", "label", "color", "onClick", "append", "prepend", "truncationProps"];
|
|
2
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
3
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
4
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
4
5
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
5
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
6
6
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
7
7
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
8
8
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
@@ -31,6 +31,7 @@ import { keys, CanvasTextUtils } from '../../../services';
|
|
|
31
31
|
import { EuiScreenReaderOnly } from '../../accessibility';
|
|
32
32
|
import { EuiFormControlLayout } from '../../form/form_control_layout';
|
|
33
33
|
import { getFormControlClassNameForIconCount } from '../../form/form_control_layout/_num_icons';
|
|
34
|
+
import { EuiComboBoxOptionAppendPrepend } from '../utils';
|
|
34
35
|
import { EuiComboBoxPill } from './combo_box_pill';
|
|
35
36
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
36
37
|
export var EuiComboBoxInput = /*#__PURE__*/function (_Component) {
|
|
@@ -57,6 +58,7 @@ export var EuiComboBoxInput = /*#__PURE__*/function (_Component) {
|
|
|
57
58
|
});
|
|
58
59
|
_defineProperty(_assertThisInitialized(_this), "updateInputSize", function (inputValue) {
|
|
59
60
|
if (!_this.widthUtils) return;
|
|
61
|
+
if (_this.asPlainText) return;
|
|
60
62
|
_this.widthUtils.setTextToCheck(inputValue);
|
|
61
63
|
// Canvas has minute subpixel differences in rendering compared to DOM
|
|
62
64
|
// We'll buffer the input by ~2px just to ensure sufficient width
|
|
@@ -82,65 +84,42 @@ export var EuiComboBoxInput = /*#__PURE__*/function (_Component) {
|
|
|
82
84
|
_defineProperty(_assertThisInitialized(_this), "onKeyDown", function (event) {
|
|
83
85
|
var _this$props2 = _this.props,
|
|
84
86
|
searchValue = _this$props2.searchValue,
|
|
87
|
+
hasSelectedOptions = _this$props2.hasSelectedOptions,
|
|
85
88
|
selectedOptions = _this$props2.selectedOptions,
|
|
86
89
|
onRemoveOption = _this$props2.onRemoveOption,
|
|
87
90
|
singleSelection = _this$props2.singleSelection,
|
|
88
91
|
isListOpen = _this$props2.isListOpen,
|
|
89
|
-
onOpenListClick = _this$props2.onOpenListClick
|
|
90
|
-
|
|
91
|
-
// When backspacing from an empty input, delete the last pill option in the list
|
|
92
|
+
onOpenListClick = _this$props2.onOpenListClick,
|
|
93
|
+
onChange = _this$props2.onChange;
|
|
92
94
|
var searchIsEmpty = !searchValue.length;
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
if (event.key === keys.BACKSPACE) {
|
|
96
|
+
// When backspacing in a plain text combobox, change normally and remove the selection
|
|
97
|
+
if (_this.asPlainText) {
|
|
98
|
+
onChange(event.currentTarget.value);
|
|
99
|
+
if (hasSelectedOptions) {
|
|
100
|
+
onRemoveOption(selectedOptions[selectedOptions.length - 1]);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
// When backspacing from an empty input, delete the last pill option in the list
|
|
104
|
+
else if (searchIsEmpty && hasSelectedOptions) {
|
|
105
|
+
onRemoveOption(selectedOptions[selectedOptions.length - 1]);
|
|
106
|
+
if (!!singleSelection && !isListOpen) {
|
|
107
|
+
onOpenListClick();
|
|
108
|
+
}
|
|
98
109
|
}
|
|
99
110
|
}
|
|
100
111
|
});
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
this.updateInputSize(this.props.searchValue);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}, {
|
|
111
|
-
key: "render",
|
|
112
|
-
value: function render() {
|
|
113
|
-
var _this$props3 = this.props,
|
|
114
|
-
compressed = _this$props3.compressed,
|
|
115
|
-
focusedOptionId = _this$props3.focusedOptionId,
|
|
116
|
-
fullWidth = _this$props3.fullWidth,
|
|
117
|
-
hasSelectedOptions = _this$props3.hasSelectedOptions,
|
|
118
|
-
id = _this$props3.id,
|
|
119
|
-
isDisabled = _this$props3.isDisabled,
|
|
120
|
-
isListOpen = _this$props3.isListOpen,
|
|
121
|
-
noIcon = _this$props3.noIcon,
|
|
122
|
-
_onChange = _this$props3.onChange,
|
|
123
|
-
onClear = _this$props3.onClear,
|
|
124
|
-
onClick = _this$props3.onClick,
|
|
125
|
-
onCloseListClick = _this$props3.onCloseListClick,
|
|
126
|
-
onOpenListClick = _this$props3.onOpenListClick,
|
|
127
|
-
onRemoveOption = _this$props3.onRemoveOption,
|
|
128
|
-
placeholder = _this$props3.placeholder,
|
|
129
|
-
rootId = _this$props3.rootId,
|
|
130
|
-
searchValue = _this$props3.searchValue,
|
|
112
|
+
_defineProperty(_assertThisInitialized(_this), "renderPills", function () {
|
|
113
|
+
// Don't render a pill for plain text comboboxes - use the input instead
|
|
114
|
+
if (_this.asPlainText) return null;
|
|
115
|
+
// Don't render the single pill selection while searching
|
|
116
|
+
if (_this.props.singleSelection && _this.props.searchValue) return null;
|
|
117
|
+
var _this$props3 = _this.props,
|
|
131
118
|
selectedOptions = _this$props3.selectedOptions,
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
isLoading = _this$props3.isLoading,
|
|
137
|
-
isInvalid = _this$props3.isInvalid,
|
|
138
|
-
autoFocus = _this$props3.autoFocus,
|
|
139
|
-
ariaLabel = _this$props3['aria-label'],
|
|
140
|
-
ariaLabelledby = _this$props3['aria-labelledby'];
|
|
141
|
-
var singleSelection = Boolean(singleSelectionProp);
|
|
142
|
-
var asPlainText = singleSelectionProp && _typeof(singleSelectionProp) === 'object' && singleSelectionProp.asPlainText || false;
|
|
143
|
-
var pills = selectedOptions ? selectedOptions.map(function (option) {
|
|
119
|
+
isDisabled = _this$props3.isDisabled,
|
|
120
|
+
onRemoveOption = _this$props3.onRemoveOption;
|
|
121
|
+
if (!selectedOptions || !selectedOptions.length) return null;
|
|
122
|
+
return selectedOptions.map(function (option) {
|
|
144
123
|
var key = option.key,
|
|
145
124
|
label = option.label,
|
|
146
125
|
color = option.color,
|
|
@@ -149,17 +128,77 @@ export var EuiComboBoxInput = /*#__PURE__*/function (_Component) {
|
|
|
149
128
|
prepend = option.prepend,
|
|
150
129
|
truncationProps = option.truncationProps,
|
|
151
130
|
rest = _objectWithoutProperties(option, _excluded);
|
|
152
|
-
var pillOnClose = isDisabled || singleSelection || onClick ? undefined : onRemoveOption;
|
|
131
|
+
var pillOnClose = isDisabled || _this.props.singleSelection || onClick ? undefined : onRemoveOption;
|
|
153
132
|
return ___EmotionJSX(EuiComboBoxPill, _extends({
|
|
154
133
|
option: option,
|
|
155
134
|
onClose: pillOnClose,
|
|
156
135
|
key: key !== null && key !== void 0 ? key : label.toLowerCase(),
|
|
157
136
|
color: color,
|
|
158
137
|
onClick: onClick,
|
|
159
|
-
onClickAriaLabel: onClick ? 'Change' : undefined
|
|
160
|
-
asPlainText: asPlainText
|
|
138
|
+
onClickAriaLabel: onClick ? 'Change' : undefined
|
|
161
139
|
}, rest), label);
|
|
162
|
-
})
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
return _this;
|
|
143
|
+
}
|
|
144
|
+
_createClass(EuiComboBoxInput, [{
|
|
145
|
+
key: "componentDidUpdate",
|
|
146
|
+
value: function componentDidUpdate(prevProps) {
|
|
147
|
+
if (prevProps.searchValue !== this.props.searchValue) {
|
|
148
|
+
this.updateInputSize(this.props.searchValue);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}, {
|
|
152
|
+
key: "asPlainText",
|
|
153
|
+
get: function get() {
|
|
154
|
+
var singleSelection = this.props.singleSelection;
|
|
155
|
+
var isSingleSelectionConfig = singleSelection && _typeof(singleSelection) === 'object';
|
|
156
|
+
return !!(isSingleSelectionConfig && singleSelection.asPlainText);
|
|
157
|
+
}
|
|
158
|
+
}, {
|
|
159
|
+
key: "searchValue",
|
|
160
|
+
get: function get() {
|
|
161
|
+
var _this$props4 = this.props,
|
|
162
|
+
searchValue = _this$props4.searchValue,
|
|
163
|
+
selectedOptions = _this$props4.selectedOptions;
|
|
164
|
+
if (this.asPlainText) {
|
|
165
|
+
var _selectedOptions$;
|
|
166
|
+
return searchValue || (selectedOptions === null || selectedOptions === void 0 ? void 0 : (_selectedOptions$ = selectedOptions[0]) === null || _selectedOptions$ === void 0 ? void 0 : _selectedOptions$.label) || '';
|
|
167
|
+
} else {
|
|
168
|
+
return searchValue;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}, {
|
|
172
|
+
key: "render",
|
|
173
|
+
value: function render() {
|
|
174
|
+
var _this$props5 = this.props,
|
|
175
|
+
compressed = _this$props5.compressed,
|
|
176
|
+
focusedOptionId = _this$props5.focusedOptionId,
|
|
177
|
+
fullWidth = _this$props5.fullWidth,
|
|
178
|
+
hasSelectedOptions = _this$props5.hasSelectedOptions,
|
|
179
|
+
id = _this$props5.id,
|
|
180
|
+
isDisabled = _this$props5.isDisabled,
|
|
181
|
+
isListOpen = _this$props5.isListOpen,
|
|
182
|
+
noIcon = _this$props5.noIcon,
|
|
183
|
+
_onChange = _this$props5.onChange,
|
|
184
|
+
onClear = _this$props5.onClear,
|
|
185
|
+
onClick = _this$props5.onClick,
|
|
186
|
+
onFocus = _this$props5.onFocus,
|
|
187
|
+
onCloseListClick = _this$props5.onCloseListClick,
|
|
188
|
+
onOpenListClick = _this$props5.onOpenListClick,
|
|
189
|
+
placeholder = _this$props5.placeholder,
|
|
190
|
+
rootId = _this$props5.rootId,
|
|
191
|
+
searchValue = _this$props5.searchValue,
|
|
192
|
+
selectedOptions = _this$props5.selectedOptions,
|
|
193
|
+
singleSelection = _this$props5.singleSelection,
|
|
194
|
+
value = _this$props5.value,
|
|
195
|
+
prepend = _this$props5.prepend,
|
|
196
|
+
append = _this$props5.append,
|
|
197
|
+
isLoading = _this$props5.isLoading,
|
|
198
|
+
isInvalid = _this$props5.isInvalid,
|
|
199
|
+
autoFocus = _this$props5.autoFocus,
|
|
200
|
+
ariaLabel = _this$props5['aria-label'],
|
|
201
|
+
ariaLabelledby = _this$props5['aria-labelledby'];
|
|
163
202
|
var removeOptionMessage;
|
|
164
203
|
var removeOptionMessageId;
|
|
165
204
|
if (this.state.hasFocus) {
|
|
@@ -176,12 +215,7 @@ export var EuiComboBoxInput = /*#__PURE__*/function (_Component) {
|
|
|
176
215
|
id: removeOptionMessageId
|
|
177
216
|
}, removeOptionMessageContent));
|
|
178
217
|
}
|
|
179
|
-
var
|
|
180
|
-
if (placeholder && selectedOptions && !selectedOptions.length && !searchValue) {
|
|
181
|
-
placeholderMessage = ___EmotionJSX("p", {
|
|
182
|
-
className: "euiComboBoxPlaceholder"
|
|
183
|
-
}, placeholder);
|
|
184
|
-
}
|
|
218
|
+
var showPlaceholder = placeholder && !(selectedOptions !== null && selectedOptions !== void 0 && selectedOptions.length) && !searchValue;
|
|
185
219
|
var clickProps = {};
|
|
186
220
|
if (!isDisabled && onClear && hasSelectedOptions) {
|
|
187
221
|
clickProps.clear = {
|
|
@@ -211,6 +245,7 @@ export var EuiComboBoxInput = /*#__PURE__*/function (_Component) {
|
|
|
211
245
|
'euiComboBox__inputWrap--compressed': compressed,
|
|
212
246
|
'euiComboBox__inputWrap--fullWidth': fullWidth,
|
|
213
247
|
'euiComboBox__inputWrap--noWrap': singleSelection,
|
|
248
|
+
'euiComboBox__inputWrap--plainText': this.asPlainText || showPlaceholder,
|
|
214
249
|
'euiComboBox__inputWrap--inGroup': prepend || append
|
|
215
250
|
});
|
|
216
251
|
return ___EmotionJSX(EuiFormControlLayout, _extends({
|
|
@@ -228,7 +263,10 @@ export var EuiComboBoxInput = /*#__PURE__*/function (_Component) {
|
|
|
228
263
|
"data-test-subj": "comboBoxInput",
|
|
229
264
|
onClick: onClick,
|
|
230
265
|
tabIndex: -1 // becomes onBlur event's relatedTarget, otherwise relatedTarget is null when clicking on this div
|
|
231
|
-
},
|
|
266
|
+
}, this.renderPills(), ___EmotionJSX(EuiComboBoxOptionAppendPrepend, {
|
|
267
|
+
option: this.asPlainText ? selectedOptions === null || selectedOptions === void 0 ? void 0 : selectedOptions[0] : undefined,
|
|
268
|
+
classNamePrefix: "euiComboBoxPlainTextSelection"
|
|
269
|
+
}, ___EmotionJSX("input", {
|
|
232
270
|
"aria-activedescendant": focusedOptionId,
|
|
233
271
|
"aria-autocomplete": "list",
|
|
234
272
|
"aria-controls": isListOpen ? rootId('listbox') : '',
|
|
@@ -249,11 +287,15 @@ export var EuiComboBoxInput = /*#__PURE__*/function (_Component) {
|
|
|
249
287
|
ref: this.inputRefCallback,
|
|
250
288
|
role: "combobox",
|
|
251
289
|
style: {
|
|
252
|
-
inlineSize: this.state.inputWidth
|
|
290
|
+
inlineSize: this.asPlainText || showPlaceholder ? '100%' : this.state.inputWidth
|
|
253
291
|
},
|
|
254
|
-
|
|
292
|
+
placeholder: showPlaceholder ? placeholder : undefined,
|
|
293
|
+
value: this.searchValue,
|
|
255
294
|
autoFocus: autoFocus
|
|
256
|
-
|
|
295
|
+
// Force the menu to re-open on every input click - only necessary when plain text
|
|
296
|
+
,
|
|
297
|
+
onClick: this.asPlainText ? onFocus : undefined // Type shenanigans - event should be mostly the same
|
|
298
|
+
})), removeOptionMessage));
|
|
257
299
|
}
|
|
258
300
|
}]);
|
|
259
301
|
return EuiComboBoxInput;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["
|
|
1
|
+
var _excluded = ["children", "className", "color", "onClick", "onClickAriaLabel", "onClose", "option"];
|
|
2
2
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
3
3
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
4
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
@@ -29,6 +29,7 @@ import PropTypes from "prop-types";
|
|
|
29
29
|
import classNames from 'classnames';
|
|
30
30
|
import { EuiBadge } from '../../badge';
|
|
31
31
|
import { EuiI18n } from '../../i18n';
|
|
32
|
+
import { EuiComboBoxOptionAppendPrepend } from '../utils';
|
|
32
33
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
33
34
|
export var EuiComboBoxPill = /*#__PURE__*/function (_Component) {
|
|
34
35
|
_inherits(EuiComboBoxPill, _Component);
|
|
@@ -55,7 +56,6 @@ export var EuiComboBoxPill = /*#__PURE__*/function (_Component) {
|
|
|
55
56
|
value: function render() {
|
|
56
57
|
var _this2 = this;
|
|
57
58
|
var _this$props2 = this.props,
|
|
58
|
-
asPlainText = _this$props2.asPlainText,
|
|
59
59
|
children = _this$props2.children,
|
|
60
60
|
className = _this$props2.className,
|
|
61
61
|
color = _this$props2.color,
|
|
@@ -64,20 +64,17 @@ export var EuiComboBoxPill = /*#__PURE__*/function (_Component) {
|
|
|
64
64
|
onClose = _this$props2.onClose,
|
|
65
65
|
option = _this$props2.option,
|
|
66
66
|
rest = _objectWithoutProperties(_this$props2, _excluded);
|
|
67
|
-
var classes = classNames('euiComboBoxPill',
|
|
68
|
-
'euiComboBoxPill--plainText': asPlainText
|
|
69
|
-
}, className);
|
|
67
|
+
var classes = classNames('euiComboBoxPill', className);
|
|
70
68
|
var onClickProps = onClick && onClickAriaLabel ? {
|
|
71
69
|
onClick: onClick,
|
|
72
70
|
onClickAriaLabel: onClickAriaLabel
|
|
73
71
|
} : {};
|
|
74
|
-
var content = ___EmotionJSX(
|
|
75
|
-
|
|
76
|
-
|
|
72
|
+
var content = ___EmotionJSX(EuiComboBoxOptionAppendPrepend, {
|
|
73
|
+
option: option,
|
|
74
|
+
classNamePrefix: "euiComboBoxPill"
|
|
75
|
+
}, ___EmotionJSX("span", {
|
|
77
76
|
className: "eui-textTruncate"
|
|
78
|
-
}, children)
|
|
79
|
-
className: "euiComboBoxPill__append"
|
|
80
|
-
}, option.append));
|
|
77
|
+
}, children));
|
|
81
78
|
if (onClose) {
|
|
82
79
|
return ___EmotionJSX(EuiI18n, {
|
|
83
80
|
token: "euiComboBoxPill.removeSelection",
|
|
@@ -98,12 +95,6 @@ export var EuiComboBoxPill = /*#__PURE__*/function (_Component) {
|
|
|
98
95
|
}, onClickProps, rest), content);
|
|
99
96
|
});
|
|
100
97
|
}
|
|
101
|
-
if (asPlainText) {
|
|
102
|
-
return ___EmotionJSX("span", _extends({
|
|
103
|
-
className: classes,
|
|
104
|
-
"data-test-subj": "euiComboBoxPill"
|
|
105
|
-
}, rest), content);
|
|
106
|
-
}
|
|
107
98
|
return ___EmotionJSX(EuiBadge, _extends({
|
|
108
99
|
className: classes,
|
|
109
100
|
color: color,
|
|
@@ -118,7 +109,6 @@ _defineProperty(EuiComboBoxPill, "defaultProps", {
|
|
|
118
109
|
color: 'hollow'
|
|
119
110
|
});
|
|
120
111
|
EuiComboBoxPill.propTypes = {
|
|
121
|
-
asPlainText: PropTypes.bool,
|
|
122
112
|
children: PropTypes.string,
|
|
123
113
|
className: PropTypes.string,
|
|
124
114
|
color: PropTypes.string,
|
|
@@ -43,6 +43,7 @@ import { EuiFilterSelectItem } from '../../filter_group/filter_select_item';
|
|
|
43
43
|
import { EuiBadge } from '../../badge';
|
|
44
44
|
import { EuiTextTruncate } from '../../text_truncate';
|
|
45
45
|
import { EuiInputPopoverWidthContext } from '../../popover/input_popover';
|
|
46
|
+
import { EuiComboBoxOptionAppendPrepend } from '../utils';
|
|
46
47
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
47
48
|
var hitEnterBadge = ___EmotionJSX(EuiBadge, {
|
|
48
49
|
className: "euiComboBoxOption__enterBadge",
|
|
@@ -126,13 +127,12 @@ export var EuiComboBoxOptionsList = /*#__PURE__*/function (_Component) {
|
|
|
126
127
|
title: label
|
|
127
128
|
}, rest), ___EmotionJSX("span", {
|
|
128
129
|
className: "euiComboBoxOption__contentWrapper"
|
|
129
|
-
},
|
|
130
|
-
|
|
131
|
-
|
|
130
|
+
}, ___EmotionJSX(EuiComboBoxOptionAppendPrepend, {
|
|
131
|
+
option: option,
|
|
132
|
+
classNamePrefix: "euiComboBoxOption"
|
|
133
|
+
}, ___EmotionJSX("span", {
|
|
132
134
|
className: "euiComboBoxOption__content"
|
|
133
|
-
}, renderOption ? renderOption(option, searchValue, 'euiComboBoxOption__renderOption') : _this.renderTruncatedOption(label, truncationProps)),
|
|
134
|
-
className: "euiComboBoxOption__append"
|
|
135
|
-
}, append), optionIsFocused && !optionIsDisabled ? hitEnterBadge : null));
|
|
135
|
+
}, renderOption ? renderOption(option, searchValue, 'euiComboBoxOption__renderOption') : _this.renderTruncatedOption(label, truncationProps))), optionIsFocused && !optionIsDisabled ? hitEnterBadge : null));
|
|
136
136
|
});
|
|
137
137
|
_defineProperty(_assertThisInitialized(_this), "optionWidth", void 0);
|
|
138
138
|
_defineProperty(_assertThisInitialized(_this), "setOptionWidth", function (width) {
|
|
@@ -0,0 +1,23 @@
|
|
|
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 from 'react';
|
|
10
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
11
|
+
/**
|
|
12
|
+
* DRY util for rendering an option with its prepend and append properties
|
|
13
|
+
*/
|
|
14
|
+
export var EuiComboBoxOptionAppendPrepend = function EuiComboBoxOptionAppendPrepend(_ref) {
|
|
15
|
+
var children = _ref.children,
|
|
16
|
+
option = _ref.option,
|
|
17
|
+
classNamePrefix = _ref.classNamePrefix;
|
|
18
|
+
return ___EmotionJSX(React.Fragment, null, (option === null || option === void 0 ? void 0 : option.prepend) && ___EmotionJSX("span", {
|
|
19
|
+
className: "".concat(classNamePrefix, "__prepend")
|
|
20
|
+
}, option.prepend), children, (option === null || option === void 0 ? void 0 : option.append) && ___EmotionJSX("span", {
|
|
21
|
+
className: "".concat(classNamePrefix, "__append")
|
|
22
|
+
}, option.append));
|
|
23
|
+
};
|
|
@@ -399,6 +399,8 @@ EuiControlBar.propTypes = {
|
|
|
399
399
|
popoverProps: PropTypes.shape({
|
|
400
400
|
/**
|
|
401
401
|
* Class name passed to the direct parent of the button
|
|
402
|
+
*
|
|
403
|
+
* @deprecated Use `className` instead
|
|
402
404
|
*/
|
|
403
405
|
anchorClassName: PropTypes.string,
|
|
404
406
|
/**
|
|
@@ -410,6 +412,9 @@ EuiControlBar.propTypes = {
|
|
|
410
412
|
* Intended for use with inputs as anchors, e.g. EuiInputPopover
|
|
411
413
|
*/
|
|
412
414
|
attachToAnchor: PropTypes.bool,
|
|
415
|
+
/**
|
|
416
|
+
* @deprecated Use `popoverRef` instead
|
|
417
|
+
*/
|
|
413
418
|
buttonRef: PropTypes.any,
|
|
414
419
|
/**
|
|
415
420
|
* Restrict the popover's position within this element
|
|
@@ -478,11 +483,6 @@ EuiControlBar.propTypes = {
|
|
|
478
483
|
*/
|
|
479
484
|
grow: PropTypes.bool,
|
|
480
485
|
panelRef: PropTypes.any,
|
|
481
|
-
/**
|
|
482
|
-
* Background color of the panel;
|
|
483
|
-
* Usually a lightened form of the brand colors
|
|
484
|
-
*/
|
|
485
|
-
color: PropTypes.any,
|
|
486
486
|
className: PropTypes.string,
|
|
487
487
|
"aria-label": PropTypes.string,
|
|
488
488
|
"data-test-subj": PropTypes.string,
|
|
@@ -108,7 +108,7 @@ export var EuiDataGridHeaderCell = function EuiDataGridHeaderCell(_ref) {
|
|
|
108
108
|
title: displayAsText || id
|
|
109
109
|
}, display || displayAsText || id), sortingScreenReaderText && ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("p", null, sortingScreenReaderText))) : ___EmotionJSX(React.Fragment, null, ___EmotionJSX(EuiPopover, _extends({
|
|
110
110
|
className: "eui-fullWidth",
|
|
111
|
-
|
|
111
|
+
display: "block",
|
|
112
112
|
panelPaddingSize: "none",
|
|
113
113
|
offset: 7,
|
|
114
114
|
button: ___EmotionJSX("button", {
|
|
@@ -121,7 +121,7 @@ export var useDataGridColumnSelector = function useDataGridColumnSelector(availa
|
|
|
121
121
|
return setIsOpen(!isOpen);
|
|
122
122
|
}
|
|
123
123
|
}, buttonText)
|
|
124
|
-
},
|
|
124
|
+
}, allowColumnHiding && ___EmotionJSX(EuiPopoverTitle, null, ___EmotionJSX(EuiI18n, {
|
|
125
125
|
tokens: ['euiColumnSelector.search', 'euiColumnSelector.searchcolumns'],
|
|
126
126
|
defaults: ['Search', 'Search columns']
|
|
127
127
|
}, function (_ref3) {
|
|
@@ -138,13 +138,12 @@ export var useDataGridColumnSelector = function useDataGridColumnSelector(availa
|
|
|
138
138
|
},
|
|
139
139
|
"data-test-subj": "dataGridColumnSelectorSearch"
|
|
140
140
|
});
|
|
141
|
-
})), ___EmotionJSX(
|
|
142
|
-
className: "euiDataGrid__controlScroll"
|
|
143
|
-
}, ___EmotionJSX(EuiDragDropContext, {
|
|
141
|
+
})), ___EmotionJSX(EuiDragDropContext, {
|
|
144
142
|
onDragEnd: onDragEnd
|
|
145
143
|
}, ___EmotionJSX(EuiDroppable, {
|
|
146
144
|
droppableId: "columnOrder",
|
|
147
|
-
isDropDisabled: !isDragEnabled
|
|
145
|
+
isDropDisabled: !isDragEnabled,
|
|
146
|
+
className: "euiDataGrid__controlScroll"
|
|
148
147
|
}, ___EmotionJSX(React.Fragment, null, filteredColumns.map(function (id, index) {
|
|
149
148
|
return ___EmotionJSX(EuiDraggable, {
|
|
150
149
|
key: id,
|
|
@@ -197,7 +196,7 @@ export var useDataGridColumnSelector = function useDataGridColumnSelector(availa
|
|
|
197
196
|
color: "subdued"
|
|
198
197
|
}))));
|
|
199
198
|
});
|
|
200
|
-
}))))
|
|
199
|
+
})))), allowColumnHiding && ___EmotionJSX(EuiPopoverFooter, null, ___EmotionJSX(EuiFlexGroup, {
|
|
201
200
|
gutterSize: "s",
|
|
202
201
|
responsive: false,
|
|
203
202
|
justifyContent: "spaceBetween"
|
|
@@ -17,7 +17,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import classNames from 'classnames';
|
|
20
|
-
import React, {
|
|
20
|
+
import React, { useEffect, useState } from 'react';
|
|
21
21
|
import { EuiButtonEmpty } from '../../button';
|
|
22
22
|
import { EuiDragDropContext, euiDragDropReorder, EuiDroppable } from '../../drag_and_drop';
|
|
23
23
|
import { EuiFlexGroup, EuiFlexItem } from '../../flex';
|
|
@@ -128,15 +128,12 @@ export var useDataGridColumnSorting = function useDataGridColumnSorting(columns,
|
|
|
128
128
|
return setIsOpen(!isOpen);
|
|
129
129
|
}
|
|
130
130
|
}, sorting.columns.length > 0 ? sortingButtonTextActive : sortingButtonText)
|
|
131
|
-
}, sorting.columns.length > 0 ? ___EmotionJSX(
|
|
132
|
-
role: "region",
|
|
133
|
-
"aria-live": "assertive",
|
|
134
|
-
className: "euiDataGrid__controlScroll"
|
|
135
|
-
}, ___EmotionJSX(EuiDragDropContext, {
|
|
131
|
+
}, sorting.columns.length > 0 ? ___EmotionJSX(EuiDragDropContext, {
|
|
136
132
|
onDragEnd: onDragEnd
|
|
137
133
|
}, ___EmotionJSX(EuiDroppable, {
|
|
138
|
-
droppableId: "columnSorting"
|
|
139
|
-
|
|
134
|
+
droppableId: "columnSorting",
|
|
135
|
+
className: "euiDataGrid__controlScroll"
|
|
136
|
+
}, ___EmotionJSX(React.Fragment, null, sorting.columns.map(function (_ref6, index) {
|
|
140
137
|
var id = _ref6.id,
|
|
141
138
|
direction = _ref6.direction;
|
|
142
139
|
return ___EmotionJSX(EuiDataGridColumnSortingDraggable, {
|
|
@@ -149,7 +146,7 @@ export var useDataGridColumnSorting = function useDataGridColumnSorting(columns,
|
|
|
149
146
|
schema: schema,
|
|
150
147
|
schemaDetectors: schemaDetectors
|
|
151
148
|
});
|
|
152
|
-
}))))
|
|
149
|
+
})))) : ___EmotionJSX(EuiText, {
|
|
153
150
|
size: "s",
|
|
154
151
|
color: "subdued"
|
|
155
152
|
}, ___EmotionJSX("p", {
|
|
@@ -81,6 +81,7 @@ var convertRowHeightsOptionsToSelection = function convertRowHeightsOptionsToSel
|
|
|
81
81
|
}
|
|
82
82
|
return rowHeightButtonOptions[0];
|
|
83
83
|
};
|
|
84
|
+
var defaultLineCountValue = String(2);
|
|
84
85
|
export var useDataGridDisplaySelector = function useDataGridDisplaySelector(showDisplaySelector, initialStyles, initialRowHeightsOptions) {
|
|
85
86
|
var _showDisplaySelector$, _rowHeightsOptions$de2;
|
|
86
87
|
var _useState = useState(false),
|
|
@@ -108,10 +109,10 @@ export var useDataGridDisplaySelector = function useDataGridDisplaySelector(show
|
|
|
108
109
|
}, []);
|
|
109
110
|
|
|
110
111
|
// Row height logic
|
|
111
|
-
var _useState7 = useState(
|
|
112
|
+
var _useState7 = useState(defaultLineCountValue),
|
|
112
113
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
113
|
-
|
|
114
|
-
|
|
114
|
+
lineCountInput = _useState8[0],
|
|
115
|
+
setLineCountInput = _useState8[1];
|
|
115
116
|
var setRowHeight = useCallback(function (option) {
|
|
116
117
|
var rowHeightsOptions = {
|
|
117
118
|
rowHeights: {} // Unset all row-specific heights
|
|
@@ -121,25 +122,27 @@ export var useDataGridDisplaySelector = function useDataGridDisplaySelector(show
|
|
|
121
122
|
rowHeightsOptions.defaultHeight = 'auto';
|
|
122
123
|
} else if (option === 'lineCount') {
|
|
123
124
|
rowHeightsOptions.defaultHeight = {
|
|
124
|
-
lineCount:
|
|
125
|
+
lineCount: Number(lineCountInput)
|
|
125
126
|
};
|
|
126
127
|
} else {
|
|
127
128
|
rowHeightsOptions.defaultHeight = undefined;
|
|
128
129
|
}
|
|
129
130
|
setUserRowHeightsOptions(rowHeightsOptions);
|
|
130
|
-
}, [
|
|
131
|
+
}, [lineCountInput]);
|
|
131
132
|
var setLineCountHeight = useCallback(function (event) {
|
|
133
|
+
setLineCountInput(event.currentTarget.value);
|
|
132
134
|
var newLineCount = Number(event.currentTarget.value);
|
|
133
|
-
if (newLineCount < 1) return; // Don't let users set a 0 or negative line count
|
|
134
135
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
136
|
+
// Don't let users set a 0 or negative line count
|
|
137
|
+
if (newLineCount > 0) {
|
|
138
|
+
setUserRowHeightsOptions({
|
|
139
|
+
rowHeights: {},
|
|
140
|
+
// Unset all row-specific line counts
|
|
141
|
+
defaultHeight: {
|
|
142
|
+
lineCount: newLineCount
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
}
|
|
143
146
|
}, []);
|
|
144
147
|
|
|
145
148
|
// Merge the developer-specified configurations with user overrides
|
|
@@ -159,8 +162,9 @@ export var useDataGridDisplaySelector = function useDataGridDisplaySelector(show
|
|
|
159
162
|
}, [rowHeightsOptions]);
|
|
160
163
|
useEffect(function () {
|
|
161
164
|
var _rowHeightsOptions$de;
|
|
165
|
+
setLineCountInput(
|
|
162
166
|
// @ts-ignore - optional chaining operator handles types & cases that aren't lineCount
|
|
163
|
-
|
|
167
|
+
(rowHeightsOptions === null || rowHeightsOptions === void 0 ? void 0 : (_rowHeightsOptions$de = rowHeightsOptions.defaultHeight) === null || _rowHeightsOptions$de === void 0 ? void 0 : _rowHeightsOptions$de.lineCount) || defaultLineCountValue);
|
|
164
168
|
// @ts-ignore - same as above
|
|
165
169
|
}, [rowHeightsOptions === null || rowHeightsOptions === void 0 ? void 0 : (_rowHeightsOptions$de2 = rowHeightsOptions.defaultHeight) === null || _rowHeightsOptions$de2 === void 0 ? void 0 : _rowHeightsOptions$de2.lineCount]);
|
|
166
170
|
|
|
@@ -292,7 +296,8 @@ export var useDataGridDisplaySelector = function useDataGridDisplaySelector(show
|
|
|
292
296
|
min: 1,
|
|
293
297
|
max: 20,
|
|
294
298
|
step: 1,
|
|
295
|
-
|
|
299
|
+
required: true,
|
|
300
|
+
value: lineCountInput,
|
|
296
301
|
onChange: setLineCountHeight,
|
|
297
302
|
"data-test-subj": "lineCountNumber"
|
|
298
303
|
})));
|