bitboss-ui 2.1.127 → 2.1.129

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.
@@ -71,6 +71,28 @@ export type BbTableColumn<Item = any> = BaseColumn<Item> & {
71
71
  * Defines the classes to be passed to the `<th>`.
72
72
  */
73
73
  thClass?: Classes;
74
+ /**
75
+ * Freezes the column to a fixed width (numbers are treated as px). When
76
+ * omitted the column syncs its width to the parent table's matching track.
77
+ */
78
+ width?: number | string;
79
+ /**
80
+ * For a nested table, where this column snaps onto the parent's grid. The
81
+ * parent's columns form snap points where `select` occupies `[0, 1]`, data
82
+ * column `k` occupies `[k + 1, k + 2]` and `actions` occupies `[N + 1, N + 2]`.
83
+ *
84
+ * - A single number is a start snap point that takes one parent track, e.g.
85
+ * `2` → `[2, 3]`. It may skip ahead (`5` jumps straight to the sixth track),
86
+ * and the next column resumes from where it ends.
87
+ * - A `[start, end]` pair snaps between two points; the width is the sum of
88
+ * the fractional parent tracks it covers, so `[3, 4.5]` is the full fourth
89
+ * track plus half of the fifth. `end` of `-1` runs to the end of the data
90
+ * region.
91
+ *
92
+ * When omitted the column chains from the previous column's end to the next
93
+ * whole snap point (a one-to-one inheritance by index).
94
+ */
95
+ snap?: number | [start: number, end: number];
74
96
  };
75
97
  export type BbTableProps<Item = any> = {
76
98
  /**
@@ -90,6 +112,22 @@ export type BbTableProps<Item = any> = {
90
112
  * Text alignment of the columns.
91
113
  */
92
114
  align?: 'left' | 'center' | 'right';
115
+ /**
116
+ * Stable id for this table's width context. When omitted a unique id is
117
+ * generated. Nested tables use the nearest ancestor id to inherit widths.
118
+ */
119
+ id?: string;
120
+ /**
121
+ * Controls whether unfrozen columns inherit their width from an ancestor
122
+ * table's matching track, accounting for `select`/`actions` columns.
123
+ * - `true` (the default): inherit from the nearest ancestor table.
124
+ * - `false`: do not inherit.
125
+ * - a table id (string): inherit from the specific ancestor in the chain with
126
+ * that id rather than the immediate parent. Use this when an intermediate
127
+ * table has a different column count, so the extra columns would otherwise
128
+ * misalign against it.
129
+ */
130
+ inheritColumnWidths?: boolean | string;
93
131
  /**
94
132
  * Boolean that defines whether to display a "Select all" checkbox.
95
133
  */
@@ -0,0 +1,42 @@
1
+ import { MaybeRefOrGetter } from 'vue';
2
+ /**
3
+ * A single table's entry in the shared width registry.
4
+ *
5
+ * `tracks` is keyed, not indexed, so structural columns participate too:
6
+ * `'select'`, the data-column index (`'0'`, `'1'`, …) and `'actions'`.
7
+ */
8
+ export interface TableWidthNode {
9
+ id: string;
10
+ parentId: string | null;
11
+ /** Measured track widths as CSS lengths, keyed by track id. */
12
+ tracks: Record<string, string>;
13
+ }
14
+ export type TableWidthRegistry = Map<string, TableWidthNode>;
15
+ export interface UseTableWidthContextOptions {
16
+ /** Explicit table id. When omitted a stable unique id is generated. */
17
+ id?: MaybeRefOrGetter<string | undefined>;
18
+ /** This table's container element; used to find the parent table in the DOM. */
19
+ container: MaybeRefOrGetter<HTMLElement | null | undefined>;
20
+ /**
21
+ * Id of a specific ancestor table to inherit from. When set, parent discovery
22
+ * walks the whole DOM ancestor chain for a table with this id rather than
23
+ * stopping at the nearest one. When omitted, the nearest ancestor table is
24
+ * used. A requested id that is not found in the chain yields no parent.
25
+ */
26
+ inheritFrom?: MaybeRefOrGetter<string | undefined>;
27
+ }
28
+ export declare function useTableWidthContext(options: UseTableWidthContextOptions): {
29
+ id: import('vue').ComputedRef<string>;
30
+ parentId: import('vue').Ref<string | null, string | null>;
31
+ parentNode: import('vue').ComputedRef<TableWidthNode | null>;
32
+ parentHasTrack: (key: string) => boolean;
33
+ parentVar: (key: string, fallback?: string) => string;
34
+ node: {
35
+ id: string;
36
+ parentId: string | null;
37
+ tracks: Record<string, string>;
38
+ };
39
+ registry: TableWidthRegistry;
40
+ setTracks: (tracks: Record<string, string>) => void;
41
+ cssVars: import('vue').ComputedRef<Record<string, string>>;
42
+ };