@carbon/ibm-products 1.5.0 → 1.8.0
Sign up to get free protection for your applications and to get access to all the features.
- package/css/index-full-carbon.css +389 -139
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +9 -3
- package/css/index-full-carbon.min.css.map +1 -0
- package/css/index-without-carbon-released-only.css +33 -27
- 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 -0
- package/css/index-without-carbon.css +330 -133
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +9 -3
- package/css/index-without-carbon.min.css.map +1 -0
- package/css/index.css +332 -135
- package/css/index.css.map +1 -1
- package/css/index.min.css +9 -3
- package/css/index.min.css.map +1 -0
- 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 +11 -13
- package/es/components/AddSelect/AddSelect.js +122 -72
- package/es/components/AddSelect/AddSelectBreadcrumbs.js +56 -0
- package/es/components/AddSelect/AddSelectList.js +94 -0
- package/es/components/AddSelect/AddSelectSidebar.js +110 -0
- package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +5 -5
- package/es/components/ButtonMenu/ButtonMenu.js +6 -4
- package/es/components/ButtonMenu/ButtonMenuItem.js +1 -2
- package/es/components/Card/Card.js +37 -25
- 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 +414 -0
- package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +138 -0
- package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +64 -0
- package/es/components/DataSpreadsheet/createActiveCellFn.js +45 -0
- package/es/components/DataSpreadsheet/generateData.js +47 -0
- package/es/components/DataSpreadsheet/getCellSize.js +30 -0
- package/es/components/{CancelableTextEdit → DataSpreadsheet}/index.js +2 -2
- package/es/components/EditSidePanel/EditSidePanel.js +9 -10
- package/es/components/EmptyStates/EmptyState.js +8 -7
- package/es/components/EmptyStates/EmptyStateContent.js +2 -2
- package/es/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +5 -9
- package/es/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +5 -9
- package/es/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +5 -9
- package/es/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +5 -9
- package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +5 -9
- package/es/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +5 -9
- 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 +256 -88
- 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 +125 -89
- package/es/components/OptionsTile/OptionsTile.js +6 -9
- package/es/components/PageHeader/PageHeader.js +19 -13
- package/es/components/PageHeader/PageHeaderTitle.js +10 -6
- package/es/components/ProductiveCard/ProductiveCard.js +23 -12
- package/es/components/RemoveModal/RemoveModal.js +0 -3
- package/es/components/SidePanel/SidePanel.js +54 -32
- package/es/components/TagSet/TagSet.js +13 -9
- 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/Tearsheet/TearsheetShell.js +3 -4
- package/es/components/Toolbar/ToolbarButton.js +0 -3
- package/es/components/WebTerminal/WebTerminal.js +18 -19
- package/es/components/index.js +2 -2
- package/es/global/js/hooks/index.js +1 -0
- package/es/global/js/hooks/useActiveElement.js +27 -0
- package/es/global/js/package-settings.js +2 -1
- package/es/global/js/utils/Wrap.js +7 -5
- package/es/global/js/utils/getScrollbarWidth.js +14 -0
- package/es/settings.js +0 -5
- 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 +11 -13
- package/lib/components/AddSelect/AddSelect.js +126 -72
- package/lib/components/AddSelect/AddSelectBreadcrumbs.js +71 -0
- package/lib/components/AddSelect/AddSelectList.js +112 -0
- package/lib/components/AddSelect/AddSelectSidebar.js +122 -0
- package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +5 -5
- package/lib/components/ButtonMenu/ButtonMenu.js +6 -4
- package/lib/components/ButtonMenu/ButtonMenuItem.js +1 -2
- package/lib/components/Card/Card.js +37 -25
- 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 +438 -0
- package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +161 -0
- package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +80 -0
- package/lib/components/DataSpreadsheet/createActiveCellFn.js +56 -0
- package/lib/components/DataSpreadsheet/generateData.js +58 -0
- package/lib/components/DataSpreadsheet/getCellSize.js +39 -0
- package/lib/components/DataSpreadsheet/index.js +13 -0
- package/lib/components/EditSidePanel/EditSidePanel.js +9 -10
- package/lib/components/EmptyStates/EmptyState.js +10 -9
- package/lib/components/EmptyStates/EmptyStateContent.js +2 -2
- package/lib/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +4 -8
- package/lib/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +4 -8
- package/lib/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +4 -8
- package/lib/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +4 -8
- package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +4 -8
- package/lib/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +4 -8
- 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 +253 -87
- 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 +122 -87
- package/lib/components/OptionsTile/OptionsTile.js +6 -9
- package/lib/components/PageHeader/PageHeader.js +18 -12
- package/lib/components/PageHeader/PageHeaderTitle.js +10 -6
- package/lib/components/ProductiveCard/ProductiveCard.js +24 -18
- package/lib/components/RemoveModal/RemoveModal.js +0 -3
- package/lib/components/SidePanel/SidePanel.js +54 -32
- package/lib/components/TagSet/TagSet.js +13 -9
- 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/Tearsheet/TearsheetShell.js +2 -3
- package/lib/components/Toolbar/ToolbarButton.js +0 -3
- package/lib/components/WebTerminal/WebTerminal.js +18 -19
- package/lib/components/index.js +8 -8
- package/lib/global/js/hooks/index.js +8 -0
- package/lib/global/js/hooks/useActiveElement.js +39 -0
- package/lib/global/js/package-settings.js +2 -1
- package/lib/global/js/utils/Wrap.js +7 -5
- package/lib/global/js/utils/getScrollbarWidth.js +23 -0
- package/lib/settings.js +0 -6
- package/package.json +25 -23
- package/scss/components/AddSelect/_add-select.scss +59 -5
- package/scss/components/BreadcrumbWithOverflow/_index.scss +1 -1
- package/scss/components/CreateInfluencer/_create-influencer.scss +4 -4
- package/scss/components/CreateTearsheet/_create-tearsheet.scss +2 -2
- package/scss/components/CreateTearsheetNarrow/_storybook-styles.scss +0 -6
- package/scss/components/DataSpreadsheet/_data-spreadsheet.scss +102 -0
- package/scss/components/{CancelableTextEdit → DataSpreadsheet}/_index.scss +2 -2
- package/scss/components/DataSpreadsheet/_storybook-styles.scss +6 -0
- package/scss/components/EditSidePanel/_storybook-styles.scss +0 -8
- package/scss/components/InlineEdit/_inline-edit.scss +293 -10
- package/scss/components/InlineEdit/_storybook-styles.scss +12 -6
- package/scss/components/LoadingBar/_storybook-styles.scss +0 -5
- package/scss/components/NotificationsPanel/_notifications-panel.scss +2 -2
- package/scss/components/OptionsTile/_storybook-styles.scss +0 -7
- package/scss/components/PageHeader/_index.scss +1 -1
- package/scss/components/PageHeader/_page-header.scss +4 -1
- package/scss/components/ProductiveCard/_productive-card.scss +0 -4
- package/scss/components/SidePanel/_side-panel.scss +15 -6
- package/scss/components/StatusIcon/_index.scss +1 -1
- package/scss/components/StatusIcon/_status-icon.scss +4 -4
- package/scss/components/TagSet/_index.scss +1 -1
- package/scss/components/UserProfileImage/_index.scss +1 -1
- package/scss/components/UserProfileImage/_user-profile-image.scss +2 -2
- package/scss/components/WebTerminal/_web-terminal.scss +2 -2
- package/scss/components/_index.scss +1 -1
- package/scss/global/styles/_project-settings.scss +5 -1
- package/es/components/CancelableTextEdit/CancelableTextEdit.js +0 -245
- package/es/generated/feature-flags/feature-flags.js +0 -15
- package/lib/components/CancelableTextEdit/CancelableTextEdit.js +0 -265
- package/lib/components/CancelableTextEdit/index.js +0 -13
- package/lib/generated/feature-flags/feature-flags.js +0 -22
- package/scss/components/CancelableTextEdit/_cancelable-text-edit.scss +0 -211
- package/scss/components/CancelableTextEdit/_storybook-styles.scss +0 -15
- package/scss/generated/feature-flags/_feature-flags.scss +0 -19
@@ -28,14 +28,20 @@ var blockClass = "".concat(pkg.prefix, "--tearsheet-create"); // This is a gener
|
|
28
28
|
export var StepsContext = /*#__PURE__*/createContext(null); // This is a context supplied separately to each step in the container
|
29
29
|
// to let it know what number it is in the sequence of steps
|
30
30
|
|
31
|
-
export var StepNumberContext = /*#__PURE__*/createContext(-1);
|
31
|
+
export var StepNumberContext = /*#__PURE__*/createContext(-1); // Default values for props
|
32
|
+
|
33
|
+
var defaults = {
|
34
|
+
verticalPosition: 'normal',
|
35
|
+
influencerWidth: 'narrow'
|
36
|
+
};
|
32
37
|
export var CreateTearsheet = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
33
38
|
var backButtonText = _ref.backButtonText,
|
34
39
|
cancelButtonText = _ref.cancelButtonText,
|
35
40
|
children = _ref.children,
|
36
41
|
className = _ref.className,
|
37
42
|
description = _ref.description,
|
38
|
-
influencerWidth = _ref.influencerWidth,
|
43
|
+
_ref$influencerWidth = _ref.influencerWidth,
|
44
|
+
influencerWidth = _ref$influencerWidth === void 0 ? defaults.influencerWidth : _ref$influencerWidth,
|
39
45
|
initialStep = _ref.initialStep,
|
40
46
|
label = _ref.label,
|
41
47
|
nextButtonText = _ref.nextButtonText,
|
@@ -44,7 +50,8 @@ export var CreateTearsheet = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
44
50
|
open = _ref.open,
|
45
51
|
submitButtonText = _ref.submitButtonText,
|
46
52
|
title = _ref.title,
|
47
|
-
verticalPosition = _ref.verticalPosition,
|
53
|
+
_ref$verticalPosition = _ref.verticalPosition,
|
54
|
+
verticalPosition = _ref$verticalPosition === void 0 ? defaults.verticalPosition : _ref$verticalPosition,
|
48
55
|
rest = _objectWithoutProperties(_ref, _excluded);
|
49
56
|
|
50
57
|
var _useState = useState([]),
|
@@ -309,12 +316,4 @@ CreateTearsheet.propTypes = {
|
|
309
316
|
* to allow an action bar navigation or breadcrumbs to also show through.
|
310
317
|
*/
|
311
318
|
verticalPosition: PropTypes.oneOf(['normal', 'lower'])
|
312
|
-
}; // Default values for component props. Default values are not required for
|
313
|
-
// props that are required, nor for props where the component can apply
|
314
|
-
// 'undefined' values reasonably. Default values should be provided when the
|
315
|
-
// component needs to make a choice or assumption when a prop is not supplied.
|
316
|
-
|
317
|
-
CreateTearsheet.defaultProps = {
|
318
|
-
verticalPosition: 'normal',
|
319
|
-
influencerWidth: 'narrow'
|
320
319
|
};
|
@@ -1,5 +1,8 @@
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
1
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
2
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
4
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
5
|
+
var _excluded = ["children", "className", "description", "disableSubmit", "fieldsetLegendText", "hasFieldset", "includeStep", "introStep", "onNext", "onMount", "secondaryLabel", "subtitle", "title"];
|
3
6
|
|
4
7
|
/**
|
5
8
|
* Copyright IBM Corp. 2021, 2022
|
@@ -16,7 +19,12 @@ import { pkg } from '../../settings';
|
|
16
19
|
import pconsole from '../../global/js/utils/pconsole';
|
17
20
|
import { usePreviousValue, useRetrieveStepData } from '../../global/js/hooks';
|
18
21
|
var componentName = 'CreateTearsheetStep';
|
19
|
-
var blockClass = "".concat(pkg.prefix, "--tearsheet-create__step");
|
22
|
+
var blockClass = "".concat(pkg.prefix, "--tearsheet-create__step"); // Default values for props
|
23
|
+
|
24
|
+
var defaults = {
|
25
|
+
hasFieldset: true,
|
26
|
+
includeStep: true
|
27
|
+
};
|
20
28
|
export var CreateTearsheetStep = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
21
29
|
var _cx;
|
22
30
|
|
@@ -25,14 +33,18 @@ export var CreateTearsheetStep = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
25
33
|
description = _ref.description,
|
26
34
|
disableSubmit = _ref.disableSubmit,
|
27
35
|
fieldsetLegendText = _ref.fieldsetLegendText,
|
28
|
-
hasFieldset = _ref.hasFieldset,
|
29
|
-
|
36
|
+
_ref$hasFieldset = _ref.hasFieldset,
|
37
|
+
hasFieldset = _ref$hasFieldset === void 0 ? defaults.hasFieldset : _ref$hasFieldset,
|
38
|
+
_ref$includeStep = _ref.includeStep,
|
39
|
+
includeStep = _ref$includeStep === void 0 ? defaults.includeStep : _ref$includeStep,
|
30
40
|
introStep = _ref.introStep,
|
31
41
|
onNext = _ref.onNext,
|
32
42
|
onMount = _ref.onMount,
|
33
43
|
secondaryLabel = _ref.secondaryLabel,
|
34
44
|
subtitle = _ref.subtitle,
|
35
|
-
title = _ref.title
|
45
|
+
title = _ref.title,
|
46
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
47
|
+
|
36
48
|
var stepsContext = useContext(StepsContext);
|
37
49
|
var stepNumber = useContext(StepNumberContext);
|
38
50
|
|
@@ -71,10 +83,10 @@ export var CreateTearsheetStep = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
71
83
|
stepsContext.setIsDisabled(disableSubmit);
|
72
84
|
}
|
73
85
|
}, [stepsContext, stepNumber, disableSubmit, onNext]);
|
74
|
-
return stepsContext ? /*#__PURE__*/React.createElement("div", {
|
86
|
+
return stepsContext ? /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
75
87
|
className: cx(blockClass, className, (_cx = {}, _defineProperty(_cx, "".concat(blockClass, "__step--hidden-step"), stepNumber !== (stepsContext === null || stepsContext === void 0 ? void 0 : stepsContext.currentStep)), _defineProperty(_cx, "".concat(blockClass, "__step--visible-step"), stepNumber === (stepsContext === null || stepsContext === void 0 ? void 0 : stepsContext.currentStep)), _cx)),
|
76
88
|
ref: ref
|
77
|
-
}, /*#__PURE__*/React.createElement(Row, null, /*#__PURE__*/React.createElement(Column, {
|
89
|
+
}), /*#__PURE__*/React.createElement(Row, null, /*#__PURE__*/React.createElement(Column, {
|
78
90
|
xlg: 12,
|
79
91
|
lg: 12,
|
80
92
|
md: 8,
|
@@ -168,12 +180,4 @@ CreateTearsheetStep.propTypes = {
|
|
168
180
|
* Sets the title text for a tearsheet step
|
169
181
|
*/
|
170
182
|
title: PropTypes.node.isRequired
|
171
|
-
}; // Default values for component props. Default values are not required for
|
172
|
-
// props that are required, nor for props where the component can apply
|
173
|
-
// 'undefined' values reasonably. Default values should be provided when the
|
174
|
-
// component needs to make a choice or assumption when a prop is not supplied.
|
175
|
-
|
176
|
-
CreateTearsheetStep.defaultProps = {
|
177
|
-
hasFieldset: true,
|
178
|
-
includeStep: true
|
179
183
|
};
|
@@ -0,0 +1,414 @@
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
4
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
5
|
+
var _excluded = ["cellSize", "className", "columns", "data", "id", "onActiveCellChange"];
|
6
|
+
|
7
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
8
|
+
|
9
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
10
|
+
|
11
|
+
/**
|
12
|
+
* Copyright IBM Corp. 2022, 2022
|
13
|
+
*
|
14
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
15
|
+
* LICENSE file in the root directory of this source tree.
|
16
|
+
*/
|
17
|
+
// Import portions of React that are needed.
|
18
|
+
import React, { useMemo, useRef, useEffect, useState, useCallback } from 'react';
|
19
|
+
import { useBlockLayout, useTable } from 'react-table'; // Other standard imports.
|
20
|
+
|
21
|
+
import PropTypes from 'prop-types';
|
22
|
+
import cx from 'classnames';
|
23
|
+
import { getDevtoolsProps } from '../../global/js/utils/devtools';
|
24
|
+
import { pkg } from '../../settings';
|
25
|
+
import { getScrollbarWidth } from '../../global/js/utils/getScrollbarWidth';
|
26
|
+
import { DataSpreadsheetBody } from './DataSpreadsheetBody';
|
27
|
+
import { getCellSize } from './getCellSize';
|
28
|
+
import { DataSpreadsheetHeader } from './DataSpreadsheetHeader';
|
29
|
+
import { useActiveElement } from '../../global/js/hooks';
|
30
|
+
import { createActiveCellFn } from './createActiveCellFn'; // cspell:words rowcount colcount
|
31
|
+
// The block part of our conventional BEM class names (blockClass__E--M).
|
32
|
+
|
33
|
+
var blockClass = "".concat(pkg.prefix, "--data-spreadsheet");
|
34
|
+
var componentName = 'DataSpreadsheet'; // Default values for props
|
35
|
+
|
36
|
+
var defaults = {
|
37
|
+
cellSize: 'standard',
|
38
|
+
columns: Object.freeze([]),
|
39
|
+
data: Object.freeze([])
|
40
|
+
};
|
41
|
+
/**
|
42
|
+
* DataSpreadsheet: used to organize and display large amounts of structured data, separated by columns and rows in a grid-like format.
|
43
|
+
*/
|
44
|
+
|
45
|
+
export var DataSpreadsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
46
|
+
var _ref$cellSize = _ref.cellSize,
|
47
|
+
cellSize = _ref$cellSize === void 0 ? defaults.cellSize : _ref$cellSize,
|
48
|
+
className = _ref.className,
|
49
|
+
_ref$columns = _ref.columns,
|
50
|
+
columns = _ref$columns === void 0 ? defaults.columns : _ref$columns,
|
51
|
+
_ref$data = _ref.data,
|
52
|
+
data = _ref$data === void 0 ? defaults.data : _ref$data,
|
53
|
+
id = _ref.id,
|
54
|
+
onActiveCellChange = _ref.onActiveCellChange,
|
55
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
56
|
+
|
57
|
+
var focusedElement = useActiveElement();
|
58
|
+
|
59
|
+
var _useState = useState(false),
|
60
|
+
_useState2 = _slicedToArray(_useState, 2),
|
61
|
+
containerHasFocus = _useState2[0],
|
62
|
+
setContainerHasFocus = _useState2[1];
|
63
|
+
|
64
|
+
var _useState3 = useState(null),
|
65
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
66
|
+
activeCellCoordinates = _useState4[0],
|
67
|
+
setActiveCellCoordinates = _useState4[1];
|
68
|
+
|
69
|
+
var cellSizeValue = getCellSize(cellSize);
|
70
|
+
var defaultColumn = useMemo(function () {
|
71
|
+
return {
|
72
|
+
width: 150,
|
73
|
+
rowHeaderWidth: 64,
|
74
|
+
rowHeight: cellSizeValue
|
75
|
+
};
|
76
|
+
}, [cellSizeValue]);
|
77
|
+
var scrollBarSize = useMemo(function () {
|
78
|
+
return getScrollbarWidth();
|
79
|
+
}, []);
|
80
|
+
|
81
|
+
var _useTable = useTable({
|
82
|
+
columns: columns,
|
83
|
+
data: data,
|
84
|
+
defaultColumn: defaultColumn
|
85
|
+
}, useBlockLayout),
|
86
|
+
getTableProps = _useTable.getTableProps,
|
87
|
+
getTableBodyProps = _useTable.getTableBodyProps,
|
88
|
+
headerGroups = _useTable.headerGroups,
|
89
|
+
rows = _useTable.rows,
|
90
|
+
totalColumnsWidth = _useTable.totalColumnsWidth,
|
91
|
+
prepareRow = _useTable.prepareRow; // Reset everything when spreadsheet loses focus
|
92
|
+
|
93
|
+
|
94
|
+
useEffect(function () {
|
95
|
+
if (!focusedElement.classList.contains("".concat(blockClass, "--interactive-cell-element"))) {
|
96
|
+
setContainerHasFocus(false);
|
97
|
+
removeActiveCell();
|
98
|
+
}
|
99
|
+
|
100
|
+
if (focusedElement.classList.contains(blockClass) || focusedElement.classList.contains("".concat(blockClass, "--interactive-cell-element"))) {
|
101
|
+
setContainerHasFocus(true);
|
102
|
+
}
|
103
|
+
}, [focusedElement, removeActiveCell]); // Removes the active cell element
|
104
|
+
|
105
|
+
var removeActiveCell = useCallback(function () {
|
106
|
+
var activeCellHighlight = spreadsheetRef.current.querySelector(".".concat(blockClass, "__active-cell--highlight"));
|
107
|
+
|
108
|
+
if (activeCellHighlight) {
|
109
|
+
activeCellHighlight.remove();
|
110
|
+
}
|
111
|
+
}, [spreadsheetRef]); // Click outside useEffect
|
112
|
+
|
113
|
+
useEffect(function () {
|
114
|
+
var handleOutsideClick = function handleOutsideClick(event) {
|
115
|
+
if (!spreadsheetRef.current || spreadsheetRef.current.contains(event.target) || event.target.classList.contains("".concat(blockClass, "__active-cell--highlight"))) {
|
116
|
+
return;
|
117
|
+
}
|
118
|
+
|
119
|
+
removeActiveCell();
|
120
|
+
setContainerHasFocus(false);
|
121
|
+
setActiveCellCoordinates(null);
|
122
|
+
};
|
123
|
+
|
124
|
+
document.addEventListener('click', handleOutsideClick);
|
125
|
+
return function () {
|
126
|
+
document.removeEventListener('click', handleOutsideClick);
|
127
|
+
};
|
128
|
+
}, [spreadsheetRef, removeActiveCell]);
|
129
|
+
var createActiveCell = useCallback(function (_ref2) {
|
130
|
+
var placementElement = _ref2.placementElement,
|
131
|
+
coords = _ref2.coords,
|
132
|
+
_ref2$addToHeader = _ref2.addToHeader,
|
133
|
+
addToHeader = _ref2$addToHeader === void 0 ? false : _ref2$addToHeader;
|
134
|
+
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;
|
135
|
+
var activeCellValue = activeCellFullData ? Object.values(activeCellFullData.row.values)[coords === null || coords === void 0 ? void 0 : coords.column] : null;
|
136
|
+
createActiveCellFn({
|
137
|
+
placementElement: placementElement,
|
138
|
+
coords: coords,
|
139
|
+
addToHeader: addToHeader,
|
140
|
+
contextRef: spreadsheetRef,
|
141
|
+
blockClass: blockClass,
|
142
|
+
onActiveCellChange: onActiveCellChange,
|
143
|
+
activeCellValue: activeCellValue
|
144
|
+
});
|
145
|
+
}, [spreadsheetRef, rows, onActiveCellChange]);
|
146
|
+
var handleInitialArrowPress = useCallback(function () {
|
147
|
+
// If activeCellCoordinates is null then we need to set an initial value
|
148
|
+
// which will place the activeCell on the select all cell/button
|
149
|
+
if (!activeCellCoordinates) {
|
150
|
+
setActiveCellCoordinates({
|
151
|
+
column: 'header',
|
152
|
+
row: 'header'
|
153
|
+
});
|
154
|
+
}
|
155
|
+
|
156
|
+
return;
|
157
|
+
}, [activeCellCoordinates]);
|
158
|
+
|
159
|
+
var updateActiveCellCoordinates = function updateActiveCellCoordinates(_ref3) {
|
160
|
+
var coords = _ref3.coords,
|
161
|
+
updatedValue = _ref3.updatedValue;
|
162
|
+
setActiveCellCoordinates(_objectSpread(_objectSpread({}, coords), updatedValue));
|
163
|
+
};
|
164
|
+
|
165
|
+
var handleKeyPress = useCallback(function (event) {
|
166
|
+
var keyCode = event.keyCode; // Command keys need to be returned as there is default browser behavior with these keys
|
167
|
+
|
168
|
+
if (keyCode === 91 || keyCode === 93) {
|
169
|
+
return;
|
170
|
+
} // Prevent arrow keys, home key, and end key from scrolling the page when the data spreadsheet container has focus
|
171
|
+
|
172
|
+
|
173
|
+
if ([35, 36, 37, 38, 39, 40].indexOf(keyCode) > -1) {
|
174
|
+
event.preventDefault();
|
175
|
+
}
|
176
|
+
|
177
|
+
switch (keyCode) {
|
178
|
+
// Tab
|
179
|
+
case 9:
|
180
|
+
{
|
181
|
+
removeActiveCell();
|
182
|
+
setContainerHasFocus(false);
|
183
|
+
setActiveCellCoordinates(null);
|
184
|
+
break;
|
185
|
+
}
|
186
|
+
// Left
|
187
|
+
|
188
|
+
case 37:
|
189
|
+
{
|
190
|
+
handleInitialArrowPress();
|
191
|
+
|
192
|
+
var coordinatesClone = _objectSpread({}, activeCellCoordinates);
|
193
|
+
|
194
|
+
if (coordinatesClone.column === 'header') {
|
195
|
+
return;
|
196
|
+
}
|
197
|
+
|
198
|
+
if (typeof coordinatesClone.column === 'number') {
|
199
|
+
if (coordinatesClone.column === 0) {
|
200
|
+
updateActiveCellCoordinates({
|
201
|
+
coords: coordinatesClone,
|
202
|
+
updatedValue: {
|
203
|
+
column: 'header'
|
204
|
+
}
|
205
|
+
});
|
206
|
+
return;
|
207
|
+
}
|
208
|
+
|
209
|
+
updateActiveCellCoordinates({
|
210
|
+
coords: coordinatesClone,
|
211
|
+
updatedValue: {
|
212
|
+
column: coordinatesClone.column - 1
|
213
|
+
}
|
214
|
+
});
|
215
|
+
}
|
216
|
+
|
217
|
+
break;
|
218
|
+
}
|
219
|
+
// Up
|
220
|
+
|
221
|
+
case 38:
|
222
|
+
{
|
223
|
+
handleInitialArrowPress();
|
224
|
+
|
225
|
+
var _coordinatesClone = _objectSpread({}, activeCellCoordinates);
|
226
|
+
|
227
|
+
if (_coordinatesClone.row === 'header') {
|
228
|
+
return;
|
229
|
+
}
|
230
|
+
|
231
|
+
if (typeof _coordinatesClone.row === 'number') {
|
232
|
+
// set row back to header if we are at index 0
|
233
|
+
if (_coordinatesClone.row === 0) {
|
234
|
+
updateActiveCellCoordinates({
|
235
|
+
coords: _coordinatesClone,
|
236
|
+
updatedValue: {
|
237
|
+
row: 'header'
|
238
|
+
}
|
239
|
+
});
|
240
|
+
return;
|
241
|
+
} // if we are at any other index than 0, subtract 1 from current row index
|
242
|
+
|
243
|
+
|
244
|
+
updateActiveCellCoordinates({
|
245
|
+
coords: _coordinatesClone,
|
246
|
+
updatedValue: {
|
247
|
+
row: _coordinatesClone.row - 1
|
248
|
+
}
|
249
|
+
});
|
250
|
+
}
|
251
|
+
|
252
|
+
break;
|
253
|
+
}
|
254
|
+
// Right
|
255
|
+
|
256
|
+
case 39:
|
257
|
+
{
|
258
|
+
handleInitialArrowPress();
|
259
|
+
|
260
|
+
var _coordinatesClone2 = _objectSpread({}, activeCellCoordinates);
|
261
|
+
|
262
|
+
if (_coordinatesClone2.column === 'header') {
|
263
|
+
updateActiveCellCoordinates({
|
264
|
+
coords: _coordinatesClone2,
|
265
|
+
updatedValue: {
|
266
|
+
column: 0
|
267
|
+
}
|
268
|
+
});
|
269
|
+
}
|
270
|
+
|
271
|
+
if (typeof _coordinatesClone2.column === 'number') {
|
272
|
+
// Prevent active cell coordinates from updating if the active
|
273
|
+
// cell is in the last column, ie we can't go any further to the right
|
274
|
+
if (columns.length - 1 === _coordinatesClone2.column) {
|
275
|
+
return;
|
276
|
+
}
|
277
|
+
|
278
|
+
updateActiveCellCoordinates({
|
279
|
+
coords: _coordinatesClone2,
|
280
|
+
updatedValue: {
|
281
|
+
column: _coordinatesClone2.column + 1
|
282
|
+
}
|
283
|
+
});
|
284
|
+
}
|
285
|
+
|
286
|
+
break;
|
287
|
+
}
|
288
|
+
// Down
|
289
|
+
|
290
|
+
case 40:
|
291
|
+
{
|
292
|
+
handleInitialArrowPress();
|
293
|
+
|
294
|
+
var _coordinatesClone3 = _objectSpread({}, activeCellCoordinates);
|
295
|
+
|
296
|
+
if (_coordinatesClone3.row === 'header') {
|
297
|
+
updateActiveCellCoordinates({
|
298
|
+
coords: _coordinatesClone3,
|
299
|
+
updatedValue: {
|
300
|
+
row: 0
|
301
|
+
}
|
302
|
+
});
|
303
|
+
}
|
304
|
+
|
305
|
+
if (typeof _coordinatesClone3.row === 'number') {
|
306
|
+
// Prevent active cell coordinates from updating if the active
|
307
|
+
// cell is in the last row, ie we can't go any further down since
|
308
|
+
// we are in the last row
|
309
|
+
if (rows.length - 1 === _coordinatesClone3.row) {
|
310
|
+
return;
|
311
|
+
}
|
312
|
+
|
313
|
+
updateActiveCellCoordinates({
|
314
|
+
coords: _coordinatesClone3,
|
315
|
+
updatedValue: {
|
316
|
+
row: _coordinatesClone3.row + 1
|
317
|
+
}
|
318
|
+
});
|
319
|
+
}
|
320
|
+
|
321
|
+
break;
|
322
|
+
}
|
323
|
+
}
|
324
|
+
}, [handleInitialArrowPress, activeCellCoordinates, removeActiveCell, columns.length, rows.length]); // Adds active cell highlight to correct cell onKeyDown
|
325
|
+
|
326
|
+
useEffect(function () {
|
327
|
+
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, "\"]"));
|
328
|
+
var shouldPlaceActiveCellInHeader = (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'header' && true;
|
329
|
+
var selectAllElement = spreadsheetRef === null || spreadsheetRef === void 0 ? void 0 : spreadsheetRef.current.querySelector("[data-row-index=\"header\"][data-column-index=\"header\"]");
|
330
|
+
|
331
|
+
if (containerHasFocus) {
|
332
|
+
createActiveCell({
|
333
|
+
placementElement: activeCellCoordinates ? activeCellPlacementElement : selectAllElement,
|
334
|
+
coords: activeCellCoordinates,
|
335
|
+
addToHeader: shouldPlaceActiveCellInHeader
|
336
|
+
});
|
337
|
+
}
|
338
|
+
}, [activeCellCoordinates, spreadsheetRef, createActiveCell, containerHasFocus]);
|
339
|
+
var localRef = useRef();
|
340
|
+
var spreadsheetRef = ref || localRef;
|
341
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, rest, getTableProps(), getDevtoolsProps(componentName), {
|
342
|
+
className: cx(blockClass, className, _defineProperty({}, "".concat(blockClass, "__container-has-focus"), containerHasFocus)),
|
343
|
+
ref: spreadsheetRef,
|
344
|
+
role: "grid",
|
345
|
+
tabIndex: 0,
|
346
|
+
"aria-rowcount": (rows === null || rows === void 0 ? void 0 : rows.length) || 0,
|
347
|
+
"aria-colcount": (columns === null || columns === void 0 ? void 0 : columns.length) || 0,
|
348
|
+
onKeyDown: handleKeyPress,
|
349
|
+
onFocus: function onFocus() {
|
350
|
+
return setContainerHasFocus(true);
|
351
|
+
}
|
352
|
+
}), /*#__PURE__*/React.createElement(DataSpreadsheetHeader, {
|
353
|
+
cellSizeValue: cellSizeValue,
|
354
|
+
defaultColumn: defaultColumn,
|
355
|
+
headerGroups: headerGroups
|
356
|
+
}), /*#__PURE__*/React.createElement(DataSpreadsheetBody, {
|
357
|
+
cellSize: cellSize,
|
358
|
+
defaultColumn: defaultColumn,
|
359
|
+
getTableBodyProps: getTableBodyProps,
|
360
|
+
onActiveCellChange: onActiveCellChange,
|
361
|
+
prepareRow: prepareRow,
|
362
|
+
rows: rows,
|
363
|
+
setActiveCellCoordinates: setActiveCellCoordinates,
|
364
|
+
scrollBarSize: scrollBarSize,
|
365
|
+
totalColumnsWidth: totalColumnsWidth,
|
366
|
+
id: id
|
367
|
+
}));
|
368
|
+
}); // Return a placeholder if not released and not enabled by feature flag
|
369
|
+
|
370
|
+
DataSpreadsheet = pkg.checkComponentEnabled(DataSpreadsheet, componentName); // The display name of the component, used by React. Note that displayName
|
371
|
+
// is used in preference to relying on function.name.
|
372
|
+
|
373
|
+
DataSpreadsheet.displayName = componentName; // The types and DocGen commentary for the component props,
|
374
|
+
// in alphabetical order (for consistency).
|
375
|
+
// See https://www.npmjs.com/package/prop-types#usage.
|
376
|
+
|
377
|
+
DataSpreadsheet.propTypes = {
|
378
|
+
/**
|
379
|
+
* Specifies the cell height
|
380
|
+
*/
|
381
|
+
cellSize: PropTypes.oneOf(['compact', 'standard', 'medium', 'large']),
|
382
|
+
|
383
|
+
/**
|
384
|
+
* Provide an optional class to be applied to the containing node.
|
385
|
+
*/
|
386
|
+
className: PropTypes.string,
|
387
|
+
|
388
|
+
/**
|
389
|
+
* The data that will build the column headers
|
390
|
+
*/
|
391
|
+
columns: PropTypes.arrayOf(PropTypes.shape({
|
392
|
+
Header: PropTypes.string,
|
393
|
+
accessor: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
|
394
|
+
Cell: PropTypes.func // optional cell formatter
|
395
|
+
|
396
|
+
})),
|
397
|
+
|
398
|
+
/**
|
399
|
+
* The spreadsheet data that will be rendered in the body of the spreadsheet component
|
400
|
+
*/
|
401
|
+
data: PropTypes.arrayOf(PropTypes.shape),
|
402
|
+
|
403
|
+
/**
|
404
|
+
* The spreadsheet id
|
405
|
+
*/
|
406
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
407
|
+
|
408
|
+
/**
|
409
|
+
* The event handler that is called when the active cell changes
|
410
|
+
*/
|
411
|
+
onActiveCellChange: PropTypes.func
|
412
|
+
/* TODO: add types and DocGen for all props. */
|
413
|
+
|
414
|
+
};
|
@@ -0,0 +1,138 @@
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Copyright IBM Corp. 2022, 2022
|
5
|
+
*
|
6
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
8
|
+
*/
|
9
|
+
import React, { useRef, useCallback, useEffect } from 'react';
|
10
|
+
import PropTypes from 'prop-types';
|
11
|
+
import { FixedSizeList } from 'react-window';
|
12
|
+
import cx from 'classnames';
|
13
|
+
import { pkg } from '../../settings';
|
14
|
+
var blockClass = "".concat(pkg.prefix, "--data-spreadsheet");
|
15
|
+
export var DataSpreadsheetBody = function DataSpreadsheetBody(_ref) {
|
16
|
+
var defaultColumn = _ref.defaultColumn,
|
17
|
+
getTableBodyProps = _ref.getTableBodyProps,
|
18
|
+
id = _ref.id,
|
19
|
+
prepareRow = _ref.prepareRow,
|
20
|
+
rows = _ref.rows,
|
21
|
+
setActiveCellCoordinates = _ref.setActiveCellCoordinates,
|
22
|
+
scrollBarSize = _ref.scrollBarSize,
|
23
|
+
totalColumnsWidth = _ref.totalColumnsWidth;
|
24
|
+
// Make sure that if the cellSize prop changes, the active
|
25
|
+
// cell also gets updated with the new size
|
26
|
+
useEffect(function () {
|
27
|
+
var listContainer = spreadsheetBodyRef === null || spreadsheetBodyRef === void 0 ? void 0 : spreadsheetBodyRef.current;
|
28
|
+
var activeCellButton = listContainer.querySelector(".".concat(blockClass, "__active-cell--highlight"));
|
29
|
+
|
30
|
+
if (activeCellButton) {
|
31
|
+
activeCellButton.style.height = "".concat(defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.rowHeight, "px");
|
32
|
+
}
|
33
|
+
}, [defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.rowHeight]); // onClick fn for each cell in the data spreadsheet body,
|
34
|
+
// adds the active cell highlight
|
35
|
+
|
36
|
+
var handleBodyCellClick = useCallback(function (cell, columnIndex) {
|
37
|
+
setActiveCellCoordinates({
|
38
|
+
row: cell.row.index,
|
39
|
+
column: columnIndex
|
40
|
+
});
|
41
|
+
}, [setActiveCellCoordinates]); // Renders each cell in the spreadsheet body
|
42
|
+
|
43
|
+
var RenderRow = useCallback(function (_ref2) {
|
44
|
+
var index = _ref2.index,
|
45
|
+
style = _ref2.style;
|
46
|
+
var row = rows[index];
|
47
|
+
prepareRow(row);
|
48
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, row.getRowProps({
|
49
|
+
style: style
|
50
|
+
}), {
|
51
|
+
className: cx("".concat(blockClass, "__tr")),
|
52
|
+
"data-row-index": index
|
53
|
+
}), /*#__PURE__*/React.createElement("button", {
|
54
|
+
tabIndex: -1,
|
55
|
+
"data-row-index": index,
|
56
|
+
"data-column-index": "header",
|
57
|
+
type: "button",
|
58
|
+
className: cx("".concat(blockClass, "__td"), "".concat(blockClass, "__td-th"), "".concat(blockClass, "--interactive-cell-element")),
|
59
|
+
style: {
|
60
|
+
width: defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.rowHeaderWidth
|
61
|
+
}
|
62
|
+
}, index + 1), row.cells.map(function (cell, index) {
|
63
|
+
return /*#__PURE__*/React.createElement("button", _extends({
|
64
|
+
tabIndex: -1,
|
65
|
+
"data-row-index": cell.row.index,
|
66
|
+
"data-column-index": index
|
67
|
+
}, cell.getCellProps(), {
|
68
|
+
className: cx("".concat(blockClass, "__td"), "".concat(blockClass, "--interactive-cell-element")),
|
69
|
+
key: "cell_".concat(index),
|
70
|
+
onClick: function onClick() {
|
71
|
+
return handleBodyCellClick(cell, index);
|
72
|
+
},
|
73
|
+
type: "button"
|
74
|
+
}), cell.render('Cell'));
|
75
|
+
}));
|
76
|
+
}, [prepareRow, rows, defaultColumn.rowHeaderWidth, handleBodyCellClick]);
|
77
|
+
var spreadsheetBodyRef = useRef();
|
78
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
79
|
+
ref: spreadsheetBodyRef,
|
80
|
+
className: cx("".concat(blockClass, "__body--container"))
|
81
|
+
}, getTableBodyProps()), /*#__PURE__*/React.createElement(FixedSizeList, {
|
82
|
+
className: cx("".concat(blockClass, "__list--container"), "".concat(blockClass, "__list--container--").concat(id)),
|
83
|
+
height: 400,
|
84
|
+
itemCount: rows.length,
|
85
|
+
itemSize: defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.rowHeight,
|
86
|
+
width: totalColumnsWidth + scrollBarSize
|
87
|
+
}, RenderRow));
|
88
|
+
};
|
89
|
+
DataSpreadsheetBody.propTypes = {
|
90
|
+
/**
|
91
|
+
* Default spreadsheet sizing values
|
92
|
+
*/
|
93
|
+
defaultColumn: PropTypes.shape({
|
94
|
+
rowHeight: PropTypes.number,
|
95
|
+
rowHeaderWidth: PropTypes.number,
|
96
|
+
width: PropTypes.number
|
97
|
+
}),
|
98
|
+
|
99
|
+
/**
|
100
|
+
* Function to set table body prop values
|
101
|
+
*/
|
102
|
+
getTableBodyProps: PropTypes.func,
|
103
|
+
|
104
|
+
/**
|
105
|
+
* The spreadsheet id
|
106
|
+
*/
|
107
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
108
|
+
|
109
|
+
/**
|
110
|
+
* The event handler that is called when the active cell changes
|
111
|
+
*/
|
112
|
+
onActiveCellChange: PropTypes.func,
|
113
|
+
|
114
|
+
/**
|
115
|
+
* Prepare row function from react-table
|
116
|
+
*/
|
117
|
+
prepareRow: PropTypes.func,
|
118
|
+
|
119
|
+
/**
|
120
|
+
* All of the spreadsheet row data
|
121
|
+
*/
|
122
|
+
rows: PropTypes.arrayOf(PropTypes.object),
|
123
|
+
|
124
|
+
/**
|
125
|
+
* The scrollbar width
|
126
|
+
*/
|
127
|
+
scrollBarSize: PropTypes.number,
|
128
|
+
|
129
|
+
/**
|
130
|
+
* Setter fn for activeCellCoordinates state value
|
131
|
+
*/
|
132
|
+
setActiveCellCoordinates: PropTypes.func,
|
133
|
+
|
134
|
+
/**
|
135
|
+
* The total columns width
|
136
|
+
*/
|
137
|
+
totalColumnsWidth: PropTypes.number
|
138
|
+
};
|