@carbon/ibm-products 2.43.2-canary.4 → 2.43.2-canary.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/css/index-full-carbon.css +52 -3
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +1 -1
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +12 -0
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +1 -1
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css +52 -3
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +1 -1
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +52 -3
- package/css/index.css.map +1 -1
- package/css/index.min.css +1 -1
- package/css/index.min.css.map +1 -1
- package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +23 -21
- package/es/components/ConditionBuilder/ConditionBuilder.js +67 -20
- package/es/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.d.ts +15 -0
- package/es/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.js +129 -0
- package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +6 -4
- package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +5 -1
- package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +16 -4
- package/es/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +2 -2
- package/es/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +2 -2
- package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +9 -11
- package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +36 -32
- package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +0 -1
- package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +7 -2
- package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +6 -1
- package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +18 -10
- package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +39 -36
- package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +12 -10
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +1 -1
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +24 -16
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +19 -4
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.d.ts +13 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +109 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/{ConditionBuilderItemOption.d.ts → ItemOptionForValueField.d.ts} +2 -2
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/{ConditionBuilderItemOption.js → ItemOptionForValueField.js} +58 -33
- package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +4 -6
- package/es/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +14 -5
- package/es/components/ConditionBuilder/utils/handleKeyboardEvents.js +1 -2
- package/es/components/ConditionBuilder/utils/util.d.ts +1 -0
- package/es/components/ConditionBuilder/utils/util.js +16 -1
- package/es/components/DataSpreadsheet/DataSpreadsheet.d.ts +12 -0
- package/es/components/DataSpreadsheet/DataSpreadsheet.js +51 -19
- package/es/components/DataSpreadsheet/DataSpreadsheetBody.d.ts +21 -1
- package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +40 -8
- package/es/components/DataSpreadsheet/DataSpreadsheetHeader.d.ts +8 -0
- package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +20 -6
- package/es/components/DataSpreadsheet/hooks/useSpreadsheetMouseMove.js +4 -1
- package/es/components/DataSpreadsheet/hooks/useSpreadsheetMouseUp.d.ts +3 -1
- package/es/components/DataSpreadsheet/hooks/useSpreadsheetMouseUp.js +15 -3
- package/es/components/DataSpreadsheet/types/index.d.ts +1 -1
- package/es/components/DataSpreadsheet/utils/moveColumnIndicatorLine.js +34 -2
- package/es/components/Datagrid/Datagrid/Datagrid.d.ts +0 -4
- package/es/components/Datagrid/Datagrid/Datagrid.js +4 -9
- package/es/components/Datagrid/Datagrid/DatagridContent.js +1 -1
- package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +23 -8
- package/es/components/Datagrid/Datagrid/DatagridRow.js +21 -8
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +6 -1
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +6 -1
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterProvider.d.ts +3 -1
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterProvider.js +6 -3
- package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.d.ts +1 -1
- package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +21 -16
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js +2 -3
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +74 -11
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.js +10 -2
- package/es/components/Datagrid/types/index.d.ts +37 -4
- package/es/components/Datagrid/useActionsColumn.d.ts +8 -1
- package/es/components/Datagrid/useActionsColumn.js +7 -6
- package/es/components/Datagrid/useColumnRightAlign.d.ts +8 -1
- package/es/components/Datagrid/useColumnRightAlign.js +4 -3
- package/es/components/Datagrid/useCustomizeColumns.d.ts +8 -1
- package/es/components/Datagrid/useCustomizeColumns.js +4 -3
- package/es/components/Datagrid/useDefaultStringRenderer.js +0 -1
- package/es/components/Datagrid/useInlineEdit.js +12 -2
- package/es/components/Datagrid/useNestedRowExpander.js +1 -3
- package/es/components/Datagrid/useNestedRows.js +32 -13
- package/es/components/Datagrid/useRowExpander.js +1 -3
- package/es/components/Decorator/Decorator.js +2 -1
- package/es/components/DecoratorBase/DecoratorBase.js +3 -5
- package/es/components/DecoratorDualButton/DecoratorDualButton.js +2 -1
- package/es/components/DecoratorLink/DecoratorLink.js +2 -1
- package/es/components/DecoratorSingleButton/DecoratorSingleButton.js +2 -1
- package/es/components/EditTearsheet/EditTearsheet.d.ts +5 -1
- package/es/components/EditTearsheet/EditTearsheet.js +0 -1
- package/es/components/EditTearsheet/EditTearsheetForm.d.ts +45 -2
- package/es/components/EditTearsheet/EditTearsheetForm.js +3 -0
- package/es/components/HTTPErrors/HTTPError403/HTTPError403.js +6 -0
- package/es/components/HTTPErrors/HTTPError404/HTTPError404.js +6 -0
- package/es/components/HTTPErrors/HTTPErrorOther/HTTPErrorOther.js +6 -0
- package/es/components/PageHeader/PageHeader.js +1 -0
- package/es/components/RemoveModal/RemoveModal.d.ts +4 -0
- package/es/components/RemoveModal/RemoveModal.js +7 -1
- package/es/components/StatusIndicator/StatusIndicatorStep.js +87 -0
- package/es/components/Tearsheet/Tearsheet.d.ts +8 -1
- package/es/components/Tearsheet/Tearsheet.js +9 -1
- package/es/components/Tearsheet/TearsheetNarrow.d.ts +11 -0
- package/es/components/Tearsheet/TearsheetNarrow.js +12 -0
- package/es/components/Tearsheet/TearsheetShell.d.ts +10 -0
- package/es/components/Tearsheet/TearsheetShell.js +17 -3
- package/es/components/Toolbar/ToolbarButton.js +1 -1
- package/es/components/index.d.ts +1 -1
- package/es/index.js +1 -0
- package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +23 -21
- package/lib/components/ConditionBuilder/ConditionBuilder.js +67 -20
- package/lib/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.d.ts +15 -0
- package/lib/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.js +137 -0
- package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +6 -3
- package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +5 -1
- package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +16 -4
- package/lib/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +2 -2
- package/lib/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +2 -2
- package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +9 -11
- package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +36 -32
- package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +0 -1
- package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +7 -2
- package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +6 -1
- package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +18 -10
- package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +39 -36
- package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +12 -10
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +1 -1
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +23 -15
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +20 -5
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.d.ts +13 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +117 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/{ConditionBuilderItemOption.d.ts → ItemOptionForValueField.d.ts} +2 -2
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/{ConditionBuilderItemOption.js → ItemOptionForValueField.js} +56 -31
- package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +4 -6
- package/lib/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +14 -4
- package/lib/components/ConditionBuilder/utils/handleKeyboardEvents.js +1 -2
- package/lib/components/ConditionBuilder/utils/util.d.ts +1 -0
- package/lib/components/ConditionBuilder/utils/util.js +17 -0
- package/lib/components/DataSpreadsheet/DataSpreadsheet.d.ts +12 -0
- package/lib/components/DataSpreadsheet/DataSpreadsheet.js +51 -19
- package/lib/components/DataSpreadsheet/DataSpreadsheetBody.d.ts +21 -1
- package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +40 -8
- package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.d.ts +8 -0
- package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +20 -6
- package/lib/components/DataSpreadsheet/hooks/useSpreadsheetMouseMove.js +4 -1
- package/lib/components/DataSpreadsheet/hooks/useSpreadsheetMouseUp.d.ts +3 -1
- package/lib/components/DataSpreadsheet/hooks/useSpreadsheetMouseUp.js +15 -3
- package/lib/components/DataSpreadsheet/types/index.d.ts +1 -1
- package/lib/components/DataSpreadsheet/utils/moveColumnIndicatorLine.js +34 -2
- package/lib/components/Datagrid/Datagrid/Datagrid.d.ts +0 -4
- package/lib/components/Datagrid/Datagrid/Datagrid.js +4 -9
- package/lib/components/Datagrid/Datagrid/DatagridContent.js +1 -1
- package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +23 -8
- package/lib/components/Datagrid/Datagrid/DatagridRow.js +21 -8
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +6 -1
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +6 -1
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterProvider.d.ts +3 -1
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterProvider.js +6 -3
- package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.d.ts +1 -1
- package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +21 -16
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js +2 -3
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +73 -10
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.js +10 -2
- package/lib/components/Datagrid/types/index.d.ts +37 -4
- package/lib/components/Datagrid/useActionsColumn.d.ts +8 -1
- package/lib/components/Datagrid/useActionsColumn.js +7 -6
- package/lib/components/Datagrid/useColumnRightAlign.d.ts +8 -1
- package/lib/components/Datagrid/useColumnRightAlign.js +4 -3
- package/lib/components/Datagrid/useCustomizeColumns.d.ts +8 -1
- package/lib/components/Datagrid/useCustomizeColumns.js +4 -3
- package/lib/components/Datagrid/useDefaultStringRenderer.js +0 -1
- package/lib/components/Datagrid/useInlineEdit.js +12 -2
- package/lib/components/Datagrid/useNestedRowExpander.js +1 -3
- package/lib/components/Datagrid/useNestedRows.js +32 -13
- package/lib/components/Datagrid/useRowExpander.js +1 -3
- package/lib/components/Decorator/Decorator.js +2 -1
- package/lib/components/DecoratorBase/DecoratorBase.js +3 -5
- package/lib/components/DecoratorDualButton/DecoratorDualButton.js +2 -1
- package/lib/components/DecoratorLink/DecoratorLink.js +2 -1
- package/lib/components/DecoratorSingleButton/DecoratorSingleButton.js +2 -1
- package/lib/components/EditTearsheet/EditTearsheet.d.ts +5 -1
- package/lib/components/EditTearsheet/EditTearsheet.js +0 -1
- package/lib/components/EditTearsheet/EditTearsheetForm.d.ts +45 -2
- package/lib/components/EditTearsheet/EditTearsheetForm.js +3 -0
- package/lib/components/HTTPErrors/HTTPError403/HTTPError403.js +6 -0
- package/lib/components/HTTPErrors/HTTPError404/HTTPError404.js +6 -0
- package/lib/components/HTTPErrors/HTTPErrorOther/HTTPErrorOther.js +6 -0
- package/lib/components/PageHeader/PageHeader.js +1 -0
- package/lib/components/RemoveModal/RemoveModal.d.ts +4 -0
- package/lib/components/RemoveModal/RemoveModal.js +7 -1
- package/lib/components/StatusIndicator/StatusIndicatorStep.js +94 -0
- package/lib/components/Tearsheet/Tearsheet.d.ts +8 -1
- package/lib/components/Tearsheet/Tearsheet.js +9 -1
- package/lib/components/Tearsheet/TearsheetNarrow.d.ts +11 -0
- package/lib/components/Tearsheet/TearsheetNarrow.js +12 -0
- package/lib/components/Tearsheet/TearsheetShell.d.ts +10 -0
- package/lib/components/Tearsheet/TearsheetShell.js +16 -2
- package/lib/components/Toolbar/ToolbarButton.js +1 -1
- package/lib/components/index.d.ts +1 -1
- package/lib/index.js +5 -0
- package/package.json +7 -6
- package/scss/components/ConditionBuilder/styles/_conditionBuilderCondition.scss +9 -1
- package/scss/components/ConditionBuilder/styles/_conditionBuilderItem.scss +26 -1
- package/scss/components/DataSpreadsheet/_data-spreadsheet.scss +8 -0
- package/scss/components/Datagrid/styles/_useInlineEdit.scss +13 -0
- package/scss/components/StatusIcon/_status-icon.scss +4 -4
- package/scss/components/StringFormatter/_string-formatter.scss +2 -2
- package/scss/components/UserProfileImage/_user-profile-image.scss +6 -2
- package/telemetry.yml +15 -3
- package/es/components/ConditionBuilder/utils/checkForHoldingKey.d.ts +0 -1
- package/es/components/ConditionBuilder/utils/checkForHoldingKey.js +0 -16
- package/lib/components/ConditionBuilder/utils/checkForHoldingKey.d.ts +0 -1
- package/lib/components/ConditionBuilder/utils/checkForHoldingKey.js +0 -20
@@ -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,
|
@@ -121,15 +123,19 @@ exports.DataSpreadsheet = /*#__PURE__*/React__default["default"].forwardRef(func
|
|
121
123
|
_useState18 = _rollupPluginBabelHelpers.slicedToArray(_useState17, 2),
|
122
124
|
headerCellHoldActive = _useState18[0],
|
123
125
|
setHeaderCellHoldActive = _useState18[1];
|
124
|
-
var isBlurSpreadsheet = React.useRef(false);
|
125
126
|
var _useState19 = React.useState(false),
|
126
127
|
_useState20 = _rollupPluginBabelHelpers.slicedToArray(_useState19, 2),
|
127
|
-
|
128
|
-
|
128
|
+
selectedHeaderReorderActive = _useState20[0],
|
129
|
+
setSelectedHeaderReorderActive = _useState20[1];
|
130
|
+
var isBlurSpreadsheet = React.useRef(false);
|
129
131
|
var _useState21 = React.useState(false),
|
130
132
|
_useState22 = _rollupPluginBabelHelpers.slicedToArray(_useState21, 2),
|
131
|
-
|
132
|
-
|
133
|
+
isActiveHeaderCellChanged = _useState22[0],
|
134
|
+
setIsActiveHeaderCellChanged = _useState22[1];
|
135
|
+
var _useState23 = React.useState(false),
|
136
|
+
_useState24 = _rollupPluginBabelHelpers.slicedToArray(_useState23, 2),
|
137
|
+
activeCellInsideSelectionArea = _useState24[0],
|
138
|
+
setActiveCellInsideSelectionArea = _useState24[1];
|
133
139
|
var previousState = usePreviousValue.usePreviousValue({
|
134
140
|
activeCellCoordinates: activeCellCoordinates,
|
135
141
|
isEditing: isEditing,
|
@@ -137,19 +143,21 @@ exports.DataSpreadsheet = /*#__PURE__*/React__default["default"].forwardRef(func
|
|
137
143
|
}) || {};
|
138
144
|
var cellSizeValue = getCellSize.getCellSize(cellSize);
|
139
145
|
var cellEditorRef = React.useRef();
|
140
|
-
var
|
141
|
-
|
142
|
-
activeCellContent =
|
143
|
-
setActiveCellContent =
|
146
|
+
var _useState25 = React.useState(),
|
147
|
+
_useState26 = _rollupPluginBabelHelpers.slicedToArray(_useState25, 2),
|
148
|
+
activeCellContent = _useState26[0],
|
149
|
+
setActiveCellContent = _useState26[1];
|
144
150
|
var activeCellRef = React.useRef();
|
145
151
|
var cellEditorRulerRef = React.useRef();
|
152
|
+
var hasCustomRowHeader = typeof renderRowHeader === 'function';
|
153
|
+
var maxNumRowsCount = data.length.toString().length;
|
146
154
|
var defaultColumn = React.useMemo(function () {
|
147
155
|
return {
|
148
156
|
width: 150,
|
149
|
-
rowHeaderWidth: 64,
|
157
|
+
rowHeaderWidth: hasCustomRowHeader ? 40 + maxNumRowsCount * 8.56 : 64,
|
150
158
|
rowHeight: cellSizeValue
|
151
159
|
};
|
152
|
-
}, [cellSizeValue]);
|
160
|
+
}, [cellSizeValue, hasCustomRowHeader, maxNumRowsCount]);
|
153
161
|
var _useMultipleKeyTracki = useMultipleKeyTracking.useMultipleKeyTracking({
|
154
162
|
ref: multiKeyTrackingRef,
|
155
163
|
containerHasFocus: containerHasFocus,
|
@@ -216,9 +224,12 @@ exports.DataSpreadsheet = /*#__PURE__*/React__default["default"].forwardRef(func
|
|
216
224
|
}
|
217
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)) {
|
218
226
|
if (activeCellCoordinates && (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) !== 'header' && (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) !== 'header') {
|
219
|
-
var _activeCellFullData$r;
|
220
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;
|
221
|
-
|
228
|
+
if (activeCellFullData) {
|
229
|
+
setActiveCellContent(activeCellFullData.render('Cell'));
|
230
|
+
} else {
|
231
|
+
setActiveCellContent(null);
|
232
|
+
}
|
222
233
|
}
|
223
234
|
if (activeCellCoordinates && (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'header' || (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === 'header') {
|
224
235
|
setActiveCellContent(null);
|
@@ -433,8 +444,8 @@ exports.DataSpreadsheet = /*#__PURE__*/React__default["default"].forwardRef(func
|
|
433
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;
|
434
445
|
var activeCellValue;
|
435
446
|
if (activeCellFullData && activeCellCoordinates !== null && activeCellCoordinates !== void 0 && activeCellCoordinates.column) {
|
436
|
-
var _activeCellFullData$
|
437
|
-
activeCellValue = activeCellFullData ? (_activeCellFullData$
|
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;
|
438
449
|
}
|
439
450
|
setCellEditorValue(activeCellValue || '');
|
440
451
|
if (cellEditorRulerRef !== null && cellEditorRulerRef !== void 0 && cellEditorRulerRef.current) {
|
@@ -624,6 +635,8 @@ exports.DataSpreadsheet = /*#__PURE__*/React__default["default"].forwardRef(func
|
|
624
635
|
columns: columns,
|
625
636
|
currentMatcher: currentMatcher,
|
626
637
|
defaultColumn: defaultColumn,
|
638
|
+
selectedHeaderReorderActive: selectedHeaderReorderActive,
|
639
|
+
setSelectedHeaderReorderActive: setSelectedHeaderReorderActive,
|
627
640
|
headerGroups: headerGroups,
|
628
641
|
rows: rows,
|
629
642
|
scrollBarSize: scrollBarSize,
|
@@ -647,12 +660,17 @@ exports.DataSpreadsheet = /*#__PURE__*/React__default["default"].forwardRef(func
|
|
647
660
|
currentMatcher: currentMatcher,
|
648
661
|
setCurrentMatcher: setCurrentMatcher,
|
649
662
|
setContainerHasFocus: setContainerHasFocus,
|
663
|
+
selectedHeaderReorderActive: selectedHeaderReorderActive,
|
664
|
+
setSelectedHeaderReorderActive: setSelectedHeaderReorderActive,
|
650
665
|
selectionAreas: selectionAreas,
|
651
666
|
setSelectionAreas: setSelectionAreas,
|
652
667
|
headerGroups: headerGroups,
|
653
668
|
defaultColumn: defaultColumn,
|
654
669
|
getTableBodyProps: getTableBodyProps,
|
670
|
+
hasCustomRowHeader: hasCustomRowHeader,
|
655
671
|
onDataUpdate: onDataUpdate,
|
672
|
+
renderRowHeaderDirection: renderRowHeaderDirection,
|
673
|
+
renderRowHeader: renderRowHeader,
|
656
674
|
onActiveCellChange: onActiveCellChange,
|
657
675
|
onSelectionAreaChange: onSelectionAreaChange,
|
658
676
|
prepareRow: prepareRow,
|
@@ -697,9 +715,11 @@ exports.DataSpreadsheet = /*#__PURE__*/React__default["default"].forwardRef(func
|
|
697
715
|
updateData: updateData
|
698
716
|
}),
|
699
717
|
onChange: function onChange(event) {
|
700
|
-
|
701
|
-
|
702
|
-
cellEditorRulerRef.current
|
718
|
+
if (previousState.isEditing) {
|
719
|
+
setCellEditorValue(event.target.value);
|
720
|
+
if (cellEditorRulerRef !== null && cellEditorRulerRef !== void 0 && cellEditorRulerRef.current) {
|
721
|
+
cellEditorRulerRef.current.textContent = event.target.value;
|
722
|
+
}
|
703
723
|
}
|
704
724
|
},
|
705
725
|
ref: cellEditorRef,
|
@@ -749,6 +769,10 @@ exports.DataSpreadsheet.propTypes = {
|
|
749
769
|
* Sets the number of empty rows to be created when there is no data provided
|
750
770
|
*/
|
751
771
|
defaultEmptyRowCount: index["default"].number,
|
772
|
+
/**
|
773
|
+
* Check if spreadsheet is using custom row header component attached
|
774
|
+
*/
|
775
|
+
hasCustomRowHeader: index["default"].bool,
|
752
776
|
/**
|
753
777
|
* The spreadsheet id
|
754
778
|
*/
|
@@ -765,6 +789,14 @@ exports.DataSpreadsheet.propTypes = {
|
|
765
789
|
* The event handler that is called when the selection area values change
|
766
790
|
*/
|
767
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']),
|
768
800
|
/**
|
769
801
|
* The aria label applied to the Select all button
|
770
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
|
*/
|
@@ -79,7 +91,15 @@ interface DataSpreadsheetBodyProps {
|
|
79
91
|
/**
|
80
92
|
* Array of selection area data
|
81
93
|
*/
|
82
|
-
selectionAreaData?:
|
94
|
+
selectionAreaData?: any[];
|
95
|
+
/**
|
96
|
+
* Header reordering is active
|
97
|
+
*/
|
98
|
+
selectedHeaderReorderActive?: boolean;
|
99
|
+
/**
|
100
|
+
* Set header reordering active or not
|
101
|
+
*/
|
102
|
+
setSelectedHeaderReorderActive?: Dispatch<SetStateAction<boolean>>;
|
83
103
|
/**
|
84
104
|
* Array of selection areas
|
85
105
|
*/
|
@@ -44,11 +44,16 @@ var DataSpreadsheetBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
44
44
|
headerGroups = _ref.headerGroups,
|
45
45
|
id = _ref.id,
|
46
46
|
onDataUpdate = _ref.onDataUpdate,
|
47
|
+
renderRowHeader = _ref.renderRowHeader,
|
48
|
+
renderRowHeaderDirection = _ref.renderRowHeaderDirection,
|
49
|
+
hasCustomRowHeader = _ref.hasCustomRowHeader,
|
47
50
|
prepareRow = _ref.prepareRow,
|
48
51
|
rows = _ref.rows,
|
49
52
|
selectionAreaData = _ref.selectionAreaData,
|
50
53
|
setSelectionAreaData = _ref.setSelectionAreaData,
|
51
54
|
setActiveCellCoordinates = _ref.setActiveCellCoordinates,
|
55
|
+
selectedHeaderReorderActive = _ref.selectedHeaderReorderActive,
|
56
|
+
setSelectedHeaderReorderActive = _ref.setSelectedHeaderReorderActive,
|
52
57
|
selectionAreas = _ref.selectionAreas,
|
53
58
|
setContainerHasFocus = _ref.setContainerHasFocus,
|
54
59
|
setSelectionAreas = _ref.setSelectionAreas,
|
@@ -84,8 +89,12 @@ var DataSpreadsheetBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
84
89
|
// back to the consumer
|
85
90
|
React.useEffect(function () {
|
86
91
|
if (selectionAreaData !== null && selectionAreaData !== void 0 && selectionAreaData.length) {
|
87
|
-
var _previousState$select;
|
88
|
-
|
92
|
+
var _previousState$select, _selectionAreaData$, _previousState$select2;
|
93
|
+
var selectionChanged = false;
|
94
|
+
if ((previousState === null || previousState === void 0 || (_previousState$select = previousState.selectionAreaData) === null || _previousState$select === void 0 ? void 0 : _previousState$select.length) !== (selectionAreaData === null || selectionAreaData === void 0 ? void 0 : selectionAreaData.length) || (selectionAreaData === null || selectionAreaData === void 0 || (_selectionAreaData$ = selectionAreaData[0]) === null || _selectionAreaData$ === void 0 ? void 0 : _selectionAreaData$.cells.length) !== (previousState === null || previousState === void 0 || (_previousState$select2 = previousState.selectionAreaData) === null || _previousState$select2 === void 0 || (_previousState$select2 = _previousState$select2[0]) === null || _previousState$select2 === void 0 ? void 0 : _previousState$select2.cells.length)) {
|
95
|
+
selectionChanged = true;
|
96
|
+
}
|
97
|
+
if (!clickAndHoldActive && previousState !== null && previousState !== void 0 && previousState.clickAndHoldActive || selectionChanged) {
|
89
98
|
onSelectionAreaChange === null || onSelectionAreaChange === void 0 || onSelectionAreaChange(selectionAreaData);
|
90
99
|
}
|
91
100
|
}
|
@@ -141,7 +150,7 @@ var DataSpreadsheetBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
141
150
|
return;
|
142
151
|
});
|
143
152
|
}
|
144
|
-
}, [selectionAreas, setSelectionAreas, defaultColumn, onSelectionAreaChange, setSelectionAreaData, ref, activeCellCoordinates, setActiveCellInsideSelectionArea, visibleColumns]);
|
153
|
+
}, [selectionAreas, setSelectionAreas, defaultColumn, onSelectionAreaChange, setSelectionAreaData, ref, activeCellCoordinates, setActiveCellInsideSelectionArea, visibleColumns, hasCustomRowHeader]);
|
145
154
|
var populateSelectionAreaCellData = function populateSelectionAreaCellData(_ref2) {
|
146
155
|
var rowStart = _ref2.rowStart,
|
147
156
|
rowEnd = _ref2.rowEnd,
|
@@ -160,6 +169,8 @@ var DataSpreadsheetBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
160
169
|
setClickAndHoldActive: setClickAndHoldActive,
|
161
170
|
setSelectionAreas: setSelectionAreas,
|
162
171
|
setValidStartingPoint: setValidStartingPoint,
|
172
|
+
selectedHeaderReorderActive: selectedHeaderReorderActive,
|
173
|
+
setSelectedHeaderReorderActive: setSelectedHeaderReorderActive,
|
163
174
|
validStartingPoint: validStartingPoint,
|
164
175
|
ref: ref,
|
165
176
|
setHeaderCellHoldActive: setHeaderCellHoldActive,
|
@@ -213,7 +224,7 @@ var DataSpreadsheetBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
213
224
|
});
|
214
225
|
}
|
215
226
|
}
|
216
|
-
}, [defaultColumn, ref, activeCellCoordinates, previousState === null || previousState === void 0 ? void 0 : previousState.rowHeight, selectionAreas, setActiveCellInsideSelectionArea, setSelectionAreas, visibleColumns]);
|
227
|
+
}, [defaultColumn, ref, activeCellCoordinates, previousState === null || previousState === void 0 ? void 0 : previousState.rowHeight, selectionAreas, setActiveCellInsideSelectionArea, setSelectionAreas, visibleColumns, hasCustomRowHeader]);
|
217
228
|
|
218
229
|
//this method will check for any duplicate selection area and remove.
|
219
230
|
//same selections are those have the same height, width, top, left styles. These inline styles are being set in createCellSelection util.
|
@@ -339,11 +350,12 @@ var DataSpreadsheetBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
339
350
|
"data-column-index": "header",
|
340
351
|
type: "button",
|
341
352
|
onClick: handleRowHeaderClickEvent(index),
|
342
|
-
className: cx__default["default"]("".concat(blockClass, "__td"), "".concat(blockClass, "__td-th"), "".concat(blockClass, "--interactive-cell-element"), _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__td-th--active-header"), (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === index || checkActiveHeaderCell.checkActiveHeaderCell(index, selectionAreas, 'row')), "".concat(blockClass, "__td-th--selected-header"), checkSelectedHeaderCell.checkSelectedHeaderCell(index, selectionAreas, 'row', columns))),
|
353
|
+
className: cx__default["default"]("".concat(blockClass, "__td"), "".concat(blockClass, "__td-th"), "".concat(blockClass, "--interactive-cell-element"), _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__td_custom"), hasCustomRowHeader ? true : false), "".concat(blockClass, "__td-th--active-header"), !hasCustomRowHeader && ((activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === index || checkActiveHeaderCell.checkActiveHeaderCell(index, selectionAreas, 'row'))), "".concat(blockClass, "__td-th--selected-header"), !hasCustomRowHeader && checkSelectedHeaderCell.checkSelectedHeaderCell(index, selectionAreas, 'row', columns))),
|
343
354
|
style: {
|
344
|
-
width: defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.rowHeaderWidth
|
355
|
+
width: defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.rowHeaderWidth,
|
356
|
+
flexDirection: hasCustomRowHeader ? renderRowHeaderDirection === 'Left' ? 'row-reverse' : row : undefined
|
345
357
|
}
|
346
|
-
}, index + 1)), row.cells.map(function (cell, index) {
|
358
|
+
}, index + 1, hasCustomRowHeader && typeof renderRowHeader === 'function' && renderRowHeader(index))), row.cells.map(function (cell, index) {
|
347
359
|
var _cell$column;
|
348
360
|
var cellProps = propsHelper.prepareProps(cell.getCellProps(), 'key');
|
349
361
|
return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
|
@@ -368,7 +380,7 @@ var DataSpreadsheetBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
368
380
|
}, cell.render('Cell')));
|
369
381
|
}));
|
370
382
|
}
|
371
|
-
}, [prepareRow, rows, activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row, selectionAreas, handleRowHeaderClickEvent, handleBodyCellClickEvent, handleBodyCellHoverEvent, defaultColumn, columns]);
|
383
|
+
}, [prepareRow, renderRowHeader, renderRowHeaderDirection, rows, hasCustomRowHeader, activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row, selectionAreas, handleRowHeaderClickEvent, handleBodyCellClickEvent, handleBodyCellHoverEvent, defaultColumn, columns]);
|
372
384
|
var spreadsheetBodyRef = React.useRef();
|
373
385
|
return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
|
374
386
|
ref: spreadsheetBodyRef,
|
@@ -434,6 +446,10 @@ DataSpreadsheetBody.propTypes = {
|
|
434
446
|
*/
|
435
447
|
/**@ts-ignore */
|
436
448
|
getTableBodyProps: index["default"].func,
|
449
|
+
/**
|
450
|
+
* Check if spreadsheet is using custom row header component attached
|
451
|
+
*/
|
452
|
+
hasCustomRowHeader: index["default"].bool,
|
437
453
|
/**
|
438
454
|
* Headers provided from useTable hook
|
439
455
|
*/
|
@@ -458,6 +474,14 @@ DataSpreadsheetBody.propTypes = {
|
|
458
474
|
* Prepare row function from react-table
|
459
475
|
*/
|
460
476
|
prepareRow: index["default"].func,
|
477
|
+
/**
|
478
|
+
* Component next to numbering rows
|
479
|
+
*/
|
480
|
+
renderRowHeader: index["default"].func,
|
481
|
+
/**
|
482
|
+
* Component next to numbering rows
|
483
|
+
*/
|
484
|
+
renderRowHeaderDirection: index["default"].string,
|
461
485
|
/**
|
462
486
|
* All of the spreadsheet row data
|
463
487
|
*/
|
@@ -466,6 +490,10 @@ DataSpreadsheetBody.propTypes = {
|
|
466
490
|
* The scrollbar width
|
467
491
|
*/
|
468
492
|
scrollBarSize: index["default"].number,
|
493
|
+
/**
|
494
|
+
* Header reordering is active
|
495
|
+
*/
|
496
|
+
selectedHeaderReorderActive: index["default"].bool,
|
469
497
|
/**
|
470
498
|
* Array of selection area data
|
471
499
|
*/
|
@@ -502,6 +530,10 @@ DataSpreadsheetBody.propTypes = {
|
|
502
530
|
* Setter fn for header cell hold active value
|
503
531
|
*/
|
504
532
|
setHeaderCellHoldActive: index["default"].func,
|
533
|
+
/**
|
534
|
+
* Set header reordering active or not
|
535
|
+
*/
|
536
|
+
setSelectedHeaderReorderActive: index["default"].func,
|
505
537
|
/**
|
506
538
|
* Setter fn for selectionAreaData state value
|
507
539
|
*/
|
@@ -56,6 +56,14 @@ interface DataSpreadsheetHeaderProps {
|
|
56
56
|
* Setter fn for activeCellCoordinates value
|
57
57
|
*/
|
58
58
|
setActiveCellCoordinates?: Dispatch<SetStateAction<ActiveCellCoordinates | null>>;
|
59
|
+
/**
|
60
|
+
* Header reordering is active
|
61
|
+
*/
|
62
|
+
selectedHeaderReorderActive?: boolean;
|
63
|
+
/**
|
64
|
+
* Set header reordering active or not
|
65
|
+
*/
|
66
|
+
setSelectedHeaderReorderActive?: Dispatch<SetStateAction<boolean>>;
|
59
67
|
/**
|
60
68
|
* Setter fn for currentMatcher value
|
61
69
|
*/
|
@@ -40,6 +40,8 @@ var DataSpreadsheetHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
40
40
|
headerGroups = _ref.headerGroups,
|
41
41
|
scrollBarSize = _ref.scrollBarSize,
|
42
42
|
selectionAreas = _ref.selectionAreas,
|
43
|
+
selectedHeaderReorderActive = _ref.selectedHeaderReorderActive,
|
44
|
+
setSelectedHeaderReorderActive = _ref.setSelectedHeaderReorderActive,
|
43
45
|
setActiveCellCoordinates = _ref.setActiveCellCoordinates,
|
44
46
|
setCurrentMatcher = _ref.setCurrentMatcher,
|
45
47
|
setSelectionAreas = _ref.setSelectionAreas,
|
@@ -55,10 +57,6 @@ var DataSpreadsheetHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
55
57
|
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
56
58
|
scrollBarSizeValue = _useState2[0],
|
57
59
|
setScrollBarSizeValue = _useState2[1];
|
58
|
-
var _useState3 = React.useState(false),
|
59
|
-
_useState4 = _rollupPluginBabelHelpers.slicedToArray(_useState3, 2),
|
60
|
-
selectedHeaderReorderActive = _useState4[0],
|
61
|
-
setSelectedHeaderReorderActive = _useState4[1];
|
62
60
|
var previousState = usePreviousValue.usePreviousValue({
|
63
61
|
cellSize: cellSize
|
64
62
|
}) || {};
|
@@ -116,11 +114,16 @@ var DataSpreadsheetHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
116
114
|
// Remove columns, need to call handleHeaderCellSelection
|
117
115
|
return;
|
118
116
|
}
|
119
|
-
setSelectedHeaderReorderActive(true);
|
120
117
|
var selectionAreaToClone = selectionAreas === null || selectionAreas === void 0 ? void 0 : selectionAreas.filter(function (item) {
|
121
118
|
return (item === null || item === void 0 ? void 0 : item.matcher) === currentMatcher;
|
122
119
|
});
|
123
120
|
var selectionAreaElement = ref.current.querySelector("[data-matcher-id=\"".concat(selectionAreaToClone === null || selectionAreaToClone === void 0 || (_selectionAreaToClone = selectionAreaToClone[0]) === null || _selectionAreaToClone === void 0 ? void 0 : _selectionAreaToClone.matcher, "\"]"));
|
121
|
+
if (selectionAreaElement) {
|
122
|
+
selectionAreaElement.classList.add("".concat(blockClass, "__selection-area--element"));
|
123
|
+
}
|
124
|
+
if (typeof setSelectedHeaderReorderActive === 'function') {
|
125
|
+
setSelectedHeaderReorderActive(true);
|
126
|
+
}
|
124
127
|
var clickXPosition = event.clientX;
|
125
128
|
var headerButtonCoords = event.target.getBoundingClientRect();
|
126
129
|
var headerIndex = event.target.getAttribute('data-column-index');
|
@@ -181,6 +184,9 @@ var DataSpreadsheetHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
181
184
|
"data-row-index": "header",
|
182
185
|
"data-column-index": "header",
|
183
186
|
type: "button",
|
187
|
+
style: {
|
188
|
+
width: defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.rowHeaderWidth
|
189
|
+
},
|
184
190
|
tabIndex: -1,
|
185
191
|
"aria-label": selectAllAriaLabel,
|
186
192
|
onClick: handleSelectAllClick,
|
@@ -198,7 +204,7 @@ var DataSpreadsheetHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
198
204
|
"data-column-index": index,
|
199
205
|
tabIndex: -1,
|
200
206
|
onMouseDown: selectedHeader ? handleHeaderMouseDown(index) : undefined,
|
201
|
-
onMouseUp: selectedHeader ? function () {
|
207
|
+
onMouseUp: selectedHeader && typeof setSelectedHeaderReorderActive === 'function' ? function () {
|
202
208
|
return setSelectedHeaderReorderActive(false);
|
203
209
|
} : undefined,
|
204
210
|
onClick: !selectedHeader ? handleColumnHeaderClick(index) : undefined,
|
@@ -263,6 +269,10 @@ DataSpreadsheetHeader.propTypes = {
|
|
263
269
|
* The aria label applied to the Select all button
|
264
270
|
*/
|
265
271
|
selectAllAriaLabel: index["default"].string.isRequired,
|
272
|
+
/**
|
273
|
+
* Header reordering is active
|
274
|
+
*/
|
275
|
+
selectedHeaderReorderActive: index["default"].bool,
|
266
276
|
/**
|
267
277
|
* All of the cell selection area items
|
268
278
|
*/
|
@@ -280,6 +290,10 @@ DataSpreadsheetHeader.propTypes = {
|
|
280
290
|
* Setter fn for header cell hold active value
|
281
291
|
*/
|
282
292
|
setHeaderCellHoldActive: index["default"].func,
|
293
|
+
/**
|
294
|
+
* Set header reordering active or not
|
295
|
+
*/
|
296
|
+
setSelectedHeaderReorderActive: index["default"].func,
|
283
297
|
/**
|
284
298
|
* Setter fn for selectionAreaData state value
|
285
299
|
*/
|
@@ -44,9 +44,12 @@ var useSpreadsheetMouseMove = function useSpreadsheetMouseMove(_ref) {
|
|
44
44
|
var totalSpreadsheetScrollingWidth = listContainer.scrollWidth;
|
45
45
|
var clonedSelectionWidth = clonedSelectionElement.offsetWidth;
|
46
46
|
var clonePlacement = Math.max(xPositionRelativeToSpreadsheet - offsetXValue, defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.rowHeaderWidth);
|
47
|
+
var leftPosition = totalSpreadsheetScrollingWidth - clonedSelectionWidth >= clonePlacement ? clonePlacement + scrollAmount : totalSpreadsheetScrollingWidth - clonedSelectionWidth;
|
47
48
|
// Moves the position of the cloned selection area to follow mouse, and
|
48
49
|
// add the amount horizontally scrolled
|
49
|
-
|
50
|
+
if (leftPosition < spreadsheetCoords.right - 40) {
|
51
|
+
clonedSelectionElement.style.left = layout.px(leftPosition);
|
52
|
+
}
|
50
53
|
};
|
51
54
|
if (headerCellHoldActive) {
|
52
55
|
ref.current.addEventListener('mousemove', handleMouseMove);
|
@@ -1,6 +1,8 @@
|
|
1
|
-
export function useSpreadsheetMouseUp({ currentMatcher, setSelectionAreas, setClickAndHoldActive, setValidStartingPoint, validStartingPoint, blockClass, ref, setHeaderCellHoldActive, setColumnOrder, visibleColumns, setActiveCellCoordinates, activeCellCoordinates, rows, defaultColumn, selectionAreas, }: {
|
1
|
+
export function useSpreadsheetMouseUp({ currentMatcher, setSelectionAreas, selectedHeaderReorderActive, setSelectedHeaderReorderActive, setClickAndHoldActive, setValidStartingPoint, validStartingPoint, blockClass, ref, setHeaderCellHoldActive, setColumnOrder, visibleColumns, setActiveCellCoordinates, activeCellCoordinates, rows, defaultColumn, selectionAreas, }: {
|
2
2
|
currentMatcher: any;
|
3
3
|
setSelectionAreas: any;
|
4
|
+
selectedHeaderReorderActive: any;
|
5
|
+
setSelectedHeaderReorderActive: any;
|
4
6
|
setClickAndHoldActive: any;
|
5
7
|
setValidStartingPoint: any;
|
6
8
|
validStartingPoint: any;
|
@@ -18,6 +18,8 @@ var deepCloneObject = require('../../../global/js/utils/deepCloneObject.js');
|
|
18
18
|
var useSpreadsheetMouseUp = function useSpreadsheetMouseUp(_ref) {
|
19
19
|
var currentMatcher = _ref.currentMatcher,
|
20
20
|
setSelectionAreas = _ref.setSelectionAreas,
|
21
|
+
selectedHeaderReorderActive = _ref.selectedHeaderReorderActive,
|
22
|
+
setSelectedHeaderReorderActive = _ref.setSelectedHeaderReorderActive,
|
21
23
|
setClickAndHoldActive = _ref.setClickAndHoldActive,
|
22
24
|
setValidStartingPoint = _ref.setValidStartingPoint,
|
23
25
|
validStartingPoint = _ref.validStartingPoint,
|
@@ -34,15 +36,22 @@ var useSpreadsheetMouseUp = function useSpreadsheetMouseUp(_ref) {
|
|
34
36
|
selectionAreas = _ref.selectionAreas;
|
35
37
|
React.useEffect(function () {
|
36
38
|
var handleMouseUp = function handleMouseUp(event) {
|
39
|
+
var _selectionAreas$;
|
40
|
+
var isHoldingColumn = false;
|
41
|
+
if (selectionAreas !== null && selectionAreas !== void 0 && (_selectionAreas$ = selectionAreas[0]) !== null && _selectionAreas$ !== void 0 && _selectionAreas$.header && selectionAreas[0].header.type === 'column') {
|
42
|
+
isHoldingColumn = true;
|
43
|
+
}
|
37
44
|
// Remove the cloned selection area on mouse up
|
38
|
-
if (!validStartingPoint) {
|
45
|
+
if (!validStartingPoint && isHoldingColumn) {
|
39
46
|
setHeaderCellHoldActive(false);
|
47
|
+
var selectionAreaElement = ref.current.querySelector(".".concat(blockClass, "__selection-area--element"));
|
40
48
|
var selectionAreaCloneElement = ref.current.querySelector(".".concat(blockClass, "__selection-area--element-cloned"));
|
41
49
|
if (!selectionAreaCloneElement) {
|
42
50
|
return;
|
43
51
|
}
|
44
52
|
// Mouse up while a cloned selection area exists/a column is being reordered
|
45
53
|
if (selectionAreaCloneElement) {
|
54
|
+
var _selectionAreaElement;
|
46
55
|
var closestCell = event.target.closest(".".concat(blockClass, "--interactive-cell-element"));
|
47
56
|
var newColumnIndex = parseInt === null || parseInt === void 0 ? void 0 : parseInt(closestCell === null || closestCell === void 0 ? void 0 : closestCell.getAttribute('data-column-index'));
|
48
57
|
var originalColumnIndex = parseInt === null || parseInt === void 0 ? void 0 : parseInt(selectionAreaCloneElement === null || selectionAreaCloneElement === void 0 ? void 0 : selectionAreaCloneElement.getAttribute('data-column-index-original'));
|
@@ -85,6 +94,7 @@ var useSpreadsheetMouseUp = function useSpreadsheetMouseUp(_ref) {
|
|
85
94
|
selectionAreaClone[indexOfItemToUpdate].point1.column = Math.min.apply(Math, _rollupPluginBabelHelpers.toConsumableArray(newIndexArray));
|
86
95
|
selectionAreaClone[indexOfItemToUpdate].point2.column = Math.max.apply(Math, _rollupPluginBabelHelpers.toConsumableArray(newIndexArray));
|
87
96
|
}
|
97
|
+
selectionAreaClone[indexOfItemToUpdate].areaCreated = false;
|
88
98
|
return selectionAreaClone;
|
89
99
|
});
|
90
100
|
// Only reorder columns if the new index is _not_ part of the
|
@@ -129,11 +139,13 @@ var useSpreadsheetMouseUp = function useSpreadsheetMouseUp(_ref) {
|
|
129
139
|
var indicatorLineElement = ref.current.querySelector(".".concat(blockClass, "__reorder-indicator-line"));
|
130
140
|
indicatorLineElement === null || indicatorLineElement === void 0 || indicatorLineElement.remove();
|
131
141
|
selectionAreaCloneElement === null || selectionAreaCloneElement === void 0 || selectionAreaCloneElement.remove();
|
142
|
+
selectionAreaElement === null || selectionAreaElement === void 0 || (_selectionAreaElement = selectionAreaElement.classList) === null || _selectionAreaElement === void 0 || _selectionAreaElement.remove("".concat(blockClass, "__selection-area--element"));
|
143
|
+
setSelectedHeaderReorderActive(false);
|
132
144
|
}
|
133
145
|
}
|
134
146
|
// Mouse up was on a spreadsheet body cell which is a valid
|
135
147
|
// start/end point for creating a selection area
|
136
|
-
if (validStartingPoint) {
|
148
|
+
if (validStartingPoint || event.type === 'mouseup') {
|
137
149
|
setClickAndHoldActive(false);
|
138
150
|
setValidStartingPoint(false);
|
139
151
|
var cellButton = event.target.closest(".".concat(blockClass, "__body--td"));
|
@@ -162,7 +174,7 @@ var useSpreadsheetMouseUp = function useSpreadsheetMouseUp(_ref) {
|
|
162
174
|
return function () {
|
163
175
|
document.removeEventListener('mouseup', handleMouseUp);
|
164
176
|
};
|
165
|
-
}, [blockClass, currentMatcher, setSelectionAreas, setClickAndHoldActive, setValidStartingPoint, validStartingPoint, ref, setHeaderCellHoldActive, setColumnOrder, visibleColumns, setActiveCellCoordinates, activeCellCoordinates, rows, defaultColumn, selectionAreas]);
|
177
|
+
}, [blockClass, currentMatcher, setSelectionAreas, setClickAndHoldActive, setValidStartingPoint, validStartingPoint, selectedHeaderReorderActive, setSelectedHeaderReorderActive, ref, setHeaderCellHoldActive, setColumnOrder, visibleColumns, setActiveCellCoordinates, activeCellCoordinates, rows, defaultColumn, selectionAreas]);
|
166
178
|
};
|
167
179
|
|
168
180
|
exports.useSpreadsheetMouseUp = useSpreadsheetMouseUp;
|
@@ -13,7 +13,7 @@ export interface PrevState {
|
|
13
13
|
cellEditorValue?: string;
|
14
14
|
activeCellCoordinates?: ActiveCellCoordinates;
|
15
15
|
isEditing?: boolean;
|
16
|
-
selectionAreaData?:
|
16
|
+
selectionAreaData?: any[];
|
17
17
|
clickAndHoldActive?: boolean;
|
18
18
|
rowHeight?: number;
|
19
19
|
cellSize?: Size;
|
@@ -26,11 +26,43 @@ var moveColumnIndicatorLine = function moveColumnIndicatorLine(_ref) {
|
|
26
26
|
var indicatorLineElement = ref.current.querySelector(".".concat(blockClass, "__reorder-indicator-line"));
|
27
27
|
var matcherId = clonedSelectionElement === null || clonedSelectionElement === void 0 ? void 0 : clonedSelectionElement.getAttribute('data-matcher-id');
|
28
28
|
var selectionAreaOrigin = ref.current.querySelector("[data-matcher-id=\"".concat(matcherId, "\"]"));
|
29
|
+
var listContainer = ref.current.querySelector(".".concat(blockClass, "__list--container"));
|
30
|
+
var scrollSpeed = 10; // Scrolling speed
|
31
|
+
var leftEdgeThreshold = 120; // Distance from the left edge to start scrolling
|
32
|
+
var rightEdgeThreshold = 100; // Distance from the right edge to start scrolling
|
33
|
+
|
34
|
+
var _event = event,
|
35
|
+
clientX = _event.clientX;
|
36
|
+
var _listContainer$getBou = listContainer.getBoundingClientRect(),
|
37
|
+
left = _listContainer$getBou.left,
|
38
|
+
right = _listContainer$getBou.right;
|
39
|
+
|
40
|
+
// Is near left side of viewport
|
41
|
+
if (clientX < leftEdgeThreshold) {
|
42
|
+
window.scrollBy(-scrollSpeed, 0);
|
43
|
+
}
|
44
|
+
|
45
|
+
// Is near right side of viewport
|
46
|
+
if (clientX > window.innerWidth - rightEdgeThreshold) {
|
47
|
+
window.scrollBy(scrollSpeed, 0);
|
48
|
+
}
|
49
|
+
|
50
|
+
// Is near left edge of table
|
51
|
+
if (clientX > left && clientX < left + leftEdgeThreshold) {
|
52
|
+
listContainer.scrollBy(-scrollSpeed, 0);
|
53
|
+
}
|
54
|
+
|
55
|
+
// Is near right edge of table
|
56
|
+
if (clientX < right && clientX > right - rightEdgeThreshold) {
|
57
|
+
listContainer.scrollBy(scrollSpeed, 0);
|
58
|
+
}
|
29
59
|
if (Number(newColumnIndex) > Number(originalColumnIndex)) {
|
30
|
-
|
60
|
+
var leftPosition = closestCellCoords.left - spreadsheetCoords.left + closestCell.offsetWidth - 2 + leftScrollAmount;
|
61
|
+
indicatorLineElement.style.left = layout.px(leftPosition);
|
31
62
|
}
|
32
63
|
if (Number(newColumnIndex) < Number(originalColumnIndex)) {
|
33
|
-
|
64
|
+
var _leftPosition = closestCellCoords.left - spreadsheetCoords.left + leftScrollAmount;
|
65
|
+
indicatorLineElement.style.left = layout.px(_leftPosition);
|
34
66
|
}
|
35
67
|
if (Number(newColumnIndex) === Number(originalColumnIndex)) {
|
36
68
|
indicatorLineElement.style.left = selectionAreaOrigin.style.left;
|
@@ -16,10 +16,6 @@ export interface DatagridProps {
|
|
16
16
|
* The data grid state, much of it being supplied by the useDatagrid hook
|
17
17
|
*/
|
18
18
|
datagridState: DataGridState;
|
19
|
-
/**
|
20
|
-
* Table title
|
21
|
-
*/
|
22
|
-
title?: string;
|
23
19
|
}
|
24
20
|
/**
|
25
21
|
* 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.
|
@@ -25,7 +25,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
25
25
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
26
26
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
27
27
|
|
28
|
-
var _excluded = ["datagridState", "
|
28
|
+
var _excluded = ["datagridState", "ariaToolbarLabel"];
|
29
29
|
var blockClass = "".concat(settings.pkg.prefix, "--datagrid");
|
30
30
|
var componentName = 'Datagrid';
|
31
31
|
/**
|
@@ -33,7 +33,6 @@ var componentName = 'Datagrid';
|
|
33
33
|
*/
|
34
34
|
exports.Datagrid = /*#__PURE__*/React__default["default"].forwardRef(function (_ref, ref) {
|
35
35
|
var datagridState = _ref.datagridState,
|
36
|
-
title = _ref.title,
|
37
36
|
ariaToolbarLabel = _ref.ariaToolbarLabel,
|
38
37
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
39
38
|
if (!datagridState) {
|
@@ -49,13 +48,13 @@ exports.Datagrid = /*#__PURE__*/React__default["default"].forwardRef(function (_
|
|
49
48
|
state = datagridState.state;
|
50
49
|
var rows = DatagridPagination && datagridState.page || datagridState.rows;
|
51
50
|
var props = {
|
52
|
-
title: title,
|
53
51
|
datagridState: datagridState,
|
54
52
|
ariaToolbarLabel: ariaToolbarLabel
|
55
53
|
};
|
56
54
|
return /*#__PURE__*/React__default["default"].createElement(FilterProvider.FilterProvider, {
|
57
55
|
filters: state === null || state === void 0 ? void 0 : state.filters,
|
58
|
-
filterProps: filterProps
|
56
|
+
filterProps: filterProps,
|
57
|
+
tableId: tableId
|
59
58
|
}, /*#__PURE__*/React__default["default"].createElement(InlineEditContext.InlineEditProvider, null, /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({}, rest, {
|
60
59
|
id: tableId,
|
61
60
|
ref: ref,
|
@@ -81,9 +80,5 @@ exports.Datagrid.propTypes = {
|
|
81
80
|
* The data grid state, much of it being supplied by the useDatagrid hook
|
82
81
|
*/
|
83
82
|
/**@ts-ignore */
|
84
|
-
datagridState: index["default"].object.isRequired
|
85
|
-
/**
|
86
|
-
* Table title
|
87
|
-
*/
|
88
|
-
title: index["default"].string
|
83
|
+
datagridState: index["default"].object.isRequired
|
89
84
|
};
|
@@ -167,7 +167,7 @@ var DatagridContent = function DatagridContent(_ref) {
|
|
167
167
|
className: "".concat(blockClass, "__filter-summary"),
|
168
168
|
filters: filterTags,
|
169
169
|
clearFilters: function clearFilters() {
|
170
|
-
return EventEmitter.dispatch(constants.CLEAR_FILTERS);
|
170
|
+
return EventEmitter.dispatch(constants.CLEAR_FILTERS, tableId);
|
171
171
|
},
|
172
172
|
renderLabel: filterProps === null || filterProps === void 0 ? void 0 : filterProps.renderLabel,
|
173
173
|
overflowType: "tag"
|