@kirbydesign/extensions-angular 4.2.0 → 4.4.0-rc.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,206 @@
1
+ import * as i0 from '@angular/core';
2
+ import { AfterViewInit, OnDestroy, EventEmitter, TemplateRef, QueryList, ElementRef, Renderer2, ChangeDetectorRef } from '@angular/core';
3
+ import { ControlValueAccessor } from '@angular/forms';
4
+ import { HorizontalDirection, PopoverComponent } from '@kirbydesign/designsystem/popover';
5
+ import { InputSize } from '@kirbydesign/designsystem/form-field';
6
+ import { FormFieldControl } from '@kirbydesign/designsystem/types';
7
+ import { ResizeObserverService } from '@kirbydesign/designsystem/shared';
8
+
9
+ declare class ComboboxComponent implements AfterViewInit, OnDestroy, ControlValueAccessor, FormFieldControl {
10
+ private renderer;
11
+ private elementRef;
12
+ private cdr;
13
+ private resizeObserverService;
14
+ static readonly OPEN_DELAY_IN_MS = 100;
15
+ private state;
16
+ private _popout;
17
+ private _attributesToForward;
18
+ _listboxId: string;
19
+ _comboboxId: string;
20
+ private readonly _defaultSearchFunction;
21
+ private compareAlphabetically;
22
+ /**
23
+ * The text to display when the search returns no results.
24
+ */
25
+ noSearchResultsText: string;
26
+ /**
27
+ * The name of the property to use as the display text for each item.
28
+ */
29
+ itemTextProperty: string;
30
+ protected getItemText(item: unknown): string;
31
+ /**
32
+ * The height of each item in the dropdown, in pixels. This is used to calculate the height of the dropdown based on the number of items.
33
+ */
34
+ itemHeight: number;
35
+ protected get dropdownMaxHeight(): number;
36
+ protected get dropdownMinHeight(): number;
37
+ protected get viewportHeight(): number;
38
+ private isTypeString;
39
+ private objectHasItemTextProperty;
40
+ private objectHasItemIdProperty;
41
+ /**
42
+ * The name of the property to use as the unique identifier for each item.
43
+ */
44
+ itemIdProperty: string;
45
+ protected getItemId(item: unknown): string;
46
+ /**
47
+ * A function that takes a search term and the list of items, and returns a filtered list of items to display in the dropdown.
48
+ */
49
+ searchFunction: (searchTerm: string, itemsToSearch: unknown[]) => unknown[];
50
+ private _searchItems;
51
+ protected get searchItems(): unknown[];
52
+ private set searchItems(value);
53
+ private _items;
54
+ get items(): unknown[];
55
+ /**
56
+ * The list of items to display in the dropdown.
57
+ * @param value
58
+ */
59
+ set items(value: unknown[]);
60
+ private _selectedItem;
61
+ get selectedItem(): unknown;
62
+ /**
63
+ * The currently selected item.
64
+ * @param value
65
+ */
66
+ set selectedItem(value: unknown);
67
+ private _focusedItem;
68
+ get focusedItem(): unknown;
69
+ set focusedItem(item: unknown);
70
+ private getIndexOfItem;
71
+ private getKirbyElement;
72
+ private setAriaPosinsetOnElement;
73
+ /**
74
+ * The placeholder text to display in the input when no item is selected and the input is empty.
75
+ */
76
+ placeholder: string;
77
+ /**
78
+ * The direction in which the dropdown should open relative to the input.
79
+ * @param direction
80
+ */
81
+ set popout(direction: HorizontalDirection | `${HorizontalDirection}`);
82
+ get popout(): HorizontalDirection | `${HorizontalDirection}`;
83
+ /**
84
+ * If the combobox needs to expand to full width of its parent container, then use expand.
85
+ */
86
+ expand?: 'block';
87
+ /**
88
+ * When `true`, the user cannot interact with the combobox.
89
+ */
90
+ disabled: boolean;
91
+ get _isDisabled(): 'disabled' | null;
92
+ /**
93
+ * Will emit the new value when error changes.
94
+ */
95
+ hasErrorChange: EventEmitter<boolean>;
96
+ private _hasError;
97
+ /**
98
+ * When `true`, the combobox will be styled with error styles.
99
+ */
100
+ get hasError(): boolean;
101
+ set hasError(value: boolean);
102
+ /**
103
+ * The size of the input element.
104
+ */
105
+ size: InputSize;
106
+ get _noBlurOnScroll(): boolean;
107
+ /**
108
+ * Emitted when an item is selected (tap on mobile, click/keypress on web)
109
+ */
110
+ change: EventEmitter<unknown>;
111
+ value: unknown;
112
+ get _isBlockLevel(): boolean;
113
+ get _isOpening(): boolean;
114
+ get isOpen(): boolean;
115
+ get hasValue(): boolean;
116
+ itemTemplate?: TemplateRef<unknown>;
117
+ slottedItems?: QueryList<ElementRef<HTMLElement>>;
118
+ cardElement?: ElementRef<HTMLElement>;
119
+ popover?: PopoverComponent;
120
+ rootElement: ElementRef<HTMLElement>;
121
+ private textInput;
122
+ get interactiveElement(): HTMLElement;
123
+ private virtualScrollViewport?;
124
+ private forwardAriaLabelToCombobox;
125
+ kirbyItemsDefault?: QueryList<ElementRef<HTMLElement>>;
126
+ _kirbyItemsSlotted?: QueryList<ElementRef<HTMLElement>>;
127
+ set kirbyItemsSlotted(kirbyItems: QueryList<ElementRef<HTMLElement>>);
128
+ get kirbyItemsSlotted(): QueryList<ElementRef<HTMLElement>> | undefined;
129
+ private disposeItemClickListeners;
130
+ constructor(renderer: Renderer2, elementRef: ElementRef<HTMLElement>, cdr: ChangeDetectorRef, resizeObserverService: ResizeObserverService);
131
+ protected onToggle(event: MouseEvent): void;
132
+ private toggle;
133
+ ngAfterViewInit(): void;
134
+ private setPopoverCardStyle;
135
+ ngOnDestroy(): void;
136
+ open(): void;
137
+ private showPopOver;
138
+ close(): void;
139
+ protected onItemSelect(item: unknown): void;
140
+ private onChange;
141
+ private onTouched;
142
+ /**
143
+ * Sets the select's value. Part of the ControlValueAccessor interface
144
+ * required to integrate with Angular's core forms API.
145
+ *
146
+ * @param value New value to be written to the model.
147
+ */
148
+ writeValue(value: string): void;
149
+ /**
150
+ * Saves a callback function to be invoked when the select's value
151
+ * changes from user input. Part of the ControlValueAccessor interface
152
+ * required to integrate with Angular's core forms API.
153
+ *
154
+ * @param fn Callback to be triggered when the value changes.
155
+ */
156
+ registerOnChange(fn: (value: unknown) => void): void;
157
+ /**
158
+ * Saves a callback function to be invoked when the select is blurred
159
+ * by the user. Part of the ControlValueAccessor interface required
160
+ * to integrate with Angular's core forms API.
161
+ *
162
+ * @param fn Callback to be triggered when the component has been touched.
163
+ */
164
+ registerOnTouched(fn: () => void): void;
165
+ /**
166
+ * Disables the select. Part of the ControlValueAccessor interface required
167
+ * to integrate with Angular's core forms API.
168
+ *
169
+ * @param isDisabled Sets whether the component is disabled.
170
+ */
171
+ setDisabledState?(isDisabled: boolean): void;
172
+ private selectItem;
173
+ private selectItemByInput;
174
+ protected updateSearchResults(event: Event): void;
175
+ protected onPopoverWillHide(): void;
176
+ protected onPopoverClick(): void;
177
+ onMouseDown(event: MouseEvent): void;
178
+ onTouchStart(event: TouchEvent): void;
179
+ onFocusOut(): void;
180
+ onTab(): void;
181
+ onEscape(): void;
182
+ onEnterO(event: Event): void;
183
+ onArrowKeys(event: Event): void;
184
+ private handleFocusNavigation;
185
+ private shiftFocusIndex;
186
+ private setFocusOnFirstOrLastItem;
187
+ private setFocusOnSelectedItem;
188
+ private setFocusOnLastItem;
189
+ private setFocusOnFirstItem;
190
+ private unlistenAllSlottedItems;
191
+ private unobserveResize;
192
+ /**
193
+ * Resolve a model/data item based on current `items` by comparing displayed text.
194
+ * This is used to map an incoming form value or input `selectedItem` to an item
195
+ * from the list.
196
+ */
197
+ private findItemByInput;
198
+ private setInputDisplayValue;
199
+ private scrollFocusedItemIntoViewWhileNavigating;
200
+ private getKirbyItems;
201
+ private scrollToIndexIntoViewWhenOpeningPopup;
202
+ static ɵfac: i0.ɵɵFactoryDeclaration<ComboboxComponent, never>;
203
+ static ɵcmp: i0.ɵɵComponentDeclaration<ComboboxComponent, "kirby-x-combobox", never, { "noSearchResultsText": { "alias": "noSearchResultsText"; "required": false; }; "itemTextProperty": { "alias": "itemTextProperty"; "required": false; }; "itemHeight": { "alias": "itemHeight"; "required": false; }; "itemIdProperty": { "alias": "itemIdProperty"; "required": false; }; "searchFunction": { "alias": "searchFunction"; "required": false; }; "items": { "alias": "items"; "required": false; }; "selectedItem": { "alias": "selectedItem"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "popout": { "alias": "popout"; "required": false; }; "expand": { "alias": "expand"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "hasError": { "alias": "hasError"; "required": false; }; "size": { "alias": "size"; "required": false; }; }, { "hasErrorChange": "hasErrorChange"; "change": "change"; }, ["itemTemplate", "slottedItems", "kirbyItemsSlotted"], never, true, never>;
204
+ }
205
+
206
+ export { ComboboxComponent };
@@ -1,6 +1,7 @@
1
1
  import { ThemeColor } from '@kirbydesign/designsystem';
2
2
  import { Params } from '@angular/router';
3
3
  import * as rxjs from 'rxjs';
4
+ import * as _kirbydesign_extensions_angular_sidebar_menu from '@kirbydesign/extensions-angular/sidebar-menu';
4
5
  import * as i0 from '@angular/core';
5
6
  import { EventEmitter } from '@angular/core';
6
7
 
@@ -56,6 +57,7 @@ type SubmenuItem = {
56
57
  type: 'submenu';
57
58
  title: string;
58
59
  icon?: string;
60
+ isReorderable?: boolean;
59
61
  children: SidebarMenuItem[];
60
62
  };
61
63
 
@@ -76,6 +78,14 @@ type CheckEvent = {
76
78
  isChecked: boolean;
77
79
  };
78
80
 
81
+ type SidebarMenuItemReorderEvent = {
82
+ parentId: string;
83
+ itemId: string;
84
+ previousIndex: number;
85
+ currentIndex: number;
86
+ reorderedItemIds: string[];
87
+ };
88
+
79
89
  declare class SidebarComponent {
80
90
  #private;
81
91
  set menuItems(menuItems: SidebarMenuItem[]);
@@ -83,15 +93,17 @@ declare class SidebarComponent {
83
93
  set expandedItems(value: Set<string>);
84
94
  set checkedItems(value: Set<string>);
85
95
  set autoCollapse(value: boolean);
96
+ menuItemsChange: EventEmitter<SidebarMenuItem[]>;
86
97
  selectedItemChange: EventEmitter<string>;
87
98
  expandedItemsChange: EventEmitter<Set<string>>;
88
99
  checkedItemsChange: EventEmitter<Set<string>>;
89
- expandChange: rxjs.Observable<ExpandEvent>;
90
- checkChange: rxjs.Observable<CheckEvent>;
100
+ expandChange: rxjs.Observable<_kirbydesign_extensions_angular_sidebar_menu.ExpandEvent>;
101
+ checkChange: rxjs.Observable<_kirbydesign_extensions_angular_sidebar_menu.CheckEvent>;
102
+ itemReorder: rxjs.Observable<_kirbydesign_extensions_angular_sidebar_menu.SidebarMenuItemReorderEvent>;
91
103
  itemSelect: rxjs.Observable<string>;
92
104
  constructor();
93
105
  static ɵfac: i0.ɵɵFactoryDeclaration<SidebarComponent, never>;
94
- static ɵcmp: i0.ɵɵComponentDeclaration<SidebarComponent, "kirby-x-sidebar", never, { "menuItems": { "alias": "menuItems"; "required": false; }; "selectedItem": { "alias": "selectedItem"; "required": false; }; "expandedItems": { "alias": "expandedItems"; "required": false; }; "checkedItems": { "alias": "checkedItems"; "required": false; }; "autoCollapse": { "alias": "autoCollapse"; "required": false; }; }, { "selectedItemChange": "selectedItemChange"; "expandedItemsChange": "expandedItemsChange"; "checkedItemsChange": "checkedItemsChange"; "expandChange": "expandChange"; "checkChange": "checkChange"; "itemSelect": "itemSelect"; }, never, ["kirby-x-sidebar-header", "kirby-x-sidebar-footer"], true, never>;
106
+ static ɵcmp: i0.ɵɵComponentDeclaration<SidebarComponent, "kirby-x-sidebar", never, { "menuItems": { "alias": "menuItems"; "required": false; }; "selectedItem": { "alias": "selectedItem"; "required": false; }; "expandedItems": { "alias": "expandedItems"; "required": false; }; "checkedItems": { "alias": "checkedItems"; "required": false; }; "autoCollapse": { "alias": "autoCollapse"; "required": false; }; }, { "menuItemsChange": "menuItemsChange"; "selectedItemChange": "selectedItemChange"; "expandedItemsChange": "expandedItemsChange"; "checkedItemsChange": "checkedItemsChange"; "expandChange": "expandChange"; "checkChange": "checkChange"; "itemReorder": "itemReorder"; "itemSelect": "itemSelect"; }, never, ["kirby-x-sidebar-header", "kirby-x-sidebar-footer"], true, never>;
95
107
  }
96
108
 
97
109
  declare class SidebarFooterComponent {
@@ -111,4 +123,4 @@ declare class SidebarModule {
111
123
  }
112
124
 
113
125
  export { SidebarComponent, SidebarFooterComponent, SidebarHeaderComponent, SidebarModule };
114
- export type { ActionItem, Badge, CheckEvent, ExpandEvent, ExternalLinkItem, RouterLinkItem, SidebarMenuItem, SubmenuItem, Toggle };
126
+ export type { ActionItem, Badge, CheckEvent, ExpandEvent, ExternalLinkItem, RouterLinkItem, SidebarMenuItem, SidebarMenuItemReorderEvent, SubmenuItem, Toggle };