@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
|
@@ -153,7 +153,7 @@ var EuiCodeBlock = function EuiCodeBlock(_ref) {
|
|
|
153
153
|
}),
|
|
154
154
|
innerTextRef = _useCopy.innerTextRef,
|
|
155
155
|
showCopyButton = _useCopy.showCopyButton,
|
|
156
|
-
|
|
156
|
+
textToCopy = _useCopy.textToCopy;
|
|
157
157
|
|
|
158
158
|
var _useOverflowDetection = useOverflowDetection(),
|
|
159
159
|
setWrapperRef = _useOverflowDetection.setWrapperRef,
|
|
@@ -166,8 +166,8 @@ var EuiCodeBlock = function EuiCodeBlock(_ref) {
|
|
|
166
166
|
}),
|
|
167
167
|
showFullScreenButton = _useFullScreen.showFullScreenButton,
|
|
168
168
|
onKeyDown = _useFullScreen.onKeyDown,
|
|
169
|
-
|
|
170
|
-
|
|
169
|
+
isFullScreen = _useFullScreen.isFullScreen,
|
|
170
|
+
toggleFullScreen = _useFullScreen.toggleFullScreen; // Classes used in both fullscreen and non-fullscreen mode
|
|
171
171
|
|
|
172
172
|
|
|
173
173
|
var wrapperClasses = (0, _classnames.default)(className, 'euiCodeBlock', {
|
|
@@ -197,25 +197,32 @@ var EuiCodeBlock = function EuiCodeBlock(_ref) {
|
|
|
197
197
|
onKeyDown: onKeyDown
|
|
198
198
|
};
|
|
199
199
|
}, [preClasses, onKeyDown]);
|
|
200
|
-
var
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
var wrapperProps = {
|
|
208
|
-
className: classes,
|
|
209
|
-
style: optionalStyles
|
|
210
|
-
};
|
|
211
|
-
var codeBlockControls;
|
|
212
|
-
|
|
213
|
-
if (showCopyButton || showFullScreenButton) {
|
|
214
|
-
codeBlockControls = (0, _react2.jsx)("div", {
|
|
215
|
-
className: "euiCodeBlock__controls"
|
|
216
|
-
}, (0, _react2.jsx)(FullScreenButton, null), (0, _react2.jsx)(CopyButton, null));
|
|
217
|
-
}
|
|
200
|
+
var overflowHeightStyles = (0, _react.useMemo)(function () {
|
|
201
|
+
if (overflowHeight) {
|
|
202
|
+
var property = typeof overflowHeight === 'string' ? 'height' : 'maxHeight';
|
|
203
|
+
return _defineProperty({}, property, overflowHeight);
|
|
204
|
+
}
|
|
218
205
|
|
|
206
|
+
return {};
|
|
207
|
+
}, [overflowHeight]);
|
|
208
|
+
var wrapperProps = (0, _react.useMemo)(function () {
|
|
209
|
+
return {
|
|
210
|
+
className: classes,
|
|
211
|
+
style: overflowHeightStyles
|
|
212
|
+
};
|
|
213
|
+
}, [classes, overflowHeightStyles]);
|
|
214
|
+
var codeBlockControls = (0, _react.useMemo)(function () {
|
|
215
|
+
if (showCopyButton || showFullScreenButton) {
|
|
216
|
+
return (0, _react2.jsx)("div", {
|
|
217
|
+
className: "euiCodeBlock__controls"
|
|
218
|
+
}, showFullScreenButton && (0, _react2.jsx)(FullScreenButton, {
|
|
219
|
+
isFullScreen: isFullScreen,
|
|
220
|
+
toggleFullScreen: toggleFullScreen
|
|
221
|
+
}), showCopyButton && (0, _react2.jsx)(CopyButton, {
|
|
222
|
+
textToCopy: textToCopy
|
|
223
|
+
}));
|
|
224
|
+
}
|
|
225
|
+
}, [isFullScreen, toggleFullScreen, showCopyButton, showFullScreenButton, textToCopy]);
|
|
219
226
|
return (0, _react2.jsx)("div", wrapperProps, isVirtualized ? (0, _react2.jsx)(VirtualizedCodeBlock, {
|
|
220
227
|
data: data,
|
|
221
228
|
rowHeight: fontSizeToRowHeightMap[fontSize],
|
|
@@ -225,10 +232,10 @@ var EuiCodeBlock = function EuiCodeBlock(_ref) {
|
|
|
225
232
|
codeProps: codeProps
|
|
226
233
|
}) : (0, _react2.jsx)("pre", {
|
|
227
234
|
ref: combinedRef,
|
|
228
|
-
style:
|
|
235
|
+
style: overflowHeightStyles,
|
|
229
236
|
className: preClasses,
|
|
230
237
|
tabIndex: tabIndex
|
|
231
|
-
}, (0, _react2.jsx)("code", codeProps, content)), codeBlockControls, (0, _react2.jsx)(FullScreenDisplay, {
|
|
238
|
+
}, (0, _react2.jsx)("code", codeProps, content)), codeBlockControls, isFullScreen && (0, _react2.jsx)(FullScreenDisplay, {
|
|
232
239
|
className: wrapperClasses
|
|
233
240
|
}, isVirtualized ? (0, _react2.jsx)(VirtualizedCodeBlock, {
|
|
234
241
|
data: data,
|
|
@@ -340,10 +347,31 @@ var useOverflowDetection = function useOverflowDetection() {
|
|
|
340
347
|
*/
|
|
341
348
|
|
|
342
349
|
|
|
343
|
-
var
|
|
344
|
-
var
|
|
345
|
-
|
|
346
|
-
|
|
350
|
+
var CopyButton = function CopyButton(_ref3) {
|
|
351
|
+
var textToCopy = _ref3.textToCopy;
|
|
352
|
+
var copyButton = (0, _i18n.useEuiI18n)('euiCodeBlock.copyButton', 'Copy');
|
|
353
|
+
return (0, _react2.jsx)("div", {
|
|
354
|
+
className: "euiCodeBlock__copyButton"
|
|
355
|
+
}, (0, _react2.jsx)(_copy.EuiCopy, {
|
|
356
|
+
textToCopy: textToCopy
|
|
357
|
+
}, function (copy) {
|
|
358
|
+
return (0, _react2.jsx)(_button.EuiButtonIcon, {
|
|
359
|
+
onClick: copy,
|
|
360
|
+
iconType: "copyClipboard",
|
|
361
|
+
color: "text",
|
|
362
|
+
"aria-label": copyButton
|
|
363
|
+
});
|
|
364
|
+
}));
|
|
365
|
+
};
|
|
366
|
+
|
|
367
|
+
CopyButton.propTypes = {
|
|
368
|
+
textToCopy: _propTypes.default.string.isRequired
|
|
369
|
+
};
|
|
370
|
+
|
|
371
|
+
var useCopy = function useCopy(_ref4) {
|
|
372
|
+
var isCopyable = _ref4.isCopyable,
|
|
373
|
+
isVirtualized = _ref4.isVirtualized,
|
|
374
|
+
children = _ref4.children;
|
|
347
375
|
|
|
348
376
|
var _useInnerText = (0, _inner_text.useInnerText)(''),
|
|
349
377
|
_useInnerText2 = _slicedToArray(_useInnerText, 2),
|
|
@@ -356,32 +384,10 @@ var useCopy = function useCopy(_ref2) {
|
|
|
356
384
|
var textToCopy = isVirtualized ? "".concat(children) : innerText; // Virtualized code blocks do not have inner text
|
|
357
385
|
|
|
358
386
|
var showCopyButton = isCopyable && textToCopy;
|
|
359
|
-
|
|
360
|
-
var CopyButton = function CopyButton() {
|
|
361
|
-
if (!showCopyButton) return null;
|
|
362
|
-
return (0, _react2.jsx)("div", {
|
|
363
|
-
className: "euiCodeBlock__copyButton"
|
|
364
|
-
}, (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
365
|
-
token: "euiCodeBlock.copyButton",
|
|
366
|
-
default: "Copy"
|
|
367
|
-
}, function (copyButton) {
|
|
368
|
-
return (0, _react2.jsx)(_copy.EuiCopy, {
|
|
369
|
-
textToCopy: textToCopy
|
|
370
|
-
}, function (copy) {
|
|
371
|
-
return (0, _react2.jsx)(_button.EuiButtonIcon, {
|
|
372
|
-
onClick: copy,
|
|
373
|
-
iconType: "copyClipboard",
|
|
374
|
-
color: "text",
|
|
375
|
-
"aria-label": copyButton
|
|
376
|
-
});
|
|
377
|
-
});
|
|
378
|
-
}));
|
|
379
|
-
};
|
|
380
|
-
|
|
381
387
|
return {
|
|
382
388
|
innerTextRef: innerTextRef,
|
|
383
389
|
showCopyButton: showCopyButton,
|
|
384
|
-
|
|
390
|
+
textToCopy: textToCopy
|
|
385
391
|
};
|
|
386
392
|
};
|
|
387
393
|
/**
|
|
@@ -389,18 +395,59 @@ var useCopy = function useCopy(_ref2) {
|
|
|
389
395
|
*/
|
|
390
396
|
|
|
391
397
|
|
|
392
|
-
var
|
|
393
|
-
var
|
|
398
|
+
var FullScreenButton = function FullScreenButton(_ref5) {
|
|
399
|
+
var isFullScreen = _ref5.isFullScreen,
|
|
400
|
+
toggleFullScreen = _ref5.toggleFullScreen;
|
|
401
|
+
|
|
402
|
+
var _useEuiI18n = (0, _i18n.useEuiI18n)(['euiCodeBlock.fullscreenCollapse', 'euiCodeBlock.fullscreenExpand'], ['Collapse', 'Expand']),
|
|
403
|
+
_useEuiI18n2 = _slicedToArray(_useEuiI18n, 2),
|
|
404
|
+
fullscreenCollapse = _useEuiI18n2[0],
|
|
405
|
+
fullscreenExpand = _useEuiI18n2[1];
|
|
406
|
+
|
|
407
|
+
return (0, _react2.jsx)(_button.EuiButtonIcon, {
|
|
408
|
+
className: "euiCodeBlock__fullScreenButton",
|
|
409
|
+
onClick: toggleFullScreen,
|
|
410
|
+
iconType: isFullScreen ? 'fullScreenExit' : 'fullScreen',
|
|
411
|
+
color: "text",
|
|
412
|
+
"aria-label": isFullScreen ? fullscreenCollapse : fullscreenExpand
|
|
413
|
+
});
|
|
414
|
+
};
|
|
415
|
+
|
|
416
|
+
FullScreenButton.propTypes = {
|
|
417
|
+
isFullScreen: _propTypes.default.bool.isRequired,
|
|
418
|
+
toggleFullScreen: _propTypes.default.func.isRequired
|
|
419
|
+
};
|
|
420
|
+
|
|
421
|
+
var FullScreenDisplay = function FullScreenDisplay(_ref6) {
|
|
422
|
+
var children = _ref6.children,
|
|
423
|
+
className = _ref6.className;
|
|
424
|
+
// Force fullscreen to use large font and padding.
|
|
425
|
+
var fullScreenClasses = (0, _classnames.default)(className, 'euiCodeBlock--fontLarge', 'euiCodeBlock--paddingLarge', 'euiCodeBlock-isFullScreen'); // Attaches to the body because of EuiOverlayMask's React portal usage.
|
|
426
|
+
|
|
427
|
+
return (0, _react2.jsx)(_overlay_mask.EuiOverlayMask, null, (0, _react2.jsx)(_focus_trap.EuiFocusTrap, {
|
|
428
|
+
clickOutsideDisables: true
|
|
429
|
+
}, (0, _react2.jsx)("div", {
|
|
430
|
+
className: fullScreenClasses
|
|
431
|
+
}, children)));
|
|
432
|
+
};
|
|
433
|
+
|
|
434
|
+
FullScreenDisplay.propTypes = {
|
|
435
|
+
className: _propTypes.default.string.isRequired
|
|
436
|
+
};
|
|
437
|
+
|
|
438
|
+
var useFullScreen = function useFullScreen(_ref7) {
|
|
439
|
+
var overflowHeight = _ref7.overflowHeight;
|
|
394
440
|
|
|
395
441
|
var _useState5 = (0, _react.useState)(false),
|
|
396
442
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
397
443
|
isFullScreen = _useState6[0],
|
|
398
444
|
setIsFullScreen = _useState6[1];
|
|
399
445
|
|
|
400
|
-
var toggleFullScreen = function
|
|
401
|
-
setIsFullScreen(
|
|
402
|
-
|
|
403
|
-
|
|
446
|
+
var toggleFullScreen = (0, _react.useCallback)(function () {
|
|
447
|
+
setIsFullScreen(function (isFullScreen) {
|
|
448
|
+
return !isFullScreen;
|
|
449
|
+
});
|
|
450
|
+
}, []);
|
|
404
451
|
var onKeyDown = (0, _react.useCallback)(function (event) {
|
|
405
452
|
if (event.key === _services.keys.ESCAPE) {
|
|
406
453
|
event.preventDefault();
|
|
@@ -409,45 +456,10 @@ var useFullScreen = function useFullScreen(_ref3) {
|
|
|
409
456
|
}
|
|
410
457
|
}, []);
|
|
411
458
|
var showFullScreenButton = !!overflowHeight;
|
|
412
|
-
|
|
413
|
-
var FullScreenButton = function FullScreenButton() {
|
|
414
|
-
if (!showFullScreenButton) return null;
|
|
415
|
-
return (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
416
|
-
tokens: ['euiCodeBlock.fullscreenCollapse', 'euiCodeBlock.fullscreenExpand'],
|
|
417
|
-
defaults: ['Collapse', 'Expand']
|
|
418
|
-
}, function (_ref4) {
|
|
419
|
-
var _ref5 = _slicedToArray(_ref4, 2),
|
|
420
|
-
fullscreenCollapse = _ref5[0],
|
|
421
|
-
fullscreenExpand = _ref5[1];
|
|
422
|
-
|
|
423
|
-
return (0, _react2.jsx)(_button.EuiButtonIcon, {
|
|
424
|
-
className: "euiCodeBlock__fullScreenButton",
|
|
425
|
-
onClick: toggleFullScreen,
|
|
426
|
-
iconType: isFullScreen ? 'fullScreenExit' : 'fullScreen',
|
|
427
|
-
color: "text",
|
|
428
|
-
"aria-label": isFullScreen ? fullscreenCollapse : fullscreenExpand
|
|
429
|
-
});
|
|
430
|
-
});
|
|
431
|
-
};
|
|
432
|
-
|
|
433
|
-
var FullScreenDisplay = function FullScreenDisplay(_ref6) {
|
|
434
|
-
var children = _ref6.children,
|
|
435
|
-
className = _ref6.className;
|
|
436
|
-
if (!isFullScreen) return null; // Force fullscreen to use large font and padding.
|
|
437
|
-
|
|
438
|
-
var fullScreenClasses = (0, _classnames.default)(className, 'euiCodeBlock--fontLarge', 'euiCodeBlock--paddingLarge', 'euiCodeBlock-isFullScreen'); // Attaches to the body because of EuiOverlayMask's React portal usage.
|
|
439
|
-
|
|
440
|
-
return (0, _react2.jsx)(_overlay_mask.EuiOverlayMask, null, (0, _react2.jsx)(_focus_trap.EuiFocusTrap, {
|
|
441
|
-
clickOutsideDisables: true
|
|
442
|
-
}, (0, _react2.jsx)("div", {
|
|
443
|
-
className: fullScreenClasses
|
|
444
|
-
}, children)));
|
|
445
|
-
};
|
|
446
|
-
|
|
447
459
|
return {
|
|
448
460
|
showFullScreenButton: showFullScreenButton,
|
|
449
|
-
|
|
450
|
-
|
|
461
|
+
isFullScreen: isFullScreen,
|
|
462
|
+
toggleFullScreen: toggleFullScreen,
|
|
451
463
|
onKeyDown: onKeyDown
|
|
452
464
|
};
|
|
453
465
|
};
|
|
@@ -456,21 +468,21 @@ var useFullScreen = function useFullScreen(_ref3) {
|
|
|
456
468
|
*/
|
|
457
469
|
|
|
458
470
|
|
|
459
|
-
var ListRow = function ListRow(
|
|
460
|
-
var data =
|
|
461
|
-
index =
|
|
462
|
-
style =
|
|
471
|
+
var ListRow = function ListRow(_ref8) {
|
|
472
|
+
var data = _ref8.data,
|
|
473
|
+
index = _ref8.index,
|
|
474
|
+
style = _ref8.style;
|
|
463
475
|
var row = data[index];
|
|
464
476
|
row.properties.style = style;
|
|
465
477
|
return (0, _utils.nodeToHtml)(row, index, data, 0);
|
|
466
478
|
};
|
|
467
479
|
|
|
468
|
-
var VirtualizedCodeBlock = function VirtualizedCodeBlock(
|
|
469
|
-
var data =
|
|
470
|
-
rowHeight =
|
|
471
|
-
overflowHeight =
|
|
472
|
-
preProps =
|
|
473
|
-
codeProps =
|
|
480
|
+
var VirtualizedCodeBlock = function VirtualizedCodeBlock(_ref9) {
|
|
481
|
+
var data = _ref9.data,
|
|
482
|
+
rowHeight = _ref9.rowHeight,
|
|
483
|
+
overflowHeight = _ref9.overflowHeight,
|
|
484
|
+
preProps = _ref9.preProps,
|
|
485
|
+
codeProps = _ref9.codeProps;
|
|
474
486
|
var VirtualizedOuterElement = (0, _react.useMemo)(function () {
|
|
475
487
|
return /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
476
488
|
return (0, _react2.jsx)("pre", _extends({}, props, {
|
|
@@ -487,9 +499,9 @@ var VirtualizedCodeBlock = function VirtualizedCodeBlock(_ref8) {
|
|
|
487
499
|
}, [codeProps]);
|
|
488
500
|
return (0, _react2.jsx)(_auto_sizer.EuiAutoSizer, {
|
|
489
501
|
disableHeight: typeof overflowHeight === 'number'
|
|
490
|
-
}, function (
|
|
491
|
-
var height =
|
|
492
|
-
width =
|
|
502
|
+
}, function (_ref10) {
|
|
503
|
+
var height = _ref10.height,
|
|
504
|
+
width = _ref10.width;
|
|
493
505
|
return (0, _react2.jsx)(_reactWindow.FixedSizeList, {
|
|
494
506
|
height: height !== null && height !== void 0 ? height : overflowHeight,
|
|
495
507
|
width: width,
|
|
@@ -281,7 +281,7 @@ EuiCollapsibleNav.propTypes = {
|
|
|
281
281
|
/**
|
|
282
282
|
* Named breakpoint or pixel value for customizing the minimum window width to enable docking
|
|
283
283
|
*/
|
|
284
|
-
pushMinBreakpoint: _propTypes.default.oneOfType([_propTypes.default.
|
|
284
|
+
pushMinBreakpoint: _propTypes.default.oneOfType([_propTypes.default.any.isRequired, _propTypes.default.number.isRequired]),
|
|
285
285
|
style: _propTypes.default.any,
|
|
286
286
|
|
|
287
287
|
/**
|
|
@@ -305,7 +305,7 @@ EuiCollapsibleNav.propTypes = {
|
|
|
305
305
|
* Keeps navigation flyout visible and push `<body>` content via padding
|
|
306
306
|
*/
|
|
307
307
|
isDocked: _propTypes.default.bool,
|
|
308
|
-
dockedBreakpoint: _propTypes.default.oneOfType([_propTypes.default.
|
|
308
|
+
dockedBreakpoint: _propTypes.default.oneOfType([_propTypes.default.any.isRequired, _propTypes.default.number.isRequired]),
|
|
309
309
|
|
|
310
310
|
/**
|
|
311
311
|
* Button for controlling visible state of the nav
|
|
@@ -383,6 +383,7 @@ EuiControlBar.propTypes = {
|
|
|
383
383
|
"aria-label": _propTypes.default.string,
|
|
384
384
|
"data-test-subj": _propTypes.default.string,
|
|
385
385
|
href: _propTypes.default.string,
|
|
386
|
+
rel: _propTypes.default.string,
|
|
386
387
|
onClick: _propTypes.default.func,
|
|
387
388
|
|
|
388
389
|
/**
|
|
@@ -405,6 +406,18 @@ EuiControlBar.propTypes = {
|
|
|
405
406
|
*/
|
|
406
407
|
"aria-current": _propTypes.default.any
|
|
407
408
|
}).isRequired),
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* Determines breadcrumbs appearance, with `page` being the default styling.
|
|
412
|
+
* Application breadcrumbs should only be once per page, in (e.g.) EuiHeader
|
|
413
|
+
*/
|
|
414
|
+
type: _propTypes.default.oneOf(["page", "application"]),
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* Whether the last breadcrumb should visually (and accessibly, to screen readers)
|
|
418
|
+
* be highlighted as the current page. Defaults to true.
|
|
419
|
+
*/
|
|
420
|
+
lastBreadcrumbIsCurrentPage: _propTypes.default.bool,
|
|
408
421
|
text: _propTypes.default.node,
|
|
409
422
|
iconType: _propTypes.default.string
|
|
410
423
|
}).isRequired).isRequired,
|
|
@@ -373,6 +373,8 @@ var EuiDataGridBody = function EuiDataGridBody(props) {
|
|
|
373
373
|
|
|
374
374
|
var rowHeightUtils = (0, _row_heights.useRowHeightUtils)({
|
|
375
375
|
gridRef: gridRef,
|
|
376
|
+
outerGridElementRef: outerGridRef,
|
|
377
|
+
gridItemsRenderedRef: gridItemsRendered,
|
|
376
378
|
gridStyles: gridStyles,
|
|
377
379
|
columns: columns,
|
|
378
380
|
rowHeightsOptions: rowHeightsOptions
|
|
@@ -959,7 +961,7 @@ EuiDataGridBody.propTypes = {
|
|
|
959
961
|
/**
|
|
960
962
|
* The color associated with this data type; it's used to color the icon token
|
|
961
963
|
*/
|
|
962
|
-
color: _propTypes.default.oneOfType([_propTypes.default.oneOfType([_propTypes.default.
|
|
964
|
+
color: _propTypes.default.oneOfType([_propTypes.default.oneOfType([_propTypes.default.any.isRequired, _propTypes.default.string.isRequired]).isRequired, _propTypes.default.string.isRequired]),
|
|
963
965
|
|
|
964
966
|
/**
|
|
965
967
|
* Text for how to represent an ascending sort of this data type, e.g. 'A -> Z'
|
|
@@ -1057,7 +1059,15 @@ EuiDataGridBody.propTypes = {
|
|
|
1057
1059
|
* Optional callback returning the current `rowHeightsOptions` when changes occur from user input (e.g. toolbar display controls).
|
|
1058
1060
|
* Can be used for, e.g. storing user `rowHeightsOptions` in a local storage object.
|
|
1059
1061
|
*/
|
|
1060
|
-
onChange: _propTypes.default.func
|
|
1062
|
+
onChange: _propTypes.default.func,
|
|
1063
|
+
|
|
1064
|
+
/**
|
|
1065
|
+
* Optional indicator of the row that should be used as an anchor for vertical layout shift compensation.
|
|
1066
|
+
* When set to 'start' or 'center', the topmost or middle visible row will try
|
|
1067
|
+
* to compensate for changes in their top offsets by adjusting the grid's scroll
|
|
1068
|
+
* position.
|
|
1069
|
+
*/
|
|
1070
|
+
scrollAnchorRow: _propTypes.default.oneOf(["start", "center", undefined])
|
|
1061
1071
|
}),
|
|
1062
1072
|
isFullScreen: _propTypes.default.bool.isRequired,
|
|
1063
1073
|
gridStyles: _propTypes.default.shape({
|
|
@@ -565,7 +565,15 @@ EuiDataGridCellContent.propTypes = {
|
|
|
565
565
|
* Optional callback returning the current `rowHeightsOptions` when changes occur from user input (e.g. toolbar display controls).
|
|
566
566
|
* Can be used for, e.g. storing user `rowHeightsOptions` in a local storage object.
|
|
567
567
|
*/
|
|
568
|
-
onChange: _propTypes.default.func
|
|
568
|
+
onChange: _propTypes.default.func,
|
|
569
|
+
|
|
570
|
+
/**
|
|
571
|
+
* Optional indicator of the row that should be used as an anchor for vertical layout shift compensation.
|
|
572
|
+
* When set to 'start' or 'center', the topmost or middle visible row will try
|
|
573
|
+
* to compensate for changes in their top offsets by adjusting the grid's scroll
|
|
574
|
+
* position.
|
|
575
|
+
*/
|
|
576
|
+
scrollAnchorRow: _propTypes.default.oneOf(["start", "center", undefined])
|
|
569
577
|
}),
|
|
570
578
|
rowHeightUtils: _propTypes.default.any,
|
|
571
579
|
pagination: _propTypes.default.shape({
|
|
@@ -935,7 +943,7 @@ var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
935
943
|
}, {
|
|
936
944
|
key: "componentDidUpdate",
|
|
937
945
|
value: function componentDidUpdate(prevProps) {
|
|
938
|
-
var _this$props$rowHeight, _prevProps$rowHeights;
|
|
946
|
+
var _this$props$rowHeight, _prevProps$rowHeights, _this$props$rowHeight2, _this$props$style, _prevProps$style;
|
|
939
947
|
|
|
940
948
|
this.recalculateAutoHeight();
|
|
941
949
|
|
|
@@ -943,6 +951,18 @@ var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
943
951
|
this.recalculateLineHeight();
|
|
944
952
|
}
|
|
945
953
|
|
|
954
|
+
if ((_this$props$rowHeight2 = this.props.rowHeightsOptions) !== null && _this$props$rowHeight2 !== void 0 && _this$props$rowHeight2.scrollAnchorRow && this.props.colIndex === 0 && // once per row
|
|
955
|
+
this.props.columnId === prevProps.columnId && // if this is still the same column
|
|
956
|
+
this.props.rowIndex === prevProps.rowIndex && // if this is still the same row
|
|
957
|
+
((_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
|
|
958
|
+
) {
|
|
959
|
+
var _prevProps$style2, _this$props$style2, _this$props$rowHeight3, _this$props$rowHeight4;
|
|
960
|
+
|
|
961
|
+
var previousTop = parseFloat((_prevProps$style2 = prevProps.style) === null || _prevProps$style2 === void 0 ? void 0 : _prevProps$style2.top);
|
|
962
|
+
var currentTop = parseFloat((_this$props$style2 = this.props.style) === null || _this$props$style2 === void 0 ? void 0 : _this$props$style2.top);
|
|
963
|
+
(_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);
|
|
964
|
+
}
|
|
965
|
+
|
|
946
966
|
if (this.props.popoverContext.popoverIsOpen !== prevProps.popoverContext.popoverIsOpen || this.props.popoverContext.cellLocation !== prevProps.popoverContext.cellLocation || this.props.renderCellPopover !== prevProps.renderCellPopover) {
|
|
947
967
|
this.handleCellPopover();
|
|
948
968
|
}
|
|
@@ -1592,7 +1612,15 @@ EuiDataGridCell.propTypes = {
|
|
|
1592
1612
|
* Optional callback returning the current `rowHeightsOptions` when changes occur from user input (e.g. toolbar display controls).
|
|
1593
1613
|
* Can be used for, e.g. storing user `rowHeightsOptions` in a local storage object.
|
|
1594
1614
|
*/
|
|
1595
|
-
onChange: _propTypes.default.func
|
|
1615
|
+
onChange: _propTypes.default.func,
|
|
1616
|
+
|
|
1617
|
+
/**
|
|
1618
|
+
* Optional indicator of the row that should be used as an anchor for vertical layout shift compensation.
|
|
1619
|
+
* When set to 'start' or 'center', the topmost or middle visible row will try
|
|
1620
|
+
* to compensate for changes in their top offsets by adjusting the grid's scroll
|
|
1621
|
+
* position.
|
|
1622
|
+
*/
|
|
1623
|
+
scrollAnchorRow: _propTypes.default.oneOf(["start", "center", undefined])
|
|
1596
1624
|
}),
|
|
1597
1625
|
rowHeightUtils: _propTypes.default.any,
|
|
1598
1626
|
rowManager: _propTypes.default.shape({
|
|
@@ -574,7 +574,7 @@ EuiDataGridHeaderRow.propTypes = {
|
|
|
574
574
|
/**
|
|
575
575
|
* The color associated with this data type; it's used to color the icon token
|
|
576
576
|
*/
|
|
577
|
-
color: _propTypes.default.oneOfType([_propTypes.default.oneOfType([_propTypes.default.
|
|
577
|
+
color: _propTypes.default.oneOfType([_propTypes.default.oneOfType([_propTypes.default.any.isRequired, _propTypes.default.string.isRequired]).isRequired, _propTypes.default.string.isRequired]),
|
|
578
578
|
|
|
579
579
|
/**
|
|
580
580
|
* Text for how to represent an ascending sort of this data type, e.g. 'A -> Z'
|
|
@@ -226,7 +226,7 @@ EuiDataGridColumnSortingDraggable.propTypes = {
|
|
|
226
226
|
/**
|
|
227
227
|
* The color associated with this data type; it's used to color the icon token
|
|
228
228
|
*/
|
|
229
|
-
color: _propTypes.default.oneOfType([_propTypes.default.oneOfType([_propTypes.default.
|
|
229
|
+
color: _propTypes.default.oneOfType([_propTypes.default.oneOfType([_propTypes.default.any.isRequired, _propTypes.default.string.isRequired]).isRequired, _propTypes.default.string.isRequired]),
|
|
230
230
|
|
|
231
231
|
/**
|
|
232
232
|
* Text for how to represent an ascending sort of this data type, e.g. 'A -> Z'
|
|
@@ -951,7 +951,7 @@ EuiDataGrid.propTypes = {
|
|
|
951
951
|
/**
|
|
952
952
|
* The color associated with this data type; it's used to color the icon token
|
|
953
953
|
*/
|
|
954
|
-
color: _propTypes.default.oneOfType([_propTypes.default.oneOfType([_propTypes.default.
|
|
954
|
+
color: _propTypes.default.oneOfType([_propTypes.default.oneOfType([_propTypes.default.any.isRequired, _propTypes.default.string.isRequired]).isRequired, _propTypes.default.string.isRequired]),
|
|
955
955
|
|
|
956
956
|
/**
|
|
957
957
|
* Text for how to represent an ascending sort of this data type, e.g. 'A -> Z'
|
|
@@ -1282,7 +1282,15 @@ EuiDataGrid.propTypes = {
|
|
|
1282
1282
|
* Optional callback returning the current `rowHeightsOptions` when changes occur from user input (e.g. toolbar display controls).
|
|
1283
1283
|
* Can be used for, e.g. storing user `rowHeightsOptions` in a local storage object.
|
|
1284
1284
|
*/
|
|
1285
|
-
onChange: _propTypes.default.func
|
|
1285
|
+
onChange: _propTypes.default.func,
|
|
1286
|
+
|
|
1287
|
+
/**
|
|
1288
|
+
* Optional indicator of the row that should be used as an anchor for vertical layout shift compensation.
|
|
1289
|
+
* When set to 'start' or 'center', the topmost or middle visible row will try
|
|
1290
|
+
* to compensate for changes in their top offsets by adjusting the grid's scroll
|
|
1291
|
+
* position.
|
|
1292
|
+
*/
|
|
1293
|
+
scrollAnchorRow: _propTypes.default.oneOf(["start", "center", undefined])
|
|
1286
1294
|
})
|
|
1287
1295
|
};
|
|
1288
1296
|
EuiDataGrid.displayName = 'EuiDataGrid';
|
|
@@ -7,10 +7,10 @@ exports.useRowHeightUtils = exports.useDefaultRowHeight = exports.cellPaddingsMa
|
|
|
7
7
|
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
|
|
10
|
-
var _predicate = require("../../../services/predicate");
|
|
11
|
-
|
|
12
10
|
var _services = require("../../../services");
|
|
13
11
|
|
|
12
|
+
var _predicate = require("../../../services/predicate");
|
|
13
|
+
|
|
14
14
|
var _sorting = require("./sorting");
|
|
15
15
|
|
|
16
16
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
@@ -54,12 +54,14 @@ var DEFAULT_ROW_HEIGHT = 34;
|
|
|
54
54
|
exports.DEFAULT_ROW_HEIGHT = DEFAULT_ROW_HEIGHT;
|
|
55
55
|
|
|
56
56
|
var RowHeightUtils = /*#__PURE__*/function () {
|
|
57
|
-
function RowHeightUtils(gridRef, rerenderGridBodyRef) {
|
|
57
|
+
function RowHeightUtils(gridRef, outerGridElementRef, gridItemsRenderedRef, rerenderGridBodyRef) {
|
|
58
58
|
var _this = this;
|
|
59
59
|
|
|
60
60
|
_classCallCheck(this, RowHeightUtils);
|
|
61
61
|
|
|
62
62
|
this.gridRef = gridRef;
|
|
63
|
+
this.outerGridElementRef = outerGridElementRef;
|
|
64
|
+
this.gridItemsRenderedRef = gridItemsRenderedRef;
|
|
63
65
|
this.rerenderGridBodyRef = rerenderGridBodyRef;
|
|
64
66
|
|
|
65
67
|
_defineProperty(this, "styles", {
|
|
@@ -255,6 +257,31 @@ var RowHeightUtils = /*#__PURE__*/function () {
|
|
|
255
257
|
(_this$gridRef$current = this.gridRef.current) === null || _this$gridRef$current === void 0 ? void 0 : _this$gridRef$current.resetAfterRowIndex(this.lastUpdatedRow);
|
|
256
258
|
this.lastUpdatedRow = Infinity;
|
|
257
259
|
}
|
|
260
|
+
}, {
|
|
261
|
+
key: "compensateForLayoutShift",
|
|
262
|
+
value: function compensateForLayoutShift(rowIndex, verticalLayoutShift, anchorRow) {
|
|
263
|
+
var grid = this.gridRef.current;
|
|
264
|
+
var outerGridElement = this.outerGridElementRef.current;
|
|
265
|
+
var renderedItems = this.gridItemsRenderedRef.current;
|
|
266
|
+
|
|
267
|
+
if (grid == null || outerGridElement == null || renderedItems == null || anchorRow == null || !Number.isFinite(verticalLayoutShift)) {
|
|
268
|
+
return;
|
|
269
|
+
} // skip if the start row is the anchor row but it hasn't shifted
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
if (anchorRow === 'start' && renderedItems.visibleRowStartIndex !== rowIndex) {
|
|
273
|
+
return;
|
|
274
|
+
} // skip if the center row is the anchor row but it hasn't shifted
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
if (anchorRow === 'center' && Math.floor((renderedItems.visibleRowStopIndex - renderedItems.visibleRowStartIndex) / 2) !== rowIndex) {
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
grid.scrollTo({
|
|
282
|
+
scrollTop: outerGridElement.scrollTop + verticalLayoutShift
|
|
283
|
+
});
|
|
284
|
+
}
|
|
258
285
|
}]);
|
|
259
286
|
|
|
260
287
|
return RowHeightUtils;
|
|
@@ -269,13 +296,15 @@ exports.RowHeightUtils = RowHeightUtils;
|
|
|
269
296
|
|
|
270
297
|
var useRowHeightUtils = function useRowHeightUtils(_ref2) {
|
|
271
298
|
var gridRef = _ref2.gridRef,
|
|
299
|
+
outerGridElementRef = _ref2.outerGridElementRef,
|
|
300
|
+
gridItemsRenderedRef = _ref2.gridItemsRenderedRef,
|
|
272
301
|
gridStyles = _ref2.gridStyles,
|
|
273
302
|
columns = _ref2.columns,
|
|
274
303
|
rowHeightsOptions = _ref2.rowHeightsOptions;
|
|
275
304
|
var forceRenderRef = (0, _services.useLatest)((0, _services.useForceRender)());
|
|
276
305
|
|
|
277
306
|
var _useState = (0, _react.useState)(function () {
|
|
278
|
-
return new RowHeightUtils(gridRef, forceRenderRef);
|
|
307
|
+
return new RowHeightUtils(gridRef, outerGridElementRef, gridItemsRenderedRef, forceRenderRef);
|
|
279
308
|
}),
|
|
280
309
|
_useState2 = _slicedToArray(_useState, 1),
|
|
281
310
|
rowHeightUtils = _useState2[0]; // Forces a rerender whenever the row heights change, as this can cause the
|
|
@@ -698,7 +698,7 @@ EuiSuperDatePickerInternal.propTypes = {
|
|
|
698
698
|
* Forces state to be `iconOnly` when within provided breakpoints.
|
|
699
699
|
* Remove completely with `false` or provide your own list of breakpoints.
|
|
700
700
|
*/
|
|
701
|
-
responsive: _propTypes.default.oneOfType([_propTypes.default.oneOf([false]), _propTypes.default.arrayOf(_propTypes.default.
|
|
701
|
+
responsive: _propTypes.default.oneOfType([_propTypes.default.oneOf([false]), _propTypes.default.arrayOf(_propTypes.default.any.isRequired).isRequired])
|
|
702
702
|
}),
|
|
703
703
|
timeOptions: _propTypes.default.shape({
|
|
704
704
|
timeTenseOptions: _propTypes.default.arrayOf(_propTypes.default.any.isRequired).isRequired,
|
|
@@ -837,6 +837,6 @@ EuiSuperDatePicker.propTypes = {
|
|
|
837
837
|
onMouseOut: _propTypes.default.func
|
|
838
838
|
}),
|
|
839
839
|
iconOnly: _propTypes.default.bool,
|
|
840
|
-
responsive: _propTypes.default.oneOfType([_propTypes.default.oneOf([false]), _propTypes.default.arrayOf(_propTypes.default.
|
|
840
|
+
responsive: _propTypes.default.oneOfType([_propTypes.default.oneOf([false]), _propTypes.default.arrayOf(_propTypes.default.any.isRequired).isRequired])
|
|
841
841
|
})
|
|
842
842
|
};
|
|
@@ -302,5 +302,5 @@ EuiSuperUpdateButton.propTypes = {
|
|
|
302
302
|
* Forces state to be `iconOnly` when within provided breakpoints.
|
|
303
303
|
* Remove completely with `false` or provide your own list of breakpoints.
|
|
304
304
|
*/
|
|
305
|
-
responsive: _propTypes.default.oneOfType([_propTypes.default.oneOf([false]), _propTypes.default.arrayOf(_propTypes.default.
|
|
305
|
+
responsive: _propTypes.default.oneOfType([_propTypes.default.oneOf([false]), _propTypes.default.arrayOf(_propTypes.default.any.isRequired).isRequired])
|
|
306
306
|
};
|