@dolusoft/query-table 3.7.1 → 3.8.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.
@@ -238,6 +238,17 @@ export interface TableProps<T extends object = Record<string, unknown>, Q extend
238
238
  * `table-layout: fixed` (C-85). Defaults to `false`.
239
239
  */
240
240
  virtual?: boolean | VirtualOptions;
241
+ /**
242
+ * Draw the header, the body and the footer as three tables in
243
+ * `.qt-table-head`, `.qt-table-body` and `.qt-table-foot`, so the body
244
+ * scrolls under a header that stays outside it (C-101, C-102). The columns
245
+ * of the body and footer take the widths of the header cells, and the
246
+ * three scroll sideways together. In your CSS give the three wrappers
247
+ * `overflow-y: scroll`, the body a height and `overflow-x: auto`, the
248
+ * header and footer `overflow-x: hidden` and a transparent scrollbar, and
249
+ * the body and footer tables `table-layout: fixed`. Defaults to `false`.
250
+ */
251
+ scrollBody?: boolean;
241
252
  /**
242
253
  * Ask for the next page (`update:query`, reason `page`) when the end of
243
254
  * `rows` comes into view (C-88); append the rows of a `page` answer and
@@ -1,5 +1,5 @@
1
1
  import { type RowsUpdate } from '@dolusoft/query-table-core/row-changes';
2
- import { type ShallowRef, type VNode } from 'vue';
2
+ import { type Ref, type ShallowRef, type VNode } from 'vue';
3
3
  import type { FlashOptions, Query } from '../contract.js';
4
4
  import type { RowKey } from '../use-query-table.js';
5
5
  import { type FlashPhase } from './marks.js';
@@ -12,7 +12,7 @@ export interface ChangeFlashOptions<T extends object> {
12
12
  /** The fields of the drawn columns. */
13
13
  fields: () => readonly string[];
14
14
  rowKey: () => RowKey<T>;
15
- table: ShallowRef<HTMLTableElement | null>;
15
+ table: Readonly<Ref<HTMLTableElement | null>>;
16
16
  }
17
17
  /** What the body draws with: the marks and the binding hook (C-94). */
18
18
  export interface FlashView<T> {
@@ -45,6 +45,8 @@ declare const __VLS_export: <T extends object>(__VLS_props: NonNullable<Awaited<
45
45
  * the body draws what it drew in 3.2 and calls nothing per row (C-95).
46
46
  */
47
47
  flash: FlashView<T> | null;
48
+ /** With `scrollBody`: the ARIA table roles of C-102. */
49
+ roles?: boolean;
48
50
  } & {
49
51
  onRowRightPanelClick?: ((row: T) => any) | undefined;
50
52
  onCellContextMenu?: ((payload: CellContextMenuPayload<T>) => any) | undefined;
@@ -11,6 +11,8 @@ type __VLS_Props = {
11
11
  offsets: Readonly<Record<string, number>>;
12
12
  /** With `virtual`: `aria-rowindex` of the first footer row (C-86). */
13
13
  firstRowIndex?: number;
14
+ /** With `scrollBody`: the ARIA table roles of C-102. */
15
+ roles?: boolean;
14
16
  };
15
17
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
16
18
  declare const _default: typeof __VLS_export;
@@ -19,6 +19,8 @@ type __VLS_Props = {
19
19
  * that they stay stable; this says which ones to draw.
20
20
  */
21
21
  slotNames: string;
22
+ /** With `scrollBody`: the ARIA table roles of C-102. */
23
+ roles?: boolean;
22
24
  };
23
25
  type __VLS_Slots = {
24
26
  'filter-datetime'?(props: FilterDatetimeSlotProps): unknown;
@@ -10,7 +10,10 @@ export interface HeaderGeometryOptions {
10
10
  table: ShallowRef<HTMLTableElement | null>;
11
11
  /** The header cells as drawn: utilities first, then the columns. */
12
12
  cells: () => HeaderCellKey[];
13
- /** Some column is pinned on either side (C-46, C-71) or has a resize handle (C-48). */
13
+ /**
14
+ * Some column is pinned on either side (C-46, C-71) or has a resize handle
15
+ * (C-48), or the body is a table of its own (`scrollBody`, C-101).
16
+ */
14
17
  active: () => boolean;
15
18
  }
16
19
  /**
@@ -28,5 +31,6 @@ export declare const useHeaderGeometry: (options: HeaderGeometryOptions) => {
28
31
  widths: ShallowRef<Readonly<Record<string, number>>, Readonly<Record<string, number>>>;
29
32
  tableWidth: ShallowRef<number, number>;
30
33
  offsets: ShallowRef<Readonly<Record<string, number>>, Readonly<Record<string, number>>>;
34
+ columns: ShallowRef<readonly number[], readonly number[]>;
31
35
  };
32
36
  export {};
@@ -17,5 +17,8 @@ export declare const styleSwap: () => {
17
17
  * between, and slot content that draws a block or a flex box counts with the
18
18
  * width its content needs, not the width its cell gives it. Only `fields`
19
19
  * when given; a column with no box (the table not displayed) is left out.
20
+ * With `scrollBody` the data rows are in a table of their own, `body`
21
+ * (C-101): it is laid out the same way, its `col` widths left out, and a
22
+ * column takes the wider of its header cell and its body cells.
20
23
  */
21
- export declare const measureColumnWidths: (table: HTMLTableElement | null | undefined, fields?: readonly string[]) => Record<string, number>;
24
+ export declare const measureColumnWidths: (table: HTMLTableElement | null | undefined, fields?: readonly string[], body?: HTMLTableElement | null) => Record<string, number>;
@@ -8,6 +8,8 @@ export interface AutoWidthOptions {
8
8
  /** The `autoWidthMax` prop: the limit of a column without `maxWidth`. */
9
9
  max: () => number | undefined;
10
10
  table: ShallowRef<HTMLTableElement | null>;
11
+ /** With `scrollBody`: the table of the body rows (C-101), else `null`. */
12
+ body: () => HTMLTableElement | null;
11
13
  /** The visible columns, as given. */
12
14
  columns: () => Column[];
13
15
  rows: () => readonly unknown[];
@@ -6,6 +6,8 @@ export interface ColumnResizeOptions {
6
6
  measuredWidth: (field: string) => number | undefined;
7
7
  /** Measured width of the table. */
8
8
  tableWidth: () => number;
9
+ /** With `scrollBody`: the table of the body rows (C-101), else `null`. */
10
+ body: () => HTMLTableElement | null;
9
11
  emit: (payload: ColumnResizePayload) => void;
10
12
  }
11
13
  /**
@@ -0,0 +1,22 @@
1
+ /** The wrappers of `scrollBody`, `null` while not drawn. */
2
+ interface ScrollBodyWrappers {
3
+ head: HTMLElement | null;
4
+ body: HTMLElement | null;
5
+ foot: HTMLElement | null;
6
+ }
7
+ export interface ScrollBodyOptions {
8
+ /** The `scrollBody` prop. */
9
+ enabled: () => boolean;
10
+ wrappers: () => ScrollBodyWrappers;
11
+ /** The table of the body rows: its layout is checked once (C-101). */
12
+ bodyTable: () => HTMLTableElement | null;
13
+ }
14
+ /**
15
+ * Header, body and footer of `scrollBody` scroll sideways together (C-101):
16
+ * one passive `scroll` listener on each wrapper sets the `scrollLeft` of the
17
+ * others to its own. A position written here is remembered, so the `scroll`
18
+ * event it fires is not taken for one of the user's. The table writes no
19
+ * style and no attribute to the wrappers. Off, nothing is listened to.
20
+ */
21
+ export declare const useScrollBody: (options: ScrollBodyOptions) => void;
22
+ export {};
@@ -1,5 +1,5 @@
1
1
  import { type PageCursors, type Query } from '@dolusoft/query-protocol';
2
- import { type ShallowRef } from 'vue';
2
+ import { type Ref } from 'vue';
3
3
  import type { InfiniteOptions } from '../contract.js';
4
4
  export interface LoadMoreOptions {
5
5
  infinite: () => boolean | InfiniteOptions | undefined;
@@ -11,7 +11,7 @@ export interface LoadMoreOptions {
11
11
  loading: () => boolean;
12
12
  /** The next page action (C-05, C-56). */
13
13
  nextPage: () => void;
14
- table: ShallowRef<HTMLTableElement | null>;
14
+ table: Readonly<Ref<HTMLTableElement | null>>;
15
15
  /** The body is virtual (C-83). */
16
16
  virtual: () => boolean;
17
17
  /**
@@ -1,4 +1,4 @@
1
- import { type ShallowRef } from 'vue';
1
+ import { type Ref } from 'vue';
2
2
  import type { ScrollToIndexOptions, VirtualOptions } from '../contract.js';
3
3
  import type { BodyRow } from '../use-query-table.js';
4
4
  import { type WindowRange } from './compute-window.js';
@@ -13,7 +13,7 @@ export interface SpacerRow {
13
13
  }
14
14
  export interface RowWindowOptions<T> {
15
15
  virtual: () => boolean | VirtualOptions | undefined;
16
- table: ShallowRef<HTMLTableElement | null>;
16
+ table: Readonly<Ref<HTMLTableElement | null>>;
17
17
  /** The rows in drawing order: pinned top, the others, pinned bottom (C-74). */
18
18
  bodyRows: () => BodyRow<T>[];
19
19
  keyOf: (row: T, index: number) => string | number;
@@ -28,8 +28,8 @@ export interface RowWindowOptions<T> {
28
28
  export declare const useRowWindow: <T extends object>(o: RowWindowOptions<T>) => {
29
29
  enabled: () => boolean;
30
30
  drawn: import("vue").ComputedRef<(SpacerRow | DrawnRow<T>)[]>;
31
- range: ShallowRef<WindowRange, WindowRange>;
32
- ready: ShallowRef<boolean, boolean>;
31
+ range: import("vue").ShallowRef<WindowRange, WindowRange>;
32
+ ready: import("vue").ShallowRef<boolean, boolean>;
33
33
  centerCount: () => number;
34
34
  expandedCount: () => number;
35
35
  scrollToIndex: (index: number, options?: ScrollToIndexOptions) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dolusoft/query-table",
3
- "version": "3.7.1",
3
+ "version": "3.8.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.7.1",
49
- "@dolusoft/query-table-core": "3.7.1",
48
+ "@dolusoft/query-protocol": "3.8.0",
49
+ "@dolusoft/query-table-core": "3.8.0",
50
50
  "@tanstack/vue-table": "9.2.6"
51
51
  },
52
52
  "devDependencies": {