@elastic/eui 95.10.0 → 95.11.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_theme_dark.css +0 -923
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +0 -923
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/basic_table/basic_table.js +4 -3
- package/es/components/basic_table/collapsed_item_actions.js +24 -31
- package/es/components/datagrid/body/cell/data_grid_cell.js +98 -86
- package/es/components/datagrid/body/cell/data_grid_cell.styles.js +107 -0
- package/es/components/datagrid/body/cell/data_grid_cell_actions.js +13 -3
- package/es/components/datagrid/body/cell/data_grid_cell_actions.styles.js +33 -0
- package/es/components/datagrid/body/cell/data_grid_cell_popover.js +21 -12
- package/es/components/datagrid/body/cell/data_grid_cell_popover.styles.js +19 -0
- package/es/components/datagrid/body/cell/focus_utils.js +18 -20
- package/es/components/datagrid/body/data_grid_body.js +20 -4
- package/es/components/datagrid/body/data_grid_body.styles.js +26 -0
- package/es/components/datagrid/body/data_grid_body_custom.js +18 -6
- package/es/components/datagrid/body/data_grid_body_virtualized.js +18 -6
- package/es/components/datagrid/body/footer/data_grid_footer.styles.js +24 -0
- package/es/components/datagrid/body/footer/data_grid_footer_row.js +10 -5
- package/es/components/datagrid/body/header/column_actions.js +16 -4
- package/es/components/datagrid/body/header/data_grid_column_resizer.js +14 -7
- package/es/components/datagrid/body/header/data_grid_column_resizer.styles.js +36 -0
- package/es/components/datagrid/body/header/data_grid_control_header_cell.js +1 -3
- package/es/components/datagrid/body/header/data_grid_header_cell.js +40 -66
- package/es/components/datagrid/body/header/data_grid_header_cell.styles.js +29 -0
- package/es/components/datagrid/body/header/data_grid_header_cell_wrapper.js +4 -1
- package/es/components/datagrid/body/header/data_grid_header_cell_wrapper.styles.js +27 -0
- package/es/components/datagrid/body/header/data_grid_header_row.js +8 -2
- package/es/components/datagrid/body/header/data_grid_header_row.styles.js +21 -0
- package/es/components/datagrid/controls/column_selector.js +17 -8
- package/es/components/datagrid/controls/column_selector.styles.js +22 -0
- package/es/components/datagrid/controls/column_sorting.js +7 -2
- package/es/components/datagrid/controls/column_sorting.styles.js +35 -0
- package/es/components/datagrid/controls/column_sorting_draggable.js +19 -14
- package/es/components/datagrid/controls/data_grid_toolbar.js +8 -1
- package/es/components/datagrid/controls/data_grid_toolbar.styles.js +18 -0
- package/es/components/datagrid/controls/data_grid_toolbar_control.js +27 -27
- package/es/components/datagrid/controls/display_selector.js +14 -3
- package/es/components/datagrid/controls/fullscreen_selector.js +8 -5
- package/es/components/datagrid/controls/fullscreen_selector.styles.js +20 -0
- package/es/components/datagrid/controls/keyboard_shortcuts.js +7 -3
- package/es/components/datagrid/controls/keyboard_shortcuts.styles.js +18 -0
- package/es/components/datagrid/data_grid.a11y.js +1 -0
- package/es/components/datagrid/data_grid.js +16 -8
- package/es/components/datagrid/data_grid.stories.utils.js +1386 -0
- package/es/components/datagrid/data_grid.styles.js +88 -0
- package/es/components/datagrid/{utils → pagination}/data_grid_pagination.js +30 -30
- package/es/components/datagrid/pagination/data_grid_pagination.styles.js +16 -0
- package/es/components/datagrid/pagination/index.js +9 -0
- package/es/components/datagrid/utils/row_heights.js +13 -15
- package/es/components/datagrid/utils/scrolling.js +14 -7
- package/es/components/datagrid/utils/scrolling.styles.js +30 -0
- package/es/components/flyout/flyout_resizable.js +6 -2
- package/es/components/flyout/flyout_resizable.styles.js +34 -5
- package/es/components/popover/popover.js +1 -1
- package/es/components/text/text.js +25 -9
- package/es/components/text/text_align.js +19 -6
- package/es/components/text/text_color.js +14 -11
- package/es/components/text/types.js +1 -0
- package/eui.d.ts +581 -108
- package/i18ntokens.json +392 -356
- package/lib/components/basic_table/basic_table.js +4 -3
- package/lib/components/basic_table/collapsed_item_actions.js +23 -30
- package/lib/components/datagrid/body/cell/data_grid_cell.js +95 -83
- package/lib/components/datagrid/body/cell/data_grid_cell.styles.js +111 -0
- package/lib/components/datagrid/body/cell/data_grid_cell_actions.js +13 -3
- package/lib/components/datagrid/body/cell/data_grid_cell_actions.styles.js +38 -0
- package/lib/components/datagrid/body/cell/data_grid_cell_popover.js +20 -11
- package/lib/components/datagrid/body/cell/data_grid_cell_popover.styles.js +24 -0
- package/lib/components/datagrid/body/cell/focus_utils.js +17 -19
- package/lib/components/datagrid/body/data_grid_body.js +20 -4
- package/lib/components/datagrid/body/data_grid_body.styles.js +30 -0
- package/lib/components/datagrid/body/data_grid_body_custom.js +18 -6
- package/lib/components/datagrid/body/data_grid_body_virtualized.js +18 -6
- package/lib/components/datagrid/body/footer/data_grid_footer.styles.js +30 -0
- package/lib/components/datagrid/body/footer/data_grid_footer_row.js +11 -6
- package/lib/components/datagrid/body/header/column_actions.js +16 -4
- package/lib/components/datagrid/body/header/data_grid_column_resizer.js +14 -7
- package/lib/components/datagrid/body/header/data_grid_column_resizer.styles.js +39 -0
- package/lib/components/datagrid/body/header/data_grid_control_header_cell.js +1 -3
- package/lib/components/datagrid/body/header/data_grid_header_cell.js +47 -74
- package/lib/components/datagrid/body/header/data_grid_header_cell.styles.js +34 -0
- package/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.js +3 -0
- package/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.styles.js +32 -0
- package/lib/components/datagrid/body/header/data_grid_header_row.js +8 -2
- package/lib/components/datagrid/body/header/data_grid_header_row.styles.js +27 -0
- package/lib/components/datagrid/controls/column_selector.js +17 -8
- package/lib/components/datagrid/controls/column_selector.styles.js +28 -0
- package/lib/components/datagrid/controls/column_sorting.js +7 -2
- package/lib/components/datagrid/controls/column_sorting.styles.js +41 -0
- package/lib/components/datagrid/controls/column_sorting_draggable.js +19 -14
- package/lib/components/datagrid/controls/data_grid_toolbar.js +8 -1
- package/lib/components/datagrid/controls/data_grid_toolbar.styles.js +24 -0
- package/lib/components/datagrid/controls/data_grid_toolbar_control.js +27 -27
- package/lib/components/datagrid/controls/display_selector.js +13 -2
- package/lib/components/datagrid/controls/fullscreen_selector.js +7 -4
- package/lib/components/datagrid/controls/fullscreen_selector.styles.js +26 -0
- package/lib/components/datagrid/controls/keyboard_shortcuts.js +6 -2
- package/lib/components/datagrid/controls/keyboard_shortcuts.styles.js +24 -0
- package/lib/components/datagrid/data_grid.a11y.js +1 -0
- package/lib/components/datagrid/data_grid.js +15 -7
- package/lib/components/datagrid/data_grid.stories.utils.js +1391 -0
- package/lib/components/datagrid/data_grid.styles.js +94 -0
- package/lib/components/datagrid/{utils → pagination}/data_grid_pagination.js +30 -30
- package/lib/components/datagrid/pagination/data_grid_pagination.styles.js +22 -0
- package/lib/components/datagrid/pagination/index.js +18 -0
- package/lib/components/datagrid/utils/row_heights.js +13 -14
- package/lib/components/datagrid/utils/scrolling.js +14 -7
- package/lib/components/datagrid/utils/scrolling.styles.js +36 -0
- package/lib/components/flyout/flyout_resizable.js +6 -2
- package/lib/components/flyout/flyout_resizable.styles.js +34 -5
- package/lib/components/popover/popover.js +1 -1
- package/lib/components/text/text.js +25 -9
- package/lib/components/text/text_align.js +19 -6
- package/lib/components/text/text_color.js +14 -11
- package/lib/components/text/types.js +5 -0
- package/optimize/es/components/basic_table/basic_table.js +4 -3
- package/optimize/es/components/basic_table/collapsed_item_actions.js +24 -31
- package/optimize/es/components/datagrid/body/cell/data_grid_cell.js +87 -81
- package/optimize/es/components/datagrid/body/cell/data_grid_cell.styles.js +107 -0
- package/optimize/es/components/datagrid/body/cell/data_grid_cell_actions.js +13 -3
- package/optimize/es/components/datagrid/body/cell/data_grid_cell_actions.styles.js +33 -0
- package/optimize/es/components/datagrid/body/cell/data_grid_cell_popover.js +21 -12
- package/optimize/es/components/datagrid/body/cell/data_grid_cell_popover.styles.js +19 -0
- package/optimize/es/components/datagrid/body/cell/focus_utils.js +18 -20
- package/optimize/es/components/datagrid/body/data_grid_body.js +9 -2
- package/optimize/es/components/datagrid/body/data_grid_body.styles.js +26 -0
- package/optimize/es/components/datagrid/body/data_grid_body_custom.js +7 -4
- package/optimize/es/components/datagrid/body/data_grid_body_virtualized.js +7 -4
- package/optimize/es/components/datagrid/body/footer/data_grid_footer.styles.js +24 -0
- package/optimize/es/components/datagrid/body/footer/data_grid_footer_row.js +10 -5
- package/optimize/es/components/datagrid/body/header/column_actions.js +16 -4
- package/optimize/es/components/datagrid/body/header/data_grid_column_resizer.js +14 -7
- package/optimize/es/components/datagrid/body/header/data_grid_column_resizer.styles.js +36 -0
- package/optimize/es/components/datagrid/body/header/data_grid_control_header_cell.js +1 -3
- package/optimize/es/components/datagrid/body/header/data_grid_header_cell.js +40 -61
- package/optimize/es/components/datagrid/body/header/data_grid_header_cell.styles.js +29 -0
- package/optimize/es/components/datagrid/body/header/data_grid_header_cell_wrapper.js +4 -1
- package/optimize/es/components/datagrid/body/header/data_grid_header_cell_wrapper.styles.js +27 -0
- package/optimize/es/components/datagrid/body/header/data_grid_header_row.js +8 -2
- package/optimize/es/components/datagrid/body/header/data_grid_header_row.styles.js +21 -0
- package/optimize/es/components/datagrid/controls/column_selector.js +17 -8
- package/optimize/es/components/datagrid/controls/column_selector.styles.js +22 -0
- package/optimize/es/components/datagrid/controls/column_sorting.js +7 -2
- package/optimize/es/components/datagrid/controls/column_sorting.styles.js +35 -0
- package/optimize/es/components/datagrid/controls/column_sorting_draggable.js +19 -14
- package/optimize/es/components/datagrid/controls/data_grid_toolbar.js +8 -1
- package/optimize/es/components/datagrid/controls/data_grid_toolbar.styles.js +18 -0
- package/optimize/es/components/datagrid/controls/data_grid_toolbar_control.js +27 -27
- package/optimize/es/components/datagrid/controls/display_selector.js +14 -3
- package/optimize/es/components/datagrid/controls/fullscreen_selector.js +8 -5
- package/optimize/es/components/datagrid/controls/fullscreen_selector.styles.js +20 -0
- package/optimize/es/components/datagrid/controls/keyboard_shortcuts.js +7 -3
- package/optimize/es/components/datagrid/controls/keyboard_shortcuts.styles.js +18 -0
- package/optimize/es/components/datagrid/data_grid.a11y.js +1 -0
- package/optimize/es/components/datagrid/data_grid.js +16 -8
- package/optimize/es/components/datagrid/data_grid.stories.utils.js +333 -0
- package/optimize/es/components/datagrid/data_grid.styles.js +88 -0
- package/optimize/es/components/datagrid/{utils → pagination}/data_grid_pagination.js +30 -30
- package/optimize/es/components/datagrid/pagination/data_grid_pagination.styles.js +16 -0
- package/optimize/es/components/datagrid/pagination/index.js +9 -0
- package/optimize/es/components/datagrid/utils/row_heights.js +13 -15
- package/optimize/es/components/datagrid/utils/scrolling.js +14 -7
- package/optimize/es/components/datagrid/utils/scrolling.styles.js +30 -0
- package/optimize/es/components/flyout/flyout_resizable.js +6 -2
- package/optimize/es/components/flyout/flyout_resizable.styles.js +34 -5
- package/optimize/es/components/popover/popover.js +1 -1
- package/optimize/es/components/text/text.js +9 -4
- package/optimize/es/components/text/text_align.js +4 -2
- package/optimize/es/components/text/text_color.js +1 -2
- package/optimize/es/components/text/types.js +1 -0
- package/optimize/lib/components/basic_table/basic_table.js +4 -3
- package/optimize/lib/components/basic_table/collapsed_item_actions.js +23 -30
- package/optimize/lib/components/datagrid/body/cell/data_grid_cell.js +84 -78
- package/optimize/lib/components/datagrid/body/cell/data_grid_cell.styles.js +111 -0
- package/optimize/lib/components/datagrid/body/cell/data_grid_cell_actions.js +13 -3
- package/optimize/lib/components/datagrid/body/cell/data_grid_cell_actions.styles.js +39 -0
- package/optimize/lib/components/datagrid/body/cell/data_grid_cell_popover.js +20 -11
- package/optimize/lib/components/datagrid/body/cell/data_grid_cell_popover.styles.js +25 -0
- package/optimize/lib/components/datagrid/body/cell/focus_utils.js +17 -19
- package/optimize/lib/components/datagrid/body/data_grid_body.js +9 -2
- package/optimize/lib/components/datagrid/body/data_grid_body.styles.js +30 -0
- package/optimize/lib/components/datagrid/body/data_grid_body_custom.js +7 -4
- package/optimize/lib/components/datagrid/body/data_grid_body_virtualized.js +7 -4
- package/optimize/lib/components/datagrid/body/footer/data_grid_footer.styles.js +30 -0
- package/optimize/lib/components/datagrid/body/footer/data_grid_footer_row.js +10 -5
- package/optimize/lib/components/datagrid/body/header/column_actions.js +16 -4
- package/optimize/lib/components/datagrid/body/header/data_grid_column_resizer.js +14 -7
- package/optimize/lib/components/datagrid/body/header/data_grid_column_resizer.styles.js +39 -0
- package/optimize/lib/components/datagrid/body/header/data_grid_control_header_cell.js +1 -3
- package/optimize/lib/components/datagrid/body/header/data_grid_header_cell.js +43 -63
- package/optimize/lib/components/datagrid/body/header/data_grid_header_cell.styles.js +34 -0
- package/optimize/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.js +3 -0
- package/optimize/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.styles.js +32 -0
- package/optimize/lib/components/datagrid/body/header/data_grid_header_row.js +8 -2
- package/optimize/lib/components/datagrid/body/header/data_grid_header_row.styles.js +27 -0
- package/optimize/lib/components/datagrid/controls/column_selector.js +17 -8
- package/optimize/lib/components/datagrid/controls/column_selector.styles.js +28 -0
- package/optimize/lib/components/datagrid/controls/column_sorting.js +7 -2
- package/optimize/lib/components/datagrid/controls/column_sorting.styles.js +41 -0
- package/optimize/lib/components/datagrid/controls/column_sorting_draggable.js +19 -14
- package/optimize/lib/components/datagrid/controls/data_grid_toolbar.js +8 -1
- package/optimize/lib/components/datagrid/controls/data_grid_toolbar.styles.js +24 -0
- package/optimize/lib/components/datagrid/controls/data_grid_toolbar_control.js +27 -27
- package/optimize/lib/components/datagrid/controls/display_selector.js +13 -2
- package/optimize/lib/components/datagrid/controls/fullscreen_selector.js +7 -4
- package/optimize/lib/components/datagrid/controls/fullscreen_selector.styles.js +26 -0
- package/optimize/lib/components/datagrid/controls/keyboard_shortcuts.js +6 -2
- package/optimize/lib/components/datagrid/controls/keyboard_shortcuts.styles.js +24 -0
- package/optimize/lib/components/datagrid/data_grid.a11y.js +1 -0
- package/optimize/lib/components/datagrid/data_grid.js +15 -7
- package/optimize/lib/components/datagrid/data_grid.stories.utils.js +341 -0
- package/optimize/lib/components/datagrid/data_grid.styles.js +94 -0
- package/{test-env/components/datagrid/utils → optimize/lib/components/datagrid/pagination}/data_grid_pagination.js +29 -31
- package/optimize/lib/components/datagrid/pagination/data_grid_pagination.styles.js +22 -0
- package/optimize/lib/components/datagrid/pagination/index.js +18 -0
- package/optimize/lib/components/datagrid/utils/row_heights.js +13 -14
- package/optimize/lib/components/datagrid/utils/scrolling.js +14 -7
- package/optimize/lib/components/datagrid/utils/scrolling.styles.js +36 -0
- package/optimize/lib/components/flyout/flyout_resizable.js +6 -2
- package/optimize/lib/components/flyout/flyout_resizable.styles.js +34 -5
- package/optimize/lib/components/popover/popover.js +1 -1
- package/optimize/lib/components/text/text.js +9 -4
- package/optimize/lib/components/text/text_align.js +4 -2
- package/optimize/lib/components/text/text_color.js +1 -2
- package/optimize/lib/components/text/types.js +5 -0
- package/package.json +3 -3
- package/src/themes/amsterdam/theme_dark.scss +0 -7
- package/src/themes/amsterdam/theme_light.scss +0 -7
- package/test-env/components/basic_table/basic_table.js +4 -3
- package/test-env/components/basic_table/collapsed_item_actions.js +23 -30
- package/test-env/components/datagrid/body/cell/data_grid_cell.js +90 -83
- package/test-env/components/datagrid/body/cell/data_grid_cell.styles.js +111 -0
- package/test-env/components/datagrid/body/cell/data_grid_cell_actions.js +13 -3
- package/test-env/components/datagrid/body/cell/data_grid_cell_actions.styles.js +39 -0
- package/test-env/components/datagrid/body/cell/data_grid_cell_popover.js +20 -11
- package/test-env/components/datagrid/body/cell/data_grid_cell_popover.styles.js +25 -0
- package/test-env/components/datagrid/body/cell/focus_utils.js +17 -19
- package/test-env/components/datagrid/body/data_grid_body.js +20 -4
- package/test-env/components/datagrid/body/data_grid_body.styles.js +30 -0
- package/test-env/components/datagrid/body/data_grid_body_custom.js +18 -6
- package/test-env/components/datagrid/body/data_grid_body_virtualized.js +18 -6
- package/test-env/components/datagrid/body/footer/data_grid_footer.styles.js +30 -0
- package/test-env/components/datagrid/body/footer/data_grid_footer_row.js +10 -5
- package/test-env/components/datagrid/body/header/column_actions.js +16 -4
- package/test-env/components/datagrid/body/header/data_grid_column_resizer.js +14 -7
- package/test-env/components/datagrid/body/header/data_grid_column_resizer.styles.js +39 -0
- package/test-env/components/datagrid/body/header/data_grid_control_header_cell.js +1 -3
- package/test-env/components/datagrid/body/header/data_grid_header_cell.js +43 -67
- package/test-env/components/datagrid/body/header/data_grid_header_cell.styles.js +34 -0
- package/test-env/components/datagrid/body/header/data_grid_header_cell_wrapper.js +3 -0
- package/test-env/components/datagrid/body/header/data_grid_header_cell_wrapper.styles.js +32 -0
- package/test-env/components/datagrid/body/header/data_grid_header_row.js +8 -2
- package/test-env/components/datagrid/body/header/data_grid_header_row.styles.js +27 -0
- package/test-env/components/datagrid/controls/column_selector.js +17 -8
- package/test-env/components/datagrid/controls/column_selector.styles.js +28 -0
- package/test-env/components/datagrid/controls/column_sorting.js +7 -2
- package/test-env/components/datagrid/controls/column_sorting.styles.js +41 -0
- package/test-env/components/datagrid/controls/column_sorting_draggable.js +19 -14
- package/test-env/components/datagrid/controls/data_grid_toolbar.js +8 -1
- package/test-env/components/datagrid/controls/data_grid_toolbar.styles.js +24 -0
- package/test-env/components/datagrid/controls/data_grid_toolbar_control.js +27 -27
- package/test-env/components/datagrid/controls/display_selector.js +13 -2
- package/test-env/components/datagrid/controls/fullscreen_selector.js +7 -4
- package/test-env/components/datagrid/controls/fullscreen_selector.styles.js +26 -0
- package/test-env/components/datagrid/controls/keyboard_shortcuts.js +6 -2
- package/test-env/components/datagrid/controls/keyboard_shortcuts.styles.js +24 -0
- package/test-env/components/datagrid/data_grid.a11y.js +1 -0
- package/test-env/components/datagrid/data_grid.js +15 -7
- package/test-env/components/datagrid/data_grid.stories.utils.js +1386 -0
- package/test-env/components/datagrid/data_grid.styles.js +94 -0
- package/{optimize/lib/components/datagrid/utils → test-env/components/datagrid/pagination}/data_grid_pagination.js +29 -31
- package/test-env/components/datagrid/pagination/data_grid_pagination.styles.js +22 -0
- package/test-env/components/datagrid/pagination/index.js +18 -0
- package/test-env/components/datagrid/utils/row_heights.js +13 -14
- package/test-env/components/datagrid/utils/scrolling.js +14 -7
- package/test-env/components/datagrid/utils/scrolling.styles.js +36 -0
- package/test-env/components/flyout/flyout_resizable.js +6 -2
- package/test-env/components/flyout/flyout_resizable.styles.js +34 -5
- package/test-env/components/popover/popover.js +1 -1
- package/test-env/components/text/text.js +25 -9
- package/test-env/components/text/text_align.js +19 -6
- package/test-env/components/text/text_color.js +14 -11
- package/test-env/components/text/types.js +5 -0
- package/src/components/datagrid/_data_grid.scss +0 -121
- package/src/components/datagrid/_data_grid_data_row.scss +0 -303
- package/src/components/datagrid/_index.scss +0 -12
- package/src/components/datagrid/_mixins.scss +0 -84
- package/src/components/datagrid/_variables.scss +0 -11
- package/src/components/datagrid/body/footer/_data_grid_footer_row.scss +0 -47
- package/src/components/datagrid/body/header/_data_grid_column_resizer.scss +0 -48
- package/src/components/datagrid/body/header/_data_grid_header_row.scss +0 -219
- package/src/components/datagrid/controls/_data_grid_column_selector.scss +0 -19
- package/src/components/datagrid/controls/_data_grid_column_sorting.scss +0 -43
- package/src/components/datagrid/controls/_data_grid_display.scss +0 -3
- package/src/components/datagrid/controls/_data_grid_keyboard_shortcuts.scss +0 -11
- package/src/components/datagrid/controls/_data_grid_toolbar.scss +0 -55
- package/src/components/index.scss +0 -3
- package/src/themes/amsterdam/overrides/_data_grid.scss +0 -5
- package/src/themes/amsterdam/overrides/_index.scss +0 -1
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
5
|
+
import _typeof from "@babel/runtime/helpers/typeof";
|
|
6
|
+
var _excluded = ["pagination", "sorting", "columnVisibility"];
|
|
7
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
8
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
9
|
+
/*
|
|
10
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
11
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
12
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
13
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
14
|
+
* Side Public License, v 1.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/* eslint-disable storybook/default-exports, storybook/prefer-pascal-case */
|
|
18
|
+
|
|
19
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
|
20
|
+
import { faker } from '@faker-js/faker';
|
|
21
|
+
import { EuiLink } from '../link';
|
|
22
|
+
import { EuiScreenReaderOnly } from '../accessibility';
|
|
23
|
+
import { EuiButtonIcon } from '../button';
|
|
24
|
+
import { MINIMUM_WIDTH_FOR_GRID_CONTROLS } from './controls/data_grid_toolbar';
|
|
25
|
+
import { EuiDataGrid } from './data_grid';
|
|
26
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
27
|
+
faker.seed(42);
|
|
28
|
+
|
|
29
|
+
// NOTE: using faker.date.past() is not fully stable for VRT as the date is
|
|
30
|
+
// based on a years time distance (default 1 year) which updates with progressing time
|
|
31
|
+
// faker.seed() ensures the same date is output in the same time frame
|
|
32
|
+
// but after some time the time distance will generate a newer, closer date
|
|
33
|
+
// which then invalidates the VRT
|
|
34
|
+
var staticDates = [new Date('Tue Mar 19 2024 18:54:51 GMT+0100'), new Date('Mon Mar 25 2024 19:27:35 GMT+0100'), new Date('Sat Sep 09 2023 00:32:42 GMT+0200'), new Date('Wed Jun 14 2023 06:48:29 GMT+0200'), new Date('Mon Mar 04 2024 04:40:36 GMT+0100'), new Date('Mon Feb 05 2024 10:51:48 GMT+0100'), new Date('Mon Jun 19 2023 12:08:38 GMT+0200'), new Date('Wed Jul 26 2023 01:15:02 GMT+0200'), new Date('Wed Nov 08 2023 08:49:13 GMT+0100'), new Date('Sun Nov 19 2023 01:49:12 GMT+0100')];
|
|
35
|
+
var dataKeys = ['name', 'email', 'account', 'location', 'date', 'version'];
|
|
36
|
+
export var raw_data = Array.from({
|
|
37
|
+
length: 10
|
|
38
|
+
}).map(function (_, i) {
|
|
39
|
+
var email = faker.internet.email();
|
|
40
|
+
var name = "".concat(faker.person.lastName(), ", ").concat(faker.person.firstName());
|
|
41
|
+
var date = staticDates[i].toDateString();
|
|
42
|
+
var suffix = faker.person.suffix();
|
|
43
|
+
return {
|
|
44
|
+
name: {
|
|
45
|
+
formatted: "".concat(name, " ").concat(suffix),
|
|
46
|
+
raw: name
|
|
47
|
+
},
|
|
48
|
+
email: {
|
|
49
|
+
formatted: ___EmotionJSX(EuiLink, {
|
|
50
|
+
href: ""
|
|
51
|
+
}, faker.internet.email()),
|
|
52
|
+
raw: email
|
|
53
|
+
},
|
|
54
|
+
location: ___EmotionJSX(React.Fragment, null, "".concat(faker.location.city(), ", "), ___EmotionJSX(EuiLink, {
|
|
55
|
+
href: "https://google.com"
|
|
56
|
+
}, faker.location.country())),
|
|
57
|
+
date: "".concat(date),
|
|
58
|
+
account: faker.finance.accountNumber(),
|
|
59
|
+
version: faker.system.semver()
|
|
60
|
+
};
|
|
61
|
+
});
|
|
62
|
+
var columns = [{
|
|
63
|
+
id: 'name',
|
|
64
|
+
displayAsText: 'Name',
|
|
65
|
+
defaultSortDirection: 'asc',
|
|
66
|
+
cellActions: [function (_ref) {
|
|
67
|
+
var rowIndex = _ref.rowIndex,
|
|
68
|
+
Component = _ref.Component;
|
|
69
|
+
var data = raw_data;
|
|
70
|
+
var value = data[rowIndex].name.raw;
|
|
71
|
+
return ___EmotionJSX(Component, {
|
|
72
|
+
onClick: function onClick() {
|
|
73
|
+
return alert("Hi ".concat(value));
|
|
74
|
+
},
|
|
75
|
+
iconType: "heart",
|
|
76
|
+
"aria-label": "Say hi to ".concat(value, "!")
|
|
77
|
+
}, "Say hi");
|
|
78
|
+
}]
|
|
79
|
+
}, {
|
|
80
|
+
id: 'email',
|
|
81
|
+
displayAsText: 'Email address',
|
|
82
|
+
initialWidth: 130,
|
|
83
|
+
cellActions: [function (_ref2) {
|
|
84
|
+
var rowIndex = _ref2.rowIndex,
|
|
85
|
+
Component = _ref2.Component;
|
|
86
|
+
var data = raw_data;
|
|
87
|
+
var value = data[rowIndex].email.raw;
|
|
88
|
+
return ___EmotionJSX(Component, {
|
|
89
|
+
onClick: function onClick() {
|
|
90
|
+
return alert(value);
|
|
91
|
+
},
|
|
92
|
+
iconType: "email",
|
|
93
|
+
"aria-label": "Send email to ".concat(value)
|
|
94
|
+
}, "Send email");
|
|
95
|
+
}]
|
|
96
|
+
}, {
|
|
97
|
+
id: 'location',
|
|
98
|
+
displayAsText: 'Location'
|
|
99
|
+
}, {
|
|
100
|
+
id: 'account',
|
|
101
|
+
displayAsText: 'Account',
|
|
102
|
+
actions: {
|
|
103
|
+
showHide: {
|
|
104
|
+
label: 'Custom hide label'
|
|
105
|
+
},
|
|
106
|
+
showMoveLeft: false,
|
|
107
|
+
showMoveRight: false,
|
|
108
|
+
additional: [{
|
|
109
|
+
label: 'Custom action',
|
|
110
|
+
onClick: function onClick() {},
|
|
111
|
+
iconType: 'cheer',
|
|
112
|
+
size: 'xs',
|
|
113
|
+
color: 'text'
|
|
114
|
+
}]
|
|
115
|
+
},
|
|
116
|
+
cellActions: [function (_ref3) {
|
|
117
|
+
var rowIndex = _ref3.rowIndex,
|
|
118
|
+
Component = _ref3.Component,
|
|
119
|
+
isExpanded = _ref3.isExpanded;
|
|
120
|
+
var data = raw_data;
|
|
121
|
+
var value = data[rowIndex].account;
|
|
122
|
+
var onClick = isExpanded ? function () {
|
|
123
|
+
return alert("Sent money to ".concat(value, " when expanded"));
|
|
124
|
+
} : function () {
|
|
125
|
+
return alert("Sent money to ".concat(value, " when not expanded"));
|
|
126
|
+
};
|
|
127
|
+
return ___EmotionJSX(Component, {
|
|
128
|
+
onClick: onClick,
|
|
129
|
+
iconType: "faceHappy",
|
|
130
|
+
"aria-label": "Send money to ".concat(value)
|
|
131
|
+
}, "Send money");
|
|
132
|
+
}]
|
|
133
|
+
}, {
|
|
134
|
+
id: 'date',
|
|
135
|
+
displayAsText: 'Date',
|
|
136
|
+
defaultSortDirection: 'desc'
|
|
137
|
+
}, {
|
|
138
|
+
id: 'version',
|
|
139
|
+
displayAsText: 'Version',
|
|
140
|
+
defaultSortDirection: 'desc',
|
|
141
|
+
initialWidth: 70,
|
|
142
|
+
isResizable: false,
|
|
143
|
+
actions: false
|
|
144
|
+
}];
|
|
145
|
+
var RenderCellValue = function RenderCellValue(_ref4) {
|
|
146
|
+
var rowIndex = _ref4.rowIndex,
|
|
147
|
+
columnId = _ref4.columnId;
|
|
148
|
+
var data = raw_data;
|
|
149
|
+
var row = data[rowIndex];
|
|
150
|
+
var columnName = columnId;
|
|
151
|
+
var column = row[columnName];
|
|
152
|
+
var getFormatted = function getFormatted() {
|
|
153
|
+
if (_typeof(column) === 'object') {
|
|
154
|
+
var hasFormatted = ('formatted' in column);
|
|
155
|
+
return hasFormatted ? column.formatted : column;
|
|
156
|
+
}
|
|
157
|
+
return typeof column === 'string' ? column : null;
|
|
158
|
+
};
|
|
159
|
+
return data.hasOwnProperty(rowIndex) ? getFormatted() : null;
|
|
160
|
+
};
|
|
161
|
+
export var defaultStorybookArgs = {
|
|
162
|
+
'aria-label': 'EuiDataGrid',
|
|
163
|
+
columns: columns,
|
|
164
|
+
rowCount: 10,
|
|
165
|
+
renderCellValue: RenderCellValue,
|
|
166
|
+
trailingControlColumns: [{
|
|
167
|
+
id: 'trailing-actions',
|
|
168
|
+
width: 40,
|
|
169
|
+
headerCellRender: function headerCellRender() {
|
|
170
|
+
return ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("span", null, "Trailing actions"));
|
|
171
|
+
},
|
|
172
|
+
rowCellRender: function rowCellRender() {
|
|
173
|
+
return ___EmotionJSX(EuiButtonIcon, {
|
|
174
|
+
iconType: "boxesHorizontal"
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
}],
|
|
178
|
+
leadingControlColumns: [{
|
|
179
|
+
id: 'leading-actions',
|
|
180
|
+
width: 40,
|
|
181
|
+
headerCellRender: function headerCellRender() {
|
|
182
|
+
return ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("span", null, "Leading actions"));
|
|
183
|
+
},
|
|
184
|
+
rowCellRender: function rowCellRender() {
|
|
185
|
+
return ___EmotionJSX(EuiButtonIcon, {
|
|
186
|
+
iconType: "boxesHorizontal"
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
}],
|
|
190
|
+
// setup for easier testing/QA
|
|
191
|
+
columnVisibility: {
|
|
192
|
+
visibleColumns: ['name', 'email', 'account', 'location', 'date', 'amount', 'phone', 'version'],
|
|
193
|
+
setVisibleColumns: function setVisibleColumns() {}
|
|
194
|
+
},
|
|
195
|
+
inMemory: {
|
|
196
|
+
level: 'sorting'
|
|
197
|
+
},
|
|
198
|
+
pagination: {
|
|
199
|
+
pageIndex: 0,
|
|
200
|
+
pageSize: 10,
|
|
201
|
+
pageSizeOptions: [10, 20, 50],
|
|
202
|
+
onChangeItemsPerPage: function onChangeItemsPerPage() {},
|
|
203
|
+
onChangePage: function onChangePage() {}
|
|
204
|
+
},
|
|
205
|
+
gridStyle: {
|
|
206
|
+
fontSize: 'm',
|
|
207
|
+
cellPadding: 'm',
|
|
208
|
+
border: 'all',
|
|
209
|
+
stripes: false,
|
|
210
|
+
header: 'shade',
|
|
211
|
+
footer: 'overline',
|
|
212
|
+
stickyFooter: true,
|
|
213
|
+
rowHover: 'highlight',
|
|
214
|
+
rowClasses: {}
|
|
215
|
+
},
|
|
216
|
+
width: '',
|
|
217
|
+
height: '',
|
|
218
|
+
toolbarVisibility: {
|
|
219
|
+
showColumnSelector: true,
|
|
220
|
+
showDisplaySelector: true,
|
|
221
|
+
showSortSelector: true,
|
|
222
|
+
showKeyboardShortcuts: true,
|
|
223
|
+
showFullScreenSelector: true,
|
|
224
|
+
additionalControls: null
|
|
225
|
+
},
|
|
226
|
+
minSizeForControls: MINIMUM_WIDTH_FOR_GRID_CONTROLS,
|
|
227
|
+
rowHeightsOptions: {
|
|
228
|
+
defaultHeight: undefined,
|
|
229
|
+
rowHeights: {},
|
|
230
|
+
lineHeight: undefined,
|
|
231
|
+
scrollAnchorRow: undefined
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
export var StatefulDataGrid = function StatefulDataGrid(props) {
|
|
235
|
+
var _pagination$pageIndex, _sorting$columns, _columnVisibility$vis;
|
|
236
|
+
var pagination = props.pagination,
|
|
237
|
+
sorting = props.sorting,
|
|
238
|
+
columnVisibility = props.columnVisibility,
|
|
239
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
240
|
+
|
|
241
|
+
// Pagination
|
|
242
|
+
var _useState = useState(_objectSpread({
|
|
243
|
+
pageIndex: (_pagination$pageIndex = pagination === null || pagination === void 0 ? void 0 : pagination.pageIndex) !== null && _pagination$pageIndex !== void 0 ? _pagination$pageIndex : 0
|
|
244
|
+
}, pagination)),
|
|
245
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
246
|
+
_pagination = _useState2[0],
|
|
247
|
+
setPagination = _useState2[1];
|
|
248
|
+
var onChangeItemsPerPage = useCallback(function (pageSize) {
|
|
249
|
+
return setPagination(function (pagination) {
|
|
250
|
+
return _objectSpread(_objectSpread({}, pagination), {}, {
|
|
251
|
+
pageSize: pageSize,
|
|
252
|
+
pageIndex: 0
|
|
253
|
+
});
|
|
254
|
+
});
|
|
255
|
+
}, [setPagination]);
|
|
256
|
+
var onChangePage = useCallback(function (pageIndex) {
|
|
257
|
+
return setPagination(function (pagination) {
|
|
258
|
+
return _objectSpread(_objectSpread({}, pagination), {}, {
|
|
259
|
+
pageIndex: pageIndex
|
|
260
|
+
});
|
|
261
|
+
});
|
|
262
|
+
}, [setPagination]);
|
|
263
|
+
useEffect(function () {
|
|
264
|
+
if (pagination) {
|
|
265
|
+
setPagination(function (curentPagination) {
|
|
266
|
+
return _objectSpread(_objectSpread({}, curentPagination), pagination);
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
}, [pagination]);
|
|
270
|
+
|
|
271
|
+
// Sorting
|
|
272
|
+
var _useState3 = useState((_sorting$columns = sorting === null || sorting === void 0 ? void 0 : sorting.columns) !== null && _sorting$columns !== void 0 ? _sorting$columns : []),
|
|
273
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
274
|
+
sortingColumns = _useState4[0],
|
|
275
|
+
setSortingColumns = _useState4[1];
|
|
276
|
+
var onSort = useCallback(function (sortingColumns) {
|
|
277
|
+
var _sorting$onSort;
|
|
278
|
+
setSortingColumns(sortingColumns);
|
|
279
|
+
sorting === null || sorting === void 0 || (_sorting$onSort = sorting.onSort) === null || _sorting$onSort === void 0 || _sorting$onSort.call(sorting, sortingColumns);
|
|
280
|
+
}, [setSortingColumns, sorting]);
|
|
281
|
+
useEffect(function () {
|
|
282
|
+
if (sorting && Array.isArray(sorting.columns)) {
|
|
283
|
+
setSortingColumns(sorting.columns);
|
|
284
|
+
}
|
|
285
|
+
}, [sorting]);
|
|
286
|
+
|
|
287
|
+
// Column visibility
|
|
288
|
+
var _useState5 = useState((_columnVisibility$vis = columnVisibility === null || columnVisibility === void 0 ? void 0 : columnVisibility.visibleColumns) !== null && _columnVisibility$vis !== void 0 ? _columnVisibility$vis : columns.map(function (_ref5) {
|
|
289
|
+
var id = _ref5.id;
|
|
290
|
+
return id;
|
|
291
|
+
}) // initialize to the full set of columns
|
|
292
|
+
),
|
|
293
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
294
|
+
visibleColumns = _useState6[0],
|
|
295
|
+
setVisibleColumns = _useState6[1];
|
|
296
|
+
useEffect(function () {
|
|
297
|
+
if ((columnVisibility === null || columnVisibility === void 0 ? void 0 : columnVisibility.visibleColumns) != null) {
|
|
298
|
+
setVisibleColumns(columnVisibility === null || columnVisibility === void 0 ? void 0 : columnVisibility.visibleColumns);
|
|
299
|
+
}
|
|
300
|
+
}, [columnVisibility]);
|
|
301
|
+
return ___EmotionJSX(EuiDataGrid, _extends({}, rest, {
|
|
302
|
+
columnVisibility: {
|
|
303
|
+
visibleColumns: visibleColumns,
|
|
304
|
+
setVisibleColumns: setVisibleColumns
|
|
305
|
+
},
|
|
306
|
+
sorting: {
|
|
307
|
+
columns: sortingColumns,
|
|
308
|
+
onSort: onSort
|
|
309
|
+
},
|
|
310
|
+
pagination: _objectSpread(_objectSpread({}, _pagination), {}, {
|
|
311
|
+
onChangeItemsPerPage: onChangeItemsPerPage,
|
|
312
|
+
onChangePage: onChangePage
|
|
313
|
+
})
|
|
314
|
+
}));
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
/*
|
|
318
|
+
* Components that exist purely for allowing Storybook to parse certain nested
|
|
319
|
+
* interfaces/types into specific example control tables.
|
|
320
|
+
*
|
|
321
|
+
* For whatever reason, they needs to be in a separate file for Storybook's
|
|
322
|
+
* react-typescript-docgen to parse the jsdoc comments into the controls table
|
|
323
|
+
*/
|
|
324
|
+
|
|
325
|
+
export var EuiDataGridToolbarPropsComponent = function EuiDataGridToolbarPropsComponent() {
|
|
326
|
+
return ___EmotionJSX(React.Fragment, null);
|
|
327
|
+
};
|
|
328
|
+
export var EuiDataGridStylePropsComponent = function EuiDataGridStylePropsComponent() {
|
|
329
|
+
return ___EmotionJSX(React.Fragment, null);
|
|
330
|
+
};
|
|
331
|
+
export var EuiDataGridRowHeightsPropsComponent = function EuiDataGridRowHeightsPropsComponent() {
|
|
332
|
+
return ___EmotionJSX(React.Fragment, null);
|
|
333
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
4
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
5
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
6
|
+
* Side Public License, v 1.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { css } from '@emotion/react';
|
|
10
|
+
import { tintOrShade } from '../../services';
|
|
11
|
+
import { euiFontSize, logicalCSS, logicalSizeCSS, mathWithUnits } from '../../global_styling';
|
|
12
|
+
export var euiDataGridVariables = function euiDataGridVariables(euiThemeContext) {
|
|
13
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
14
|
+
return {
|
|
15
|
+
cellPadding: {
|
|
16
|
+
s: euiTheme.size.xs,
|
|
17
|
+
m: mathWithUnits(euiTheme.size.m, function (x) {
|
|
18
|
+
return x / 2;
|
|
19
|
+
}),
|
|
20
|
+
l: euiTheme.size.s
|
|
21
|
+
},
|
|
22
|
+
lineHeight: {
|
|
23
|
+
s: euiFontSize(euiThemeContext, 'xs').lineHeight,
|
|
24
|
+
m: euiFontSize(euiThemeContext, 'm').lineHeight
|
|
25
|
+
},
|
|
26
|
+
fontSize: {
|
|
27
|
+
s: euiFontSize(euiThemeContext, 'xs').fontSize,
|
|
28
|
+
m: euiFontSize(euiThemeContext, 's').fontSize
|
|
29
|
+
},
|
|
30
|
+
levels: {
|
|
31
|
+
cellPopover: Number(euiTheme.levels.header),
|
|
32
|
+
// Same z-index as EuiFlyout mask overlays - cell popovers should be under both modal and flyout overlays
|
|
33
|
+
get stickyHeader() {
|
|
34
|
+
return this.cellPopover - 1; // Needs to sit above the content + cell focus outlines/actions, but below actual popovers
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export var euiDataGridStyles = function euiDataGridStyles(euiThemeContext) {
|
|
40
|
+
var euiTheme = euiThemeContext.euiTheme,
|
|
41
|
+
colorMode = euiThemeContext.colorMode;
|
|
42
|
+
var _euiDataGridVariables = euiDataGridVariables(euiThemeContext),
|
|
43
|
+
_cellPadding = _euiDataGridVariables.cellPadding,
|
|
44
|
+
lineHeight = _euiDataGridVariables.lineHeight,
|
|
45
|
+
_fontSize = _euiDataGridVariables.fontSize;
|
|
46
|
+
return {
|
|
47
|
+
euiDataGrid: /*#__PURE__*/css("display:flex;flex-direction:column;align-items:stretch;", logicalCSS('height', '100%'), " overflow:hidden;*:where(& .euiDataGridRow){background-color:", euiTheme.colors.emptyShade, ";}*:where(&.euiDataGrid--stripes .euiDataGridRow--striped){background-color:", euiTheme.colors.lightestShade, ";}*:where(&.euiDataGrid--rowHoverHighlight .euiDataGridRow:hover){background-color:", euiTheme.colors.highlight, ";};label:euiDataGrid;"),
|
|
48
|
+
cellPadding: {
|
|
49
|
+
cellPadding: function cellPadding(size) {
|
|
50
|
+
return /*#__PURE__*/css(".euiDataGridHeaderCell,.euiDataGridRowCell__content{padding:", _cellPadding[size], ";}/* Workaround to trim line-clamp and padding - @see https://github.com/elastic/eui/issues/7780 */.euiDataGridRowCell__content--lineCountHeight{", logicalCSS('padding-bottom', 0), " ", logicalCSS('border-bottom', "".concat(_cellPadding[size], " solid transparent")), ";}.euiDataGridHeaderCell__button{margin-block:-", _cellPadding[size], ";};label:cellPadding;");
|
|
51
|
+
},
|
|
52
|
+
get s() {
|
|
53
|
+
return /*#__PURE__*/css(this.cellPadding('s'), ";label:s;");
|
|
54
|
+
},
|
|
55
|
+
get m() {
|
|
56
|
+
return /*#__PURE__*/css(this.cellPadding('m'), ";label:m;");
|
|
57
|
+
},
|
|
58
|
+
get l() {
|
|
59
|
+
return /*#__PURE__*/css(this.cellPadding('l'), ";label:l;");
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
fontSize: {
|
|
63
|
+
fontSize: function fontSize(size) {
|
|
64
|
+
return /*#__PURE__*/css(".euiDataGridHeaderCell,.euiDataGridRowCell{font-size:", _fontSize[size], ";line-height:", lineHeight[size], ";};label:fontSize;");
|
|
65
|
+
},
|
|
66
|
+
get s() {
|
|
67
|
+
return /*#__PURE__*/css(this.fontSize('s'), ";label:s;");
|
|
68
|
+
},
|
|
69
|
+
get m() {
|
|
70
|
+
return /*#__PURE__*/css(this.fontSize('m'), ";label:m;");
|
|
71
|
+
},
|
|
72
|
+
get l() {
|
|
73
|
+
// On the Amsterdam theme, the l fontSize is the same as m
|
|
74
|
+
return /*#__PURE__*/css(this.fontSize('m'), ";label:l;");
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
borders: {
|
|
78
|
+
none: null,
|
|
79
|
+
horizontal: /*#__PURE__*/css("label:borders;.euiDataGridRowCell:not(.euiDataGridFooterCell),.euiDataGridFooter,&:not(.euiDataGrid--headerUnderline) .euiDataGridHeader{", logicalCSS('border-bottom', euiTheme.border.thin), ";}&:not(.euiDataGrid--footerOverline) .euiDataGridFooter{", logicalCSS('border-top', euiTheme.border.thin), " ", logicalCSS('margin-top', "-".concat(euiTheme.border.width.thin)), ";}.euiDataGridHeader{", logicalCSS('border-top', euiTheme.border.thin), ";};label:horizontal;"),
|
|
80
|
+
all: /*#__PURE__*/css("label:borders;.euiDataGridRowCell{&:not(.euiDataGridFooterCell){", logicalCSS('border-bottom', euiTheme.border.thin), " ", logicalCSS('border-right', // Visually lighten vertical borders
|
|
81
|
+
"".concat(euiTheme.border.width.thin, " solid ").concat(tintOrShade(euiTheme.border.color, 0.3, colorMode))), ";}&--firstColumn{", logicalCSS('border-left', euiTheme.border.thin), ";}&--lastColumn{", logicalCSS('border-right-color', euiTheme.border.color), ";}}.euiDataGridFooterCell,.euiDataGridHeaderCell{", logicalCSS('border-right', euiTheme.border.thin), " &:first-of-type{", logicalCSS('border-left', euiTheme.border.thin), ";}}.euiDataGridFooter{", logicalCSS('border-bottom', euiTheme.border.thin), ";}&:not(.euiDataGrid--footerOverline) .euiDataGridFooter{", logicalCSS('border-top', euiTheme.border.thin), " ", logicalCSS('margin-top', "-".concat(euiTheme.border.width.thin)), ";}&:not(.euiDataGrid--headerUnderline) .euiDataGridHeader{", logicalCSS('border-bottom', euiTheme.border.thin), ";}&:is(.euiDataGrid--noControls) .euiDataGridHeader{", logicalCSS('border-top', euiTheme.border.thin), ";}.euiDataGrid__controls{border:", euiTheme.border.thin, ";background-color:", euiTheme.colors.body, ";};label:all;")
|
|
82
|
+
},
|
|
83
|
+
// Sits below the controls above it and pagination below it
|
|
84
|
+
euiDataGrid__content: /*#__PURE__*/css("z-index:1;position:relative;flex-grow:1;", logicalSizeCSS('100%'), " ", logicalCSS('max-width', '100%'), " overflow:hidden;background-color:", euiTheme.colors.body, ";font-feature-settings:'tnum' 1;;label:euiDataGrid__content;"),
|
|
85
|
+
// Wrapper around EuiDataGrid
|
|
86
|
+
euiDataGrid__focusWrap: /*#__PURE__*/css(logicalCSS('height', '100%'), ";;label:euiDataGrid__focusWrap;")
|
|
87
|
+
};
|
|
88
|
+
};
|
|
@@ -8,22 +8,35 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import React, { useCallback, useContext } from 'react';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
11
|
+
import { useEuiMemoizedStyles } from '../../../services';
|
|
12
|
+
import { useEuiI18n } from '../../i18n';
|
|
13
|
+
import { EuiTablePagination } from '../../table/table_pagination';
|
|
14
|
+
import { DataGridFocusContext } from '../utils/focus';
|
|
15
|
+
import { euiDataGridPaginationStyles } from './data_grid_pagination.styles';
|
|
14
16
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Do not render the pagination when:
|
|
19
|
+
* 1. Rows count is less than min pagination option (rows per page)
|
|
20
|
+
* 2. Rows count is less than pageSize (the case when there are no pageSizeOptions provided)
|
|
21
|
+
*/
|
|
22
|
+
export var shouldRenderPagination = function shouldRenderPagination(rowCount, _ref) {
|
|
23
|
+
var pageSize = _ref.pageSize,
|
|
24
|
+
pageSizeOptions = _ref.pageSizeOptions;
|
|
25
|
+
var minSizeOption = _toConsumableArray(pageSizeOptions).sort(function (a, b) {
|
|
26
|
+
return a - b;
|
|
27
|
+
})[0];
|
|
28
|
+
return !(rowCount < (minSizeOption || pageSize));
|
|
29
|
+
};
|
|
30
|
+
export var EuiDataGridPagination = function EuiDataGridPagination(_ref2) {
|
|
31
|
+
var pageIndex = _ref2.pageIndex,
|
|
32
|
+
pageSize = _ref2.pageSize,
|
|
33
|
+
pageSizeOptions = _ref2.pageSizeOptions,
|
|
34
|
+
_onChangePage = _ref2.onChangePage,
|
|
35
|
+
onChangeItemsPerPage = _ref2.onChangeItemsPerPage,
|
|
36
|
+
rowCount = _ref2.rowCount,
|
|
37
|
+
controls = _ref2.controls,
|
|
38
|
+
ariaLabel = _ref2['aria-label'];
|
|
39
|
+
var styles = useEuiMemoizedStyles(euiDataGridPaginationStyles);
|
|
27
40
|
var detailedPaginationLabel = useEuiI18n('euiDataGridPagination.detailedPaginationLabel', 'Pagination for preceding grid: {label}', {
|
|
28
41
|
label: ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : ''
|
|
29
42
|
});
|
|
@@ -37,28 +50,15 @@ export var EuiDataGridPaginationRenderer = function EuiDataGridPaginationRendere
|
|
|
37
50
|
setFocusedCell([0, 0]);
|
|
38
51
|
}, [setFocusedCell, _onChangePage]);
|
|
39
52
|
var pageCount = pageSize ? Math.ceil(rowCount / pageSize) : 1;
|
|
40
|
-
var minSizeOption = _toConsumableArray(pageSizeOptions).sort(function (a, b) {
|
|
41
|
-
return a - b;
|
|
42
|
-
})[0];
|
|
43
|
-
if (rowCount < (minSizeOption || pageSize)) {
|
|
44
|
-
/**
|
|
45
|
-
* Do not render the pagination when:
|
|
46
|
-
* 1. Rows count is less than min pagination option (rows per page)
|
|
47
|
-
* 2. Rows count is less than pageSize (the case when there are no pageSizeOptions provided)
|
|
48
|
-
*/
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// Hide select rows per page if pageSizeOptions is an empty array
|
|
53
|
-
var hidePerPageOptions = pageSizeOptions.length === 0;
|
|
54
53
|
return ___EmotionJSX("div", {
|
|
54
|
+
css: styles.euiDataGrid__pagination,
|
|
55
55
|
className: "euiDataGrid__pagination"
|
|
56
56
|
}, ___EmotionJSX(EuiTablePagination, {
|
|
57
57
|
"aria-controls": controls,
|
|
58
58
|
activePage: pageIndex,
|
|
59
|
-
showPerPageOptions: !hidePerPageOptions,
|
|
60
59
|
itemsPerPage: pageSize,
|
|
61
60
|
itemsPerPageOptions: pageSizeOptions,
|
|
61
|
+
showPerPageOptions: pageSizeOptions.length > 0,
|
|
62
62
|
pageCount: pageCount,
|
|
63
63
|
onChangePage: onChangePage,
|
|
64
64
|
onChangeItemsPerPage: onChangeItemsPerPage,
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
4
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
5
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
6
|
+
* Side Public License, v 1.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { css } from '@emotion/react';
|
|
10
|
+
import { logicalCSS } from '../../../global_styling';
|
|
11
|
+
export var euiDataGridPaginationStyles = function euiDataGridPaginationStyles(_ref) {
|
|
12
|
+
var euiTheme = _ref.euiTheme;
|
|
13
|
+
return {
|
|
14
|
+
euiDataGrid__pagination: /*#__PURE__*/css("z-index:2;flex-grow:0;", logicalCSS('padding-top', euiTheme.size.xs), " .euiDataGrid--fullScreen &{", logicalCSS('padding-bottom', euiTheme.size.xs), " background-color:", euiTheme.colors.lightestShade, ";box-shadow:", euiTheme.border.width.thin, " 0 0 ", euiTheme.border.width.thin, " ", euiTheme.border.color, ";};label:euiDataGrid__pagination;")
|
|
15
|
+
};
|
|
16
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
4
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
5
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
6
|
+
* Side Public License, v 1.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export { shouldRenderPagination, EuiDataGridPagination } from './data_grid_pagination';
|
|
@@ -17,18 +17,12 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import { useCallback, useContext, useEffect, useMemo, useState } from 'react';
|
|
20
|
-
import { useForceRender, useLatest } from '../../../services';
|
|
20
|
+
import { useForceRender, useLatest, useEuiMemoizedStyles } from '../../../services';
|
|
21
21
|
import { isNumber, isObject } from '../../../services/predicate';
|
|
22
|
+
import { euiDataGridVariables } from '../data_grid.styles';
|
|
22
23
|
import { DataGridSortedContext } from './sorting';
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
export var cellPaddingsMap = {
|
|
26
|
-
s: 4,
|
|
27
|
-
m: 6,
|
|
28
|
-
l: 8
|
|
29
|
-
};
|
|
30
|
-
export var AUTO_HEIGHT = 'auto';
|
|
31
|
-
export var DEFAULT_ROW_HEIGHT = 34;
|
|
24
|
+
var AUTO_HEIGHT = 'auto';
|
|
25
|
+
var DEFAULT_ROW_HEIGHT = 34;
|
|
32
26
|
export var RowHeightUtils = /*#__PURE__*/function () {
|
|
33
27
|
function RowHeightUtils() {
|
|
34
28
|
var _this = this;
|
|
@@ -96,10 +90,13 @@ export var RowHeightUtils = /*#__PURE__*/function () {
|
|
|
96
90
|
}
|
|
97
91
|
}, {
|
|
98
92
|
key: "cacheStyles",
|
|
99
|
-
value: function cacheStyles(gridStyles) {
|
|
93
|
+
value: function cacheStyles(gridStyles, cellPaddingsMap) {
|
|
94
|
+
var _gridStyles$cellPaddi;
|
|
95
|
+
var paddingSize = (_gridStyles$cellPaddi = gridStyles.cellPadding) !== null && _gridStyles$cellPaddi !== void 0 ? _gridStyles$cellPaddi : 'm';
|
|
96
|
+
var padding = parseFloat(cellPaddingsMap[paddingSize]);
|
|
100
97
|
this.styles = {
|
|
101
|
-
paddingTop:
|
|
102
|
-
paddingBottom:
|
|
98
|
+
paddingTop: padding,
|
|
99
|
+
paddingBottom: padding
|
|
103
100
|
};
|
|
104
101
|
}
|
|
105
102
|
}, {
|
|
@@ -305,11 +302,12 @@ export var useRowHeightUtils = function useRowHeightUtils(_ref2) {
|
|
|
305
302
|
rowHeightUtils, forceRenderRef]);
|
|
306
303
|
|
|
307
304
|
// Re-cache styles whenever grid density changes
|
|
305
|
+
var styleVars = useEuiMemoizedStyles(euiDataGridVariables);
|
|
308
306
|
useEffect(function () {
|
|
309
307
|
rowHeightUtils.cacheStyles({
|
|
310
308
|
cellPadding: gridStyles.cellPadding
|
|
311
|
-
});
|
|
312
|
-
}, [gridStyles.cellPadding, rowHeightUtils]);
|
|
309
|
+
}, styleVars.cellPadding);
|
|
310
|
+
}, [gridStyles.cellPadding, rowHeightUtils, styleVars.cellPadding]);
|
|
313
311
|
|
|
314
312
|
// Update row heights map to remove hidden columns whenever orderedVisibleColumns change
|
|
315
313
|
useEffect(function () {
|
|
@@ -9,8 +9,11 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import React, { useContext, useEffect, useCallback, useMemo } from 'react';
|
|
12
|
+
import { useEuiMemoizedStyles } from '../../../services';
|
|
13
|
+
import { logicalStyles } from '../../../global_styling';
|
|
12
14
|
import { DataGridCellPopoverContext } from '../body/cell';
|
|
13
15
|
import { DataGridFocusContext } from './focus';
|
|
16
|
+
import { euiDataGridScrollBarStyles } from './scrolling.styles';
|
|
14
17
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
15
18
|
/**
|
|
16
19
|
* The primary goal of this scroll logic is to ensure keyboard navigation works accessibly,
|
|
@@ -206,6 +209,7 @@ export var useScrollBars = function useScrollBars(outerGridRef) {
|
|
|
206
209
|
// If the grid scrolls or has scrollbars, we add custom border overlays
|
|
207
210
|
// (since borders are normally set by cells) to ensure our grid body has
|
|
208
211
|
// ending borders regardless of scroll position
|
|
212
|
+
var styles = useEuiMemoizedStyles(euiDataGridScrollBarStyles);
|
|
209
213
|
var scrollBorderOverlay = useMemo(function () {
|
|
210
214
|
if (!hasHorizontalScroll && !hasVerticalScroll) {
|
|
211
215
|
return null; // Nothing to render if the grid doesn't scroll
|
|
@@ -214,22 +218,25 @@ export var useScrollBars = function useScrollBars(outerGridRef) {
|
|
|
214
218
|
return null; // Nothing to render if the grid doesn't use borders
|
|
215
219
|
}
|
|
216
220
|
return ___EmotionJSX("div", {
|
|
221
|
+
css: styles.euiDataGrid__scrollOverlay,
|
|
217
222
|
className: "euiDataGrid__scrollOverlay",
|
|
218
223
|
role: "presentation"
|
|
219
224
|
}, scrollBarHeight > 0 && ___EmotionJSX("div", {
|
|
225
|
+
css: styles.euiDataGrid__scrollBarOverlayBottom,
|
|
220
226
|
className: "euiDataGrid__scrollBarOverlayBottom",
|
|
221
|
-
style: {
|
|
222
|
-
bottom: scrollBarHeight
|
|
223
|
-
|
|
224
|
-
}
|
|
227
|
+
style: logicalStyles({
|
|
228
|
+
bottom: scrollBarHeight
|
|
229
|
+
})
|
|
225
230
|
}), scrollBarWidth > 0 && ___EmotionJSX("div", {
|
|
231
|
+
css: styles.euiDataGrid__scrollBarOverlayRight,
|
|
226
232
|
className: "euiDataGrid__scrollBarOverlayRight",
|
|
227
|
-
style: {
|
|
233
|
+
style: logicalStyles({
|
|
234
|
+
top: 0,
|
|
228
235
|
bottom: scrollBarHeight,
|
|
229
236
|
right: scrollBarWidth
|
|
230
|
-
}
|
|
237
|
+
})
|
|
231
238
|
}));
|
|
232
|
-
}, [hasHorizontalScroll, hasVerticalScroll, scrollBarHeight, scrollBarWidth, borderStyle]);
|
|
239
|
+
}, [hasHorizontalScroll, hasVerticalScroll, scrollBarHeight, scrollBarWidth, borderStyle, styles]);
|
|
233
240
|
return {
|
|
234
241
|
scrollBarHeight: scrollBarHeight,
|
|
235
242
|
scrollBarWidth: scrollBarWidth,
|