@dolusoft/query-table 3.3.0 → 3.4.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.
@@ -322,6 +322,14 @@ export interface CellContextMenuPayload<T> {
322
322
  /** Index into `columns`, hidden columns included. */
323
323
  columnIndex: number;
324
324
  }
325
+ /** Payload of the `headerContextMenu` event (C-96). */
326
+ export interface HeaderContextMenuPayload {
327
+ event: MouseEvent;
328
+ /** The column definition the consumer passed. */
329
+ column: Column;
330
+ /** Index into `columns`, hidden columns included. */
331
+ columnIndex: number;
332
+ }
325
333
  /** Payload of the `columnResize` event. */
326
334
  export interface ColumnResizePayload {
327
335
  /** `field` of the resized column. */
@@ -372,6 +380,12 @@ export type TableEmits<T, Q extends Query = TableQuery> = {
372
380
  * suppressed; without one the table emits nothing and keeps it.
373
381
  */
374
382
  cellContextMenu: [payload: CellContextMenuPayload<T>];
383
+ /**
384
+ * A data-column header was right-clicked (C-96). With a listener the
385
+ * browser menu is suppressed; without one the table emits nothing and
386
+ * keeps it. The filter row and utility headers keep the browser menu.
387
+ */
388
+ headerContextMenu: [payload: HeaderContextMenuPayload];
375
389
  /**
376
390
  * The user resized a column: on release of a drag, on an arrow key or on
377
391
  * autofit. Write `width` back to the column (`Column.width`), or the column
@@ -0,0 +1,23 @@
1
+ import type { Column, HeaderContextMenuPayload } from '../contract.js';
2
+ export interface HeaderContextMenuOptions {
3
+ /** The drawn columns (hidden already dropped), in drawing order. */
4
+ columns: () => Column[];
5
+ /**
6
+ * Original index of a drawn column in the consumer's `columns` (hidden
7
+ * included), as C-28's `columnIndex`.
8
+ */
9
+ indexOf: (field: string) => number | undefined;
10
+ /** Someone listens to `headerContextMenu`; without one the menu is left alone. */
11
+ listening: () => boolean;
12
+ onContextMenu: (payload: HeaderContextMenuPayload) => void;
13
+ }
14
+ /**
15
+ * One listener on the `thead` serves every header cell (C-96): a listener per
16
+ * cell would be a new closure per cell on every render. Only a data column
17
+ * header emits (`data-field`); utility cells keep the browser menu. A right
18
+ * click inside the filter row (`.qt-filter`) keeps the browser menu too, so
19
+ * paste and spell-check stay (issue #102 S1(a)).
20
+ */
21
+ export declare const useHeaderContextMenu: (options: HeaderContextMenuOptions) => {
22
+ onContextMenu: (event: MouseEvent) => void;
23
+ };
@@ -5,6 +5,7 @@ declare const __VLS_export: <T extends object, Q extends Query = TableQuery>(__V
5
5
  onCellContextMenu?: ((payload: import("./contract.js").CellContextMenuPayload<T>) => any) | undefined;
6
6
  "onUpdate:query"?: ((query: Q, reason: "reset" | "page" | "pageSize" | "sort" | "filter" | "search") => any) | undefined;
7
7
  "onUpdate:selection"?: ((selection: import("./contract.js").RowSelection) => any) | undefined;
8
+ onHeaderContextMenu?: ((payload: import("./contract.js").HeaderContextMenuPayload) => any) | undefined;
8
9
  onColumnResize?: ((payload: import("./contract.js").ColumnResizePayload) => any) | undefined;
9
10
  "onUpdate:columns"?: ((columns: import("./contract.js").Column[], reason: import("./contract.js").ColumnChangeReason) => any) | undefined;
10
11
  "onUpdate:rowPinning"?: ((rowPinning: import("./contract.js").RowPinning) => any) | undefined;
@@ -14,7 +15,7 @@ declare const __VLS_export: <T extends object, Q extends Query = TableQuery>(__V
14
15
  expose: (exposed: import("vue").ShallowUnwrapRef<QueryTableExpose>) => void;
15
16
  attrs: any;
16
17
  slots: TableSlots<T>;
17
- emit: ((evt: "rowRightPanelClick", row: T) => void) & ((evt: "cellContextMenu", payload: import("./contract.js").CellContextMenuPayload<T>) => void) & ((evt: "update:query", query: Q, reason: "reset" | "page" | "pageSize" | "sort" | "filter" | "search") => void) & ((evt: "update:selection", selection: import("./contract.js").RowSelection) => void) & ((evt: "columnResize", payload: import("./contract.js").ColumnResizePayload) => void) & ((evt: "update:columns", columns: import("./contract.js").Column[], reason: import("./contract.js").ColumnChangeReason) => void) & ((evt: "update:rowPinning", rowPinning: import("./contract.js").RowPinning) => void);
18
+ emit: ((evt: "rowRightPanelClick", row: T) => void) & ((evt: "cellContextMenu", payload: import("./contract.js").CellContextMenuPayload<T>) => void) & ((evt: "update:query", query: Q, reason: "reset" | "page" | "pageSize" | "sort" | "filter" | "search") => void) & ((evt: "update:selection", selection: import("./contract.js").RowSelection) => void) & ((evt: "headerContextMenu", payload: import("./contract.js").HeaderContextMenuPayload) => void) & ((evt: "columnResize", payload: import("./contract.js").ColumnResizePayload) => void) & ((evt: "update:columns", columns: import("./contract.js").Column[], reason: import("./contract.js").ColumnChangeReason) => void) & ((evt: "update:rowPinning", rowPinning: import("./contract.js").RowPinning) => void);
18
19
  }>) => import("vue").VNode & {
19
20
  __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
20
21
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dolusoft/query-table",
3
- "version": "3.3.0",
3
+ "version": "3.4.0",
4
4
  "description": "A thin Vue 3 table for server-side data: it renders rows and emits sort, filter, search and paging changes. Built on TanStack Table.",
5
5
  "private": false,
6
6
  "type": "module",
@@ -45,8 +45,8 @@
45
45
  ],
46
46
  "license": "MIT",
47
47
  "dependencies": {
48
- "@dolusoft/query-protocol": "3.3.0",
49
- "@dolusoft/query-table-core": "3.3.0",
48
+ "@dolusoft/query-protocol": "3.4.0",
49
+ "@dolusoft/query-table-core": "3.4.0",
50
50
  "@tanstack/vue-table": "9.2.6"
51
51
  },
52
52
  "devDependencies": {