@truenas/ui-components 0.4.9 → 0.4.11
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.
|
@@ -9584,21 +9584,20 @@ class TnSelectComponent {
|
|
|
9584
9584
|
return;
|
|
9585
9585
|
}
|
|
9586
9586
|
this.isOpen.set(true);
|
|
9587
|
-
// Seed keyboard focus at the current selection when there is one
|
|
9588
|
-
//
|
|
9587
|
+
// Seed keyboard focus at the current selection when there is one, else at
|
|
9588
|
+
// the first navigable row. Something is ALWAYS highlighted while the panel
|
|
9589
|
+
// is open (matching mat-select): a freshly-opened select must be operable
|
|
9590
|
+
// with Enter/Space straight away, without an ArrowDown first.
|
|
9589
9591
|
const selected = this.selectedValue();
|
|
9590
|
-
|
|
9591
|
-
|
|
9592
|
-
this.
|
|
9593
|
-
|
|
9594
|
-
|
|
9595
|
-
|
|
9596
|
-
|
|
9597
|
-
|
|
9598
|
-
|
|
9599
|
-
else {
|
|
9600
|
-
this.focusedIndex.set(-1);
|
|
9601
|
-
}
|
|
9592
|
+
const idx = selected === null || selected === undefined
|
|
9593
|
+
? -1
|
|
9594
|
+
: this.navigableOptions().findIndex((x) => x.kind === 'option' && this.compareValues(x.option.value, selected));
|
|
9595
|
+
// findIndex can also miss (e.g. the selected option is disabled, so it
|
|
9596
|
+
// isn't navigable) — fall back to the first row there too. `-1` would
|
|
9597
|
+
// leave the panel with nothing highlighted, which is the state we're
|
|
9598
|
+
// avoiding. When `allowEmpty` is set the first row IS the empty option,
|
|
9599
|
+
// so a cleared value lands on it for free.
|
|
9600
|
+
this.focusedIndex.set(idx >= 0 ? idx : 0);
|
|
9602
9601
|
this.attachOverlay();
|
|
9603
9602
|
}
|
|
9604
9603
|
/**
|
|
@@ -9931,10 +9930,9 @@ class TnSelectComponent {
|
|
|
9931
9930
|
case 'ArrowDown':
|
|
9932
9931
|
event.preventDefault();
|
|
9933
9932
|
if (!this.isOpen()) {
|
|
9933
|
+
// openDropdown() already seeds the highlight (selection, else first),
|
|
9934
|
+
// so opening must not also advance a row.
|
|
9934
9935
|
this.openDropdown();
|
|
9935
|
-
if (this.focusedIndex() < 0) {
|
|
9936
|
-
this.moveFocus('first');
|
|
9937
|
-
}
|
|
9938
9936
|
}
|
|
9939
9937
|
else {
|
|
9940
9938
|
this.moveFocus(1);
|
|
@@ -11298,36 +11296,47 @@ class TnTableComponent {
|
|
|
11298
11296
|
* Cells wrap regardless of this (that is the table's default), so reach for it only when equal
|
|
11299
11297
|
* columns are actually wanted: it gives up the `auto` layout's content-proportional sizing,
|
|
11300
11298
|
* which a table with one long text column among short ones usually wants to keep.
|
|
11299
|
+
*
|
|
11300
|
+
* Changes the layout algorithm only — the table still shrinks with its container, with no floor
|
|
11301
|
+
* unless {@link minColumnWidth} or {@link minWidth} sets one.
|
|
11301
11302
|
*/
|
|
11302
11303
|
fixedLayout = input(false, ...(ngDevMode ? [{ debugName: "fixedLayout" }] : []));
|
|
11303
11304
|
/**
|
|
11304
11305
|
* Smallest width a column is allowed to shrink to before the host scrolls horizontally instead.
|
|
11305
|
-
* Any CSS length.
|
|
11306
|
+
* Any CSS length. Empty (the default) applies no floor.
|
|
11307
|
+
*
|
|
11308
|
+
* `fixedLayout` makes the table fit its container exactly, so past a certain width the columns
|
|
11309
|
+
* keep shrinking and wrap every cell to a couple of characters per line: technically visible,
|
|
11310
|
+
* unreadable, and never scrollable. Set this to scroll instead once a column would go below it.
|
|
11311
|
+
* The floor is derived as this times the column count, so it scales with the table rather than
|
|
11312
|
+
* needing a hand-picked number per page.
|
|
11306
11313
|
*
|
|
11307
|
-
*
|
|
11308
|
-
*
|
|
11309
|
-
*
|
|
11310
|
-
*
|
|
11314
|
+
* Opt-in rather than on by default, because a derived floor cannot know the table's container: a
|
|
11315
|
+
* full-width page table has room for one, while the same table in a dashboard card or beside a
|
|
11316
|
+
* details pane would just scroll at every ordinary window size. Only the consumer knows which it
|
|
11317
|
+
* is — reach for it when the table can actually get narrow enough to matter, typically a
|
|
11318
|
+
* full-width table on a phone.
|
|
11311
11319
|
*
|
|
11312
11320
|
* Only applies with `fixedLayout`. Without it the table lays out `auto`, sizing to its content
|
|
11313
11321
|
* and overflowing the host — which scrolls on its own.
|
|
11314
11322
|
*/
|
|
11315
|
-
minColumnWidth = input('
|
|
11323
|
+
minColumnWidth = input('', ...(ngDevMode ? [{ debugName: "minColumnWidth" }] : []));
|
|
11316
11324
|
/**
|
|
11317
11325
|
* Explicit width floor, overriding the {@link minColumnWidth} derivation. Any CSS length. Reach
|
|
11318
11326
|
* for this only when a specific table needs a floor its column count doesn't imply.
|
|
11319
11327
|
*/
|
|
11320
11328
|
minWidth = input('', ...(ngDevMode ? [{ debugName: "minWidth" }] : []));
|
|
11321
|
-
/** The floor actually applied to the table — explicit if given, else derived. */
|
|
11329
|
+
/** The floor actually applied to the table — explicit if given, else derived, else none. */
|
|
11322
11330
|
resolvedMinWidth = computed(() => {
|
|
11323
11331
|
const explicit = this.minWidth();
|
|
11324
11332
|
if (explicit) {
|
|
11325
11333
|
return explicit;
|
|
11326
11334
|
}
|
|
11327
|
-
|
|
11335
|
+
const perColumn = this.minColumnWidth();
|
|
11336
|
+
if (!perColumn || !this.fixedLayout()) {
|
|
11328
11337
|
return null;
|
|
11329
11338
|
}
|
|
11330
|
-
return `calc(${
|
|
11339
|
+
return `calc(${perColumn} * ${this.effectiveDisplayedColumns().length})`;
|
|
11331
11340
|
}, ...(ngDevMode ? [{ debugName: "resolvedMinWidth" }] : []));
|
|
11332
11341
|
// --- Outputs ---
|
|
11333
11342
|
sortChange = output();
|