@prioticket/design-system-web 1.7.0-beta.1 → 1.7.0
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.
|
@@ -49,6 +49,20 @@ export interface PdTableRowReorderEvent<T extends PdTableRowData = PdTableRowDat
|
|
|
49
49
|
fromIndex: number;
|
|
50
50
|
toIndex: number;
|
|
51
51
|
item: T;
|
|
52
|
+
/**
|
|
53
|
+
* The complete data array after the reorder has been applied.
|
|
54
|
+
* When sorting was active, the sorted order is materialized first,
|
|
55
|
+
* then the drag reorder is applied on top.
|
|
56
|
+
*
|
|
57
|
+
* **Recommended:** use this directly instead of manually splicing:
|
|
58
|
+
* ```ts
|
|
59
|
+
* table.addEventListener('pd-table-row-reorder', (e) => {
|
|
60
|
+
* myData = e.detail.data;
|
|
61
|
+
* table.data = myData;
|
|
62
|
+
* });
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
data: T[];
|
|
52
66
|
}
|
|
53
67
|
export interface PdTableColumnReorderEvent<T extends PdTableRowData = PdTableRowData> {
|
|
54
68
|
fromIndex: number;
|
|
@@ -119,8 +133,11 @@ export declare class PdTable<T extends PdTableRowData = PdTableRowData> extends
|
|
|
119
133
|
private _isDragHandleGrabbed;
|
|
120
134
|
private _draggedColumnIndex;
|
|
121
135
|
private _dragOverColumnIndex;
|
|
136
|
+
private _flipPositions;
|
|
137
|
+
private _flipPending;
|
|
122
138
|
private _displayDataCache;
|
|
123
139
|
private _displayDataCacheKey;
|
|
140
|
+
private _displayToDataIndexMap;
|
|
124
141
|
private _reactRoots;
|
|
125
142
|
/** Whether server-side pagination is active */
|
|
126
143
|
private get _isServerSidePagination();
|
|
@@ -135,14 +152,25 @@ export declare class PdTable<T extends PdTableRowData = PdTableRowData> extends
|
|
|
135
152
|
private get _displayData();
|
|
136
153
|
disconnectedCallback(): void;
|
|
137
154
|
protected willUpdate(changedProperties: PropertyValues): void;
|
|
155
|
+
protected updated(changedProperties: PropertyValues): void;
|
|
156
|
+
/**
|
|
157
|
+
* Captures the current Y position of every visible row.
|
|
158
|
+
* Must be called BEFORE data changes trigger a re-render.
|
|
159
|
+
*/
|
|
160
|
+
private _captureRowPositions;
|
|
161
|
+
/**
|
|
162
|
+
* After re-render, computes the delta between old and new positions
|
|
163
|
+
* and animates rows from their old position to the new one.
|
|
164
|
+
*/
|
|
165
|
+
private _playFlipAnimation;
|
|
166
|
+
/**
|
|
167
|
+
* Incremented whenever data is set, ensuring the cache is always invalidated.
|
|
168
|
+
* This replaces the fragile fingerprinting approach that missed adjacent swaps.
|
|
169
|
+
*/
|
|
170
|
+
private _dataRevision;
|
|
138
171
|
private _computeCacheKey;
|
|
139
172
|
private _sortData;
|
|
140
173
|
private _getRowKey;
|
|
141
|
-
/**
|
|
142
|
-
* Finds the actual index of a row in the full data array.
|
|
143
|
-
* This is critical for stable row keys when pagination is active.
|
|
144
|
-
*/
|
|
145
|
-
private _getActualDataIndex;
|
|
146
174
|
private _isColumnSortable;
|
|
147
175
|
private _getColumnAlignment;
|
|
148
176
|
private _getColspan;
|
|
@@ -161,6 +189,15 @@ export declare class PdTable<T extends PdTableRowData = PdTableRowData> extends
|
|
|
161
189
|
private _handleDragHandleMouseDown;
|
|
162
190
|
private _handleDragHandleMouseUp;
|
|
163
191
|
private _handleDragHandleKeyDown;
|
|
192
|
+
/**
|
|
193
|
+
* Maps display indices to this.data indices, performs the reorder
|
|
194
|
+
* internally, and emits the event with the complete reordered array.
|
|
195
|
+
*
|
|
196
|
+
* When sorting is active the user sees a sorted view; dragging within it
|
|
197
|
+
* means "I accept this sorted order AND want to adjust it." We therefore
|
|
198
|
+
* **materialize** the sort into the data array before applying the drag,
|
|
199
|
+
* so the result matches what the user visually intended.
|
|
200
|
+
*/
|
|
164
201
|
private _emitReorder;
|
|
165
202
|
private _onColumnDragStart;
|
|
166
203
|
private _onColumnDragOver;
|
|
@@ -181,6 +218,12 @@ export declare class PdTable<T extends PdTableRowData = PdTableRowData> extends
|
|
|
181
218
|
private _renderBoolean;
|
|
182
219
|
private _isReactElement;
|
|
183
220
|
private _renderReactCellContent;
|
|
221
|
+
/**
|
|
222
|
+
* Renders a single table row.
|
|
223
|
+
* @param row The data item
|
|
224
|
+
* @param displayIndex 0-based position in the visible (sorted/paginated) list — used for drag-and-drop
|
|
225
|
+
* @param dataIndex Position in the original this.data array — used for row keys, selection, and events
|
|
226
|
+
*/
|
|
184
227
|
private _renderRow;
|
|
185
228
|
private _renderEmptyState;
|
|
186
229
|
private _renderLoadingState;
|