@nanahoshi/mona-ui 0.51.0 → 0.52.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.
@@ -0,0 +1,272 @@
1
+ # Tile View
2
+
3
+ > A collection as tiles in rows that fill the width, virtualized, with file-explorer selection.
4
+
5
+ Entry point: `@nanahoshi/mona-ui/tile-view`
6
+
7
+ **Selector:** `mona-tile-view`
8
+
9
+ `TileViewComponent` shows a collection as tiles of one size, in rows that fill the width, like the icons of a file explorer. Only the rows in view are rendered, so it stays fast with tens of thousands of items. It is one Tab stop: the arrow keys move in two dimensions, and selection works as in a file explorer, with Ctrl and Shift.
10
+
11
+ Import it from `@nanahoshi/mona-ui/tile-view`, and name every tile view with `aria-label` or `aria-labelledby`.
12
+
13
+ ## Overview
14
+
15
+ Tile View renders items as tiles: a `role="listbox"` of `option`s you select from, or a `role="list"` of `listitem`s with `selectionMode="none"`. Tiles are all `tileWidth` by `tileHeight` pixels, and a row holds as many as fit the width, or the number `columns` gives. Rows are virtualized, so a folder of 50,000 pictures scrolls as smoothly as one of fifty.
16
+
17
+ **Use Tile View when:**
18
+
19
+ - Items are best recognized by a picture: photos, files, products, avatars.
20
+ - The collection can be large, and the keyboard should move up, down, left and right through it.
21
+
22
+ **Use `ListView` instead when:**
23
+
24
+ - Items are rows of text, grouped or paged.
25
+
26
+ **Use `Grid` instead when:**
27
+
28
+ - Items need columns of details, sorting by column, or editing.
29
+
30
+ ## Import & Quick Start
31
+
32
+ ```typescript
33
+ import { TileViewComponent } from "@nanahoshi/mona-ui/tile-view";
34
+ ```
35
+
36
+ ```html
37
+ <mona-tile-view aria-label="Fruits" class="h-64" [items]="fruits" [(selectedKeys)]="selected" />
38
+ ```
39
+
40
+ `items` accepts any `Iterable<T>`. Without an item template, each tile shows the item's text: `textField` names a property or gives a function `(item: T) => string`, and without it the item itself is converted to text. Give the tile view a height, through `class` or its container: it fills its container and scrolls inside it.
41
+
42
+ ## Anatomy
43
+
44
+ Each template below is an `ng-template` placed inside `<mona-tile-view>...</mona-tile-view>`.
45
+
46
+ | Directive | Selector | Template context | Replaces |
47
+ |-----------------------------------|-------------------------------------------|----------------------------------------------------------------------------------------------|----------------------------------|
48
+ | `TileViewItemTemplateDirective` | `ng-template[monaTileViewItemTemplate]` | `TileViewItemTemplateContext<T>`: `{ $implicit: T, selected, active, index, slot }` | The item's text, centered |
49
+ | `TileViewNoDataTemplateDirective` | `ng-template[monaTileViewNoDataTemplate]` | None | The default "No data" placeholder |
50
+
51
+ ```html
52
+ <mona-tile-view aria-label="Pictures" itemKey="id" textField="name" [items]="pictures">
53
+ <ng-template monaTileViewItemTemplate [monaTileViewItemTemplateOf]="pictures" let-picture let-slot="slot">
54
+ <img alt="" class="mx-auto mt-2 size-16 object-contain" [src]="picture.thumbnail" />
55
+ <span class="line-clamp-2 px-1 text-center text-sm">{{ picture.name }}</span>
56
+ </ng-template>
57
+ </mona-tile-view>
58
+ ```
59
+
60
+ Bind the tile view's items to `[monaTileViewItemTemplateOf]` to type `let-picture`; without it, the item is `any`. A tile is a column of flex content: the template's elements stack from the top. Keep item templates free of buttons and links, since tiles are options of a listbox.
61
+
62
+ ## Examples
63
+
64
+ ### Selection
65
+
66
+ `basic-example.component.ts`
67
+
68
+ ```typescript
69
+ import { Component, signal } from "@angular/core";
70
+ import { TileViewComponent } from "@nanahoshi/mona-ui/tile-view";
71
+
72
+ @Component({
73
+ selector: "app-tile-view-basic-example",
74
+ imports: [TileViewComponent],
75
+ templateUrl: "./basic-example.component.html"
76
+ })
77
+ export class TileViewBasicExampleComponent {
78
+ protected readonly fruits = [
79
+ "Apple",
80
+ "Banana",
81
+ "Cherry",
82
+ "Date",
83
+ "Elderberry",
84
+ "Fig",
85
+ "Grape",
86
+ "Kiwi",
87
+ "Lemon",
88
+ "Mango",
89
+ "Nectarine",
90
+ "Orange"
91
+ ];
92
+ protected readonly selected = signal<readonly unknown[]>(["Cherry"]);
93
+ }
94
+ ```
95
+
96
+ `basic-example.component.html`
97
+
98
+ ```html
99
+ <div class="flex flex-col gap-2">
100
+ <mona-tile-view
101
+ aria-label="Fruits"
102
+ class="h-64"
103
+ selectionMode="multiple"
104
+ [items]="fruits"
105
+ [tileHeight]="64"
106
+ [tileWidth]="96"
107
+ [(selectedKeys)]="selected" />
108
+ <span aria-live="polite" class="text-sm">Selected: {{ selected().join(", ") || "none" }}</span>
109
+ </div>
110
+ ```
111
+
112
+ `selectedKeys` holds the keys of the selected items, and `[(selectedKeys)]` follows the user's selection. `itemKey` names the property, or gives the function, that is each item's key; without it, the item itself is its key. Keys must be unique. Keys set through `selectedKeys` aren't emitted back.
113
+
114
+ ### Pictures and many items
115
+
116
+ `pictures-example.component.ts`
117
+
118
+ ```typescript
119
+ import { Component, signal } from "@angular/core";
120
+ import {
121
+ type TileViewItemActivateEvent,
122
+ TileViewComponent,
123
+ TileViewItemTemplateDirective
124
+ } from "@nanahoshi/mona-ui/tile-view";
125
+
126
+ interface Picture {
127
+ readonly hue: number;
128
+ readonly id: number;
129
+ readonly name: string;
130
+ }
131
+
132
+ @Component({
133
+ selector: "app-tile-view-pictures-example",
134
+ imports: [TileViewComponent, TileViewItemTemplateDirective],
135
+ templateUrl: "./pictures-example.component.html"
136
+ })
137
+ export class TileViewPicturesExampleComponent {
138
+ protected readonly opened = signal("");
139
+ protected readonly pictures: readonly Picture[] = Array.from({ length: 10_000 }, (_, i) => ({
140
+ hue: (i * 47) % 360,
141
+ id: i + 1,
142
+ name: `Picture ${i + 1}`
143
+ }));
144
+ protected readonly selected = signal<readonly unknown[]>([]);
145
+
146
+ protected open(event: TileViewItemActivateEvent<Picture>): void {
147
+ this.opened.set(event.item.name);
148
+ }
149
+ }
150
+ ```
151
+
152
+ `pictures-example.component.html`
153
+
154
+ ```html
155
+ <div class="flex flex-col gap-2">
156
+ <mona-tile-view
157
+ aria-label="Pictures"
158
+ class="h-80"
159
+ itemKey="id"
160
+ selectionMode="multiple"
161
+ textField="name"
162
+ [items]="pictures"
163
+ [(selectedKeys)]="selected"
164
+ (itemActivate)="open($event)">
165
+ <ng-template monaTileViewItemTemplate [monaTileViewItemTemplateOf]="pictures" let-picture>
166
+ <span
167
+ aria-hidden="true"
168
+ class="mx-auto mt-2 size-14 shrink-0 rounded-sm forced-color-adjust-none"
169
+ [style.background-color]="'hsl(' + picture.hue + ' 55% 50%)'"></span>
170
+ <span class="mt-1 line-clamp-2 px-1 text-center text-sm wrap-break-word">{{ picture.name }}</span>
171
+ </ng-template>
172
+ </mona-tile-view>
173
+ <span aria-live="polite" class="text-sm">
174
+ {{ selected().length }} selected{{ opened() ? ", opened " + opened() : "" }}
175
+ </span>
176
+ </div>
177
+ ```
178
+
179
+ Ten thousand tiles, each a picture and a name. Double-click a tile, or press Enter, to activate it: `itemActivate` emits the item and the event, so Ctrl+Enter can do something else than Enter.
180
+
181
+ ## Appearance & Styling
182
+
183
+ The tile view fills its container's width and height, and has no size of its own, since only the rows in view are rendered: give the container a height, or the tile view a class such as `h-96`. `tileWidth`, `tileHeight` and `gap` size the tiles and the space between and around them, in pixels. Every tile must render at `tileHeight`, or scrolling drifts. `rounded` and `size` set the frame's radius and the text size, and `class` is merged onto the host with `tailwind-merge`.
184
+
185
+ A selected tile has the selection background, and the tile the keyboard is on has a 2px ring. In forced colors, where backgrounds and rings don't paint, a selected tile has a `Highlight` frame, and the keyboard's tile a dashed outline inside it.
186
+
187
+ ## Behavior
188
+
189
+ ### Selection follows a file explorer
190
+
191
+ | Mode | Click | Ctrl+click | Shift+click | Click in empty space |
192
+ |--------------|--------------------|------------------------|--------------------------------|----------------------|
193
+ | `"multiple"` | Selects that tile | Adds or removes it | Selects from the anchor to it | Clears the selection |
194
+ | `"single"` | Selects that tile | Selects it, or clears it if it is selected | Selects that tile | Clears the selection |
195
+ | `"none"` | Moves the focus | Moves the focus | Moves the focus | Nothing |
196
+
197
+ The anchor is the tile last clicked, or moved to, without Shift. Ctrl+Shift+click adds the range to the selection.
198
+
199
+ ### The active tile follows the app's selection
200
+
201
+ When the app sets `selectedKeys` to keys that don't include the active tile, such as the key of an item it just added, the first selected tile in item order becomes active and is scrolled into view. `scrollToItem(key)` scrolls a tile into view without changing anything else.
202
+
203
+ ### When items change
204
+
205
+ The active tile stays on its item while the item is there. When it goes, the item that takes its place becomes active. Selected keys aren't pruned: the app owns them.
206
+
207
+ ### Tiles are reused
208
+
209
+ Only the tiles in view and a row or two around them are rendered. A row that scrolls away is reused for one that scrolls in, and its tiles show other items: the item template's context changes, and its elements and components stay. Keep what a tile shows in the item or derive it from the item, not in state a component of the template keeps on its own.
210
+
211
+ ### Slots
212
+
213
+ `slot` in the item template's context is a number no other rendered tile has: a tile that scrolls into view takes it over from one that scrolled away. Key work by it that a newer tile should replace, such as a request for a picture, so that scrolling fast to the end leaves only the last screen waiting. Slots change when the view's size does.
214
+
215
+ ## Accessibility
216
+
217
+ ### Keyboard
218
+
219
+ | Key | Action |
220
+ |-----------------------------|--------------------------------------------------------------------------------------------------|
221
+ | `ArrowLeft` / `ArrowRight` | Move to the previous or next tile in the row (swapped right to left). Stops at the row's ends. |
222
+ | `ArrowUp` / `ArrowDown` | Move to the tile above or below. Down from a column the last row lacks goes to the last tile. |
223
+ | `PageUp` / `PageDown` | Move by as many rows as fit in view. |
224
+ | `Home` / `End` | Move to the first or last tile. |
225
+ | `Shift` + a move | Select from the anchor to the tile moved to. |
226
+ | `Ctrl` + a move | Move without selecting. |
227
+ | `Space` | Select the active tile, adding it in multiple selection. `Ctrl+Space` adds or removes it. |
228
+ | `Ctrl+A` | Select all, in multiple selection. |
229
+ | `Enter` | Emit `itemActivate` for the active tile. |
230
+ | Letters, digits | Typeahead: move to the next tile whose text starts with what was typed. A space typed quickly after a letter is part of the text. |
231
+
232
+ A move without Ctrl selects the tile moved to, in single and multiple selection. Arrow keys with Alt are left to the page.
233
+
234
+ ### Focus
235
+
236
+ The tile view is one Tab stop: the listbox takes the focus, and `aria-activedescendant` points at the active tile. Tabbing in makes the first selected tile active, or the first tile, without selecting it. A click focuses the tile view without scrolling it. The active tile shows its ring only while the keyboard is in use, as `:focus-visible` would. An empty tile view keeps its listbox as the Tab stop, with a ring of its own, described by the "No data" text.
237
+
238
+ ### ARIA
239
+
240
+ | Attribute | Where | Value |
241
+ |----------------------------------|-------------------------------------------|-----------------------------------------------------------------|
242
+ | `role` | The scrolling element | `"listbox"`, or `"list"` with `selectionMode="none"` |
243
+ | `aria-label` / `aria-labelledby` | The listbox | From the inputs of the same names (not left on the host) |
244
+ | `aria-multiselectable` | The listbox, in multiple selection | `true` |
245
+ | `aria-activedescendant` | The listbox, while focused | The active tile's id |
246
+ | `aria-busy` | The listbox, while `loading` | `true` |
247
+ | `aria-describedby` | The listbox, when empty | The "No data" text, or the no-data template |
248
+ | `role` | Each row | `"none"` |
249
+ | `role` | Each tile | `"option"`, or `"listitem"` with `selectionMode="none"` |
250
+ | `aria-selected` | Each option | Whether the item is selected |
251
+ | `aria-posinset` / `aria-setsize` | Each tile | The item's 1-based position and the number of items, since only some tiles are rendered |
252
+ | `role="status"` | A visually hidden element after the tiles | "Loading" while `loading`, and "No data" when there are no items, unless a no-data template says it |
253
+
254
+ Give pictures in item templates an empty `alt` when the tile's text names the item, so it isn't read twice.
255
+
256
+ ## API
257
+
258
+ Everything below is imported from `@nanahoshi/mona-ui/tile-view`. Each name links to its reference page, with every input, output, property and method.
259
+
260
+ | Name | Kind | Description |
261
+ | --- | --- | --- |
262
+ | [`TileViewComponent`](api/tile-view.md#tileviewcomponent) | Component | A collection shown as tiles of one size, in rows that fill the width, like the icons of a file explorer. |
263
+ | [`TileViewItemTemplateDirective`](api/tile-view.md#tileviewitemtemplatedirective) | Directive | Template for each tile of a tile view. |
264
+ | [`TileViewNoDataTemplateDirective`](api/tile-view.md#tileviewnodatatemplatedirective) | Directive | Template shown in place of the tiles while there are no items. |
265
+
266
+ ### Types
267
+
268
+ | Type | Kind | Description |
269
+ | --- | --- | --- |
270
+ | [`TileViewItemActivateEvent`](api/tile-view.md#tileviewitemactivateevent) | Interface | A tile was activated: double-clicked, or Enter was pressed on it. |
271
+ | [`TileViewItemTemplateContext`](api/tile-view.md#tileviewitemtemplatecontext) | Interface | The context of a `monaTileViewItemTemplate`: the data item, as `let-item`, and the tile's state. |
272
+ | [`TileViewSelectionMode`](api/tile-view.md#tileviewselectionmode) | Type alias | How tiles are selected: not at all, one at a time, or several, as in a file explorer, with Ctrl and Shift. |
@@ -1,4 +1,4 @@
1
- import { q as GridService } from "./grid.styles-D6jP3vwD.mjs";
1
+ import { q as GridService } from "./grid.styles-DBLUtq2X.mjs";
2
2
  import * as i0 from "@angular/core";
3
3
  import { Component, inject } from "@angular/core";
4
4
  import { take } from "rxjs";
@@ -74,4 +74,4 @@ i0.ɵɵngDeclareClassMetadata({
74
74
  });
75
75
  export { removeGridRow as n, GridColgroupComponent as t };
76
76
 
77
- //# sourceMappingURL=grid-colgroup.component-BFbiAvkG.mjs.map
77
+ //# sourceMappingURL=grid-colgroup.component-Ccz4jNGD.mjs.map
@@ -1,4 +1,4 @@
1
- import { H as GridLogicalCellDirective, K as GridLockedCellDirective, h as gridFooterTableRowThemeVariants, m as gridFooterTableCellThemeVariants, q as GridService } from "./grid.styles-D6jP3vwD.mjs";
1
+ import { H as GridLogicalCellDirective, K as GridLockedCellDirective, h as gridFooterTableRowThemeVariants, m as gridFooterTableCellThemeVariants, q as GridService } from "./grid.styles-DBLUtq2X.mjs";
2
2
  import { NgTemplateOutlet } from "@angular/common";
3
3
  import * as i0 from "@angular/core";
4
4
  import { Component, Directive, computed, inject, input } from "@angular/core";
@@ -484,4 +484,4 @@ i0.ɵɵngDeclareClassMetadata({
484
484
  });
485
485
  export { GridFooterRowComponent };
486
486
 
487
- //# sourceMappingURL=grid-footer-row.component-DpSu7jvG.mjs.map
487
+ //# sourceMappingURL=grid-footer-row.component-3i2wvQ6a.mjs.map
@@ -1,7 +1,7 @@
1
- import { I as gridRowDragPreviewThemeVariants, K as GridLockedCellDirective, P as gridListTableThemeVariants, j as gridListBaseThemeVariants, q as GridService } from "./grid.styles-D6jP3vwD.mjs";
2
- import { i as GridCellDirective, n as GridGroupRowComponent, r as GridAddRowComponent, t as GridRowComponent } from "./grid-row.component-CuCQ_Z5F.mjs";
3
- import { t as GridColgroupComponent } from "./grid-colgroup.component-BFbiAvkG.mjs";
4
- import { GridFooterRowComponent } from "./grid-footer-row.component-DpSu7jvG.mjs";
1
+ import { I as gridRowDragPreviewThemeVariants, K as GridLockedCellDirective, P as gridListTableThemeVariants, j as gridListBaseThemeVariants, q as GridService } from "./grid.styles-DBLUtq2X.mjs";
2
+ import { i as GridCellDirective, n as GridGroupRowComponent, r as GridAddRowComponent, t as GridRowComponent } from "./grid-row.component-CK8q0Ecr.mjs";
3
+ import { t as GridColgroupComponent } from "./grid-colgroup.component-Ccz4jNGD.mjs";
4
+ import { GridFooterRowComponent } from "./grid-footer-row.component-3i2wvQ6a.mjs";
5
5
  import { NgTemplateOutlet } from "@angular/common";
6
6
  import * as i0 from "@angular/core";
7
7
  import { Component, DestroyRef, ElementRef, afterNextRender, afterRenderEffect, computed, effect, inject, input, untracked, viewChild } from "@angular/core";
@@ -471,4 +471,4 @@ i0.ɵɵngDeclareClassMetadata({
471
471
  });
472
472
  export { GridListComponent };
473
473
 
474
- //# sourceMappingURL=grid-list.component-B-F4bvFL.mjs.map
474
+ //# sourceMappingURL=grid-list.component-BaI4IOC6.mjs.map
@@ -1,5 +1,5 @@
1
- import { B as gridTreeLeafSpacerThemeVariants, H as GridLogicalCellDirective, K as GridLockedCellDirective, L as gridRowReorderHandleThemeVariants, M as gridListTableCellThemeVariants, N as gridListTableRowThemeVariants, Q as formatGridCellValue, U as GRID_CELL_FOCUSABLE_SELECTOR, V as gridTreeToggleThemeVariants, a as gridCellEditorBaseThemeVariants, b as gridGroupRowThemeVariants, i as gridCellDirtyIndicatorThemeVariants, n as gridCellBaseThemeVariants, o as gridCellEditorInputThemeVariants, q as GridService, r as gridCellContainerThemeVariants, s as gridCellTextThemeVariants, tt as GridNavigationService, z as gridSelectionCellThemeVariants } from "./grid.styles-D6jP3vwD.mjs";
2
- import { n as removeGridRow } from "./grid-colgroup.component-BFbiAvkG.mjs";
1
+ import { B as gridTreeLeafSpacerThemeVariants, H as GridLogicalCellDirective, K as GridLockedCellDirective, L as gridRowReorderHandleThemeVariants, M as gridListTableCellThemeVariants, N as gridListTableRowThemeVariants, Q as formatGridCellValue, U as GRID_CELL_FOCUSABLE_SELECTOR, V as gridTreeToggleThemeVariants, a as gridCellEditorBaseThemeVariants, b as gridGroupRowThemeVariants, i as gridCellDirtyIndicatorThemeVariants, n as gridCellBaseThemeVariants, o as gridCellEditorInputThemeVariants, q as GridService, r as gridCellContainerThemeVariants, s as gridCellTextThemeVariants, tt as GridNavigationService, z as gridSelectionCellThemeVariants } from "./grid.styles-DBLUtq2X.mjs";
2
+ import { n as removeGridRow } from "./grid-colgroup.component-Ccz4jNGD.mjs";
3
3
  import { NgTemplateOutlet } from "@angular/common";
4
4
  import * as i0 from "@angular/core";
5
5
  import { Component, Directive, ElementRef, Injector, LOCALE_ID, afterNextRender, computed, effect, inject, input, isDevMode, model, output, signal, untracked, viewChild } from "@angular/core";
@@ -2174,4 +2174,4 @@ i0.ɵɵngDeclareClassMetadata({
2174
2174
  });
2175
2175
  export { GridCellDirective as i, GridGroupRowComponent as n, GridAddRowComponent as r, GridRowComponent as t };
2176
2176
 
2177
- //# sourceMappingURL=grid-row.component-CuCQ_Z5F.mjs.map
2177
+ //# sourceMappingURL=grid-row.component-CK8q0Ecr.mjs.map
@@ -1,7 +1,7 @@
1
- import { P as gridListTableThemeVariants, _ as gridFooterThemeVariants, g as gridFooterTableThemeVariants, j as gridListBaseThemeVariants, q as GridService, tt as GridNavigationService } from "./grid.styles-D6jP3vwD.mjs";
2
- import { n as GridGroupRowComponent, r as GridAddRowComponent, t as GridRowComponent } from "./grid-row.component-CuCQ_Z5F.mjs";
3
- import { t as GridColgroupComponent } from "./grid-colgroup.component-BFbiAvkG.mjs";
4
- import { GridFooterRowComponent } from "./grid-footer-row.component-DpSu7jvG.mjs";
1
+ import { P as gridListTableThemeVariants, _ as gridFooterThemeVariants, g as gridFooterTableThemeVariants, j as gridListBaseThemeVariants, q as GridService, tt as GridNavigationService } from "./grid.styles-DBLUtq2X.mjs";
2
+ import { n as GridGroupRowComponent, r as GridAddRowComponent, t as GridRowComponent } from "./grid-row.component-CK8q0Ecr.mjs";
3
+ import { t as GridColgroupComponent } from "./grid-colgroup.component-Ccz4jNGD.mjs";
4
+ import { GridFooterRowComponent } from "./grid-footer-row.component-3i2wvQ6a.mjs";
5
5
  import * as i0 from "@angular/core";
6
6
  import { Component, DestroyRef, ElementRef, Injector, afterNextRender, computed, effect, inject, input, signal, untracked, viewChild } from "@angular/core";
7
7
  import { takeUntilDestroyed, toObservable } from "@angular/core/rxjs-interop";
@@ -346,4 +346,4 @@ i0.ɵɵngDeclareClassMetadata({
346
346
  });
347
347
  export { GridVirtualListComponent };
348
348
 
349
- //# sourceMappingURL=grid-virtual-list.component-rIz5AUOU.mjs.map
349
+ //# sourceMappingURL=grid-virtual-list.component-BPLi0OaO.mjs.map
@@ -1426,6 +1426,7 @@ var GridService = class GridService {
1426
1426
  #anchorRowKey;
1427
1427
  #bulkSelectionRowKeys;
1428
1428
  #bulkSelectionSelectedCount;
1429
+ #columnIdsSizedByUser;
1429
1430
  #document;
1430
1431
  #editContext;
1431
1432
  #editSession;
@@ -1446,7 +1447,6 @@ var GridService = class GridService {
1446
1447
  #rowReorderableOptions;
1447
1448
  #rowUidByData;
1448
1449
  #rowUidByKeyObject;
1449
- #scrollbarGutterMeasurementSource;
1450
1450
  #scrollbarGutterWidth;
1451
1451
  #seededFields;
1452
1452
  #serverBindingEnabled;
@@ -1479,6 +1479,7 @@ var GridService = class GridService {
1479
1479
  for (const key of this.selectedKeys()) if (scopeKeys.has(key)) count++;
1480
1480
  return count;
1481
1481
  }, ...ngDevMode ? [{ debugName: "#bulkSelectionSelectedCount" }] : /* istanbul ignore next */ []);
1482
+ this.#columnIdsSizedByUser = signal(ImmutableSet.create(), ...ngDevMode ? [{ debugName: "#columnIdsSizedByUser" }] : /* istanbul ignore next */ []);
1482
1483
  this.#document = inject(DOCUMENT$1);
1483
1484
  this.#editContext = signal(null, ...ngDevMode ? [{ debugName: "#editContext" }] : /* istanbul ignore next */ []);
1484
1485
  this.#editSession = signal(null, ...ngDevMode ? [{ debugName: "#editSession" }] : /* istanbul ignore next */ []);
@@ -1507,7 +1508,6 @@ var GridService = class GridService {
1507
1508
  this.#rowReorderableOptions = signal({ enabled: false }, ...ngDevMode ? [{ debugName: "#rowReorderableOptions" }] : /* istanbul ignore next */ []);
1508
1509
  this.#rowUidByData = /* @__PURE__ */ new WeakMap();
1509
1510
  this.#rowUidByKeyObject = /* @__PURE__ */ new WeakMap();
1510
- this.#scrollbarGutterMeasurementSource = signal("fallback", ...ngDevMode ? [{ debugName: "#scrollbarGutterMeasurementSource" }] : /* istanbul ignore next */ []);
1511
1511
  this.#scrollbarGutterWidth = signal(0, ...ngDevMode ? [{ debugName: "#scrollbarGutterWidth" }] : /* istanbul ignore next */ []);
1512
1512
  this.#seededFields = /* @__PURE__ */ new WeakMap();
1513
1513
  this.#serverBindingEnabled = signal(false, ...ngDevMode ? [{ debugName: "#serverBindingEnabled" }] : /* istanbul ignore next */ []);
@@ -1666,7 +1666,6 @@ var GridService = class GridService {
1666
1666
  }, ...ngDevMode ? [{ debugName: "groupableOptions" }] : /* istanbul ignore next */ []);
1667
1667
  this.hasFooter = computed(() => this.aggregateColumns().any(), ...ngDevMode ? [{ debugName: "hasFooter" }] : /* istanbul ignore next */ []);
1668
1668
  this.hasLeftLockedColumns = computed(() => this.rowReorderColumnVisible() || this.selectionColumnVisible() || this.visibleColumns().any((column) => column.locked && column.lockedPosition === "left"), ...ngDevMode ? [{ debugName: "hasLeftLockedColumns" }] : /* istanbul ignore next */ []);
1669
- this.hasLiveScrollbarGutterWidth = computed(() => this.#scrollbarGutterMeasurementSource() === "body", ...ngDevMode ? [{ debugName: "hasLiveScrollbarGutterWidth" }] : /* istanbul ignore next */ []);
1670
1669
  this.headerGroupDepth = computed(() => this.headerGroupRows().length, ...ngDevMode ? [{ debugName: "headerGroupDepth" }] : /* istanbul ignore next */ []);
1671
1670
  this.headerGroupRows = computed(() => buildHeaderGroupRows(this.layout()), ...ngDevMode ? [{ debugName: "headerGroupRows" }] : /* istanbul ignore next */ []);
1672
1671
  this.headerRowCount = computed(() => this.headerGroupDepth() + (this.filterRowEnabled() ? 2 : 1), ...ngDevMode ? [{ debugName: "headerRowCount" }] : /* istanbul ignore next */ []);
@@ -1976,6 +1975,8 @@ var GridService = class GridService {
1976
1975
  hidden: columnState.hidden
1977
1976
  };
1978
1977
  });
1978
+ const restoredColumnIds = columns.filter((column) => stateColumnById.get(this.getColumnStateId(column) ?? "")?.width != null).map((column) => column.id);
1979
+ this.#columnIdsSizedByUser.update((ids) => ids.addAll(restoredColumnIds));
1979
1980
  const updatedColumnById = /* @__PURE__ */ new Map();
1980
1981
  for (const column of columns) {
1981
1982
  const id = this.getColumnStateId(column);
@@ -2280,6 +2281,9 @@ var GridService = class GridService {
2280
2281
  const column = this.#rangeColumnIndexById().get(columnId);
2281
2282
  return row != null && column != null && row >= bounds.firstRow && row <= bounds.lastRow && column >= bounds.firstColumn && column <= bounds.lastColumn;
2282
2283
  }
2284
+ isColumnSizedByUser(columnId) {
2285
+ return this.#columnIdsSizedByUser().contains(columnId);
2286
+ }
2283
2287
  isGroupCollapsed(groupKey) {
2284
2288
  return this.collapsedGroupKeys().contains(groupKey);
2285
2289
  }
@@ -2361,6 +2365,9 @@ var GridService = class GridService {
2361
2365
  const current = this.treeExpandedKeys();
2362
2366
  if (next.size() !== current.size() || !next.all((key) => current.contains(key))) this.treeExpandedKeys.set(next);
2363
2367
  }
2368
+ markColumnSizedByUser(columnId) {
2369
+ this.#columnIdsSizedByUser.update((ids) => ids.add(columnId));
2370
+ }
2364
2371
  moveGroupColumn(column, moveAs) {
2365
2372
  const previous = this.#groupColumnIds();
2366
2373
  this.#groupColumnIds.update((ids) => {
@@ -2624,10 +2631,13 @@ var GridService = class GridService {
2624
2631
  this.updateColumn(columnId, { calculatedWidth: value });
2625
2632
  }
2626
2633
  setCalculatedWidths(widthByColumnId) {
2627
- this.updateColumns((column) => widthByColumnId.has(column.id) ? {
2628
- ...column,
2629
- calculatedWidth: widthByColumnId.get(column.id) ?? null
2630
- } : column);
2634
+ this.updateColumns((column) => {
2635
+ const calculatedWidth = widthByColumnId.get(column.id) ?? null;
2636
+ return widthByColumnId.has(column.id) && column.calculatedWidth !== calculatedWidth ? {
2637
+ ...column,
2638
+ calculatedWidth
2639
+ } : column;
2640
+ });
2631
2641
  }
2632
2642
  setCellRange(anchor, focus) {
2633
2643
  const current = this.cellRange();
@@ -3423,12 +3433,10 @@ var GridService = class GridService {
3423
3433
  effect((onCleanup) => {
3424
3434
  const bodyElement = this.bodyScrollElement();
3425
3435
  if (bodyElement == null) {
3426
- this.#scrollbarGutterMeasurementSource.set("fallback");
3427
3436
  this.#scrollbarGutterWidth.set(this.measureFallbackScrollbarGutter());
3428
3437
  return;
3429
3438
  }
3430
3439
  const updateScrollbarGutter = () => {
3431
- this.#scrollbarGutterMeasurementSource.set("body");
3432
3440
  this.#scrollbarGutterWidth.set(this.measureElementScrollbarGutter(bodyElement));
3433
3441
  };
3434
3442
  updateScrollbarGutter();
@@ -4676,4 +4684,4 @@ const gridNoDataThemeVariants = cva(`
4676
4684
  `);
4677
4685
  export { getGridCellText as $, gridHeaderThemeVariants as A, gridTreeLeafSpacerThemeVariants as B, gridHeaderGroupTableRowThemeVariants as C, gridHeaderTableColumnWrapThemeVariants as D, gridHeaderTableColumnTitleThemeVariants as E, gridNoDataThemeVariants as F, observeGridCellTabStops as G, GridLogicalCellDirective as H, gridRowDragPreviewThemeVariants as I, getColumnGroupDepth as J, GridLockedCellDirective as K, gridRowReorderHandleThemeVariants as L, gridListTableCellThemeVariants as M, gridListTableRowThemeVariants as N, gridHeaderTableRowThemeVariants as O, gridListTableThemeVariants as P, formatGridCellValue as Q, gridSelectAllCellThemeVariants as R, gridHeaderGroupSpacerCellThemeVariants as S, gridHeaderTableCellThemeVariants as T, GRID_CELL_FOCUSABLE_SELECTOR as U, gridTreeToggleThemeVariants as V, isKeyboardEntryElement as W, getColumnStepTarget as X, getColumnGroups as Y, getSiblingRuns as Z, gridFooterThemeVariants as _, gridCellEditorBaseThemeVariants as a, GridEditEvent as at, gridGroupRowThemeVariants as b, gridColumnActionsThemeVariants as c, RowEditEvent as ct, gridColumnResizerThemeVariants as d, RowReorderEvent as et, gridFilterRowCellThemeVariants as f, gridFooterTableThemeVariants as g, gridFooterTableRowThemeVariants as h, gridCellDirtyIndicatorThemeVariants as i, GridRemoveEvent as it, gridListBaseThemeVariants as j, gridHeaderTableThemeVariants as k, gridColumnDragPreviewThemeVariants as l, CellEditEvent as lt, gridFooterTableCellThemeVariants as m, gridCellBaseThemeVariants as n, GRID_DEFAULT_MESSAGES as nt, gridCellEditorInputThemeVariants as o, GridCancelEvent as ot, gridFilterRowHeaderCellThemeVariants as p, GridService as q, gridCellContainerThemeVariants as r, GridSaveEvent as rt, gridCellTextThemeVariants as s, GridAddEvent as st, gridBaseThemeVariants as t, GridNavigationService as tt, gridColumnDropHintThemeVariants as u, gridGroupPanelPlaceholderThemeVariants as v, gridHeaderGroupTitleThemeVariants as w, gridHeaderGroupCellThemeVariants as x, gridGroupPanelThemeVariants as y, gridSelectionCellThemeVariants as z };
4678
4686
 
4679
- //# sourceMappingURL=grid.styles-D6jP3vwD.mjs.map
4687
+ //# sourceMappingURL=grid.styles-DBLUtq2X.mjs.map