@elastic/eui 93.3.0 → 93.4.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.d.ts +9 -0
- package/dist/eui_charts_theme.js +56 -14
- package/dist/eui_charts_theme.js.map +1 -1
- package/es/components/breadcrumbs/_breadcrumb_content.js +362 -0
- package/es/components/breadcrumbs/_breadcrumb_content.styles.js +48 -0
- package/es/components/breadcrumbs/breadcrumb.js +10 -327
- package/es/components/breadcrumbs/breadcrumb.styles.js +5 -27
- package/es/components/breadcrumbs/breadcrumbs.js +4 -4
- package/es/components/breadcrumbs/types.js +1 -0
- package/es/components/button/button_group/button_group.js +16 -2
- package/es/components/button/button_group/button_group.styles.js +1 -1
- package/es/components/button/button_group/button_group_button.js +59 -5
- package/es/components/button/button_group/button_group_button.styles.js +39 -3
- package/es/components/datagrid/body/cell/data_grid_cell.js +97 -58
- package/es/components/datagrid/body/cell/data_grid_cell_actions.js +24 -18
- package/es/components/datagrid/body/cell/data_grid_cell_popover.js +64 -56
- package/es/components/datagrid/body/cell/data_grid_cell_wrapper.js +32 -31
- package/es/components/datagrid/body/cell/index.js +1 -1
- package/es/components/datagrid/body/data_grid_body.js +13 -0
- package/es/components/datagrid/body/data_grid_body_custom.js +52 -36
- package/es/components/datagrid/body/data_grid_body_virtualized.js +84 -56
- package/es/components/datagrid/body/data_grid_row_manager.js +6 -4
- package/es/components/datagrid/body/footer/use_data_grid_footer.js +1 -2
- package/es/components/datagrid/body/header/data_grid_control_header_cell.js +5 -4
- package/es/components/datagrid/body/header/data_grid_header_cell.js +73 -53
- package/es/components/datagrid/body/header/data_grid_header_row.js +15 -551
- package/es/components/datagrid/body/header/use_data_grid_header.js +7 -6
- package/es/components/datagrid/controls/column_selector.js +126 -123
- package/es/components/datagrid/controls/column_sorting.js +605 -103
- package/es/components/datagrid/controls/column_sorting_draggable.js +24 -22
- package/es/components/datagrid/controls/display_selector.js +109 -107
- package/es/components/datagrid/data_grid.a11y.js +13 -12
- package/es/components/datagrid/data_grid.js +45 -22
- package/es/components/datagrid/utils/col_widths.js +12 -8
- package/es/components/datagrid/utils/focus.js +10 -8
- package/es/components/datagrid/utils/grid_height_width.js +31 -30
- package/es/components/datagrid/utils/ref.js +1 -1
- package/es/components/datagrid/utils/row_heights.js +2 -2
- package/es/components/datagrid/utils/sorting.js +29 -27
- package/es/components/date_picker/super_date_picker/super_date_picker.js +9 -0
- package/es/components/date_picker/super_date_picker/super_update_button.js +57 -29
- package/es/components/flex/flex_grid.js +22 -8
- package/es/components/flex/flex_grid.styles.js +13 -6
- package/es/components/flex/flex_group.js +10 -11
- package/es/components/flex/flex_item.js +9 -11
- package/es/components/flex/flex_item.styles.js +107 -122
- package/es/components/flyout/flyout.js +16 -18
- package/es/components/header/header_breadcrumbs/header_breadcrumbs.js +3 -5
- package/es/components/modal/confirm_modal.js +2 -1
- package/es/components/modal/modal.js +12 -3
- package/es/components/observer/resize_observer/resize_observer.js +15 -24
- package/es/components/spacer/spacer.js +2 -3
- package/es/components/toast/global_toast_list.js +70 -73
- package/es/components/toast/toast.js +27 -42
- package/es/components/toast/toast.styles.js +2 -17
- package/es/services/color/eui_palettes.js +21 -13
- package/es/services/color/index.js +1 -1
- package/es/services/hooks/index.js +1 -0
- package/es/services/hooks/useDeepEqual.js +23 -0
- package/es/services/index.js +1 -1
- package/eui.d.ts +2442 -2337
- package/i18ntokens.json +259 -259
- package/lib/components/breadcrumbs/_breadcrumb_content.js +372 -0
- package/lib/components/breadcrumbs/_breadcrumb_content.styles.js +55 -0
- package/lib/components/breadcrumbs/breadcrumb.js +11 -331
- package/lib/components/breadcrumbs/breadcrumb.styles.js +5 -29
- package/lib/components/breadcrumbs/breadcrumbs.js +3 -3
- package/lib/components/breadcrumbs/types.js +5 -0
- package/lib/components/button/button_group/button_group.js +16 -2
- package/lib/components/button/button_group/button_group.styles.js +1 -1
- package/lib/components/button/button_group/button_group_button.js +59 -5
- package/lib/components/button/button_group/button_group_button.styles.js +45 -11
- package/lib/components/datagrid/body/cell/data_grid_cell.js +95 -57
- package/lib/components/datagrid/body/cell/data_grid_cell_actions.js +24 -18
- package/lib/components/datagrid/body/cell/data_grid_cell_popover.js +63 -55
- package/lib/components/datagrid/body/cell/data_grid_cell_wrapper.js +32 -31
- package/lib/components/datagrid/body/cell/index.js +2 -2
- package/lib/components/datagrid/body/data_grid_body.js +13 -0
- package/lib/components/datagrid/body/data_grid_body_custom.js +51 -35
- package/lib/components/datagrid/body/data_grid_body_virtualized.js +83 -55
- package/lib/components/datagrid/body/data_grid_row_manager.js +5 -3
- package/lib/components/datagrid/body/footer/use_data_grid_footer.js +1 -2
- package/lib/components/datagrid/body/header/data_grid_control_header_cell.js +8 -4
- package/lib/components/datagrid/body/header/data_grid_header_cell.js +72 -52
- package/lib/components/datagrid/body/header/data_grid_header_row.js +14 -550
- package/lib/components/datagrid/body/header/use_data_grid_header.js +7 -6
- package/lib/components/datagrid/controls/column_selector.js +126 -123
- package/lib/components/datagrid/controls/column_sorting.js +615 -110
- package/lib/components/datagrid/controls/column_sorting_draggable.js +27 -22
- package/lib/components/datagrid/controls/display_selector.js +109 -107
- package/lib/components/datagrid/data_grid.a11y.js +13 -12
- package/lib/components/datagrid/data_grid.js +43 -20
- package/lib/components/datagrid/utils/col_widths.js +12 -8
- package/lib/components/datagrid/utils/focus.js +10 -8
- package/lib/components/datagrid/utils/grid_height_width.js +29 -28
- package/lib/components/datagrid/utils/ref.js +1 -1
- package/lib/components/datagrid/utils/row_heights.js +1 -1
- package/lib/components/datagrid/utils/sorting.js +31 -29
- package/lib/components/date_picker/super_date_picker/super_date_picker.js +9 -0
- package/lib/components/date_picker/super_date_picker/super_update_button.js +57 -29
- package/lib/components/flex/flex_grid.js +23 -7
- package/lib/components/flex/flex_grid.styles.js +13 -6
- package/lib/components/flex/flex_group.js +10 -10
- package/lib/components/flex/flex_item.js +13 -13
- package/lib/components/flex/flex_item.styles.js +107 -122
- package/lib/components/flyout/flyout.js +16 -18
- package/lib/components/header/header_breadcrumbs/header_breadcrumbs.js +3 -5
- package/lib/components/modal/confirm_modal.js +2 -1
- package/lib/components/modal/modal.js +12 -3
- package/lib/components/observer/resize_observer/resize_observer.js +15 -24
- package/lib/components/spacer/spacer.js +1 -2
- package/lib/components/toast/global_toast_list.js +68 -71
- package/lib/components/toast/toast.js +25 -40
- package/lib/components/toast/toast.styles.js +11 -25
- package/lib/services/color/eui_palettes.js +24 -14
- package/lib/services/color/index.js +14 -0
- package/lib/services/hooks/index.js +11 -0
- package/lib/services/hooks/useDeepEqual.js +30 -0
- package/lib/services/index.js +15 -1
- package/optimize/es/components/breadcrumbs/_breadcrumb_content.js +153 -0
- package/optimize/es/components/breadcrumbs/_breadcrumb_content.styles.js +48 -0
- package/optimize/es/components/breadcrumbs/breadcrumb.js +10 -110
- package/optimize/es/components/breadcrumbs/breadcrumb.styles.js +5 -27
- package/optimize/es/components/breadcrumbs/breadcrumbs.js +4 -4
- package/optimize/es/components/breadcrumbs/types.js +1 -0
- package/optimize/es/components/button/button_group/button_group.js +2 -2
- package/optimize/es/components/button/button_group/button_group.styles.js +1 -1
- package/optimize/es/components/button/button_group/button_group_button.js +36 -4
- package/optimize/es/components/button/button_group/button_group_button.styles.js +39 -3
- package/optimize/es/components/datagrid/body/cell/data_grid_cell.js +80 -55
- package/optimize/es/components/datagrid/body/cell/data_grid_cell_actions.js +24 -18
- package/optimize/es/components/datagrid/body/cell/data_grid_cell_popover.js +64 -56
- package/optimize/es/components/datagrid/body/cell/data_grid_cell_wrapper.js +32 -31
- package/optimize/es/components/datagrid/body/cell/index.js +1 -1
- package/optimize/es/components/datagrid/body/data_grid_body_custom.js +39 -36
- package/optimize/es/components/datagrid/body/data_grid_body_virtualized.js +69 -49
- package/optimize/es/components/datagrid/body/data_grid_row_manager.js +6 -4
- package/optimize/es/components/datagrid/body/footer/use_data_grid_footer.js +1 -2
- package/optimize/es/components/datagrid/body/header/data_grid_control_header_cell.js +4 -3
- package/optimize/es/components/datagrid/body/header/data_grid_header_cell.js +65 -49
- package/optimize/es/components/datagrid/body/header/data_grid_header_row.js +15 -13
- package/optimize/es/components/datagrid/body/header/use_data_grid_header.js +7 -6
- package/optimize/es/components/datagrid/controls/column_selector.js +126 -123
- package/optimize/es/components/datagrid/controls/column_sorting.js +121 -103
- package/optimize/es/components/datagrid/controls/column_sorting_draggable.js +24 -22
- package/optimize/es/components/datagrid/controls/display_selector.js +109 -107
- package/optimize/es/components/datagrid/data_grid.a11y.js +13 -12
- package/optimize/es/components/datagrid/data_grid.js +45 -22
- package/optimize/es/components/datagrid/utils/col_widths.js +9 -5
- package/optimize/es/components/datagrid/utils/focus.js +10 -8
- package/optimize/es/components/datagrid/utils/grid_height_width.js +31 -30
- package/optimize/es/components/datagrid/utils/ref.js +1 -1
- package/optimize/es/components/datagrid/utils/row_heights.js +2 -2
- package/optimize/es/components/datagrid/utils/sorting.js +29 -27
- package/optimize/es/components/date_picker/super_date_picker/super_update_button.js +49 -29
- package/optimize/es/components/flex/flex_grid.js +19 -8
- package/optimize/es/components/flex/flex_grid.styles.js +13 -6
- package/optimize/es/components/flex/flex_group.js +9 -10
- package/optimize/es/components/flex/flex_item.js +9 -11
- package/optimize/es/components/flex/flex_item.styles.js +107 -122
- package/optimize/es/components/flyout/flyout.js +16 -18
- package/optimize/es/components/header/header_breadcrumbs/header_breadcrumbs.js +3 -5
- package/optimize/es/components/modal/confirm_modal.js +2 -1
- package/optimize/es/components/modal/modal.js +6 -2
- package/optimize/es/components/observer/resize_observer/resize_observer.js +15 -24
- package/optimize/es/components/spacer/spacer.js +2 -3
- package/optimize/es/components/toast/global_toast_list.js +70 -73
- package/optimize/es/components/toast/toast.js +27 -42
- package/optimize/es/components/toast/toast.styles.js +2 -17
- package/optimize/es/services/color/eui_palettes.js +21 -13
- package/optimize/es/services/color/index.js +1 -1
- package/optimize/es/services/hooks/index.js +1 -0
- package/optimize/es/services/hooks/useDeepEqual.js +23 -0
- package/optimize/es/services/index.js +1 -1
- package/optimize/lib/components/breadcrumbs/_breadcrumb_content.js +163 -0
- package/optimize/lib/components/breadcrumbs/_breadcrumb_content.styles.js +55 -0
- package/optimize/lib/components/breadcrumbs/breadcrumb.js +10 -113
- package/optimize/lib/components/breadcrumbs/breadcrumb.styles.js +5 -29
- package/optimize/lib/components/breadcrumbs/breadcrumbs.js +3 -3
- package/optimize/lib/components/breadcrumbs/types.js +5 -0
- package/optimize/lib/components/button/button_group/button_group.js +2 -2
- package/optimize/lib/components/button/button_group/button_group.styles.js +1 -1
- package/optimize/lib/components/button/button_group/button_group_button.js +37 -5
- package/optimize/lib/components/button/button_group/button_group_button.styles.js +45 -11
- package/optimize/lib/components/datagrid/body/cell/data_grid_cell.js +78 -54
- package/optimize/lib/components/datagrid/body/cell/data_grid_cell_actions.js +24 -18
- package/optimize/lib/components/datagrid/body/cell/data_grid_cell_popover.js +63 -55
- package/optimize/lib/components/datagrid/body/cell/data_grid_cell_wrapper.js +32 -31
- package/optimize/lib/components/datagrid/body/cell/index.js +2 -2
- package/optimize/lib/components/datagrid/body/data_grid_body_custom.js +38 -35
- package/optimize/lib/components/datagrid/body/data_grid_body_virtualized.js +70 -50
- package/optimize/lib/components/datagrid/body/data_grid_row_manager.js +5 -3
- package/optimize/lib/components/datagrid/body/footer/use_data_grid_footer.js +1 -2
- package/optimize/lib/components/datagrid/body/header/data_grid_control_header_cell.js +8 -4
- package/optimize/lib/components/datagrid/body/header/data_grid_header_cell.js +65 -49
- package/optimize/lib/components/datagrid/body/header/data_grid_header_row.js +14 -12
- package/optimize/lib/components/datagrid/body/header/use_data_grid_header.js +7 -6
- package/optimize/lib/components/datagrid/controls/column_selector.js +126 -123
- package/optimize/lib/components/datagrid/controls/column_sorting.js +125 -107
- package/optimize/lib/components/datagrid/controls/column_sorting_draggable.js +27 -22
- package/optimize/lib/components/datagrid/controls/display_selector.js +109 -107
- package/optimize/lib/components/datagrid/data_grid.a11y.js +13 -12
- package/optimize/lib/components/datagrid/data_grid.js +43 -20
- package/optimize/lib/components/datagrid/utils/col_widths.js +9 -5
- package/optimize/lib/components/datagrid/utils/focus.js +10 -8
- package/optimize/lib/components/datagrid/utils/grid_height_width.js +29 -28
- package/optimize/lib/components/datagrid/utils/ref.js +1 -1
- package/optimize/lib/components/datagrid/utils/row_heights.js +1 -1
- package/optimize/lib/components/datagrid/utils/sorting.js +31 -29
- package/optimize/lib/components/date_picker/super_date_picker/super_update_button.js +49 -29
- package/optimize/lib/components/flex/flex_grid.js +21 -7
- package/optimize/lib/components/flex/flex_grid.styles.js +13 -6
- package/optimize/lib/components/flex/flex_group.js +9 -9
- package/optimize/lib/components/flex/flex_item.js +13 -13
- package/optimize/lib/components/flex/flex_item.styles.js +107 -122
- package/optimize/lib/components/flyout/flyout.js +16 -18
- package/optimize/lib/components/header/header_breadcrumbs/header_breadcrumbs.js +3 -5
- package/optimize/lib/components/modal/confirm_modal.js +2 -1
- package/optimize/lib/components/modal/modal.js +6 -2
- package/optimize/lib/components/observer/resize_observer/resize_observer.js +15 -24
- package/optimize/lib/components/spacer/spacer.js +1 -2
- package/optimize/lib/components/toast/global_toast_list.js +68 -71
- package/optimize/lib/components/toast/toast.js +25 -40
- package/optimize/lib/components/toast/toast.styles.js +11 -25
- package/optimize/lib/services/color/eui_palettes.js +24 -14
- package/optimize/lib/services/color/index.js +14 -0
- package/optimize/lib/services/hooks/index.js +11 -0
- package/optimize/lib/services/hooks/useDeepEqual.js +30 -0
- package/optimize/lib/services/index.js +15 -1
- package/package.json +2 -2
- package/test-env/components/breadcrumbs/_breadcrumb_content.js +363 -0
- package/test-env/components/breadcrumbs/_breadcrumb_content.styles.js +55 -0
- package/test-env/components/breadcrumbs/breadcrumb.js +11 -326
- package/test-env/components/breadcrumbs/breadcrumb.styles.js +5 -29
- package/test-env/components/breadcrumbs/breadcrumbs.js +3 -3
- package/test-env/components/breadcrumbs/types.js +5 -0
- package/test-env/components/button/button_group/button_group.js +16 -2
- package/test-env/components/button/button_group/button_group.styles.js +1 -1
- package/test-env/components/button/button_group/button_group_button.js +56 -5
- package/test-env/components/button/button_group/button_group_button.styles.js +45 -11
- package/test-env/components/datagrid/body/cell/data_grid_cell.js +95 -57
- package/test-env/components/datagrid/body/cell/data_grid_cell_actions.js +24 -18
- package/test-env/components/datagrid/body/cell/data_grid_cell_popover.js +63 -55
- package/test-env/components/datagrid/body/cell/data_grid_cell_wrapper.js +32 -31
- package/test-env/components/datagrid/body/cell/index.js +2 -2
- package/test-env/components/datagrid/body/data_grid_body.js +13 -0
- package/test-env/components/datagrid/body/data_grid_body_custom.js +51 -35
- package/test-env/components/datagrid/body/data_grid_body_virtualized.js +83 -55
- package/test-env/components/datagrid/body/data_grid_row_manager.js +5 -3
- package/test-env/components/datagrid/body/footer/use_data_grid_footer.js +1 -2
- package/test-env/components/datagrid/body/header/data_grid_control_header_cell.js +8 -4
- package/test-env/components/datagrid/body/header/data_grid_header_cell.js +72 -52
- package/test-env/components/datagrid/body/header/data_grid_header_row.js +14 -550
- package/test-env/components/datagrid/body/header/use_data_grid_header.js +7 -6
- package/test-env/components/datagrid/controls/column_selector.js +126 -123
- package/test-env/components/datagrid/controls/column_sorting.js +607 -106
- package/test-env/components/datagrid/controls/column_sorting_draggable.js +27 -22
- package/test-env/components/datagrid/controls/display_selector.js +109 -107
- package/test-env/components/datagrid/data_grid.a11y.js +13 -12
- package/test-env/components/datagrid/data_grid.js +43 -20
- package/test-env/components/datagrid/utils/col_widths.js +9 -5
- package/test-env/components/datagrid/utils/focus.js +10 -8
- package/test-env/components/datagrid/utils/grid_height_width.js +29 -28
- package/test-env/components/datagrid/utils/ref.js +1 -1
- package/test-env/components/datagrid/utils/row_heights.js +1 -1
- package/test-env/components/datagrid/utils/sorting.js +31 -29
- package/test-env/components/date_picker/super_date_picker/super_date_picker.js +9 -0
- package/test-env/components/date_picker/super_date_picker/super_update_button.js +57 -29
- package/test-env/components/flex/flex_grid.js +21 -7
- package/test-env/components/flex/flex_grid.styles.js +13 -6
- package/test-env/components/flex/flex_group.js +10 -10
- package/test-env/components/flex/flex_item.js +13 -13
- package/test-env/components/flex/flex_item.styles.js +107 -122
- package/test-env/components/header/header_breadcrumbs/header_breadcrumbs.js +3 -5
- package/test-env/components/modal/confirm_modal.js +2 -1
- package/test-env/components/modal/modal.js +12 -3
- package/test-env/components/spacer/spacer.js +1 -2
- package/test-env/components/toast/global_toast_list.js +68 -71
- package/test-env/components/toast/toast.js +25 -40
- package/test-env/components/toast/toast.styles.js +11 -25
- package/test-env/services/color/eui_palettes.js +24 -14
- package/test-env/services/color/index.js +14 -0
- package/test-env/services/hooks/index.js +11 -0
- package/test-env/services/hooks/useDeepEqual.js +30 -0
- package/test-env/services/index.js +15 -1
- package/src/themes/charts/theme.scss +0 -5
|
@@ -12,11 +12,11 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
12
12
|
* Side Public License, v 1.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import { useEffect, useState, useContext } from 'react';
|
|
15
|
+
import { useEffect, useState, useContext, useMemo } from 'react';
|
|
16
16
|
import { IS_JEST_ENVIRONMENT } from '../../../utils';
|
|
17
17
|
import { useUpdateEffect, useForceRender } from '../../../services';
|
|
18
18
|
import { useResizeObserver } from '../../observer/resize_observer';
|
|
19
|
-
import {
|
|
19
|
+
import { DataGridSortedContext } from './sorting';
|
|
20
20
|
export var useFinalGridDimensions = function useFinalGridDimensions(_ref) {
|
|
21
21
|
var unconstrainedHeight = _ref.unconstrainedHeight,
|
|
22
22
|
unconstrainedWidth = _ref.unconstrainedWidth,
|
|
@@ -88,42 +88,43 @@ export var useUnconstrainedHeight = function useUnconstrainedHeight(_ref2) {
|
|
|
88
88
|
footerRowHeight = _ref2.footerRowHeight,
|
|
89
89
|
scrollBarHeight = _ref2.scrollBarHeight,
|
|
90
90
|
innerGridRef = _ref2.innerGridRef;
|
|
91
|
-
var _useContext = useContext(
|
|
91
|
+
var _useContext = useContext(DataGridSortedContext),
|
|
92
92
|
getCorrectRowIndex = _useContext.getCorrectRowIndex;
|
|
93
|
-
var knownHeight = 0; // tracks the pixel height of rows we know the size of
|
|
94
|
-
var knownRowCount = 0; // how many rows we know the size of
|
|
95
|
-
for (var i = startRow; i < endRow; i++) {
|
|
96
|
-
var correctRowIndex = getCorrectRowIndex(i); // map visible row to logical row
|
|
97
|
-
|
|
98
|
-
// lookup the height configuration of this row
|
|
99
|
-
var rowHeightOption = rowHeightUtils.getRowHeightOption(correctRowIndex, rowHeightsOptions);
|
|
100
|
-
if (rowHeightOption) {
|
|
101
|
-
// this row's height is known
|
|
102
|
-
knownRowCount++;
|
|
103
|
-
knownHeight += rowHeightUtils.getCalculatedHeight(rowHeightOption, defaultRowHeight, correctRowIndex, rowHeightUtils.isRowHeightOverride(correctRowIndex, rowHeightsOptions));
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// how many rows to provide space for on the screen
|
|
108
|
-
var rowCountToAffordFor = endRow - startRow;
|
|
109
|
-
|
|
110
93
|
// watch the inner element for a change to its width
|
|
111
94
|
// which may cause the horizontal scrollbar to be added or removed
|
|
112
95
|
var _useResizeObserver = useResizeObserver(innerGridRef.current, 'width'),
|
|
113
96
|
innerWidth = _useResizeObserver.width;
|
|
114
97
|
var forceRender = useForceRender();
|
|
115
98
|
useUpdateEffect(forceRender, [innerWidth]);
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
99
|
+
return useMemo(function () {
|
|
100
|
+
var knownHeight = 0; // tracks the pixel height of rows we know the size of
|
|
101
|
+
var knownRowCount = 0; // how many rows we know the size of
|
|
102
|
+
for (var i = startRow; i < endRow; i++) {
|
|
103
|
+
var correctRowIndex = getCorrectRowIndex(i); // map visible row to logical row
|
|
104
|
+
|
|
105
|
+
// lookup the height configuration of this row
|
|
106
|
+
var rowHeightOption = rowHeightUtils.getRowHeightOption(correctRowIndex, rowHeightsOptions);
|
|
107
|
+
if (rowHeightOption) {
|
|
108
|
+
// this row's height is known
|
|
109
|
+
knownRowCount++;
|
|
110
|
+
knownHeight += rowHeightUtils.getCalculatedHeight(rowHeightOption, defaultRowHeight, correctRowIndex, rowHeightUtils.isRowHeightOverride(correctRowIndex, rowHeightsOptions));
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// how many rows to provide space for on the screen
|
|
115
|
+
var rowCountToAffordFor = endRow - startRow;
|
|
116
|
+
var unconstrainedHeight = defaultRowHeight * (rowCountToAffordFor - knownRowCount) +
|
|
117
|
+
// guess how much space is required for unknown rows
|
|
118
|
+
knownHeight +
|
|
119
|
+
// computed pixel height of the known rows
|
|
120
|
+
headerRowHeight +
|
|
121
|
+
// account for header
|
|
122
|
+
footerRowHeight +
|
|
123
|
+
// account for footer
|
|
124
|
+
scrollBarHeight; // account for horizontal scrollbar
|
|
125
125
|
|
|
126
|
-
|
|
126
|
+
return unconstrainedHeight;
|
|
127
|
+
}, [defaultRowHeight, endRow, footerRowHeight, headerRowHeight, startRow, getCorrectRowIndex, rowHeightUtils, rowHeightsOptions, scrollBarHeight]);
|
|
127
128
|
};
|
|
128
129
|
|
|
129
130
|
/**
|
|
@@ -13,7 +13,7 @@ export var useImperativeGridRef = function useImperativeGridRef(_ref) {
|
|
|
13
13
|
setIsFullScreen = _ref.setIsFullScreen,
|
|
14
14
|
focusContext = _ref.focusContext,
|
|
15
15
|
cellPopoverContext = _ref.cellPopoverContext,
|
|
16
|
-
sortedRowMap = _ref.
|
|
16
|
+
sortedRowMap = _ref.sortedContext.sortedRowMap,
|
|
17
17
|
pagination = _ref.pagination,
|
|
18
18
|
rowCount = _ref.rowCount,
|
|
19
19
|
visibleColCount = _ref.visibleColCount;
|
|
@@ -31,7 +31,7 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
|
31
31
|
import { useCallback, useContext, useEffect, useMemo, useState } from 'react';
|
|
32
32
|
import { useForceRender, useLatest } from '../../../services';
|
|
33
33
|
import { isNumber, isObject } from '../../../services/predicate';
|
|
34
|
-
import {
|
|
34
|
+
import { DataGridSortedContext } from './sorting';
|
|
35
35
|
|
|
36
36
|
// TODO: Once JS variables are available, use them here instead of hard-coded maps
|
|
37
37
|
export var cellPaddingsMap = {
|
|
@@ -336,7 +336,7 @@ export var useRowHeightUtils = function useRowHeightUtils(_ref2) {
|
|
|
336
336
|
export var useDefaultRowHeight = function useDefaultRowHeight(_ref3) {
|
|
337
337
|
var rowHeightsOptions = _ref3.rowHeightsOptions,
|
|
338
338
|
rowHeightUtils = _ref3.rowHeightUtils;
|
|
339
|
-
var _useContext = useContext(
|
|
339
|
+
var _useContext = useContext(DataGridSortedContext),
|
|
340
340
|
getCorrectRowIndex = _useContext.getCorrectRowIndex;
|
|
341
341
|
|
|
342
342
|
// `minRowHeight` is primarily used by undefined & lineCount heights
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { createContext, useMemo, useCallback } from 'react';
|
|
10
|
+
import { useDeepEqual } from '../../../services';
|
|
10
11
|
import { defaultComparator } from './data_grid_schema';
|
|
11
|
-
export var
|
|
12
|
-
sorting: undefined,
|
|
12
|
+
export var DataGridSortedContext = /*#__PURE__*/createContext({
|
|
13
13
|
sortedRowMap: [],
|
|
14
14
|
getCorrectRowIndex: function getCorrectRowIndex(number) {
|
|
15
15
|
return number;
|
|
@@ -22,22 +22,18 @@ export var useSorting = function useSorting(_ref) {
|
|
|
22
22
|
schema = _ref.schema,
|
|
23
23
|
schemaDetectors = _ref.schemaDetectors,
|
|
24
24
|
startRow = _ref.startRow;
|
|
25
|
-
var sortingColumns = sorting === null || sorting === void 0 ? void 0 : sorting.columns;
|
|
26
|
-
var
|
|
27
|
-
var rowMap = [];
|
|
25
|
+
var sortingColumns = useDeepEqual(sorting === null || sorting === void 0 ? void 0 : sorting.columns);
|
|
26
|
+
var sortedWrappedValues = useMemo(function () {
|
|
28
27
|
if ((inMemory === null || inMemory === void 0 ? void 0 : inMemory.level) === 'sorting' && sortingColumns != null && sortingColumns.length > 0) {
|
|
29
28
|
var inMemoryRowIndices = Object.keys(inMemoryValues);
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
wrappedValues.sort(function (a, b) {
|
|
39
|
-
for (var _i = 0; _i < sortingColumns.length; _i++) {
|
|
40
|
-
var column = sortingColumns[_i];
|
|
29
|
+
return inMemoryRowIndices.map(function (row, index) {
|
|
30
|
+
return {
|
|
31
|
+
index: index,
|
|
32
|
+
values: inMemoryValues[row]
|
|
33
|
+
};
|
|
34
|
+
}).sort(function (a, b) {
|
|
35
|
+
for (var i = 0; i < sortingColumns.length; i++) {
|
|
36
|
+
var column = sortingColumns[i];
|
|
41
37
|
var aValue = a.values[column.id];
|
|
42
38
|
var bValue = b.values[column.id];
|
|
43
39
|
|
|
@@ -45,8 +41,8 @@ export var useSorting = function useSorting(_ref) {
|
|
|
45
41
|
var comparator = defaultComparator;
|
|
46
42
|
if (schema.hasOwnProperty(column.id)) {
|
|
47
43
|
var columnType = schema[column.id].columnType;
|
|
48
|
-
for (var
|
|
49
|
-
var detector = schemaDetectors[
|
|
44
|
+
for (var _i = 0; _i < schemaDetectors.length; _i++) {
|
|
45
|
+
var detector = schemaDetectors[_i];
|
|
50
46
|
if (detector.type === columnType && detector.hasOwnProperty('comparator')) {
|
|
51
47
|
comparator = detector.comparator;
|
|
52
48
|
}
|
|
@@ -61,12 +57,17 @@ export var useSorting = function useSorting(_ref) {
|
|
|
61
57
|
}
|
|
62
58
|
return 0;
|
|
63
59
|
});
|
|
64
|
-
for (var _i3 = 0; _i3 < wrappedValues.length; _i3++) {
|
|
65
|
-
rowMap[_i3] = wrappedValues[_i3].index;
|
|
66
|
-
}
|
|
67
60
|
}
|
|
68
|
-
return rowMap;
|
|
69
61
|
}, [inMemory === null || inMemory === void 0 ? void 0 : inMemory.level, inMemoryValues, sortingColumns, schema, schemaDetectors]);
|
|
62
|
+
var sortedRowMap = useMemo(function () {
|
|
63
|
+
if ((inMemory === null || inMemory === void 0 ? void 0 : inMemory.level) === 'sorting' && sortingColumns != null && sortingColumns.length > 0 && sortedWrappedValues != null) {
|
|
64
|
+
return sortedWrappedValues.map(function (row) {
|
|
65
|
+
return row.index;
|
|
66
|
+
});
|
|
67
|
+
} else {
|
|
68
|
+
return [];
|
|
69
|
+
}
|
|
70
|
+
}, [inMemory === null || inMemory === void 0 ? void 0 : inMemory.level, sortingColumns, sortedWrappedValues]);
|
|
70
71
|
|
|
71
72
|
// Given a visible row index, obtain the unpaginated & unsorted
|
|
72
73
|
// row index from the passed cell data
|
|
@@ -76,9 +77,10 @@ export var useSorting = function useSorting(_ref) {
|
|
|
76
77
|
var unsortedRowIndex = unpaginatedRowIndex in sortedRowMap ? sortedRowMap[unpaginatedRowIndex] : unpaginatedRowIndex;
|
|
77
78
|
return unsortedRowIndex;
|
|
78
79
|
}, [startRow, sortedRowMap]);
|
|
79
|
-
return {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
80
|
+
return useMemo(function () {
|
|
81
|
+
return {
|
|
82
|
+
sortedRowMap: sortedRowMap,
|
|
83
|
+
getCorrectRowIndex: getCorrectRowIndex
|
|
84
|
+
};
|
|
85
|
+
}, [sortedRowMap, getCorrectRowIndex]);
|
|
84
86
|
};
|
|
@@ -603,6 +603,14 @@ EuiSuperDatePickerInternal.propTypes = {
|
|
|
603
603
|
* Props passed to the update button #EuiSuperUpdateButtonProps
|
|
604
604
|
*/
|
|
605
605
|
updateButtonProps: PropTypes.shape({
|
|
606
|
+
/**
|
|
607
|
+
* Overrides the default button label with a custom React node.
|
|
608
|
+
*
|
|
609
|
+
* When defined, you're responsible for updating the custom label
|
|
610
|
+
* when the data needs updating (the `needsUpdate` prop)
|
|
611
|
+
* or is loading (the `isLoading` prop).
|
|
612
|
+
*/
|
|
613
|
+
children: PropTypes.node,
|
|
606
614
|
/**
|
|
607
615
|
* Show the "Click to apply" tooltip
|
|
608
616
|
*/
|
|
@@ -836,6 +844,7 @@ EuiSuperDatePicker.propTypes = {
|
|
|
836
844
|
* Props passed to the update button #EuiSuperUpdateButtonProps
|
|
837
845
|
*/
|
|
838
846
|
updateButtonProps: PropTypes.shape({
|
|
847
|
+
children: PropTypes.node,
|
|
839
848
|
showTooltip: PropTypes.bool,
|
|
840
849
|
toolTipProps: PropTypes.shape({
|
|
841
850
|
anchorClassName: PropTypes.string,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["className", "needsUpdate", "isLoading", "isDisabled", "onClick", "toolTipProps", "showTooltip", "iconOnly", "responsive", "textProps", "fill"];
|
|
1
|
+
var _excluded = ["children", "className", "needsUpdate", "isLoading", "isDisabled", "onClick", "toolTipProps", "showTooltip", "iconOnly", "responsive", "textProps", "fill"];
|
|
2
2
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
3
3
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
4
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -89,6 +89,7 @@ export var EuiSuperUpdateButton = /*#__PURE__*/function (_Component) {
|
|
|
89
89
|
key: "render",
|
|
90
90
|
value: function render() {
|
|
91
91
|
var _this$props = this.props,
|
|
92
|
+
children = _this$props.children,
|
|
92
93
|
className = _this$props.className,
|
|
93
94
|
needsUpdate = _this$props.needsUpdate,
|
|
94
95
|
isLoading = _this$props.isLoading,
|
|
@@ -104,31 +105,6 @@ export var EuiSuperUpdateButton = /*#__PURE__*/function (_Component) {
|
|
|
104
105
|
// Force responsive for "all" if `iconOnly = true`
|
|
105
106
|
var responsive = iconOnly ? 'all' : _responsive;
|
|
106
107
|
var classes = classNames('euiSuperUpdateButton', className);
|
|
107
|
-
var buttonText = ___EmotionJSX(EuiI18n, {
|
|
108
|
-
token: "euiSuperUpdateButton.refreshButtonLabel",
|
|
109
|
-
default: "Refresh"
|
|
110
|
-
});
|
|
111
|
-
if (needsUpdate || isLoading) {
|
|
112
|
-
buttonText = isLoading ? ___EmotionJSX(EuiI18n, {
|
|
113
|
-
token: "euiSuperUpdateButton.updatingButtonLabel",
|
|
114
|
-
default: "Updating"
|
|
115
|
-
}) : ___EmotionJSX(EuiI18n, {
|
|
116
|
-
token: "euiSuperUpdateButton.updateButtonLabel",
|
|
117
|
-
default: "Update"
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
var tooltipContent;
|
|
121
|
-
if (isDisabled) {
|
|
122
|
-
tooltipContent = ___EmotionJSX(EuiI18n, {
|
|
123
|
-
token: "euiSuperUpdateButton.cannotUpdateTooltip",
|
|
124
|
-
default: "Cannot update"
|
|
125
|
-
});
|
|
126
|
-
} else if (needsUpdate && !isLoading) {
|
|
127
|
-
tooltipContent = ___EmotionJSX(EuiI18n, {
|
|
128
|
-
token: "euiSuperUpdateButton.clickToApplyTooltip",
|
|
129
|
-
default: "Click to apply"
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
108
|
var sharedButtonProps = {
|
|
133
109
|
color: needsUpdate || isLoading ? 'success' : 'primary',
|
|
134
110
|
iconType: needsUpdate || isLoading ? 'kqlFunction' : 'refresh',
|
|
@@ -136,9 +112,10 @@ export var EuiSuperUpdateButton = /*#__PURE__*/function (_Component) {
|
|
|
136
112
|
onClick: onClick,
|
|
137
113
|
isLoading: isLoading
|
|
138
114
|
};
|
|
115
|
+
var buttonContent = this.renderButtonContent();
|
|
139
116
|
return ___EmotionJSX(EuiToolTip, _extends({
|
|
140
117
|
ref: this.setTootipRef,
|
|
141
|
-
content:
|
|
118
|
+
content: this.renderTooltipContent(),
|
|
142
119
|
position: "bottom"
|
|
143
120
|
}, toolTipProps), ___EmotionJSX(React.Fragment, null, ___EmotionJSX(EuiShowFor, {
|
|
144
121
|
sizes: responsive || 'none'
|
|
@@ -150,7 +127,7 @@ export var EuiSuperUpdateButton = /*#__PURE__*/function (_Component) {
|
|
|
150
127
|
textProps: _objectSpread(_objectSpread({}, restTextProps), {}, {
|
|
151
128
|
className: classNames('euiScreenReaderOnly', restTextProps && restTextProps.className)
|
|
152
129
|
})
|
|
153
|
-
}, rest),
|
|
130
|
+
}, rest), buttonContent)), ___EmotionJSX(EuiHideFor, {
|
|
154
131
|
sizes: responsive || 'none'
|
|
155
132
|
}, ___EmotionJSX(EuiButton, _extends({
|
|
156
133
|
className: classes,
|
|
@@ -158,7 +135,50 @@ export var EuiSuperUpdateButton = /*#__PURE__*/function (_Component) {
|
|
|
158
135
|
}, sharedButtonProps, {
|
|
159
136
|
fill: fill,
|
|
160
137
|
textProps: restTextProps
|
|
161
|
-
}, rest),
|
|
138
|
+
}, rest), buttonContent))));
|
|
139
|
+
}
|
|
140
|
+
}, {
|
|
141
|
+
key: "renderButtonContent",
|
|
142
|
+
value: function renderButtonContent() {
|
|
143
|
+
var _this$props2 = this.props,
|
|
144
|
+
children = _this$props2.children,
|
|
145
|
+
isLoading = _this$props2.isLoading,
|
|
146
|
+
needsUpdate = _this$props2.needsUpdate;
|
|
147
|
+
if (children) {
|
|
148
|
+
return children;
|
|
149
|
+
}
|
|
150
|
+
if (isLoading) {
|
|
151
|
+
return ___EmotionJSX(EuiI18n, {
|
|
152
|
+
token: "euiSuperUpdateButton.updatingButtonLabel",
|
|
153
|
+
default: "Updating"
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
if (needsUpdate) {
|
|
157
|
+
return ___EmotionJSX(EuiI18n, {
|
|
158
|
+
token: "euiSuperUpdateButton.updateButtonLabel",
|
|
159
|
+
default: "Update"
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
return ___EmotionJSX(EuiI18n, {
|
|
163
|
+
token: "euiSuperUpdateButton.refreshButtonLabel",
|
|
164
|
+
default: "Refresh"
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
}, {
|
|
168
|
+
key: "renderTooltipContent",
|
|
169
|
+
value: function renderTooltipContent() {
|
|
170
|
+
if (this.props.isDisabled) {
|
|
171
|
+
return ___EmotionJSX(EuiI18n, {
|
|
172
|
+
token: "euiSuperUpdateButton.cannotUpdateTooltip",
|
|
173
|
+
default: "Cannot update"
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
if (this.props.needsUpdate && !this.props.isLoading) {
|
|
177
|
+
return ___EmotionJSX(EuiI18n, {
|
|
178
|
+
token: "euiSuperUpdateButton.clickToApplyTooltip",
|
|
179
|
+
default: "Click to apply"
|
|
180
|
+
});
|
|
181
|
+
}
|
|
162
182
|
}
|
|
163
183
|
}]);
|
|
164
184
|
return EuiSuperUpdateButton;
|
|
@@ -176,6 +196,14 @@ EuiSuperUpdateButton.propTypes = {
|
|
|
176
196
|
isLoading: PropTypes.bool,
|
|
177
197
|
needsUpdate: PropTypes.bool,
|
|
178
198
|
onClick: PropTypes.func.isRequired,
|
|
199
|
+
/**
|
|
200
|
+
* Overrides the default button label with a custom React node.
|
|
201
|
+
*
|
|
202
|
+
* When defined, you're responsible for updating the custom label
|
|
203
|
+
* when the data needs updating (the `needsUpdate` prop)
|
|
204
|
+
* or is loading (the `isLoading` prop).
|
|
205
|
+
*/
|
|
206
|
+
children: PropTypes.node,
|
|
179
207
|
/**
|
|
180
208
|
* Show the "Click to apply" tooltip
|
|
181
209
|
*/
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
var _excluded = ["children", "className", "style", "gutterSize", "direction", "alignItems", "responsive", "columns", "component"];
|
|
2
3
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
7
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
8
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
3
9
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
4
10
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
5
11
|
/*
|
|
@@ -10,10 +16,10 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
10
16
|
* Side Public License, v 1.
|
|
11
17
|
*/
|
|
12
18
|
|
|
13
|
-
import React from 'react';
|
|
19
|
+
import React, { useMemo } from 'react';
|
|
14
20
|
import PropTypes from "prop-types";
|
|
15
21
|
import classNames from 'classnames';
|
|
16
|
-
import {
|
|
22
|
+
import { useEuiMemoizedStyles } from '../../services';
|
|
17
23
|
import { euiFlexGridStyles } from './flex_grid.styles';
|
|
18
24
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
19
25
|
export var DIRECTIONS = ['row', 'column'];
|
|
@@ -22,6 +28,7 @@ export var GUTTER_SIZES = ['none', 's', 'm', 'l', 'xl'];
|
|
|
22
28
|
export var EuiFlexGrid = function EuiFlexGrid(_ref) {
|
|
23
29
|
var children = _ref.children,
|
|
24
30
|
className = _ref.className,
|
|
31
|
+
style = _ref.style,
|
|
25
32
|
_ref$gutterSize = _ref.gutterSize,
|
|
26
33
|
gutterSize = _ref$gutterSize === void 0 ? 'l' : _ref$gutterSize,
|
|
27
34
|
_ref$direction = _ref.direction,
|
|
@@ -35,14 +42,21 @@ export var EuiFlexGrid = function EuiFlexGrid(_ref) {
|
|
|
35
42
|
_ref$component = _ref.component,
|
|
36
43
|
Component = _ref$component === void 0 ? 'div' : _ref$component,
|
|
37
44
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
38
|
-
var gridTemplateRows = direction === 'column' ? Math.ceil(React.Children.count(children) / columns) : 0;
|
|
39
|
-
var euiTheme = useEuiTheme();
|
|
40
|
-
var styles = euiFlexGridStyles(euiTheme, gridTemplateRows);
|
|
41
|
-
var cssStyles = [styles.euiFlexGrid, styles.gutterSizes[gutterSize], styles.direction[direction], styles.alignItems[alignItems], styles.columnCount[columns], responsive && styles.responsive];
|
|
42
45
|
var classes = classNames('euiFlexGrid', className);
|
|
46
|
+
var styles = useEuiMemoizedStyles(euiFlexGridStyles);
|
|
47
|
+
var cssStyles = [styles.euiFlexGrid, styles.gutterSizes[gutterSize], styles.direction[direction], styles.alignItems[alignItems], styles.columnCount[columns], responsive && styles.responsive];
|
|
48
|
+
var columnDirectionStyles = useMemo(function () {
|
|
49
|
+
if (direction === 'column') {
|
|
50
|
+
var rowsToRender = Math.ceil(React.Children.count(children) / columns);
|
|
51
|
+
return {
|
|
52
|
+
gridTemplateRows: "repeat(".concat(rowsToRender, ", 1fr)")
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
}, [direction, columns, children]);
|
|
43
56
|
return ___EmotionJSX(Component, _extends({
|
|
44
57
|
css: cssStyles,
|
|
45
|
-
className: classes
|
|
58
|
+
className: classes,
|
|
59
|
+
style: columnDirectionStyles ? _objectSpread(_objectSpread({}, style), columnDirectionStyles) : style
|
|
46
60
|
}, rest), children);
|
|
47
61
|
};
|
|
48
62
|
EuiFlexGrid.propTypes = {
|
|
@@ -82,6 +82,14 @@ var _ref9 = process.env.NODE_ENV === "production" ? {
|
|
|
82
82
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
83
83
|
};
|
|
84
84
|
var _ref10 = process.env.NODE_ENV === "production" ? {
|
|
85
|
+
name: "1t690q7-column",
|
|
86
|
+
styles: "grid-auto-flow:column;label:column;"
|
|
87
|
+
} : {
|
|
88
|
+
name: "1t690q7-column",
|
|
89
|
+
styles: "grid-auto-flow:column;label:column;",
|
|
90
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
91
|
+
};
|
|
92
|
+
var _ref11 = process.env.NODE_ENV === "production" ? {
|
|
85
93
|
name: "1uinx0j-euiFlexGrid",
|
|
86
94
|
styles: "display:grid;label:euiFlexGrid;"
|
|
87
95
|
} : {
|
|
@@ -89,18 +97,17 @@ var _ref10 = process.env.NODE_ENV === "production" ? {
|
|
|
89
97
|
styles: "display:grid;label:euiFlexGrid;",
|
|
90
98
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
91
99
|
};
|
|
92
|
-
// Note: the only way to get column direction working with `display: grid`
|
|
93
|
-
// the same way `display: flex` works is to manually set `grid-template-rows`,
|
|
94
|
-
// calculated based on the number of children in the grid
|
|
95
100
|
export var euiFlexGridStyles = function euiFlexGridStyles(euiThemeContext) {
|
|
96
|
-
var gridTemplateRows = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
97
101
|
var euiTheme = euiThemeContext.euiTheme;
|
|
98
102
|
return {
|
|
99
|
-
euiFlexGrid:
|
|
103
|
+
euiFlexGrid: _ref11,
|
|
100
104
|
responsive: /*#__PURE__*/css(euiMaxBreakpoint(euiThemeContext, 'm'), "{grid-template-columns:repeat(1, 1fr);grid-auto-flow:row;};label:responsive;"),
|
|
101
105
|
direction: {
|
|
102
106
|
row: /*#__PURE__*/css(";label:row;"),
|
|
103
|
-
|
|
107
|
+
// Note: the only way to get column direction working with `display: grid`
|
|
108
|
+
// the same way `display: flex` works is to manually set `grid-template-rows`,
|
|
109
|
+
// calculated based on the number of children in the grid
|
|
110
|
+
column: _ref10
|
|
104
111
|
},
|
|
105
112
|
columnCount: {
|
|
106
113
|
'1': _ref9,
|
|
@@ -10,19 +10,17 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
10
10
|
* Side Public License, v 1.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import React, { forwardRef } from 'react';
|
|
13
|
+
import React, { forwardRef, useEffect } from 'react';
|
|
14
14
|
import PropTypes from "prop-types";
|
|
15
15
|
import classNames from 'classnames';
|
|
16
|
-
import {
|
|
16
|
+
import { useEuiMemoizedStyles } from '../../services';
|
|
17
17
|
import { euiFlexGroupStyles } from './flex_group.styles';
|
|
18
18
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
19
19
|
export var GUTTER_SIZES = ['none', 'xs', 's', 'm', 'l', 'xl'];
|
|
20
20
|
export var ALIGN_ITEMS = ['stretch', 'flexStart', 'flexEnd', 'center', 'baseline'];
|
|
21
21
|
export var JUSTIFY_CONTENTS = ['flexStart', 'flexEnd', 'center', 'spaceBetween', 'spaceAround', 'spaceEvenly'];
|
|
22
22
|
export var DIRECTIONS = ['row', 'rowReverse', 'column', 'columnReverse'];
|
|
23
|
-
var
|
|
24
|
-
return ['div', 'span'].includes(component);
|
|
25
|
-
};
|
|
23
|
+
export var COMPONENT_TYPES = ['div', 'span'];
|
|
26
24
|
export var EuiFlexGroup = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
27
25
|
var children = _ref.children,
|
|
28
26
|
className = _ref.className,
|
|
@@ -41,13 +39,14 @@ export var EuiFlexGroup = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
41
39
|
_ref$component = _ref.component,
|
|
42
40
|
component = _ref$component === void 0 ? 'div' : _ref$component,
|
|
43
41
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
44
|
-
var
|
|
45
|
-
var styles = euiFlexGroupStyles(euiTheme);
|
|
42
|
+
var styles = useEuiMemoizedStyles(euiFlexGroupStyles);
|
|
46
43
|
var cssStyles = [styles.euiFlexGroup, responsive && !direction.includes('column') && styles.responsive, wrap && styles.wrap, styles.gutterSizes[gutterSize], styles.justifyContent[justifyContent], styles.alignItems[alignItems], styles.direction[direction]];
|
|
47
44
|
var classes = classNames('euiFlexGroup', className);
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
45
|
+
useEffect(function () {
|
|
46
|
+
if (!COMPONENT_TYPES.includes(component)) {
|
|
47
|
+
throw new Error("".concat(component, " is not a valid element type. Use `div` or `span`."));
|
|
48
|
+
}
|
|
49
|
+
}, [component]);
|
|
51
50
|
return component === 'span' ? ___EmotionJSX("span", _extends({
|
|
52
51
|
css: cssStyles,
|
|
53
52
|
className: classes,
|
|
@@ -60,7 +59,7 @@ export var EuiFlexGroup = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
60
59
|
});
|
|
61
60
|
EuiFlexGroup.propTypes = {
|
|
62
61
|
alignItems: PropTypes.any,
|
|
63
|
-
component: PropTypes.
|
|
62
|
+
component: PropTypes.any,
|
|
64
63
|
direction: PropTypes.any,
|
|
65
64
|
gutterSize: PropTypes.any,
|
|
66
65
|
justifyContent: PropTypes.any,
|
|
@@ -10,11 +10,12 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
10
10
|
* Side Public License, v 1.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import React from 'react';
|
|
13
|
+
import React, { useEffect } from 'react';
|
|
14
14
|
import PropTypes from "prop-types";
|
|
15
15
|
import classNames from 'classnames';
|
|
16
|
-
import { euiFlexItemStyles } from './flex_item.styles';
|
|
16
|
+
import { euiFlexItemStyles as styles } from './flex_item.styles';
|
|
17
17
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
18
|
+
var VALID_GROW_VALUES = [null, undefined, true, false, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
|
18
19
|
export var EuiFlexItem = function EuiFlexItem(_ref) {
|
|
19
20
|
var children = _ref.children,
|
|
20
21
|
className = _ref.className,
|
|
@@ -23,8 +24,11 @@ export var EuiFlexItem = function EuiFlexItem(_ref) {
|
|
|
23
24
|
_ref$component = _ref.component,
|
|
24
25
|
Component = _ref$component === void 0 ? 'div' : _ref$component,
|
|
25
26
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
useEffect(function () {
|
|
28
|
+
if (VALID_GROW_VALUES.indexOf(grow) === -1) {
|
|
29
|
+
throw new Error("Prop `grow` passed to `EuiFlexItem` must be a boolean or an integer between 0 and 10, received `".concat(grow, "`"));
|
|
30
|
+
}
|
|
31
|
+
}, [grow]);
|
|
28
32
|
var cssStyles = [styles.euiFlexItem, !grow ? styles.growZero : styles.grow, grow && (typeof grow === 'number' ? styles.growSizes[grow] : styles.growSizes['1'])];
|
|
29
33
|
var classes = classNames('euiFlexItem', className);
|
|
30
34
|
return ___EmotionJSX(Component, _extends({
|
|
@@ -43,10 +47,4 @@ EuiFlexItem.propTypes = {
|
|
|
43
47
|
* @default div
|
|
44
48
|
*/
|
|
45
49
|
component: PropTypes.any
|
|
46
|
-
};
|
|
47
|
-
export var VALID_GROW_VALUES = [null, undefined, true, false, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
|
48
|
-
function validateGrowValue(value) {
|
|
49
|
-
if (VALID_GROW_VALUES.indexOf(value) === -1) {
|
|
50
|
-
throw new Error("Prop `grow` passed to `EuiFlexItem` must be a boolean or an integer between 0 and 10, received `".concat(value, "`"));
|
|
51
|
-
}
|
|
52
|
-
}
|
|
50
|
+
};
|