pixelize-design-library 2.2.153 → 2.2.154
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.
|
@@ -152,18 +152,31 @@ var KanbanBoard = function (_a) {
|
|
|
152
152
|
var copiedItems = __spreadArray([], sourceCol.items, true);
|
|
153
153
|
copiedItems.splice(source.index, 1);
|
|
154
154
|
copiedItems.splice(destination.index, 0, draggedItem);
|
|
155
|
-
|
|
155
|
+
var nextColumns = __assign(__assign({}, columns), (_a = {}, _a[source.droppableId] = __assign(__assign({}, sourceCol), { items: copiedItems }), _a));
|
|
156
|
+
setColumns(nextColumns);
|
|
157
|
+
onDrag === null || onDrag === void 0 ? void 0 : onDrag({
|
|
158
|
+
from: source.droppableId,
|
|
159
|
+
to: destination.droppableId,
|
|
160
|
+
item: draggedItem,
|
|
161
|
+
columns: nextColumns,
|
|
162
|
+
fromIndex: source.index,
|
|
163
|
+
toIndex: destination.index,
|
|
164
|
+
});
|
|
156
165
|
}
|
|
157
166
|
else {
|
|
158
167
|
var sourceItems = __spreadArray([], sourceCol.items, true);
|
|
159
168
|
var destItems = __spreadArray([], destCol.items, true);
|
|
160
169
|
sourceItems.splice(source.index, 1);
|
|
161
170
|
destItems.splice(destination.index, 0, draggedItem);
|
|
162
|
-
|
|
171
|
+
var nextColumns = __assign(__assign({}, columns), (_b = {}, _b[source.droppableId] = __assign(__assign({}, sourceCol), { items: sourceItems }), _b[destination.droppableId] = __assign(__assign({}, destCol), { items: destItems }), _b));
|
|
172
|
+
setColumns(nextColumns);
|
|
163
173
|
onDrag === null || onDrag === void 0 ? void 0 : onDrag({
|
|
164
174
|
from: source.droppableId,
|
|
165
175
|
to: destination.droppableId,
|
|
166
176
|
item: draggedItem,
|
|
177
|
+
columns: nextColumns,
|
|
178
|
+
fromIndex: source.index,
|
|
179
|
+
toIndex: destination.index,
|
|
167
180
|
});
|
|
168
181
|
}
|
|
169
182
|
};
|
|
@@ -175,8 +188,11 @@ var KanbanBoard = function (_a) {
|
|
|
175
188
|
// row renderer
|
|
176
189
|
var Row = function (_a) {
|
|
177
190
|
var index = _a.index, style = _a.style, data = _a.data;
|
|
178
|
-
var items = data.items, colId = data.colId
|
|
191
|
+
var items = data.items, colId = data.colId;
|
|
179
192
|
var account = items[index];
|
|
193
|
+
if (!account) {
|
|
194
|
+
return react_1.default.createElement("div", { style: style });
|
|
195
|
+
}
|
|
180
196
|
return (react_1.default.createElement("div", { style: style },
|
|
181
197
|
react_1.default.createElement(MeasuredItem_1.default, { index: index, setSize: function (i, h) { return setSize(i, h, colId); } },
|
|
182
198
|
react_1.default.createElement("div", { style: { marginBottom: 12 } },
|
|
@@ -185,8 +201,7 @@ var KanbanBoard = function (_a) {
|
|
|
185
201
|
return (react_1.default.createElement("div", __assign({ ref: provided.innerRef }, provided.draggableProps, provided.dragHandleProps, { style: provided.draggableProps.style }), (account === null || account === void 0 ? void 0 : account.customNode) ? (_a = account === null || account === void 0 ? void 0 : account.customNode) === null || _a === void 0 ? void 0 : _a.call(account) : (react_1.default.createElement(AccountCard_1.default, { key: account.id, account: account, index: index, onDelete: onDelete, onOpen: onOpen, isExpanded: expanded[account.id], onToggleExpand: function () {
|
|
186
202
|
return toggleExpand(account.id, colId, index);
|
|
187
203
|
}, isDeletable: canDelete }))));
|
|
188
|
-
})))
|
|
189
|
-
index === items.length - 1 && placeholder));
|
|
204
|
+
})))));
|
|
190
205
|
};
|
|
191
206
|
var NoItemsTemplate = function (_a) {
|
|
192
207
|
var _b;
|
|
@@ -304,12 +319,12 @@ var KanbanBoard = function (_a) {
|
|
|
304
319
|
virtualization ? (react_1.default.createElement(react_window_1.VariableSizeList, { ref: function (el) {
|
|
305
320
|
if (el)
|
|
306
321
|
listRefs.current[colId] = el;
|
|
307
|
-
}, height: containerHeight - 150, itemCount: column.items.length
|
|
322
|
+
}, height: containerHeight - 150, itemCount: column.items.length +
|
|
323
|
+
(snapshot.isUsingPlaceholder ? 1 : 0), itemSize: function (index) {
|
|
308
324
|
return getItemSize(index, column.items, colId);
|
|
309
325
|
}, width: "100%", itemData: {
|
|
310
326
|
items: column.items,
|
|
311
327
|
colId: colId,
|
|
312
|
-
placeholder: provided.placeholder,
|
|
313
328
|
} }, Row)) : (react_1.default.createElement(react_2.Box, null,
|
|
314
329
|
column.items.map(function (account, index) { return (react_1.default.createElement("div", { key: account.id, style: { marginBottom: 12 } },
|
|
315
330
|
react_1.default.createElement(dnd_1.Draggable, { draggableId: account.id.toString(), index: index, key: account.id, isDragDisabled: !canDrag }, function (provided) {
|
|
@@ -27,10 +27,13 @@ export type KanbanBoardProps = {
|
|
|
27
27
|
onDelete?: (account: Account) => void;
|
|
28
28
|
onOpen?: (account: Account) => void;
|
|
29
29
|
onColumnDelete?: (colId: (string | number)[]) => void;
|
|
30
|
-
onDrag?: ({ from, to, item, }: {
|
|
30
|
+
onDrag?: ({ from, to, item, columns, fromIndex, toIndex, }: {
|
|
31
31
|
from: string;
|
|
32
32
|
to: string;
|
|
33
33
|
item: Account;
|
|
34
|
+
columns: Record<string, ColumnType>;
|
|
35
|
+
fromIndex: number;
|
|
36
|
+
toIndex: number;
|
|
34
37
|
}) => void;
|
|
35
38
|
isLoading?: boolean;
|
|
36
39
|
kanbanSelect?: {
|