@dolusoft/query-table 3.4.0 → 3.5.1

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.
@@ -186,6 +186,22 @@ export interface TableProps<T extends object = Record<string, unknown>, Q extend
186
186
  * `rows`). Defaults to `false`.
187
187
  */
188
188
  hasSubtable?: boolean;
189
+ /**
190
+ * Which rows can expand, with `hasSubtable` (C-98): called with the row and
191
+ * its index in `rows`. A row it returns `false` for gets an empty expand
192
+ * cell (no button), never draws the `subtable` slot, is skipped by
193
+ * `expandAll()` and ignores its `isExpanded` field. Absent, every row can
194
+ * expand.
195
+ */
196
+ rowExpandable?: (row: T, index: number) => boolean;
197
+ /**
198
+ * A kind for a row, written as `data-row-kind` on its `tr` (C-97): called
199
+ * with the row and its index in `rows`. Data, not styling: the table draws
200
+ * nothing by it, and the consumer's CSS selects
201
+ * `tr[data-row-kind="total"]`. An empty string, `null` or `undefined`
202
+ * writes no attribute.
203
+ */
204
+ rowKind?: (row: T, index: number) => string | null | undefined;
189
205
  /** Add a column with a button that emits `rowRightPanelClick`. Defaults to `false`. */
190
206
  hasRightPanel?: boolean;
191
207
  /**
@@ -7,7 +7,8 @@ import type { Column, FilterCondition, FilterRule } from '../contract.js';
7
7
  * a segment without an operator uses `condition`.
8
8
  * - `number`: one rule with a number value; text that is not a finite number
9
9
  * gives `[]`.
10
- * - `integer`: the same, but only a whole number; `2.5` gives `[]`.
10
+ * - `integer`: the same, but only a whole number in the safe range; `2.5`
11
+ * and `9007199254740993` give `[]`.
11
12
  * - `bool`: `'true'` or `'false'` gives one rule with a boolean value;
12
13
  * anything else gives `[]`.
13
14
  * - `date` and `datetime`: one rule with the trimmed text as its value; the
@@ -29,8 +29,12 @@ declare const __VLS_export: <T extends object>(__VLS_props: NonNullable<Awaited<
29
29
  /** `--qt-pin-left` or `--qt-pin-right` of each pinned cell, by key (C-47, C-71). */
30
30
  offsets: Readonly<Record<string, number>>;
31
31
  keyOf: (row: T, index: number) => string | number;
32
+ /** The row can expand: no expand button otherwise (C-98). */
33
+ canExpand: (row: T, index: number) => boolean;
32
34
  isExpanded: (row: T, index: number) => boolean;
33
35
  toggle: (row: T, index: number) => void;
36
+ /** `data-row-kind` of a row (C-97); absent, no row carries it. */
37
+ rowKind?: (row: T, index: number) => string | null | undefined;
34
38
  labels: TableLabels;
35
39
  /** The consumer listens to `cellContextMenu` (C-28); read at event time. */
36
40
  hasContextMenuListener: () => boolean;
@@ -49,6 +49,12 @@ export interface UseQueryTableOptions<T extends object, Q extends Query = TableQ
49
49
  rowKey?: MaybeRefOrGetter<RowKey<T>>;
50
50
  /** Rows can expand (the `subtable` column). Defaults to `false`. */
51
51
  hasSubtable?: MaybeRefOrGetter<boolean | undefined>;
52
+ /**
53
+ * Which rows can expand, with `hasSubtable` (C-98); without it every row
54
+ * can. Give a getter or a ref that holds the function (`() => fn`): a bare
55
+ * function is read as a getter.
56
+ */
57
+ rowExpandable?: MaybeRefOrGetter<TableProps<T>['rowExpandable']>;
52
58
  /** Page sizes offered. Defaults to `[10, 20, 30, 50, 100]`. */
53
59
  pageSizeOptions?: MaybeRefOrGetter<number[] | undefined>;
54
60
  /** Called once per user action that changes the query, with a new object. */
@@ -135,10 +141,13 @@ export interface QueryTableSearch {
135
141
  export interface QueryTableExpansion<T extends object> {
136
142
  /** Identity of a row: `rowKey`, else its index. */
137
143
  keyOf: (row: T, index: number) => string | number;
144
+ /** `hasSubtable` is on and `rowExpandable` lets the row expand (C-98). */
145
+ canExpand: (row: T, index: number) => boolean;
138
146
  isExpanded: (row: T, index: number) => boolean;
147
+ /** Opens or closes the row; nothing for a row that cannot expand (C-98). */
139
148
  toggle: (row: T, index: number) => void;
140
149
  collapseAll: () => void;
141
- /** Opens every row given; nothing is fetched. */
150
+ /** Opens every row given that can expand; nothing is fetched. */
142
151
  expandAll: () => void;
143
152
  }
144
153
  /** Row selection (C-59), owned by the consumer. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dolusoft/query-table",
3
- "version": "3.4.0",
3
+ "version": "3.5.1",
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.4.0",
49
- "@dolusoft/query-table-core": "3.4.0",
48
+ "@dolusoft/query-protocol": "3.5.1",
49
+ "@dolusoft/query-table-core": "3.5.1",
50
50
  "@tanstack/vue-table": "9.2.6"
51
51
  },
52
52
  "devDependencies": {