@cloudscape-design/board-components 3.0.16 → 3.0.17
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/board/internal.js +2 -2
- package/board/transition.js +14 -5
- package/internal/base-component/use-visual-refresh.js +2 -3
- package/internal/environment.js +1 -1
- package/internal/manifest.json +1 -1
- package/package.json +1 -1
- package/internal/is-development.d.ts +0 -6
- package/internal/is-development.js +0 -8
- package/internal/logging.d.ts +0 -1
- package/internal/logging.js +0 -10
package/board/internal.js
CHANGED
|
@@ -91,7 +91,7 @@ export function InternalBoard({ items, renderItem, onItemsChange, empty, i18nStr
|
|
|
91
91
|
// If draggables can be of different types a check of some sort is required here.
|
|
92
92
|
draggableItem: draggableItem,
|
|
93
93
|
draggableRect: collisionRect,
|
|
94
|
-
collisionIds: interactionType === "
|
|
94
|
+
collisionIds: interactionType === "pointer" && isElementOverBoard(collisionRect) ? collisionIds : [],
|
|
95
95
|
});
|
|
96
96
|
autoScrollHandlers.addPointerEventHandlers();
|
|
97
97
|
document.body.classList.add(styles[`current-operation-${operation}`]);
|
|
@@ -99,7 +99,7 @@ export function InternalBoard({ items, renderItem, onItemsChange, empty, i18nStr
|
|
|
99
99
|
useDragSubscription("update", ({ interactionType, collisionIds, positionOffset, collisionRect }) => {
|
|
100
100
|
dispatch({
|
|
101
101
|
type: "update-with-pointer",
|
|
102
|
-
collisionIds: interactionType === "
|
|
102
|
+
collisionIds: interactionType === "pointer" && isElementOverBoard(collisionRect) ? collisionIds : [],
|
|
103
103
|
positionOffset,
|
|
104
104
|
draggableRect: collisionRect,
|
|
105
105
|
});
|
package/board/transition.js
CHANGED
|
@@ -47,14 +47,23 @@ function initTransition({ operation, interactionType, itemsLayout, draggableItem
|
|
|
47
47
|
path: [],
|
|
48
48
|
};
|
|
49
49
|
const placeholdersLayout = getLayoutPlaceholders(transition);
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
const layoutItem = itemsLayout.items.find((it) => it.id === draggableItem.id);
|
|
51
|
+
let path = [];
|
|
52
|
+
if (interactionType === "pointer" || operation === "insert") {
|
|
53
|
+
const collisionRect = getHoveredRect(collisionIds, placeholdersLayout.items);
|
|
54
|
+
const appendPath = operation === "resize" ? appendResizePath : appendMovePath;
|
|
55
|
+
path = layoutItem ? appendPath([], collisionRect) : [];
|
|
56
|
+
}
|
|
57
|
+
else if (layoutItem) {
|
|
58
|
+
path =
|
|
59
|
+
operation === "resize"
|
|
60
|
+
? [new Position({ x: layoutItem.x + layoutItem.width, y: layoutItem.y + layoutItem.height })]
|
|
61
|
+
: [new Position({ x: layoutItem.x, y: layoutItem.y })];
|
|
62
|
+
}
|
|
54
63
|
return {
|
|
55
64
|
transition: { ...transition, path },
|
|
56
65
|
removeTransition: null,
|
|
57
|
-
announcement:
|
|
66
|
+
announcement: layoutItem ? { type: "dnd-started", item: draggableItem, operation } : null,
|
|
58
67
|
};
|
|
59
68
|
}
|
|
60
69
|
function initRemoveTransition({ items, removedItem, itemsLayout }) {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { isDevelopment, warnOnce } from "@cloudscape-design/component-toolkit/internal";
|
|
3
4
|
import { ALWAYS_VISUAL_REFRESH } from "../environment";
|
|
4
|
-
import { IS_DEV } from "../is-development";
|
|
5
|
-
import { warnOnce } from "../logging";
|
|
6
5
|
export const useVisualRefresh = ALWAYS_VISUAL_REFRESH ? () => true : useVisualRefreshDynamic;
|
|
7
6
|
// We expect VR is to be set only once and before the application is rendered.
|
|
8
7
|
let visualRefreshState = undefined;
|
|
@@ -13,7 +12,7 @@ function useVisualRefreshDynamic() {
|
|
|
13
12
|
if (visualRefreshState === undefined) {
|
|
14
13
|
visualRefreshState = detectVisualRefresh();
|
|
15
14
|
}
|
|
16
|
-
if (
|
|
15
|
+
if (isDevelopment) {
|
|
17
16
|
const newVisualRefreshState = detectVisualRefresh();
|
|
18
17
|
if (newVisualRefreshState !== visualRefreshState) {
|
|
19
18
|
warnOnce("Visual Refresh", "Dynamic visual refresh change detected. This is not supported. " +
|
package/internal/environment.js
CHANGED
package/internal/manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
/**
|
|
4
|
-
* Whether the bundle is a development bundle.
|
|
5
|
-
* Only use this in an if condition and on its own! This will help bundlers find
|
|
6
|
-
* and remove the conditional statement for production bundles.
|
|
7
|
-
*/
|
|
8
|
-
export const IS_DEV = process.env.NODE_ENV !== "production";
|
package/internal/logging.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function warnOnce(component: string, message: string): void;
|
package/internal/logging.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
const messageCache = {};
|
|
4
|
-
export function warnOnce(component, message) {
|
|
5
|
-
const warning = `[${component}] ${message}`;
|
|
6
|
-
if (!messageCache[warning]) {
|
|
7
|
-
messageCache[warning] = true;
|
|
8
|
-
console.warn(warning);
|
|
9
|
-
}
|
|
10
|
-
}
|