@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,6 +1,6 @@
|
|
|
1
|
+
import _typeof from "@babel/runtime/helpers/typeof";
|
|
1
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
import _typeof from "@babel/runtime/helpers/typeof";
|
|
4
4
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
5
5
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
6
6
|
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
@@ -25,6 +25,7 @@ import { keys, CanvasTextUtils } from '../../../services';
|
|
|
25
25
|
import { EuiScreenReaderOnly } from '../../accessibility';
|
|
26
26
|
import { EuiFormControlLayout } from '../../form/form_control_layout';
|
|
27
27
|
import { getFormControlClassNameForIconCount } from '../../form/form_control_layout/_num_icons';
|
|
28
|
+
import { EuiComboBoxOptionAppendPrepend } from '../utils';
|
|
28
29
|
import { EuiComboBoxPill } from './combo_box_pill';
|
|
29
30
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
30
31
|
export var EuiComboBoxInput = /*#__PURE__*/function (_Component) {
|
|
@@ -51,6 +52,7 @@ export var EuiComboBoxInput = /*#__PURE__*/function (_Component) {
|
|
|
51
52
|
});
|
|
52
53
|
_defineProperty(_assertThisInitialized(_this), "updateInputSize", function (inputValue) {
|
|
53
54
|
if (!_this.widthUtils) return;
|
|
55
|
+
if (_this.asPlainText) return;
|
|
54
56
|
_this.widthUtils.setTextToCheck(inputValue);
|
|
55
57
|
// Canvas has minute subpixel differences in rendering compared to DOM
|
|
56
58
|
// We'll buffer the input by ~2px just to ensure sufficient width
|
|
@@ -76,65 +78,42 @@ export var EuiComboBoxInput = /*#__PURE__*/function (_Component) {
|
|
|
76
78
|
_defineProperty(_assertThisInitialized(_this), "onKeyDown", function (event) {
|
|
77
79
|
var _this$props2 = _this.props,
|
|
78
80
|
searchValue = _this$props2.searchValue,
|
|
81
|
+
hasSelectedOptions = _this$props2.hasSelectedOptions,
|
|
79
82
|
selectedOptions = _this$props2.selectedOptions,
|
|
80
83
|
onRemoveOption = _this$props2.onRemoveOption,
|
|
81
84
|
singleSelection = _this$props2.singleSelection,
|
|
82
85
|
isListOpen = _this$props2.isListOpen,
|
|
83
|
-
onOpenListClick = _this$props2.onOpenListClick
|
|
84
|
-
|
|
85
|
-
// When backspacing from an empty input, delete the last pill option in the list
|
|
86
|
+
onOpenListClick = _this$props2.onOpenListClick,
|
|
87
|
+
onChange = _this$props2.onChange;
|
|
86
88
|
var searchIsEmpty = !searchValue.length;
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
if (event.key === keys.BACKSPACE) {
|
|
90
|
+
// When backspacing in a plain text combobox, change normally and remove the selection
|
|
91
|
+
if (_this.asPlainText) {
|
|
92
|
+
onChange(event.currentTarget.value);
|
|
93
|
+
if (hasSelectedOptions) {
|
|
94
|
+
onRemoveOption(selectedOptions[selectedOptions.length - 1]);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
// When backspacing from an empty input, delete the last pill option in the list
|
|
98
|
+
else if (searchIsEmpty && hasSelectedOptions) {
|
|
99
|
+
onRemoveOption(selectedOptions[selectedOptions.length - 1]);
|
|
100
|
+
if (!!singleSelection && !isListOpen) {
|
|
101
|
+
onOpenListClick();
|
|
102
|
+
}
|
|
92
103
|
}
|
|
93
104
|
}
|
|
94
105
|
});
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
this.updateInputSize(this.props.searchValue);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}, {
|
|
105
|
-
key: "render",
|
|
106
|
-
value: function render() {
|
|
107
|
-
var _this$props3 = this.props,
|
|
108
|
-
compressed = _this$props3.compressed,
|
|
109
|
-
focusedOptionId = _this$props3.focusedOptionId,
|
|
110
|
-
fullWidth = _this$props3.fullWidth,
|
|
111
|
-
hasSelectedOptions = _this$props3.hasSelectedOptions,
|
|
112
|
-
id = _this$props3.id,
|
|
113
|
-
isDisabled = _this$props3.isDisabled,
|
|
114
|
-
isListOpen = _this$props3.isListOpen,
|
|
115
|
-
noIcon = _this$props3.noIcon,
|
|
116
|
-
_onChange = _this$props3.onChange,
|
|
117
|
-
onClear = _this$props3.onClear,
|
|
118
|
-
onClick = _this$props3.onClick,
|
|
119
|
-
onCloseListClick = _this$props3.onCloseListClick,
|
|
120
|
-
onOpenListClick = _this$props3.onOpenListClick,
|
|
121
|
-
onRemoveOption = _this$props3.onRemoveOption,
|
|
122
|
-
placeholder = _this$props3.placeholder,
|
|
123
|
-
rootId = _this$props3.rootId,
|
|
124
|
-
searchValue = _this$props3.searchValue,
|
|
106
|
+
_defineProperty(_assertThisInitialized(_this), "renderPills", function () {
|
|
107
|
+
// Don't render a pill for plain text comboboxes - use the input instead
|
|
108
|
+
if (_this.asPlainText) return null;
|
|
109
|
+
// Don't render the single pill selection while searching
|
|
110
|
+
if (_this.props.singleSelection && _this.props.searchValue) return null;
|
|
111
|
+
var _this$props3 = _this.props,
|
|
125
112
|
selectedOptions = _this$props3.selectedOptions,
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
isLoading = _this$props3.isLoading,
|
|
131
|
-
isInvalid = _this$props3.isInvalid,
|
|
132
|
-
autoFocus = _this$props3.autoFocus,
|
|
133
|
-
ariaLabel = _this$props3['aria-label'],
|
|
134
|
-
ariaLabelledby = _this$props3['aria-labelledby'];
|
|
135
|
-
var singleSelection = Boolean(singleSelectionProp);
|
|
136
|
-
var asPlainText = singleSelectionProp && _typeof(singleSelectionProp) === 'object' && singleSelectionProp.asPlainText || false;
|
|
137
|
-
var pills = selectedOptions ? selectedOptions.map(function (option) {
|
|
113
|
+
isDisabled = _this$props3.isDisabled,
|
|
114
|
+
onRemoveOption = _this$props3.onRemoveOption;
|
|
115
|
+
if (!selectedOptions || !selectedOptions.length) return null;
|
|
116
|
+
return selectedOptions.map(function (option) {
|
|
138
117
|
var key = option.key,
|
|
139
118
|
label = option.label,
|
|
140
119
|
color = option.color,
|
|
@@ -143,17 +122,77 @@ export var EuiComboBoxInput = /*#__PURE__*/function (_Component) {
|
|
|
143
122
|
prepend = option.prepend,
|
|
144
123
|
truncationProps = option.truncationProps,
|
|
145
124
|
rest = _objectWithoutProperties(option, _excluded);
|
|
146
|
-
var pillOnClose = isDisabled || singleSelection || onClick ? undefined : onRemoveOption;
|
|
125
|
+
var pillOnClose = isDisabled || _this.props.singleSelection || onClick ? undefined : onRemoveOption;
|
|
147
126
|
return ___EmotionJSX(EuiComboBoxPill, _extends({
|
|
148
127
|
option: option,
|
|
149
128
|
onClose: pillOnClose,
|
|
150
129
|
key: key !== null && key !== void 0 ? key : label.toLowerCase(),
|
|
151
130
|
color: color,
|
|
152
131
|
onClick: onClick,
|
|
153
|
-
onClickAriaLabel: onClick ? 'Change' : undefined
|
|
154
|
-
asPlainText: asPlainText
|
|
132
|
+
onClickAriaLabel: onClick ? 'Change' : undefined
|
|
155
133
|
}, rest), label);
|
|
156
|
-
})
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
return _this;
|
|
137
|
+
}
|
|
138
|
+
_createClass(EuiComboBoxInput, [{
|
|
139
|
+
key: "componentDidUpdate",
|
|
140
|
+
value: function componentDidUpdate(prevProps) {
|
|
141
|
+
if (prevProps.searchValue !== this.props.searchValue) {
|
|
142
|
+
this.updateInputSize(this.props.searchValue);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}, {
|
|
146
|
+
key: "asPlainText",
|
|
147
|
+
get: function get() {
|
|
148
|
+
var singleSelection = this.props.singleSelection;
|
|
149
|
+
var isSingleSelectionConfig = singleSelection && _typeof(singleSelection) === 'object';
|
|
150
|
+
return !!(isSingleSelectionConfig && singleSelection.asPlainText);
|
|
151
|
+
}
|
|
152
|
+
}, {
|
|
153
|
+
key: "searchValue",
|
|
154
|
+
get: function get() {
|
|
155
|
+
var _this$props4 = this.props,
|
|
156
|
+
searchValue = _this$props4.searchValue,
|
|
157
|
+
selectedOptions = _this$props4.selectedOptions;
|
|
158
|
+
if (this.asPlainText) {
|
|
159
|
+
var _selectedOptions$;
|
|
160
|
+
return searchValue || (selectedOptions === null || selectedOptions === void 0 ? void 0 : (_selectedOptions$ = selectedOptions[0]) === null || _selectedOptions$ === void 0 ? void 0 : _selectedOptions$.label) || '';
|
|
161
|
+
} else {
|
|
162
|
+
return searchValue;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}, {
|
|
166
|
+
key: "render",
|
|
167
|
+
value: function render() {
|
|
168
|
+
var _this$props5 = this.props,
|
|
169
|
+
compressed = _this$props5.compressed,
|
|
170
|
+
focusedOptionId = _this$props5.focusedOptionId,
|
|
171
|
+
fullWidth = _this$props5.fullWidth,
|
|
172
|
+
hasSelectedOptions = _this$props5.hasSelectedOptions,
|
|
173
|
+
id = _this$props5.id,
|
|
174
|
+
isDisabled = _this$props5.isDisabled,
|
|
175
|
+
isListOpen = _this$props5.isListOpen,
|
|
176
|
+
noIcon = _this$props5.noIcon,
|
|
177
|
+
_onChange = _this$props5.onChange,
|
|
178
|
+
onClear = _this$props5.onClear,
|
|
179
|
+
onClick = _this$props5.onClick,
|
|
180
|
+
onFocus = _this$props5.onFocus,
|
|
181
|
+
onCloseListClick = _this$props5.onCloseListClick,
|
|
182
|
+
onOpenListClick = _this$props5.onOpenListClick,
|
|
183
|
+
placeholder = _this$props5.placeholder,
|
|
184
|
+
rootId = _this$props5.rootId,
|
|
185
|
+
searchValue = _this$props5.searchValue,
|
|
186
|
+
selectedOptions = _this$props5.selectedOptions,
|
|
187
|
+
singleSelection = _this$props5.singleSelection,
|
|
188
|
+
value = _this$props5.value,
|
|
189
|
+
prepend = _this$props5.prepend,
|
|
190
|
+
append = _this$props5.append,
|
|
191
|
+
isLoading = _this$props5.isLoading,
|
|
192
|
+
isInvalid = _this$props5.isInvalid,
|
|
193
|
+
autoFocus = _this$props5.autoFocus,
|
|
194
|
+
ariaLabel = _this$props5['aria-label'],
|
|
195
|
+
ariaLabelledby = _this$props5['aria-labelledby'];
|
|
157
196
|
var removeOptionMessage;
|
|
158
197
|
var removeOptionMessageId;
|
|
159
198
|
if (this.state.hasFocus) {
|
|
@@ -170,12 +209,7 @@ export var EuiComboBoxInput = /*#__PURE__*/function (_Component) {
|
|
|
170
209
|
id: removeOptionMessageId
|
|
171
210
|
}, removeOptionMessageContent));
|
|
172
211
|
}
|
|
173
|
-
var
|
|
174
|
-
if (placeholder && selectedOptions && !selectedOptions.length && !searchValue) {
|
|
175
|
-
placeholderMessage = ___EmotionJSX("p", {
|
|
176
|
-
className: "euiComboBoxPlaceholder"
|
|
177
|
-
}, placeholder);
|
|
178
|
-
}
|
|
212
|
+
var showPlaceholder = placeholder && !(selectedOptions !== null && selectedOptions !== void 0 && selectedOptions.length) && !searchValue;
|
|
179
213
|
var clickProps = {};
|
|
180
214
|
if (!isDisabled && onClear && hasSelectedOptions) {
|
|
181
215
|
clickProps.clear = {
|
|
@@ -205,6 +239,7 @@ export var EuiComboBoxInput = /*#__PURE__*/function (_Component) {
|
|
|
205
239
|
'euiComboBox__inputWrap--compressed': compressed,
|
|
206
240
|
'euiComboBox__inputWrap--fullWidth': fullWidth,
|
|
207
241
|
'euiComboBox__inputWrap--noWrap': singleSelection,
|
|
242
|
+
'euiComboBox__inputWrap--plainText': this.asPlainText || showPlaceholder,
|
|
208
243
|
'euiComboBox__inputWrap--inGroup': prepend || append
|
|
209
244
|
});
|
|
210
245
|
return ___EmotionJSX(EuiFormControlLayout, _extends({
|
|
@@ -222,7 +257,10 @@ export var EuiComboBoxInput = /*#__PURE__*/function (_Component) {
|
|
|
222
257
|
"data-test-subj": "comboBoxInput",
|
|
223
258
|
onClick: onClick,
|
|
224
259
|
tabIndex: -1 // becomes onBlur event's relatedTarget, otherwise relatedTarget is null when clicking on this div
|
|
225
|
-
},
|
|
260
|
+
}, this.renderPills(), ___EmotionJSX(EuiComboBoxOptionAppendPrepend, {
|
|
261
|
+
option: this.asPlainText ? selectedOptions === null || selectedOptions === void 0 ? void 0 : selectedOptions[0] : undefined,
|
|
262
|
+
classNamePrefix: "euiComboBoxPlainTextSelection"
|
|
263
|
+
}, ___EmotionJSX("input", {
|
|
226
264
|
"aria-activedescendant": focusedOptionId,
|
|
227
265
|
"aria-autocomplete": "list",
|
|
228
266
|
"aria-controls": isListOpen ? rootId('listbox') : '',
|
|
@@ -243,11 +281,15 @@ export var EuiComboBoxInput = /*#__PURE__*/function (_Component) {
|
|
|
243
281
|
ref: this.inputRefCallback,
|
|
244
282
|
role: "combobox",
|
|
245
283
|
style: {
|
|
246
|
-
inlineSize: this.state.inputWidth
|
|
284
|
+
inlineSize: this.asPlainText || showPlaceholder ? '100%' : this.state.inputWidth
|
|
247
285
|
},
|
|
248
|
-
|
|
286
|
+
placeholder: showPlaceholder ? placeholder : undefined,
|
|
287
|
+
value: this.searchValue,
|
|
249
288
|
autoFocus: autoFocus
|
|
250
|
-
|
|
289
|
+
// Force the menu to re-open on every input click - only necessary when plain text
|
|
290
|
+
,
|
|
291
|
+
onClick: this.asPlainText ? onFocus : undefined // Type shenanigans - event should be mostly the same
|
|
292
|
+
})), removeOptionMessage));
|
|
251
293
|
}
|
|
252
294
|
}]);
|
|
253
295
|
return EuiComboBoxInput;
|
|
@@ -7,7 +7,7 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
7
7
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
8
8
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
9
9
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
10
|
-
var _excluded = ["
|
|
10
|
+
var _excluded = ["children", "className", "color", "onClick", "onClickAriaLabel", "onClose", "option"];
|
|
11
11
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
12
12
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
13
13
|
/*
|
|
@@ -22,6 +22,7 @@ import React, { Component } from 'react';
|
|
|
22
22
|
import classNames from 'classnames';
|
|
23
23
|
import { EuiBadge } from '../../badge';
|
|
24
24
|
import { EuiI18n } from '../../i18n';
|
|
25
|
+
import { EuiComboBoxOptionAppendPrepend } from '../utils';
|
|
25
26
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
26
27
|
export var EuiComboBoxPill = /*#__PURE__*/function (_Component) {
|
|
27
28
|
_inherits(EuiComboBoxPill, _Component);
|
|
@@ -48,7 +49,6 @@ export var EuiComboBoxPill = /*#__PURE__*/function (_Component) {
|
|
|
48
49
|
value: function render() {
|
|
49
50
|
var _this2 = this;
|
|
50
51
|
var _this$props2 = this.props,
|
|
51
|
-
asPlainText = _this$props2.asPlainText,
|
|
52
52
|
children = _this$props2.children,
|
|
53
53
|
className = _this$props2.className,
|
|
54
54
|
color = _this$props2.color,
|
|
@@ -57,20 +57,17 @@ export var EuiComboBoxPill = /*#__PURE__*/function (_Component) {
|
|
|
57
57
|
onClose = _this$props2.onClose,
|
|
58
58
|
option = _this$props2.option,
|
|
59
59
|
rest = _objectWithoutProperties(_this$props2, _excluded);
|
|
60
|
-
var classes = classNames('euiComboBoxPill',
|
|
61
|
-
'euiComboBoxPill--plainText': asPlainText
|
|
62
|
-
}, className);
|
|
60
|
+
var classes = classNames('euiComboBoxPill', className);
|
|
63
61
|
var onClickProps = onClick && onClickAriaLabel ? {
|
|
64
62
|
onClick: onClick,
|
|
65
63
|
onClickAriaLabel: onClickAriaLabel
|
|
66
64
|
} : {};
|
|
67
|
-
var content = ___EmotionJSX(
|
|
68
|
-
|
|
69
|
-
|
|
65
|
+
var content = ___EmotionJSX(EuiComboBoxOptionAppendPrepend, {
|
|
66
|
+
option: option,
|
|
67
|
+
classNamePrefix: "euiComboBoxPill"
|
|
68
|
+
}, ___EmotionJSX("span", {
|
|
70
69
|
className: "eui-textTruncate"
|
|
71
|
-
}, children)
|
|
72
|
-
className: "euiComboBoxPill__append"
|
|
73
|
-
}, option.append));
|
|
70
|
+
}, children));
|
|
74
71
|
if (onClose) {
|
|
75
72
|
return ___EmotionJSX(EuiI18n, {
|
|
76
73
|
token: "euiComboBoxPill.removeSelection",
|
|
@@ -91,12 +88,6 @@ export var EuiComboBoxPill = /*#__PURE__*/function (_Component) {
|
|
|
91
88
|
}, onClickProps, rest), content);
|
|
92
89
|
});
|
|
93
90
|
}
|
|
94
|
-
if (asPlainText) {
|
|
95
|
-
return ___EmotionJSX("span", _extends({
|
|
96
|
-
className: classes,
|
|
97
|
-
"data-test-subj": "euiComboBoxPill"
|
|
98
|
-
}, rest), content);
|
|
99
|
-
}
|
|
100
91
|
return ___EmotionJSX(EuiBadge, _extends({
|
|
101
92
|
className: classes,
|
|
102
93
|
color: color,
|
|
@@ -36,6 +36,7 @@ import { EuiFilterSelectItem } from '../../filter_group/filter_select_item';
|
|
|
36
36
|
import { EuiBadge } from '../../badge';
|
|
37
37
|
import { EuiTextTruncate } from '../../text_truncate';
|
|
38
38
|
import { EuiInputPopoverWidthContext } from '../../popover/input_popover';
|
|
39
|
+
import { EuiComboBoxOptionAppendPrepend } from '../utils';
|
|
39
40
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
40
41
|
var hitEnterBadge = ___EmotionJSX(EuiBadge, {
|
|
41
42
|
className: "euiComboBoxOption__enterBadge",
|
|
@@ -119,13 +120,12 @@ export var EuiComboBoxOptionsList = /*#__PURE__*/function (_Component) {
|
|
|
119
120
|
title: label
|
|
120
121
|
}, rest), ___EmotionJSX("span", {
|
|
121
122
|
className: "euiComboBoxOption__contentWrapper"
|
|
122
|
-
},
|
|
123
|
-
|
|
124
|
-
|
|
123
|
+
}, ___EmotionJSX(EuiComboBoxOptionAppendPrepend, {
|
|
124
|
+
option: option,
|
|
125
|
+
classNamePrefix: "euiComboBoxOption"
|
|
126
|
+
}, ___EmotionJSX("span", {
|
|
125
127
|
className: "euiComboBoxOption__content"
|
|
126
|
-
}, renderOption ? renderOption(option, searchValue, 'euiComboBoxOption__renderOption') : _this.renderTruncatedOption(label, truncationProps)),
|
|
127
|
-
className: "euiComboBoxOption__append"
|
|
128
|
-
}, append), optionIsFocused && !optionIsDisabled ? hitEnterBadge : null));
|
|
128
|
+
}, renderOption ? renderOption(option, searchValue, 'euiComboBoxOption__renderOption') : _this.renderTruncatedOption(label, truncationProps))), optionIsFocused && !optionIsDisabled ? hitEnterBadge : null));
|
|
129
129
|
});
|
|
130
130
|
_defineProperty(_assertThisInitialized(_this), "optionWidth", void 0);
|
|
131
131
|
_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
|
+
};
|
|
@@ -99,7 +99,7 @@ export var EuiDataGridHeaderCell = function EuiDataGridHeaderCell(_ref) {
|
|
|
99
99
|
title: displayAsText || id
|
|
100
100
|
}, display || displayAsText || id), sortingScreenReaderText && ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("p", null, sortingScreenReaderText))) : ___EmotionJSX(React.Fragment, null, ___EmotionJSX(EuiPopover, _extends({
|
|
101
101
|
className: "eui-fullWidth",
|
|
102
|
-
|
|
102
|
+
display: "block",
|
|
103
103
|
panelPaddingSize: "none",
|
|
104
104
|
offset: 7,
|
|
105
105
|
button: ___EmotionJSX("button", {
|
|
@@ -113,7 +113,7 @@ export var useDataGridColumnSelector = function useDataGridColumnSelector(availa
|
|
|
113
113
|
return setIsOpen(!isOpen);
|
|
114
114
|
}
|
|
115
115
|
}, buttonText)
|
|
116
|
-
},
|
|
116
|
+
}, allowColumnHiding && ___EmotionJSX(EuiPopoverTitle, null, ___EmotionJSX(EuiI18n, {
|
|
117
117
|
tokens: ['euiColumnSelector.search', 'euiColumnSelector.searchcolumns'],
|
|
118
118
|
defaults: ['Search', 'Search columns']
|
|
119
119
|
}, function (_ref3) {
|
|
@@ -130,13 +130,12 @@ export var useDataGridColumnSelector = function useDataGridColumnSelector(availa
|
|
|
130
130
|
},
|
|
131
131
|
"data-test-subj": "dataGridColumnSelectorSearch"
|
|
132
132
|
});
|
|
133
|
-
})), ___EmotionJSX(
|
|
134
|
-
className: "euiDataGrid__controlScroll"
|
|
135
|
-
}, ___EmotionJSX(EuiDragDropContext, {
|
|
133
|
+
})), ___EmotionJSX(EuiDragDropContext, {
|
|
136
134
|
onDragEnd: onDragEnd
|
|
137
135
|
}, ___EmotionJSX(EuiDroppable, {
|
|
138
136
|
droppableId: "columnOrder",
|
|
139
|
-
isDropDisabled: !isDragEnabled
|
|
137
|
+
isDropDisabled: !isDragEnabled,
|
|
138
|
+
className: "euiDataGrid__controlScroll"
|
|
140
139
|
}, ___EmotionJSX(React.Fragment, null, filteredColumns.map(function (id, index) {
|
|
141
140
|
return ___EmotionJSX(EuiDraggable, {
|
|
142
141
|
key: id,
|
|
@@ -189,7 +188,7 @@ export var useDataGridColumnSelector = function useDataGridColumnSelector(availa
|
|
|
189
188
|
color: "subdued"
|
|
190
189
|
}))));
|
|
191
190
|
});
|
|
192
|
-
}))))
|
|
191
|
+
})))), allowColumnHiding && ___EmotionJSX(EuiPopoverFooter, null, ___EmotionJSX(EuiFlexGroup, {
|
|
193
192
|
gutterSize: "s",
|
|
194
193
|
responsive: false,
|
|
195
194
|
justifyContent: "spaceBetween"
|
|
@@ -9,7 +9,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import classNames from 'classnames';
|
|
12
|
-
import React, {
|
|
12
|
+
import React, { useEffect, useState } from 'react';
|
|
13
13
|
import { EuiButtonEmpty } from '../../button';
|
|
14
14
|
import { EuiDragDropContext, euiDragDropReorder, EuiDroppable } from '../../drag_and_drop';
|
|
15
15
|
import { EuiFlexGroup, EuiFlexItem } from '../../flex';
|
|
@@ -120,15 +120,12 @@ export var useDataGridColumnSorting = function useDataGridColumnSorting(columns,
|
|
|
120
120
|
return setIsOpen(!isOpen);
|
|
121
121
|
}
|
|
122
122
|
}, sorting.columns.length > 0 ? sortingButtonTextActive : sortingButtonText)
|
|
123
|
-
}, sorting.columns.length > 0 ? ___EmotionJSX(
|
|
124
|
-
role: "region",
|
|
125
|
-
"aria-live": "assertive",
|
|
126
|
-
className: "euiDataGrid__controlScroll"
|
|
127
|
-
}, ___EmotionJSX(EuiDragDropContext, {
|
|
123
|
+
}, sorting.columns.length > 0 ? ___EmotionJSX(EuiDragDropContext, {
|
|
128
124
|
onDragEnd: onDragEnd
|
|
129
125
|
}, ___EmotionJSX(EuiDroppable, {
|
|
130
|
-
droppableId: "columnSorting"
|
|
131
|
-
|
|
126
|
+
droppableId: "columnSorting",
|
|
127
|
+
className: "euiDataGrid__controlScroll"
|
|
128
|
+
}, ___EmotionJSX(React.Fragment, null, sorting.columns.map(function (_ref6, index) {
|
|
132
129
|
var id = _ref6.id,
|
|
133
130
|
direction = _ref6.direction;
|
|
134
131
|
return ___EmotionJSX(EuiDataGridColumnSortingDraggable, {
|
|
@@ -141,7 +138,7 @@ export var useDataGridColumnSorting = function useDataGridColumnSorting(columns,
|
|
|
141
138
|
schema: schema,
|
|
142
139
|
schemaDetectors: schemaDetectors
|
|
143
140
|
});
|
|
144
|
-
}))))
|
|
141
|
+
})))) : ___EmotionJSX(EuiText, {
|
|
145
142
|
size: "s",
|
|
146
143
|
color: "subdued"
|
|
147
144
|
}, ___EmotionJSX("p", {
|
|
@@ -73,6 +73,7 @@ var convertRowHeightsOptionsToSelection = function convertRowHeightsOptionsToSel
|
|
|
73
73
|
}
|
|
74
74
|
return rowHeightButtonOptions[0];
|
|
75
75
|
};
|
|
76
|
+
var defaultLineCountValue = String(2);
|
|
76
77
|
export var useDataGridDisplaySelector = function useDataGridDisplaySelector(showDisplaySelector, initialStyles, initialRowHeightsOptions) {
|
|
77
78
|
var _showDisplaySelector$, _rowHeightsOptions$de2;
|
|
78
79
|
var _useState = useState(false),
|
|
@@ -100,10 +101,10 @@ export var useDataGridDisplaySelector = function useDataGridDisplaySelector(show
|
|
|
100
101
|
}, []);
|
|
101
102
|
|
|
102
103
|
// Row height logic
|
|
103
|
-
var _useState7 = useState(
|
|
104
|
+
var _useState7 = useState(defaultLineCountValue),
|
|
104
105
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
105
|
-
|
|
106
|
-
|
|
106
|
+
lineCountInput = _useState8[0],
|
|
107
|
+
setLineCountInput = _useState8[1];
|
|
107
108
|
var setRowHeight = useCallback(function (option) {
|
|
108
109
|
var rowHeightsOptions = {
|
|
109
110
|
rowHeights: {} // Unset all row-specific heights
|
|
@@ -113,25 +114,27 @@ export var useDataGridDisplaySelector = function useDataGridDisplaySelector(show
|
|
|
113
114
|
rowHeightsOptions.defaultHeight = 'auto';
|
|
114
115
|
} else if (option === 'lineCount') {
|
|
115
116
|
rowHeightsOptions.defaultHeight = {
|
|
116
|
-
lineCount:
|
|
117
|
+
lineCount: Number(lineCountInput)
|
|
117
118
|
};
|
|
118
119
|
} else {
|
|
119
120
|
rowHeightsOptions.defaultHeight = undefined;
|
|
120
121
|
}
|
|
121
122
|
setUserRowHeightsOptions(rowHeightsOptions);
|
|
122
|
-
}, [
|
|
123
|
+
}, [lineCountInput]);
|
|
123
124
|
var setLineCountHeight = useCallback(function (event) {
|
|
125
|
+
setLineCountInput(event.currentTarget.value);
|
|
124
126
|
var newLineCount = Number(event.currentTarget.value);
|
|
125
|
-
if (newLineCount < 1) return; // Don't let users set a 0 or negative line count
|
|
126
127
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
128
|
+
// Don't let users set a 0 or negative line count
|
|
129
|
+
if (newLineCount > 0) {
|
|
130
|
+
setUserRowHeightsOptions({
|
|
131
|
+
rowHeights: {},
|
|
132
|
+
// Unset all row-specific line counts
|
|
133
|
+
defaultHeight: {
|
|
134
|
+
lineCount: newLineCount
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
}
|
|
135
138
|
}, []);
|
|
136
139
|
|
|
137
140
|
// Merge the developer-specified configurations with user overrides
|
|
@@ -151,8 +154,9 @@ export var useDataGridDisplaySelector = function useDataGridDisplaySelector(show
|
|
|
151
154
|
}, [rowHeightsOptions]);
|
|
152
155
|
useEffect(function () {
|
|
153
156
|
var _rowHeightsOptions$de;
|
|
157
|
+
setLineCountInput(
|
|
154
158
|
// @ts-ignore - optional chaining operator handles types & cases that aren't lineCount
|
|
155
|
-
|
|
159
|
+
(rowHeightsOptions === null || rowHeightsOptions === void 0 ? void 0 : (_rowHeightsOptions$de = rowHeightsOptions.defaultHeight) === null || _rowHeightsOptions$de === void 0 ? void 0 : _rowHeightsOptions$de.lineCount) || defaultLineCountValue);
|
|
156
160
|
// @ts-ignore - same as above
|
|
157
161
|
}, [rowHeightsOptions === null || rowHeightsOptions === void 0 ? void 0 : (_rowHeightsOptions$de2 = rowHeightsOptions.defaultHeight) === null || _rowHeightsOptions$de2 === void 0 ? void 0 : _rowHeightsOptions$de2.lineCount]);
|
|
158
162
|
|
|
@@ -284,7 +288,8 @@ export var useDataGridDisplaySelector = function useDataGridDisplaySelector(show
|
|
|
284
288
|
min: 1,
|
|
285
289
|
max: 20,
|
|
286
290
|
step: 1,
|
|
287
|
-
|
|
291
|
+
required: true,
|
|
292
|
+
value: lineCountInput,
|
|
288
293
|
onChange: setLineCountHeight,
|
|
289
294
|
"data-test-subj": "lineCountNumber"
|
|
290
295
|
})));
|
|
@@ -16,7 +16,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
import classNames from 'classnames';
|
|
19
|
-
import React, { forwardRef, useMemo, useRef, useState } from 'react';
|
|
19
|
+
import React, { forwardRef, useMemo, useRef, useState, memo } from 'react';
|
|
20
20
|
import { useGeneratedHtmlId } from '../../services';
|
|
21
21
|
import { useEuiTablePaginationDefaults } from '../table/table_pagination';
|
|
22
22
|
import { EuiFocusTrap } from '../focus_trap';
|
|
@@ -66,7 +66,7 @@ var cellPaddingsToClassMap = {
|
|
|
66
66
|
m: '',
|
|
67
67
|
l: 'euiDataGrid--paddingLarge'
|
|
68
68
|
};
|
|
69
|
-
export var EuiDataGrid = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
69
|
+
export var EuiDataGrid = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (props, ref) {
|
|
70
70
|
var _gridItemsRendered$cu;
|
|
71
71
|
var _props$leadingControl = props.leadingControlColumns,
|
|
72
72
|
leadingControlColumns = _props$leadingControl === void 0 ? emptyControlColumns : _props$leadingControl,
|
|
@@ -383,5 +383,5 @@ export var EuiDataGrid = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
383
383
|
token: "euiDataGrid.screenReaderNotice",
|
|
384
384
|
default: "Cell contains interactive content."
|
|
385
385
|
}))))), cellPopover));
|
|
386
|
-
});
|
|
386
|
+
}));
|
|
387
387
|
EuiDataGrid.displayName = 'EuiDataGrid';
|