playbook_ui 15.5.0.pre.alpha.draggablefix12570 → 15.5.0.pre.alpha.draggablefix12577
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.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +96 -6
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.html.erb +163 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.jsx +190 -0
- data/app/pb_kits/playbook/pb_draggable/context/index.tsx +44 -28
- data/app/pb_kits/playbook/pb_table/styles/_vertical_border.scss +49 -0
- data/dist/chunks/{_typeahead-GktRCvmq.js → _typeahead-CdVpaHUH.js} +2 -2
- data/dist/chunks/vendor.js +2 -2
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +2 -3
- data/app/pb_kits/playbook/pb_bar_graph/BarGraphStyles.scss +0 -58
|
@@ -42,9 +42,9 @@ const reducer = (state: InitialStateType, action: ActionType) => {
|
|
|
42
42
|
case 'REORDER_ITEMS_CROSS_CONTAINER': {
|
|
43
43
|
const { dragId, targetId, newContainer } = action.payload;
|
|
44
44
|
const newItems = [...state.items];
|
|
45
|
-
const draggedItem = newItems.find(item => item.id === dragId);
|
|
45
|
+
const draggedItem = newItems.find(item => item && item.id === dragId);
|
|
46
46
|
const draggedIndex = newItems.indexOf(draggedItem);
|
|
47
|
-
const targetIndex = newItems.findIndex(item => item.id === targetId);
|
|
47
|
+
const targetIndex = newItems.findIndex(item => item && item.id === targetId);
|
|
48
48
|
|
|
49
49
|
// Update container temporarily so dropzone preview works correctly
|
|
50
50
|
const updatedItem = { ...draggedItem, container: newContainer };
|
|
@@ -57,7 +57,7 @@ const reducer = (state: InitialStateType, action: ActionType) => {
|
|
|
57
57
|
case 'MOVE_TO_CONTAINER_END': {
|
|
58
58
|
const { dragId, newContainer } = action.payload;
|
|
59
59
|
const newItems = [...state.items];
|
|
60
|
-
const draggedItem = newItems.find(item => item.id === dragId);
|
|
60
|
+
const draggedItem = newItems.find(item => item && item.id === dragId);
|
|
61
61
|
const draggedIndex = newItems.indexOf(draggedItem);
|
|
62
62
|
|
|
63
63
|
// Update container temporarily so dropzone preview works correctly
|
|
@@ -144,6 +144,7 @@ export const DraggableProvider = ({
|
|
|
144
144
|
}, [state.items]);
|
|
145
145
|
|
|
146
146
|
const handleDragStart = (id: string, container: string) => {
|
|
147
|
+
console.log('[Draggable] handleDragStart:', { id, container, providerId });
|
|
147
148
|
dispatch({ type: 'SET_DRAG_DATA', payload: { id: id, initialGroup: container, originId: providerId } });
|
|
148
149
|
dispatch({ type: 'SET_IS_DRAGGING', payload: id });
|
|
149
150
|
if (onDragStart) onDragStart(id, container);
|
|
@@ -155,6 +156,7 @@ export const DraggableProvider = ({
|
|
|
155
156
|
if (state.dragData.id !== id) {
|
|
156
157
|
// Check if this is a cross-container drag
|
|
157
158
|
const isCrossContainer = state.dragData.initialGroup !== container;
|
|
159
|
+
console.log('[Draggable] handleDragEnter:', { id, container, isCrossContainer, draggedId: state.dragData.id });
|
|
158
160
|
|
|
159
161
|
if (isCrossContainer) {
|
|
160
162
|
// Use cross-container reorder to update container temporarily for dropzone preview
|
|
@@ -172,19 +174,24 @@ export const DraggableProvider = ({
|
|
|
172
174
|
const draggedItemId = state.dragData.id;
|
|
173
175
|
const originalContainer = state.dragData.initialGroup;
|
|
174
176
|
|
|
177
|
+
console.log('[Draggable] handleDragEnd:', { draggedItemId, originalContainer });
|
|
178
|
+
|
|
175
179
|
if (!draggedItemId) {
|
|
180
|
+
console.warn('[Draggable] handleDragEnd: No draggedItemId found');
|
|
176
181
|
dispatch({ type: 'SET_IS_DRAGGING', payload: "" });
|
|
177
182
|
dispatch({ type: 'SET_ACTIVE_CONTAINER', payload: "" });
|
|
178
183
|
dispatch({ type: 'SET_DRAG_DATA', payload: { id: "", initialGroup: "", originId: "" } });
|
|
179
184
|
return;
|
|
180
185
|
}
|
|
181
186
|
|
|
182
|
-
const draggedItem = state.items.find(item => item.id === draggedItemId);
|
|
187
|
+
const draggedItem = state.items.find(item => item && item.id === draggedItemId);
|
|
183
188
|
const finalContainer = draggedItem ? draggedItem.container : originalContainer;
|
|
184
189
|
|
|
190
|
+
console.log('[Draggable] handleDragEnd item found:', { draggedItem: !!draggedItem, finalContainer });
|
|
191
|
+
|
|
185
192
|
// Find items above and below in the same container
|
|
186
|
-
const itemsInContainer = state.items.filter(item => item.container === finalContainer);
|
|
187
|
-
const indexInContainer = itemsInContainer.findIndex(item => item.id === draggedItemId);
|
|
193
|
+
const itemsInContainer = state.items.filter(item => item && item.container === finalContainer);
|
|
194
|
+
const indexInContainer = itemsInContainer.findIndex(item => item && item.id === draggedItemId);
|
|
188
195
|
const itemAbove = indexInContainer > 0 ? itemsInContainer[indexInContainer - 1] : null;
|
|
189
196
|
const itemBelow = indexInContainer < itemsInContainer.length - 1 ? itemsInContainer[indexInContainer + 1] : null;
|
|
190
197
|
|
|
@@ -206,21 +213,33 @@ export const DraggableProvider = ({
|
|
|
206
213
|
const draggedItemId = state.dragData.id;
|
|
207
214
|
const originalContainer = state.dragData.initialGroup;
|
|
208
215
|
|
|
209
|
-
|
|
216
|
+
console.log('[Draggable] handleDrop:', { draggedItemId, container, originalContainer });
|
|
210
217
|
|
|
211
|
-
|
|
218
|
+
if (!draggedItemId) {
|
|
219
|
+
console.warn('[Draggable] handleDrop: No draggedItemId found');
|
|
220
|
+
return; // Guard against missing drag data when dropping too quickly
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
const draggedItem = state.items.find(item => item && item.id === draggedItemId);
|
|
212
224
|
|
|
213
225
|
if (!draggedItem) {
|
|
214
|
-
|
|
226
|
+
console.error('[Draggable] handleDrop: Item not found in state', { draggedItemId, itemsCount: state.items.length });
|
|
227
|
+
// Item not found in state: clear drag state and exit
|
|
215
228
|
dispatch({ type: 'SET_IS_DRAGGING', payload: "" });
|
|
216
229
|
dispatch({ type: 'SET_ACTIVE_CONTAINER', payload: "" });
|
|
217
230
|
dispatch({ type: 'SET_DRAG_DATA', payload: { id: "", initialGroup: "", originId: "" } });
|
|
218
231
|
return;
|
|
219
232
|
}
|
|
220
233
|
|
|
221
|
-
//
|
|
222
|
-
|
|
223
|
-
|
|
234
|
+
// If dropping in a different container and item hasn't been moved there yet, move to end
|
|
235
|
+
if (container !== originalContainer && draggedItem.container !== container) {
|
|
236
|
+
console.log('[Draggable] handleDrop: Moving to container end');
|
|
237
|
+
dispatch({ type: 'MOVE_TO_CONTAINER_END', payload: { dragId: draggedItemId, newContainer: container } });
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// Find items above and below in the same container
|
|
241
|
+
const itemsInContainer = state.items.filter(item => item && item.container === container);
|
|
242
|
+
const indexInContainer = itemsInContainer.findIndex(item => item && item.id === draggedItemId);
|
|
224
243
|
const itemAbove = indexInContainer > 0 ? itemsInContainer[indexInContainer - 1] : null;
|
|
225
244
|
const itemBelow = indexInContainer < itemsInContainer.length - 1 ? itemsInContainer[indexInContainer + 1] : null;
|
|
226
245
|
|
|
@@ -230,7 +249,7 @@ export const DraggableProvider = ({
|
|
|
230
249
|
changeCategory(draggedItemId, container);
|
|
231
250
|
|
|
232
251
|
// Pass enhanced info to onDrop callback so devs have more context
|
|
233
|
-
if (onDrop) {
|
|
252
|
+
if (onDrop && draggedItem) {
|
|
234
253
|
const updatedItem = { ...draggedItem, container };
|
|
235
254
|
onDrop(draggedItemId, container, originalContainer, updatedItem, itemAbove, itemBelow);
|
|
236
255
|
}
|
|
@@ -240,25 +259,22 @@ export const DraggableProvider = ({
|
|
|
240
259
|
if (state.dragData.originId !== providerId) return; // Ignore drag over events from other providers
|
|
241
260
|
|
|
242
261
|
e.preventDefault();
|
|
262
|
+
dispatch({ type: 'SET_ACTIVE_CONTAINER', payload: container });
|
|
243
263
|
|
|
244
|
-
//
|
|
245
|
-
if (!state.dragData.id) return;
|
|
264
|
+
// Guard against missing drag ID
|
|
265
|
+
if (!state.dragData.id) return;
|
|
246
266
|
|
|
247
|
-
|
|
267
|
+
// Find the dragged item
|
|
268
|
+
const draggedItem = state.items.find(item => item && item.id === state.dragData.id);
|
|
248
269
|
|
|
249
|
-
// Only
|
|
270
|
+
// Only move to container end if item exists and is in a different container
|
|
250
271
|
if (draggedItem && draggedItem.container !== container) {
|
|
251
|
-
|
|
252
|
-
//
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
dispatch({ type: 'SET_DRAG_DATA', payload: { id: state.dragData.id, initialGroup: container, originId: providerId } });
|
|
258
|
-
}
|
|
259
|
-
} else if (state.activeContainer !== container) {
|
|
260
|
-
// Just update active container if item is already in correct container
|
|
261
|
-
dispatch({ type: 'SET_ACTIVE_CONTAINER', payload: container });
|
|
272
|
+
console.log('[Draggable] handleDragOver: Moving to container end', { dragId: state.dragData.id, fromContainer: draggedItem.container, toContainer: container });
|
|
273
|
+
// Move item to end of target container for preview
|
|
274
|
+
dispatch({ type: 'MOVE_TO_CONTAINER_END', payload: { dragId: state.dragData.id, newContainer: container } });
|
|
275
|
+
dispatch({ type: 'SET_DRAG_DATA', payload: { id: state.dragData.id, initialGroup: container, originId: providerId } });
|
|
276
|
+
} else if (!draggedItem) {
|
|
277
|
+
console.error('[Draggable] handleDragOver: Item not found', { dragId: state.dragData.id, itemsCount: state.items.length });
|
|
262
278
|
}
|
|
263
279
|
|
|
264
280
|
if (onDragOver) onDragOver(e, container);
|
|
@@ -8,6 +8,25 @@
|
|
|
8
8
|
border-right: 1px solid $border_light !important;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
// **Advanced Table** specific rules to eliminate double borders when vertical-border is active
|
|
12
|
+
.pb_advanced_table &,
|
|
13
|
+
&[data-vertical-border="true"] {
|
|
14
|
+
// Remove first column box-shadow (preserve border-right in Chrome and use CSS var to respect column group border colors)
|
|
15
|
+
.table-header-cells:first-child,
|
|
16
|
+
.table-header-cells-custom:first-child,
|
|
17
|
+
td:first-child,
|
|
18
|
+
.pb_table_td:first-child,
|
|
19
|
+
.checkbox-cell.checkbox-cell-header:first-child {
|
|
20
|
+
box-shadow: none !important;
|
|
21
|
+
border-right: 1px solid var(--column-border-color, #{$border_light}) !important;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.pb_table_td:nth-child(2) {
|
|
25
|
+
box-shadow: none !important;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
// --- End Advanced Table First Column Code Section ---
|
|
29
|
+
|
|
11
30
|
@media screen and (min-width: $screen-xs-min) {
|
|
12
31
|
tr:hover, .pb_table_tr:hover {
|
|
13
32
|
td:last-child, .pb_table_td:last-child {
|
|
@@ -63,5 +82,35 @@
|
|
|
63
82
|
}
|
|
64
83
|
}
|
|
65
84
|
}
|
|
85
|
+
|
|
86
|
+
// Dark mode support for advanced tables
|
|
87
|
+
.pb_advanced_table.dark & {
|
|
88
|
+
td, th, .pb_table_td, .pb_table_th {
|
|
89
|
+
border-right: 1px solid $border_dark !important;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
thead tr th {
|
|
93
|
+
border-right: 1px solid $border_dark !important;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
&[data-vertical-border="true"] {
|
|
97
|
+
.table-header-cells:first-child,
|
|
98
|
+
.table-header-cells-custom:first-child,
|
|
99
|
+
td:first-child,
|
|
100
|
+
.pb_table_td:first-child,
|
|
101
|
+
.checkbox-cell.checkbox-cell-header:first-child {
|
|
102
|
+
border-right: 1px solid var(--column-border-color, #{$border_dark}) !important;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
@media screen and (min-width: $screen-xs-min) {
|
|
107
|
+
tr:hover, .pb_table_tr:hover {
|
|
108
|
+
td:last-child, .pb_table_td:last-child {
|
|
109
|
+
border-right-color: darken($border_dark, 10%) !important;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
// --- End Advanced Table Dark Mode Code Section ---
|
|
66
115
|
}
|
|
67
116
|
}
|