@elastic/eui 62.0.2 → 62.2.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 +330 -330
- package/dist/eui_charts_theme.js.map +1 -1
- package/dist/eui_theme_dark.css +1 -783
- package/dist/eui_theme_dark.json +0 -57
- package/dist/eui_theme_dark.json.d.ts +0 -57
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +1 -783
- package/dist/eui_theme_light.json +0 -57
- package/dist/eui_theme_light.json.d.ts +0 -57
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/breadcrumbs/breadcrumb.js +199 -0
- package/es/components/breadcrumbs/breadcrumb.styles.js +61 -0
- package/es/components/breadcrumbs/breadcrumbs.js +115 -187
- package/es/components/breadcrumbs/breadcrumbs.styles.js +30 -0
- package/es/components/code/code_block.js +119 -107
- package/es/components/collapsible_nav/collapsible_nav.js +2 -2
- package/es/components/control_bar/control_bar.js +13 -0
- package/es/components/datagrid/body/data_grid_body.js +12 -2
- package/es/components/datagrid/body/data_grid_cell.js +31 -3
- package/es/components/datagrid/body/header/data_grid_header_row.js +1 -1
- package/es/components/datagrid/controls/column_sorting_draggable.js +1 -1
- package/es/components/datagrid/data_grid.js +10 -2
- package/es/components/datagrid/utils/row_heights.js +33 -4
- package/es/components/date_picker/super_date_picker/super_date_picker.js +2 -2
- package/es/components/date_picker/super_date_picker/super_update_button.js +1 -1
- package/es/components/description_list/description_list.js +22 -26
- package/es/components/description_list/description_list.styles.js +25 -0
- package/es/components/description_list/description_list_context.js +14 -0
- package/es/components/description_list/description_list_description.js +43 -2
- package/es/components/description_list/description_list_description.styles.js +47 -0
- package/es/components/description_list/description_list_title.js +43 -2
- package/es/components/description_list/description_list_title.styles.js +37 -0
- package/es/components/description_list/description_list_types.js +10 -0
- package/es/components/header/header.js +1 -27
- package/es/components/header/header_breadcrumbs/header_breadcrumbs.js +22 -2
- package/es/components/header/header_breadcrumbs/header_breadcrumbs.styles.js +15 -0
- package/es/components/header/header_links/header_links.js +9 -9
- package/es/components/icon/assets/tokenStruct.js +1 -1
- package/es/components/page/page_header/page_header.js +1 -0
- package/es/components/page/page_header/page_header_content.js +2 -1
- package/es/components/page/page_template.js +1 -0
- package/es/components/pagination/pagination.js +1 -1
- package/es/components/panel/split_panel/split_panel.js +2 -2
- package/es/components/popover/wrapping_popover.js +88 -45
- package/es/components/portal/portal.js +84 -38
- package/es/components/provider/provider.js +2 -2
- package/es/components/responsive/hide_for.js +6 -38
- package/es/components/responsive/show_for.js +6 -38
- package/es/components/selectable/selectable_templates/selectable_template_sitewide.js +17 -36
- package/es/components/side_nav/side_nav.js +1 -1
- package/es/components/table/table_row_cell.js +1 -2
- package/es/components/toast/global_toast_list.js +208 -241
- package/es/components/toast/global_toast_list.styles.js +38 -0
- package/es/components/toast/global_toast_list_item.js +12 -7
- package/es/components/toast/toast.js +25 -25
- package/es/components/toast/toast.styles.js +55 -0
- package/es/components/token/index.js +2 -1
- package/es/components/token/token.js +48 -112
- package/es/components/token/token.styles.js +93 -0
- package/es/components/token/token_map.js +6 -9
- package/es/components/token/token_types.js +11 -0
- package/es/global_styling/reset/global_styles.js +1 -1
- package/es/services/{breakpoint.js → breakpoint/breakpoint.js} +4 -9
- package/es/services/{hooks/useIsWithinBreakpoints.js → breakpoint/currentEuiBreakpoint.js} +36 -28
- package/es/services/breakpoint/index.js +10 -0
- package/es/services/breakpoint/useIsWithinBreakpoints.js +24 -0
- package/es/services/hooks/index.js +0 -1
- package/es/services/index.js +1 -1
- package/es/test/rtl/component_helpers.js +60 -1
- package/eui.d.ts +1787 -1550
- package/i18ntokens.json +36 -36
- package/lib/components/breadcrumbs/breadcrumb.js +225 -0
- package/lib/components/breadcrumbs/breadcrumb.styles.js +68 -0
- package/lib/components/breadcrumbs/breadcrumbs.js +125 -188
- package/lib/components/breadcrumbs/breadcrumbs.styles.js +33 -0
- package/lib/components/code/code_block.js +118 -106
- package/lib/components/collapsible_nav/collapsible_nav.js +2 -2
- package/lib/components/control_bar/control_bar.js +13 -0
- package/lib/components/datagrid/body/data_grid_body.js +12 -2
- package/lib/components/datagrid/body/data_grid_cell.js +31 -3
- package/lib/components/datagrid/body/header/data_grid_header_row.js +1 -1
- package/lib/components/datagrid/controls/column_sorting_draggable.js +1 -1
- package/lib/components/datagrid/data_grid.js +10 -2
- package/lib/components/datagrid/utils/row_heights.js +33 -4
- package/lib/components/date_picker/super_date_picker/super_date_picker.js +2 -2
- package/lib/components/date_picker/super_date_picker/super_update_button.js +1 -1
- package/lib/components/description_list/description_list.js +25 -31
- package/lib/components/description_list/description_list.styles.js +36 -0
- package/lib/components/description_list/description_list_context.js +24 -0
- package/lib/components/description_list/description_list_description.js +52 -2
- package/lib/components/description_list/description_list_description.styles.js +51 -0
- package/lib/components/description_list/description_list_title.js +52 -2
- package/lib/components/description_list/description_list_title.styles.js +50 -0
- package/lib/components/description_list/description_list_types.js +20 -0
- package/lib/components/header/header.js +1 -27
- package/lib/components/header/header_breadcrumbs/header_breadcrumbs.js +24 -2
- package/lib/components/header/header_breadcrumbs/header_breadcrumbs.styles.js +26 -0
- package/lib/components/header/header_links/header_links.js +8 -8
- package/lib/components/icon/assets/tokenStruct.js +1 -1
- package/lib/components/icon/svgs/tokens/tokenStruct.svg +1 -1
- package/lib/components/page/page_header/page_header.js +1 -0
- package/lib/components/page/page_header/page_header_content.js +3 -2
- package/lib/components/page/page_template.js +1 -0
- package/lib/components/pagination/pagination.js +1 -1
- package/lib/components/panel/split_panel/split_panel.js +3 -3
- package/lib/components/popover/wrapping_popover.js +85 -44
- package/lib/components/portal/portal.js +87 -39
- package/lib/components/provider/provider.js +1 -1
- package/lib/components/responsive/hide_for.js +12 -44
- package/lib/components/responsive/show_for.js +12 -44
- package/lib/components/selectable/selectable_templates/selectable_template_sitewide.js +15 -35
- package/lib/components/side_nav/side_nav.js +1 -1
- package/lib/components/table/table_row_cell.js +1 -3
- package/lib/components/toast/global_toast_list.js +209 -238
- package/lib/components/toast/global_toast_list.styles.js +45 -0
- package/lib/components/toast/global_toast_list_item.js +14 -7
- package/lib/components/toast/toast.js +27 -25
- package/lib/components/toast/toast.styles.js +66 -0
- package/lib/components/token/index.js +5 -3
- package/lib/components/token/token.js +50 -120
- package/lib/components/token/token.styles.js +101 -0
- package/lib/components/token/token_map.js +6 -9
- package/lib/components/token/token_types.js +22 -0
- package/lib/global_styling/reset/global_styles.js +1 -1
- package/{test-env/services → lib/services/breakpoint}/breakpoint.js +5 -9
- package/lib/services/breakpoint/currentEuiBreakpoint.js +80 -0
- package/lib/services/breakpoint/index.js +44 -0
- package/lib/services/breakpoint/useIsWithinBreakpoints.js +34 -0
- package/lib/services/hooks/index.js +0 -13
- package/lib/services/index.js +28 -0
- package/lib/test/rtl/component_helpers.js +69 -3
- package/optimize/es/components/breadcrumbs/breadcrumb.js +136 -0
- package/optimize/es/components/breadcrumbs/breadcrumb.styles.js +61 -0
- package/optimize/es/components/breadcrumbs/breadcrumbs.js +92 -165
- package/optimize/es/components/breadcrumbs/breadcrumbs.styles.js +30 -0
- package/optimize/es/components/code/code_block.js +106 -107
- package/optimize/es/components/datagrid/body/data_grid_body.js +2 -0
- package/optimize/es/components/datagrid/body/data_grid_cell.js +13 -1
- package/optimize/es/components/datagrid/utils/row_heights.js +33 -4
- package/optimize/es/components/description_list/description_list.js +20 -24
- package/optimize/es/components/description_list/description_list.styles.js +25 -0
- package/optimize/es/components/description_list/description_list_context.js +14 -0
- package/optimize/es/components/description_list/description_list_description.js +32 -2
- package/optimize/es/components/description_list/description_list_description.styles.js +47 -0
- package/optimize/es/components/description_list/description_list_title.js +32 -2
- package/optimize/es/components/description_list/description_list_title.styles.js +37 -0
- package/optimize/es/components/description_list/description_list_types.js +10 -0
- package/optimize/es/components/header/header_breadcrumbs/header_breadcrumbs.js +8 -1
- package/optimize/es/components/header/header_breadcrumbs/header_breadcrumbs.styles.js +15 -0
- package/optimize/es/components/header/header_links/header_links.js +8 -8
- package/optimize/es/components/icon/assets/tokenStruct.js +1 -1
- package/optimize/es/components/page/page_header/page_header_content.js +1 -1
- package/optimize/es/components/panel/split_panel/split_panel.js +1 -1
- package/optimize/es/components/popover/wrapping_popover.js +79 -38
- package/optimize/es/components/portal/portal.js +66 -34
- package/optimize/es/components/provider/provider.js +2 -2
- package/optimize/es/components/responsive/hide_for.js +5 -27
- package/optimize/es/components/responsive/show_for.js +5 -27
- package/optimize/es/components/selectable/selectable_templates/selectable_template_sitewide.js +16 -35
- package/optimize/es/components/table/table_row_cell.js +1 -2
- package/optimize/es/components/toast/global_toast_list.js +199 -230
- package/optimize/es/components/toast/global_toast_list.styles.js +38 -0
- package/optimize/es/components/toast/global_toast_list_item.js +11 -6
- package/optimize/es/components/toast/toast.js +24 -24
- package/optimize/es/components/toast/toast.styles.js +55 -0
- package/optimize/es/components/token/index.js +2 -1
- package/optimize/es/components/token/token.js +46 -69
- package/optimize/es/components/token/token.styles.js +83 -0
- package/optimize/es/components/token/token_map.js +6 -9
- package/optimize/es/components/token/token_types.js +11 -0
- package/optimize/es/global_styling/reset/global_styles.js +1 -1
- package/optimize/es/services/{breakpoint.js → breakpoint/breakpoint.js} +4 -9
- package/optimize/es/services/breakpoint/currentEuiBreakpoint.js +53 -0
- package/optimize/es/services/breakpoint/index.js +10 -0
- package/optimize/es/services/breakpoint/useIsWithinBreakpoints.js +24 -0
- package/optimize/es/services/hooks/index.js +0 -1
- package/optimize/es/services/index.js +1 -1
- package/optimize/es/test/rtl/component_helpers.js +60 -1
- package/optimize/lib/components/breadcrumbs/breadcrumb.js +162 -0
- package/optimize/lib/components/breadcrumbs/breadcrumb.styles.js +68 -0
- package/optimize/lib/components/breadcrumbs/breadcrumbs.js +99 -164
- package/optimize/lib/components/breadcrumbs/breadcrumbs.styles.js +33 -0
- package/optimize/lib/components/code/code_block.js +105 -106
- package/optimize/lib/components/datagrid/body/data_grid_body.js +2 -0
- package/optimize/lib/components/datagrid/body/data_grid_cell.js +13 -1
- package/optimize/lib/components/datagrid/utils/row_heights.js +33 -4
- package/optimize/lib/components/description_list/description_list.js +23 -28
- package/optimize/lib/components/description_list/description_list.styles.js +36 -0
- package/optimize/lib/components/description_list/description_list_context.js +24 -0
- package/optimize/lib/components/description_list/description_list_description.js +43 -2
- package/optimize/lib/components/description_list/description_list_description.styles.js +51 -0
- package/optimize/lib/components/description_list/description_list_title.js +43 -2
- package/optimize/lib/components/description_list/description_list_title.styles.js +50 -0
- package/optimize/lib/components/description_list/description_list_types.js +20 -0
- package/optimize/lib/components/header/header_breadcrumbs/header_breadcrumbs.js +10 -1
- package/optimize/lib/components/header/header_breadcrumbs/header_breadcrumbs.styles.js +26 -0
- package/optimize/lib/components/header/header_links/header_links.js +7 -7
- package/optimize/lib/components/icon/assets/tokenStruct.js +1 -1
- package/optimize/lib/components/icon/svgs/tokens/tokenStruct.svg +1 -1
- package/optimize/lib/components/page/page_header/page_header_content.js +2 -2
- package/optimize/lib/components/panel/split_panel/split_panel.js +2 -2
- package/optimize/lib/components/popover/wrapping_popover.js +78 -38
- package/optimize/lib/components/portal/portal.js +65 -44
- package/optimize/lib/components/provider/provider.js +1 -1
- package/optimize/lib/components/responsive/hide_for.js +4 -33
- package/optimize/lib/components/responsive/show_for.js +4 -33
- package/optimize/lib/components/selectable/selectable_templates/selectable_template_sitewide.js +14 -34
- package/optimize/lib/components/table/table_row_cell.js +1 -3
- package/optimize/lib/components/toast/global_toast_list.js +206 -220
- package/optimize/lib/components/toast/global_toast_list.styles.js +47 -0
- package/optimize/lib/components/toast/global_toast_list_item.js +14 -7
- package/optimize/lib/components/toast/toast.js +26 -24
- package/optimize/lib/components/toast/toast.styles.js +66 -0
- package/optimize/lib/components/token/index.js +5 -3
- package/optimize/lib/components/token/token.js +50 -76
- package/optimize/lib/components/token/token.styles.js +91 -0
- package/optimize/lib/components/token/token_map.js +6 -9
- package/optimize/lib/components/token/token_types.js +22 -0
- package/optimize/lib/global_styling/reset/global_styles.js +1 -1
- package/optimize/lib/services/{breakpoint.js → breakpoint/breakpoint.js} +5 -9
- package/optimize/lib/services/breakpoint/currentEuiBreakpoint.js +81 -0
- package/optimize/lib/services/breakpoint/index.js +44 -0
- package/optimize/lib/services/breakpoint/useIsWithinBreakpoints.js +34 -0
- package/optimize/lib/services/hooks/index.js +0 -13
- package/optimize/lib/services/index.js +28 -0
- package/optimize/lib/test/rtl/component_helpers.js +69 -3
- package/package.json +2 -2
- package/src/components/control_bar/_control_bar.scss +1 -1
- package/src/components/header/_index.scss +0 -1
- package/src/components/index.scss +0 -5
- package/src/themes/amsterdam/overrides/_breadcrumbs.scss +0 -12
- package/src/themes/amsterdam/overrides/_index.scss +0 -4
- package/test-env/components/breadcrumbs/breadcrumb.js +211 -0
- package/test-env/components/breadcrumbs/breadcrumb.styles.js +68 -0
- package/test-env/components/breadcrumbs/breadcrumbs.js +122 -174
- package/test-env/components/breadcrumbs/breadcrumbs.styles.js +33 -0
- package/test-env/components/collapsible_nav/collapsible_nav.js +2 -2
- package/test-env/components/control_bar/control_bar.js +13 -0
- package/test-env/components/datagrid/body/data_grid_body.js +12 -2
- package/test-env/components/datagrid/body/data_grid_cell.js +31 -3
- package/test-env/components/datagrid/body/header/data_grid_header_row.js +1 -1
- package/test-env/components/datagrid/controls/column_sorting_draggable.js +1 -1
- package/test-env/components/datagrid/data_grid.js +10 -2
- package/test-env/components/datagrid/utils/row_heights.js +33 -4
- package/test-env/components/date_picker/super_date_picker/super_date_picker.js +2 -2
- package/test-env/components/date_picker/super_date_picker/super_update_button.js +1 -1
- package/test-env/components/description_list/description_list.js +25 -30
- package/test-env/components/description_list/description_list.styles.js +36 -0
- package/test-env/components/description_list/description_list_context.js +24 -0
- package/test-env/components/description_list/description_list_description.js +43 -2
- package/test-env/components/description_list/description_list_description.styles.js +51 -0
- package/test-env/components/description_list/description_list_title.js +43 -2
- package/test-env/components/description_list/description_list_title.styles.js +50 -0
- package/test-env/components/description_list/description_list_types.js +20 -0
- package/test-env/components/header/header.js +1 -27
- package/test-env/components/header/header_breadcrumbs/header_breadcrumbs.js +24 -2
- package/test-env/components/header/header_breadcrumbs/header_breadcrumbs.styles.js +26 -0
- package/test-env/components/header/header_links/header_links.js +8 -8
- package/test-env/components/icon/assets/tokenStruct.js +1 -1
- package/test-env/components/observer/resize_observer/resize_observer.js +43 -126
- package/test-env/components/page/page_header/page_header.js +1 -0
- package/test-env/components/page/page_header/page_header_content.js +3 -2
- package/test-env/components/page/page_template.js +1 -0
- package/test-env/components/pagination/pagination.js +1 -1
- package/test-env/components/panel/split_panel/split_panel.js +3 -3
- package/test-env/components/popover/wrapping_popover.js +78 -38
- package/test-env/components/portal/portal.js +79 -45
- package/test-env/components/provider/provider.js +1 -1
- package/test-env/components/responsive/hide_for.js +5 -34
- package/test-env/components/responsive/show_for.js +5 -34
- package/test-env/components/selectable/selectable_templates/selectable_template_sitewide.js +15 -35
- package/test-env/components/side_nav/side_nav.js +1 -1
- package/test-env/components/table/table_row_cell.js +1 -3
- package/test-env/components/toast/global_toast_list.js +206 -220
- package/test-env/components/toast/global_toast_list.styles.js +47 -0
- package/test-env/components/toast/global_toast_list_item.js +14 -7
- package/test-env/components/toast/toast.js +27 -25
- package/test-env/components/toast/toast.styles.js +66 -0
- package/test-env/components/token/index.js +5 -3
- package/test-env/components/token/token.js +51 -120
- package/test-env/components/token/token.styles.js +91 -0
- package/test-env/components/token/token_map.js +6 -9
- package/test-env/components/token/token_types.js +22 -0
- package/test-env/global_styling/reset/global_styles.js +1 -1
- package/{lib/services → test-env/services/breakpoint}/breakpoint.js +5 -9
- package/test-env/services/breakpoint/currentEuiBreakpoint.js +37 -0
- package/test-env/services/breakpoint/index.js +44 -0
- package/test-env/services/breakpoint/useIsWithinBreakpoints.js +34 -0
- package/test-env/services/hooks/index.js +0 -13
- package/test-env/services/index.js +28 -0
- package/test-env/test/rtl/component_helpers.js +69 -3
- package/lib/services/hooks/useIsWithinBreakpoints.js +0 -57
- package/optimize/es/services/hooks/useIsWithinBreakpoints.js +0 -46
- package/optimize/lib/services/hooks/useIsWithinBreakpoints.js +0 -57
- package/src/components/breadcrumbs/_breadcrumbs.scss +0 -79
- package/src/components/breadcrumbs/_index.scss +0 -2
- package/src/components/breadcrumbs/_variables.scss +0 -2
- package/src/components/description_list/_description_list.scss +0 -211
- package/src/components/description_list/_index.scss +0 -1
- package/src/components/header/header_breadcrumbs/_header_breadcrumbs.scss +0 -8
- package/src/components/header/header_breadcrumbs/_index.scss +0 -1
- package/src/components/portal/_index.scss +0 -1
- package/src/components/portal/_portal.scss +0 -6
- package/src/components/toast/_global_toast_list.scss +0 -90
- package/src/components/toast/_index.scss +0 -4
- package/src/components/toast/_toast.scss +0 -103
- package/src/components/token/_index.scss +0 -2
- package/src/components/token/_token.scss +0 -85
- package/src/components/token/_variables.scss +0 -13
- package/src/themes/amsterdam/overrides/_header_breadcrumbs.scss +0 -71
- package/src/themes/amsterdam/overrides/_toast.scss +0 -21
- package/src/themes/amsterdam/overrides/_token.scss +0 -4
- package/test-env/services/hooks/useIsWithinBreakpoints.js +0 -57
|
@@ -43,7 +43,7 @@ import { EuiButtonIcon } from '../button';
|
|
|
43
43
|
import { keysOf } from '../common';
|
|
44
44
|
import { EuiCopy } from '../copy';
|
|
45
45
|
import { EuiFocusTrap } from '../focus_trap';
|
|
46
|
-
import {
|
|
46
|
+
import { useEuiI18n } from '../i18n';
|
|
47
47
|
import { useInnerText } from '../inner_text';
|
|
48
48
|
import { useMutationObserver } from '../observer/mutation_observer';
|
|
49
49
|
import { useResizeObserver } from '../observer/resize_observer';
|
|
@@ -127,7 +127,7 @@ export var EuiCodeBlock = function EuiCodeBlock(_ref) {
|
|
|
127
127
|
}),
|
|
128
128
|
innerTextRef = _useCopy.innerTextRef,
|
|
129
129
|
showCopyButton = _useCopy.showCopyButton,
|
|
130
|
-
|
|
130
|
+
textToCopy = _useCopy.textToCopy;
|
|
131
131
|
|
|
132
132
|
var _useOverflowDetection = useOverflowDetection(),
|
|
133
133
|
setWrapperRef = _useOverflowDetection.setWrapperRef,
|
|
@@ -140,8 +140,8 @@ export var EuiCodeBlock = function EuiCodeBlock(_ref) {
|
|
|
140
140
|
}),
|
|
141
141
|
showFullScreenButton = _useFullScreen.showFullScreenButton,
|
|
142
142
|
onKeyDown = _useFullScreen.onKeyDown,
|
|
143
|
-
|
|
144
|
-
|
|
143
|
+
isFullScreen = _useFullScreen.isFullScreen,
|
|
144
|
+
toggleFullScreen = _useFullScreen.toggleFullScreen; // Classes used in both fullscreen and non-fullscreen mode
|
|
145
145
|
|
|
146
146
|
|
|
147
147
|
var wrapperClasses = classNames(className, 'euiCodeBlock', {
|
|
@@ -171,25 +171,32 @@ export var EuiCodeBlock = function EuiCodeBlock(_ref) {
|
|
|
171
171
|
onKeyDown: onKeyDown
|
|
172
172
|
};
|
|
173
173
|
}, [preClasses, onKeyDown]);
|
|
174
|
-
var
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
var wrapperProps = {
|
|
182
|
-
className: classes,
|
|
183
|
-
style: optionalStyles
|
|
184
|
-
};
|
|
185
|
-
var codeBlockControls;
|
|
186
|
-
|
|
187
|
-
if (showCopyButton || showFullScreenButton) {
|
|
188
|
-
codeBlockControls = ___EmotionJSX("div", {
|
|
189
|
-
className: "euiCodeBlock__controls"
|
|
190
|
-
}, ___EmotionJSX(FullScreenButton, null), ___EmotionJSX(CopyButton, null));
|
|
191
|
-
}
|
|
174
|
+
var overflowHeightStyles = useMemo(function () {
|
|
175
|
+
if (overflowHeight) {
|
|
176
|
+
var property = typeof overflowHeight === 'string' ? 'height' : 'maxHeight';
|
|
177
|
+
return _defineProperty({}, property, overflowHeight);
|
|
178
|
+
}
|
|
192
179
|
|
|
180
|
+
return {};
|
|
181
|
+
}, [overflowHeight]);
|
|
182
|
+
var wrapperProps = useMemo(function () {
|
|
183
|
+
return {
|
|
184
|
+
className: classes,
|
|
185
|
+
style: overflowHeightStyles
|
|
186
|
+
};
|
|
187
|
+
}, [classes, overflowHeightStyles]);
|
|
188
|
+
var codeBlockControls = useMemo(function () {
|
|
189
|
+
if (showCopyButton || showFullScreenButton) {
|
|
190
|
+
return ___EmotionJSX("div", {
|
|
191
|
+
className: "euiCodeBlock__controls"
|
|
192
|
+
}, showFullScreenButton && ___EmotionJSX(FullScreenButton, {
|
|
193
|
+
isFullScreen: isFullScreen,
|
|
194
|
+
toggleFullScreen: toggleFullScreen
|
|
195
|
+
}), showCopyButton && ___EmotionJSX(CopyButton, {
|
|
196
|
+
textToCopy: textToCopy
|
|
197
|
+
}));
|
|
198
|
+
}
|
|
199
|
+
}, [isFullScreen, toggleFullScreen, showCopyButton, showFullScreenButton, textToCopy]);
|
|
193
200
|
return ___EmotionJSX("div", wrapperProps, isVirtualized ? ___EmotionJSX(VirtualizedCodeBlock, {
|
|
194
201
|
data: data,
|
|
195
202
|
rowHeight: fontSizeToRowHeightMap[fontSize],
|
|
@@ -199,10 +206,10 @@ export var EuiCodeBlock = function EuiCodeBlock(_ref) {
|
|
|
199
206
|
codeProps: codeProps
|
|
200
207
|
}) : ___EmotionJSX("pre", {
|
|
201
208
|
ref: combinedRef,
|
|
202
|
-
style:
|
|
209
|
+
style: overflowHeightStyles,
|
|
203
210
|
className: preClasses,
|
|
204
211
|
tabIndex: tabIndex
|
|
205
|
-
}, ___EmotionJSX("code", codeProps, content)), codeBlockControls, ___EmotionJSX(FullScreenDisplay, {
|
|
212
|
+
}, ___EmotionJSX("code", codeProps, content)), codeBlockControls, isFullScreen && ___EmotionJSX(FullScreenDisplay, {
|
|
206
213
|
className: wrapperClasses
|
|
207
214
|
}, isVirtualized ? ___EmotionJSX(VirtualizedCodeBlock, {
|
|
208
215
|
data: data,
|
|
@@ -312,10 +319,31 @@ var useOverflowDetection = function useOverflowDetection() {
|
|
|
312
319
|
*/
|
|
313
320
|
|
|
314
321
|
|
|
315
|
-
var
|
|
316
|
-
var
|
|
317
|
-
|
|
318
|
-
|
|
322
|
+
var CopyButton = function CopyButton(_ref3) {
|
|
323
|
+
var textToCopy = _ref3.textToCopy;
|
|
324
|
+
var copyButton = useEuiI18n('euiCodeBlock.copyButton', 'Copy');
|
|
325
|
+
return ___EmotionJSX("div", {
|
|
326
|
+
className: "euiCodeBlock__copyButton"
|
|
327
|
+
}, ___EmotionJSX(EuiCopy, {
|
|
328
|
+
textToCopy: textToCopy
|
|
329
|
+
}, function (copy) {
|
|
330
|
+
return ___EmotionJSX(EuiButtonIcon, {
|
|
331
|
+
onClick: copy,
|
|
332
|
+
iconType: "copyClipboard",
|
|
333
|
+
color: "text",
|
|
334
|
+
"aria-label": copyButton
|
|
335
|
+
});
|
|
336
|
+
}));
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
CopyButton.propTypes = {
|
|
340
|
+
textToCopy: PropTypes.string.isRequired
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
var useCopy = function useCopy(_ref4) {
|
|
344
|
+
var isCopyable = _ref4.isCopyable,
|
|
345
|
+
isVirtualized = _ref4.isVirtualized,
|
|
346
|
+
children = _ref4.children;
|
|
319
347
|
|
|
320
348
|
var _useInnerText = useInnerText(''),
|
|
321
349
|
_useInnerText2 = _slicedToArray(_useInnerText, 2),
|
|
@@ -328,32 +356,10 @@ var useCopy = function useCopy(_ref2) {
|
|
|
328
356
|
var textToCopy = isVirtualized ? "".concat(children) : innerText; // Virtualized code blocks do not have inner text
|
|
329
357
|
|
|
330
358
|
var showCopyButton = isCopyable && textToCopy;
|
|
331
|
-
|
|
332
|
-
var CopyButton = function CopyButton() {
|
|
333
|
-
if (!showCopyButton) return null;
|
|
334
|
-
return ___EmotionJSX("div", {
|
|
335
|
-
className: "euiCodeBlock__copyButton"
|
|
336
|
-
}, ___EmotionJSX(EuiI18n, {
|
|
337
|
-
token: "euiCodeBlock.copyButton",
|
|
338
|
-
default: "Copy"
|
|
339
|
-
}, function (copyButton) {
|
|
340
|
-
return ___EmotionJSX(EuiCopy, {
|
|
341
|
-
textToCopy: textToCopy
|
|
342
|
-
}, function (copy) {
|
|
343
|
-
return ___EmotionJSX(EuiButtonIcon, {
|
|
344
|
-
onClick: copy,
|
|
345
|
-
iconType: "copyClipboard",
|
|
346
|
-
color: "text",
|
|
347
|
-
"aria-label": copyButton
|
|
348
|
-
});
|
|
349
|
-
});
|
|
350
|
-
}));
|
|
351
|
-
};
|
|
352
|
-
|
|
353
359
|
return {
|
|
354
360
|
innerTextRef: innerTextRef,
|
|
355
361
|
showCopyButton: showCopyButton,
|
|
356
|
-
|
|
362
|
+
textToCopy: textToCopy
|
|
357
363
|
};
|
|
358
364
|
};
|
|
359
365
|
/**
|
|
@@ -361,18 +367,59 @@ var useCopy = function useCopy(_ref2) {
|
|
|
361
367
|
*/
|
|
362
368
|
|
|
363
369
|
|
|
364
|
-
var
|
|
365
|
-
var
|
|
370
|
+
var FullScreenButton = function FullScreenButton(_ref5) {
|
|
371
|
+
var isFullScreen = _ref5.isFullScreen,
|
|
372
|
+
toggleFullScreen = _ref5.toggleFullScreen;
|
|
373
|
+
|
|
374
|
+
var _useEuiI18n = useEuiI18n(['euiCodeBlock.fullscreenCollapse', 'euiCodeBlock.fullscreenExpand'], ['Collapse', 'Expand']),
|
|
375
|
+
_useEuiI18n2 = _slicedToArray(_useEuiI18n, 2),
|
|
376
|
+
fullscreenCollapse = _useEuiI18n2[0],
|
|
377
|
+
fullscreenExpand = _useEuiI18n2[1];
|
|
378
|
+
|
|
379
|
+
return ___EmotionJSX(EuiButtonIcon, {
|
|
380
|
+
className: "euiCodeBlock__fullScreenButton",
|
|
381
|
+
onClick: toggleFullScreen,
|
|
382
|
+
iconType: isFullScreen ? 'fullScreenExit' : 'fullScreen',
|
|
383
|
+
color: "text",
|
|
384
|
+
"aria-label": isFullScreen ? fullscreenCollapse : fullscreenExpand
|
|
385
|
+
});
|
|
386
|
+
};
|
|
387
|
+
|
|
388
|
+
FullScreenButton.propTypes = {
|
|
389
|
+
isFullScreen: PropTypes.bool.isRequired,
|
|
390
|
+
toggleFullScreen: PropTypes.func.isRequired
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
var FullScreenDisplay = function FullScreenDisplay(_ref6) {
|
|
394
|
+
var children = _ref6.children,
|
|
395
|
+
className = _ref6.className;
|
|
396
|
+
// Force fullscreen to use large font and padding.
|
|
397
|
+
var fullScreenClasses = classNames(className, 'euiCodeBlock--fontLarge', 'euiCodeBlock--paddingLarge', 'euiCodeBlock-isFullScreen'); // Attaches to the body because of EuiOverlayMask's React portal usage.
|
|
398
|
+
|
|
399
|
+
return ___EmotionJSX(EuiOverlayMask, null, ___EmotionJSX(EuiFocusTrap, {
|
|
400
|
+
clickOutsideDisables: true
|
|
401
|
+
}, ___EmotionJSX("div", {
|
|
402
|
+
className: fullScreenClasses
|
|
403
|
+
}, children)));
|
|
404
|
+
};
|
|
405
|
+
|
|
406
|
+
FullScreenDisplay.propTypes = {
|
|
407
|
+
className: PropTypes.string.isRequired
|
|
408
|
+
};
|
|
409
|
+
|
|
410
|
+
var useFullScreen = function useFullScreen(_ref7) {
|
|
411
|
+
var overflowHeight = _ref7.overflowHeight;
|
|
366
412
|
|
|
367
413
|
var _useState5 = useState(false),
|
|
368
414
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
369
415
|
isFullScreen = _useState6[0],
|
|
370
416
|
setIsFullScreen = _useState6[1];
|
|
371
417
|
|
|
372
|
-
var toggleFullScreen = function
|
|
373
|
-
setIsFullScreen(
|
|
374
|
-
|
|
375
|
-
|
|
418
|
+
var toggleFullScreen = useCallback(function () {
|
|
419
|
+
setIsFullScreen(function (isFullScreen) {
|
|
420
|
+
return !isFullScreen;
|
|
421
|
+
});
|
|
422
|
+
}, []);
|
|
376
423
|
var onKeyDown = useCallback(function (event) {
|
|
377
424
|
if (event.key === keys.ESCAPE) {
|
|
378
425
|
event.preventDefault();
|
|
@@ -381,45 +428,10 @@ var useFullScreen = function useFullScreen(_ref3) {
|
|
|
381
428
|
}
|
|
382
429
|
}, []);
|
|
383
430
|
var showFullScreenButton = !!overflowHeight;
|
|
384
|
-
|
|
385
|
-
var FullScreenButton = function FullScreenButton() {
|
|
386
|
-
if (!showFullScreenButton) return null;
|
|
387
|
-
return ___EmotionJSX(EuiI18n, {
|
|
388
|
-
tokens: ['euiCodeBlock.fullscreenCollapse', 'euiCodeBlock.fullscreenExpand'],
|
|
389
|
-
defaults: ['Collapse', 'Expand']
|
|
390
|
-
}, function (_ref4) {
|
|
391
|
-
var _ref5 = _slicedToArray(_ref4, 2),
|
|
392
|
-
fullscreenCollapse = _ref5[0],
|
|
393
|
-
fullscreenExpand = _ref5[1];
|
|
394
|
-
|
|
395
|
-
return ___EmotionJSX(EuiButtonIcon, {
|
|
396
|
-
className: "euiCodeBlock__fullScreenButton",
|
|
397
|
-
onClick: toggleFullScreen,
|
|
398
|
-
iconType: isFullScreen ? 'fullScreenExit' : 'fullScreen',
|
|
399
|
-
color: "text",
|
|
400
|
-
"aria-label": isFullScreen ? fullscreenCollapse : fullscreenExpand
|
|
401
|
-
});
|
|
402
|
-
});
|
|
403
|
-
};
|
|
404
|
-
|
|
405
|
-
var FullScreenDisplay = function FullScreenDisplay(_ref6) {
|
|
406
|
-
var children = _ref6.children,
|
|
407
|
-
className = _ref6.className;
|
|
408
|
-
if (!isFullScreen) return null; // Force fullscreen to use large font and padding.
|
|
409
|
-
|
|
410
|
-
var fullScreenClasses = classNames(className, 'euiCodeBlock--fontLarge', 'euiCodeBlock--paddingLarge', 'euiCodeBlock-isFullScreen'); // Attaches to the body because of EuiOverlayMask's React portal usage.
|
|
411
|
-
|
|
412
|
-
return ___EmotionJSX(EuiOverlayMask, null, ___EmotionJSX(EuiFocusTrap, {
|
|
413
|
-
clickOutsideDisables: true
|
|
414
|
-
}, ___EmotionJSX("div", {
|
|
415
|
-
className: fullScreenClasses
|
|
416
|
-
}, children)));
|
|
417
|
-
};
|
|
418
|
-
|
|
419
431
|
return {
|
|
420
432
|
showFullScreenButton: showFullScreenButton,
|
|
421
|
-
|
|
422
|
-
|
|
433
|
+
isFullScreen: isFullScreen,
|
|
434
|
+
toggleFullScreen: toggleFullScreen,
|
|
423
435
|
onKeyDown: onKeyDown
|
|
424
436
|
};
|
|
425
437
|
};
|
|
@@ -428,21 +440,21 @@ var useFullScreen = function useFullScreen(_ref3) {
|
|
|
428
440
|
*/
|
|
429
441
|
|
|
430
442
|
|
|
431
|
-
var ListRow = function ListRow(
|
|
432
|
-
var data =
|
|
433
|
-
index =
|
|
434
|
-
style =
|
|
443
|
+
var ListRow = function ListRow(_ref8) {
|
|
444
|
+
var data = _ref8.data,
|
|
445
|
+
index = _ref8.index,
|
|
446
|
+
style = _ref8.style;
|
|
435
447
|
var row = data[index];
|
|
436
448
|
row.properties.style = style;
|
|
437
449
|
return nodeToHtml(row, index, data, 0);
|
|
438
450
|
};
|
|
439
451
|
|
|
440
|
-
var VirtualizedCodeBlock = function VirtualizedCodeBlock(
|
|
441
|
-
var data =
|
|
442
|
-
rowHeight =
|
|
443
|
-
overflowHeight =
|
|
444
|
-
preProps =
|
|
445
|
-
codeProps =
|
|
452
|
+
var VirtualizedCodeBlock = function VirtualizedCodeBlock(_ref9) {
|
|
453
|
+
var data = _ref9.data,
|
|
454
|
+
rowHeight = _ref9.rowHeight,
|
|
455
|
+
overflowHeight = _ref9.overflowHeight,
|
|
456
|
+
preProps = _ref9.preProps,
|
|
457
|
+
codeProps = _ref9.codeProps;
|
|
446
458
|
var VirtualizedOuterElement = useMemo(function () {
|
|
447
459
|
return /*#__PURE__*/forwardRef(function (props, ref) {
|
|
448
460
|
return ___EmotionJSX("pre", _extends({}, props, {
|
|
@@ -459,9 +471,9 @@ var VirtualizedCodeBlock = function VirtualizedCodeBlock(_ref8) {
|
|
|
459
471
|
}, [codeProps]);
|
|
460
472
|
return ___EmotionJSX(EuiAutoSizer, {
|
|
461
473
|
disableHeight: typeof overflowHeight === 'number'
|
|
462
|
-
}, function (
|
|
463
|
-
var height =
|
|
464
|
-
width =
|
|
474
|
+
}, function (_ref10) {
|
|
475
|
+
var height = _ref10.height,
|
|
476
|
+
width = _ref10.width;
|
|
465
477
|
return ___EmotionJSX(FixedSizeList, {
|
|
466
478
|
height: height !== null && height !== void 0 ? height : overflowHeight,
|
|
467
479
|
width: width,
|
|
@@ -268,7 +268,7 @@ EuiCollapsibleNav.propTypes = {
|
|
|
268
268
|
/**
|
|
269
269
|
* Named breakpoint or pixel value for customizing the minimum window width to enable docking
|
|
270
270
|
*/
|
|
271
|
-
pushMinBreakpoint: PropTypes.oneOfType([PropTypes.
|
|
271
|
+
pushMinBreakpoint: PropTypes.oneOfType([PropTypes.any.isRequired, PropTypes.number.isRequired]),
|
|
272
272
|
style: PropTypes.any,
|
|
273
273
|
|
|
274
274
|
/**
|
|
@@ -292,7 +292,7 @@ EuiCollapsibleNav.propTypes = {
|
|
|
292
292
|
* Keeps navigation flyout visible and push `<body>` content via padding
|
|
293
293
|
*/
|
|
294
294
|
isDocked: PropTypes.bool,
|
|
295
|
-
dockedBreakpoint: PropTypes.oneOfType([PropTypes.
|
|
295
|
+
dockedBreakpoint: PropTypes.oneOfType([PropTypes.any.isRequired, PropTypes.number.isRequired]),
|
|
296
296
|
|
|
297
297
|
/**
|
|
298
298
|
* Button for controlling visible state of the nav
|
|
@@ -370,6 +370,7 @@ EuiControlBar.propTypes = {
|
|
|
370
370
|
"aria-label": PropTypes.string,
|
|
371
371
|
"data-test-subj": PropTypes.string,
|
|
372
372
|
href: PropTypes.string,
|
|
373
|
+
rel: PropTypes.string,
|
|
373
374
|
onClick: PropTypes.func,
|
|
374
375
|
|
|
375
376
|
/**
|
|
@@ -392,6 +393,18 @@ EuiControlBar.propTypes = {
|
|
|
392
393
|
*/
|
|
393
394
|
"aria-current": PropTypes.any
|
|
394
395
|
}).isRequired),
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* Determines breadcrumbs appearance, with `page` being the default styling.
|
|
399
|
+
* Application breadcrumbs should only be once per page, in (e.g.) EuiHeader
|
|
400
|
+
*/
|
|
401
|
+
type: PropTypes.oneOf(["page", "application"]),
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* Whether the last breadcrumb should visually (and accessibly, to screen readers)
|
|
405
|
+
* be highlighted as the current page. Defaults to true.
|
|
406
|
+
*/
|
|
407
|
+
lastBreadcrumbIsCurrentPage: PropTypes.bool,
|
|
395
408
|
text: PropTypes.node,
|
|
396
409
|
iconType: PropTypes.string
|
|
397
410
|
}).isRequired).isRequired,
|
|
@@ -343,6 +343,8 @@ export var EuiDataGridBody = function EuiDataGridBody(props) {
|
|
|
343
343
|
|
|
344
344
|
var rowHeightUtils = useRowHeightUtils({
|
|
345
345
|
gridRef: gridRef,
|
|
346
|
+
outerGridElementRef: outerGridRef,
|
|
347
|
+
gridItemsRenderedRef: gridItemsRendered,
|
|
346
348
|
gridStyles: gridStyles,
|
|
347
349
|
columns: columns,
|
|
348
350
|
rowHeightsOptions: rowHeightsOptions
|
|
@@ -927,7 +929,7 @@ EuiDataGridBody.propTypes = {
|
|
|
927
929
|
/**
|
|
928
930
|
* The color associated with this data type; it's used to color the icon token
|
|
929
931
|
*/
|
|
930
|
-
color: PropTypes.oneOfType([PropTypes.oneOfType([PropTypes.
|
|
932
|
+
color: PropTypes.oneOfType([PropTypes.oneOfType([PropTypes.any.isRequired, PropTypes.string.isRequired]).isRequired, PropTypes.string.isRequired]),
|
|
931
933
|
|
|
932
934
|
/**
|
|
933
935
|
* Text for how to represent an ascending sort of this data type, e.g. 'A -> Z'
|
|
@@ -1025,7 +1027,15 @@ EuiDataGridBody.propTypes = {
|
|
|
1025
1027
|
* Optional callback returning the current `rowHeightsOptions` when changes occur from user input (e.g. toolbar display controls).
|
|
1026
1028
|
* Can be used for, e.g. storing user `rowHeightsOptions` in a local storage object.
|
|
1027
1029
|
*/
|
|
1028
|
-
onChange: PropTypes.func
|
|
1030
|
+
onChange: PropTypes.func,
|
|
1031
|
+
|
|
1032
|
+
/**
|
|
1033
|
+
* Optional indicator of the row that should be used as an anchor for vertical layout shift compensation.
|
|
1034
|
+
* When set to 'start' or 'center', the topmost or middle visible row will try
|
|
1035
|
+
* to compensate for changes in their top offsets by adjusting the grid's scroll
|
|
1036
|
+
* position.
|
|
1037
|
+
*/
|
|
1038
|
+
scrollAnchorRow: PropTypes.oneOf(["start", "center", undefined])
|
|
1029
1039
|
}),
|
|
1030
1040
|
isFullScreen: PropTypes.bool.isRequired,
|
|
1031
1041
|
gridStyles: PropTypes.shape({
|
|
@@ -544,7 +544,15 @@ EuiDataGridCellContent.propTypes = {
|
|
|
544
544
|
* Optional callback returning the current `rowHeightsOptions` when changes occur from user input (e.g. toolbar display controls).
|
|
545
545
|
* Can be used for, e.g. storing user `rowHeightsOptions` in a local storage object.
|
|
546
546
|
*/
|
|
547
|
-
onChange: PropTypes.func
|
|
547
|
+
onChange: PropTypes.func,
|
|
548
|
+
|
|
549
|
+
/**
|
|
550
|
+
* Optional indicator of the row that should be used as an anchor for vertical layout shift compensation.
|
|
551
|
+
* When set to 'start' or 'center', the topmost or middle visible row will try
|
|
552
|
+
* to compensate for changes in their top offsets by adjusting the grid's scroll
|
|
553
|
+
* position.
|
|
554
|
+
*/
|
|
555
|
+
scrollAnchorRow: PropTypes.oneOf(["start", "center", undefined])
|
|
548
556
|
}),
|
|
549
557
|
rowHeightUtils: PropTypes.any,
|
|
550
558
|
pagination: PropTypes.shape({
|
|
@@ -915,7 +923,7 @@ export var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
915
923
|
}, {
|
|
916
924
|
key: "componentDidUpdate",
|
|
917
925
|
value: function componentDidUpdate(prevProps) {
|
|
918
|
-
var _this$props$rowHeight, _prevProps$rowHeights;
|
|
926
|
+
var _this$props$rowHeight, _prevProps$rowHeights, _this$props$rowHeight2, _this$props$style, _prevProps$style;
|
|
919
927
|
|
|
920
928
|
this.recalculateAutoHeight();
|
|
921
929
|
|
|
@@ -923,6 +931,18 @@ export var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
923
931
|
this.recalculateLineHeight();
|
|
924
932
|
}
|
|
925
933
|
|
|
934
|
+
if ((_this$props$rowHeight2 = this.props.rowHeightsOptions) !== null && _this$props$rowHeight2 !== void 0 && _this$props$rowHeight2.scrollAnchorRow && this.props.colIndex === 0 && // once per row
|
|
935
|
+
this.props.columnId === prevProps.columnId && // if this is still the same column
|
|
936
|
+
this.props.rowIndex === prevProps.rowIndex && // if this is still the same row
|
|
937
|
+
((_this$props$style = this.props.style) === null || _this$props$style === void 0 ? void 0 : _this$props$style.top) !== ((_prevProps$style = prevProps.style) === null || _prevProps$style === void 0 ? void 0 : _prevProps$style.top) // if the top position has changed
|
|
938
|
+
) {
|
|
939
|
+
var _prevProps$style2, _this$props$style2, _this$props$rowHeight3, _this$props$rowHeight4;
|
|
940
|
+
|
|
941
|
+
var previousTop = parseFloat((_prevProps$style2 = prevProps.style) === null || _prevProps$style2 === void 0 ? void 0 : _prevProps$style2.top);
|
|
942
|
+
var currentTop = parseFloat((_this$props$style2 = this.props.style) === null || _this$props$style2 === void 0 ? void 0 : _this$props$style2.top);
|
|
943
|
+
(_this$props$rowHeight3 = this.props.rowHeightUtils) === null || _this$props$rowHeight3 === void 0 ? void 0 : _this$props$rowHeight3.compensateForLayoutShift(this.props.rowIndex, currentTop - previousTop, (_this$props$rowHeight4 = this.props.rowHeightsOptions) === null || _this$props$rowHeight4 === void 0 ? void 0 : _this$props$rowHeight4.scrollAnchorRow);
|
|
944
|
+
}
|
|
945
|
+
|
|
926
946
|
if (this.props.popoverContext.popoverIsOpen !== prevProps.popoverContext.popoverIsOpen || this.props.popoverContext.cellLocation !== prevProps.popoverContext.cellLocation || this.props.renderCellPopover !== prevProps.renderCellPopover) {
|
|
927
947
|
this.handleCellPopover();
|
|
928
948
|
}
|
|
@@ -1572,7 +1592,15 @@ EuiDataGridCell.propTypes = {
|
|
|
1572
1592
|
* Optional callback returning the current `rowHeightsOptions` when changes occur from user input (e.g. toolbar display controls).
|
|
1573
1593
|
* Can be used for, e.g. storing user `rowHeightsOptions` in a local storage object.
|
|
1574
1594
|
*/
|
|
1575
|
-
onChange: PropTypes.func
|
|
1595
|
+
onChange: PropTypes.func,
|
|
1596
|
+
|
|
1597
|
+
/**
|
|
1598
|
+
* Optional indicator of the row that should be used as an anchor for vertical layout shift compensation.
|
|
1599
|
+
* When set to 'start' or 'center', the topmost or middle visible row will try
|
|
1600
|
+
* to compensate for changes in their top offsets by adjusting the grid's scroll
|
|
1601
|
+
* position.
|
|
1602
|
+
*/
|
|
1603
|
+
scrollAnchorRow: PropTypes.oneOf(["start", "center", undefined])
|
|
1576
1604
|
}),
|
|
1577
1605
|
rowHeightUtils: PropTypes.any,
|
|
1578
1606
|
rowManager: PropTypes.shape({
|
|
@@ -559,7 +559,7 @@ EuiDataGridHeaderRow.propTypes = {
|
|
|
559
559
|
/**
|
|
560
560
|
* The color associated with this data type; it's used to color the icon token
|
|
561
561
|
*/
|
|
562
|
-
color: PropTypes.oneOfType([PropTypes.oneOfType([PropTypes.
|
|
562
|
+
color: PropTypes.oneOfType([PropTypes.oneOfType([PropTypes.any.isRequired, PropTypes.string.isRequired]).isRequired, PropTypes.string.isRequired]),
|
|
563
563
|
|
|
564
564
|
/**
|
|
565
565
|
* Text for how to represent an ascending sort of this data type, e.g. 'A -> Z'
|
|
@@ -207,7 +207,7 @@ EuiDataGridColumnSortingDraggable.propTypes = {
|
|
|
207
207
|
/**
|
|
208
208
|
* The color associated with this data type; it's used to color the icon token
|
|
209
209
|
*/
|
|
210
|
-
color: PropTypes.oneOfType([PropTypes.oneOfType([PropTypes.
|
|
210
|
+
color: PropTypes.oneOfType([PropTypes.oneOfType([PropTypes.any.isRequired, PropTypes.string.isRequired]).isRequired, PropTypes.string.isRequired]),
|
|
211
211
|
|
|
212
212
|
/**
|
|
213
213
|
* Text for how to represent an ascending sort of this data type, e.g. 'A -> Z'
|
|
@@ -922,7 +922,7 @@ EuiDataGrid.propTypes = {
|
|
|
922
922
|
/**
|
|
923
923
|
* The color associated with this data type; it's used to color the icon token
|
|
924
924
|
*/
|
|
925
|
-
color: PropTypes.oneOfType([PropTypes.oneOfType([PropTypes.
|
|
925
|
+
color: PropTypes.oneOfType([PropTypes.oneOfType([PropTypes.any.isRequired, PropTypes.string.isRequired]).isRequired, PropTypes.string.isRequired]),
|
|
926
926
|
|
|
927
927
|
/**
|
|
928
928
|
* Text for how to represent an ascending sort of this data type, e.g. 'A -> Z'
|
|
@@ -1253,7 +1253,15 @@ EuiDataGrid.propTypes = {
|
|
|
1253
1253
|
* Optional callback returning the current `rowHeightsOptions` when changes occur from user input (e.g. toolbar display controls).
|
|
1254
1254
|
* Can be used for, e.g. storing user `rowHeightsOptions` in a local storage object.
|
|
1255
1255
|
*/
|
|
1256
|
-
onChange: PropTypes.func
|
|
1256
|
+
onChange: PropTypes.func,
|
|
1257
|
+
|
|
1258
|
+
/**
|
|
1259
|
+
* Optional indicator of the row that should be used as an anchor for vertical layout shift compensation.
|
|
1260
|
+
* When set to 'start' or 'center', the topmost or middle visible row will try
|
|
1261
|
+
* to compensate for changes in their top offsets by adjusting the grid's scroll
|
|
1262
|
+
* position.
|
|
1263
|
+
*/
|
|
1264
|
+
scrollAnchorRow: PropTypes.oneOf(["start", "center", undefined])
|
|
1257
1265
|
})
|
|
1258
1266
|
};
|
|
1259
1267
|
EuiDataGrid.displayName = 'EuiDataGrid';
|
|
@@ -33,9 +33,9 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
33
33
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
34
34
|
* Side Public License, v 1.
|
|
35
35
|
*/
|
|
36
|
-
import {
|
|
37
|
-
import { isObject, isNumber } from '../../../services/predicate';
|
|
36
|
+
import { useCallback, useContext, useEffect, useMemo, useState } from 'react';
|
|
38
37
|
import { useForceRender, useLatest } from '../../../services';
|
|
38
|
+
import { isNumber, isObject } from '../../../services/predicate';
|
|
39
39
|
import { DataGridSortingContext } from './sorting'; // TODO: Once JS variables are available, use them here instead of hard-coded maps
|
|
40
40
|
|
|
41
41
|
export var cellPaddingsMap = {
|
|
@@ -46,12 +46,14 @@ export var cellPaddingsMap = {
|
|
|
46
46
|
export var AUTO_HEIGHT = 'auto';
|
|
47
47
|
export var DEFAULT_ROW_HEIGHT = 34;
|
|
48
48
|
export var RowHeightUtils = /*#__PURE__*/function () {
|
|
49
|
-
function RowHeightUtils(gridRef, rerenderGridBodyRef) {
|
|
49
|
+
function RowHeightUtils(gridRef, outerGridElementRef, gridItemsRenderedRef, rerenderGridBodyRef) {
|
|
50
50
|
var _this = this;
|
|
51
51
|
|
|
52
52
|
_classCallCheck(this, RowHeightUtils);
|
|
53
53
|
|
|
54
54
|
this.gridRef = gridRef;
|
|
55
|
+
this.outerGridElementRef = outerGridElementRef;
|
|
56
|
+
this.gridItemsRenderedRef = gridItemsRenderedRef;
|
|
55
57
|
this.rerenderGridBodyRef = rerenderGridBodyRef;
|
|
56
58
|
|
|
57
59
|
_defineProperty(this, "styles", {
|
|
@@ -247,6 +249,31 @@ export var RowHeightUtils = /*#__PURE__*/function () {
|
|
|
247
249
|
(_this$gridRef$current = this.gridRef.current) === null || _this$gridRef$current === void 0 ? void 0 : _this$gridRef$current.resetAfterRowIndex(this.lastUpdatedRow);
|
|
248
250
|
this.lastUpdatedRow = Infinity;
|
|
249
251
|
}
|
|
252
|
+
}, {
|
|
253
|
+
key: "compensateForLayoutShift",
|
|
254
|
+
value: function compensateForLayoutShift(rowIndex, verticalLayoutShift, anchorRow) {
|
|
255
|
+
var grid = this.gridRef.current;
|
|
256
|
+
var outerGridElement = this.outerGridElementRef.current;
|
|
257
|
+
var renderedItems = this.gridItemsRenderedRef.current;
|
|
258
|
+
|
|
259
|
+
if (grid == null || outerGridElement == null || renderedItems == null || anchorRow == null || !Number.isFinite(verticalLayoutShift)) {
|
|
260
|
+
return;
|
|
261
|
+
} // skip if the start row is the anchor row but it hasn't shifted
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
if (anchorRow === 'start' && renderedItems.visibleRowStartIndex !== rowIndex) {
|
|
265
|
+
return;
|
|
266
|
+
} // skip if the center row is the anchor row but it hasn't shifted
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
if (anchorRow === 'center' && Math.floor((renderedItems.visibleRowStopIndex - renderedItems.visibleRowStartIndex) / 2) !== rowIndex) {
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
grid.scrollTo({
|
|
274
|
+
scrollTop: outerGridElement.scrollTop + verticalLayoutShift
|
|
275
|
+
});
|
|
276
|
+
}
|
|
250
277
|
}]);
|
|
251
278
|
|
|
252
279
|
return RowHeightUtils;
|
|
@@ -258,13 +285,15 @@ export var RowHeightUtils = /*#__PURE__*/function () {
|
|
|
258
285
|
|
|
259
286
|
export var useRowHeightUtils = function useRowHeightUtils(_ref2) {
|
|
260
287
|
var gridRef = _ref2.gridRef,
|
|
288
|
+
outerGridElementRef = _ref2.outerGridElementRef,
|
|
289
|
+
gridItemsRenderedRef = _ref2.gridItemsRenderedRef,
|
|
261
290
|
gridStyles = _ref2.gridStyles,
|
|
262
291
|
columns = _ref2.columns,
|
|
263
292
|
rowHeightsOptions = _ref2.rowHeightsOptions;
|
|
264
293
|
var forceRenderRef = useLatest(useForceRender());
|
|
265
294
|
|
|
266
295
|
var _useState = useState(function () {
|
|
267
|
-
return new RowHeightUtils(gridRef, forceRenderRef);
|
|
296
|
+
return new RowHeightUtils(gridRef, outerGridElementRef, gridItemsRenderedRef, forceRenderRef);
|
|
268
297
|
}),
|
|
269
298
|
_useState2 = _slicedToArray(_useState, 1),
|
|
270
299
|
rowHeightUtils = _useState2[0]; // Forces a rerender whenever the row heights change, as this can cause the
|
|
@@ -674,7 +674,7 @@ EuiSuperDatePickerInternal.propTypes = {
|
|
|
674
674
|
* Forces state to be `iconOnly` when within provided breakpoints.
|
|
675
675
|
* Remove completely with `false` or provide your own list of breakpoints.
|
|
676
676
|
*/
|
|
677
|
-
responsive: PropTypes.oneOfType([PropTypes.oneOf([false]), PropTypes.arrayOf(PropTypes.
|
|
677
|
+
responsive: PropTypes.oneOfType([PropTypes.oneOf([false]), PropTypes.arrayOf(PropTypes.any.isRequired).isRequired])
|
|
678
678
|
}),
|
|
679
679
|
timeOptions: PropTypes.shape({
|
|
680
680
|
timeTenseOptions: PropTypes.arrayOf(PropTypes.any.isRequired).isRequired,
|
|
@@ -810,6 +810,6 @@ EuiSuperDatePicker.propTypes = {
|
|
|
810
810
|
onMouseOut: PropTypes.func
|
|
811
811
|
}),
|
|
812
812
|
iconOnly: PropTypes.bool,
|
|
813
|
-
responsive: PropTypes.oneOfType([PropTypes.oneOf([false]), PropTypes.arrayOf(PropTypes.
|
|
813
|
+
responsive: PropTypes.oneOfType([PropTypes.oneOf([false]), PropTypes.arrayOf(PropTypes.any.isRequired).isRequired])
|
|
814
814
|
})
|
|
815
815
|
};
|
|
@@ -287,5 +287,5 @@ EuiSuperUpdateButton.propTypes = {
|
|
|
287
287
|
* Forces state to be `iconOnly` when within provided breakpoints.
|
|
288
288
|
* Remove completely with `false` or provide your own list of breakpoints.
|
|
289
289
|
*/
|
|
290
|
-
responsive: PropTypes.oneOfType([PropTypes.oneOf([false]), PropTypes.arrayOf(PropTypes.
|
|
290
|
+
responsive: PropTypes.oneOfType([PropTypes.oneOf([false]), PropTypes.arrayOf(PropTypes.any.isRequired).isRequired])
|
|
291
291
|
};
|