@dolusoft/query-table 3.7.0 → 3.7.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.
@@ -1,3 +1,13 @@
1
+ /**
2
+ * Sets inline declarations for one read and puts every `style` attribute
3
+ * back exactly as it was, absent included, so the markup after the call is
4
+ * the markup before it (C-31). `!important` so a consumer's `!important`
5
+ * rule cannot keep the fixed layout during the read.
6
+ */
7
+ export declare const styleSwap: () => {
8
+ set(element: HTMLElement, property: string, value: string): void;
9
+ restore(): void;
10
+ };
1
11
  /**
2
12
  * The max-content width of each drawn column, by `field`: header label and
3
13
  * the cells of the drawn data rows, padding and border included, in whole
@@ -25,15 +25,19 @@ export declare const clampWidth: (column: Column, width: number) => number;
25
25
  * drag is under way (the preview, P2); every committed width goes out as a
26
26
  * `columnResize` event and comes back, if the consumer wants it, as
27
27
  * `Column.width`. The handle captures the pointer, so all drag events arrive
28
- * at the handle itself, and it has the focus, so Escape does too.
28
+ * at the handle itself, and it has the focus, so Escape does too. The pointer
29
+ * and the arrow keys move the drawn width; what the table writes and emits is
30
+ * the declared width that draws it (`measureWidthScale`).
29
31
  */
30
32
  export declare const useColumnResize: (options: ColumnResizeOptions) => {
31
33
  preview: import("vue").ShallowRef<{
32
34
  field: string;
33
35
  width: number;
36
+ rendered: number;
34
37
  } | null, {
35
38
  field: string;
36
39
  width: number;
40
+ rendered: number;
37
41
  } | null>;
38
42
  isResizable: (column: Column) => boolean;
39
43
  widthOf: (column: Column) => number;
@@ -0,0 +1,34 @@
1
+ /** How a column's declared width maps to the width it is drawn at. */
2
+ export interface WidthScale {
3
+ /** The declared width that draws the column `rendered` pixels wide. */
4
+ declared: (rendered: number) => number;
5
+ /** The width the column is drawn at with the `declared` width. */
6
+ rendered: (declared: number) => number;
7
+ }
8
+ /** The declared width is the drawn one. */
9
+ export declare const identityScale: WidthScale;
10
+ /**
11
+ * A table whose cells take `space` (a container's width, with
12
+ * `min-width: 100%`) and whose columns are declared narrower: the fixed
13
+ * layout spreads the rest over the columns by their declared widths, so a
14
+ * column declared `w` next to `others` is drawn `w * space / (w + others)`
15
+ * wide until the columns fill the space, and `w` from there on. With no other
16
+ * column the one column takes the space whatever its width: the identity.
17
+ */
18
+ export declare const stretchedScale: (space: number, others: number) => WidthScale;
19
+ /**
20
+ * How the declared width of the column of `th` maps to its drawn width, read
21
+ * from the layout. The column is drawn once at the width it is drawn at now.
22
+ * Wider there, the table stretches it: its row's cells take the whole space,
23
+ * and the other columns' declared widths follow from the stretch; the fit
24
+ * must then give back the width the column is drawn at now. Not wider, the
25
+ * column is drawn once more at `low`, the narrowest width a resize writes. A
26
+ * table that stretches it there widens every cell of the row by one factor,
27
+ * the column at least as much (content the fixed layout keeps wider than
28
+ * `low` only adds to it), and its cells then take the space the columns can
29
+ * shrink into before the table stretches them. Any other layout gets the
30
+ * identity: one that never stretches, a column without a width that takes
31
+ * what is left, one that spreads the space otherwise. Every style is put back before the
32
+ * function returns (C-31), so nothing is painted in between.
33
+ */
34
+ export declare const measureWidthScale: (th: HTMLElement, low: number) => WidthScale;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dolusoft/query-table",
3
- "version": "3.7.0",
3
+ "version": "3.7.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.7.0",
49
- "@dolusoft/query-table-core": "3.7.0",
48
+ "@dolusoft/query-protocol": "3.7.1",
49
+ "@dolusoft/query-table-core": "3.7.1",
50
50
  "@tanstack/vue-table": "9.2.6"
51
51
  },
52
52
  "devDependencies": {