@toolbox-web/grid 1.6.0 → 1.6.2

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.
Files changed (49) hide show
  1. package/all.js +561 -471
  2. package/all.js.map +1 -1
  3. package/index.js +3 -3
  4. package/index.js.map +1 -1
  5. package/lib/plugins/context-menu/ContextMenuPlugin.d.ts +11 -0
  6. package/lib/plugins/context-menu/ContextMenuPlugin.d.ts.map +1 -1
  7. package/lib/plugins/context-menu/index.js +136 -77
  8. package/lib/plugins/context-menu/index.js.map +1 -1
  9. package/lib/plugins/filtering/FilteringPlugin.d.ts.map +1 -1
  10. package/lib/plugins/filtering/index.js +246 -250
  11. package/lib/plugins/filtering/index.js.map +1 -1
  12. package/lib/plugins/multi-sort/index.js +11 -11
  13. package/lib/plugins/pivot/PivotPlugin.d.ts +2 -0
  14. package/lib/plugins/pivot/PivotPlugin.d.ts.map +1 -1
  15. package/lib/plugins/pivot/index.js +29 -27
  16. package/lib/plugins/pivot/index.js.map +1 -1
  17. package/lib/plugins/print/index.js +1 -1
  18. package/lib/plugins/print/index.js.map +1 -1
  19. package/lib/plugins/row-reorder/RowReorderPlugin.d.ts +18 -0
  20. package/lib/plugins/row-reorder/RowReorderPlugin.d.ts.map +1 -1
  21. package/lib/plugins/row-reorder/index.js +132 -72
  22. package/lib/plugins/row-reorder/index.js.map +1 -1
  23. package/lib/plugins/selection/index.js +1 -1
  24. package/lib/plugins/visibility/index.js +7 -7
  25. package/package.json +1 -1
  26. package/themes/dg-theme-bootstrap.css +60 -33
  27. package/themes/dg-theme-material.css +83 -52
  28. package/themes/dg-theme-standard.css +80 -12
  29. package/themes/dg-theme-vibrant.css +78 -9
  30. package/umd/grid.all.umd.js +17 -17
  31. package/umd/grid.all.umd.js.map +1 -1
  32. package/umd/grid.umd.js +1 -1
  33. package/umd/grid.umd.js.map +1 -1
  34. package/umd/plugins/context-menu.umd.js +1 -1
  35. package/umd/plugins/context-menu.umd.js.map +1 -1
  36. package/umd/plugins/filtering.umd.js +1 -1
  37. package/umd/plugins/filtering.umd.js.map +1 -1
  38. package/umd/plugins/multi-sort.umd.js +1 -1
  39. package/umd/plugins/multi-sort.umd.js.map +1 -1
  40. package/umd/plugins/pivot.umd.js +1 -1
  41. package/umd/plugins/pivot.umd.js.map +1 -1
  42. package/umd/plugins/print.umd.js +1 -1
  43. package/umd/plugins/print.umd.js.map +1 -1
  44. package/umd/plugins/row-reorder.umd.js +1 -1
  45. package/umd/plugins/row-reorder.umd.js.map +1 -1
  46. package/umd/plugins/selection.umd.js +1 -1
  47. package/umd/plugins/selection.umd.js.map +1 -1
  48. package/umd/plugins/visibility.umd.js +1 -1
  49. package/umd/plugins/visibility.umd.js.map +1 -1
@@ -79,6 +79,11 @@ export declare class RowReorderPlugin extends BaseGridPlugin<RowReorderConfig> {
79
79
  readonly styles: string;
80
80
  /** @internal */
81
81
  protected get defaultConfig(): Partial<RowReorderConfig>;
82
+ /**
83
+ * Resolve animation type from plugin config.
84
+ * Uses base class isAnimationEnabled to respect grid-level settings.
85
+ */
86
+ private get animationType();
82
87
  private isDragging;
83
88
  private draggedRowIndex;
84
89
  private dropRowIndex;
@@ -138,6 +143,19 @@ export declare class RowReorderPlugin extends BaseGridPlugin<RowReorderConfig> {
138
143
  * Execute a row move and emit the event.
139
144
  */
140
145
  private executeMove;
146
+ /**
147
+ * Capture row positions before reorder.
148
+ * Maps visual row index to its top position.
149
+ */
150
+ private captureRowPositions;
151
+ /**
152
+ * Apply FLIP animation for row reorder.
153
+ * Uses CSS transitions - JS sets initial transform and toggles class.
154
+ * @param oldPositions - Row positions captured before DOM change
155
+ * @param fromIndex - Original index of moved row
156
+ * @param toIndex - New index of moved row
157
+ */
158
+ private animateFLIP;
141
159
  /**
142
160
  * Get the row index from a row element by checking data-row attribute on cells.
143
161
  * This is consistent with how other plugins retrieve row indices.
@@ -1 +1 @@
1
- {"version":3,"file":"RowReorderPlugin.d.ts","sourceRoot":"","sources":["../../../../../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A8C;IACnE,qDAAqD;IACrD,OAAO,CAAC,YAAY,CAAK;IAKzB,gBAAgB;IACP,MAAM,IAAI,IAAI;IAWvB,gBAAgB;IACP,cAAc,CAAC,OAAO,EAAE,SAAS,YAAY,EAAE,GAAG,YAAY,EAAE;IAwCzE,gBAAgB;IACP,WAAW,IAAI,IAAI;IA+B5B;;;OAGG;IACM,SAAS,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,GAAG,IAAI;IAoCxD;;;;OAIG;IACM,WAAW,IAAI,IAAI;IAS5B;;;;OAIG;IACH,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAiBjD;;;;OAIG;IACH,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO;IAevD;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAwBhC;;;OAGG;IACH,OAAO,CAAC,qBAAqB;IAkD7B;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAmD1B;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAmCxB;;OAEG;IACH,OAAO,CAAC,WAAW;IAiCnB;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAW3B;;;;;;OAMG;IACH,OAAO,CAAC,WAAW;IAoEnB;;;OAGG;IACH,OAAO,CAAC,WAAW;IAKnB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAMxB;;OAEG;IACH,OAAO,CAAC,kBAAkB;CAO3B"}
@@ -1,54 +1,54 @@
1
- function v(a) {
2
- a && a.querySelectorAll(".cell-focus").forEach((e) => e.classList.remove("cell-focus"));
1
+ function v(l) {
2
+ l && l.querySelectorAll(".cell-focus").forEach((e) => e.classList.remove("cell-focus"));
3
3
  }
4
- const R = 'input,select,textarea,[contenteditable="true"],[contenteditable=""],[tabindex]:not([tabindex="-1"])', m = document.createElement("template");
5
- m.innerHTML = '<div class="cell" role="gridcell" part="cell"></div>';
6
- const _ = document.createElement("template");
7
- _.innerHTML = '<div class="data-grid-row" role="row" part="row"></div>';
8
- function h(a, e) {
9
- if (a._virtualization?.enabled) {
10
- const { rowHeight: o, container: s, viewportEl: l } = a._virtualization, c = s, d = l?.clientHeight ?? c?.clientHeight ?? 0;
11
- if (c && d > 0) {
12
- const u = a._focusRow * o;
13
- u < c.scrollTop ? c.scrollTop = u : u + o > c.scrollTop + d && (c.scrollTop = u - d + o);
4
+ const m = 'input,select,textarea,[contenteditable="true"],[contenteditable=""],[tabindex]:not([tabindex="-1"])', R = document.createElement("template");
5
+ R.innerHTML = '<div class="cell" role="gridcell" part="cell"></div>';
6
+ const E = document.createElement("template");
7
+ E.innerHTML = '<div class="data-grid-row" role="row" part="row"></div>';
8
+ function p(l, e) {
9
+ if (l._virtualization?.enabled) {
10
+ const { rowHeight: o, container: n, viewportEl: c } = l._virtualization, a = n, u = c?.clientHeight ?? a?.clientHeight ?? 0;
11
+ if (a && u > 0) {
12
+ const d = l._focusRow * o;
13
+ d < a.scrollTop ? a.scrollTop = d : d + o > a.scrollTop + u && (a.scrollTop = d - u + o);
14
14
  }
15
15
  }
16
- const r = a._activeEditRows !== void 0 && a._activeEditRows !== -1;
17
- r || a.refreshVirtualWindow(!1), v(a._bodyEl), Array.from(a._bodyEl.querySelectorAll('[aria-selected="true"]')).forEach((o) => {
16
+ const r = l._activeEditRows !== void 0 && l._activeEditRows !== -1;
17
+ r || l.refreshVirtualWindow(!1), v(l._bodyEl), Array.from(l._bodyEl.querySelectorAll('[aria-selected="true"]')).forEach((o) => {
18
18
  o.setAttribute("aria-selected", "false");
19
19
  });
20
- const t = a._focusRow, i = a._virtualization.start ?? 0, n = a._virtualization.end ?? a._rows.length;
21
- if (t >= i && t < n) {
22
- const o = a._bodyEl.querySelectorAll(".data-grid-row")[t - i];
23
- let s = o?.children[a._focusCol];
24
- if ((!s || !s.classList?.contains("cell")) && (s = o?.querySelector(`.cell[data-col="${a._focusCol}"]`) ?? o?.querySelector(".cell[data-col]")), s) {
25
- s.classList.add("cell-focus"), s.setAttribute("aria-selected", "true");
26
- const l = a.querySelector(".tbw-scroll-area");
27
- if (l && s && !r) {
28
- const c = a._getHorizontalScrollOffsets?.(o ?? void 0, s) ?? { left: 0, right: 0 };
29
- if (!c.skipScroll) {
30
- const d = s.getBoundingClientRect(), u = l.getBoundingClientRect(), g = d.left - u.left + l.scrollLeft, f = g + d.width, b = l.scrollLeft + c.left, p = l.scrollLeft + l.clientWidth - c.right;
31
- g < b ? l.scrollLeft = g - c.left : f > p && (l.scrollLeft = f - l.clientWidth + c.right);
20
+ const t = l._focusRow, i = l._virtualization.start ?? 0, s = l._virtualization.end ?? l._rows.length;
21
+ if (t >= i && t < s) {
22
+ const o = l._bodyEl.querySelectorAll(".data-grid-row")[t - i];
23
+ let n = o?.children[l._focusCol];
24
+ if ((!n || !n.classList?.contains("cell")) && (n = o?.querySelector(`.cell[data-col="${l._focusCol}"]`) ?? o?.querySelector(".cell[data-col]")), n) {
25
+ n.classList.add("cell-focus"), n.setAttribute("aria-selected", "true");
26
+ const c = l.querySelector(".tbw-scroll-area");
27
+ if (c && n && !r) {
28
+ const a = l._getHorizontalScrollOffsets?.(o ?? void 0, n) ?? { left: 0, right: 0 };
29
+ if (!a.skipScroll) {
30
+ const u = n.getBoundingClientRect(), d = c.getBoundingClientRect(), g = u.left - d.left + c.scrollLeft, h = g + u.width, w = c.scrollLeft + a.left, f = c.scrollLeft + c.clientWidth - a.right;
31
+ g < w ? c.scrollLeft = g - a.left : h > f && (c.scrollLeft = h - c.clientWidth + a.right);
32
32
  }
33
33
  }
34
- if (a._activeEditRows !== void 0 && a._activeEditRows !== -1 && s.classList.contains("editing")) {
35
- const c = s.querySelector(R);
36
- if (c && document.activeElement !== c)
34
+ if (l._activeEditRows !== void 0 && l._activeEditRows !== -1 && n.classList.contains("editing")) {
35
+ const a = n.querySelector(m);
36
+ if (a && document.activeElement !== a)
37
37
  try {
38
- c.focus({ preventScroll: !0 });
38
+ a.focus({ preventScroll: !0 });
39
39
  } catch {
40
40
  }
41
- } else if (!s.contains(document.activeElement)) {
42
- s.hasAttribute("tabindex") || s.setAttribute("tabindex", "-1");
41
+ } else if (!n.contains(document.activeElement)) {
42
+ n.hasAttribute("tabindex") || n.setAttribute("tabindex", "-1");
43
43
  try {
44
- s.focus({ preventScroll: !0 });
44
+ n.focus({ preventScroll: !0 });
45
45
  } catch {
46
46
  }
47
47
  }
48
48
  }
49
49
  }
50
50
  }
51
- const w = '<svg viewBox="0 0 16 16" width="12" height="12"><path fill="currentColor" d="M6 10.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5z"/></svg>', E = {
51
+ const b = '<svg viewBox="0 0 16 16" width="12" height="12"><path fill="currentColor" d="M6 10.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5z"/></svg>', y = {
52
52
  expand: "▶",
53
53
  collapse: "▼",
54
54
  sortAsc: "▲",
@@ -57,11 +57,11 @@ const w = '<svg viewBox="0 0 16 16" width="12" height="12"><path fill="currentCo
57
57
  submenuArrow: "▶",
58
58
  dragHandle: "⋮⋮",
59
59
  toolPanel: "☰",
60
- filter: w,
61
- filterActive: w,
60
+ filter: b,
61
+ filterActive: b,
62
62
  print: "🖨️"
63
63
  };
64
- class y {
64
+ class _ {
65
65
  /**
66
66
  * Plugin dependencies - declare other plugins this one requires.
67
67
  *
@@ -285,7 +285,7 @@ class y {
285
285
  */
286
286
  get gridIcons() {
287
287
  const e = this.grid?.gridConfig?.icons ?? {};
288
- return { ...E, ...e };
288
+ return { ...y, ...e };
289
289
  }
290
290
  // #region Animation Helpers
291
291
  /**
@@ -361,8 +361,8 @@ class y {
361
361
  }
362
362
  // #endregion
363
363
  }
364
- const C = '.dg-row-drag-handle{display:flex;align-items:center;justify-content:center;cursor:grab;-webkit-user-select:none;user-select:none;color:var(--tbw-color-fg-muted, #999);transition:color .15s ease;font-size:14px;letter-spacing:-2px}.dg-row-drag-handle:hover{color:var(--tbw-color-fg, #333)}.dg-row-drag-handle:active{cursor:grabbing}.data-grid-row.dragging{opacity:.6}.data-grid-row.drop-target{position:relative}.data-grid-row.drop-target.drop-before:before{content:"";position:absolute;top:0;left:0;right:0;height:2px;background-color:var(--tbw-color-accent, #1976d2);z-index:10}.data-grid-row.drop-target.drop-after:after{content:"";position:absolute;bottom:0;left:0;right:0;height:2px;background-color:var(--tbw-color-accent, #1976d2);z-index:10}.data-grid-row.keyboard-moving{background-color:var(--tbw-color-bg-selected, #e3f2fd);box-shadow:0 0 0 1px var(--tbw-color-accent, #1976d2) inset}.data-grid-row.animate-flip{transition:transform var(--tbw-animation-duration, .2s) ease-out}', L = "__tbw_row_drag";
365
- class A extends y {
364
+ const C = '@layer tbw-plugins{.dg-row-drag-handle{display:flex;align-items:center;justify-content:center;cursor:grab;-webkit-user-select:none;user-select:none;color:var(--tbw-row-reorder-handle-color, var(--tbw-color-fg-muted));transition:color var(--tbw-transition-duration, .12s) var(--tbw-transition-ease, ease);font-size:var(--tbw-font-size, 1em);letter-spacing:-2px}.dg-row-drag-handle:hover{color:var(--tbw-row-reorder-handle-hover, var(--tbw-color-fg))}.dg-row-drag-handle:active{cursor:grabbing}.data-grid-row.dragging{opacity:.6}.data-grid-row.drop-target{position:relative}.data-grid-row.drop-target.drop-before:before{content:"";position:absolute;top:0;left:0;right:0;height:2px;background-color:var(--tbw-row-reorder-indicator, var(--tbw-color-accent));z-index:10}.data-grid-row.drop-target.drop-after:after{content:"";position:absolute;bottom:0;left:0;right:0;height:2px;background-color:var(--tbw-row-reorder-indicator, var(--tbw-color-accent));z-index:10}.data-grid-row.keyboard-moving{background-color:var(--tbw-row-reorder-moving-bg, var(--tbw-focus-background));box-shadow:0 0 0 1px var(--tbw-row-reorder-moving-border, var(--tbw-color-accent)) inset}.data-grid-row.flip-animating{transition:transform var(--tbw-animation-duration, .2s) ease-out;will-change:transform;z-index:1}}', A = "__tbw_row_drag";
365
+ class L extends _ {
366
366
  /** @internal */
367
367
  name = "rowReorder";
368
368
  /** @internal */
@@ -378,6 +378,13 @@ class A extends y {
378
378
  animation: "flip"
379
379
  };
380
380
  }
381
+ /**
382
+ * Resolve animation type from plugin config.
383
+ * Uses base class isAnimationEnabled to respect grid-level settings.
384
+ */
385
+ get animationType() {
386
+ return this.isAnimationEnabled ? this.config.animation !== void 0 ? this.config.animation : "flip" : !1;
387
+ }
381
388
  // #region Internal State
382
389
  isDragging = !1;
383
390
  draggedRowIndex = null;
@@ -399,7 +406,7 @@ class A extends y {
399
406
  if (!this.config.showDragHandle)
400
407
  return [...e];
401
408
  const r = {
402
- field: L,
409
+ field: A,
403
410
  header: "",
404
411
  width: this.config.dragHandleWidth ?? 40,
405
412
  resizable: !1,
@@ -423,14 +430,14 @@ class A extends y {
423
430
  const e = this.gridElement;
424
431
  if (!e) return;
425
432
  e.querySelectorAll(".dg-row-drag-handle").forEach((i) => {
426
- const n = i;
427
- if (n.getAttribute("data-drag-bound")) return;
428
- n.setAttribute("data-drag-bound", "true");
429
- const o = n.closest(".data-grid-row");
430
- o && this.setupHandleDragListeners(n, o);
433
+ const s = i;
434
+ if (s.getAttribute("data-drag-bound")) return;
435
+ s.setAttribute("data-drag-bound", "true");
436
+ const o = s.closest(".data-grid-row");
437
+ o && this.setupHandleDragListeners(s, o);
431
438
  }), e.querySelectorAll(".data-grid-row").forEach((i) => {
432
- const n = i;
433
- n.getAttribute("data-drop-bound") || (n.setAttribute("data-drop-bound", "true"), this.setupRowDropListeners(n));
439
+ const s = i;
440
+ s.getAttribute("data-drop-bound") || (s.setAttribute("data-drop-bound", "true"), this.setupRowDropListeners(s));
434
441
  });
435
442
  }
436
443
  /**
@@ -442,11 +449,11 @@ class A extends y {
442
449
  return;
443
450
  const r = this.grid, t = r._focusRow, i = r._rows ?? this.sourceRows;
444
451
  if (t < 0 || t >= i.length) return;
445
- const n = e.key === "ArrowUp" ? "up" : "down", o = n === "up" ? t - 1 : t + 1;
452
+ const s = e.key === "ArrowUp" ? "up" : "down", o = s === "up" ? t - 1 : t + 1;
446
453
  if (o < 0 || o >= i.length) return;
447
- const s = i[t];
448
- if (!(this.config.canMove && !this.config.canMove(s, t, o, n)))
449
- return this.handleKeyboardMove(s, t, o, n, r._focusCol), e.preventDefault(), e.stopPropagation(), !0;
454
+ const n = i[t];
455
+ if (!(this.config.canMove && !this.config.canMove(n, t, o, s)))
456
+ return this.handleKeyboardMove(n, t, o, s, r._focusCol), e.preventDefault(), e.stopPropagation(), !0;
450
457
  }
451
458
  /**
452
459
  * Flush pending keyboard moves when user clicks a cell.
@@ -466,8 +473,8 @@ class A extends y {
466
473
  moveRow(e, r) {
467
474
  const t = [...this.sourceRows];
468
475
  if (e < 0 || e >= t.length || r < 0 || r >= t.length || e === r) return;
469
- const i = r < e ? "up" : "down", n = t[e];
470
- this.config.canMove && !this.config.canMove(n, e, r, i) || this.executeMove(n, e, r, "keyboard");
476
+ const i = r < e ? "up" : "down", s = t[e];
477
+ this.config.canMove && !this.config.canMove(s, e, r, i) || this.executeMove(s, e, r, "keyboard");
471
478
  }
472
479
  /**
473
480
  * Check if a row can be moved to a position.
@@ -503,7 +510,7 @@ class A extends y {
503
510
  if (r.preventDefault(), !this.isDragging || this.draggedRowIndex === null) return;
504
511
  const t = this.getRowIndex(e);
505
512
  if (t < 0 || t === this.draggedRowIndex) return;
506
- const i = e.getBoundingClientRect(), n = i.top + i.height / 2, o = r.clientY < n;
513
+ const i = e.getBoundingClientRect(), s = i.top + i.height / 2, o = r.clientY < s;
507
514
  this.dropRowIndex = o ? t : t + 1, e.classList.add("drop-target"), e.classList.toggle("drop-before", o), e.classList.toggle("drop-after", !o);
508
515
  }), e.addEventListener("dragleave", () => {
509
516
  e.classList.remove("drop-target", "drop-before", "drop-after");
@@ -512,8 +519,8 @@ class A extends y {
512
519
  const t = this.draggedRowIndex;
513
520
  let i = this.dropRowIndex;
514
521
  if (!(!this.isDragging || t === null || i === null) && (i > t && i--, t !== i)) {
515
- const o = this.sourceRows[t], s = i < t ? "up" : "down";
516
- (!this.config.canMove || this.config.canMove(o, t, i, s)) && this.executeMove(o, t, i, "drag");
522
+ const o = this.sourceRows[t], n = i < t ? "up" : "down";
523
+ (!this.config.canMove || this.config.canMove(o, t, i, n)) && this.executeMove(o, t, i, "drag");
517
524
  }
518
525
  });
519
526
  }
@@ -521,14 +528,14 @@ class A extends y {
521
528
  * Handle debounced keyboard moves.
522
529
  * Rows move immediately for visual feedback, but the event emission is debounced.
523
530
  */
524
- handleKeyboardMove(e, r, t, i, n) {
531
+ handleKeyboardMove(e, r, t, i, s) {
525
532
  this.pendingMove ? this.pendingMove.currentIndex = t : this.pendingMove = {
526
533
  originalIndex: r,
527
534
  currentIndex: t,
528
535
  row: e
529
- }, this.lastFocusCol = n;
530
- const o = this.grid, s = [...o._rows ?? this.sourceRows], [l] = s.splice(r, 1);
531
- s.splice(t, 0, l), o._rows = s, o._focusRow = t, o._focusCol = n, o.refreshVirtualWindow(!0), h(o), this.clearDebounceTimer(), this.debounceTimer = setTimeout(() => {
536
+ }, this.lastFocusCol = s;
537
+ const o = this.grid, n = [...o._rows ?? this.sourceRows], [c] = n.splice(r, 1);
538
+ n.splice(t, 0, c), o._rows = n, o._focusRow = t, o._focusCol = s, o.refreshVirtualWindow(!0), p(o), this.clearDebounceTimer(), this.debounceTimer = setTimeout(() => {
532
539
  this.flushPendingMove();
533
540
  }, this.config.debounceMs ?? 300);
534
541
  }
@@ -548,26 +555,79 @@ class A extends y {
548
555
  source: "keyboard"
549
556
  };
550
557
  if (this.emitCancelable("row-move", i)) {
551
- const o = [...this.sourceRows], [s] = o.splice(r, 1);
552
- o.splice(e, 0, s);
553
- const l = this.grid;
554
- l._rows = o, l._focusRow = e, l._focusCol = this.lastFocusCol, l.refreshVirtualWindow(!0), h(l);
558
+ const o = [...this.sourceRows], [n] = o.splice(r, 1);
559
+ o.splice(e, 0, n);
560
+ const c = this.grid;
561
+ c._rows = o, c._focusRow = e, c._focusCol = this.lastFocusCol, c.refreshVirtualWindow(!0), p(c);
555
562
  }
556
563
  }
557
564
  /**
558
565
  * Execute a row move and emit the event.
559
566
  */
560
567
  executeMove(e, r, t, i) {
561
- const n = [...this.sourceRows], [o] = n.splice(r, 1);
562
- n.splice(t, 0, o);
563
- const s = {
568
+ const s = [...this.sourceRows], [o] = s.splice(r, 1);
569
+ s.splice(t, 0, o);
570
+ const n = {
564
571
  row: e,
565
572
  fromIndex: r,
566
573
  toIndex: t,
567
- rows: n,
574
+ rows: s,
568
575
  source: i
569
576
  };
570
- this.emitCancelable("row-move", s) || (this.grid.rows = n);
577
+ if (!this.emitCancelable("row-move", n))
578
+ if (this.animationType === "flip" && this.gridElement) {
579
+ const a = this.captureRowPositions();
580
+ this.grid.rows = s, requestAnimationFrame(() => {
581
+ this.gridElement.offsetHeight, this.animateFLIP(a, r, t);
582
+ });
583
+ } else
584
+ this.grid.rows = s;
585
+ }
586
+ /**
587
+ * Capture row positions before reorder.
588
+ * Maps visual row index to its top position.
589
+ */
590
+ captureRowPositions() {
591
+ const e = /* @__PURE__ */ new Map();
592
+ return this.gridElement?.querySelectorAll(".data-grid-row").forEach((r) => {
593
+ const t = this.getRowIndex(r);
594
+ t >= 0 && e.set(t, r.getBoundingClientRect().top);
595
+ }), e;
596
+ }
597
+ /**
598
+ * Apply FLIP animation for row reorder.
599
+ * Uses CSS transitions - JS sets initial transform and toggles class.
600
+ * @param oldPositions - Row positions captured before DOM change
601
+ * @param fromIndex - Original index of moved row
602
+ * @param toIndex - New index of moved row
603
+ */
604
+ animateFLIP(e, r, t) {
605
+ const i = this.gridElement;
606
+ if (!i || e.size === 0) return;
607
+ const s = Math.min(r, t), o = Math.max(r, t), n = [];
608
+ if (i.querySelectorAll(".data-grid-row").forEach((a) => {
609
+ const u = a, d = this.getRowIndex(u);
610
+ if (d < 0 || d < s || d > o) return;
611
+ let g;
612
+ d === t ? g = r : r < t ? g = d + 1 : g = d - 1;
613
+ const h = e.get(g);
614
+ if (h === void 0) return;
615
+ const w = u.getBoundingClientRect().top, f = h - w;
616
+ Math.abs(f) > 1 && n.push({ el: u, deltaY: f });
617
+ }), n.length === 0) return;
618
+ n.forEach(({ el: a, deltaY: u }) => {
619
+ a.style.transform = `translateY(${u}px)`;
620
+ }), i.offsetHeight;
621
+ const c = this.animationDuration;
622
+ requestAnimationFrame(() => {
623
+ n.forEach(({ el: a }) => {
624
+ a.classList.add("flip-animating"), a.style.transform = "";
625
+ }), setTimeout(() => {
626
+ n.forEach(({ el: a }) => {
627
+ a.style.transform = "", a.classList.remove("flip-animating");
628
+ });
629
+ }, c + 50);
630
+ });
571
631
  }
572
632
  /**
573
633
  * Get the row index from a row element by checking data-row attribute on cells.
@@ -594,7 +654,7 @@ class A extends y {
594
654
  // #endregion
595
655
  }
596
656
  export {
597
- L as ROW_DRAG_HANDLE_FIELD,
598
- A as RowReorderPlugin
657
+ A as ROW_DRAG_HANDLE_FIELD,
658
+ L as RowReorderPlugin
599
659
  };
600
660
  //# sourceMappingURL=index.js.map