@guiexpert/table 1.1.110 → 1.1.113

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/index.js CHANGED
@@ -1250,20 +1250,26 @@ class Hn {
1250
1250
  (this.mouseDown || this.pendingDraggingEnd) && t && t.areaIdent === "body" && t.rowIndex >= 0 && (t.rowIndex = Math.max(0, e.mapIndexOrNext(t.rowIndex)));
1251
1251
  }
1252
1252
  onMouseMove(e) {
1253
- var t, s, o, i;
1253
+ var t, s, o, i, r;
1254
1254
  if (!this.mouseDown && ((s = (t = this.tableScope).isEventInDetail) != null && s.call(t, e))) {
1255
1255
  (i = (o = this.tableScope).hideHover) == null || i.call(o);
1256
1256
  return;
1257
1257
  }
1258
- if (!(!this.mouseDown && this.isBlocked(e)))
1258
+ if (!(!this.mouseDown && this.isBlocked(e))) {
1259
+ if (this.mouseDown && !this.dragging) {
1260
+ const l = (r = this.startMouseEvent) == null ? void 0 : r.originalEvent;
1261
+ if (l && l.clientX === e.clientX && l.clientY === e.clientY)
1262
+ return;
1263
+ }
1259
1264
  if (this.mouseEvent = e, this.mouseDown) {
1260
1265
  this.dragging || (this.dragging = !0, this.tableScope.setDragging(!0));
1261
- const r = this.dragGeneration;
1266
+ const l = this.dragGeneration;
1262
1267
  requestAnimationFrame(() => {
1263
- r === this.dragGeneration && this.mouseDraggingOnFrame();
1268
+ l === this.dragGeneration && this.mouseDraggingOnFrame();
1264
1269
  });
1265
1270
  } else
1266
1271
  requestAnimationFrame(this.mouseMoveOnFrame.bind(this));
1272
+ }
1267
1273
  }
1268
1274
  onMouseUp(e) {
1269
1275
  var s, o;
@@ -20206,7 +20212,7 @@ class th {
20206
20212
  const Ne = class Ne extends na {
20207
20213
  constructor(e, t, s, o, i, r = new Ae(), l = new Ia()) {
20208
20214
  var u;
20209
- if (super(e, t, new Qs(s), o), this.eventListener = i, this.copyService = r, this.excelService = l, this.licenseManager = at.getInstance(), this.listenerAbortController = new AbortController(), this.destroyed = !1, this.selectionService = new ge(this), this.api = new Yl(this), this.initialized = !1, this.mouseStartAction = "", this.mouseStartWidth = -1, this.mouseStartColumnIndex = -1, this.dragFrom = -1, this.dragTo = -1, this.lastDragFrom = -1, this.lastDragTo = -1, this.firstDraggingRendering = !0, this.editingOptions = _o.create(lt(this.tableOptions, "editing")), this.subscribers = /* @__PURE__ */ new Set(), this.clipboardOptions = ws.create(lt(this.tableOptions, "clipboard")), this.undoOptions = Go.create(lt(this.tableOptions, "undo")), this.lastTabKeyTime = 0, this.lastContextmenu = Date.now(), this.allExpanded = !0, this.selectionEventsHeld = 0, t.setTableScope(this), this.liveAnnouncer = new ao(e.ownerDocument, this.ariaIds.liveRegion(), s), this.eventListener = qc(i ?? new ls(), this.subscribers), this.stateService = new no(this), this.mouseHandler = new Hn(this), this.inputHandler = new pa(this), this.resizeHandler = new Ma(this, o.resizeEventDebounceDelay), this.shortcutService = new va(this), this.rowDragService = new ka(this), this.batchEditService = new Na(this), this.fillHandleService = new ja(this), this.editingOptions) {
20215
+ if (super(e, t, new Qs(s), o), this.eventListener = i, this.copyService = r, this.excelService = l, this.licenseManager = at.getInstance(), this.listenerAbortController = new AbortController(), this.destroyed = !1, this.selectionService = new ge(this), this.api = new Yl(this), this.initialized = !1, this.mouseStartAction = "", this.mouseStartWidth = -1, this.mouseStartColumnIndex = -1, this.dragFrom = -1, this.lastDragFrom = -1, this.lastDragTo = -1, this.firstDraggingRendering = !0, this.editingOptions = _o.create(lt(this.tableOptions, "editing")), this.subscribers = /* @__PURE__ */ new Set(), this.clipboardOptions = ws.create(lt(this.tableOptions, "clipboard")), this.undoOptions = Go.create(lt(this.tableOptions, "undo")), this.lastTabKeyTime = 0, this.lastContextmenu = Date.now(), this.allExpanded = !0, this.selectionEventsHeld = 0, t.setTableScope(this), this.liveAnnouncer = new ao(e.ownerDocument, this.ariaIds.liveRegion(), s), this.eventListener = qc(i ?? new ls(), this.subscribers), this.stateService = new no(this), this.mouseHandler = new Hn(this), this.inputHandler = new pa(this), this.resizeHandler = new Ma(this, o.resizeEventDebounceDelay), this.shortcutService = new va(this), this.rowDragService = new ka(this), this.batchEditService = new Na(this), this.fillHandleService = new ja(this), this.editingOptions) {
20210
20216
  this.cellEditorService = new dc(this, this.editingOptions);
20211
20217
  const f = t.getBodyModel();
20212
20218
  this.editingOptions.defaultEditable && "defaultEditable" in f && (f.defaultEditable = !0), this.setHostAriaAttribute("aria-description", this.getSheetTexts().gridEditingHint());
@@ -21662,12 +21668,16 @@ const Ne = class Ne extends na {
21662
21668
  * horizontal scroll bar must stay usable), so a mouse event on a footer cell arrives at the viewport: then the footer
21663
21669
  * element below the mouse pointer is returned (not on the scroll bar itself).
21664
21670
  *
21671
+ * A target that a render replaced meanwhile (an event handled in a later animation frame – a drag frame, the end of a
21672
+ * drag – while live data renders) is resolved again at the pointer position: its `data-row-index` would be the index
21673
+ * of an earlier render (since 1.1.112).
21674
+ *
21665
21675
  * @param {MouseEvent} evt - a mouse event on the host element
21666
21676
  * @returns {EventTarget | null} the target element
21667
21677
  */
21668
21678
  getMouseEventTarget(e) {
21669
- const t = e.target;
21670
- if ((t === this.scrollViewport || t === this.contentWrapperDiv || t === this.contentDiv) && this.tableModel.getPadding().bottom > 0) {
21679
+ let t = e.target;
21680
+ if (t instanceof Element && !t.isConnected && Number.isFinite(e.clientX) && Number.isFinite(e.clientY) && (t = this.getCellElementAtPoint(e.clientX, e.clientY) ?? t), (t === this.scrollViewport || t === this.contentWrapperDiv || t === this.contentDiv) && this.tableModel.getPadding().bottom > 0) {
21671
21681
  const s = this.scrollViewport.getBoundingClientRect(), o = e.clientX - s.left, i = e.clientY - s.top >= this.scrollViewport.clientHeight || o < this.scrollViewport.clientLeft || o >= this.scrollViewport.clientLeft + this.scrollViewport.clientWidth, r = this.hostElement.getRootNode();
21672
21682
  if (!i && r.elementsFromPoint) {
21673
21683
  const l = r.elementsFromPoint(e.clientX, e.clientY).find((a) => this.hostElement.contains(a) && a.closest(".ge-table-footer"));
@@ -21677,6 +21687,12 @@ const Ne = class Ne extends na {
21677
21687
  }
21678
21688
  return t;
21679
21689
  }
21690
+ /** The cell element (or an element in it) of this table at a client position, `undefined` if there is none. */
21691
+ getCellElementAtPoint(e, t) {
21692
+ var o;
21693
+ const s = this.hostElement.getRootNode();
21694
+ return (o = s.elementsFromPoint) == null ? void 0 : o.call(s, e, t).find((i) => this.hostElement.contains(i) && !!i.closest("[data-col-index]"));
21695
+ }
21680
21696
  /**
21681
21697
  * Handles the mouse down event.
21682
21698
  *
@@ -21705,7 +21721,7 @@ const Ne = class Ne extends na {
21705
21721
  /** Forgets the column action of the last press (no events). */
21706
21722
  resetColumnDrag() {
21707
21723
  var e, t;
21708
- (t = (e = this.columnDrag) == null ? void 0 : e.keyAbort) == null || t.abort(), this.columnDrag = void 0, this.mouseStartAction = "", this.mouseStartWidth = -1, this.mouseStartColumnIndex = -1, this.dragFrom = -1, this.dragTo = -1, this.firstDraggingRendering = !0;
21724
+ (t = (e = this.columnDrag) == null ? void 0 : e.keyAbort) == null || t.abort(), this.columnDrag = void 0, this.mouseStartAction = "", this.mouseStartWidth = -1, this.mouseStartColumnIndex = -1, this.dragFrom = -1, this.firstDraggingRendering = !0;
21709
21725
  }
21710
21726
  /**
21711
21727
  * Starts the column drag of this press once the mouse moved past {@link MouseHandler.clickMoveTolerance}: reports
@@ -21823,7 +21839,7 @@ const Ne = class Ne extends na {
21823
21839
  const r = Array.from({ length: s }, (a, c) => this.isColumnMovable(c)), l = la(r, this.dragFrom, o);
21824
21840
  l != null && l.length && (l.forEach(([a, c]) => t.changeColumnOrder(a, c)), (i = this.columnDrag) == null || i.moves.push(...l), this.lastDragFrom = this.dragFrom, this.lastDragTo = o, this.dragFrom = o, this.columnDrag && (this.columnDrag.currentIndex = o), this.resetSizeOfWrapperDiv(), this.adjustContainersAndRows());
21825
21841
  }
21826
- this.draggingTargetColumnIndex = this.dragFrom, this.dragTo = this.dragFrom;
21842
+ this.draggingTargetColumnIndex = this.dragFrom;
21827
21843
  }
21828
21844
  /**
21829
21845
  * Handles the end of mouse dragging event on a frame.
@@ -128,7 +128,6 @@ export declare class TableScope extends RenderScope implements OnActionTriggered
128
128
  /** The column resize or move of the current press (prompt 022) – `undefined` without an allowed column action. */
129
129
  private columnDrag?;
130
130
  private dragFrom;
131
- private dragTo;
132
131
  private lastDragFrom;
133
132
  private lastDragTo;
134
133
  private firstDraggingRendering;
@@ -777,10 +776,16 @@ export declare class TableScope extends RenderScope implements OnActionTriggered
777
776
  * horizontal scroll bar must stay usable), so a mouse event on a footer cell arrives at the viewport: then the footer
778
777
  * element below the mouse pointer is returned (not on the scroll bar itself).
779
778
  *
779
+ * A target that a render replaced meanwhile (an event handled in a later animation frame – a drag frame, the end of a
780
+ * drag – while live data renders) is resolved again at the pointer position: its `data-row-index` would be the index
781
+ * of an earlier render (since 1.1.112).
782
+ *
780
783
  * @param {MouseEvent} evt - a mouse event on the host element
781
784
  * @returns {EventTarget | null} the target element
782
785
  */
783
786
  getMouseEventTarget(evt: MouseEvent): EventTarget | null;
787
+ /** The cell element (or an element in it) of this table at a client position, `undefined` if there is none. */
788
+ private getCellElementAtPoint;
784
789
  /**
785
790
  * Handles the mouse down event.
786
791
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guiexpert/table",
3
- "version": "1.1.110",
3
+ "version": "1.1.113",
4
4
  "license": "MIT",
5
5
  "author": "Dr. Marc Kronberg <info@gui.expert> (https://gui.expert)",
6
6
  "repository": {