@elastic/eui 121.0.0-snapshot.1788869799640 → 121.0.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-icons.json +10 -10
- package/es/components/datagrid/body/cell/data_grid_cell.js +5 -8
- package/es/components/datagrid/body/cell/data_grid_cell.styles.js +1 -1
- package/es/components/datagrid/body/cell/data_grid_cell_wrapper.js +2 -4
- package/es/components/datagrid/body/footer/data_grid_footer_row.js +0 -4
- package/es/components/datagrid/body/header/column_resizer.js +87 -74
- package/es/components/datagrid/body/header/data_grid_control_header_cell.js +1 -2
- package/es/components/datagrid/body/header/data_grid_header_cell.js +0 -1
- package/es/components/datagrid/body/header/data_grid_header_cell_wrapper.js +3 -9
- package/es/components/datagrid/body/header/data_grid_header_cell_wrapper.styles.js +1 -1
- package/es/components/datagrid/controls/keyboard_shortcuts.js +1 -17
- package/es/components/datagrid/data_grid.js +0 -2
- package/es/components/form/super_select/super_select.js +351 -247
- package/eui.d.ts +55 -30
- package/i18ntokens.json +205 -277
- package/lib/components/datagrid/body/cell/data_grid_cell.js +5 -8
- package/lib/components/datagrid/body/cell/data_grid_cell.styles.js +1 -1
- package/lib/components/datagrid/body/cell/data_grid_cell_wrapper.js +2 -4
- package/lib/components/datagrid/body/footer/data_grid_footer_row.js +0 -4
- package/lib/components/datagrid/body/header/column_resizer.js +85 -73
- package/lib/components/datagrid/body/header/data_grid_control_header_cell.js +1 -2
- package/lib/components/datagrid/body/header/data_grid_header_cell.js +0 -1
- package/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.js +3 -9
- package/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.styles.js +1 -1
- package/lib/components/datagrid/controls/keyboard_shortcuts.js +1 -17
- package/lib/components/datagrid/data_grid.js +0 -2
- package/lib/components/form/super_select/super_select.js +355 -253
- package/optimize/es/components/datagrid/body/cell/data_grid_cell.js +4 -5
- package/optimize/es/components/datagrid/body/cell/data_grid_cell.styles.js +1 -1
- package/optimize/es/components/datagrid/body/cell/data_grid_cell_wrapper.js +2 -4
- package/optimize/es/components/datagrid/body/footer/data_grid_footer_row.js +0 -4
- package/optimize/es/components/datagrid/body/header/column_resizer.js +81 -69
- package/optimize/es/components/datagrid/body/header/data_grid_control_header_cell.js +1 -2
- package/optimize/es/components/datagrid/body/header/data_grid_header_cell.js +0 -1
- package/optimize/es/components/datagrid/body/header/data_grid_header_cell_wrapper.js +3 -7
- package/optimize/es/components/datagrid/body/header/data_grid_header_cell_wrapper.styles.js +1 -1
- package/optimize/es/components/datagrid/controls/keyboard_shortcuts.js +1 -17
- package/optimize/es/components/datagrid/data_grid.js +0 -2
- package/optimize/es/components/form/super_select/super_select.js +265 -242
- package/optimize/lib/components/datagrid/body/cell/data_grid_cell.js +4 -5
- package/optimize/lib/components/datagrid/body/cell/data_grid_cell.styles.js +1 -1
- package/optimize/lib/components/datagrid/body/cell/data_grid_cell_wrapper.js +2 -4
- package/optimize/lib/components/datagrid/body/footer/data_grid_footer_row.js +0 -4
- package/optimize/lib/components/datagrid/body/header/column_resizer.js +79 -69
- package/optimize/lib/components/datagrid/body/header/data_grid_control_header_cell.js +1 -2
- package/optimize/lib/components/datagrid/body/header/data_grid_header_cell.js +0 -1
- package/optimize/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.js +3 -7
- package/optimize/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.styles.js +1 -1
- package/optimize/lib/components/datagrid/controls/keyboard_shortcuts.js +1 -17
- package/optimize/lib/components/datagrid/data_grid.js +0 -2
- package/optimize/lib/components/form/super_select/super_select.js +265 -243
- package/package.json +7 -8
- package/test-env/components/datagrid/body/cell/data_grid_cell.js +5 -8
- package/test-env/components/datagrid/body/cell/data_grid_cell.styles.js +1 -1
- package/test-env/components/datagrid/body/cell/data_grid_cell_wrapper.js +2 -4
- package/test-env/components/datagrid/body/footer/data_grid_footer_row.js +0 -4
- package/test-env/components/datagrid/body/header/column_resizer.js +79 -69
- package/test-env/components/datagrid/body/header/data_grid_control_header_cell.js +1 -2
- package/test-env/components/datagrid/body/header/data_grid_header_cell.js +0 -1
- package/test-env/components/datagrid/body/header/data_grid_header_cell_wrapper.js +3 -9
- package/test-env/components/datagrid/body/header/data_grid_header_cell_wrapper.styles.js +1 -1
- package/test-env/components/datagrid/controls/keyboard_shortcuts.js +1 -17
- package/test-env/components/datagrid/data_grid.js +0 -2
- package/test-env/components/form/super_select/super_select.js +345 -243
- package/es/components/datagrid/utils/copy_focused_cell.js +0 -34
- package/lib/components/datagrid/utils/copy_focused_cell.js +0 -39
- package/optimize/es/components/datagrid/utils/copy_focused_cell.js +0 -34
- package/optimize/lib/components/datagrid/utils/copy_focused_cell.js +0 -39
- package/test-env/components/datagrid/utils/copy_focused_cell.js +0 -16
|
@@ -22,7 +22,7 @@ var _focus_utils = require("./focus_utils");
|
|
|
22
22
|
var _data_grid_cell = require("./data_grid_cell.styles");
|
|
23
23
|
var _react2 = require("@emotion/react");
|
|
24
24
|
var _excluded = ["renderCellValue", "cellContext", "column", "setCellContentsRef", "rowIndex", "colIndex", "rowHeightsOptions", "rowHeightUtils", "isControlColumn"],
|
|
25
|
-
_excluded2 = ["width", "popoverContext", "interactiveCellId", "columnType", "className", "column", "style", "rowHeightUtils", "rowHeightsOptions", "rowManager", "pagination"
|
|
25
|
+
_excluded2 = ["width", "popoverContext", "interactiveCellId", "columnType", "className", "column", "style", "rowHeightUtils", "rowHeightsOptions", "rowManager", "pagination"],
|
|
26
26
|
_excluded3 = ["isExpandable", "style", "className", "data-test-subj"],
|
|
27
27
|
_excluded4 = ["columnId", "columnIndex", "rowIndex", "visibleRowIndex"];
|
|
28
28
|
/*
|
|
@@ -668,7 +668,6 @@ EuiDataGridCellContent.propTypes = {
|
|
|
668
668
|
*/
|
|
669
669
|
onChange: _propTypes.default.func
|
|
670
670
|
}).isRequired,
|
|
671
|
-
isLastCopyColumn: _propTypes.default.bool,
|
|
672
671
|
setCellProps: _propTypes.default.func.isRequired,
|
|
673
672
|
setCellContentsRef: _propTypes.default.func.isRequired,
|
|
674
673
|
isExpanded: _propTypes.default.bool.isRequired,
|
|
@@ -1008,8 +1007,6 @@ var EuiDataGridCell = exports.EuiDataGridCell = /*#__PURE__*/function (_Componen
|
|
|
1008
1007
|
rowHeightsOptions = _this$props9.rowHeightsOptions,
|
|
1009
1008
|
rowManager = _this$props9.rowManager,
|
|
1010
1009
|
pagination = _this$props9.pagination,
|
|
1011
|
-
_this$props9$isLastCo = _this$props9.isLastCopyColumn,
|
|
1012
|
-
isLastCopyColumn = _this$props9$isLastCo === void 0 ? false : _this$props9$isLastCo,
|
|
1013
1010
|
rest = _objectWithoutProperties(_this$props9, _excluded2);
|
|
1014
1011
|
var rowIndex = rest.rowIndex,
|
|
1015
1012
|
visibleRowIndex = rest.visibleRowIndex,
|
|
@@ -1021,6 +1018,7 @@ var EuiDataGridCell = exports.EuiDataGridCell = /*#__PURE__*/function (_Componen
|
|
|
1021
1018
|
|
|
1022
1019
|
// classNames set by EuiDataGridCellWrapper
|
|
1023
1020
|
var isControlColumn = cellClasses.includes('euiDataGridRowCell--controlColumn');
|
|
1021
|
+
var isLastColumn = cellClasses.includes('euiDataGridRowCell--lastColumn');
|
|
1024
1022
|
var ariaRowIndex = pagination ? visibleRowIndex + 1 + pagination.pageSize * pagination.pageIndex : visibleRowIndex + 1;
|
|
1025
1023
|
var _this$state$cellProps2 = this.state.cellProps,
|
|
1026
1024
|
_ = _this$state$cellProps2.isExpandable,
|
|
@@ -1060,7 +1058,7 @@ var EuiDataGridCell = exports.EuiDataGridCell = /*#__PURE__*/function (_Componen
|
|
|
1060
1058
|
onKeyDown: this.handleCellKeyDown,
|
|
1061
1059
|
onMouseEnter: this.onMouseEnter,
|
|
1062
1060
|
onMouseLeave: this.onMouseLeave
|
|
1063
|
-
}),
|
|
1061
|
+
}), (0, _react2.jsx)(_focus_utils.HandleInteractiveChildren, {
|
|
1064
1062
|
cellEl: this.cellRef.current,
|
|
1065
1063
|
updateCellFocusContext: this.updateCellFocusContext,
|
|
1066
1064
|
renderFocusTrap: !isExpandable
|
|
@@ -1076,7 +1074,7 @@ var EuiDataGridCell = exports.EuiDataGridCell = /*#__PURE__*/function (_Componen
|
|
|
1076
1074
|
isControlColumn: isControlColumn,
|
|
1077
1075
|
rowIndex: rowIndex,
|
|
1078
1076
|
colIndex: colIndex
|
|
1079
|
-
}))),
|
|
1077
|
+
}))), isLastColumn ? _services.tabularCopyMarkers.hiddenNewline : _services.tabularCopyMarkers.hiddenTab, this.state.isFocused && (0, _react2.jsx)(CellScreenReaderDescription, {
|
|
1080
1078
|
columnName: (column === null || column === void 0 ? void 0 : column.displayAsText) || this.props.columnId,
|
|
1081
1079
|
columnIndex: colIndex + 1,
|
|
1082
1080
|
rowIndex: ariaRowIndex,
|
|
@@ -1566,8 +1564,7 @@ EuiDataGridCell.propTypes = {
|
|
|
1566
1564
|
* Can be used for, e.g. storing user `gridStyle` in a local storage object.
|
|
1567
1565
|
*/
|
|
1568
1566
|
onChange: _propTypes.default.func
|
|
1569
|
-
}).isRequired
|
|
1570
|
-
isLastCopyColumn: _propTypes.default.bool
|
|
1567
|
+
}).isRequired
|
|
1571
1568
|
};
|
|
1572
1569
|
var RenderCellInRow = /*#__PURE__*/(0, _react.memo)(function (_ref2) {
|
|
1573
1570
|
var row = _ref2.row,
|
|
@@ -108,7 +108,7 @@ var euiDataGridRowCellStyles = exports.euiDataGridRowCellStyles = function euiDa
|
|
|
108
108
|
var _euiDataGridCellOutli = euiDataGridCellOutlineSelectors(),
|
|
109
109
|
outlineSelectors = _euiDataGridCellOutli.outline;
|
|
110
110
|
return {
|
|
111
|
-
euiDataGridRowCell: /*#__PURE__*/(0, _react.css)("position:relative;", outlineSelectors.show, "{", cellOutline.focusStyles, ";}", outlineSelectors.hover, "{", cellOutline.hoverStyles, ";}", outlineSelectors.focusTrapped, "{", cellOutline.hoverStyles, ";}&>[data-focus-lock-disabled]{", (0, _global_styling.logicalCSS)('height', '100%'), ";}&:where(.euiDataGridRowCell--numeric, .euiDataGridRowCell--currency){", (0, _global_styling.logicalTextAlignCSS)('right'), ";}&:where(.euiDataGridRowCell--uppercase){text-transform:uppercase;}&:where(.euiDataGridRowCell--lowercase){text-transform:lowercase;}&:where(.euiDataGridRowCell--capitalize){text-transform:capitalize;}
|
|
111
|
+
euiDataGridRowCell: /*#__PURE__*/(0, _react.css)("position:relative;", outlineSelectors.show, "{", cellOutline.focusStyles, ";}", outlineSelectors.hover, "{", cellOutline.hoverStyles, ";}", outlineSelectors.focusTrapped, "{", cellOutline.hoverStyles, ";}&>[data-focus-lock-disabled]{", (0, _global_styling.logicalCSS)('height', '100%'), ";}&:where(.euiDataGridRowCell--numeric, .euiDataGridRowCell--currency){", (0, _global_styling.logicalTextAlignCSS)('right'), ";}&:where(.euiDataGridRowCell--uppercase){text-transform:uppercase;}&:where(.euiDataGridRowCell--lowercase){text-transform:lowercase;}&:where(.euiDataGridRowCell--capitalize){text-transform:capitalize;};label:euiDataGridRowCell;"),
|
|
112
112
|
content: {
|
|
113
113
|
euiDataGridRowCell__content: _ref,
|
|
114
114
|
autoHeight: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('height', 'auto'), ";;label:autoHeight;"),
|
|
@@ -60,7 +60,6 @@ var CellWrapper = exports.CellWrapper = /*#__PURE__*/(0, _react.memo)(function (
|
|
|
60
60
|
getCorrectRowIndex = _useContext.getCorrectRowIndex;
|
|
61
61
|
var isFirstColumn = colIndex === 0;
|
|
62
62
|
var isLastColumn = colIndex === visibleColCount - 1;
|
|
63
|
-
var isLastCopyColumn = columns.length > 0 && colIndex === leadingControlColumns.length + columns.length - 1;
|
|
64
63
|
var isLeadingControlColumn = colIndex < leadingControlColumns.length;
|
|
65
64
|
var isTrailingControlColumn = colIndex >= leadingControlColumns.length + columns.length;
|
|
66
65
|
var datacolIndex = colIndex - leadingControlColumns.length;
|
|
@@ -91,10 +90,9 @@ var CellWrapper = exports.CellWrapper = /*#__PURE__*/(0, _react.memo)(function (
|
|
|
91
90
|
rowManager: rowManager,
|
|
92
91
|
popoverContext: popoverContext,
|
|
93
92
|
pagination: pagination,
|
|
94
|
-
cellContext: cellContext
|
|
95
|
-
isLastCopyColumn: isLastCopyColumn
|
|
93
|
+
cellContext: cellContext
|
|
96
94
|
};
|
|
97
|
-
}, [colIndex, setRowHeight, visibleRowIndex, getCorrectRowIndex, interactiveCellId, style, rowHeightsOptions, rowHeightUtils, rowManager, popoverContext, pagination, cellContext, isFirstColumn, isLastColumn,
|
|
95
|
+
}, [colIndex, setRowHeight, visibleRowIndex, getCorrectRowIndex, interactiveCellId, style, rowHeightsOptions, rowHeightUtils, rowManager, popoverContext, pagination, cellContext, isFirstColumn, isLastColumn, isLeadingControlColumn, isTrailingControlColumn, textTransform]);
|
|
98
96
|
if (isLeadingControlColumn) {
|
|
99
97
|
var leadingColumn = leadingControlColumns[colIndex];
|
|
100
98
|
var id = leadingColumn.id,
|
|
@@ -50,7 +50,6 @@ var EuiDataGridFooterRow = exports.EuiDataGridFooterRow = /*#__PURE__*/(0, _reac
|
|
|
50
50
|
var cssStyles = [styles.euiDataGridFooter, gridStyles.stickyFooter && styles.sticky, gridStyles.footer === 'striped' ? visibleRowIndex % 2 !== 0 && styles.striped : styles[gridStyles.footer]];
|
|
51
51
|
var classes = (0, _classnames.default)('euiDataGridFooter', className);
|
|
52
52
|
var dataTestSubj = (0, _classnames.default)('dataGridRow', 'dataGridFooterRow', _dataTestSubj);
|
|
53
|
-
var lastCopyColumnIndex = columns.length > 0 ? leadingControlColumns.length + columns.length - 1 : -1;
|
|
54
53
|
var getCellClasses = (0, _react.useCallback)(function (columnIndex, classes) {
|
|
55
54
|
return (0, _classnames.default)('euiDataGridFooterCell', {
|
|
56
55
|
'euiDataGridRowCell--firstColumn': columnIndex === 0,
|
|
@@ -84,7 +83,6 @@ var EuiDataGridFooterRow = exports.EuiDataGridFooterRow = /*#__PURE__*/(0, _reac
|
|
|
84
83
|
width: width,
|
|
85
84
|
renderCellValue: footerCellRender !== null && footerCellRender !== void 0 ? footerCellRender : renderEmpty,
|
|
86
85
|
isExpandable: false,
|
|
87
|
-
isLastCopyColumn: i === lastCopyColumnIndex,
|
|
88
86
|
className: getCellClasses(i, (0, _classnames.default)('euiDataGridRowCell--controlColumn', footerCellProps === null || footerCellProps === void 0 ? void 0 : footerCellProps.className))
|
|
89
87
|
}));
|
|
90
88
|
}), columns.map(function (_ref3, i) {
|
|
@@ -102,7 +100,6 @@ var EuiDataGridFooterRow = exports.EuiDataGridFooterRow = /*#__PURE__*/(0, _reac
|
|
|
102
100
|
renderCellValue: renderCellValue,
|
|
103
101
|
renderCellPopover: renderCellPopover,
|
|
104
102
|
isExpandable: true,
|
|
105
|
-
isLastCopyColumn: columnPosition === lastCopyColumnIndex,
|
|
106
103
|
className: getCellClasses(columnPosition)
|
|
107
104
|
}));
|
|
108
105
|
}), trailingControlColumns.map(function (_ref4, i) {
|
|
@@ -118,7 +115,6 @@ var EuiDataGridFooterRow = exports.EuiDataGridFooterRow = /*#__PURE__*/(0, _reac
|
|
|
118
115
|
width: width,
|
|
119
116
|
renderCellValue: footerCellRender !== null && footerCellRender !== void 0 ? footerCellRender : renderEmpty,
|
|
120
117
|
isExpandable: false,
|
|
121
|
-
isLastCopyColumn: colIndex === lastCopyColumnIndex,
|
|
122
118
|
className: getCellClasses(colIndex, (0, _classnames.default)('euiDataGridRowCell--controlColumn', footerCellProps === null || footerCellProps === void 0 ? void 0 : footerCellProps.className))
|
|
123
119
|
}));
|
|
124
120
|
}));
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
@@ -15,12 +14,20 @@ var _react2 = require("@emotion/react");
|
|
|
15
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
15
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
17
16
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
18
|
-
function
|
|
19
|
-
function
|
|
20
|
-
function
|
|
21
|
-
function
|
|
22
|
-
function
|
|
23
|
-
function
|
|
17
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
18
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
19
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
20
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
21
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
22
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
23
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
24
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
25
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
26
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
27
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
28
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
29
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
30
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /*
|
|
24
31
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
25
32
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
26
33
|
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
@@ -28,73 +35,78 @@ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; } /*
|
|
|
28
35
|
* Side Public License, v 1.
|
|
29
36
|
*/
|
|
30
37
|
var MINIMUM_COLUMN_WIDTH = 40;
|
|
31
|
-
var EuiDataGridColumnResizer = exports.EuiDataGridColumnResizer = function
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
});
|
|
51
|
-
var onMouseMove = (0, _react.useCallback)(function (e) {
|
|
52
|
-
var _ref2 = latest.current,
|
|
53
|
-
columnWidth = _ref2.columnWidth;
|
|
54
|
-
setOffset(Math.max(e.pageX - initialX.current, -(columnWidth - MINIMUM_COLUMN_WIDTH)));
|
|
55
|
-
}, [latest]);
|
|
56
|
-
var onMouseUp = (0, _react.useCallback)(function () {
|
|
57
|
-
var _ref3 = latest.current,
|
|
58
|
-
columnId = _ref3.columnId,
|
|
59
|
-
columnWidth = _ref3.columnWidth,
|
|
60
|
-
setColumnWidth = _ref3.setColumnWidth,
|
|
61
|
-
offset = _ref3.offset;
|
|
62
|
-
setColumnWidth(columnId, Math.max(MINIMUM_COLUMN_WIDTH, columnWidth + offset));
|
|
63
|
-
setOffset(0);
|
|
64
|
-
window.removeEventListener('mouseup', onMouseUp);
|
|
65
|
-
window.removeEventListener('blur', onMouseUp);
|
|
66
|
-
window.removeEventListener('mousemove', onMouseMove);
|
|
67
|
-
}, [latest, onMouseMove]);
|
|
68
|
-
var onMouseDown = (0, _react.useCallback)(function (e) {
|
|
69
|
-
initialX.current = e.pageX;
|
|
70
|
-
window.addEventListener('mouseup', onMouseUp);
|
|
71
|
-
window.addEventListener('blur', onMouseUp);
|
|
72
|
-
window.addEventListener('mousemove', onMouseMove);
|
|
73
|
-
|
|
74
|
-
// don't let this action steal focus
|
|
75
|
-
e.preventDefault();
|
|
76
|
-
}, [onMouseUp, onMouseMove]);
|
|
38
|
+
var EuiDataGridColumnResizer = exports.EuiDataGridColumnResizer = /*#__PURE__*/function (_Component) {
|
|
39
|
+
function EuiDataGridColumnResizer() {
|
|
40
|
+
var _this;
|
|
41
|
+
_classCallCheck(this, EuiDataGridColumnResizer);
|
|
42
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
43
|
+
args[_key] = arguments[_key];
|
|
44
|
+
}
|
|
45
|
+
_this = _callSuper(this, EuiDataGridColumnResizer, [].concat(args));
|
|
46
|
+
_defineProperty(_this, "state", {
|
|
47
|
+
initialX: 0,
|
|
48
|
+
offset: 0
|
|
49
|
+
});
|
|
50
|
+
_defineProperty(_this, "onMouseDown", function (e) {
|
|
51
|
+
_this.setState({
|
|
52
|
+
initialX: e.pageX
|
|
53
|
+
});
|
|
54
|
+
window.addEventListener('mouseup', _this.onMouseUp);
|
|
55
|
+
window.addEventListener('blur', _this.onMouseUp);
|
|
56
|
+
window.addEventListener('mousemove', _this.onMouseMove);
|
|
77
57
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
58
|
+
// don't let this action steal focus
|
|
59
|
+
e.preventDefault();
|
|
60
|
+
});
|
|
61
|
+
_defineProperty(_this, "onMouseUp", function () {
|
|
62
|
+
var offset = _this.state.offset;
|
|
63
|
+
var _this$props = _this.props,
|
|
64
|
+
columnId = _this$props.columnId,
|
|
65
|
+
columnWidth = _this$props.columnWidth,
|
|
66
|
+
setColumnWidth = _this$props.setColumnWidth;
|
|
67
|
+
setColumnWidth(columnId, Math.max(MINIMUM_COLUMN_WIDTH, columnWidth + offset));
|
|
68
|
+
_this.setState({
|
|
69
|
+
offset: 0
|
|
70
|
+
});
|
|
71
|
+
window.removeEventListener('mouseup', _this.onMouseUp);
|
|
72
|
+
window.removeEventListener('blur', _this.onMouseUp);
|
|
73
|
+
window.removeEventListener('mousemove', _this.onMouseMove);
|
|
74
|
+
});
|
|
75
|
+
_defineProperty(_this, "onMouseMove", function (e) {
|
|
76
|
+
var columnWidth = _this.props.columnWidth;
|
|
77
|
+
_this.setState(function (_ref) {
|
|
78
|
+
var initialX = _ref.initialX;
|
|
79
|
+
return {
|
|
80
|
+
offset: Math.max(e.pageX - initialX, -(columnWidth - MINIMUM_COLUMN_WIDTH))
|
|
81
|
+
};
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
return _this;
|
|
85
|
+
}
|
|
86
|
+
_inherits(EuiDataGridColumnResizer, _Component);
|
|
87
|
+
return _createClass(EuiDataGridColumnResizer, [{
|
|
88
|
+
key: "render",
|
|
89
|
+
value: function render() {
|
|
90
|
+
var _this2 = this;
|
|
91
|
+
var offset = this.state.offset;
|
|
92
|
+
var isLastColumn = this.props.isLastColumn;
|
|
93
|
+
return (0, _react2.jsx)(_services.RenderWithEuiStylesMemoizer, null, function (stylesMemoizer) {
|
|
94
|
+
var styles = stylesMemoizer(_column_resizer.euiDataGridColumnResizerStyles);
|
|
95
|
+
var cssStyles = [styles.euiDataGridColumnResizer, isLastColumn && styles.isLastColumn, offset && styles.isDragging];
|
|
96
|
+
return (0, _react2.jsx)("div", {
|
|
97
|
+
css: cssStyles,
|
|
98
|
+
className: "euiDataGridColumnResizer",
|
|
99
|
+
"data-test-subj": "dataGridColumnResizer",
|
|
100
|
+
style: offset ? (0, _global_styling.logicalStyle)('margin-right', "".concat(-offset, "px")) : undefined,
|
|
101
|
+
onMouseDown: _this2.onMouseDown
|
|
102
|
+
}, (0, _react2.jsx)(_draggable_columns.DragOverlay, {
|
|
103
|
+
isDragging: !!offset,
|
|
104
|
+
cursor: "ew-resize"
|
|
105
|
+
}));
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}]);
|
|
109
|
+
}(_react.Component);
|
|
98
110
|
EuiDataGridColumnResizer.propTypes = {
|
|
99
111
|
columnId: _propTypes.default.string.isRequired,
|
|
100
112
|
columnWidth: _propTypes.default.number.isRequired,
|
|
@@ -33,8 +33,7 @@ var EuiDataGridControlHeaderCell = exports.EuiDataGridControlHeaderCell = /*#__P
|
|
|
33
33
|
id: id,
|
|
34
34
|
index: index,
|
|
35
35
|
width: width,
|
|
36
|
-
isLastColumn: isLastColumn
|
|
37
|
-
isControlColumn: true
|
|
36
|
+
isLastColumn: isLastColumn
|
|
38
37
|
}), (0, _react2.jsx)(HeaderCellRender, null));
|
|
39
38
|
});
|
|
40
39
|
EuiDataGridControlHeaderCell.propTypes = {
|
|
@@ -103,7 +103,6 @@ var EuiDataGridHeaderCell = exports.EuiDataGridHeaderCell = /*#__PURE__*/(0, _re
|
|
|
103
103
|
id: id,
|
|
104
104
|
index: index,
|
|
105
105
|
isLastColumn: isLastColumn,
|
|
106
|
-
isLastCopyColumn: columns.length > 0 ? columns[columns.length - 1].id === id : isLastColumn,
|
|
107
106
|
width: width,
|
|
108
107
|
"aria-sort": ariaSort,
|
|
109
108
|
"aria-labelledby": cellContentId,
|
|
@@ -13,7 +13,7 @@ var _focus = require("../../utils/focus");
|
|
|
13
13
|
var _focus_utils = require("../cell/focus_utils");
|
|
14
14
|
var _data_grid_header_cell_wrapper = require("./data_grid_header_cell_wrapper.styles");
|
|
15
15
|
var _react2 = require("@emotion/react");
|
|
16
|
-
var _excluded = ["id", "index", "isLastColumn", "
|
|
16
|
+
var _excluded = ["id", "index", "isLastColumn", "width", "className", "children", "hasColumnActions", "isDragging", "onKeyDown", "aria-label", "aria-labelledby"];
|
|
17
17
|
/*
|
|
18
18
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
19
19
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -42,10 +42,6 @@ var EuiDataGridHeaderCellWrapper = exports.EuiDataGridHeaderCellWrapper = functi
|
|
|
42
42
|
var id = _ref.id,
|
|
43
43
|
index = _ref.index,
|
|
44
44
|
isLastColumn = _ref.isLastColumn,
|
|
45
|
-
_ref$isLastCopyColumn = _ref.isLastCopyColumn,
|
|
46
|
-
isLastCopyColumn = _ref$isLastCopyColumn === void 0 ? isLastColumn : _ref$isLastCopyColumn,
|
|
47
|
-
_ref$isControlColumn = _ref.isControlColumn,
|
|
48
|
-
isControlColumn = _ref$isControlColumn === void 0 ? false : _ref$isControlColumn,
|
|
49
45
|
width = _ref.width,
|
|
50
46
|
className = _ref.className,
|
|
51
47
|
children = _ref.children,
|
|
@@ -121,20 +117,18 @@ var EuiDataGridHeaderCellWrapper = exports.EuiDataGridHeaderCellWrapper = functi
|
|
|
121
117
|
} : {},
|
|
122
118
|
"aria-label": renderFocusTrap ? ariaLabel : undefined,
|
|
123
119
|
"aria-labelledby": renderFocusTrap ? ariaLabelledby : undefined
|
|
124
|
-
}, rest),
|
|
120
|
+
}, rest), (0, _react2.jsx)(_focus_utils.HandleInteractiveChildren, {
|
|
125
121
|
cellEl: isDragging ? null : headerEl,
|
|
126
122
|
renderFocusTrap: isDragging ? false : renderFocusTrap,
|
|
127
123
|
updateCellFocusContext: updateCellFocusContext,
|
|
128
124
|
onInteractiveChildrenFound: setInteractiveChildren
|
|
129
|
-
}, typeof children === 'function' ? children(renderFocusTrap) : children),
|
|
125
|
+
}, typeof children === 'function' ? children(renderFocusTrap) : children), isLastColumn ? _services.tabularCopyMarkers.hiddenNewline : _services.tabularCopyMarkers.hiddenTab);
|
|
130
126
|
};
|
|
131
127
|
EuiDataGridHeaderCellWrapper.propTypes = {
|
|
132
128
|
children: _propTypes.default.oneOfType([_propTypes.default.node.isRequired, _propTypes.default.func.isRequired]).isRequired,
|
|
133
129
|
id: _propTypes.default.string.isRequired,
|
|
134
130
|
index: _propTypes.default.number.isRequired,
|
|
135
131
|
isLastColumn: _propTypes.default.bool.isRequired,
|
|
136
|
-
isLastCopyColumn: _propTypes.default.bool,
|
|
137
|
-
isControlColumn: _propTypes.default.bool,
|
|
138
132
|
width: _propTypes.default.oneOfType([_propTypes.default.number.isRequired, _propTypes.default.oneOf([null])]),
|
|
139
133
|
className: _propTypes.default.string,
|
|
140
134
|
"aria-label": _propTypes.default.any,
|
|
@@ -26,6 +26,6 @@ var euiDataGridHeaderCellWrapperStyles = exports.euiDataGridHeaderCellWrapperSty
|
|
|
26
26
|
var _euiDataGridCellOutli2 = (0, _data_grid_cell.euiDataGridCellOutlineSelectors)(),
|
|
27
27
|
outlineSelectors = _euiDataGridCellOutli2.header;
|
|
28
28
|
return {
|
|
29
|
-
euiDataGridHeaderCell: /*#__PURE__*/(0, _react.css)("position:relative;display:flex;align-items:center;flex:0 0 auto;font-weight:", euiTheme.font.weight.bold, ";", outlineSelectors.focus, "{", focusStyles, ";}", outlineSelectors.focusTrapped, "{", hoverStyles, ";}", outlineSelectors.showActions, "{&,&>[data-focus-lock-disabled]{gap:", euiTheme.size.xxs, ";}}&>[data-focus-lock-disabled]{display:flex;align-items:center;", (0, _global_styling.logicalCSS)('width', '100%'), ";}
|
|
29
|
+
euiDataGridHeaderCell: /*#__PURE__*/(0, _react.css)("position:relative;display:flex;align-items:center;flex:0 0 auto;font-weight:", euiTheme.font.weight.bold, ";", outlineSelectors.focus, "{", focusStyles, ";}", outlineSelectors.focusTrapped, "{", hoverStyles, ";}", outlineSelectors.showActions, "{&,&>[data-focus-lock-disabled]{gap:", euiTheme.size.xxs, ";}}&>[data-focus-lock-disabled]{display:flex;align-items:center;", (0, _global_styling.logicalCSS)('width', '100%'), ";};label:euiDataGridHeaderCell;")
|
|
30
30
|
};
|
|
31
31
|
};
|
|
@@ -36,7 +36,6 @@ var useDataGridKeyboardShortcuts = exports.useDataGridKeyboardShortcuts = functi
|
|
|
36
36
|
setIsOpen = _useState2[1];
|
|
37
37
|
var title = (0, _i18n.useEuiI18n)('euiKeyboardShortcuts.title', 'Keyboard shortcuts');
|
|
38
38
|
var titleId = (0, _services.useGeneratedHtmlId)();
|
|
39
|
-
var copyModifier = typeof navigator !== 'undefined' && /Mac|iP(hone|od|ad)/.test(navigator.platform) ? 'Cmd' : 'Ctrl';
|
|
40
39
|
var styles = (0, _services.useEuiMemoizedStyles)(_keyboard_shortcuts.euiDataGridKeyboardShortcutsStyles);
|
|
41
40
|
var keyboardShortcuts = (0, _react.useMemo)(function () {
|
|
42
41
|
return (0, _react2.jsx)(_popover.EuiPopover, {
|
|
@@ -188,24 +187,9 @@ var useDataGridKeyboardShortcuts = exports.useDataGridKeyboardShortcuts = functi
|
|
|
188
187
|
token: "euiKeyboardShortcuts.escapeDescription",
|
|
189
188
|
default: "Close cell details and actions"
|
|
190
189
|
})
|
|
191
|
-
}, {
|
|
192
|
-
title: (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)("kbd", null, copyModifier === 'Cmd' ? (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
193
|
-
token: "euiKeyboardShortcuts.cmd",
|
|
194
|
-
default: "Cmd"
|
|
195
|
-
}) : (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
196
|
-
token: "euiKeyboardShortcuts.ctrl",
|
|
197
|
-
default: "Ctrl"
|
|
198
|
-
})), ' ', (0, _react2.jsx)("kbd", null, (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
199
|
-
token: "euiKeyboardShortcuts.copyTitle",
|
|
200
|
-
default: "C"
|
|
201
|
-
}))),
|
|
202
|
-
description: (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
203
|
-
token: "euiKeyboardShortcuts.copyDescription",
|
|
204
|
-
default: "Copy the focused cell value"
|
|
205
|
-
})
|
|
206
190
|
}]
|
|
207
191
|
})));
|
|
208
|
-
}, [isOpen, title, titleId, styles
|
|
192
|
+
}, [isOpen, title, titleId, styles]);
|
|
209
193
|
return {
|
|
210
194
|
keyboardShortcuts: keyboardShortcuts
|
|
211
195
|
};
|
|
@@ -22,7 +22,6 @@ var _in_memory = require("./utils/in_memory");
|
|
|
22
22
|
var _cell = require("./body/cell");
|
|
23
23
|
var _row_count = require("./utils/row_count");
|
|
24
24
|
var _data_grid_schema = require("./utils/data_grid_schema");
|
|
25
|
-
var _copy_focused_cell = require("./utils/copy_focused_cell");
|
|
26
25
|
var _ref = require("./utils/ref");
|
|
27
26
|
var _data_grid_types = require("./data_grid_types");
|
|
28
27
|
var _data_grid = require("./data_grid.styles");
|
|
@@ -267,7 +266,6 @@ var EuiDataGrid = exports.EuiDataGrid = /*#__PURE__*/(0, _react.memo)( /*#__PURE
|
|
|
267
266
|
var showToolbar = !!toolbarVisibility;
|
|
268
267
|
var _useDataGridKeyboardS = (0, _controls.useDataGridKeyboardShortcuts)(),
|
|
269
268
|
keyboardShortcuts = _useDataGridKeyboardS.keyboardShortcuts;
|
|
270
|
-
(0, _copy_focused_cell.useCopyFocusedDataGridCell)();
|
|
271
269
|
var _useDataGridFullScree = (0, _controls.useDataGridFullScreenSelector)(onFullScreenChange),
|
|
272
270
|
isFullScreen = _useDataGridFullScree.isFullScreen,
|
|
273
271
|
setIsFullScreen = _useDataGridFullScree.setIsFullScreen,
|