@carbon/ibm-products 2.43.2-canary.7 → 2.43.2-canary.9
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 +1 -0
- 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.css +1 -0
- 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 +1 -0
- 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/DataSpreadsheet/DataSpreadsheet.js +5 -3
- package/es/components/DataSpreadsheet/hooks/useSpreadsheetMouseMove.js +4 -1
- package/es/components/DataSpreadsheet/utils/moveColumnIndicatorLine.js +34 -2
- package/lib/components/DataSpreadsheet/DataSpreadsheet.js +5 -3
- package/lib/components/DataSpreadsheet/hooks/useSpreadsheetMouseMove.js +4 -1
- package/lib/components/DataSpreadsheet/utils/moveColumnIndicatorLine.js +34 -2
- package/package.json +3 -3
- package/scss/components/DataSpreadsheet/_data-spreadsheet.scss +1 -0
@@ -22,11 +22,43 @@ var moveColumnIndicatorLine = function moveColumnIndicatorLine(_ref) {
|
|
22
22
|
var indicatorLineElement = ref.current.querySelector(".".concat(blockClass, "__reorder-indicator-line"));
|
23
23
|
var matcherId = clonedSelectionElement === null || clonedSelectionElement === void 0 ? void 0 : clonedSelectionElement.getAttribute('data-matcher-id');
|
24
24
|
var selectionAreaOrigin = ref.current.querySelector("[data-matcher-id=\"".concat(matcherId, "\"]"));
|
25
|
+
var listContainer = ref.current.querySelector(".".concat(blockClass, "__list--container"));
|
26
|
+
var scrollSpeed = 10; // Scrolling speed
|
27
|
+
var leftEdgeThreshold = 120; // Distance from the left edge to start scrolling
|
28
|
+
var rightEdgeThreshold = 100; // Distance from the right edge to start scrolling
|
29
|
+
|
30
|
+
var _event = event,
|
31
|
+
clientX = _event.clientX;
|
32
|
+
var _listContainer$getBou = listContainer.getBoundingClientRect(),
|
33
|
+
left = _listContainer$getBou.left,
|
34
|
+
right = _listContainer$getBou.right;
|
35
|
+
|
36
|
+
// Is near left side of viewport
|
37
|
+
if (clientX < leftEdgeThreshold) {
|
38
|
+
window.scrollBy(-scrollSpeed, 0);
|
39
|
+
}
|
40
|
+
|
41
|
+
// Is near right side of viewport
|
42
|
+
if (clientX > window.innerWidth - rightEdgeThreshold) {
|
43
|
+
window.scrollBy(scrollSpeed, 0);
|
44
|
+
}
|
45
|
+
|
46
|
+
// Is near left edge of table
|
47
|
+
if (clientX > left && clientX < left + leftEdgeThreshold) {
|
48
|
+
listContainer.scrollBy(-scrollSpeed, 0);
|
49
|
+
}
|
50
|
+
|
51
|
+
// Is near right edge of table
|
52
|
+
if (clientX < right && clientX > right - rightEdgeThreshold) {
|
53
|
+
listContainer.scrollBy(scrollSpeed, 0);
|
54
|
+
}
|
25
55
|
if (Number(newColumnIndex) > Number(originalColumnIndex)) {
|
26
|
-
|
56
|
+
var leftPosition = closestCellCoords.left - spreadsheetCoords.left + closestCell.offsetWidth - 2 + leftScrollAmount;
|
57
|
+
indicatorLineElement.style.left = px(leftPosition);
|
27
58
|
}
|
28
59
|
if (Number(newColumnIndex) < Number(originalColumnIndex)) {
|
29
|
-
|
60
|
+
var _leftPosition = closestCellCoords.left - spreadsheetCoords.left + leftScrollAmount;
|
61
|
+
indicatorLineElement.style.left = px(_leftPosition);
|
30
62
|
}
|
31
63
|
if (Number(newColumnIndex) === Number(originalColumnIndex)) {
|
32
64
|
indicatorLineElement.style.left = selectionAreaOrigin.style.left;
|
@@ -705,9 +705,11 @@ exports.DataSpreadsheet = /*#__PURE__*/React__default["default"].forwardRef(func
|
|
705
705
|
updateData: updateData
|
706
706
|
}),
|
707
707
|
onChange: function onChange(event) {
|
708
|
-
|
709
|
-
|
710
|
-
cellEditorRulerRef.current
|
708
|
+
if (previousState.isEditing) {
|
709
|
+
setCellEditorValue(event.target.value);
|
710
|
+
if (cellEditorRulerRef !== null && cellEditorRulerRef !== void 0 && cellEditorRulerRef.current) {
|
711
|
+
cellEditorRulerRef.current.textContent = event.target.value;
|
712
|
+
}
|
711
713
|
}
|
712
714
|
},
|
713
715
|
ref: cellEditorRef,
|
@@ -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);
|
@@ -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;
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@carbon/ibm-products",
|
3
3
|
"description": "Carbon for IBM Products",
|
4
|
-
"version": "2.43.2-canary.
|
4
|
+
"version": "2.43.2-canary.9+8a0d1a48a",
|
5
5
|
"license": "Apache-2.0",
|
6
6
|
"main": "lib/index.js",
|
7
7
|
"module": "es/index.js",
|
@@ -95,7 +95,7 @@
|
|
95
95
|
"dependencies": {
|
96
96
|
"@babel/runtime": "^7.23.9",
|
97
97
|
"@carbon/feature-flags": "^0.20.0",
|
98
|
-
"@carbon/ibm-products-styles": "^2.39.
|
98
|
+
"@carbon/ibm-products-styles": "^2.39.1-canary.19+8a0d1a48a",
|
99
99
|
"@carbon/telemetry": "^0.1.0",
|
100
100
|
"@dnd-kit/core": "^6.0.8",
|
101
101
|
"@dnd-kit/modifiers": "^7.0.0",
|
@@ -119,5 +119,5 @@
|
|
119
119
|
"react": "^16.8.6 || ^17.0.1 || ^18.2.0",
|
120
120
|
"react-dom": "^16.8.6 || ^17.0.1 || ^18.2.0"
|
121
121
|
},
|
122
|
-
"gitHead": "
|
122
|
+
"gitHead": "8a0d1a48aca63b9f5111c7c10abf0e385151a1ad"
|
123
123
|
}
|