@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
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.defaultSortDescLabel = exports.defaultSortAscLabel = exports.EuiDataGridColumnSortingDraggable = void 0;
|
|
7
|
-
var _react =
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
11
|
var _accessibility = require("../../accessibility");
|
|
@@ -26,6 +27,8 @@ var _excluded = ["id", "display", "direction", "index", "sorting", "schema", "sc
|
|
|
26
27
|
* Side Public License, v 1.
|
|
27
28
|
*/
|
|
28
29
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
30
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
31
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
29
32
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
30
33
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
31
34
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -69,6 +72,27 @@ var EuiDataGridColumnSortingDraggable = function EuiDataGridColumnSortingDraggab
|
|
|
69
72
|
'data-test-subj': "euiDataGridColumnSorting-sortColumn-".concat(id, "-desc")
|
|
70
73
|
}];
|
|
71
74
|
var dragHandleAriaLabel = (0, _i18n.useEuiI18n)('euiColumnSortingDraggable.dragHandleAriaLabel', 'Drag handle');
|
|
75
|
+
var removeSort = (0, _react.useCallback)(function () {
|
|
76
|
+
var nextColumns = _toConsumableArray(sorting.columns);
|
|
77
|
+
var columnIndex = nextColumns.map(function (_ref2) {
|
|
78
|
+
var id = _ref2.id;
|
|
79
|
+
return id;
|
|
80
|
+
}).indexOf(id);
|
|
81
|
+
nextColumns.splice(columnIndex, 1);
|
|
82
|
+
sorting.onSort(nextColumns);
|
|
83
|
+
}, [id, sorting]);
|
|
84
|
+
var toggleLegendHandler = (0, _react.useCallback)(function (_, direction) {
|
|
85
|
+
var nextColumns = _toConsumableArray(sorting.columns);
|
|
86
|
+
var columnIndex = nextColumns.map(function (_ref3) {
|
|
87
|
+
var id = _ref3.id;
|
|
88
|
+
return id;
|
|
89
|
+
}).indexOf(id);
|
|
90
|
+
nextColumns.splice(columnIndex, 1, {
|
|
91
|
+
id: id,
|
|
92
|
+
direction: direction
|
|
93
|
+
});
|
|
94
|
+
sorting.onSort(nextColumns);
|
|
95
|
+
}, [id, sorting]);
|
|
72
96
|
return (0, _react2.jsx)(_drag_and_drop.EuiDraggable, _extends({
|
|
73
97
|
draggableId: id,
|
|
74
98
|
index: index,
|
|
@@ -106,15 +130,7 @@ var EuiDataGridColumnSortingDraggable = function EuiDataGridColumnSortingDraggab
|
|
|
106
130
|
className: "euiDataGridColumnSorting__button",
|
|
107
131
|
"aria-label": removeSortLabel,
|
|
108
132
|
iconType: "cross",
|
|
109
|
-
onClick:
|
|
110
|
-
var nextColumns = _toConsumableArray(sorting.columns);
|
|
111
|
-
var columnIndex = nextColumns.map(function (_ref2) {
|
|
112
|
-
var id = _ref2.id;
|
|
113
|
-
return id;
|
|
114
|
-
}).indexOf(id);
|
|
115
|
-
nextColumns.splice(columnIndex, 1);
|
|
116
|
-
sorting.onSort(nextColumns);
|
|
117
|
-
}
|
|
133
|
+
onClick: removeSort
|
|
118
134
|
});
|
|
119
135
|
})), (0, _react2.jsx)(_flex.EuiFlexItem, _extends({
|
|
120
136
|
className: "euiDataGridColumnSorting__name"
|
|
@@ -149,18 +165,7 @@ var EuiDataGridColumnSortingDraggable = function EuiDataGridColumnSortingDraggab
|
|
|
149
165
|
buttonSize: "compressed",
|
|
150
166
|
className: "euiDataGridColumnSorting__order",
|
|
151
167
|
idSelected: direction === 'asc' ? "".concat(id, "Asc") : "".concat(id, "Desc"),
|
|
152
|
-
onChange:
|
|
153
|
-
var nextColumns = _toConsumableArray(sorting.columns);
|
|
154
|
-
var columnIndex = nextColumns.map(function (_ref3) {
|
|
155
|
-
var id = _ref3.id;
|
|
156
|
-
return id;
|
|
157
|
-
}).indexOf(id);
|
|
158
|
-
nextColumns.splice(columnIndex, 1, {
|
|
159
|
-
id: id,
|
|
160
|
-
direction: direction
|
|
161
|
-
});
|
|
162
|
-
sorting.onSort(nextColumns);
|
|
163
|
-
}
|
|
168
|
+
onChange: toggleLegendHandler
|
|
164
169
|
});
|
|
165
170
|
})), (0, _react2.jsx)(_flex.EuiFlexItem, _extends({
|
|
166
171
|
grow: false
|
|
@@ -210,114 +210,116 @@ var useDataGridDisplaySelector = function useDataGridDisplaySelector(showDisplay
|
|
|
210
210
|
}, []);
|
|
211
211
|
var buttonLabel = (0, _i18n.useEuiI18n)('euiDisplaySelector.buttonText', 'Display options');
|
|
212
212
|
var resetButtonLabel = (0, _i18n.useEuiI18n)('euiDisplaySelector.resetButtonText', 'Reset to default');
|
|
213
|
-
var displaySelector =
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
anchorPosition: "downRight",
|
|
220
|
-
panelPaddingSize: "s",
|
|
221
|
-
panelClassName: "euiDataGrid__displayPopoverPanel",
|
|
222
|
-
button: (0, _react2.jsx)(_tool_tip.EuiToolTip, {
|
|
223
|
-
content: buttonLabel,
|
|
224
|
-
delay: "long"
|
|
225
|
-
}, (0, _react2.jsx)(_button.EuiButtonIcon, {
|
|
226
|
-
size: "xs",
|
|
227
|
-
iconType: "controlsHorizontal",
|
|
228
|
-
color: "text",
|
|
229
|
-
"data-test-subj": "dataGridDisplaySelectorButton",
|
|
230
|
-
onClick: function onClick() {
|
|
231
|
-
return setIsOpen(!isOpen);
|
|
213
|
+
var displaySelector = (0, _react.useMemo)(function () {
|
|
214
|
+
return showDensityControls || showRowHeightControls || additionalDisplaySettings ? (0, _react2.jsx)(_popover.EuiPopover, {
|
|
215
|
+
"data-test-subj": "dataGridDisplaySelectorPopover",
|
|
216
|
+
isOpen: isOpen,
|
|
217
|
+
closePopover: function closePopover() {
|
|
218
|
+
return setIsOpen(false);
|
|
232
219
|
},
|
|
233
|
-
"
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
label:
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
label:
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
220
|
+
anchorPosition: "downRight",
|
|
221
|
+
panelPaddingSize: "s",
|
|
222
|
+
panelClassName: "euiDataGrid__displayPopoverPanel",
|
|
223
|
+
button: (0, _react2.jsx)(_tool_tip.EuiToolTip, {
|
|
224
|
+
content: buttonLabel,
|
|
225
|
+
delay: "long"
|
|
226
|
+
}, (0, _react2.jsx)(_button.EuiButtonIcon, {
|
|
227
|
+
size: "xs",
|
|
228
|
+
iconType: "controlsHorizontal",
|
|
229
|
+
color: "text",
|
|
230
|
+
"data-test-subj": "dataGridDisplaySelectorButton",
|
|
231
|
+
onClick: function onClick() {
|
|
232
|
+
return setIsOpen(!isOpen);
|
|
233
|
+
},
|
|
234
|
+
"aria-label": buttonLabel
|
|
235
|
+
}))
|
|
236
|
+
}, showDensityControls && (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
237
|
+
tokens: ['euiDisplaySelector.densityLabel', 'euiDisplaySelector.labelCompact', 'euiDisplaySelector.labelNormal', 'euiDisplaySelector.labelExpanded'],
|
|
238
|
+
defaults: ['Density', 'Compact', 'Normal', 'Expanded']
|
|
239
|
+
}, function (_ref) {
|
|
240
|
+
var _ref2 = _slicedToArray(_ref, 4),
|
|
241
|
+
densityLabel = _ref2[0],
|
|
242
|
+
labelCompact = _ref2[1],
|
|
243
|
+
labelNormal = _ref2[2],
|
|
244
|
+
labelExpanded = _ref2[3];
|
|
245
|
+
return (0, _react2.jsx)(_form.EuiFormRow, {
|
|
246
|
+
label: densityLabel,
|
|
247
|
+
display: "columnCompressed"
|
|
248
|
+
}, (0, _react2.jsx)(_button.EuiButtonGroup, {
|
|
249
|
+
legend: densityLabel,
|
|
250
|
+
buttonSize: "compressed",
|
|
251
|
+
isFullWidth: true,
|
|
252
|
+
options: [{
|
|
253
|
+
id: densityOptions[0],
|
|
254
|
+
label: labelCompact
|
|
255
|
+
}, {
|
|
256
|
+
id: densityOptions[1],
|
|
257
|
+
label: labelNormal
|
|
258
|
+
}, {
|
|
259
|
+
id: densityOptions[2],
|
|
260
|
+
label: labelExpanded
|
|
261
|
+
}],
|
|
262
|
+
onChange: setGridStyles,
|
|
263
|
+
idSelected: gridDensity,
|
|
264
|
+
"data-test-subj": "densityButtonGroup"
|
|
265
|
+
}));
|
|
266
|
+
}), showRowHeightControls && (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
267
|
+
tokens: ['euiDisplaySelector.rowHeightLabel', 'euiDisplaySelector.labelSingle', 'euiDisplaySelector.labelAuto', 'euiDisplaySelector.labelCustom', 'euiDisplaySelector.lineCountLabel'],
|
|
268
|
+
defaults: ['Row height', 'Single', 'Auto fit', 'Custom', 'Lines per row']
|
|
269
|
+
}, function (_ref3) {
|
|
270
|
+
var _ref4 = _slicedToArray(_ref3, 5),
|
|
271
|
+
rowHeightLabel = _ref4[0],
|
|
272
|
+
labelSingle = _ref4[1],
|
|
273
|
+
labelAuto = _ref4[2],
|
|
274
|
+
labelCustom = _ref4[3],
|
|
275
|
+
lineCountLabel = _ref4[4];
|
|
276
|
+
return (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)(_form.EuiFormRow, {
|
|
277
|
+
label: rowHeightLabel,
|
|
278
|
+
display: "columnCompressed"
|
|
279
|
+
}, (0, _react2.jsx)(_button.EuiButtonGroup, {
|
|
280
|
+
legend: rowHeightLabel,
|
|
281
|
+
buttonSize: "compressed",
|
|
282
|
+
isFullWidth: true,
|
|
283
|
+
options: [{
|
|
284
|
+
id: rowHeightButtonOptions[0],
|
|
285
|
+
label: labelSingle
|
|
286
|
+
}, {
|
|
287
|
+
id: rowHeightButtonOptions[1],
|
|
288
|
+
label: labelAuto
|
|
289
|
+
}, {
|
|
290
|
+
id: rowHeightButtonOptions[2],
|
|
291
|
+
label: labelCustom
|
|
292
|
+
}],
|
|
293
|
+
onChange: setRowHeight,
|
|
294
|
+
idSelected: rowHeightSelection,
|
|
295
|
+
"data-test-subj": "rowHeightButtonGroup"
|
|
296
|
+
})), rowHeightSelection === rowHeightButtonOptions[2] && (0, _react2.jsx)(_form.EuiFormRow, {
|
|
297
|
+
label: lineCountLabel,
|
|
298
|
+
display: "columnCompressed"
|
|
299
|
+
}, (0, _react2.jsx)(_form.EuiRange, {
|
|
300
|
+
compressed: true,
|
|
301
|
+
fullWidth: true,
|
|
302
|
+
showInput: true,
|
|
303
|
+
min: 1,
|
|
304
|
+
max: 20,
|
|
305
|
+
step: 1,
|
|
306
|
+
required: true,
|
|
307
|
+
value: lineCountInput,
|
|
308
|
+
onChange: setLineCountHeight,
|
|
309
|
+
"data-test-subj": "lineCountNumber"
|
|
310
|
+
})));
|
|
311
|
+
}), additionalDisplaySettings, showResetButton && (0, _react2.jsx)(_popover.EuiPopoverFooter, null, (0, _react2.jsx)(_flex.EuiFlexGroup, {
|
|
312
|
+
justifyContent: "flexEnd",
|
|
313
|
+
responsive: false
|
|
314
|
+
}, (0, _react2.jsx)(_flex.EuiFlexItem, {
|
|
315
|
+
grow: false
|
|
316
|
+
}, (0, _react2.jsx)("div", null, (0, _react2.jsx)(_button.EuiButtonEmpty, {
|
|
317
|
+
flush: "both",
|
|
318
|
+
size: "xs",
|
|
319
|
+
onClick: resetToInitialState,
|
|
320
|
+
"data-test-subj": "resetDisplaySelector"
|
|
321
|
+
}, resetButtonLabel)))))) : null;
|
|
322
|
+
}, [additionalDisplaySettings, buttonLabel, isOpen, resetButtonLabel, showDensityControls, showResetButton, showRowHeightControls, gridDensity, rowHeightSelection, lineCountInput, setGridStyles, setRowHeight, setLineCountHeight, resetToInitialState]);
|
|
321
323
|
return [displaySelector, gridStyles, rowHeightsOptions];
|
|
322
324
|
};
|
|
323
325
|
exports.useDataGridDisplaySelector = useDataGridDisplaySelector;
|
|
@@ -75,9 +75,19 @@ var commaSeparateNumbers = function commaSeparateNumbers(numberString) {
|
|
|
75
75
|
);
|
|
76
76
|
});
|
|
77
77
|
};
|
|
78
|
+
var renderCellValue = function renderCellValue(_ref2) {
|
|
79
|
+
var rowIndex = _ref2.rowIndex,
|
|
80
|
+
columnId = _ref2.columnId,
|
|
81
|
+
schema = _ref2.schema;
|
|
82
|
+
var value = storeData[rowIndex][columnId];
|
|
83
|
+
if (schema === 'numeric') {
|
|
84
|
+
value = commaSeparateNumbers(value);
|
|
85
|
+
}
|
|
86
|
+
return value;
|
|
87
|
+
};
|
|
78
88
|
var DataGrid = function DataGrid() {
|
|
79
|
-
var _useState = (0, _react.useState)(columns.map(function (
|
|
80
|
-
var id =
|
|
89
|
+
var _useState = (0, _react.useState)(columns.map(function (_ref3) {
|
|
90
|
+
var id = _ref3.id;
|
|
81
91
|
return id;
|
|
82
92
|
})),
|
|
83
93
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -119,16 +129,7 @@ var DataGrid = function DataGrid() {
|
|
|
119
129
|
inMemory: {
|
|
120
130
|
level: 'sorting'
|
|
121
131
|
},
|
|
122
|
-
renderCellValue:
|
|
123
|
-
var rowIndex = _ref3.rowIndex,
|
|
124
|
-
columnId = _ref3.columnId,
|
|
125
|
-
schema = _ref3.schema;
|
|
126
|
-
var value = data[rowIndex][columnId];
|
|
127
|
-
if (schema === 'numeric') {
|
|
128
|
-
value = commaSeparateNumbers(value);
|
|
129
|
-
}
|
|
130
|
-
return value;
|
|
131
|
-
},
|
|
132
|
+
renderCellValue: renderCellValue,
|
|
132
133
|
sorting: {
|
|
133
134
|
columns: sortingColumns,
|
|
134
135
|
onSort: setSorting
|
|
@@ -25,8 +25,7 @@ var _data_grid_schema = require("./utils/data_grid_schema");
|
|
|
25
25
|
var _ref = require("./utils/ref");
|
|
26
26
|
var _data_grid_types = require("./data_grid_types");
|
|
27
27
|
var _react2 = require("@emotion/react");
|
|
28
|
-
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"]
|
|
29
|
-
_excluded2 = ["focusProps"];
|
|
28
|
+
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"];
|
|
30
29
|
/*
|
|
31
30
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
32
31
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -84,8 +83,8 @@ var cellPaddingsToClassMap = {
|
|
|
84
83
|
m: '',
|
|
85
84
|
l: 'euiDataGrid--paddingLarge'
|
|
86
85
|
};
|
|
86
|
+
var emptyVirtualizationOptions = {};
|
|
87
87
|
var EuiDataGrid = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
88
|
-
var _gridItemsRendered$cu;
|
|
89
88
|
var _props$leadingControl = props.leadingControlColumns,
|
|
90
89
|
leadingControlColumns = _props$leadingControl === void 0 ? _data_grid_types.emptyControlColumns : _props$leadingControl,
|
|
91
90
|
_props$trailingContro = props.trailingControlColumns,
|
|
@@ -205,8 +204,14 @@ var EuiDataGrid = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forward
|
|
|
205
204
|
/**
|
|
206
205
|
* Sorting
|
|
207
206
|
*/
|
|
208
|
-
var columnSorting = (0, _controls.useDataGridColumnSorting)(
|
|
209
|
-
|
|
207
|
+
var columnSorting = (0, _controls.useDataGridColumnSorting)({
|
|
208
|
+
sorting: sorting,
|
|
209
|
+
columns: orderedVisibleColumns,
|
|
210
|
+
displayValues: displayValues,
|
|
211
|
+
schema: mergedSchema,
|
|
212
|
+
schemaDetectors: allSchemaDetectors
|
|
213
|
+
});
|
|
214
|
+
var sortedContext = (0, _sorting.useSorting)({
|
|
210
215
|
sorting: sorting,
|
|
211
216
|
inMemory: inMemory,
|
|
212
217
|
inMemoryValues: inMemoryValues,
|
|
@@ -220,7 +225,20 @@ var EuiDataGrid = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forward
|
|
|
220
225
|
*/
|
|
221
226
|
var _useFocus = (0, _focus.useFocus)(),
|
|
222
227
|
wrappingDivFocusProps = _useFocus.focusProps,
|
|
223
|
-
|
|
228
|
+
onFocusUpdate = _useFocus.onFocusUpdate,
|
|
229
|
+
focusedCell = _useFocus.focusedCell,
|
|
230
|
+
setFocusedCell = _useFocus.setFocusedCell,
|
|
231
|
+
setIsFocusedCellInView = _useFocus.setIsFocusedCellInView,
|
|
232
|
+
focusFirstVisibleInteractiveCell = _useFocus.focusFirstVisibleInteractiveCell;
|
|
233
|
+
var focusContext = (0, _react.useMemo)(function () {
|
|
234
|
+
return {
|
|
235
|
+
onFocusUpdate: onFocusUpdate,
|
|
236
|
+
focusedCell: focusedCell,
|
|
237
|
+
setFocusedCell: setFocusedCell,
|
|
238
|
+
setIsFocusedCellInView: setIsFocusedCellInView,
|
|
239
|
+
focusFirstVisibleInteractiveCell: focusFirstVisibleInteractiveCell
|
|
240
|
+
};
|
|
241
|
+
}, [onFocusUpdate, focusedCell, setFocusedCell, setIsFocusedCellInView, focusFirstVisibleInteractiveCell]);
|
|
224
242
|
|
|
225
243
|
/**
|
|
226
244
|
* Cell popover
|
|
@@ -250,7 +268,7 @@ var EuiDataGrid = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forward
|
|
|
250
268
|
setIsFullScreen: setIsFullScreen,
|
|
251
269
|
focusContext: focusContext,
|
|
252
270
|
cellPopoverContext: cellPopoverContext,
|
|
253
|
-
|
|
271
|
+
sortedContext: sortedContext,
|
|
254
272
|
pagination: pagination,
|
|
255
273
|
rowCount: rowCount,
|
|
256
274
|
visibleColCount: visibleColCount
|
|
@@ -297,12 +315,25 @@ var EuiDataGrid = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forward
|
|
|
297
315
|
gridAriaProps['aria-labelledby'] = "".concat(rest['aria-labelledby'], " ").concat(pagination ? ariaLabelledById : '');
|
|
298
316
|
delete rest['aria-labelledby'];
|
|
299
317
|
}
|
|
318
|
+
var onKeyDown = (0, _react.useCallback)(function (event) {
|
|
319
|
+
var _gridItemsRendered$cu;
|
|
320
|
+
(0, _focus.createKeyDownHandler)({
|
|
321
|
+
gridElement: contentRef.current,
|
|
322
|
+
visibleColCount: visibleColCount,
|
|
323
|
+
visibleRowCount: visibleRowCount,
|
|
324
|
+
visibleRowStartIndex: ((_gridItemsRendered$cu = gridItemsRendered.current) === null || _gridItemsRendered$cu === void 0 ? void 0 : _gridItemsRendered$cu.visibleRowStartIndex) || 0,
|
|
325
|
+
rowCount: rowCount,
|
|
326
|
+
pagination: pagination,
|
|
327
|
+
hasFooter: !!renderFooterCellValue,
|
|
328
|
+
focusContext: focusContext
|
|
329
|
+
})(event);
|
|
330
|
+
}, [focusContext, visibleColCount, visibleRowCount, rowCount, pagination, renderFooterCellValue]);
|
|
300
331
|
return (0, _react2.jsx)(_focus.DataGridFocusContext.Provider, {
|
|
301
332
|
value: focusContext
|
|
302
333
|
}, (0, _react2.jsx)(_cell.DataGridCellPopoverContext.Provider, {
|
|
303
334
|
value: cellPopoverContext
|
|
304
|
-
}, (0, _react2.jsx)(_sorting.
|
|
305
|
-
value:
|
|
335
|
+
}, (0, _react2.jsx)(_sorting.DataGridSortedContext.Provider, {
|
|
336
|
+
value: sortedContext
|
|
306
337
|
}, (0, _react2.jsx)(_focus_trap.EuiFocusTrap, {
|
|
307
338
|
disabled: !isFullScreen,
|
|
308
339
|
className: "euiDataGrid__focusWrap"
|
|
@@ -338,16 +369,7 @@ var EuiDataGrid = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forward
|
|
|
338
369
|
}) : null, (0, _react2.jsx)("div", _extends({
|
|
339
370
|
// eslint-disable-line jsx-a11y/interactive-supports-focus
|
|
340
371
|
ref: contentRef,
|
|
341
|
-
onKeyDown:
|
|
342
|
-
gridElement: contentRef.current,
|
|
343
|
-
visibleColCount: visibleColCount,
|
|
344
|
-
visibleRowCount: visibleRowCount,
|
|
345
|
-
visibleRowStartIndex: ((_gridItemsRendered$cu = gridItemsRendered.current) === null || _gridItemsRendered$cu === void 0 ? void 0 : _gridItemsRendered$cu.visibleRowStartIndex) || 0,
|
|
346
|
-
rowCount: rowCount,
|
|
347
|
-
pagination: pagination,
|
|
348
|
-
hasFooter: !!renderFooterCellValue,
|
|
349
|
-
focusContext: focusContext
|
|
350
|
-
}),
|
|
372
|
+
onKeyDown: onKeyDown,
|
|
351
373
|
"data-test-subj": "euiDataGridBody",
|
|
352
374
|
className: "euiDataGrid__content",
|
|
353
375
|
role: "grid",
|
|
@@ -363,6 +385,7 @@ var EuiDataGrid = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forward
|
|
|
363
385
|
switchColumnPos: switchColumnPos,
|
|
364
386
|
onColumnResize: onColumnResize,
|
|
365
387
|
schemaDetectors: allSchemaDetectors,
|
|
388
|
+
sorting: sorting,
|
|
366
389
|
pagination: pagination,
|
|
367
390
|
renderCellValue: renderCellValue,
|
|
368
391
|
cellContext: cellContext,
|
|
@@ -372,7 +395,7 @@ var EuiDataGrid = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forward
|
|
|
372
395
|
visibleRows: visibleRows,
|
|
373
396
|
interactiveCellId: interactiveCellId,
|
|
374
397
|
rowHeightsOptions: rowHeightsOptions,
|
|
375
|
-
virtualizationOptions: virtualizationOptions ||
|
|
398
|
+
virtualizationOptions: virtualizationOptions || emptyVirtualizationOptions,
|
|
376
399
|
isFullScreen: isFullScreen,
|
|
377
400
|
gridStyles: gridStyles,
|
|
378
401
|
gridWidth: gridWidth,
|
|
@@ -8,15 +8,15 @@ exports.useDefaultColumnWidth = exports.useColumnWidths = exports.doesColumnHave
|
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _services = require("../../../services");
|
|
10
10
|
var _utils = require("../../../utils");
|
|
11
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
12
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
13
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
14
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
15
|
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; }
|
|
12
16
|
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; }
|
|
13
17
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
14
18
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
15
19
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
16
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
17
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
18
|
-
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
19
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
20
20
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
21
21
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
22
22
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -65,10 +65,12 @@ var useColumnWidths = function useColumnWidths(_ref) {
|
|
|
65
65
|
onColumnResize = _ref.onColumnResize;
|
|
66
66
|
var computeColumnWidths = (0, _react.useCallback)(function () {
|
|
67
67
|
return columns.filter(doesColumnHaveAnInitialWidth).reduce(function (initialWidths, column) {
|
|
68
|
-
initialWidths
|
|
69
|
-
return initialWidths;
|
|
68
|
+
return _objectSpread(_objectSpread({}, initialWidths), {}, _defineProperty({}, column.id, column.initialWidth));
|
|
70
69
|
}, {});
|
|
71
70
|
}, [columns]);
|
|
71
|
+
|
|
72
|
+
// Passes initializer function for performance, so computing only runs once on init
|
|
73
|
+
// @see https://react.dev/reference/react/useState#examples-initializer
|
|
72
74
|
var _useState = (0, _react.useState)(computeColumnWidths),
|
|
73
75
|
_useState2 = _slicedToArray(_useState, 2),
|
|
74
76
|
columnWidths = _useState2[0],
|
|
@@ -77,14 +79,16 @@ var useColumnWidths = function useColumnWidths(_ref) {
|
|
|
77
79
|
setColumnWidths(computeColumnWidths());
|
|
78
80
|
}, [computeColumnWidths]);
|
|
79
81
|
var setColumnWidth = (0, _react.useCallback)(function (columnId, width) {
|
|
80
|
-
setColumnWidths(
|
|
82
|
+
setColumnWidths(function (prevColumnWidths) {
|
|
83
|
+
return _objectSpread(_objectSpread({}, prevColumnWidths), {}, _defineProperty({}, columnId, width));
|
|
84
|
+
});
|
|
81
85
|
if (onColumnResize) {
|
|
82
86
|
onColumnResize({
|
|
83
87
|
columnId: columnId,
|
|
84
88
|
width: width
|
|
85
89
|
});
|
|
86
90
|
}
|
|
87
|
-
}, [
|
|
91
|
+
}, [onColumnResize]);
|
|
88
92
|
|
|
89
93
|
// Used by react-window to determine actual column widths
|
|
90
94
|
var getColumnWidth = (0, _react.useCallback)(function (index) {
|
|
@@ -97,14 +97,16 @@ var useFocus = function useFocus() {
|
|
|
97
97
|
}
|
|
98
98
|
};
|
|
99
99
|
}, [isFocusedCellInView, focusFirstVisibleInteractiveCell]);
|
|
100
|
-
return {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
100
|
+
return (0, _react.useMemo)(function () {
|
|
101
|
+
return {
|
|
102
|
+
onFocusUpdate: onFocusUpdate,
|
|
103
|
+
focusedCell: focusedCell,
|
|
104
|
+
setFocusedCell: setFocusedCell,
|
|
105
|
+
setIsFocusedCellInView: setIsFocusedCellInView,
|
|
106
|
+
focusFirstVisibleInteractiveCell: focusFirstVisibleInteractiveCell,
|
|
107
|
+
focusProps: focusProps
|
|
108
|
+
};
|
|
109
|
+
}, [onFocusUpdate, focusedCell, setFocusedCell, setIsFocusedCellInView, focusFirstVisibleInteractiveCell, focusProps]);
|
|
108
110
|
};
|
|
109
111
|
exports.useFocus = useFocus;
|
|
110
112
|
var notifyCellOfFocusState = function notifyCellOfFocusState(cellsUpdateFocus, cell, isFocused) {
|
|
@@ -93,42 +93,43 @@ var useUnconstrainedHeight = function useUnconstrainedHeight(_ref2) {
|
|
|
93
93
|
footerRowHeight = _ref2.footerRowHeight,
|
|
94
94
|
scrollBarHeight = _ref2.scrollBarHeight,
|
|
95
95
|
innerGridRef = _ref2.innerGridRef;
|
|
96
|
-
var _useContext = (0, _react.useContext)(_sorting.
|
|
96
|
+
var _useContext = (0, _react.useContext)(_sorting.DataGridSortedContext),
|
|
97
97
|
getCorrectRowIndex = _useContext.getCorrectRowIndex;
|
|
98
|
-
var knownHeight = 0; // tracks the pixel height of rows we know the size of
|
|
99
|
-
var knownRowCount = 0; // how many rows we know the size of
|
|
100
|
-
for (var i = startRow; i < endRow; i++) {
|
|
101
|
-
var correctRowIndex = getCorrectRowIndex(i); // map visible row to logical row
|
|
102
|
-
|
|
103
|
-
// lookup the height configuration of this row
|
|
104
|
-
var rowHeightOption = rowHeightUtils.getRowHeightOption(correctRowIndex, rowHeightsOptions);
|
|
105
|
-
if (rowHeightOption) {
|
|
106
|
-
// this row's height is known
|
|
107
|
-
knownRowCount++;
|
|
108
|
-
knownHeight += rowHeightUtils.getCalculatedHeight(rowHeightOption, defaultRowHeight, correctRowIndex, rowHeightUtils.isRowHeightOverride(correctRowIndex, rowHeightsOptions));
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// how many rows to provide space for on the screen
|
|
113
|
-
var rowCountToAffordFor = endRow - startRow;
|
|
114
|
-
|
|
115
98
|
// watch the inner element for a change to its width
|
|
116
99
|
// which may cause the horizontal scrollbar to be added or removed
|
|
117
100
|
var _useResizeObserver = (0, _resize_observer.useResizeObserver)(innerGridRef.current, 'width'),
|
|
118
101
|
innerWidth = _useResizeObserver.width;
|
|
119
102
|
var forceRender = (0, _services.useForceRender)();
|
|
120
103
|
(0, _services.useUpdateEffect)(forceRender, [innerWidth]);
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
104
|
+
return (0, _react.useMemo)(function () {
|
|
105
|
+
var knownHeight = 0; // tracks the pixel height of rows we know the size of
|
|
106
|
+
var knownRowCount = 0; // how many rows we know the size of
|
|
107
|
+
for (var i = startRow; i < endRow; i++) {
|
|
108
|
+
var correctRowIndex = getCorrectRowIndex(i); // map visible row to logical row
|
|
109
|
+
|
|
110
|
+
// lookup the height configuration of this row
|
|
111
|
+
var rowHeightOption = rowHeightUtils.getRowHeightOption(correctRowIndex, rowHeightsOptions);
|
|
112
|
+
if (rowHeightOption) {
|
|
113
|
+
// this row's height is known
|
|
114
|
+
knownRowCount++;
|
|
115
|
+
knownHeight += rowHeightUtils.getCalculatedHeight(rowHeightOption, defaultRowHeight, correctRowIndex, rowHeightUtils.isRowHeightOverride(correctRowIndex, rowHeightsOptions));
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// how many rows to provide space for on the screen
|
|
120
|
+
var rowCountToAffordFor = endRow - startRow;
|
|
121
|
+
var unconstrainedHeight = defaultRowHeight * (rowCountToAffordFor - knownRowCount) +
|
|
122
|
+
// guess how much space is required for unknown rows
|
|
123
|
+
knownHeight +
|
|
124
|
+
// computed pixel height of the known rows
|
|
125
|
+
headerRowHeight +
|
|
126
|
+
// account for header
|
|
127
|
+
footerRowHeight +
|
|
128
|
+
// account for footer
|
|
129
|
+
scrollBarHeight; // account for horizontal scrollbar
|
|
130
130
|
|
|
131
|
-
|
|
131
|
+
return unconstrainedHeight;
|
|
132
|
+
}, [defaultRowHeight, endRow, footerRowHeight, headerRowHeight, startRow, getCorrectRowIndex, rowHeightUtils, rowHeightsOptions, scrollBarHeight]);
|
|
132
133
|
};
|
|
133
134
|
|
|
134
135
|
/**
|