@carbon/ibm-products 2.41.1-canary.11 → 2.41.1-canary.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. package/es/components/CreateFullPage/CreateFullPage.d.ts +2 -1
  2. package/es/components/CreateFullPage/CreateFullPageStep.d.ts +71 -2
  3. package/es/components/CreateFullPage/CreateFullPageStep.js +3 -0
  4. package/es/components/DataSpreadsheet/DataSpreadsheet.d.ts +3 -2
  5. package/es/components/DataSpreadsheet/DataSpreadsheet.js +28 -28
  6. package/es/components/DataSpreadsheet/DataSpreadsheetBody.d.ts +7 -8
  7. package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +1 -0
  8. package/es/components/DataSpreadsheet/DataSpreadsheetHeader.d.ts +4 -3
  9. package/es/components/DataSpreadsheet/types/index.d.ts +1 -4
  10. package/es/components/Datagrid/Datagrid/Datagrid.d.ts +24 -2
  11. package/es/components/Datagrid/Datagrid/Datagrid.js +4 -4
  12. package/es/components/Datagrid/Datagrid/DatagridBody.d.ts +2 -1
  13. package/es/components/Datagrid/Datagrid/DatagridBody.js +1 -2
  14. package/es/components/Datagrid/Datagrid/DatagridContent.d.ts +16 -13
  15. package/es/components/Datagrid/Datagrid/DatagridContent.js +12 -13
  16. package/es/components/Datagrid/Datagrid/DatagridEmptyBody.d.ts +8 -1
  17. package/es/components/Datagrid/Datagrid/DatagridEmptyBody.js +3 -4
  18. package/es/components/Datagrid/Datagrid/DatagridExpandedRow.d.ts +9 -1
  19. package/es/components/Datagrid/Datagrid/DatagridExpandedRow.js +10 -5
  20. package/es/components/Datagrid/Datagrid/DatagridHead.d.ts +8 -1
  21. package/es/components/Datagrid/Datagrid/DatagridHead.js +3 -5
  22. package/es/components/Datagrid/Datagrid/DatagridHeaderRow.d.ts +8 -1
  23. package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +41 -36
  24. package/es/components/Datagrid/Datagrid/DatagridRefBody.d.ts +2 -1
  25. package/es/components/Datagrid/Datagrid/DatagridRefBody.js +4 -4
  26. package/es/components/Datagrid/Datagrid/DatagridRow.d.ts +8 -1
  27. package/es/components/Datagrid/Datagrid/DatagridRow.js +12 -16
  28. package/es/components/Datagrid/Datagrid/DatagridSelectAll.d.ts +9 -1
  29. package/es/components/Datagrid/Datagrid/DatagridSelectAll.js +10 -8
  30. package/es/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.d.ts +23 -27
  31. package/es/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +9 -9
  32. package/es/components/Datagrid/Datagrid/DatagridSimpleBody.d.ts +2 -1
  33. package/es/components/Datagrid/Datagrid/DatagridSimpleBody.js +3 -3
  34. package/es/components/Datagrid/Datagrid/DatagridToolbar.d.ts +17 -10
  35. package/es/components/Datagrid/Datagrid/DatagridToolbar.js +15 -11
  36. package/es/components/Datagrid/Datagrid/DatagridVirtualBody.d.ts +8 -1
  37. package/es/components/Datagrid/Datagrid/DatagridVirtualBody.js +29 -17
  38. package/es/components/Datagrid/Datagrid/DraggableElement.d.ts +23 -21
  39. package/es/components/Datagrid/Datagrid/DraggableElement.js +2 -4
  40. package/es/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.d.ts +1 -1
  41. package/es/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +1 -1
  42. package/es/components/Datagrid/Datagrid/addons/Slug/DatagridSlug.d.ts +12 -2
  43. package/es/components/Datagrid/Datagrid/index.d.ts +7 -1
  44. package/es/components/Datagrid/types/index.d.ts +208 -0
  45. package/es/components/Datagrid/useColumnOrder.d.ts +1 -0
  46. package/es/components/Datagrid/useDatagrid.d.ts +1 -1
  47. package/es/components/Datagrid/useSelectRows.js +5 -1
  48. package/es/components/FilterSummary/FilterSummary.d.ts +21 -2
  49. package/es/components/FilterSummary/FilterSummary.js +10 -11
  50. package/es/components/Guidebanner/Guidebanner.js +7 -2
  51. package/es/global/js/hooks/usePreviousValue.d.ts +1 -1
  52. package/es/global/js/hooks/usePreviousValue.js +3 -2
  53. package/es/global/js/hooks/useRetrieveStepData.d.ts +5 -5
  54. package/es/global/js/hooks/useRetrieveStepData.js +5 -5
  55. package/lib/components/CreateFullPage/CreateFullPage.d.ts +2 -1
  56. package/lib/components/CreateFullPage/CreateFullPageStep.d.ts +71 -2
  57. package/lib/components/CreateFullPage/CreateFullPageStep.js +3 -0
  58. package/lib/components/DataSpreadsheet/DataSpreadsheet.d.ts +3 -2
  59. package/lib/components/DataSpreadsheet/DataSpreadsheet.js +28 -28
  60. package/lib/components/DataSpreadsheet/DataSpreadsheetBody.d.ts +7 -8
  61. package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +1 -0
  62. package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.d.ts +4 -3
  63. package/lib/components/DataSpreadsheet/types/index.d.ts +1 -4
  64. package/lib/components/Datagrid/Datagrid/Datagrid.d.ts +24 -2
  65. package/lib/components/Datagrid/Datagrid/Datagrid.js +4 -4
  66. package/lib/components/Datagrid/Datagrid/DatagridBody.d.ts +2 -1
  67. package/lib/components/Datagrid/Datagrid/DatagridBody.js +1 -2
  68. package/lib/components/Datagrid/Datagrid/DatagridContent.d.ts +16 -13
  69. package/lib/components/Datagrid/Datagrid/DatagridContent.js +44 -45
  70. package/lib/components/Datagrid/Datagrid/DatagridEmptyBody.d.ts +8 -1
  71. package/lib/components/Datagrid/Datagrid/DatagridEmptyBody.js +3 -4
  72. package/lib/components/Datagrid/Datagrid/DatagridExpandedRow.d.ts +9 -1
  73. package/lib/components/Datagrid/Datagrid/DatagridExpandedRow.js +9 -4
  74. package/lib/components/Datagrid/Datagrid/DatagridHead.d.ts +8 -1
  75. package/lib/components/Datagrid/Datagrid/DatagridHead.js +3 -5
  76. package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.d.ts +8 -1
  77. package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +40 -35
  78. package/lib/components/Datagrid/Datagrid/DatagridRefBody.d.ts +2 -1
  79. package/lib/components/Datagrid/Datagrid/DatagridRefBody.js +4 -4
  80. package/lib/components/Datagrid/Datagrid/DatagridRow.d.ts +8 -1
  81. package/lib/components/Datagrid/Datagrid/DatagridRow.js +12 -16
  82. package/lib/components/Datagrid/Datagrid/DatagridSelectAll.d.ts +9 -1
  83. package/lib/components/Datagrid/Datagrid/DatagridSelectAll.js +10 -8
  84. package/lib/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.d.ts +23 -27
  85. package/lib/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +9 -9
  86. package/lib/components/Datagrid/Datagrid/DatagridSimpleBody.d.ts +2 -1
  87. package/lib/components/Datagrid/Datagrid/DatagridSimpleBody.js +3 -3
  88. package/lib/components/Datagrid/Datagrid/DatagridToolbar.d.ts +17 -10
  89. package/lib/components/Datagrid/Datagrid/DatagridToolbar.js +15 -11
  90. package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.d.ts +8 -1
  91. package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.js +29 -17
  92. package/lib/components/Datagrid/Datagrid/DraggableElement.d.ts +23 -21
  93. package/lib/components/Datagrid/Datagrid/DraggableElement.js +2 -4
  94. package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.d.ts +1 -1
  95. package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +1 -1
  96. package/lib/components/Datagrid/Datagrid/addons/Slug/DatagridSlug.d.ts +12 -2
  97. package/lib/components/Datagrid/Datagrid/index.d.ts +7 -1
  98. package/lib/components/Datagrid/types/index.d.ts +208 -0
  99. package/lib/components/Datagrid/useColumnOrder.d.ts +1 -0
  100. package/lib/components/Datagrid/useDatagrid.d.ts +1 -1
  101. package/lib/components/Datagrid/useSelectRows.js +5 -1
  102. package/lib/components/FilterSummary/FilterSummary.d.ts +21 -2
  103. package/lib/components/FilterSummary/FilterSummary.js +10 -11
  104. package/lib/components/Guidebanner/Guidebanner.js +7 -2
  105. package/lib/global/js/hooks/usePreviousValue.d.ts +1 -1
  106. package/lib/global/js/hooks/usePreviousValue.js +3 -2
  107. package/lib/global/js/hooks/useRetrieveStepData.d.ts +5 -5
  108. package/lib/global/js/hooks/useRetrieveStepData.js +5 -5
  109. package/package.json +3 -2
@@ -5,7 +5,8 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import React, { ReactNode } from 'react';
8
- export declare const StepsContext: React.Context<null>;
8
+ import { StepsContextType } from '../CreateTearsheet/CreateTearsheet';
9
+ export declare const StepsContext: React.Context<StepsContextType | null>;
9
10
  export declare const StepNumberContext: React.Context<number>;
10
11
  interface HeaderBreadcrumbs {
11
12
  /** breadcrumb item key */
@@ -1,2 +1,71 @@
1
- export let CreateFullPageStep: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
2
- import React from 'react';
1
+ /**
2
+ * Copyright IBM Corp. 2021, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import React, { PropsWithChildren, ReactNode } from 'react';
8
+ interface CreateFullPageStepBaseProps extends PropsWithChildren {
9
+ /**
10
+ * Sets an optional className to be added to the CreateFullPage step
11
+ */
12
+ className?: string;
13
+ /**
14
+ * Sets an optional description on the progress step component
15
+ */
16
+ description?: ReactNode;
17
+ /**
18
+ * This will conditionally disable the submit button in the multi step CreateFullPage
19
+ */
20
+ disableSubmit?: boolean;
21
+ /**
22
+ * This optional prop will render your form content inside of a fieldset html element
23
+ */
24
+ hasFieldset: boolean;
25
+ /**
26
+ * This prop is used to help track dynamic steps. If this value is `false` then the step is not included in the visible steps or the ProgressIndicator
27
+ * steps. If this value is `true` then the step will be included in the list of visible steps, as well as being included in the ProgressIndicator step list
28
+ */
29
+ includeStep?: boolean;
30
+ /**
31
+ * This prop can be used on the first step to mark it as an intro step, which will not render the progress indicator steps
32
+ */
33
+ introStep?: boolean;
34
+ /**
35
+ * This optional prop will indicate an error icon on the progress indicator step item
36
+ */
37
+ invalid?: boolean;
38
+ /**
39
+ * Optional function to be called on initial mount of a step.
40
+ * For example, this can be used to fetch data that is required on a particular step.
41
+ */
42
+ onMount?: () => void;
43
+ /**
44
+ * Optional function to be called on a step change.
45
+ * For example, this can be used to validate input fields before proceeding to the next step.
46
+ * This function can _optionally_ return a promise that is either resolved or rejected and the CreateFullPage will handle the submitting state of the next button.
47
+ */
48
+ onNext?: () => void | Promise<any>;
49
+ /**
50
+ * Sets the optional secondary label on the progress step component
51
+ */
52
+ secondaryLabel?: string;
53
+ /**
54
+ * Sets an optional subtitle on the progress step component
55
+ */
56
+ subtitle?: string;
57
+ /**
58
+ * Sets the title text for a create full page step
59
+ */
60
+ title: ReactNode;
61
+ }
62
+ type CreateFullPageStepFieldsetProps = {
63
+ hasFieldset: false;
64
+ fieldsetLegendText?: string;
65
+ } | {
66
+ hasFieldset?: true;
67
+ fieldsetLegendText: string;
68
+ };
69
+ type CreateFullPageStepProps = CreateFullPageStepBaseProps & CreateFullPageStepFieldsetProps;
70
+ export declare let CreateFullPageStep: React.ForwardRefExoticComponent<CreateFullPageStepProps & React.RefAttributes<HTMLDivElement>>;
71
+ export {};
@@ -143,10 +143,12 @@ exports.CreateFullPageStep.propTypes = {
143
143
  /**
144
144
  * This will conditionally disable the submit button in the multi step CreateFullPage
145
145
  */
146
+ /**@ts-ignore */
146
147
  disableSubmit: index["default"].bool,
147
148
  /**
148
149
  * This is the legend text that appears above a fieldset html element for accessibility purposes. It is required when the optional `hasFieldset` prop is provided to a FullPageStep.
149
150
  */
151
+ /**@ts-ignore */
150
152
  fieldsetLegendText: index["default"].string.isRequired.if(function (_ref2) {
151
153
  var hasFieldset = _ref2.hasFieldset;
152
154
  return hasFieldset === true;
@@ -154,6 +156,7 @@ exports.CreateFullPageStep.propTypes = {
154
156
  /**
155
157
  * This optional prop will render your form content inside of a fieldset html element
156
158
  */
159
+ /**@ts-ignore */
157
160
  hasFieldset: index["default"].bool,
158
161
  /**
159
162
  * This prop is used to help track dynamic steps. If this value is `false` then the step is not included in the visible steps or the ProgressIndicator
@@ -5,7 +5,8 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import React from 'react';
8
- import { Column, Size, Theme } from './types';
8
+ import { Column } from 'react-table';
9
+ import { Size, Theme } from './types';
9
10
  interface DataSpreadsheetProps {
10
11
  /**
11
12
  * Specifies the cell height
@@ -18,7 +19,7 @@ interface DataSpreadsheetProps {
18
19
  /**
19
20
  * The data that will build the column headers
20
21
  */
21
- columns?: readonly Column[];
22
+ columns?: readonly Column<object>[];
22
23
  /**
23
24
  * The spreadsheet data that will be rendered in the body of the spreadsheet component
24
25
  */
@@ -135,7 +135,7 @@ exports.DataSpreadsheet = /*#__PURE__*/React__default["default"].forwardRef(func
135
135
  }) || {};
136
136
  var cellSizeValue = getCellSize.getCellSize(cellSize);
137
137
  var cellEditorRef = React.useRef();
138
- var _useState23 = React.useState(null),
138
+ var _useState23 = React.useState(),
139
139
  _useState24 = _rollupPluginBabelHelpers.slicedToArray(_useState23, 2),
140
140
  activeCellContent = _useState24[0],
141
141
  setActiveCellContent = _useState24[1];
@@ -158,19 +158,19 @@ exports.DataSpreadsheet = /*#__PURE__*/React__default["default"].forwardRef(func
158
158
  var scrollBarSize = React.useMemo(function () {
159
159
  return getScrollbarWidth.getScrollbarWidth();
160
160
  }, []);
161
- var _useTable = reactTable.useTable({
161
+ var _ref2 = reactTable.useTable({
162
162
  columns: columns,
163
163
  data: data,
164
164
  defaultColumn: defaultColumn
165
165
  }, reactTable.useBlockLayout, reactTable.useColumnOrder),
166
- getTableProps = _useTable.getTableProps,
167
- getTableBodyProps = _useTable.getTableBodyProps,
168
- headerGroups = _useTable.headerGroups,
169
- rows = _useTable.rows,
170
- totalColumnsWidth = _useTable.totalColumnsWidth,
171
- prepareRow = _useTable.prepareRow,
172
- setColumnOrder = _useTable.setColumnOrder,
173
- visibleColumns = _useTable.visibleColumns;
166
+ getTableProps = _ref2.getTableProps,
167
+ getTableBodyProps = _ref2.getTableBodyProps,
168
+ headerGroups = _ref2.headerGroups,
169
+ rows = _ref2.rows,
170
+ totalColumnsWidth = _ref2.totalColumnsWidth,
171
+ prepareRow = _ref2.prepareRow,
172
+ setColumnOrder = _ref2.setColumnOrder,
173
+ visibleColumns = _ref2.visibleColumns;
174
174
 
175
175
  // Update the spreadsheet data after editing a cell
176
176
  var updateData = React.useCallback(function (rowIndex, columnId, newValue) {
@@ -205,7 +205,7 @@ exports.DataSpreadsheet = /*#__PURE__*/React__default["default"].forwardRef(func
205
205
  React.useEffect(function () {
206
206
  var prevCoords = previousState === null || previousState === void 0 ? void 0 : previousState.activeCellCoordinates;
207
207
  if (((prevCoords === null || prevCoords === void 0 ? void 0 : prevCoords.row) !== (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) || (prevCoords === null || prevCoords === void 0 ? void 0 : prevCoords.column) !== (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column)) && isEditing) {
208
- var cellProps = rows[prevCoords === null || prevCoords === void 0 ? void 0 : prevCoords.row].cells[prevCoords === null || prevCoords === void 0 ? void 0 : prevCoords.column];
208
+ var cellProps = rows[Number(prevCoords === null || prevCoords === void 0 ? void 0 : prevCoords.row)].cells[Number(prevCoords === null || prevCoords === void 0 ? void 0 : prevCoords.column)];
209
209
  removeCellEditor();
210
210
  updateData(prevCoords === null || prevCoords === void 0 ? void 0 : prevCoords.row, cellProps.column.id, undefined);
211
211
  if (cellEditorRulerRef !== null && cellEditorRulerRef !== void 0 && cellEditorRulerRef.current) {
@@ -226,11 +226,11 @@ exports.DataSpreadsheet = /*#__PURE__*/React__default["default"].forwardRef(func
226
226
  }
227
227
  }
228
228
  }, [activeCellCoordinates, previousState === null || previousState === void 0 ? void 0 : previousState.activeCellCoordinates, updateData, rows, isEditing, removeCellEditor, activeCellContent]);
229
- var createActiveCell = React.useCallback(function (_ref2) {
230
- var placementElement = _ref2.placementElement,
231
- coords = _ref2.coords,
232
- _ref2$addToHeader = _ref2.addToHeader,
233
- addToHeader = _ref2$addToHeader === void 0 ? false : _ref2$addToHeader;
229
+ var createActiveCell = React.useCallback(function (_ref3) {
230
+ var placementElement = _ref3.placementElement,
231
+ coords = _ref3.coords,
232
+ _ref3$addToHeader = _ref3.addToHeader,
233
+ addToHeader = _ref3$addToHeader === void 0 ? false : _ref3$addToHeader;
234
234
  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;
235
235
  var activeCellValue = activeCellFullData ? Object.values(activeCellFullData.row.values)[coords === null || coords === void 0 ? void 0 : coords.column] : null;
236
236
  createActiveCellFn.createActiveCellFn({
@@ -279,12 +279,12 @@ exports.DataSpreadsheet = /*#__PURE__*/React__default["default"].forwardRef(func
279
279
  }
280
280
  return;
281
281
  }, [activeCellCoordinates]);
282
- var updateActiveCellCoordinates = React.useCallback(function (_ref3) {
283
- var _ref3$coords = _ref3.coords,
284
- coords = _ref3$coords === void 0 ? _rollupPluginBabelHelpers.objectSpread2({}, activeCellCoordinates) : _ref3$coords,
285
- updatedValue = _ref3.updatedValue,
286
- _ref3$optOutOfSelecti = _ref3.optOutOfSelectionAreaUpdate,
287
- optOutOfSelectionAreaUpdate = _ref3$optOutOfSelecti === void 0 ? false : _ref3$optOutOfSelecti;
282
+ var updateActiveCellCoordinates = React.useCallback(function (_ref4) {
283
+ var _ref4$coords = _ref4.coords,
284
+ coords = _ref4$coords === void 0 ? _rollupPluginBabelHelpers.objectSpread2({}, activeCellCoordinates) : _ref4$coords,
285
+ updatedValue = _ref4.updatedValue,
286
+ _ref4$optOutOfSelecti = _ref4.optOutOfSelectionAreaUpdate,
287
+ optOutOfSelectionAreaUpdate = _ref4$optOutOfSelecti === void 0 ? false : _ref4$optOutOfSelecti;
288
288
  var newActiveCell = _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, coords), updatedValue);
289
289
  setActiveCellCoordinates(newActiveCell);
290
290
  // Only run if the active cell is _not_ a header cell. This will add a point1 object
@@ -300,8 +300,8 @@ exports.DataSpreadsheet = /*#__PURE__*/React__default["default"].forwardRef(func
300
300
  setCurrentMatcher(tempMatcher);
301
301
  }
302
302
  }, [activeCellCoordinates]);
303
- var handleHomeEndKey = React.useCallback(function (_ref4) {
304
- var type = _ref4.type;
303
+ var handleHomeEndKey = React.useCallback(function (_ref5) {
304
+ var type = _ref5.type;
305
305
  var coordinatesClone = _rollupPluginBabelHelpers.objectSpread2({}, activeCellCoordinates);
306
306
  updateActiveCellCoordinates({
307
307
  coords: coordinatesClone,
@@ -499,10 +499,10 @@ exports.DataSpreadsheet = /*#__PURE__*/React__default["default"].forwardRef(func
499
499
  }
500
500
  }
501
501
  };
502
- var handleRowColumnHeaderClick = function handleRowColumnHeaderClick(_ref5) {
503
- var isKeyboard = _ref5.isKeyboard,
504
- _ref5$index = _ref5.index,
505
- index = _ref5$index === void 0 ? -1 : _ref5$index;
502
+ var handleRowColumnHeaderClick = function handleRowColumnHeaderClick(_ref6) {
503
+ var isKeyboard = _ref6.isKeyboard,
504
+ _ref6$index = _ref6.index,
505
+ index = _ref6$index === void 0 ? -1 : _ref6$index;
506
506
  var handleHeaderCellProps = {
507
507
  activeCellCoordinates: activeCellCoordinates,
508
508
  rows: rows,
@@ -5,7 +5,8 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import React, { Dispatch, SetStateAction, MutableRefObject } from 'react';
8
- import { ActiveCellCoordinates, Column } from './types';
8
+ import { ActiveCellCoordinates, SpreadsheetColumn } from './types';
9
+ import { Column, IdType, TableBodyPropGetter, TableBodyProps } from 'react-table';
9
10
  interface DataSpreadsheetBodyProps {
10
11
  /**
11
12
  * Object containing the active cell coordinates
@@ -22,7 +23,7 @@ interface DataSpreadsheetBodyProps {
22
23
  /**
23
24
  * All of the spreadsheet columns
24
25
  */
25
- columns?: readonly Column[];
26
+ columns?: readonly Column<object>[];
26
27
  /**
27
28
  * This represents the id of the current cell selection area
28
29
  */
@@ -30,7 +31,7 @@ interface DataSpreadsheetBodyProps {
30
31
  /**
31
32
  * Default spreadsheet sizing values
32
33
  */
33
- defaultColumn?: Column;
34
+ defaultColumn?: SpreadsheetColumn;
34
35
  /**
35
36
  * Sets the number of empty rows to be created when there is no data provided
36
37
  */
@@ -38,9 +39,7 @@ interface DataSpreadsheetBodyProps {
38
39
  /**
39
40
  * Function to set table body prop values
40
41
  */
41
- getTableBodyProps?: () => {
42
- data: any;
43
- };
42
+ getTableBodyProps: (propGetter?: TableBodyPropGetter<any>) => TableBodyProps;
44
43
  /**
45
44
  * Headers provided from useTable hook
46
45
  */
@@ -100,7 +99,7 @@ interface DataSpreadsheetBodyProps {
100
99
  /**
101
100
  * Setter fn for column ordering, provided from react-table
102
101
  */
103
- setColumnOrder?: () => void;
102
+ setColumnOrder?: (updater: ((columnOrder: Array<IdType<any>>) => Array<IdType<any>>) | Array<IdType<any>>) => void;
104
103
  /**
105
104
  * Setter fn for containerHasFocus state value
106
105
  */
@@ -133,7 +132,7 @@ interface DataSpreadsheetBodyProps {
133
132
  /**
134
133
  * Prop from react-table used to reorder columns
135
134
  */
136
- visibleColumns?: [];
135
+ visibleColumns?: Column<object>[];
137
136
  }
138
137
  export declare const DataSpreadsheetBody: React.ForwardRefExoticComponent<DataSpreadsheetBodyProps & React.RefAttributes<HTMLDivElement>>;
139
138
  export {};
@@ -432,6 +432,7 @@ DataSpreadsheetBody.propTypes = {
432
432
  /**
433
433
  * Function to set table body prop values
434
434
  */
435
+ /**@ts-ignore */
435
436
  getTableBodyProps: index["default"].func,
436
437
  /**
437
438
  * Headers provided from useTable hook
@@ -5,7 +5,8 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import React, { Dispatch, SetStateAction } from 'react';
8
- import { ActiveCellCoordinates, Column, ItemType, Size } from './types';
8
+ import { ActiveCellCoordinates, ItemType, Size, SpreadsheetColumn } from './types';
9
+ import { Column } from 'react-table';
9
10
  interface DataSpreadsheetHeaderProps {
10
11
  /**
11
12
  * Object containing the active cell coordinates
@@ -26,7 +27,7 @@ interface DataSpreadsheetHeaderProps {
26
27
  /**
27
28
  * Default spreadsheet sizing values
28
29
  */
29
- defaultColumn?: Column;
30
+ defaultColumn?: SpreadsheetColumn;
30
31
  /**
31
32
  * Whether or not a click/hold is active on a header cell
32
33
  */
@@ -83,7 +84,7 @@ interface DataSpreadsheetHeaderProps {
83
84
  /**
84
85
  * Array of visible columns provided by react-table useTable hook
85
86
  */
86
- visibleColumns?: [];
87
+ visibleColumns?: Column<object>[];
87
88
  }
88
89
  export declare const DataSpreadsheetHeader: React.ForwardRefExoticComponent<DataSpreadsheetHeaderProps & React.RefAttributes<HTMLDivElement>>;
89
90
  export {};
@@ -1,9 +1,6 @@
1
1
  export type Size = 'xs' | 'sm' | 'md' | 'lg';
2
2
  export type Theme = 'light' | 'dark';
3
- export interface Column {
4
- Header?: string;
5
- accessor?: string | (() => void);
6
- Cell?: () => void;
3
+ export interface SpreadsheetColumn {
7
4
  rowHeight?: number;
8
5
  rowHeaderWidth?: number;
9
6
  width?: number;
@@ -1,5 +1,27 @@
1
1
  /**
2
- * The `Datagrid` component is an extension of Carbon's DataTable component. At the most basic level, the `Datagrid` component takes in columns and rows and renders a data table. There is a set of data table extensions which this component provides support for, these can be found [here](https://pages.github.ibm.com/cdai-design/pal/components/data-table/overview/). This component is data driven and allows you to choose what pieces will be included based on the hooks/plugins that are provided.
2
+ * Copyright IBM Corp. 2020, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
3
6
  */
4
- export let Datagrid: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
5
7
  import React from 'react';
8
+ import { DataGridState } from '../types';
9
+ export interface DatagridProps {
10
+ /**
11
+ * Specify a label to be read by screen readers on the container node
12
+ * 'aria-label' of the TableToolbar component.
13
+ */
14
+ ariaToolbarLabel?: string;
15
+ /**
16
+ * The data grid state, much of it being supplied by the useDatagrid hook
17
+ */
18
+ datagridState: DataGridState;
19
+ /**
20
+ * Table title
21
+ */
22
+ title?: string;
23
+ }
24
+ /**
25
+ * The `Datagrid` component is an extension of Carbon's DataTable component. At the most basic level, the `Datagrid` component takes in columns and rows and renders a data table. There is a set of data table extensions which this component provides support for, these can be found [here](https://pages.github.ibm.com/cdai-design/pal/components/data-table/overview/). This component is data driven and allows you to choose what pieces will be included based on the hooks/plugins that are provided.
26
+ */
27
+ export declare let Datagrid: React.ForwardRefExoticComponent<DatagridProps & React.RefAttributes<HTMLDivElement>>;
@@ -28,7 +28,6 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
28
28
  var _excluded = ["datagridState", "title", "ariaToolbarLabel"];
29
29
  var blockClass = "".concat(settings.pkg.prefix, "--datagrid");
30
30
  var componentName = 'Datagrid';
31
-
32
31
  /**
33
32
  * The `Datagrid` component is an extension of Carbon's DataTable component. At the most basic level, the `Datagrid` component takes in columns and rows and renders a data table. There is a set of data table extensions which this component provides support for, these can be found [here](https://pages.github.ibm.com/cdai-design/pal/components/data-table/overview/). This component is data driven and allows you to choose what pieces will be included based on the hooks/plugins that are provided.
34
33
  */
@@ -39,7 +38,7 @@ exports.Datagrid = /*#__PURE__*/React__default["default"].forwardRef(function (_
39
38
  rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
40
39
  if (!datagridState) {
41
40
  pconsole["default"].warn('Datagrid was not passed datagridState which is required to render this component.');
42
- return null;
41
+ return;
43
42
  }
44
43
  var withVirtualScroll = datagridState.withVirtualScroll,
45
44
  DatagridPagination = datagridState.DatagridPagination,
@@ -47,7 +46,7 @@ exports.Datagrid = /*#__PURE__*/React__default["default"].forwardRef(function (_
47
46
  tableId = datagridState.tableId,
48
47
  filterProps = datagridState.filterProps,
49
48
  className = datagridState.className,
50
- filters = datagridState.state.filters;
49
+ state = datagridState.state;
51
50
  var rows = DatagridPagination && datagridState.page || datagridState.rows;
52
51
  var props = {
53
52
  title: title,
@@ -55,7 +54,7 @@ exports.Datagrid = /*#__PURE__*/React__default["default"].forwardRef(function (_
55
54
  ariaToolbarLabel: ariaToolbarLabel
56
55
  };
57
56
  return /*#__PURE__*/React__default["default"].createElement(FilterProvider.FilterProvider, {
58
- filters: filters,
57
+ filters: state === null || state === void 0 ? void 0 : state.filters,
59
58
  filterProps: filterProps
60
59
  }, /*#__PURE__*/React__default["default"].createElement(InlineEditContext.InlineEditProvider, null, /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({}, rest, {
61
60
  id: tableId,
@@ -81,6 +80,7 @@ exports.Datagrid.propTypes = {
81
80
  /**
82
81
  * The data grid state, much of it being supplied by the useDatagrid hook
83
82
  */
83
+ /**@ts-ignore */
84
84
  datagridState: index["default"].object.isRequired,
85
85
  /**
86
86
  * Table title
@@ -1,2 +1,3 @@
1
+ import { DataGridState } from '../types';
2
+ declare const DatagridBody: (datagridState: DataGridState) => import("react/jsx-runtime").JSX.Element;
1
3
  export default DatagridBody;
2
- declare function DatagridBody(datagridState: any): import("react/jsx-runtime").JSX.Element;
@@ -36,6 +36,5 @@ var DatagridBody = function DatagridBody(datagridState) {
36
36
  }
37
37
  return /*#__PURE__*/React__default["default"].createElement(DatagridSimpleBody["default"], datagridState);
38
38
  };
39
- var DatagridBody$1 = DatagridBody;
40
39
 
41
- exports["default"] = DatagridBody$1;
40
+ exports["default"] = DatagridBody;
@@ -1,12 +1,15 @@
1
- export function DatagridContent({ datagridState, title, ariaToolbarLabel }: {
2
- datagridState: any;
3
- title: any;
4
- ariaToolbarLabel: any;
5
- }): import("react/jsx-runtime").JSX.Element;
6
- export namespace DatagridContent {
7
- namespace propTypes {
8
- let ariaToolbarLabel: PropTypes.Requireable<string>;
9
- let datagridState: PropTypes.Requireable<PropTypes.InferProps<{
1
+ import PropTypes from 'prop-types';
2
+ import { DataGridState } from '../types';
3
+ interface DatagridContentProps {
4
+ ariaToolbarLabel?: string;
5
+ datagridState: DataGridState;
6
+ title?: string;
7
+ }
8
+ export declare const DatagridContent: {
9
+ ({ datagridState, ariaToolbarLabel, title, }: DatagridContentProps): import("react/jsx-runtime").JSX.Element;
10
+ propTypes: {
11
+ ariaToolbarLabel: PropTypes.Requireable<string>;
12
+ datagridState: PropTypes.Requireable<PropTypes.InferProps<{
10
13
  getTableProps: PropTypes.Requireable<(...args: any[]) => any>;
11
14
  getFilterFlyoutProps: PropTypes.Requireable<(...args: any[]) => any>;
12
15
  withVirtualScroll: PropTypes.Requireable<boolean>;
@@ -32,7 +35,7 @@ export namespace DatagridContent {
32
35
  getFilterProps: PropTypes.Requireable<(...args: any[]) => any>;
33
36
  state: PropTypes.Requireable<object>;
34
37
  }>>;
35
- let title: PropTypes.Requireable<string>;
36
- }
37
- }
38
- import PropTypes from 'prop-types';
38
+ title: PropTypes.Requireable<string>;
39
+ };
40
+ };
41
+ export {};
@@ -17,13 +17,13 @@ var constants = require('./addons/Filtering/constants.js');
17
17
  var DatagridBody = require('./DatagridBody.js');
18
18
  var DatagridHead = require('./DatagridHead.js');
19
19
  var DatagridToolbar = require('./DatagridToolbar.js');
20
- var index$1 = require('../../../node_modules/prop-types/index.js');
20
+ var index = require('../../../node_modules/prop-types/index.js');
21
21
  var cx = require('classnames');
22
22
  var handleGridFocus = require('./addons/InlineEdit/handleGridFocus.js');
23
23
  var handleGridKeyPress = require('./addons/InlineEdit/handleGridKeyPress.js');
24
24
  var layout = require('@carbon/layout');
25
25
  var FilterProvider = require('./addons/Filtering/FilterProvider.js');
26
- var index = require('../../FeatureFlags/index.js');
26
+ var index$1 = require('../../FeatureFlags/index.js');
27
27
  var InlineEditContext = require('./addons/InlineEdit/InlineEditContext/InlineEditContext.js');
28
28
  var useClickOutside = require('../../../global/js/hooks/useClickOutside.js');
29
29
  var useMultipleKeyTracking = require('../../DataSpreadsheet/hooks/useMultipleKeyTracking.js');
@@ -40,8 +40,8 @@ var blockClass = "".concat(settings.pkg.prefix, "--datagrid");
40
40
  var gcClass = "".concat(blockClass, "__grid-container");
41
41
  var DatagridContent = function DatagridContent(_ref) {
42
42
  var datagridState = _ref.datagridState,
43
- title = _ref.title,
44
- ariaToolbarLabel = _ref.ariaToolbarLabel;
43
+ ariaToolbarLabel = _ref.ariaToolbarLabel,
44
+ title = _ref.title;
45
45
  var _useContext = React.useContext(InlineEditContext.InlineEditContext),
46
46
  inlineEditState = _useContext.state,
47
47
  dispatch = _useContext.dispatch;
@@ -78,11 +78,11 @@ var DatagridContent = function DatagridContent(_ref) {
78
78
  rows = datagridState.rows;
79
79
  var columnResizing = state.columnResizing;
80
80
  var contentRows = DatagridPagination && page || rows;
81
- var gridAreaRef = React.useRef();
82
- var multiKeyTrackingRef = React.useRef();
83
- var enableEditableCell = index.useFeatureFlag('enable-datagrid-useEditableCell');
84
- var enableInlineEdit = index.useFeatureFlag('enable-datagrid-useInlineEdit');
85
- var enableCustomizeCols = index.useFeatureFlag('enable-datagrid-useCustomizeColumns');
81
+ var gridAreaRef = React.useRef(null);
82
+ var multiKeyTrackingRef = React.useRef(null);
83
+ var enableEditableCell = index$1.useFeatureFlag('enable-datagrid-useEditableCell');
84
+ var enableInlineEdit = index$1.useFeatureFlag('enable-datagrid-useInlineEdit');
85
+ var enableCustomizeCols = index$1.useFeatureFlag('enable-datagrid-useCustomizeColumns');
86
86
  React.useEffect(function () {
87
87
  dispatch({
88
88
  type: 'SET_FEATURE_FLAGS',
@@ -114,13 +114,11 @@ var DatagridContent = function DatagridContent(_ref) {
114
114
  });
115
115
  });
116
116
  var renderTable = function renderTable() {
117
- var _getTableProps;
118
- return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(react.Table, _rollupPluginBabelHelpers["extends"]({}, getTableProps(), {
119
- className: cx__default["default"](withVirtualScroll ? "".concat(blockClass, "__table-virtual-scroll") : "".concat(blockClass, "__table-simple"), "".concat(blockClass, "__vertical-align-").concat(verticalAlign), _rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__variable-row-height"), variableRowHeight), _rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__table-with-inline-edit"), withInlineEdit), _rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__table-grid-active"), gridActive), _rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__table-is-resizing"), typeof (columnResizing === null || columnResizing === void 0 ? void 0 : columnResizing.isResizingColumn) === 'string'), (_getTableProps = getTableProps()) === null || _getTableProps === void 0 ? void 0 : _getTableProps.className),
117
+ return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(react.Table, _rollupPluginBabelHelpers["extends"]({}, getTableProps === null || getTableProps === void 0 ? void 0 : getTableProps(), {
118
+ className: cx__default["default"](withVirtualScroll ? "".concat(blockClass, "__table-virtual-scroll") : "".concat(blockClass, "__table-simple"), "".concat(blockClass, "__vertical-align-").concat(verticalAlign), _rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__variable-row-height"), variableRowHeight), _rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__table-with-inline-edit"), withInlineEdit), _rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__table-grid-active"), gridActive), _rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__table-is-resizing"), typeof (columnResizing === null || columnResizing === void 0 ? void 0 : columnResizing.isResizingColumn) === 'string'), getTableProps === null || getTableProps === void 0 ? void 0 : getTableProps().className),
120
119
  role: withInlineEdit ? 'grid' : undefined,
121
120
  tabIndex: withInlineEdit ? 0 : -1,
122
- onKeyDown: /* istanbul ignore next */
123
- withInlineEdit && function (event) {
121
+ onKeyDown: withInlineEdit && function (event) {
124
122
  return handleGridKeyPress.handleGridKeyPress({
125
123
  event: event,
126
124
  dispatch: dispatch,
@@ -149,14 +147,15 @@ var DatagridContent = function DatagridContent(_ref) {
149
147
 
150
148
  // Provides a width for the region outline for useInlineEdit
151
149
  React.useEffect(function () {
150
+ var _gridElement$style;
152
151
  if (!withInlineEdit) {
153
152
  return;
154
153
  }
155
154
  var gridElement = document.querySelector("#".concat(tableId));
156
155
  var tableHeader = gridElement === null || gridElement === void 0 ? void 0 : gridElement.querySelector(".".concat(settings.carbon.prefix, "--data-table-header"));
157
- gridElement.style.setProperty("--".concat(blockClass, "--grid-width"), layout.px(totalColumnsWidth + 32));
156
+ gridElement === null || gridElement === void 0 || (_gridElement$style = gridElement.style) === null || _gridElement$style === void 0 || _gridElement$style.setProperty("--".concat(blockClass, "--grid-width"), layout.px((totalColumnsWidth || 0) + 32));
158
157
  if (gridActive) {
159
- gridElement.style.setProperty("--".concat(blockClass, "--grid-header-height"), layout.px((tableHeader === null || tableHeader === void 0 ? void 0 : tableHeader.clientHeight) || 0));
158
+ gridElement === null || gridElement === void 0 || gridElement.style.setProperty("--".concat(blockClass, "--grid-header-height"), layout.px((tableHeader === null || tableHeader === void 0 ? void 0 : tableHeader.clientHeight) || 0));
160
159
  }
161
160
  }, [withInlineEdit, tableId, totalColumnsWidth, datagridState, gridActive]);
162
161
  useSubscribeToEventEmitter["default"](constants.CLEAR_SINGLE_FILTER, function (id) {
@@ -169,7 +168,7 @@ var DatagridContent = function DatagridContent(_ref) {
169
168
  clearFilters: function clearFilters() {
170
169
  return EventEmitter.dispatch(constants.CLEAR_FILTERS);
171
170
  },
172
- renderLabel: filterProps.renderLabel,
171
+ renderLabel: filterProps === null || filterProps === void 0 ? void 0 : filterProps.renderLabel,
173
172
  overflowType: "tag"
174
173
  });
175
174
  };
@@ -187,7 +186,7 @@ var DatagridContent = function DatagridContent(_ref) {
187
186
  })), /*#__PURE__*/React__default["default"].createElement("div", {
188
187
  className: cx__default["default"]("".concat(blockClass, "__table-container"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__table-container--filter-open"), panelOpen)),
189
188
  ref: gridAreaRef
190
- }, (filterProps === null || filterProps === void 0 ? void 0 : filterProps.variation) === 'panel' && /*#__PURE__*/React__default["default"].createElement(FilterPanel["default"], _rollupPluginBabelHelpers["extends"]({}, getFilterFlyoutProps(), {
189
+ }, (filterProps === null || filterProps === void 0 ? void 0 : filterProps.variation) === 'panel' && /*#__PURE__*/React__default["default"].createElement(FilterPanel["default"], _rollupPluginBabelHelpers["extends"]({}, getFilterFlyoutProps === null || getFilterFlyoutProps === void 0 ? void 0 : getFilterFlyoutProps(), {
191
190
  title: filterProps.panelTitle,
192
191
  filterSections: filterProps.sections,
193
192
  autoHideFilters: filterProps.autoHideFilters,
@@ -204,34 +203,34 @@ var DatagridContent = function DatagridContent(_ref) {
204
203
  }));
205
204
  };
206
205
  DatagridContent.propTypes = {
207
- ariaToolbarLabel: index$1["default"].string,
208
- datagridState: index$1["default"].shape({
209
- getTableProps: index$1["default"].func,
210
- getFilterFlyoutProps: index$1["default"].func,
211
- withVirtualScroll: index$1["default"].bool,
212
- DatagridActions: index$1["default"].oneOfType([index$1["default"].element, index$1["default"].func]),
213
- DatagridPagination: index$1["default"].oneOfType([index$1["default"].element, index$1["default"].func]),
214
- CustomizeColumnsTearsheet: index$1["default"].oneOfType([index$1["default"].element, index$1["default"].func]),
215
- isFetching: index$1["default"].bool,
216
- skeletonRowCount: index$1["default"].number,
217
- fullHeightDatagrid: index$1["default"].bool,
218
- filterProps: index$1["default"].object,
219
- variableRowHeight: index$1["default"].bool,
220
- useDenseHeader: index$1["default"].bool,
221
- withInlineEdit: index$1["default"].bool,
222
- verticalAlign: index$1["default"].string,
223
- gridTitle: index$1["default"].node,
224
- gridDescription: index$1["default"].node,
225
- page: index$1["default"].arrayOf(index$1["default"].object),
226
- rows: index$1["default"].arrayOf(index$1["default"].object),
227
- tableId: index$1["default"].string,
228
- totalColumnsWidth: index$1["default"].number,
229
- gridRef: index$1["default"].object,
230
- setAllFilters: index$1["default"].func,
231
- getFilterProps: index$1["default"].func,
232
- state: index$1["default"].object
206
+ ariaToolbarLabel: index["default"].string,
207
+ datagridState: index["default"].shape({
208
+ getTableProps: index["default"].func,
209
+ getFilterFlyoutProps: index["default"].func,
210
+ withVirtualScroll: index["default"].bool,
211
+ DatagridActions: index["default"].oneOfType([index["default"].element, index["default"].func]),
212
+ DatagridPagination: index["default"].oneOfType([index["default"].element, index["default"].func]),
213
+ CustomizeColumnsTearsheet: index["default"].oneOfType([index["default"].element, index["default"].func]),
214
+ isFetching: index["default"].bool,
215
+ skeletonRowCount: index["default"].number,
216
+ fullHeightDatagrid: index["default"].bool,
217
+ filterProps: index["default"].object,
218
+ variableRowHeight: index["default"].bool,
219
+ useDenseHeader: index["default"].bool,
220
+ withInlineEdit: index["default"].bool,
221
+ verticalAlign: index["default"].string,
222
+ gridTitle: index["default"].node,
223
+ gridDescription: index["default"].node,
224
+ page: index["default"].arrayOf(index["default"].object),
225
+ rows: index["default"].arrayOf(index["default"].object),
226
+ tableId: index["default"].string,
227
+ totalColumnsWidth: index["default"].number,
228
+ gridRef: index["default"].object,
229
+ setAllFilters: index["default"].func,
230
+ getFilterProps: index["default"].func,
231
+ state: index["default"].object
233
232
  }),
234
- title: index$1["default"].string
233
+ title: index["default"].string
235
234
  };
236
235
 
237
236
  exports.DatagridContent = DatagridContent;
@@ -1,2 +1,9 @@
1
+ /**
2
+ * Copyright IBM Corp. 2020, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import { DataGridState } from '../types';
8
+ declare const DatagridEmptyBody: (datagridState: DataGridState) => import("react/jsx-runtime").JSX.Element;
1
9
  export default DatagridEmptyBody;
2
- declare function DatagridEmptyBody(datagridState: any): import("react/jsx-runtime").JSX.Element;