@cloudscape-design/board-components 3.0.21 → 3.0.22
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/interfaces.d.ts
CHANGED
|
@@ -47,12 +47,15 @@ export interface BoardProps<D = DataFallbackType> {
|
|
|
47
47
|
*/
|
|
48
48
|
i18nStrings: BoardProps.I18nStrings<D>;
|
|
49
49
|
/**
|
|
50
|
-
*
|
|
50
|
+
* Called when a user modifies the size or position of board items.
|
|
51
51
|
*
|
|
52
52
|
* The change detail has the following properties:
|
|
53
|
+
*
|
|
53
54
|
* * `items`: (readonly Item<D>[]) - the updated items array.
|
|
54
|
-
* * `addedItem`: (Item<D>, optional) - the item that was added as part of the update, if
|
|
55
|
-
* * `removedItem`: (Item<D>, optional) - the item that was removed as part of the update, if
|
|
55
|
+
* * `addedItem`: (Item<D>, optional) - the item that was added as part of the update, if applicable.
|
|
56
|
+
* * `removedItem`: (Item<D>, optional) - the item that was removed as part of the update, if applicable.
|
|
57
|
+
* * `resizedItem`: (Item<D>, optional) - the item that was resized as part of the update, if applicable.
|
|
58
|
+
* * `movedItem`: (Item<D>, optional) - the item that was moved as part of the update, if applicable.
|
|
56
59
|
*/
|
|
57
60
|
onItemsChange: NonCancelableEventHandler<BoardProps.ItemsChangeDetail<D>>;
|
|
58
61
|
/**
|
|
@@ -69,6 +72,8 @@ export declare namespace BoardProps {
|
|
|
69
72
|
}
|
|
70
73
|
interface ItemsChangeDetail<D = DataFallbackType> {
|
|
71
74
|
items: ReadonlyArray<Item<D>>;
|
|
75
|
+
movedItem?: Item<D>;
|
|
76
|
+
resizedItem?: Item<D>;
|
|
72
77
|
addedItem?: Item<D>;
|
|
73
78
|
removedItem?: Item<D>;
|
|
74
79
|
}
|
package/board/utils/events.js
CHANGED
|
@@ -3,12 +3,17 @@
|
|
|
3
3
|
import { createCustomEvent } from "../../internal/utils/events";
|
|
4
4
|
import { transformItems } from "../../internal/utils/layout";
|
|
5
5
|
export function createItemsChangeEvent(items, layoutShift) {
|
|
6
|
-
var _a, _b, _c, _d, _e, _f;
|
|
6
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
7
7
|
const insertTarget = (_b = (_a = layoutShift.moves.find((move) => move.type === "INSERT")) === null || _a === void 0 ? void 0 : _a.itemId) !== null && _b !== void 0 ? _b : null;
|
|
8
|
-
const
|
|
9
|
-
const
|
|
8
|
+
const moveTarget = (_d = (_c = layoutShift.moves.find((move) => move.type === "MOVE")) === null || _c === void 0 ? void 0 : _c.itemId) !== null && _d !== void 0 ? _d : null;
|
|
9
|
+
const removeTarget = (_f = (_e = layoutShift.moves.find((move) => move.type === "REMOVE")) === null || _e === void 0 ? void 0 : _e.itemId) !== null && _f !== void 0 ? _f : null;
|
|
10
|
+
const resizeTarget = (_h = (_g = layoutShift.moves.find((move) => move.type === "RESIZE")) === null || _g === void 0 ? void 0 : _g.itemId) !== null && _h !== void 0 ? _h : null;
|
|
10
11
|
const newItems = transformItems(items, layoutShift.next, resizeTarget !== null && resizeTarget !== void 0 ? resizeTarget : insertTarget);
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
return createCustomEvent({
|
|
13
|
+
items: newItems,
|
|
14
|
+
addedItem: newItems.find((it) => it.id === insertTarget),
|
|
15
|
+
removedItem: newItems.find((it) => it.id === removeTarget),
|
|
16
|
+
resizedItem: newItems.find((it) => it.id === resizeTarget),
|
|
17
|
+
movedItem: !insertTarget ? newItems.find((it) => it.id === moveTarget) : undefined,
|
|
18
|
+
});
|
|
14
19
|
}
|
|
@@ -88,7 +88,7 @@ module.exports = {
|
|
|
88
88
|
"events": [
|
|
89
89
|
{
|
|
90
90
|
"name": "onItemsChange",
|
|
91
|
-
"description": "
|
|
91
|
+
"description": "Called when a user modifies the size or position of board items.\nThe change detail has the following properties:\n\n* `items`: (readonly Item<D>[]) - the updated items array.\n* `addedItem`: (Item<D>, optional) - the item that was added as part of the update, if applicable.\n* `removedItem`: (Item<D>, optional) - the item that was removed as part of the update, if applicable.\n* `resizedItem`: (Item<D>, optional) - the item that was resized as part of the update, if applicable.\n* `movedItem`: (Item<D>, optional) - the item that was moved as part of the update, if applicable.\n",
|
|
92
92
|
"cancelable": false,
|
|
93
93
|
"detailType": "BoardProps.ItemsChangeDetail<D>",
|
|
94
94
|
"detailInlineType": {
|
|
@@ -105,10 +105,20 @@ module.exports = {
|
|
|
105
105
|
"type": "ReadonlyArray<BoardProps.Item<D>>",
|
|
106
106
|
"optional": false
|
|
107
107
|
},
|
|
108
|
+
{
|
|
109
|
+
"name": "movedItem",
|
|
110
|
+
"type": "BoardProps.Item<D>",
|
|
111
|
+
"optional": true
|
|
112
|
+
},
|
|
108
113
|
{
|
|
109
114
|
"name": "removedItem",
|
|
110
115
|
"type": "BoardProps.Item<D>",
|
|
111
116
|
"optional": true
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"name": "resizedItem",
|
|
120
|
+
"type": "BoardProps.Item<D>",
|
|
121
|
+
"optional": true
|
|
112
122
|
}
|
|
113
123
|
]
|
|
114
124
|
}
|
package/internal/environment.js
CHANGED
package/internal/manifest.json
CHANGED