@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
|
@@ -195,113 +195,115 @@ export var useDataGridDisplaySelector = function useDataGridDisplaySelector(show
|
|
|
195
195
|
}, []);
|
|
196
196
|
var buttonLabel = useEuiI18n('euiDisplaySelector.buttonText', 'Display options');
|
|
197
197
|
var resetButtonLabel = useEuiI18n('euiDisplaySelector.resetButtonText', 'Reset to default');
|
|
198
|
-
var displaySelector =
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
anchorPosition: "downRight",
|
|
205
|
-
panelPaddingSize: "s",
|
|
206
|
-
panelClassName: "euiDataGrid__displayPopoverPanel",
|
|
207
|
-
button: ___EmotionJSX(EuiToolTip, {
|
|
208
|
-
content: buttonLabel,
|
|
209
|
-
delay: "long"
|
|
210
|
-
}, ___EmotionJSX(EuiButtonIcon, {
|
|
211
|
-
size: "xs",
|
|
212
|
-
iconType: "controlsHorizontal",
|
|
213
|
-
color: "text",
|
|
214
|
-
"data-test-subj": "dataGridDisplaySelectorButton",
|
|
215
|
-
onClick: function onClick() {
|
|
216
|
-
return setIsOpen(!isOpen);
|
|
198
|
+
var displaySelector = useMemo(function () {
|
|
199
|
+
return showDensityControls || showRowHeightControls || additionalDisplaySettings ? ___EmotionJSX(EuiPopover, {
|
|
200
|
+
"data-test-subj": "dataGridDisplaySelectorPopover",
|
|
201
|
+
isOpen: isOpen,
|
|
202
|
+
closePopover: function closePopover() {
|
|
203
|
+
return setIsOpen(false);
|
|
217
204
|
},
|
|
218
|
-
"
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
label:
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
label:
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
205
|
+
anchorPosition: "downRight",
|
|
206
|
+
panelPaddingSize: "s",
|
|
207
|
+
panelClassName: "euiDataGrid__displayPopoverPanel",
|
|
208
|
+
button: ___EmotionJSX(EuiToolTip, {
|
|
209
|
+
content: buttonLabel,
|
|
210
|
+
delay: "long"
|
|
211
|
+
}, ___EmotionJSX(EuiButtonIcon, {
|
|
212
|
+
size: "xs",
|
|
213
|
+
iconType: "controlsHorizontal",
|
|
214
|
+
color: "text",
|
|
215
|
+
"data-test-subj": "dataGridDisplaySelectorButton",
|
|
216
|
+
onClick: function onClick() {
|
|
217
|
+
return setIsOpen(!isOpen);
|
|
218
|
+
},
|
|
219
|
+
"aria-label": buttonLabel
|
|
220
|
+
}))
|
|
221
|
+
}, showDensityControls && ___EmotionJSX(EuiI18n, {
|
|
222
|
+
tokens: ['euiDisplaySelector.densityLabel', 'euiDisplaySelector.labelCompact', 'euiDisplaySelector.labelNormal', 'euiDisplaySelector.labelExpanded'],
|
|
223
|
+
defaults: ['Density', 'Compact', 'Normal', 'Expanded']
|
|
224
|
+
}, function (_ref) {
|
|
225
|
+
var _ref2 = _slicedToArray(_ref, 4),
|
|
226
|
+
densityLabel = _ref2[0],
|
|
227
|
+
labelCompact = _ref2[1],
|
|
228
|
+
labelNormal = _ref2[2],
|
|
229
|
+
labelExpanded = _ref2[3];
|
|
230
|
+
return ___EmotionJSX(EuiFormRow, {
|
|
231
|
+
label: densityLabel,
|
|
232
|
+
display: "columnCompressed"
|
|
233
|
+
}, ___EmotionJSX(EuiButtonGroup, {
|
|
234
|
+
legend: densityLabel,
|
|
235
|
+
buttonSize: "compressed",
|
|
236
|
+
isFullWidth: true,
|
|
237
|
+
options: [{
|
|
238
|
+
id: densityOptions[0],
|
|
239
|
+
label: labelCompact
|
|
240
|
+
}, {
|
|
241
|
+
id: densityOptions[1],
|
|
242
|
+
label: labelNormal
|
|
243
|
+
}, {
|
|
244
|
+
id: densityOptions[2],
|
|
245
|
+
label: labelExpanded
|
|
246
|
+
}],
|
|
247
|
+
onChange: setGridStyles,
|
|
248
|
+
idSelected: gridDensity,
|
|
249
|
+
"data-test-subj": "densityButtonGroup"
|
|
250
|
+
}));
|
|
251
|
+
}), showRowHeightControls && ___EmotionJSX(EuiI18n, {
|
|
252
|
+
tokens: ['euiDisplaySelector.rowHeightLabel', 'euiDisplaySelector.labelSingle', 'euiDisplaySelector.labelAuto', 'euiDisplaySelector.labelCustom', 'euiDisplaySelector.lineCountLabel'],
|
|
253
|
+
defaults: ['Row height', 'Single', 'Auto fit', 'Custom', 'Lines per row']
|
|
254
|
+
}, function (_ref3) {
|
|
255
|
+
var _ref4 = _slicedToArray(_ref3, 5),
|
|
256
|
+
rowHeightLabel = _ref4[0],
|
|
257
|
+
labelSingle = _ref4[1],
|
|
258
|
+
labelAuto = _ref4[2],
|
|
259
|
+
labelCustom = _ref4[3],
|
|
260
|
+
lineCountLabel = _ref4[4];
|
|
261
|
+
return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(EuiFormRow, {
|
|
262
|
+
label: rowHeightLabel,
|
|
263
|
+
display: "columnCompressed"
|
|
264
|
+
}, ___EmotionJSX(EuiButtonGroup, {
|
|
265
|
+
legend: rowHeightLabel,
|
|
266
|
+
buttonSize: "compressed",
|
|
267
|
+
isFullWidth: true,
|
|
268
|
+
options: [{
|
|
269
|
+
id: rowHeightButtonOptions[0],
|
|
270
|
+
label: labelSingle
|
|
271
|
+
}, {
|
|
272
|
+
id: rowHeightButtonOptions[1],
|
|
273
|
+
label: labelAuto
|
|
274
|
+
}, {
|
|
275
|
+
id: rowHeightButtonOptions[2],
|
|
276
|
+
label: labelCustom
|
|
277
|
+
}],
|
|
278
|
+
onChange: setRowHeight,
|
|
279
|
+
idSelected: rowHeightSelection,
|
|
280
|
+
"data-test-subj": "rowHeightButtonGroup"
|
|
281
|
+
})), rowHeightSelection === rowHeightButtonOptions[2] && ___EmotionJSX(EuiFormRow, {
|
|
282
|
+
label: lineCountLabel,
|
|
283
|
+
display: "columnCompressed"
|
|
284
|
+
}, ___EmotionJSX(EuiRange, {
|
|
285
|
+
compressed: true,
|
|
286
|
+
fullWidth: true,
|
|
287
|
+
showInput: true,
|
|
288
|
+
min: 1,
|
|
289
|
+
max: 20,
|
|
290
|
+
step: 1,
|
|
291
|
+
required: true,
|
|
292
|
+
value: lineCountInput,
|
|
293
|
+
onChange: setLineCountHeight,
|
|
294
|
+
"data-test-subj": "lineCountNumber"
|
|
295
|
+
})));
|
|
296
|
+
}), additionalDisplaySettings, showResetButton && ___EmotionJSX(EuiPopoverFooter, null, ___EmotionJSX(EuiFlexGroup, {
|
|
297
|
+
justifyContent: "flexEnd",
|
|
298
|
+
responsive: false
|
|
299
|
+
}, ___EmotionJSX(EuiFlexItem, {
|
|
300
|
+
grow: false
|
|
301
|
+
}, ___EmotionJSX("div", null, ___EmotionJSX(EuiButtonEmpty, {
|
|
302
|
+
flush: "both",
|
|
303
|
+
size: "xs",
|
|
304
|
+
onClick: resetToInitialState,
|
|
305
|
+
"data-test-subj": "resetDisplaySelector"
|
|
306
|
+
}, resetButtonLabel)))))) : null;
|
|
307
|
+
}, [additionalDisplaySettings, buttonLabel, isOpen, resetButtonLabel, showDensityControls, showResetButton, showRowHeightControls, gridDensity, rowHeightSelection, lineCountInput, setGridStyles, setRowHeight, setLineCountHeight, resetToInitialState]);
|
|
306
308
|
return [displaySelector, gridStyles, rowHeightsOptions];
|
|
307
309
|
};
|
|
@@ -66,9 +66,19 @@ var commaSeparateNumbers = function commaSeparateNumbers(numberString) {
|
|
|
66
66
|
);
|
|
67
67
|
});
|
|
68
68
|
};
|
|
69
|
+
var renderCellValue = function renderCellValue(_ref2) {
|
|
70
|
+
var rowIndex = _ref2.rowIndex,
|
|
71
|
+
columnId = _ref2.columnId,
|
|
72
|
+
schema = _ref2.schema;
|
|
73
|
+
var value = storeData[rowIndex][columnId];
|
|
74
|
+
if (schema === 'numeric') {
|
|
75
|
+
value = commaSeparateNumbers(value);
|
|
76
|
+
}
|
|
77
|
+
return value;
|
|
78
|
+
};
|
|
69
79
|
var DataGrid = function DataGrid() {
|
|
70
|
-
var _useState = useState(columns.map(function (
|
|
71
|
-
var id =
|
|
80
|
+
var _useState = useState(columns.map(function (_ref3) {
|
|
81
|
+
var id = _ref3.id;
|
|
72
82
|
return id;
|
|
73
83
|
})),
|
|
74
84
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -110,16 +120,7 @@ var DataGrid = function DataGrid() {
|
|
|
110
120
|
inMemory: {
|
|
111
121
|
level: 'sorting'
|
|
112
122
|
},
|
|
113
|
-
renderCellValue:
|
|
114
|
-
var rowIndex = _ref3.rowIndex,
|
|
115
|
-
columnId = _ref3.columnId,
|
|
116
|
-
schema = _ref3.schema;
|
|
117
|
-
var value = data[rowIndex][columnId];
|
|
118
|
-
if (schema === 'numeric') {
|
|
119
|
-
value = commaSeparateNumbers(value);
|
|
120
|
-
}
|
|
121
|
-
return value;
|
|
122
|
-
},
|
|
123
|
+
renderCellValue: renderCellValue,
|
|
123
124
|
sorting: {
|
|
124
125
|
columns: sortingColumns,
|
|
125
126
|
onSort: setSorting
|
|
@@ -3,8 +3,7 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
4
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
5
5
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
6
|
-
var _excluded = ["leadingControlColumns", "trailingControlColumns", "columns", "columnVisibility", "schemaDetectors", "rowCount", "renderCellValue", "cellContext", "renderCellPopover", "renderFooterCellValue", "className", "gridStyle", "toolbarVisibility", "pagination", "sorting", "inMemory", "onColumnResize", "minSizeForControls", "height", "width", "rowHeightsOptions", "virtualizationOptions", "renderCustomGridBody", "renderCustomToolbar"]
|
|
7
|
-
_excluded2 = ["focusProps"];
|
|
6
|
+
var _excluded = ["leadingControlColumns", "trailingControlColumns", "columns", "columnVisibility", "schemaDetectors", "rowCount", "renderCellValue", "cellContext", "renderCellPopover", "renderFooterCellValue", "className", "gridStyle", "toolbarVisibility", "pagination", "sorting", "inMemory", "onColumnResize", "minSizeForControls", "height", "width", "rowHeightsOptions", "virtualizationOptions", "renderCustomGridBody", "renderCustomToolbar"];
|
|
8
7
|
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; }
|
|
9
8
|
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; }
|
|
10
9
|
/*
|
|
@@ -16,7 +15,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
16
15
|
*/
|
|
17
16
|
|
|
18
17
|
import classNames from 'classnames';
|
|
19
|
-
import React, { forwardRef, useMemo, useRef, useState, memo } from 'react';
|
|
18
|
+
import React, { forwardRef, useMemo, useRef, useState, memo, useCallback } from 'react';
|
|
20
19
|
import { useGeneratedHtmlId } from '../../services';
|
|
21
20
|
import { useEuiTablePaginationDefaults } from '../table/table_pagination';
|
|
22
21
|
import { EuiFocusTrap } from '../focus_trap';
|
|
@@ -25,7 +24,7 @@ import { useMutationObserver } from '../observer/mutation_observer';
|
|
|
25
24
|
import { useResizeObserver } from '../observer/resize_observer';
|
|
26
25
|
import { EuiDataGridBody } from './body';
|
|
27
26
|
import { useDataGridColumnSelector, useDataGridColumnSorting, useDataGridDisplaySelector, startingStyles, useDataGridFullScreenSelector, useDataGridKeyboardShortcuts, checkOrDefaultToolBarDisplayOptions, EuiDataGridToolbar } from './controls';
|
|
28
|
-
import {
|
|
27
|
+
import { DataGridSortedContext, useSorting } from './utils/sorting';
|
|
29
28
|
import { DataGridFocusContext, useFocus, createKeyDownHandler, preventTabbing } from './utils/focus';
|
|
30
29
|
import { useInMemoryValues, EuiDataGridInMemoryRenderer } from './utils/in_memory';
|
|
31
30
|
import { DataGridCellPopoverContext, useCellPopover } from './body/cell';
|
|
@@ -65,8 +64,8 @@ var cellPaddingsToClassMap = {
|
|
|
65
64
|
m: '',
|
|
66
65
|
l: 'euiDataGrid--paddingLarge'
|
|
67
66
|
};
|
|
67
|
+
var emptyVirtualizationOptions = {};
|
|
68
68
|
export var EuiDataGrid = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (props, ref) {
|
|
69
|
-
var _gridItemsRendered$cu;
|
|
70
69
|
var _props$leadingControl = props.leadingControlColumns,
|
|
71
70
|
leadingControlColumns = _props$leadingControl === void 0 ? emptyControlColumns : _props$leadingControl,
|
|
72
71
|
_props$trailingContro = props.trailingControlColumns,
|
|
@@ -186,8 +185,14 @@ export var EuiDataGrid = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (pr
|
|
|
186
185
|
/**
|
|
187
186
|
* Sorting
|
|
188
187
|
*/
|
|
189
|
-
var columnSorting = useDataGridColumnSorting(
|
|
190
|
-
|
|
188
|
+
var columnSorting = useDataGridColumnSorting({
|
|
189
|
+
sorting: sorting,
|
|
190
|
+
columns: orderedVisibleColumns,
|
|
191
|
+
displayValues: displayValues,
|
|
192
|
+
schema: mergedSchema,
|
|
193
|
+
schemaDetectors: allSchemaDetectors
|
|
194
|
+
});
|
|
195
|
+
var sortedContext = useSorting({
|
|
191
196
|
sorting: sorting,
|
|
192
197
|
inMemory: inMemory,
|
|
193
198
|
inMemoryValues: inMemoryValues,
|
|
@@ -201,7 +206,20 @@ export var EuiDataGrid = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (pr
|
|
|
201
206
|
*/
|
|
202
207
|
var _useFocus = useFocus(),
|
|
203
208
|
wrappingDivFocusProps = _useFocus.focusProps,
|
|
204
|
-
|
|
209
|
+
onFocusUpdate = _useFocus.onFocusUpdate,
|
|
210
|
+
focusedCell = _useFocus.focusedCell,
|
|
211
|
+
setFocusedCell = _useFocus.setFocusedCell,
|
|
212
|
+
setIsFocusedCellInView = _useFocus.setIsFocusedCellInView,
|
|
213
|
+
focusFirstVisibleInteractiveCell = _useFocus.focusFirstVisibleInteractiveCell;
|
|
214
|
+
var focusContext = useMemo(function () {
|
|
215
|
+
return {
|
|
216
|
+
onFocusUpdate: onFocusUpdate,
|
|
217
|
+
focusedCell: focusedCell,
|
|
218
|
+
setFocusedCell: setFocusedCell,
|
|
219
|
+
setIsFocusedCellInView: setIsFocusedCellInView,
|
|
220
|
+
focusFirstVisibleInteractiveCell: focusFirstVisibleInteractiveCell
|
|
221
|
+
};
|
|
222
|
+
}, [onFocusUpdate, focusedCell, setFocusedCell, setIsFocusedCellInView, focusFirstVisibleInteractiveCell]);
|
|
205
223
|
|
|
206
224
|
/**
|
|
207
225
|
* Cell popover
|
|
@@ -231,7 +249,7 @@ export var EuiDataGrid = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (pr
|
|
|
231
249
|
setIsFullScreen: setIsFullScreen,
|
|
232
250
|
focusContext: focusContext,
|
|
233
251
|
cellPopoverContext: cellPopoverContext,
|
|
234
|
-
|
|
252
|
+
sortedContext: sortedContext,
|
|
235
253
|
pagination: pagination,
|
|
236
254
|
rowCount: rowCount,
|
|
237
255
|
visibleColCount: visibleColCount
|
|
@@ -278,12 +296,25 @@ export var EuiDataGrid = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (pr
|
|
|
278
296
|
gridAriaProps['aria-labelledby'] = "".concat(rest['aria-labelledby'], " ").concat(pagination ? ariaLabelledById : '');
|
|
279
297
|
delete rest['aria-labelledby'];
|
|
280
298
|
}
|
|
299
|
+
var onKeyDown = useCallback(function (event) {
|
|
300
|
+
var _gridItemsRendered$cu;
|
|
301
|
+
createKeyDownHandler({
|
|
302
|
+
gridElement: contentRef.current,
|
|
303
|
+
visibleColCount: visibleColCount,
|
|
304
|
+
visibleRowCount: visibleRowCount,
|
|
305
|
+
visibleRowStartIndex: ((_gridItemsRendered$cu = gridItemsRendered.current) === null || _gridItemsRendered$cu === void 0 ? void 0 : _gridItemsRendered$cu.visibleRowStartIndex) || 0,
|
|
306
|
+
rowCount: rowCount,
|
|
307
|
+
pagination: pagination,
|
|
308
|
+
hasFooter: !!renderFooterCellValue,
|
|
309
|
+
focusContext: focusContext
|
|
310
|
+
})(event);
|
|
311
|
+
}, [focusContext, visibleColCount, visibleRowCount, rowCount, pagination, renderFooterCellValue]);
|
|
281
312
|
return ___EmotionJSX(DataGridFocusContext.Provider, {
|
|
282
313
|
value: focusContext
|
|
283
314
|
}, ___EmotionJSX(DataGridCellPopoverContext.Provider, {
|
|
284
315
|
value: cellPopoverContext
|
|
285
|
-
}, ___EmotionJSX(
|
|
286
|
-
value:
|
|
316
|
+
}, ___EmotionJSX(DataGridSortedContext.Provider, {
|
|
317
|
+
value: sortedContext
|
|
287
318
|
}, ___EmotionJSX(EuiFocusTrap, {
|
|
288
319
|
disabled: !isFullScreen,
|
|
289
320
|
className: "euiDataGrid__focusWrap"
|
|
@@ -319,16 +350,7 @@ export var EuiDataGrid = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (pr
|
|
|
319
350
|
}) : null, ___EmotionJSX("div", _extends({
|
|
320
351
|
// eslint-disable-line jsx-a11y/interactive-supports-focus
|
|
321
352
|
ref: contentRef,
|
|
322
|
-
onKeyDown:
|
|
323
|
-
gridElement: contentRef.current,
|
|
324
|
-
visibleColCount: visibleColCount,
|
|
325
|
-
visibleRowCount: visibleRowCount,
|
|
326
|
-
visibleRowStartIndex: ((_gridItemsRendered$cu = gridItemsRendered.current) === null || _gridItemsRendered$cu === void 0 ? void 0 : _gridItemsRendered$cu.visibleRowStartIndex) || 0,
|
|
327
|
-
rowCount: rowCount,
|
|
328
|
-
pagination: pagination,
|
|
329
|
-
hasFooter: !!renderFooterCellValue,
|
|
330
|
-
focusContext: focusContext
|
|
331
|
-
}),
|
|
353
|
+
onKeyDown: onKeyDown,
|
|
332
354
|
"data-test-subj": "euiDataGridBody",
|
|
333
355
|
className: "euiDataGrid__content",
|
|
334
356
|
role: "grid",
|
|
@@ -344,6 +366,7 @@ export var EuiDataGrid = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (pr
|
|
|
344
366
|
switchColumnPos: switchColumnPos,
|
|
345
367
|
onColumnResize: onColumnResize,
|
|
346
368
|
schemaDetectors: allSchemaDetectors,
|
|
369
|
+
sorting: sorting,
|
|
347
370
|
pagination: pagination,
|
|
348
371
|
renderCellValue: renderCellValue,
|
|
349
372
|
cellContext: cellContext,
|
|
@@ -353,7 +376,7 @@ export var EuiDataGrid = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (pr
|
|
|
353
376
|
visibleRows: visibleRows,
|
|
354
377
|
interactiveCellId: interactiveCellId,
|
|
355
378
|
rowHeightsOptions: rowHeightsOptions,
|
|
356
|
-
virtualizationOptions: virtualizationOptions ||
|
|
379
|
+
virtualizationOptions: virtualizationOptions || emptyVirtualizationOptions,
|
|
357
380
|
isFullScreen: isFullScreen,
|
|
358
381
|
gridStyles: gridStyles,
|
|
359
382
|
gridWidth: gridWidth,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
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; }
|
|
5
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; }
|
|
@@ -48,10 +48,12 @@ export var useColumnWidths = function useColumnWidths(_ref) {
|
|
|
48
48
|
onColumnResize = _ref.onColumnResize;
|
|
49
49
|
var computeColumnWidths = useCallback(function () {
|
|
50
50
|
return columns.filter(doesColumnHaveAnInitialWidth).reduce(function (initialWidths, column) {
|
|
51
|
-
initialWidths
|
|
52
|
-
return initialWidths;
|
|
51
|
+
return _objectSpread(_objectSpread({}, initialWidths), {}, _defineProperty({}, column.id, column.initialWidth));
|
|
53
52
|
}, {});
|
|
54
53
|
}, [columns]);
|
|
54
|
+
|
|
55
|
+
// Passes initializer function for performance, so computing only runs once on init
|
|
56
|
+
// @see https://react.dev/reference/react/useState#examples-initializer
|
|
55
57
|
var _useState = useState(computeColumnWidths),
|
|
56
58
|
_useState2 = _slicedToArray(_useState, 2),
|
|
57
59
|
columnWidths = _useState2[0],
|
|
@@ -60,14 +62,16 @@ export var useColumnWidths = function useColumnWidths(_ref) {
|
|
|
60
62
|
setColumnWidths(computeColumnWidths());
|
|
61
63
|
}, [computeColumnWidths]);
|
|
62
64
|
var setColumnWidth = useCallback(function (columnId, width) {
|
|
63
|
-
setColumnWidths(
|
|
65
|
+
setColumnWidths(function (prevColumnWidths) {
|
|
66
|
+
return _objectSpread(_objectSpread({}, prevColumnWidths), {}, _defineProperty({}, columnId, width));
|
|
67
|
+
});
|
|
64
68
|
if (onColumnResize) {
|
|
65
69
|
onColumnResize({
|
|
66
70
|
columnId: columnId,
|
|
67
71
|
width: width
|
|
68
72
|
});
|
|
69
73
|
}
|
|
70
|
-
}, [
|
|
74
|
+
}, [onColumnResize]);
|
|
71
75
|
|
|
72
76
|
// Used by react-window to determine actual column widths
|
|
73
77
|
var getColumnWidth = useCallback(function (index) {
|
|
@@ -87,14 +87,16 @@ export var useFocus = function useFocus() {
|
|
|
87
87
|
}
|
|
88
88
|
};
|
|
89
89
|
}, [isFocusedCellInView, focusFirstVisibleInteractiveCell]);
|
|
90
|
-
return {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
90
|
+
return useMemo(function () {
|
|
91
|
+
return {
|
|
92
|
+
onFocusUpdate: onFocusUpdate,
|
|
93
|
+
focusedCell: focusedCell,
|
|
94
|
+
setFocusedCell: setFocusedCell,
|
|
95
|
+
setIsFocusedCellInView: setIsFocusedCellInView,
|
|
96
|
+
focusFirstVisibleInteractiveCell: focusFirstVisibleInteractiveCell,
|
|
97
|
+
focusProps: focusProps
|
|
98
|
+
};
|
|
99
|
+
}, [onFocusUpdate, focusedCell, setFocusedCell, setIsFocusedCellInView, focusFirstVisibleInteractiveCell, focusProps]);
|
|
98
100
|
};
|
|
99
101
|
export var notifyCellOfFocusState = function notifyCellOfFocusState(cellsUpdateFocus, cell, isFocused) {
|
|
100
102
|
var key = "".concat(cell[0], "-").concat(cell[1]);
|
|
@@ -7,11 +7,11 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
7
7
|
* Side Public License, v 1.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import { useEffect, useState, useContext } from 'react';
|
|
10
|
+
import { useEffect, useState, useContext, useMemo } from 'react';
|
|
11
11
|
import { IS_JEST_ENVIRONMENT } from '../../../utils';
|
|
12
12
|
import { useUpdateEffect, useForceRender } from '../../../services';
|
|
13
13
|
import { useResizeObserver } from '../../observer/resize_observer';
|
|
14
|
-
import {
|
|
14
|
+
import { DataGridSortedContext } from './sorting';
|
|
15
15
|
export var useFinalGridDimensions = function useFinalGridDimensions(_ref) {
|
|
16
16
|
var unconstrainedHeight = _ref.unconstrainedHeight,
|
|
17
17
|
unconstrainedWidth = _ref.unconstrainedWidth,
|
|
@@ -83,42 +83,43 @@ export var useUnconstrainedHeight = function useUnconstrainedHeight(_ref2) {
|
|
|
83
83
|
footerRowHeight = _ref2.footerRowHeight,
|
|
84
84
|
scrollBarHeight = _ref2.scrollBarHeight,
|
|
85
85
|
innerGridRef = _ref2.innerGridRef;
|
|
86
|
-
var _useContext = useContext(
|
|
86
|
+
var _useContext = useContext(DataGridSortedContext),
|
|
87
87
|
getCorrectRowIndex = _useContext.getCorrectRowIndex;
|
|
88
|
-
var knownHeight = 0; // tracks the pixel height of rows we know the size of
|
|
89
|
-
var knownRowCount = 0; // how many rows we know the size of
|
|
90
|
-
for (var i = startRow; i < endRow; i++) {
|
|
91
|
-
var correctRowIndex = getCorrectRowIndex(i); // map visible row to logical row
|
|
92
|
-
|
|
93
|
-
// lookup the height configuration of this row
|
|
94
|
-
var rowHeightOption = rowHeightUtils.getRowHeightOption(correctRowIndex, rowHeightsOptions);
|
|
95
|
-
if (rowHeightOption) {
|
|
96
|
-
// this row's height is known
|
|
97
|
-
knownRowCount++;
|
|
98
|
-
knownHeight += rowHeightUtils.getCalculatedHeight(rowHeightOption, defaultRowHeight, correctRowIndex, rowHeightUtils.isRowHeightOverride(correctRowIndex, rowHeightsOptions));
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
// how many rows to provide space for on the screen
|
|
103
|
-
var rowCountToAffordFor = endRow - startRow;
|
|
104
|
-
|
|
105
88
|
// watch the inner element for a change to its width
|
|
106
89
|
// which may cause the horizontal scrollbar to be added or removed
|
|
107
90
|
var _useResizeObserver = useResizeObserver(innerGridRef.current, 'width'),
|
|
108
91
|
innerWidth = _useResizeObserver.width;
|
|
109
92
|
var forceRender = useForceRender();
|
|
110
93
|
useUpdateEffect(forceRender, [innerWidth]);
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
94
|
+
return useMemo(function () {
|
|
95
|
+
var knownHeight = 0; // tracks the pixel height of rows we know the size of
|
|
96
|
+
var knownRowCount = 0; // how many rows we know the size of
|
|
97
|
+
for (var i = startRow; i < endRow; i++) {
|
|
98
|
+
var correctRowIndex = getCorrectRowIndex(i); // map visible row to logical row
|
|
99
|
+
|
|
100
|
+
// lookup the height configuration of this row
|
|
101
|
+
var rowHeightOption = rowHeightUtils.getRowHeightOption(correctRowIndex, rowHeightsOptions);
|
|
102
|
+
if (rowHeightOption) {
|
|
103
|
+
// this row's height is known
|
|
104
|
+
knownRowCount++;
|
|
105
|
+
knownHeight += rowHeightUtils.getCalculatedHeight(rowHeightOption, defaultRowHeight, correctRowIndex, rowHeightUtils.isRowHeightOverride(correctRowIndex, rowHeightsOptions));
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// how many rows to provide space for on the screen
|
|
110
|
+
var rowCountToAffordFor = endRow - startRow;
|
|
111
|
+
var unconstrainedHeight = defaultRowHeight * (rowCountToAffordFor - knownRowCount) +
|
|
112
|
+
// guess how much space is required for unknown rows
|
|
113
|
+
knownHeight +
|
|
114
|
+
// computed pixel height of the known rows
|
|
115
|
+
headerRowHeight +
|
|
116
|
+
// account for header
|
|
117
|
+
footerRowHeight +
|
|
118
|
+
// account for footer
|
|
119
|
+
scrollBarHeight; // account for horizontal scrollbar
|
|
120
120
|
|
|
121
|
-
|
|
121
|
+
return unconstrainedHeight;
|
|
122
|
+
}, [defaultRowHeight, endRow, footerRowHeight, headerRowHeight, startRow, getCorrectRowIndex, rowHeightUtils, rowHeightsOptions, scrollBarHeight]);
|
|
122
123
|
};
|
|
123
124
|
|
|
124
125
|
/**
|
|
@@ -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;
|
|
@@ -20,7 +20,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
20
20
|
import { useCallback, useContext, useEffect, useMemo, useState } from 'react';
|
|
21
21
|
import { useForceRender, useLatest } from '../../../services';
|
|
22
22
|
import { isNumber, isObject } from '../../../services/predicate';
|
|
23
|
-
import {
|
|
23
|
+
import { DataGridSortedContext } from './sorting';
|
|
24
24
|
|
|
25
25
|
// TODO: Once JS variables are available, use them here instead of hard-coded maps
|
|
26
26
|
export var cellPaddingsMap = {
|
|
@@ -325,7 +325,7 @@ export var useRowHeightUtils = function useRowHeightUtils(_ref2) {
|
|
|
325
325
|
export var useDefaultRowHeight = function useDefaultRowHeight(_ref3) {
|
|
326
326
|
var rowHeightsOptions = _ref3.rowHeightsOptions,
|
|
327
327
|
rowHeightUtils = _ref3.rowHeightUtils;
|
|
328
|
-
var _useContext = useContext(
|
|
328
|
+
var _useContext = useContext(DataGridSortedContext),
|
|
329
329
|
getCorrectRowIndex = _useContext.getCorrectRowIndex;
|
|
330
330
|
|
|
331
331
|
// `minRowHeight` is primarily used by undefined & lineCount heights
|