@flywheel-io/vision 21.1.1 → 21.1.3

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flywheel-io/vision",
3
- "version": "21.1.1",
3
+ "version": "21.1.3",
4
4
  "description": "Flywheel UI elements provided as Angular components and native web components",
5
5
  "author": "Flywheel",
6
6
  "license": "MIT",
@@ -1236,6 +1236,14 @@ declare class FwMenuItemComponent implements OnChanges, OnDestroy, AfterContentI
1236
1236
  readonly selected: _angular_core.ModelSignal<boolean>;
1237
1237
  subItems: QueryList<FwMenuSubItemComponent>;
1238
1238
  private subscriptions;
1239
+ private isDestroyed;
1240
+ /**
1241
+ * Whether this item's view has been torn down. Owners that iterate their items (`fw-menu`) have to
1242
+ * check this before writing to the item's `model()`s: neither `QueryList` nor a signal query is
1243
+ * emptied by view destruction, so an item can still be reachable from a query after the menu it
1244
+ * lives in was destroyed - writing to it then logs NG0953.
1245
+ */
1246
+ get destroyed(): boolean;
1239
1247
  scrollIntoView(options?: ScrollIntoViewOptions): void;
1240
1248
  focus(): void;
1241
1249
  isFocused(): boolean;
@@ -1649,6 +1657,11 @@ type MenuFilterFn = (filter: string, menuItems: readonly FwMenuItemComponent[])
1649
1657
  declare class FwMenuContainerComponent implements AfterViewInit {
1650
1658
  private sanitizer;
1651
1659
  private ngZone;
1660
+ /**
1661
+ * The container's own element. Exposed because this component is usually rendered into a cdk
1662
+ * overlay, so a consumer holding the instance has no other way to reach the rendered panel.
1663
+ */
1664
+ readonly hostElement: HTMLElement;
1652
1665
  menuWrapperRef: _angular_core.Signal<HTMLElement>;
1653
1666
  canScrollUp: _angular_core.WritableSignal<boolean>;
1654
1667
  canScrollDown: _angular_core.WritableSignal<boolean>;
@@ -1918,10 +1931,31 @@ declare class MenuRegisterDirective implements OnInit, OnDestroy {
1918
1931
  * Form control component for selecting multiple options from a dropdown, displaying selected values as chips
1919
1932
  * @see [Vision storybook](https://cdn.flywheel.io/docs/vision/master/?path=/docs/form-controls-multi-select--docs)
1920
1933
  */
1921
- declare class FwMultiSelectMenuComponent implements ControlValueAccessor, AfterContentInit, OnDestroy {
1934
+ declare class FwMultiSelectMenuComponent implements ControlValueAccessor, AfterContentInit, OnInit, OnDestroy {
1922
1935
  private elementRef;
1936
+ private document;
1923
1937
  readonly listboxId: string;
1924
- outsideClick(event: MouseEvent): void;
1938
+ private readonly documentClickListener;
1939
+ /**
1940
+ * Closes the options panel when a click lands outside of both the trigger and the panel.
1941
+ *
1942
+ * Registered by hand instead of through `@HostListener('document:click')` so that it runs in the
1943
+ * capture phase: a number of components in the library (`fw-menu-item`, `fw-chip`, `fw-navbar-item`,
1944
+ * the dialog backdrop, ...) call `stopPropagation()` on click, which would otherwise keep this
1945
+ * listener from ever seeing the click and leave the panel open.
1946
+ */
1947
+ outsideClick(event: Event): void;
1948
+ /**
1949
+ * Whether the options panel is currently open. The single place this class asks that question -
1950
+ * the trigger owns the state, so there is no local flag to keep in sync.
1951
+ *
1952
+ * ! Deliberately a plain method, not a `computed()` ! The trigger reports its state from the
1953
+ * overlay ref rather than from a signal, so a computed would memoize the first answer and stop
1954
+ * tracking, silently freezing `aria-expanded`.
1955
+ */
1956
+ isMenuOpen(): boolean;
1957
+ /** Whether an event originated on this select's control box or inside its rendered options panel */
1958
+ private isEventInsideSelect;
1925
1959
  readonly options: _angular_core.InputSignal<object[]>;
1926
1960
  readonly valueProperty: _angular_core.InputSignal<string>;
1927
1961
  readonly titleProperty: _angular_core.InputSignal<string>;
@@ -1945,6 +1979,12 @@ declare class FwMultiSelectMenuComponent implements ControlValueAccessor, AfterC
1945
1979
  readonly size: _angular_core.InputSignal<"large" | "medium" | "small">;
1946
1980
  trigger: CdkMenuTrigger;
1947
1981
  menu: FwMenuComponent;
1982
+ /**
1983
+ * The control itself, which is only as wide as `width()`. The host element is a block element and
1984
+ * so can be considerably wider, and a click in that gap is an outside click.
1985
+ */
1986
+ private wrapper;
1987
+ /** The options panel, `undefined` while it is closed since it only exists inside the cdk overlay */
1948
1988
  menuFilter: _angular_core.Signal<FwMenuContainerComponent>;
1949
1989
  renderedMenuItems: QueryList<FwMenuItemComponent>;
1950
1990
  customMenuItems: QueryList<FwMenuItemComponent>;
@@ -1955,7 +1995,6 @@ declare class FwMultiSelectMenuComponent implements ControlValueAccessor, AfterC
1955
1995
  focusedIndex: WritableSignal<number>;
1956
1996
  touched: boolean;
1957
1997
  private subscriptions;
1958
- private _isOpen;
1959
1998
  change: EventEmitter<any>;
1960
1999
  defaultFilter: MenuFilterFn;
1961
2000
  /**
@@ -1974,6 +2013,7 @@ declare class FwMultiSelectMenuComponent implements ControlValueAccessor, AfterC
1974
2013
  registerOnTouched(fn: () => void): void;
1975
2014
  setDisabledState?(isDisabled: boolean): void;
1976
2015
  writeValue(value: any[]): void;
2016
+ ngOnInit(): void;
1977
2017
  ngOnDestroy(): void;
1978
2018
  ngAfterContentInit(): void;
1979
2019
  private registerCustomMenuItems;
@@ -2000,8 +2040,20 @@ type DisplayFn = (menuItem: FwMenuItemComponent) => string;
2000
2040
  */
2001
2041
  declare class FwSelectMenuComponent implements OnInit, OnDestroy, ControlValueAccessor {
2002
2042
  private ngControl;
2043
+ private document;
2003
2044
  readonly listboxId: string;
2004
- outsideClick(evt: any): void;
2045
+ private readonly documentClickListener;
2046
+ /**
2047
+ * Closes the options panel when a click lands outside of both the trigger and the panel.
2048
+ *
2049
+ * Registered by hand instead of through `@HostListener('document:click')` so that it runs in the
2050
+ * capture phase: a number of components in the library (`fw-menu-item`, `fw-chip`, `fw-navbar-item`,
2051
+ * the dialog backdrop, ...) call `stopPropagation()` on click, which would otherwise keep this
2052
+ * listener from ever seeing the click and leave the panel open.
2053
+ */
2054
+ outsideClick(event: Event): void;
2055
+ /** Whether an event originated on this select's control box or inside its rendered options panel */
2056
+ private isEventInsideSelect;
2005
2057
  get disabledClass(): boolean;
2006
2058
  options: _angular_core.InputSignal<Object[]>;
2007
2059
  valueProperty: _angular_core.InputSignal<string>;
@@ -2023,6 +2075,13 @@ declare class FwSelectMenuComponent implements OnInit, OnDestroy, ControlValueAc
2023
2075
  trigger: CdkMenuTrigger;
2024
2076
  textInput: FwTextInputComponent;
2025
2077
  menu: _angular_core.Signal<FwMenuComponent>;
2078
+ /**
2079
+ * The control itself, which is only as wide as `width()`. The host element is a block element and
2080
+ * so can be considerably wider, and a click in that gap is an outside click.
2081
+ */
2082
+ private wrapper;
2083
+ /** The options panel, `undefined` while it is closed since it only exists inside the cdk overlay */
2084
+ private panel;
2026
2085
  menuItems: _angular_core.Signal<readonly FwMenuItemComponent[]>;
2027
2086
  viewMenuItems: _angular_core.Signal<readonly FwMenuItemComponent[]>;
2028
2087
  menuItemGroups: _angular_core.Signal<readonly FwMenuItemGroupComponent[]>;
@@ -2034,10 +2093,12 @@ declare class FwSelectMenuComponent implements OnInit, OnDestroy, ControlValueAc
2034
2093
  filterValue: _angular_core.WritableSignal<string>;
2035
2094
  private menuItemClickSubscriptions;
2036
2095
  private subscriptions;
2037
- private _isOpen;
2038
2096
  focused: number;
2039
2097
  inFocusOpen: boolean;
2040
2098
  preFocusValue: any;
2099
+ /** Displayed value and title as of the last time the panel was opened, used to undo a dismissed filter */
2100
+ private displayValueOnOpen;
2101
+ private displayTitleOnOpen;
2041
2102
  isTyping: _angular_core.WritableSignal<boolean>;
2042
2103
  valueDisplayFn: _angular_core.InputSignal<DisplayFn>;
2043
2104
  custom(menuItem: FwMenuItemComponent): string;
@@ -2074,6 +2135,14 @@ declare class FwSelectMenuComponent implements OnInit, OnDestroy, ControlValueAc
2074
2135
  setDisabledState(isDisabled: boolean): void;
2075
2136
  writeValue(value: any): void;
2076
2137
  handleClick(e: string): void;
2138
+ /**
2139
+ * Whether the options panel is currently open. The single place this class asks that question -
2140
+ * the trigger owns the state, so there is no local flag to keep in sync.
2141
+ *
2142
+ * ! Deliberately a plain method, not a `computed()` ! The trigger reports its state from the
2143
+ * overlay ref rather than from a signal, so a computed would memoize the first answer and stop
2144
+ * tracking, silently freezing `aria-expanded`.
2145
+ */
2077
2146
  isMenuOpen(): boolean;
2078
2147
  /**
2079
2148
  * The DOM id of the currently active/highlighted option, for aria-activedescendant on the combobox input.