@guiexpert/table 1.1.86 → 1.1.88

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.
@@ -11,7 +11,22 @@ export declare class SelectionService implements OnActionTriggeredIf {
11
11
  getSelectionModel?: GetT<SelectionModelIf>;
12
12
  getFocusModel?: GetT<FocusModelIf>;
13
13
  protected previousEvt?: GeMouseEvent;
14
+ /** A drag selection ends with a click on another cell – that click must not clear the new range. */
15
+ protected ignoreNextClick: boolean;
14
16
  constructor(tableScope: TableScope);
17
+ /**
18
+ * Called on mouse down: a new gesture starts.
19
+ */
20
+ onMouseDown(): void;
21
+ /**
22
+ * Selects a range by dragging the mouse over body cells (selection type "range").
23
+ * The cell where the drag started stays the anchor, so a following shift-click extends from there.
24
+ *
25
+ * @param {GeMouseEvent} evt - the current mouse position
26
+ * @param {GeMouseEvent} startEvt - the mouse down event that started the drag
27
+ * @returns {boolean} true if the selection changed (repaint needed)
28
+ */
29
+ onMouseDragging(evt: GeMouseEvent, startEvt: GeMouseEvent | undefined): boolean;
15
30
  onMouseClicked(evt: GeMouseEvent, _previousEvt: GeMouseEvent | undefined): boolean;
16
31
  onActionTriggered(actionId: ActionId): boolean;
17
32
  private createRangeByEvents;
@@ -80,6 +80,8 @@ export declare class TableScope extends RenderScope implements OnActionTriggered
80
80
  private lastDragFrom;
81
81
  private lastDragTo;
82
82
  private firstDraggingRendering;
83
+ /** Last comparator passed to `sort()`; re-applied after filtering. Cleared by a header sort. */
84
+ private lastSortCompareFn?;
83
85
  constructor(hostElement: HTMLDivElement, tableModel: TableModelIf, domService: DomServiceIf, tableOptions: TableOptionsIf, eventListener: EventListenerIf, copyService?: CopyServiceIf, excelService?: ExcelServiceIf);
84
86
  /**
85
87
  * Creates a TableScope instance.
@@ -321,12 +323,27 @@ export declare class TableScope extends RenderScope implements OnActionTriggered
321
323
  * @private
322
324
  */
323
325
  private autoRestoreCollapsedExpandedState;
326
+ /**
327
+ * Calculates a width per column that fits the widest text of header, body and footer.
328
+ *
329
+ * The text is measured with the font and padding of a rendered cell label (canvas `measureText`),
330
+ * so dates, numbers and long names are no longer cut off. To stay fast with millions of rows, the body
331
+ * is scanned once by character length and only the longest candidates per column are measured.
332
+ * Without a canvas (e.g. in tests) it falls back to 8 px per character.
333
+ *
334
+ * @returns {number[]} one width in px per column (at least 50 px)
335
+ */
324
336
  calcAutoColumnWidths(): number[];
325
337
  setColumnWidth(columnIndex: number, width: number): void;
326
338
  autoResizeColumns(recalcWrappers?: boolean): void;
327
339
  recalcWrappers(): void;
328
340
  reSort(): void;
329
341
  sort(compareFn: (a: any, b: any) => number): void;
342
+ /**
343
+ * Sorts the (freshly filtered) body rows again, so a filter keeps the current order:
344
+ * the last `sort(compareFn)` call, otherwise the columns with a `sortState` (header icons).
345
+ */
346
+ protected reapplySorting(): void;
330
347
  /**
331
348
  * Ensures that a specific row is visible in the viewport by scrolling if necessary.
332
349
  * This method checks if the target row is within the currently visible range and
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guiexpert/table",
3
- "version": "1.1.86",
3
+ "version": "1.1.88",
4
4
  "license": "MIT",
5
5
  "author": "Dr. Marc Kronberg <info@gui.expert> (https://gui.expert)",
6
6
  "repository": {