@carbon/ibm-products 1.7.0 → 1.10.0
Sign up to get free protection for your applications and to get access to all the features.
- package/css/index-full-carbon.css +227 -5762
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +5 -5
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +46 -3426
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +3 -3
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css +195 -4028
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +5 -5
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +195 -4029
- package/css/index.css.map +1 -1
- package/css/index.min.css +5 -5
- package/css/index.min.css.map +1 -1
- package/es/components/APIKeyModal/APIKeyModal.js +10 -13
- package/es/components/ActionBar/ActionBar.js +0 -3
- package/es/components/ActionBar/ActionBarItem.js +2 -6
- package/es/components/ActionSet/ActionSet.js +10 -12
- package/es/components/AddSelect/AddSelect.js +120 -25
- package/es/components/AddSelect/AddSelectBreadcrumbs.js +4 -4
- package/es/components/AddSelect/AddSelectColumn.js +58 -0
- package/es/components/AddSelect/AddSelectList.js +67 -8
- package/es/components/AddSelect/AddSelectSidebar.js +7 -1
- package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +0 -3
- package/es/components/ButtonMenu/ButtonMenu.js +7 -5
- package/es/components/ButtonMenu/ButtonMenuItem.js +1 -2
- package/es/components/Card/Card.js +31 -21
- package/es/components/Card/CardFooter.js +14 -10
- package/es/components/Card/CardHeader.js +8 -6
- package/es/components/Cascade/Cascade.js +5 -4
- package/es/components/ComboButton/ComboButton.js +0 -4
- package/es/components/ComboButton/ComboButtonItem/index.js +0 -5
- package/es/components/CreateFullPage/CreateFullPageStep.js +15 -8
- package/es/components/CreateModal/CreateModal.js +1 -4
- package/es/components/CreateTearsheet/CreateTearsheet.js +10 -11
- package/es/components/CreateTearsheet/CreateTearsheetStep.js +18 -14
- package/es/components/DataSpreadsheet/DataSpreadsheet.js +563 -80
- package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +366 -0
- package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +81 -0
- package/es/components/DataSpreadsheet/checkActiveHeaderCell.js +34 -0
- package/es/components/DataSpreadsheet/createActiveCellFn.js +47 -0
- package/es/components/DataSpreadsheet/createCellSelectionArea.js +45 -0
- package/es/components/DataSpreadsheet/getCellSize.js +30 -0
- package/es/components/EditSidePanel/EditSidePanel.js +9 -10
- package/es/components/EmptyStates/EmptyState.js +7 -6
- package/es/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +4 -8
- package/es/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +4 -8
- package/es/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +4 -8
- package/es/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +4 -8
- package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +4 -8
- package/es/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +4 -8
- package/es/components/ExampleComponent/ExampleComponent.js +12 -13
- package/es/components/ExportModal/ExportModal.js +13 -9
- package/es/components/ExpressiveCard/ExpressiveCard.js +0 -8
- package/es/components/ImportModal/ImportModal.js +7 -5
- package/es/components/InlineEdit/InlineEdit.js +44 -46
- package/es/components/LoadingBar/LoadingBar.js +13 -17
- package/es/components/ModifiedTabs/ModifiedTabLabelNew.js +0 -4
- package/es/components/ModifiedTabs/ModifiedTabLabelWithClose.js +0 -5
- package/es/components/ModifiedTabs/ModifiedTabs.js +24 -18
- package/es/components/NotificationsPanel/NotificationsPanel.js +109 -86
- package/es/components/OptionsTile/OptionsTile.js +17 -10
- package/es/components/PageHeader/PageHeader.js +58 -47
- package/es/components/PageHeader/PageHeaderUtils.js +3 -7
- package/es/components/ProductiveCard/ProductiveCard.js +23 -12
- package/es/components/RemoveModal/RemoveModal.js +0 -3
- package/es/components/SidePanel/SidePanel.js +22 -17
- package/es/components/TagSet/TagSet.js +25 -12
- package/es/components/TagSet/TagSetModal.js +16 -12
- package/es/components/TagSet/TagSetOverflow.js +21 -13
- package/es/components/Tearsheet/Tearsheet.js +27 -18
- package/es/components/Tearsheet/TearsheetNarrow.js +18 -15
- package/es/components/Toolbar/ToolbarButton.js +0 -3
- package/es/components/UserProfileImage/UserProfileImage.js +2 -1
- package/es/components/WebTerminal/WebTerminal.js +17 -18
- package/es/components/index.js +0 -1
- package/es/global/js/hooks/index.js +1 -0
- package/es/global/js/hooks/useActiveElement.js +27 -0
- package/es/global/js/utils/DisplayBox.js +31 -0
- package/es/global/js/utils/Wrap.js +7 -5
- package/es/global/js/utils/deepCloneObject.js +26 -0
- package/lib/components/APIKeyModal/APIKeyModal.js +10 -13
- package/lib/components/ActionBar/ActionBar.js +0 -3
- package/lib/components/ActionBar/ActionBarItem.js +2 -6
- package/lib/components/ActionSet/ActionSet.js +10 -12
- package/lib/components/AddSelect/AddSelect.js +118 -24
- package/lib/components/AddSelect/AddSelectBreadcrumbs.js +2 -3
- package/lib/components/AddSelect/AddSelectColumn.js +79 -0
- package/lib/components/AddSelect/AddSelectList.js +65 -8
- package/lib/components/AddSelect/AddSelectSidebar.js +7 -1
- package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +0 -3
- package/lib/components/ButtonMenu/ButtonMenu.js +7 -5
- package/lib/components/ButtonMenu/ButtonMenuItem.js +1 -2
- package/lib/components/Card/Card.js +31 -21
- package/lib/components/Card/CardFooter.js +14 -10
- package/lib/components/Card/CardHeader.js +8 -6
- package/lib/components/Cascade/Cascade.js +5 -4
- package/lib/components/ComboButton/ComboButton.js +0 -4
- package/lib/components/ComboButton/ComboButtonItem/index.js +0 -5
- package/lib/components/CreateFullPage/CreateFullPageStep.js +17 -14
- package/lib/components/CreateModal/CreateModal.js +1 -4
- package/lib/components/CreateTearsheet/CreateTearsheet.js +10 -11
- package/lib/components/CreateTearsheet/CreateTearsheetStep.js +20 -20
- package/lib/components/DataSpreadsheet/DataSpreadsheet.js +567 -77
- package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +391 -0
- package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +99 -0
- package/lib/components/DataSpreadsheet/checkActiveHeaderCell.js +45 -0
- package/lib/components/DataSpreadsheet/createActiveCellFn.js +58 -0
- package/lib/components/DataSpreadsheet/createCellSelectionArea.js +56 -0
- package/lib/components/DataSpreadsheet/getCellSize.js +39 -0
- package/lib/components/EditSidePanel/EditSidePanel.js +9 -10
- package/lib/components/EmptyStates/EmptyState.js +9 -8
- package/lib/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +3 -7
- package/lib/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +3 -7
- package/lib/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +3 -7
- package/lib/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +3 -7
- package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +3 -7
- package/lib/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +3 -7
- package/lib/components/ExampleComponent/ExampleComponent.js +12 -13
- package/lib/components/ExportModal/ExportModal.js +13 -9
- package/lib/components/ExpressiveCard/ExpressiveCard.js +0 -8
- package/lib/components/ImportModal/ImportModal.js +7 -5
- package/lib/components/InlineEdit/InlineEdit.js +43 -45
- package/lib/components/LoadingBar/LoadingBar.js +13 -17
- package/lib/components/ModifiedTabs/ModifiedTabLabelNew.js +0 -4
- package/lib/components/ModifiedTabs/ModifiedTabLabelWithClose.js +0 -5
- package/lib/components/ModifiedTabs/ModifiedTabs.js +24 -18
- package/lib/components/NotificationsPanel/NotificationsPanel.js +109 -86
- package/lib/components/OptionsTile/OptionsTile.js +17 -10
- package/lib/components/PageHeader/PageHeader.js +56 -46
- package/lib/components/PageHeader/PageHeaderUtils.js +3 -7
- package/lib/components/ProductiveCard/ProductiveCard.js +24 -18
- package/lib/components/RemoveModal/RemoveModal.js +0 -3
- package/lib/components/SidePanel/SidePanel.js +22 -17
- package/lib/components/TagSet/TagSet.js +26 -12
- package/lib/components/TagSet/TagSetModal.js +17 -13
- package/lib/components/TagSet/TagSetOverflow.js +24 -19
- package/lib/components/Tearsheet/Tearsheet.js +26 -17
- package/lib/components/Tearsheet/TearsheetNarrow.js +18 -15
- package/lib/components/Toolbar/ToolbarButton.js +0 -3
- package/lib/components/UserProfileImage/UserProfileImage.js +2 -1
- package/lib/components/WebTerminal/WebTerminal.js +17 -18
- package/lib/components/index.js +0 -8
- package/lib/global/js/hooks/index.js +8 -0
- package/lib/global/js/hooks/useActiveElement.js +39 -0
- package/lib/global/js/utils/DisplayBox.js +46 -0
- package/lib/global/js/utils/Wrap.js +7 -5
- package/lib/global/js/utils/deepCloneObject.js +37 -0
- package/package.json +18 -18
- package/scss/components/{CancelableTextEdit/_index.scss → ActionBar/_storybook-styles.scss} +2 -2
- package/scss/components/ActionSet/_storybook-styles.scss +1 -3
- package/scss/components/AddSelect/_add-select.scss +83 -14
- package/scss/components/{CancelableTextEdit → BreadcrumbWithOverflow}/_storybook-styles.scss +2 -2
- package/scss/components/ButtonSetWithOverflow/_storybook-styles.scss +8 -0
- package/scss/components/CreateInfluencer/_create-influencer.scss +2 -0
- package/scss/components/CreateModal/_create-modal.scss +1 -0
- package/scss/components/CreateTearsheet/_create-tearsheet.scss +1 -0
- package/scss/components/CreateTearsheetNarrow/_create-tearsheet-narrow.scss +1 -0
- package/scss/components/DataSpreadsheet/_data-spreadsheet.scss +53 -7
- package/scss/components/InlineEdit/_inline-edit.scss +36 -15
- package/scss/components/InlineEdit/_storybook-styles.scss +2 -0
- package/scss/components/LoadingBar/_loading-bar.scss +13 -0
- package/scss/components/NotificationsPanel/_notifications-panel.scss +3 -0
- package/scss/components/PageHeader/_page-header.scss +2 -0
- package/scss/components/SidePanel/_side-panel.scss +11 -4
- package/scss/components/StatusIcon/_status-icon.scss +1 -0
- package/scss/components/TagSet/_storybook-styles.scss +8 -0
- package/scss/components/Tearsheet/_tearsheet.scss +1 -2
- package/scss/components/UserProfileImage/_user-profile-image.scss +9 -0
- package/scss/components/WebTerminal/_web-terminal.scss +2 -0
- package/scss/components/_index.scss +0 -1
- package/scss/global/styles/_display-box.scss +62 -0
- package/es/components/CancelableTextEdit/CancelableTextEdit.js +0 -245
- package/es/components/CancelableTextEdit/index.js +0 -7
- package/lib/components/CancelableTextEdit/CancelableTextEdit.js +0 -265
- package/lib/components/CancelableTextEdit/index.js +0 -13
- package/scss/components/CancelableTextEdit/_cancelable-text-edit.scss +0 -212
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
4
|
|
5
|
-
var
|
5
|
+
var _typeof3 = require("@babel/runtime/helpers/typeof");
|
6
6
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
8
8
|
value: true
|
@@ -11,14 +11,20 @@ exports.DataSpreadsheet = void 0;
|
|
11
11
|
|
12
12
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
13
13
|
|
14
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
15
|
+
|
16
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
17
|
+
|
18
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
19
|
+
|
20
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
21
|
+
|
14
22
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
15
23
|
|
16
24
|
var _react = _interopRequireWildcard(require("react"));
|
17
25
|
|
18
26
|
var _reactTable = require("react-table");
|
19
27
|
|
20
|
-
var _reactWindow = require("react-window");
|
21
|
-
|
22
28
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
23
29
|
|
24
30
|
var _classnames = _interopRequireDefault(require("classnames"));
|
@@ -29,30 +35,95 @@ var _settings = require("../../settings");
|
|
29
35
|
|
30
36
|
var _getScrollbarWidth = require("../../global/js/utils/getScrollbarWidth");
|
31
37
|
|
32
|
-
var
|
38
|
+
var _DataSpreadsheetBody = require("./DataSpreadsheetBody");
|
39
|
+
|
40
|
+
var _getCellSize = require("./getCellSize");
|
41
|
+
|
42
|
+
var _DataSpreadsheetHeader = require("./DataSpreadsheetHeader");
|
43
|
+
|
44
|
+
var _hooks = require("../../global/js/hooks");
|
45
|
+
|
46
|
+
var _createActiveCellFn = require("./createActiveCellFn");
|
47
|
+
|
48
|
+
var _deepCloneObject = require("../../global/js/utils/deepCloneObject");
|
49
|
+
|
50
|
+
var _uuidv = _interopRequireDefault(require("../../global/js/utils/uuidv4"));
|
51
|
+
|
52
|
+
var _excluded = ["cellSize", "className", "columns", "data", "id", "onActiveCellChange"];
|
33
53
|
|
34
54
|
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); }
|
35
55
|
|
36
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null ||
|
56
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(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; }
|
37
57
|
|
58
|
+
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; }
|
59
|
+
|
60
|
+
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) { (0, _defineProperty2.default)(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; }
|
61
|
+
|
62
|
+
// cspell:words rowcount colcount
|
38
63
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
39
64
|
var blockClass = "".concat(_settings.pkg.prefix, "--data-spreadsheet");
|
40
|
-
var componentName = 'DataSpreadsheet';
|
65
|
+
var componentName = 'DataSpreadsheet'; // Default values for props
|
66
|
+
|
67
|
+
var defaults = {
|
68
|
+
cellSize: 'standard',
|
69
|
+
columns: Object.freeze([]),
|
70
|
+
data: Object.freeze([])
|
71
|
+
};
|
41
72
|
/**
|
42
73
|
* DataSpreadsheet: used to organize and display large amounts of structured data, separated by columns and rows in a grid-like format.
|
43
74
|
*/
|
44
75
|
|
45
76
|
var DataSpreadsheet = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
46
|
-
var
|
47
|
-
|
48
|
-
|
77
|
+
var _ref$cellSize = _ref.cellSize,
|
78
|
+
cellSize = _ref$cellSize === void 0 ? defaults.cellSize : _ref$cellSize,
|
79
|
+
className = _ref.className,
|
80
|
+
_ref$columns = _ref.columns,
|
81
|
+
columns = _ref$columns === void 0 ? defaults.columns : _ref$columns,
|
82
|
+
_ref$data = _ref.data,
|
83
|
+
data = _ref$data === void 0 ? defaults.data : _ref$data,
|
84
|
+
id = _ref.id,
|
85
|
+
onActiveCellChange = _ref.onActiveCellChange,
|
49
86
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
87
|
+
var focusedElement = (0, _hooks.useActiveElement)();
|
88
|
+
|
89
|
+
var _useState = (0, _react.useState)(false),
|
90
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
91
|
+
containerHasFocus = _useState2[0],
|
92
|
+
setContainerHasFocus = _useState2[1];
|
93
|
+
|
94
|
+
var _useState3 = (0, _react.useState)(null),
|
95
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
96
|
+
activeCellCoordinates = _useState4[0],
|
97
|
+
setActiveCellCoordinates = _useState4[1];
|
98
|
+
|
99
|
+
var _useState5 = (0, _react.useState)([]),
|
100
|
+
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
101
|
+
selectionAreas = _useState6[0],
|
102
|
+
setSelectionAreas = _useState6[1];
|
103
|
+
|
104
|
+
var _useState7 = (0, _react.useState)(false),
|
105
|
+
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
106
|
+
clickAndHoldActive = _useState8[0],
|
107
|
+
setClickAndHoldActive = _useState8[1];
|
108
|
+
|
109
|
+
var _useState9 = (0, _react.useState)(''),
|
110
|
+
_useState10 = (0, _slicedToArray2.default)(_useState9, 2),
|
111
|
+
currentMatcher = _useState10[0],
|
112
|
+
setCurrentMatcher = _useState10[1];
|
113
|
+
|
114
|
+
var previousState = (0, _hooks.usePreviousValue)({
|
115
|
+
activeCellCoordinates: activeCellCoordinates
|
116
|
+
});
|
117
|
+
var cellSizeValue = (0, _getCellSize.getCellSize)(cellSize);
|
118
|
+
var currentMatcherRef = (0, _react.useRef)();
|
119
|
+
var activeKeys = (0, _react.useRef)([]);
|
50
120
|
var defaultColumn = (0, _react.useMemo)(function () {
|
51
121
|
return {
|
52
122
|
width: 150,
|
53
|
-
rowHeaderWidth: 64
|
123
|
+
rowHeaderWidth: 64,
|
124
|
+
rowHeight: cellSizeValue
|
54
125
|
};
|
55
|
-
}, []);
|
126
|
+
}, [cellSizeValue]);
|
56
127
|
var scrollBarSize = (0, _react.useMemo)(function () {
|
57
128
|
return (0, _getScrollbarWidth.getScrollbarWidth)();
|
58
129
|
}, []);
|
@@ -67,66 +138,478 @@ var DataSpreadsheet = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref
|
|
67
138
|
headerGroups = _useTable.headerGroups,
|
68
139
|
rows = _useTable.rows,
|
69
140
|
totalColumnsWidth = _useTable.totalColumnsWidth,
|
70
|
-
prepareRow = _useTable.prepareRow;
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
}
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
141
|
+
prepareRow = _useTable.prepareRow; // Reset everything when spreadsheet loses focus
|
142
|
+
|
143
|
+
|
144
|
+
(0, _react.useEffect)(function () {
|
145
|
+
if (!focusedElement.classList.contains("".concat(blockClass, "--interactive-cell-element"))) {
|
146
|
+
setContainerHasFocus(false);
|
147
|
+
removeActiveCell();
|
148
|
+
activeKeys.current = [];
|
149
|
+
}
|
150
|
+
|
151
|
+
if (focusedElement.classList.contains(blockClass) || focusedElement.classList.contains("".concat(blockClass, "--interactive-cell-element"))) {
|
152
|
+
setContainerHasFocus(true);
|
153
|
+
}
|
154
|
+
}, [focusedElement, removeActiveCell]); // Removes the active cell element
|
155
|
+
|
156
|
+
var removeActiveCell = (0, _react.useCallback)(function () {
|
157
|
+
var activeCellHighlight = spreadsheetRef.current.querySelector(".".concat(blockClass, "__active-cell--highlight"));
|
158
|
+
|
159
|
+
if (activeCellHighlight) {
|
160
|
+
activeCellHighlight.remove();
|
161
|
+
}
|
162
|
+
}, [spreadsheetRef]); // Removes the cell selection elements
|
163
|
+
|
164
|
+
var removeCellSelections = (0, _react.useCallback)(function (matcher) {
|
165
|
+
if (matcher && typeof matcher === 'string') {
|
166
|
+
var selectionToRemove = spreadsheetRef.current.querySelector("[data-matcher-id=\"".concat(matcher, "\"]"));
|
167
|
+
|
168
|
+
if (selectionToRemove) {
|
169
|
+
selectionToRemove.remove();
|
90
170
|
}
|
91
|
-
}
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
}));
|
99
|
-
}, [prepareRow, rows, defaultColumn.rowHeaderWidth]);
|
171
|
+
} else {
|
172
|
+
var cellSelections = spreadsheetRef.current.querySelectorAll(".".concat(blockClass, "__selection-area--element"));
|
173
|
+
(0, _toConsumableArray2.default)(cellSelections).forEach(function (element) {
|
174
|
+
return element.remove();
|
175
|
+
});
|
176
|
+
}
|
177
|
+
}, [spreadsheetRef]); // Click outside useEffect
|
100
178
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
179
|
+
(0, _react.useEffect)(function () {
|
180
|
+
var handleOutsideClick = function handleOutsideClick(event) {
|
181
|
+
if (!spreadsheetRef.current || spreadsheetRef.current.contains(event.target) || event.target.classList.contains("".concat(blockClass, "__active-cell--highlight"))) {
|
182
|
+
return;
|
183
|
+
}
|
184
|
+
|
185
|
+
setActiveCellCoordinates(null);
|
186
|
+
setSelectionAreas([]);
|
187
|
+
removeActiveCell();
|
188
|
+
removeCellSelections();
|
189
|
+
setContainerHasFocus(false);
|
190
|
+
activeKeys.current = [];
|
191
|
+
};
|
192
|
+
|
193
|
+
document.addEventListener('click', handleOutsideClick);
|
194
|
+
return function () {
|
195
|
+
document.removeEventListener('click', handleOutsideClick);
|
196
|
+
};
|
197
|
+
}, [spreadsheetRef, removeActiveCell, removeCellSelections]);
|
198
|
+
var createActiveCell = (0, _react.useCallback)(function (_ref2) {
|
199
|
+
var placementElement = _ref2.placementElement,
|
200
|
+
coords = _ref2.coords,
|
201
|
+
_ref2$addToHeader = _ref2.addToHeader,
|
202
|
+
addToHeader = _ref2$addToHeader === void 0 ? false : _ref2$addToHeader;
|
203
|
+
var activeCellFullData = typeof (coords === null || coords === void 0 ? void 0 : coords.column) === 'number' && typeof (coords === null || coords === void 0 ? void 0 : coords.row) === 'number' ? rows[coords === null || coords === void 0 ? void 0 : coords.row].cells[coords === null || coords === void 0 ? void 0 : coords.column] : null;
|
204
|
+
var activeCellValue = activeCellFullData ? Object.values(activeCellFullData.row.values)[coords === null || coords === void 0 ? void 0 : coords.column] : null;
|
205
|
+
|
206
|
+
var handleActiveCellMouseEnter = function handleActiveCellMouseEnter() {
|
207
|
+
handleActiveCellMouseEnterCallback(selectionAreas, clickAndHoldActive);
|
208
|
+
};
|
209
|
+
|
210
|
+
var prevCoords = previousState === null || previousState === void 0 ? void 0 : previousState.activeCellCoordinates; // Only create an active cell if the activeCellCoordinates have changed
|
211
|
+
|
212
|
+
if ((prevCoords === null || prevCoords === void 0 ? void 0 : prevCoords.row) !== (coords === null || coords === void 0 ? void 0 : coords.row) || (prevCoords === null || prevCoords === void 0 ? void 0 : prevCoords.column) !== (coords === null || coords === void 0 ? void 0 : coords.column)) {
|
213
|
+
(0, _createActiveCellFn.createActiveCellFn)({
|
214
|
+
placementElement: placementElement,
|
215
|
+
coords: coords,
|
216
|
+
addToHeader: addToHeader,
|
217
|
+
contextRef: spreadsheetRef,
|
218
|
+
blockClass: blockClass,
|
219
|
+
onActiveCellChange: onActiveCellChange,
|
220
|
+
activeCellValue: activeCellValue,
|
221
|
+
handleActiveCellMouseEnter: handleActiveCellMouseEnter
|
222
|
+
});
|
223
|
+
}
|
224
|
+
}, [spreadsheetRef, rows, onActiveCellChange, clickAndHoldActive, handleActiveCellMouseEnterCallback, selectionAreas, previousState === null || previousState === void 0 ? void 0 : previousState.activeCellCoordinates]);
|
225
|
+
var handleInitialArrowPress = (0, _react.useCallback)(function () {
|
226
|
+
// If activeCellCoordinates is null then we need to set an initial value
|
227
|
+
// which will place the activeCell on the select all cell/button
|
228
|
+
if (!activeCellCoordinates) {
|
229
|
+
setActiveCellCoordinates({
|
230
|
+
column: 'header',
|
231
|
+
row: 'header'
|
232
|
+
});
|
233
|
+
}
|
234
|
+
|
235
|
+
return;
|
236
|
+
}, [activeCellCoordinates]);
|
237
|
+
var updateActiveCellCoordinates = (0, _react.useCallback)(function (_ref3) {
|
238
|
+
var coords = _ref3.coords,
|
239
|
+
updatedValue = _ref3.updatedValue;
|
240
|
+
|
241
|
+
var newActiveCell = _objectSpread(_objectSpread({}, coords), updatedValue);
|
242
|
+
|
243
|
+
setActiveCellCoordinates(newActiveCell); // Only run if the active cell is _not_ a header cell. This will add a point1 object
|
244
|
+
// to selectionAreas every time the active cell changes, allowing us to create cell
|
245
|
+
// selections using keyboard
|
246
|
+
|
247
|
+
if (newActiveCell.row !== 'header' && newActiveCell.column !== 'header') {
|
248
|
+
var tempMatcher = (0, _uuidv.default)();
|
249
|
+
setSelectionAreas([{
|
250
|
+
point1: newActiveCell,
|
251
|
+
matcher: tempMatcher
|
252
|
+
}]);
|
253
|
+
setCurrentMatcher(tempMatcher);
|
254
|
+
}
|
255
|
+
}, []);
|
256
|
+
var handleMultipleKeys = (0, _react.useCallback)(function () {
|
257
|
+
var _selectionAreasClone$;
|
258
|
+
|
259
|
+
var activeKeyValues = activeKeys.current;
|
260
|
+
var selectionAreasClone = (0, _deepCloneObject.deepCloneObject)(selectionAreas);
|
261
|
+
var indexOfCurrentArea = selectionAreasClone.findIndex(function (item) {
|
262
|
+
return item.matcher === currentMatcher;
|
263
|
+
});
|
264
|
+
var pointToUpdate = (_selectionAreasClone$ = selectionAreasClone[indexOfCurrentArea]) !== null && _selectionAreasClone$ !== void 0 && _selectionAreasClone$.point2 ? selectionAreasClone[indexOfCurrentArea].point2 : selectionAreasClone[indexOfCurrentArea].point1; // Down + Shift
|
265
|
+
|
266
|
+
if (activeKeyValues.includes('Shift') && activeKeyValues.includes('ArrowDown')) {
|
267
|
+
if (rows.length - 1 === pointToUpdate.row) {
|
268
|
+
return;
|
269
|
+
}
|
270
|
+
|
271
|
+
var newPoint = {
|
272
|
+
row: pointToUpdate.row + 1,
|
273
|
+
column: pointToUpdate.column
|
274
|
+
};
|
275
|
+
selectionAreasClone[indexOfCurrentArea].point2 = newPoint;
|
276
|
+
selectionAreasClone[indexOfCurrentArea].areaCreated = false;
|
277
|
+
setSelectionAreas(selectionAreasClone);
|
278
|
+
} // Right + Shift
|
279
|
+
|
280
|
+
|
281
|
+
if (activeKeyValues.includes('Shift') && activeKeyValues.includes('ArrowRight')) {
|
282
|
+
if (columns.length - 1 === pointToUpdate.column) {
|
283
|
+
return;
|
284
|
+
}
|
285
|
+
|
286
|
+
var _newPoint = {
|
287
|
+
row: pointToUpdate.row,
|
288
|
+
column: pointToUpdate.column + 1
|
289
|
+
};
|
290
|
+
selectionAreasClone[indexOfCurrentArea].point2 = _newPoint;
|
291
|
+
selectionAreasClone[indexOfCurrentArea].areaCreated = false;
|
292
|
+
setSelectionAreas(selectionAreasClone);
|
293
|
+
} // Up + Shift
|
294
|
+
|
295
|
+
|
296
|
+
if (activeKeyValues.includes('Shift') && activeKeyValues.includes('ArrowUp')) {
|
297
|
+
if (pointToUpdate.row === 0) {
|
298
|
+
return;
|
299
|
+
}
|
300
|
+
|
301
|
+
var _newPoint2 = {
|
302
|
+
row: pointToUpdate.row - 1,
|
303
|
+
column: pointToUpdate.column
|
304
|
+
};
|
305
|
+
selectionAreasClone[indexOfCurrentArea].point2 = _newPoint2;
|
306
|
+
selectionAreasClone[indexOfCurrentArea].areaCreated = false;
|
307
|
+
setSelectionAreas(selectionAreasClone);
|
308
|
+
} // Left + Shift
|
309
|
+
|
310
|
+
|
311
|
+
if (activeKeyValues.includes('Shift') && activeKeyValues.includes('ArrowLeft')) {
|
312
|
+
if (pointToUpdate.column === 0) {
|
313
|
+
return;
|
314
|
+
}
|
315
|
+
|
316
|
+
var _newPoint3 = {
|
317
|
+
row: pointToUpdate.row,
|
318
|
+
column: pointToUpdate.column - 1
|
319
|
+
};
|
320
|
+
selectionAreasClone[indexOfCurrentArea].point2 = _newPoint3;
|
321
|
+
selectionAreasClone[indexOfCurrentArea].areaCreated = false;
|
322
|
+
setSelectionAreas(selectionAreasClone);
|
323
|
+
}
|
324
|
+
}, [selectionAreas, currentMatcher, columns, rows]);
|
325
|
+
var handleKeyPress = (0, _react.useCallback)(function (event) {
|
326
|
+
var _activeKeys$current, _activeKeys$current2;
|
327
|
+
|
328
|
+
var key = event.key; // Command keys need to be returned as there is default browser behavior with these keys
|
329
|
+
|
330
|
+
if (key === 'Meta' || key === 'Control') {
|
331
|
+
return;
|
332
|
+
} // Prevent arrow keys, home key, and end key from scrolling the page when the data spreadsheet container has focus
|
333
|
+
|
334
|
+
|
335
|
+
if (['End', 'Home', 'ArrowLeft', 'ArrowUp', 'ArrowRight', 'ArrowDown'].indexOf(key) > -1) {
|
336
|
+
event.preventDefault();
|
337
|
+
} // Clear out all cell selection areas if user uses any arrow key, except if the shift key is being held
|
338
|
+
|
339
|
+
|
340
|
+
if (['ArrowLeft', 'ArrowUp', 'ArrowRight', 'ArrowDown'].indexOf(key) > -1) {
|
341
|
+
if (selectionAreas !== null && selectionAreas !== void 0 && selectionAreas.length && key !== 'Shift' && !activeKeys.current.includes('Shift')) {
|
342
|
+
setSelectionAreas([]);
|
343
|
+
removeCellSelections();
|
344
|
+
}
|
345
|
+
} // Update list of activeKeys
|
346
|
+
|
347
|
+
|
348
|
+
if (!((_activeKeys$current = activeKeys.current) !== null && _activeKeys$current !== void 0 && _activeKeys$current.includes(key))) {
|
349
|
+
var activeClone = (0, _toConsumableArray2.default)(activeKeys.current);
|
350
|
+
activeKeys.current = [].concat((0, _toConsumableArray2.default)(activeClone), [key]);
|
351
|
+
}
|
352
|
+
|
353
|
+
if (((_activeKeys$current2 = activeKeys.current) === null || _activeKeys$current2 === void 0 ? void 0 : _activeKeys$current2.length) > 1) {
|
354
|
+
handleMultipleKeys();
|
355
|
+
} // Allow arrow key navigation if there are less than two activeKeys OR
|
356
|
+
// if one of the activeCellCoordinates is in a header position
|
357
|
+
|
358
|
+
|
359
|
+
if (!activeKeys.current.includes('Shift') || activeCellCoordinates.row === 'header' || activeCellCoordinates.column === 'header') {
|
360
|
+
switch (key) {
|
361
|
+
// Tab
|
362
|
+
case 'Tab':
|
363
|
+
{
|
364
|
+
setSelectionAreas([]);
|
365
|
+
removeActiveCell();
|
366
|
+
setContainerHasFocus(false);
|
367
|
+
setActiveCellCoordinates(null);
|
368
|
+
break;
|
369
|
+
}
|
370
|
+
// Left
|
371
|
+
|
372
|
+
case 'ArrowLeft':
|
373
|
+
{
|
374
|
+
handleInitialArrowPress();
|
375
|
+
|
376
|
+
var coordinatesClone = _objectSpread({}, activeCellCoordinates);
|
377
|
+
|
378
|
+
if (coordinatesClone.column === 'header') {
|
379
|
+
return;
|
380
|
+
}
|
381
|
+
|
382
|
+
if (typeof coordinatesClone.column === 'number') {
|
383
|
+
if (coordinatesClone.column === 0) {
|
384
|
+
updateActiveCellCoordinates({
|
385
|
+
coords: coordinatesClone,
|
386
|
+
updatedValue: {
|
387
|
+
column: 'header'
|
388
|
+
}
|
389
|
+
});
|
390
|
+
return;
|
391
|
+
}
|
392
|
+
|
393
|
+
updateActiveCellCoordinates({
|
394
|
+
coords: coordinatesClone,
|
395
|
+
updatedValue: {
|
396
|
+
column: coordinatesClone.column - 1
|
397
|
+
}
|
398
|
+
});
|
399
|
+
}
|
400
|
+
|
401
|
+
break;
|
402
|
+
}
|
403
|
+
// Up
|
404
|
+
|
405
|
+
case 'ArrowUp':
|
406
|
+
{
|
407
|
+
handleInitialArrowPress();
|
408
|
+
|
409
|
+
var _coordinatesClone = _objectSpread({}, activeCellCoordinates);
|
410
|
+
|
411
|
+
if (_coordinatesClone.row === 'header') {
|
412
|
+
return;
|
413
|
+
}
|
414
|
+
|
415
|
+
if (typeof _coordinatesClone.row === 'number') {
|
416
|
+
// set row back to header if we are at index 0
|
417
|
+
if (_coordinatesClone.row === 0) {
|
418
|
+
updateActiveCellCoordinates({
|
419
|
+
coords: _coordinatesClone,
|
420
|
+
updatedValue: {
|
421
|
+
row: 'header'
|
422
|
+
}
|
423
|
+
});
|
424
|
+
return;
|
425
|
+
} // if we are at any other index than 0, subtract 1 from current row index
|
426
|
+
|
427
|
+
|
428
|
+
updateActiveCellCoordinates({
|
429
|
+
coords: _coordinatesClone,
|
430
|
+
updatedValue: {
|
431
|
+
row: _coordinatesClone.row - 1
|
432
|
+
}
|
433
|
+
});
|
434
|
+
}
|
435
|
+
|
436
|
+
break;
|
437
|
+
}
|
438
|
+
// Right
|
439
|
+
|
440
|
+
case 'ArrowRight':
|
441
|
+
{
|
442
|
+
handleInitialArrowPress();
|
443
|
+
|
444
|
+
var _coordinatesClone2 = _objectSpread({}, activeCellCoordinates);
|
445
|
+
|
446
|
+
if (_coordinatesClone2.column === 'header') {
|
447
|
+
updateActiveCellCoordinates({
|
448
|
+
coords: _coordinatesClone2,
|
449
|
+
updatedValue: {
|
450
|
+
column: 0
|
451
|
+
}
|
452
|
+
});
|
453
|
+
}
|
454
|
+
|
455
|
+
if (typeof _coordinatesClone2.column === 'number') {
|
456
|
+
// Prevent active cell coordinates from updating if the active
|
457
|
+
// cell is in the last column, ie we can't go any further to the right
|
458
|
+
if (columns.length - 1 === _coordinatesClone2.column) {
|
459
|
+
return;
|
460
|
+
}
|
461
|
+
|
462
|
+
updateActiveCellCoordinates({
|
463
|
+
coords: _coordinatesClone2,
|
464
|
+
updatedValue: {
|
465
|
+
column: _coordinatesClone2.column + 1
|
466
|
+
}
|
467
|
+
});
|
468
|
+
}
|
469
|
+
|
470
|
+
break;
|
471
|
+
}
|
472
|
+
// Down
|
473
|
+
|
474
|
+
case 'ArrowDown':
|
475
|
+
{
|
476
|
+
handleInitialArrowPress();
|
477
|
+
|
478
|
+
var _coordinatesClone3 = _objectSpread({}, activeCellCoordinates);
|
479
|
+
|
480
|
+
if (_coordinatesClone3.row === 'header') {
|
481
|
+
updateActiveCellCoordinates({
|
482
|
+
coords: _coordinatesClone3,
|
483
|
+
updatedValue: {
|
484
|
+
row: 0
|
485
|
+
}
|
486
|
+
});
|
487
|
+
}
|
488
|
+
|
489
|
+
if (typeof _coordinatesClone3.row === 'number') {
|
490
|
+
// Prevent active cell coordinates from updating if the active
|
491
|
+
// cell is in the last row, ie we can't go any further down since
|
492
|
+
// we are in the last row
|
493
|
+
if (rows.length - 1 === _coordinatesClone3.row) {
|
494
|
+
return;
|
495
|
+
}
|
496
|
+
|
497
|
+
updateActiveCellCoordinates({
|
498
|
+
coords: _coordinatesClone3,
|
499
|
+
updatedValue: {
|
500
|
+
row: _coordinatesClone3.row + 1
|
501
|
+
}
|
502
|
+
});
|
503
|
+
}
|
504
|
+
|
505
|
+
break;
|
506
|
+
}
|
115
507
|
}
|
116
|
-
}
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
508
|
+
}
|
509
|
+
}, [updateActiveCellCoordinates, handleInitialArrowPress, handleMultipleKeys, activeCellCoordinates, selectionAreas === null || selectionAreas === void 0 ? void 0 : selectionAreas.length, removeCellSelections, removeActiveCell, columns.length, rows.length]); // Only update if there are cell selection areas
|
510
|
+
// Find point object that matches currentMatcher and remove the second point
|
511
|
+
// because hovering over the active cell while clicking and holding should
|
512
|
+
// remove the previously existing selection area
|
513
|
+
|
514
|
+
var handleActiveCellMouseEnterCallback = (0, _react.useCallback)(function (areas, clickHold) {
|
515
|
+
var freshMatcherValue = currentMatcherRef.current;
|
516
|
+
|
517
|
+
if (!freshMatcherValue) {
|
518
|
+
return;
|
519
|
+
}
|
520
|
+
|
521
|
+
if (areas && areas.length && clickHold && freshMatcherValue) {
|
522
|
+
setSelectionAreas(function (prev) {
|
523
|
+
var selectionAreaClone = (0, _deepCloneObject.deepCloneObject)(prev);
|
524
|
+
var indexOfItemToUpdate = selectionAreaClone.findIndex(function (item) {
|
525
|
+
return item.matcher === freshMatcherValue;
|
526
|
+
});
|
527
|
+
|
528
|
+
if (indexOfItemToUpdate === -1) {
|
529
|
+
return prev;
|
530
|
+
}
|
531
|
+
|
532
|
+
if ((0, _typeof2.default)(selectionAreaClone[indexOfItemToUpdate].point2) === 'object' && selectionAreaClone[indexOfItemToUpdate].areaCreated) {
|
533
|
+
selectionAreaClone[indexOfItemToUpdate].point2 = null;
|
534
|
+
selectionAreaClone[indexOfItemToUpdate].areaCreated = false;
|
535
|
+
removeCellSelections(freshMatcherValue);
|
536
|
+
return selectionAreaClone;
|
537
|
+
}
|
538
|
+
|
539
|
+
return prev;
|
540
|
+
});
|
541
|
+
}
|
542
|
+
}, [removeCellSelections]); // Adds active cell highlight to correct cell onKeyDown
|
543
|
+
|
544
|
+
(0, _react.useEffect)(function () {
|
545
|
+
var activeCellPlacementElement = spreadsheetRef === null || spreadsheetRef === void 0 ? void 0 : spreadsheetRef.current.querySelector("[data-row-index=\"".concat(activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row, "\"][data-column-index=\"").concat(activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column, "\"]"));
|
546
|
+
var shouldPlaceActiveCellInHeader = (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'header' && true;
|
547
|
+
var selectAllElement = spreadsheetRef === null || spreadsheetRef === void 0 ? void 0 : spreadsheetRef.current.querySelector("[data-row-index=\"header\"][data-column-index=\"header\"]");
|
548
|
+
|
549
|
+
if (containerHasFocus) {
|
550
|
+
createActiveCell({
|
551
|
+
placementElement: activeCellCoordinates ? activeCellPlacementElement : selectAllElement,
|
552
|
+
coords: activeCellCoordinates,
|
553
|
+
addToHeader: shouldPlaceActiveCellInHeader
|
554
|
+
});
|
555
|
+
}
|
556
|
+
}, [activeCellCoordinates, spreadsheetRef, createActiveCell, containerHasFocus]);
|
557
|
+
|
558
|
+
var handleKeyUp = function handleKeyUp(event) {
|
559
|
+
var _activeKeys$current3;
|
560
|
+
|
561
|
+
var key = event.key; // Remove key from active keys array on key up
|
562
|
+
|
563
|
+
if ((_activeKeys$current3 = activeKeys.current) !== null && _activeKeys$current3 !== void 0 && _activeKeys$current3.includes(key)) {
|
564
|
+
var activeKeysClone = (0, _toConsumableArray2.default)(activeKeys.current);
|
565
|
+
var filteredKeysClone = activeKeysClone.filter(function (item) {
|
566
|
+
return item !== key;
|
567
|
+
});
|
568
|
+
activeKeys.current = filteredKeysClone;
|
569
|
+
}
|
570
|
+
};
|
571
|
+
|
572
|
+
var localRef = (0, _react.useRef)();
|
573
|
+
var spreadsheetRef = ref || localRef;
|
574
|
+
return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, rest, getTableProps(), (0, _devtools.getDevtoolsProps)(componentName), {
|
575
|
+
className: (0, _classnames.default)(blockClass, className, (0, _defineProperty2.default)({}, "".concat(blockClass, "__container-has-focus"), containerHasFocus)),
|
576
|
+
ref: spreadsheetRef,
|
577
|
+
role: "grid",
|
578
|
+
tabIndex: 0,
|
579
|
+
"aria-rowcount": (rows === null || rows === void 0 ? void 0 : rows.length) || 0,
|
580
|
+
"aria-colcount": (columns === null || columns === void 0 ? void 0 : columns.length) || 0,
|
581
|
+
onKeyDown: handleKeyPress,
|
582
|
+
onKeyUp: handleKeyUp,
|
583
|
+
onFocus: function onFocus() {
|
584
|
+
return setContainerHasFocus(true);
|
585
|
+
}
|
586
|
+
}), /*#__PURE__*/_react.default.createElement(_DataSpreadsheetHeader.DataSpreadsheetHeader, {
|
587
|
+
activeCellCoordinates: activeCellCoordinates,
|
588
|
+
cellSizeValue: cellSizeValue,
|
589
|
+
defaultColumn: defaultColumn,
|
590
|
+
headerGroups: headerGroups,
|
591
|
+
selectionAreas: selectionAreas
|
592
|
+
}), /*#__PURE__*/_react.default.createElement(_DataSpreadsheetBody.DataSpreadsheetBody, {
|
593
|
+
activeCellCoordinates: activeCellCoordinates,
|
594
|
+
ref: currentMatcherRef,
|
595
|
+
clickAndHoldActive: clickAndHoldActive,
|
596
|
+
setClickAndHoldActive: setClickAndHoldActive,
|
597
|
+
currentMatcher: currentMatcher,
|
598
|
+
setCurrentMatcher: setCurrentMatcher,
|
599
|
+
setContainerHasFocus: setContainerHasFocus,
|
600
|
+
selectionAreas: selectionAreas,
|
601
|
+
setSelectionAreas: setSelectionAreas,
|
602
|
+
cellSize: cellSize,
|
603
|
+
defaultColumn: defaultColumn,
|
604
|
+
getTableBodyProps: getTableBodyProps,
|
605
|
+
onActiveCellChange: onActiveCellChange,
|
606
|
+
prepareRow: prepareRow,
|
607
|
+
rows: rows,
|
608
|
+
setActiveCellCoordinates: setActiveCellCoordinates,
|
609
|
+
scrollBarSize: scrollBarSize,
|
610
|
+
totalColumnsWidth: totalColumnsWidth,
|
611
|
+
id: id
|
612
|
+
}));
|
130
613
|
}); // Return a placeholder if not released and not enabled by feature flag
|
131
614
|
|
132
615
|
|
@@ -139,6 +622,11 @@ DataSpreadsheet.displayName = componentName; // The types and DocGen commentary
|
|
139
622
|
// See https://www.npmjs.com/package/prop-types#usage.
|
140
623
|
|
141
624
|
DataSpreadsheet.propTypes = {
|
625
|
+
/**
|
626
|
+
* Specifies the cell height
|
627
|
+
*/
|
628
|
+
cellSize: _propTypes.default.oneOf(['compact', 'standard', 'medium', 'large']),
|
629
|
+
|
142
630
|
/**
|
143
631
|
* Provide an optional class to be applied to the containing node.
|
144
632
|
*/
|
@@ -157,15 +645,17 @@ DataSpreadsheet.propTypes = {
|
|
157
645
|
/**
|
158
646
|
* The spreadsheet data that will be rendered in the body of the spreadsheet component
|
159
647
|
*/
|
160
|
-
data: _propTypes.default.arrayOf(_propTypes.default.shape)
|
161
|
-
|
648
|
+
data: _propTypes.default.arrayOf(_propTypes.default.shape),
|
649
|
+
|
650
|
+
/**
|
651
|
+
* The spreadsheet id
|
652
|
+
*/
|
653
|
+
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
162
654
|
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
655
|
+
/**
|
656
|
+
* The event handler that is called when the active cell changes
|
657
|
+
*/
|
658
|
+
onActiveCellChange: _propTypes.default.func
|
659
|
+
/* TODO: add types and DocGen for all props. */
|
167
660
|
|
168
|
-
DataSpreadsheet.defaultProps = {
|
169
|
-
data: [],
|
170
|
-
columns: []
|
171
661
|
};
|