@carbon/ibm-products 2.43.2-canary.9 → 2.44.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. package/css/index-full-carbon.css +51 -3
  2. package/css/index-full-carbon.css.map +1 -1
  3. package/css/index-full-carbon.min.css +1 -1
  4. package/css/index-full-carbon.min.css.map +1 -1
  5. package/css/index-without-carbon-released-only.css +12 -0
  6. package/css/index-without-carbon-released-only.css.map +1 -1
  7. package/css/index-without-carbon-released-only.min.css +1 -1
  8. package/css/index-without-carbon-released-only.min.css.map +1 -1
  9. package/css/index-without-carbon.css +51 -3
  10. package/css/index-without-carbon.css.map +1 -1
  11. package/css/index-without-carbon.min.css +1 -1
  12. package/css/index-without-carbon.min.css.map +1 -1
  13. package/css/index.css +51 -3
  14. package/css/index.css.map +1 -1
  15. package/css/index.min.css +1 -1
  16. package/css/index.min.css.map +1 -1
  17. package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +23 -21
  18. package/es/components/ConditionBuilder/ConditionBuilder.js +67 -20
  19. package/es/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.d.ts +15 -0
  20. package/es/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.js +129 -0
  21. package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +6 -4
  22. package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +5 -1
  23. package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +16 -4
  24. package/es/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +2 -2
  25. package/es/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +2 -2
  26. package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +9 -11
  27. package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +36 -32
  28. package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +0 -1
  29. package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +7 -2
  30. package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +6 -1
  31. package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +18 -10
  32. package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +39 -36
  33. package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +12 -10
  34. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +1 -1
  35. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +24 -16
  36. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +19 -4
  37. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.d.ts +13 -0
  38. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +109 -0
  39. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/{ConditionBuilderItemOption.d.ts → ItemOptionForValueField.d.ts} +2 -2
  40. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/{ConditionBuilderItemOption.js → ItemOptionForValueField.js} +58 -33
  41. package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +4 -6
  42. package/es/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +14 -5
  43. package/es/components/ConditionBuilder/utils/handleKeyboardEvents.js +1 -2
  44. package/es/components/ConditionBuilder/utils/util.d.ts +1 -0
  45. package/es/components/ConditionBuilder/utils/util.js +16 -1
  46. package/es/components/DataSpreadsheet/DataSpreadsheet.d.ts +12 -0
  47. package/es/components/DataSpreadsheet/DataSpreadsheet.js +29 -7
  48. package/es/components/DataSpreadsheet/DataSpreadsheetBody.d.ts +12 -0
  49. package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +22 -6
  50. package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +3 -0
  51. package/es/components/Datagrid/Datagrid/Datagrid.js +2 -1
  52. package/es/components/Datagrid/Datagrid/DatagridContent.js +1 -1
  53. package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +11 -1
  54. package/es/components/Datagrid/Datagrid/DatagridRow.js +13 -2
  55. package/es/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +6 -1
  56. package/es/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +6 -1
  57. package/es/components/Datagrid/Datagrid/addons/Filtering/FilterProvider.d.ts +3 -1
  58. package/es/components/Datagrid/Datagrid/addons/Filtering/FilterProvider.js +6 -3
  59. package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.d.ts +1 -1
  60. package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +21 -16
  61. package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js +1 -1
  62. package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +74 -11
  63. package/es/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.js +10 -2
  64. package/es/components/Datagrid/types/index.d.ts +18 -4
  65. package/es/components/Datagrid/useActionsColumn.d.ts +8 -1
  66. package/es/components/Datagrid/useActionsColumn.js +7 -6
  67. package/es/components/Datagrid/useColumnRightAlign.d.ts +8 -1
  68. package/es/components/Datagrid/useColumnRightAlign.js +4 -3
  69. package/es/components/Datagrid/useInlineEdit.js +12 -2
  70. package/es/components/Datagrid/useNestedRows.js +32 -13
  71. package/es/components/Decorator/Decorator.js +2 -1
  72. package/es/components/DecoratorBase/DecoratorBase.js +3 -5
  73. package/es/components/DecoratorDualButton/DecoratorDualButton.js +2 -1
  74. package/es/components/DecoratorLink/DecoratorLink.js +2 -1
  75. package/es/components/DecoratorSingleButton/DecoratorSingleButton.js +2 -1
  76. package/es/components/EditTearsheet/EditTearsheet.d.ts +5 -1
  77. package/es/components/EditTearsheet/EditTearsheet.js +0 -1
  78. package/es/components/EditTearsheet/EditTearsheetForm.d.ts +45 -2
  79. package/es/components/EditTearsheet/EditTearsheetForm.js +3 -0
  80. package/es/components/HTTPErrors/HTTPError403/HTTPError403.js +6 -0
  81. package/es/components/HTTPErrors/HTTPError404/HTTPError404.js +6 -0
  82. package/es/components/HTTPErrors/HTTPErrorOther/HTTPErrorOther.js +6 -0
  83. package/es/components/RemoveModal/RemoveModal.d.ts +4 -0
  84. package/es/components/RemoveModal/RemoveModal.js +7 -1
  85. package/es/components/StatusIndicator/StatusIndicatorStep.js +87 -0
  86. package/es/components/Tearsheet/Tearsheet.d.ts +8 -1
  87. package/es/components/Tearsheet/Tearsheet.js +9 -1
  88. package/es/components/Tearsheet/TearsheetNarrow.d.ts +11 -0
  89. package/es/components/Tearsheet/TearsheetNarrow.js +12 -0
  90. package/es/components/Tearsheet/TearsheetShell.d.ts +10 -0
  91. package/es/components/Tearsheet/TearsheetShell.js +17 -3
  92. package/es/components/Toolbar/ToolbarButton.js +1 -1
  93. package/es/components/index.d.ts +1 -1
  94. package/es/index.js +1 -0
  95. package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +23 -21
  96. package/lib/components/ConditionBuilder/ConditionBuilder.js +67 -20
  97. package/lib/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.d.ts +15 -0
  98. package/lib/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.js +137 -0
  99. package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +6 -3
  100. package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +5 -1
  101. package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +16 -4
  102. package/lib/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +2 -2
  103. package/lib/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +2 -2
  104. package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +9 -11
  105. package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +36 -32
  106. package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +0 -1
  107. package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +7 -2
  108. package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +6 -1
  109. package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +18 -10
  110. package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +39 -36
  111. package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +12 -10
  112. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +1 -1
  113. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +23 -15
  114. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +20 -5
  115. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.d.ts +13 -0
  116. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +117 -0
  117. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/{ConditionBuilderItemOption.d.ts → ItemOptionForValueField.d.ts} +2 -2
  118. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/{ConditionBuilderItemOption.js → ItemOptionForValueField.js} +56 -31
  119. package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +4 -6
  120. package/lib/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +14 -4
  121. package/lib/components/ConditionBuilder/utils/handleKeyboardEvents.js +1 -2
  122. package/lib/components/ConditionBuilder/utils/util.d.ts +1 -0
  123. package/lib/components/ConditionBuilder/utils/util.js +17 -0
  124. package/lib/components/DataSpreadsheet/DataSpreadsheet.d.ts +12 -0
  125. package/lib/components/DataSpreadsheet/DataSpreadsheet.js +29 -7
  126. package/lib/components/DataSpreadsheet/DataSpreadsheetBody.d.ts +12 -0
  127. package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +22 -6
  128. package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +3 -0
  129. package/lib/components/Datagrid/Datagrid/Datagrid.js +2 -1
  130. package/lib/components/Datagrid/Datagrid/DatagridContent.js +1 -1
  131. package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +11 -1
  132. package/lib/components/Datagrid/Datagrid/DatagridRow.js +13 -2
  133. package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +6 -1
  134. package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +6 -1
  135. package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterProvider.d.ts +3 -1
  136. package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterProvider.js +6 -3
  137. package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.d.ts +1 -1
  138. package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +21 -16
  139. package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js +1 -1
  140. package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +73 -10
  141. package/lib/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.js +10 -2
  142. package/lib/components/Datagrid/types/index.d.ts +18 -4
  143. package/lib/components/Datagrid/useActionsColumn.d.ts +8 -1
  144. package/lib/components/Datagrid/useActionsColumn.js +7 -6
  145. package/lib/components/Datagrid/useColumnRightAlign.d.ts +8 -1
  146. package/lib/components/Datagrid/useColumnRightAlign.js +4 -3
  147. package/lib/components/Datagrid/useInlineEdit.js +12 -2
  148. package/lib/components/Datagrid/useNestedRows.js +32 -13
  149. package/lib/components/Decorator/Decorator.js +2 -1
  150. package/lib/components/DecoratorBase/DecoratorBase.js +3 -5
  151. package/lib/components/DecoratorDualButton/DecoratorDualButton.js +2 -1
  152. package/lib/components/DecoratorLink/DecoratorLink.js +2 -1
  153. package/lib/components/DecoratorSingleButton/DecoratorSingleButton.js +2 -1
  154. package/lib/components/EditTearsheet/EditTearsheet.d.ts +5 -1
  155. package/lib/components/EditTearsheet/EditTearsheet.js +0 -1
  156. package/lib/components/EditTearsheet/EditTearsheetForm.d.ts +45 -2
  157. package/lib/components/EditTearsheet/EditTearsheetForm.js +3 -0
  158. package/lib/components/HTTPErrors/HTTPError403/HTTPError403.js +6 -0
  159. package/lib/components/HTTPErrors/HTTPError404/HTTPError404.js +6 -0
  160. package/lib/components/HTTPErrors/HTTPErrorOther/HTTPErrorOther.js +6 -0
  161. package/lib/components/RemoveModal/RemoveModal.d.ts +4 -0
  162. package/lib/components/RemoveModal/RemoveModal.js +7 -1
  163. package/lib/components/StatusIndicator/StatusIndicatorStep.js +94 -0
  164. package/lib/components/Tearsheet/Tearsheet.d.ts +8 -1
  165. package/lib/components/Tearsheet/Tearsheet.js +9 -1
  166. package/lib/components/Tearsheet/TearsheetNarrow.d.ts +11 -0
  167. package/lib/components/Tearsheet/TearsheetNarrow.js +12 -0
  168. package/lib/components/Tearsheet/TearsheetShell.d.ts +10 -0
  169. package/lib/components/Tearsheet/TearsheetShell.js +16 -2
  170. package/lib/components/Toolbar/ToolbarButton.js +1 -1
  171. package/lib/components/index.d.ts +1 -1
  172. package/lib/index.js +5 -0
  173. package/package.json +7 -6
  174. package/scss/components/ConditionBuilder/styles/_conditionBuilderCondition.scss +9 -1
  175. package/scss/components/ConditionBuilder/styles/_conditionBuilderItem.scss +26 -1
  176. package/scss/components/DataSpreadsheet/_data-spreadsheet.scss +7 -0
  177. package/scss/components/Datagrid/styles/_useInlineEdit.scss +13 -0
  178. package/scss/components/StatusIcon/_status-icon.scss +4 -4
  179. package/scss/components/StringFormatter/_string-formatter.scss +2 -2
  180. package/scss/components/UserProfileImage/_user-profile-image.scss +6 -2
  181. package/telemetry.yml +15 -3
  182. package/es/components/ConditionBuilder/utils/checkForHoldingKey.d.ts +0 -1
  183. package/es/components/ConditionBuilder/utils/checkForHoldingKey.js +0 -16
  184. package/lib/components/ConditionBuilder/utils/checkForHoldingKey.d.ts +0 -1
  185. package/lib/components/ConditionBuilder/utils/checkForHoldingKey.js +0 -20
@@ -0,0 +1,117 @@
1
+ /**
2
+ * Copyright IBM Corp. 2020, 2024
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
+
8
+ 'use strict';
9
+
10
+ Object.defineProperty(exports, '__esModule', { value: true });
11
+
12
+ var _rollupPluginBabelHelpers = require('../../../../_virtual/_rollupPluginBabelHelpers.js');
13
+ var React = require('react');
14
+ var react = require('@carbon/react');
15
+ var icons = require('@carbon/react/icons');
16
+ var index = require('../../../../node_modules/prop-types/index.js');
17
+ var ConditionBuilderProvider = require('../../ConditionBuilderContext/ConditionBuilderProvider.js');
18
+ var DataConfigs = require('../../ConditionBuilderContext/DataConfigs.js');
19
+
20
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
21
+
22
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
23
+
24
+ var ItemOption = function ItemOption(_ref) {
25
+ var _ref$conditionState = _ref.conditionState,
26
+ conditionState = _ref$conditionState === void 0 ? {} : _ref$conditionState,
27
+ _ref$config = _ref.config,
28
+ config = _ref$config === void 0 ? {} : _ref$config,
29
+ onChange = _ref.onChange;
30
+ var _useContext = React.useContext(ConditionBuilderProvider.ConditionBuilderContext),
31
+ popOverSearchThreshold = _useContext.popOverSearchThreshold;
32
+ var contentRef = React.useRef();
33
+ var allOptions = config.options;
34
+ var _useState = React.useState(''),
35
+ _useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
36
+ searchValue = _useState2[0],
37
+ setSearchValue = _useState2[1];
38
+ var selection = conditionState.value;
39
+ var filteredItems = allOptions === null || allOptions === void 0 ? void 0 : allOptions.filter(function (opt) {
40
+ return opt.label.toLowerCase().includes(searchValue.toLowerCase());
41
+ });
42
+ React.useEffect(function () {
43
+ //this will focus the first input field in the popover
44
+
45
+ if (contentRef.current) {
46
+ var firstFocusableElement = contentRef.current.querySelector('input, button,li');
47
+ if (firstFocusableElement) {
48
+ firstFocusableElement.focus();
49
+ }
50
+ }
51
+ }, [allOptions]);
52
+ var onClickHandler = function onClickHandler(evt, option) {
53
+ onChange(option.id, evt);
54
+ };
55
+ var onSearchChangeHandler = function onSearchChangeHandler(evt) {
56
+ var value = evt.target.value;
57
+ setSearchValue(value);
58
+ };
59
+ var getAriaLabel = function getAriaLabel() {
60
+ return conditionState.label ? conditionState.label : conditionState.property ? conditionState.property : DataConfigs.translateWithId('property');
61
+ };
62
+ if (!allOptions) {
63
+ return;
64
+ }
65
+ return /*#__PURE__*/React__default["default"].createElement("div", {
66
+ className: "".concat(DataConfigs.blockClass, "__item-option"),
67
+ ref: contentRef
68
+ }, allOptions.length > popOverSearchThreshold && /*#__PURE__*/React__default["default"].createElement("div", {
69
+ className: "".concat(DataConfigs.blockClass, "__item-option__search")
70
+ }, /*#__PURE__*/React__default["default"].createElement(react.Search, {
71
+ size: "sm",
72
+ labelText: DataConfigs.translateWithId('clear_search'),
73
+ closeButtonLabelText: DataConfigs.translateWithId('clear_search'),
74
+ onChange: onSearchChangeHandler
75
+ })), /*#__PURE__*/React__default["default"].createElement("ul", {
76
+ "aria-label": getAriaLabel(),
77
+ role: "listbox"
78
+ }, filteredItems === null || filteredItems === void 0 ? void 0 : filteredItems.map(function (option) {
79
+ var isSelected = selection === option.id;
80
+ var Icon = option.icon;
81
+ return /*#__PURE__*/React__default["default"].createElement("li", {
82
+ tabIndex: 0,
83
+ key: option.id,
84
+ role: "option",
85
+ "aria-selected": isSelected,
86
+ className: "".concat(DataConfigs.blockClass, "__item-option__option"),
87
+ onKeyUp: function onKeyUp() {
88
+ return false;
89
+ },
90
+ onClick: function onClick(evt) {
91
+ return onClickHandler(evt, option);
92
+ }
93
+ }, /*#__PURE__*/React__default["default"].createElement("div", {
94
+ className: "".concat(DataConfigs.blockClass, "__item-option__option-content")
95
+ }, /*#__PURE__*/React__default["default"].createElement("span", {
96
+ className: "".concat(DataConfigs.blockClass, "__item-option__option-label")
97
+ }, Icon && /*#__PURE__*/React__default["default"].createElement(Icon, null), option.label), isSelected && /*#__PURE__*/React__default["default"].createElement(icons.Checkmark, {
98
+ className: "".concat(DataConfigs.blockClass, "__checkmark")
99
+ })));
100
+ })));
101
+ };
102
+ ItemOption.propTypes = {
103
+ /**
104
+ * current condition object
105
+ */
106
+ conditionState: index["default"].object,
107
+ /**
108
+ * current config object that this property is part of
109
+ */
110
+ config: index["default"].object,
111
+ /**
112
+ * callback to update state oin date change
113
+ */
114
+ onChange: index["default"].func
115
+ };
116
+
117
+ exports.ItemOption = ItemOption;
@@ -1,9 +1,9 @@
1
- export function ConditionBuilderItemOption({ conditionState, config, onChange, }: {
1
+ export function ItemOptionForValueField({ conditionState, config, onChange, }: {
2
2
  conditionState?: {} | undefined;
3
3
  config?: {} | undefined;
4
4
  onChange: any;
5
5
  }): import("react/jsx-runtime").JSX.Element;
6
- export namespace ConditionBuilderItemOption {
6
+ export namespace ItemOptionForValueField {
7
7
  namespace propTypes {
8
8
  let conditionState: PropTypes.Requireable<object>;
9
9
  let config: PropTypes.Requireable<object>;
@@ -21,28 +21,51 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
21
21
 
22
22
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
23
23
 
24
- var _CheckboxCheckedFille, _Checkbox, _SelectSkeleton;
25
- var ConditionBuilderItemOption = function ConditionBuilderItemOption(_ref) {
24
+ var _SelectSkeleton, _CheckboxCheckedFille, _Checkbox;
25
+ var ItemOptionForValueField = function ItemOptionForValueField(_ref) {
26
26
  var _ref$conditionState = _ref.conditionState,
27
27
  conditionState = _ref$conditionState === void 0 ? {} : _ref$conditionState,
28
28
  _ref$config = _ref.config,
29
29
  config = _ref$config === void 0 ? {} : _ref$config,
30
30
  onChange = _ref.onChange;
31
- var multiSelectable = conditionState.operator === 'one-of';
31
+ var multiSelectable = conditionState.operator === 'one_of';
32
32
  var _useContext = React.useContext(ConditionBuilderProvider.ConditionBuilderContext),
33
33
  popOverSearchThreshold = _useContext.popOverSearchThreshold,
34
- getOptions = _useContext.getOptions;
34
+ getOptions = _useContext.getOptions,
35
+ rootState = _useContext.rootState;
36
+ var contentRef = React.useRef();
35
37
  var _useState = React.useState(config.options),
36
38
  _useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
37
39
  allOptions = _useState2[0],
38
40
  setAllOptions = _useState2[1];
39
- var _useState3 = React.useState(config.options),
41
+ var _useState3 = React.useState(''),
40
42
  _useState4 = _rollupPluginBabelHelpers.slicedToArray(_useState3, 2),
41
- filteredItems = _useState4[0],
42
- setFilteredItems = _useState4[1];
43
+ searchValue = _useState4[0],
44
+ setSearchValue = _useState4[1];
45
+ var filteredItems = allOptions === null || allOptions === void 0 ? void 0 : allOptions.filter(function (opt) {
46
+ return opt.label.toLowerCase().includes(searchValue.toLowerCase());
47
+ });
43
48
  var selection = Array.isArray(conditionState.value) ? conditionState.value : conditionState.value !== undefined ? [conditionState.value] : [];
44
- var contentRef = React.useRef();
45
49
  React.useEffect(function () {
50
+ // if(rest['data-name'] == 'valueField'){
51
+ // const fetchData = async () => {
52
+ // const response = await config.options(conditionState);
53
+ // if (
54
+ // response?.length > 0 &&
55
+ // Object.keys(response[0]).includes('label') &&
56
+ // Object.keys(response[0]).includes('id')
57
+ // ) {
58
+ // setAllOptions(response);
59
+ // setFilteredItems(response);
60
+ // }
61
+ // };
62
+
63
+ // fetchData(); // Call the async method
64
+ // }else{
65
+ // setAllOptions(config.options);
66
+ // setFilteredItems(config.options);
67
+ // }
68
+
46
69
  if (!allOptions && getOptions) {
47
70
  var fetchData = /*#__PURE__*/function () {
48
71
  var _ref2 = _rollupPluginBabelHelpers.asyncToGenerator( /*#__PURE__*/_rollupPluginBabelHelpers.regeneratorRuntime().mark(function _callee() {
@@ -51,12 +74,11 @@ var ConditionBuilderItemOption = function ConditionBuilderItemOption(_ref) {
51
74
  while (1) switch (_context.prev = _context.next) {
52
75
  case 0:
53
76
  _context.next = 2;
54
- return getOptions(conditionState);
77
+ return getOptions(rootState, conditionState);
55
78
  case 2:
56
79
  response = _context.sent;
57
80
  if ((response === null || response === void 0 ? void 0 : response.length) > 0 && Object.keys(response[0]).includes('label') && Object.keys(response[0]).includes('id')) {
58
81
  setAllOptions(response);
59
- setFilteredItems(response);
60
82
  }
61
83
  case 4:
62
84
  case "end":
@@ -76,46 +98,47 @@ var ConditionBuilderItemOption = function ConditionBuilderItemOption(_ref) {
76
98
  //this will focus the first input field in the popover
77
99
 
78
100
  if (contentRef.current) {
79
- var _contentRef$current;
80
- var firstFocusableElement = (_contentRef$current = contentRef.current) === null || _contentRef$current === void 0 ? void 0 : _contentRef$current.querySelector('input, button,li');
81
- firstFocusableElement === null || firstFocusableElement === void 0 || firstFocusableElement.focus();
101
+ var firstFocusableElement = contentRef.current.querySelector('input, button,li');
102
+ if (firstFocusableElement) {
103
+ firstFocusableElement.focus();
104
+ }
82
105
  }
83
- // eslint-disable-next-line react-hooks/exhaustive-deps
84
106
  }, [allOptions]);
85
107
  var handleSelectAll = function handleSelectAll(evt) {
86
108
  if (evt.currentTarget.dataset.selectedAll == 'false') {
87
109
  onChange(undefined);
88
110
  } else {
89
- onChange(allOptions.map(function (op) {
90
- return op.id;
91
- }));
111
+ onChange(allOptions);
92
112
  }
93
113
  };
94
114
  var onSearchChangeHandler = function onSearchChangeHandler(evt) {
95
115
  var value = evt.target.value;
96
- var _filteredItems = allOptions.filter(function (opt) {
97
- return opt.label.toLowerCase().includes(value.toLowerCase());
98
- });
99
- setFilteredItems(_filteredItems);
116
+ setSearchValue(value);
100
117
  };
101
118
  var onClickHandler = function onClickHandler(evt, option, isSelected) {
102
119
  if (multiSelectable) {
103
120
  if (isSelected) {
104
121
  var items = selection.filter(function (v) {
105
- return v !== option.id;
122
+ return v.id !== option.id;
106
123
  });
107
124
  onChange(items.length > 0 ? items : undefined, evt);
108
125
  } else {
109
- onChange([].concat(_rollupPluginBabelHelpers.toConsumableArray(selection), [option.id]), evt);
126
+ onChange([].concat(_rollupPluginBabelHelpers.toConsumableArray(selection), [option]), evt);
110
127
  }
111
128
  } else {
112
- onChange(option.id, evt);
129
+ onChange(option, evt);
113
130
  }
114
131
  };
115
- return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, allOptions && /*#__PURE__*/React__default["default"].createElement("div", {
132
+ var getAriaLabel = function getAriaLabel() {
133
+ return conditionState.label ? conditionState.label : conditionState.property ? conditionState.property : DataConfigs.translateWithId('property');
134
+ };
135
+ if (!allOptions) {
136
+ return _SelectSkeleton || (_SelectSkeleton = /*#__PURE__*/React__default["default"].createElement(react.SelectSkeleton, null));
137
+ }
138
+ return /*#__PURE__*/React__default["default"].createElement("div", {
116
139
  className: "".concat(DataConfigs.blockClass, "__item-option"),
117
140
  ref: contentRef
118
- }, (config.includeSearch || allOptions.length > popOverSearchThreshold) && /*#__PURE__*/React__default["default"].createElement("div", {
141
+ }, allOptions.length > popOverSearchThreshold && /*#__PURE__*/React__default["default"].createElement("div", {
119
142
  className: "".concat(DataConfigs.blockClass, "__item-option__search")
120
143
  }, /*#__PURE__*/React__default["default"].createElement(react.Search, {
121
144
  size: "sm",
@@ -131,11 +154,13 @@ var ConditionBuilderItemOption = function ConditionBuilderItemOption(_ref) {
131
154
  onClick: handleSelectAll,
132
155
  className: "".concat(DataConfigs.blockClass, "__selectAll-button")
133
156
  }, selection.length == 0 ? 'Select all' : 'Deselect all')), /*#__PURE__*/React__default["default"].createElement("ul", {
134
- "aria-label": conditionState.label ? conditionState.label : conditionState.property ? conditionState.property : DataConfigs.translateWithId('property'),
157
+ "aria-label": getAriaLabel(),
135
158
  role: "listbox",
136
159
  "data-multi-select": multiSelectable
137
160
  }, filteredItems === null || filteredItems === void 0 ? void 0 : filteredItems.map(function (option) {
138
- var isSelected = selection.includes(option.id);
161
+ var isSelected = selection.map(function (option) {
162
+ return option.id;
163
+ }).includes(option.id);
139
164
  var Icon = option.icon;
140
165
  return /*#__PURE__*/React__default["default"].createElement("li", {
141
166
  tabIndex: 0,
@@ -162,9 +187,9 @@ var ConditionBuilderItemOption = function ConditionBuilderItemOption(_ref) {
162
187
  }, Icon && /*#__PURE__*/React__default["default"].createElement(Icon, null), option.label), isSelected && /*#__PURE__*/React__default["default"].createElement(icons.Checkmark, {
163
188
  className: "".concat(DataConfigs.blockClass, "__checkmark")
164
189
  }))));
165
- }))), !allOptions && (_SelectSkeleton || (_SelectSkeleton = /*#__PURE__*/React__default["default"].createElement(react.SelectSkeleton, null))));
190
+ })));
166
191
  };
167
- ConditionBuilderItemOption.propTypes = {
192
+ ItemOptionForValueField.propTypes = {
168
193
  /**
169
194
  * current condition object
170
195
  */
@@ -179,4 +204,4 @@ ConditionBuilderItemOption.propTypes = {
179
204
  onChange: index["default"].func
180
205
  };
181
206
 
182
- exports.ConditionBuilderItemOption = ConditionBuilderItemOption;
207
+ exports.ItemOptionForValueField = ItemOptionForValueField;
@@ -16,12 +16,12 @@ var index = require('../../../node_modules/prop-types/index.js');
16
16
  var cx = require('classnames');
17
17
  var DataConfigs = require('../ConditionBuilderContext/DataConfigs.js');
18
18
  var ConditionBuilderItem = require('../ConditionBuilderItem/ConditionBuilderItem.js');
19
- var ConditionBuilderItemOption = require('../ConditionBuilderItem/ConditionBuilderItemOption/ConditionBuilderItemOption.js');
20
19
  var util = require('../utils/util.js');
21
20
  var ConditionConnector = require('../ConditionBuilderConnector/ConditionConnector.js');
22
21
  var ConditionBuilderProvider = require('../ConditionBuilderContext/ConditionBuilderProvider.js');
23
22
  var uuidv4 = require('../../../global/js/utils/uuidv4.js');
24
23
  var ConditionPreview = require('../ConditionPreview/ConditionPreview.js');
24
+ var ItemOption = require('../ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js');
25
25
 
26
26
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
27
27
 
@@ -29,7 +29,6 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
29
29
  var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
30
30
 
31
31
  var _ConditionPreview, _ConditionPreview2;
32
-
33
32
  /**
34
33
  *
35
34
  * state - this is the current group that is being rendered . This can be a inner group or outer group
@@ -94,7 +93,6 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
94
93
  var addConditionSubGroupHandler = function addConditionSubGroupHandler(conditionIndex) {
95
94
  onChange(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, group), {}, {
96
95
  conditions: [].concat(_rollupPluginBabelHelpers.toConsumableArray(group.conditions.slice(0, conditionIndex + 1)), [{
97
- groupSeparateOperator: null,
98
96
  groupOperator: 'and',
99
97
  statement: 'if',
100
98
  conditions: [{
@@ -187,7 +185,7 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
187
185
  "data-name": "connectorField",
188
186
  popOverClassName: "".concat(DataConfigs.blockClass, "__gap"),
189
187
  className: "".concat(DataConfigs.blockClass, "__statement-button")
190
- }, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItemOption.ConditionBuilderItemOption, {
188
+ }, /*#__PURE__*/React__default["default"].createElement(ItemOption.ItemOption, {
191
189
  conditionState: {
192
190
  value: group.statement,
193
191
  label: DataConfigs.translateWithId('condition')
@@ -223,7 +221,7 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
223
221
  onRemoveHandler(eachCondition.id, e);
224
222
  },
225
223
  conditionBuilderRef: conditionBuilderRef
226
- })) : /*#__PURE__*/React__default["default"].createElement(ConditionBlock["default"], {
224
+ })) : /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement(ConditionBlock["default"], {
227
225
  conjunction: conditionIndex > 0 ? group.groupOperator : undefined,
228
226
  aria: {
229
227
  level: aria.level + 1,
@@ -253,7 +251,7 @@ var ConditionGroupBuilder = function ConditionGroupBuilder(_ref) {
253
251
  },
254
252
  hideConditionPreviewHandler: hideConditionPreviewHandler,
255
253
  isLastCondition: isLastCondition
256
- }), conditionIndex == showConditionSubGroupPreview && (_ConditionPreview || (_ConditionPreview = /*#__PURE__*/React__default["default"].createElement(ConditionPreview["default"], {
254
+ })), conditionIndex == showConditionSubGroupPreview && (_ConditionPreview || (_ConditionPreview = /*#__PURE__*/React__default["default"].createElement(ConditionPreview["default"], {
257
255
  previewType: "subGroup"
258
256
  }))), conditionIndex == showConditionPreview && (_ConditionPreview2 || (_ConditionPreview2 = /*#__PURE__*/React__default["default"].createElement(ConditionPreview["default"], {
259
257
  previewType: "condition"
@@ -9,7 +9,9 @@
9
9
 
10
10
  Object.defineProperty(exports, '__esModule', { value: true });
11
11
 
12
+ var _rollupPluginBabelHelpers = require('../../../_virtual/_rollupPluginBabelHelpers.js');
12
13
  var React = require('react');
14
+ var cx = require('classnames');
13
15
  var index = require('../../../node_modules/prop-types/index.js');
14
16
  var DataConfigs = require('../ConditionBuilderContext/DataConfigs.js');
15
17
  var ConditionBuilderItem = require('../ConditionBuilderItem/ConditionBuilderItem.js');
@@ -18,9 +20,17 @@ var ConditionConnector = require('../ConditionBuilderConnector/ConditionConnecto
18
20
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
19
21
 
20
22
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
23
+ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
21
24
 
22
25
  var ConditionPreview = function ConditionPreview(_ref) {
23
26
  var previewType = _ref.previewType;
27
+ var _useState = React.useState(false),
28
+ _useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
29
+ animate = _useState2[0],
30
+ setAnimate = _useState2[1];
31
+ React.useEffect(function () {
32
+ setAnimate(true);
33
+ }, []);
24
34
  var getConditionSection = function getConditionSection() {
25
35
  return /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, {
26
36
  label: DataConfigs.translateWithId('property')
@@ -31,20 +41,20 @@ var ConditionPreview = function ConditionPreview(_ref) {
31
41
  }));
32
42
  };
33
43
  return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, previewType == 'newGroup' && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", {
34
- className: "".concat(DataConfigs.blockClass, "__group__row ").concat(DataConfigs.blockClass, "__group-preview ")
44
+ className: cx__default["default"](["".concat(DataConfigs.blockClass, "__group__row ").concat(DataConfigs.blockClass, "__group-preview "), _rollupPluginBabelHelpers.defineProperty({}, "".concat(DataConfigs.blockClass, "__group-preview-animate"), animate)])
35
45
  }, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, {
36
46
  className: "".concat(DataConfigs.blockClass, "__statement-button"),
37
47
  label: DataConfigs.translateWithId('and')
38
48
  })), /*#__PURE__*/React__default["default"].createElement("div", {
39
49
  "aria-hidden": true,
40
- className: "".concat(DataConfigs.blockClass, "__group ").concat(DataConfigs.blockClass, "__condition-wrapper ").concat(DataConfigs.blockClass, "__group-preview ").concat(DataConfigs.blockClass, "__group-wrapper")
50
+ className: cx__default["default"](["".concat(DataConfigs.blockClass, "__group ").concat(DataConfigs.blockClass, "__condition-wrapper ").concat(DataConfigs.blockClass, "__group-preview ").concat(DataConfigs.blockClass, "__group-wrapper "), _rollupPluginBabelHelpers.defineProperty({}, "".concat(DataConfigs.blockClass, "__group-preview-animate"), animate)])
41
51
  }, /*#__PURE__*/React__default["default"].createElement("div", {
42
52
  className: "".concat(DataConfigs.blockClass, "__gap")
43
53
  }, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, {
44
54
  className: "".concat(DataConfigs.blockClass, "__statement-button"),
45
55
  label: DataConfigs.translateWithId('if')
46
56
  })), getConditionSection())), previewType == 'subGroup' && /*#__PURE__*/React__default["default"].createElement("div", {
47
- className: "".concat(DataConfigs.blockClass, "__group-preview")
57
+ className: cx__default["default"](["".concat(DataConfigs.blockClass, "__group__row ").concat(DataConfigs.blockClass, "__group-preview "), _rollupPluginBabelHelpers.defineProperty({}, "".concat(DataConfigs.blockClass, "__group-preview-animate"), animate)])
48
58
  }, /*#__PURE__*/React__default["default"].createElement("div", {
49
59
  className: "".concat(DataConfigs.blockClass, "__condition-block ").concat(DataConfigs.blockClass, "__gap")
50
60
  }, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, {
@@ -57,7 +67,7 @@ var ConditionPreview = function ConditionPreview(_ref) {
57
67
  className: "".concat(DataConfigs.blockClass, "__gap ").concat(DataConfigs.blockClass, "__groupConnector"),
58
68
  operator: DataConfigs.translateWithId('if')
59
69
  }), getConditionSection()))), previewType == 'condition' && /*#__PURE__*/React__default["default"].createElement("div", {
60
- className: "".concat(DataConfigs.blockClass, "__group-preview")
70
+ className: cx__default["default"](["".concat(DataConfigs.blockClass, "__group__row ").concat(DataConfigs.blockClass, "__group-preview "), _rollupPluginBabelHelpers.defineProperty({}, "".concat(DataConfigs.blockClass, "__group-preview-animate"), animate)])
61
71
  }, /*#__PURE__*/React__default["default"].createElement("div", {
62
72
  className: "".concat(DataConfigs.blockClass, "__condition-block ").concat(DataConfigs.blockClass, "__gap")
63
73
  }, /*#__PURE__*/React__default["default"].createElement(ConditionBuilderItem.ConditionBuilderItem, {
@@ -11,7 +11,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
11
11
 
12
12
  var _rollupPluginBabelHelpers = require('../../../_virtual/_rollupPluginBabelHelpers.js');
13
13
  var DataConfigs = require('../ConditionBuilderContext/DataConfigs.js');
14
- var checkForHoldingKey = require('./checkForHoldingKey.js');
15
14
  var util = require('./util.js');
16
15
 
17
16
  var handleKeyDown = function handleKeyDown(evt, conditionBuilderRef) {
@@ -25,7 +24,7 @@ var handleKeyDown = function handleKeyDown(evt, conditionBuilderRef) {
25
24
  var handleKeyPressForPopover = function handleKeyPressForPopover(evt, parentContainer) {
26
25
  var _parentContainer$quer;
27
26
  var key = evt.key;
28
- var isHoldingShiftKey = checkForHoldingKey.checkForHoldingKey(evt, 'shiftKey');
27
+ var isHoldingShiftKey = util.checkForHoldingKey(evt, 'shiftKey');
29
28
  var isMultiSelect = (_parentContainer$quer = parentContainer.querySelector('ul')) === null || _parentContainer$quer === void 0 ? void 0 : _parentContainer$quer.dataset.multiSelect;
30
29
  var allItems = [];
31
30
  switch (key) {
@@ -3,3 +3,4 @@ export function focusThisItem(currentElement: any): void;
3
3
  export function traverseClockVise(eachElem: any, index: any, allElements: any, rotate: any, trapFocus: any): void;
4
4
  export function traverseReverse(eachElem: any, index: any, allElements: any, rotate: any, trapFocus: any): void;
5
5
  export function checkForHoldingKey(evt: any, key: any): any;
6
+ export function checkDuplicateAction(actionState: any, selectedId: any, currentActionId: any): boolean;
@@ -45,7 +45,24 @@ var traverseReverse = function traverseReverse(eachElem, index, allElements, rot
45
45
  focusThisItem(allElements[allElements.length - 1]);
46
46
  }
47
47
  };
48
+ var checkForHoldingKey = function checkForHoldingKey(evt, key) {
49
+ // possible key inputs: altKey,ctrlKey,metaKey,shiftKey
50
+ if (key === 'cmd') {
51
+ return evt.metaKey || evt.ctrlKey;
52
+ }
53
+ return evt[key];
54
+ };
55
+ var checkDuplicateAction = function checkDuplicateAction(actionState, selectedId, currentActionId) {
56
+ if (selectedId !== currentActionId && actionState.find(function (eachAction) {
57
+ return eachAction.id === selectedId;
58
+ })) {
59
+ return true;
60
+ }
61
+ return false;
62
+ };
48
63
 
64
+ exports.checkDuplicateAction = checkDuplicateAction;
65
+ exports.checkForHoldingKey = checkForHoldingKey;
49
66
  exports.focusThisField = focusThisField;
50
67
  exports.focusThisItem = focusThisItem;
51
68
  exports.traverseClockVise = traverseClockVise;
@@ -28,6 +28,10 @@ interface DataSpreadsheetProps {
28
28
  * Sets the number of empty rows to be created when there is no data provided
29
29
  */
30
30
  defaultEmptyRowCount?: number;
31
+ /**
32
+ * Check if has custom row header component attached
33
+ */
34
+ hasCustomRowHeader?: boolean;
31
35
  /**
32
36
  * The spreadsheet id
33
37
  */
@@ -46,6 +50,14 @@ interface DataSpreadsheetProps {
46
50
  * The event handler that is called when the selection area values change
47
51
  */
48
52
  onSelectionAreaChange?: () => void;
53
+ /**
54
+ * Position of the custom row numbering component
55
+ */
56
+ renderRowHeaderDirection?: 'left' | 'right';
57
+ /**
58
+ * Component next to numbering rows
59
+ */
60
+ renderRowHeader?: (index: number) => any[];
49
61
  /**
50
62
  * The aria label applied to the Select all button
51
63
  */
@@ -41,7 +41,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
41
41
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
42
42
  var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
43
43
 
44
- var _excluded = ["cellSize", "className", "columns", "data", "defaultEmptyRowCount", "onDataUpdate", "id", "onActiveCellChange", "onSelectionAreaChange", "selectAllAriaLabel", "spreadsheetAriaLabel", "theme", "totalVisibleColumns"];
44
+ var _excluded = ["cellSize", "className", "columns", "data", "defaultEmptyRowCount", "onDataUpdate", "id", "onActiveCellChange", "onSelectionAreaChange", "renderRowHeader", "renderRowHeaderDirection", "selectAllAriaLabel", "spreadsheetAriaLabel", "theme", "totalVisibleColumns"];
45
45
  // The block part of our conventional BEM class names (blockClass__E--M).
46
46
  var blockClass = "".concat(settings.pkg.prefix, "--data-spreadsheet");
47
47
  var componentName = 'DataSpreadsheet';
@@ -76,6 +76,8 @@ exports.DataSpreadsheet = /*#__PURE__*/React__default["default"].forwardRef(func
76
76
  onActiveCellChange = _ref$onActiveCellChan === void 0 ? defaults.onActiveCellChange : _ref$onActiveCellChan,
77
77
  _ref$onSelectionAreaC = _ref.onSelectionAreaChange,
78
78
  onSelectionAreaChange = _ref$onSelectionAreaC === void 0 ? defaults.onSelectionAreaChange : _ref$onSelectionAreaC,
79
+ renderRowHeader = _ref.renderRowHeader,
80
+ renderRowHeaderDirection = _ref.renderRowHeaderDirection,
79
81
  selectAllAriaLabel = _ref.selectAllAriaLabel,
80
82
  spreadsheetAriaLabel = _ref.spreadsheetAriaLabel,
81
83
  theme = _ref.theme,
@@ -147,13 +149,15 @@ exports.DataSpreadsheet = /*#__PURE__*/React__default["default"].forwardRef(func
147
149
  setActiveCellContent = _useState26[1];
148
150
  var activeCellRef = React.useRef();
149
151
  var cellEditorRulerRef = React.useRef();
152
+ var hasCustomRowHeader = typeof renderRowHeader === 'function';
153
+ var maxNumRowsCount = data.length.toString().length;
150
154
  var defaultColumn = React.useMemo(function () {
151
155
  return {
152
156
  width: 150,
153
- rowHeaderWidth: 64,
157
+ rowHeaderWidth: hasCustomRowHeader ? 40 + maxNumRowsCount * 8.56 : 64,
154
158
  rowHeight: cellSizeValue
155
159
  };
156
- }, [cellSizeValue]);
160
+ }, [cellSizeValue, hasCustomRowHeader, maxNumRowsCount]);
157
161
  var _useMultipleKeyTracki = useMultipleKeyTracking.useMultipleKeyTracking({
158
162
  ref: multiKeyTrackingRef,
159
163
  containerHasFocus: containerHasFocus,
@@ -220,9 +224,12 @@ exports.DataSpreadsheet = /*#__PURE__*/React__default["default"].forwardRef(func
220
224
  }
221
225
  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)) {
222
226
  if (activeCellCoordinates && (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) !== 'header' && (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) !== 'header') {
223
- var _activeCellFullData$r;
224
227
  var activeCellFullData = typeof (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === 'number' && typeof (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'number' ? rows[activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row].cells[activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column] : null;
225
- setActiveCellContent((_activeCellFullData$r = activeCellFullData === null || activeCellFullData === void 0 ? void 0 : activeCellFullData.render('Cell')) !== null && _activeCellFullData$r !== void 0 ? _activeCellFullData$r : null);
228
+ if (activeCellFullData) {
229
+ setActiveCellContent(activeCellFullData.render('Cell'));
230
+ } else {
231
+ setActiveCellContent(null);
232
+ }
226
233
  }
227
234
  if (activeCellCoordinates && (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'header' || (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === 'header') {
228
235
  setActiveCellContent(null);
@@ -437,8 +444,8 @@ exports.DataSpreadsheet = /*#__PURE__*/React__default["default"].forwardRef(func
437
444
  var activeCellFullData = typeof (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === 'number' && typeof (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'number' ? rows[activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row].cells[activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column] : null;
438
445
  var activeCellValue;
439
446
  if (activeCellFullData && activeCellCoordinates !== null && activeCellCoordinates !== void 0 && activeCellCoordinates.column) {
440
- var _activeCellFullData$r2;
441
- activeCellValue = activeCellFullData ? (_activeCellFullData$r2 = activeCellFullData.row.cells) === null || _activeCellFullData$r2 === void 0 || (_activeCellFullData$r2 = _activeCellFullData$r2[activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column]) === null || _activeCellFullData$r2 === void 0 ? void 0 : _activeCellFullData$r2.value : null;
447
+ var _activeCellFullData$r;
448
+ activeCellValue = activeCellFullData ? (_activeCellFullData$r = activeCellFullData.row.cells) === null || _activeCellFullData$r === void 0 || (_activeCellFullData$r = _activeCellFullData$r[activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column]) === null || _activeCellFullData$r === void 0 ? void 0 : _activeCellFullData$r.value : null;
442
449
  }
443
450
  setCellEditorValue(activeCellValue || '');
444
451
  if (cellEditorRulerRef !== null && cellEditorRulerRef !== void 0 && cellEditorRulerRef.current) {
@@ -660,7 +667,10 @@ exports.DataSpreadsheet = /*#__PURE__*/React__default["default"].forwardRef(func
660
667
  headerGroups: headerGroups,
661
668
  defaultColumn: defaultColumn,
662
669
  getTableBodyProps: getTableBodyProps,
670
+ hasCustomRowHeader: hasCustomRowHeader,
663
671
  onDataUpdate: onDataUpdate,
672
+ renderRowHeaderDirection: renderRowHeaderDirection,
673
+ renderRowHeader: renderRowHeader,
664
674
  onActiveCellChange: onActiveCellChange,
665
675
  onSelectionAreaChange: onSelectionAreaChange,
666
676
  prepareRow: prepareRow,
@@ -759,6 +769,10 @@ exports.DataSpreadsheet.propTypes = {
759
769
  * Sets the number of empty rows to be created when there is no data provided
760
770
  */
761
771
  defaultEmptyRowCount: index["default"].number,
772
+ /**
773
+ * Check if spreadsheet is using custom row header component attached
774
+ */
775
+ hasCustomRowHeader: index["default"].bool,
762
776
  /**
763
777
  * The spreadsheet id
764
778
  */
@@ -775,6 +789,14 @@ exports.DataSpreadsheet.propTypes = {
775
789
  * The event handler that is called when the selection area values change
776
790
  */
777
791
  onSelectionAreaChange: index["default"].func,
792
+ /**
793
+ * Component next to numbering rows
794
+ */
795
+ renderRowHeader: index["default"].func,
796
+ /**
797
+ * Component next to numbering rows
798
+ */
799
+ renderRowHeaderDirection: index["default"].oneOf(['left', 'right']),
778
800
  /**
779
801
  * The aria label applied to the Select all button
780
802
  */
@@ -52,6 +52,18 @@ interface DataSpreadsheetBodyProps {
52
52
  * The event handler that is called when the active cell changes
53
53
  */
54
54
  onActiveCellChange?: () => void;
55
+ /**
56
+ * Check if user is using custom component
57
+ */
58
+ hasCustomRowHeader?: boolean;
59
+ /**
60
+ * Component next to numbering rows
61
+ */
62
+ renderRowHeader?: (index: number) => any[];
63
+ /**
64
+ * Component next to numbering rows
65
+ */
66
+ renderRowHeaderDirection?: string;
55
67
  /**
56
68
  * The event handler that is called to set the rows for the empty spreadsheet
57
69
  */