@skyux/lookup 7.3.0 → 7.4.1

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.
Files changed (61) hide show
  1. package/documentation.json +3468 -1027
  2. package/esm2020/index.mjs +10 -1
  3. package/esm2020/lib/modules/lookup/lookup.component.mjs +122 -70
  4. package/esm2020/lib/modules/lookup/lookup.module.mjs +7 -13
  5. package/esm2020/lib/modules/selection-modal/selection-modal-item-selected.pipe.mjs +19 -0
  6. package/esm2020/lib/modules/selection-modal/selection-modal.component.mjs +199 -0
  7. package/esm2020/lib/modules/selection-modal/selection-modal.module.mjs +62 -0
  8. package/esm2020/lib/modules/selection-modal/selection-modal.service.mjs +86 -0
  9. package/esm2020/lib/modules/selection-modal/types/selection-modal-add-click-callback-args.mjs +2 -0
  10. package/esm2020/lib/modules/selection-modal/types/selection-modal-add-click-event-args.mjs +2 -0
  11. package/esm2020/lib/modules/selection-modal/types/selection-modal-close-args.mjs +2 -0
  12. package/esm2020/lib/modules/selection-modal/types/selection-modal-context.mjs +17 -0
  13. package/esm2020/lib/modules/selection-modal/types/selection-modal-instance.mjs +48 -0
  14. package/esm2020/lib/modules/selection-modal/types/selection-modal-open-args.mjs +2 -0
  15. package/esm2020/lib/modules/selection-modal/types/selection-modal-result.mjs +2 -0
  16. package/esm2020/lib/modules/selection-modal/types/selection-modal-search-args.mjs +2 -0
  17. package/esm2020/lib/modules/selection-modal/types/selection-modal-search-result.mjs +2 -0
  18. package/esm2020/testing/lookup/lookup-show-more-picker-harness.mjs +6 -98
  19. package/esm2020/testing/lookup/lookup-show-more-picker-search-result-harness-filters.mjs +1 -1
  20. package/esm2020/testing/lookup/lookup-show-more-picker-search-result-harness.mjs +3 -3
  21. package/esm2020/testing/public-api.mjs +4 -1
  22. package/esm2020/testing/selection-modal/selection-modal-harness.mjs +128 -0
  23. package/esm2020/testing/selection-modal/selection-modal-search-result-harness-filters.mjs +2 -0
  24. package/esm2020/testing/selection-modal/selection-modal-search-result-harness.mjs +7 -0
  25. package/fesm2015/skyux-lookup-testing.mjs +86 -32
  26. package/fesm2015/skyux-lookup-testing.mjs.map +1 -1
  27. package/fesm2015/skyux-lookup.mjs +362 -130
  28. package/fesm2015/skyux-lookup.mjs.map +1 -1
  29. package/fesm2020/skyux-lookup-testing.mjs +72 -32
  30. package/fesm2020/skyux-lookup-testing.mjs.map +1 -1
  31. package/fesm2020/skyux-lookup.mjs +361 -130
  32. package/fesm2020/skyux-lookup.mjs.map +1 -1
  33. package/index.d.ts +9 -0
  34. package/lib/modules/lookup/lookup.component.d.ts +4 -3
  35. package/lib/modules/lookup/lookup.module.d.ts +16 -17
  36. package/lib/modules/selection-modal/selection-modal-item-selected.pipe.d.ts +10 -0
  37. package/lib/modules/{lookup/lookup-show-more-async-modal.component.d.ts → selection-modal/selection-modal.component.d.ts} +8 -8
  38. package/lib/modules/selection-modal/selection-modal.module.d.ts +18 -0
  39. package/lib/modules/selection-modal/selection-modal.service.d.ts +18 -0
  40. package/lib/modules/selection-modal/types/selection-modal-add-click-callback-args.d.ts +9 -0
  41. package/lib/modules/selection-modal/types/selection-modal-add-click-event-args.d.ts +11 -0
  42. package/lib/modules/selection-modal/types/selection-modal-close-args.d.ts +14 -0
  43. package/lib/modules/selection-modal/types/selection-modal-context.d.ts +18 -0
  44. package/lib/modules/selection-modal/types/selection-modal-instance.d.ts +33 -0
  45. package/lib/modules/selection-modal/types/selection-modal-open-args.d.ts +58 -0
  46. package/lib/modules/selection-modal/types/selection-modal-result.d.ts +14 -0
  47. package/lib/modules/selection-modal/types/selection-modal-search-args.d.ts +21 -0
  48. package/lib/modules/selection-modal/types/selection-modal-search-result.d.ts +25 -0
  49. package/package.json +10 -10
  50. package/testing/lookup/lookup-show-more-picker-harness.d.ts +3 -41
  51. package/testing/lookup/lookup-show-more-picker-search-result-harness-filters.d.ts +2 -2
  52. package/testing/lookup/lookup-show-more-picker-search-result-harness.d.ts +2 -2
  53. package/testing/public-api.d.ts +3 -0
  54. package/testing/selection-modal/selection-modal-harness.d.ts +61 -0
  55. package/testing/selection-modal/selection-modal-search-result-harness-filters.d.ts +6 -0
  56. package/testing/selection-modal/selection-modal-search-result-harness.d.ts +6 -0
  57. package/esm2020/lib/modules/lookup/lookup-item-selected.pipe.mjs +0 -16
  58. package/esm2020/lib/modules/lookup/lookup-show-more-async-modal.component.mjs +0 -192
  59. package/esm2020/lib/modules/lookup/types/lookup-show-more-native-picker-async-context.mjs +0 -17
  60. package/lib/modules/lookup/lookup-item-selected.pipe.d.ts +0 -7
  61. package/lib/modules/lookup/types/lookup-show-more-native-picker-async-context.d.ts +0 -18
package/index.d.ts CHANGED
@@ -22,6 +22,15 @@ export * from './lib/modules/lookup/types/lookup-show-more-native-picker-config'
22
22
  export * from './lib/modules/autocomplete/types/autocomplete-search-args';
23
23
  export * from './lib/modules/autocomplete/types/autocomplete-search-context';
24
24
  export * from './lib/modules/search/search.module';
25
+ export * from './lib/modules/selection-modal/selection-modal.module';
26
+ export * from './lib/modules/selection-modal/selection-modal.service';
27
+ export * from './lib/modules/selection-modal/types/selection-modal-add-click-callback-args';
28
+ export * from './lib/modules/selection-modal/types/selection-modal-add-click-event-args';
29
+ export * from './lib/modules/selection-modal/types/selection-modal-close-args';
30
+ export * from './lib/modules/selection-modal/types/selection-modal-open-args';
31
+ export * from './lib/modules/selection-modal/types/selection-modal-result';
32
+ export * from './lib/modules/selection-modal/types/selection-modal-search-args';
33
+ export * from './lib/modules/selection-modal/types/selection-modal-search-result';
25
34
  export * from './lib/modules/search/search.component';
26
35
  export { SkyAutocompleteInputDirective as λ1 } from './lib/modules/autocomplete/autocomplete-input.directive';
27
36
  export { SkyAutocompleteComponent as λ2 } from './lib/modules/autocomplete/autocomplete.component';
@@ -1,6 +1,6 @@
1
1
  import { AfterViewInit, ChangeDetectorRef, ElementRef, EventEmitter, OnDestroy, OnInit, TemplateRef } from '@angular/core';
2
2
  import { ControlValueAccessor, NgControl } from '@angular/forms';
3
- import { SkyAppWindowRef } from '@skyux/core';
3
+ import { SkyAppWindowRef, SkyLogService } from '@skyux/core';
4
4
  import { SkyInputBoxHostService } from '@skyux/forms';
5
5
  import { SkyLibResourcesService } from '@skyux/i18n';
6
6
  import { SkyToken, SkyTokensMessage } from '@skyux/indicators';
@@ -12,6 +12,7 @@ import { SkyAutocompleteMessage } from '../autocomplete/types/autocomplete-messa
12
12
  import { SkyAutocompleteSearchAsyncArgs } from '../autocomplete/types/autocomplete-search-async-args';
13
13
  import { SkyAutocompleteSelectionChange } from '../autocomplete/types/autocomplete-selection-change';
14
14
  import { SkyAutocompleteShowMoreArgs } from '../autocomplete/types/autocomplete-show-more-args';
15
+ import { SkySelectionModalService } from '../selection-modal/selection-modal.service';
15
16
  import { SkyLookupAdapterService } from './lookup-adapter.service';
16
17
  import { SkyLookupAutocompleteAdapter } from './lookup-autocomplete-adapter';
17
18
  import { SkyLookupAddClickEventArgs } from './types/lookup-add-click-event-args';
@@ -107,7 +108,7 @@ export declare class SkyLookupComponent extends SkyLookupAutocompleteAdapter imp
107
108
  inputTemplateRef: TemplateRef<unknown> | undefined;
108
109
  lookupWrapperRef: ElementRef | undefined;
109
110
  searchIconTemplateRef: TemplateRef<unknown> | undefined;
110
- constructor(changeDetector: ChangeDetectorRef, elementRef: ElementRef, windowRef: SkyAppWindowRef, adapter: SkyLookupAdapterService, modalService: SkyModalService, resourcesService: SkyLibResourcesService, ngControl?: NgControl, inputBoxHostSvc?: SkyInputBoxHostService | undefined, themeSvc?: SkyThemeService | undefined);
111
+ constructor(changeDetector: ChangeDetectorRef, elementRef: ElementRef, windowRef: SkyAppWindowRef, adapter: SkyLookupAdapterService, modalService: SkyModalService, resourcesService: SkyLibResourcesService, selectionModalSvc: SkySelectionModalService, logSvc: SkyLogService, ngControl?: NgControl, inputBoxHostSvc?: SkyInputBoxHostService | undefined, themeSvc?: SkyThemeService | undefined);
111
112
  ngOnInit(): void;
112
113
  ngAfterViewInit(): void;
113
114
  ngOnDestroy(): void;
@@ -131,6 +132,6 @@ export declare class SkyLookupComponent extends SkyLookupAutocompleteAdapter imp
131
132
  onShowMoreClick(event: SkyAutocompleteShowMoreArgs): void;
132
133
  openPicker(initialSearch: string): void;
133
134
  onSearchAsync(args: SkyAutocompleteSearchAsyncArgs): void;
134
- static ɵfac: i0.ɵɵFactoryDeclaration<SkyLookupComponent, [null, null, null, null, null, null, { optional: true; self: true; }, { optional: true; }, { optional: true; }]>;
135
+ static ɵfac: i0.ɵɵFactoryDeclaration<SkyLookupComponent, [null, null, null, null, null, null, null, null, { optional: true; self: true; }, { optional: true; }, { optional: true; }]>;
135
136
  static ɵcmp: i0.ɵɵComponentDeclaration<SkyLookupComponent, "sky-lookup", never, { "ariaLabel": "ariaLabel"; "ariaLabelledBy": "ariaLabelledBy"; "autocompleteAttribute": "autocompleteAttribute"; "data": "data"; "disabled": "disabled"; "enableShowMore": "enableShowMore"; "placeholderText": "placeholderText"; "idProperty": "idProperty"; "showAddButton": "showAddButton"; "showMoreConfig": "showMoreConfig"; "selectMode": "selectMode"; "wrapperClass": "wrapperClass"; }, { "addClick": "addClick"; }, never, never, false>;
136
137
  }
@@ -1,23 +1,22 @@
1
1
  import * as i0 from "@angular/core";
2
2
  import * as i1 from "./lookup.component";
3
- import * as i2 from "./lookup-item-selected.pipe";
4
- import * as i3 from "./lookup-show-more-async-modal.component";
5
- import * as i4 from "./lookup-show-more-modal.component";
6
- import * as i5 from "@angular/common";
7
- import * as i6 from "@angular/forms";
8
- import * as i7 from "../autocomplete/autocomplete.module";
9
- import * as i8 from "@skyux/forms";
10
- import * as i9 from "@skyux/indicators";
11
- import * as i10 from "@skyux/lists";
12
- import * as i11 from "@skyux/i18n";
13
- import * as i12 from "../shared/sky-lookup-resources.module";
14
- import * as i13 from "@skyux/modals";
15
- import * as i14 from "../search/search.module";
16
- import * as i15 from "@skyux/theme";
17
- import * as i16 from "@skyux/layout";
18
- import * as i17 from "@skyux/core";
3
+ import * as i2 from "./lookup-show-more-modal.component";
4
+ import * as i3 from "@angular/common";
5
+ import * as i4 from "@angular/forms";
6
+ import * as i5 from "../autocomplete/autocomplete.module";
7
+ import * as i6 from "@skyux/forms";
8
+ import * as i7 from "@skyux/indicators";
9
+ import * as i8 from "@skyux/lists";
10
+ import * as i9 from "@skyux/i18n";
11
+ import * as i10 from "../shared/sky-lookup-resources.module";
12
+ import * as i11 from "@skyux/modals";
13
+ import * as i12 from "../search/search.module";
14
+ import * as i13 from "../selection-modal/selection-modal.module";
15
+ import * as i14 from "@skyux/theme";
16
+ import * as i15 from "@skyux/layout";
17
+ import * as i16 from "@skyux/core";
19
18
  export declare class SkyLookupModule {
20
19
  static ɵfac: i0.ɵɵFactoryDeclaration<SkyLookupModule, never>;
21
- static ɵmod: i0.ɵɵNgModuleDeclaration<SkyLookupModule, [typeof i1.SkyLookupComponent, typeof i2.SkyLookupItemSelectedPipe, typeof i3.SkyLookupShowMoreAsyncModalComponent, typeof i4.SkyLookupShowMoreModalComponent], [typeof i5.CommonModule, typeof i6.FormsModule, typeof i7.SkyAutocompleteModule, typeof i8.SkyCheckboxModule, typeof i9.SkyIconModule, typeof i10.SkyInfiniteScrollModule, typeof i11.SkyI18nModule, typeof i12.SkyLookupResourcesModule, typeof i13.SkyModalModule, typeof i10.SkyRepeaterModule, typeof i14.SkySearchModule, typeof i15.SkyThemeModule, typeof i9.SkyTokensModule, typeof i16.SkyToolbarModule, typeof i17.SkyViewkeeperModule, typeof i9.SkyWaitModule], [typeof i1.SkyLookupComponent]>;
20
+ static ɵmod: i0.ɵɵNgModuleDeclaration<SkyLookupModule, [typeof i1.SkyLookupComponent, typeof i2.SkyLookupShowMoreModalComponent], [typeof i3.CommonModule, typeof i4.FormsModule, typeof i5.SkyAutocompleteModule, typeof i6.SkyCheckboxModule, typeof i7.SkyIconModule, typeof i8.SkyInfiniteScrollModule, typeof i9.SkyI18nModule, typeof i10.SkyLookupResourcesModule, typeof i11.SkyModalModule, typeof i8.SkyRepeaterModule, typeof i12.SkySearchModule, typeof i13.SkySelectionModalModule, typeof i14.SkyThemeModule, typeof i7.SkyTokensModule, typeof i15.SkyToolbarModule, typeof i16.SkyViewkeeperModule, typeof i7.SkyWaitModule], [typeof i1.SkyLookupComponent]>;
22
21
  static ɵinj: i0.ɵɵInjectorDeclaration<SkyLookupModule>;
23
22
  }
@@ -0,0 +1,10 @@
1
+ import { PipeTransform } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ /**
4
+ * @internal
5
+ */
6
+ export declare class SkySelectionModalItemSelectedPipe implements PipeTransform {
7
+ transform(id: unknown, selectedIdMap: Map<unknown, unknown>): boolean;
8
+ static ɵfac: i0.ɵɵFactoryDeclaration<SkySelectionModalItemSelectedPipe, never>;
9
+ static ɵpipe: i0.ɵɵPipeDeclaration<SkySelectionModalItemSelectedPipe, "skySelectionModalItemSelected", false>;
10
+ }
@@ -1,17 +1,16 @@
1
1
  import { ChangeDetectorRef, OnDestroy, OnInit, TemplateRef } from '@angular/core';
2
- import { SkyIdService, SkyLogService } from '@skyux/core';
2
+ import { SkyIdService } from '@skyux/core';
3
3
  import { SkyModalInstance } from '@skyux/modals';
4
4
  import { Subject } from 'rxjs';
5
- import { SkyLookupShowMoreNativePickerAsyncContext } from './types/lookup-show-more-native-picker-async-context';
5
+ import { SkySelectionModalContext } from './types/selection-modal-context';
6
6
  import * as i0 from "@angular/core";
7
7
  /**
8
8
  * @internal
9
- * Internal component to implement the native picker.
10
9
  */
11
- export declare class SkyLookupShowMoreAsyncModalComponent implements OnInit, OnDestroy {
10
+ export declare class SkySelectionModalComponent implements OnInit, OnDestroy {
12
11
  #private;
13
12
  modalInstance: SkyModalInstance;
14
- context: SkyLookupShowMoreNativePickerAsyncContext;
13
+ context: SkySelectionModalContext;
15
14
  /**
16
15
  * @internal
17
16
  * Fires when users select the button to add new options to the list.
@@ -30,18 +29,19 @@ export declare class SkyLookupShowMoreAsyncModalComponent implements OnInit, OnD
30
29
  repeaterItemTemplate: TemplateRef<unknown> | null;
31
30
  searchText: string | undefined;
32
31
  selectedIdMap: Map<unknown, unknown>;
33
- constructor(modalInstance: SkyModalInstance, context: SkyLookupShowMoreNativePickerAsyncContext, changeDetector: ChangeDetectorRef, idSvc: SkyIdService, logSvc: SkyLogService);
32
+ constructor(modalInstance: SkyModalInstance, context: SkySelectionModalContext, changeDetector: ChangeDetectorRef, idSvc: SkyIdService);
34
33
  ngOnInit(): void;
35
34
  ngOnDestroy(): void;
36
35
  addButtonClicked(): void;
37
36
  clearAll(): void;
38
37
  itemClick(selectedItem: any): void;
38
+ addItem(itemToAdd: any): void;
39
39
  onItemSelect(newSelectState: boolean, itemToSelect: any): void;
40
40
  searchApplied(searchText: string): void;
41
41
  selectAll(): void;
42
42
  infiniteScrollEnd(): void;
43
43
  save(): void;
44
44
  updateDisplayedItems(): void;
45
- static ɵfac: i0.ɵɵFactoryDeclaration<SkyLookupShowMoreAsyncModalComponent, never>;
46
- static ɵcmp: i0.ɵɵComponentDeclaration<SkyLookupShowMoreAsyncModalComponent, "sky-lookup-show-more-async-modal", never, {}, {}, never, never, false>;
45
+ static ɵfac: i0.ɵɵFactoryDeclaration<SkySelectionModalComponent, never>;
46
+ static ɵcmp: i0.ɵɵComponentDeclaration<SkySelectionModalComponent, "sky-selection-modal", never, {}, {}, never, never, false>;
47
47
  }
@@ -0,0 +1,18 @@
1
+ import * as i0 from "@angular/core";
2
+ import * as i1 from "./selection-modal.component";
3
+ import * as i2 from "./selection-modal-item-selected.pipe";
4
+ import * as i3 from "@angular/common";
5
+ import * as i4 from "@skyux/forms";
6
+ import * as i5 from "@skyux/i18n";
7
+ import * as i6 from "@skyux/indicators";
8
+ import * as i7 from "@skyux/lists";
9
+ import * as i8 from "@skyux/modals";
10
+ import * as i9 from "../search/search.module";
11
+ import * as i10 from "@skyux/theme";
12
+ import * as i11 from "@skyux/layout";
13
+ import * as i12 from "@skyux/core";
14
+ export declare class SkySelectionModalModule {
15
+ static ɵfac: i0.ɵɵFactoryDeclaration<SkySelectionModalModule, never>;
16
+ static ɵmod: i0.ɵɵNgModuleDeclaration<SkySelectionModalModule, [typeof i1.SkySelectionModalComponent, typeof i2.SkySelectionModalItemSelectedPipe], [typeof i3.CommonModule, typeof i4.SkyCheckboxModule, typeof i5.SkyI18nModule, typeof i6.SkyIconModule, typeof i7.SkyInfiniteScrollModule, typeof i8.SkyModalModule, typeof i7.SkyRepeaterModule, typeof i9.SkySearchModule, typeof i10.SkyThemeModule, typeof i11.SkyToolbarModule, typeof i12.SkyViewkeeperModule, typeof i6.SkyWaitModule], never>;
17
+ static ɵinj: i0.ɵɵInjectorDeclaration<SkySelectionModalModule>;
18
+ }
@@ -0,0 +1,18 @@
1
+ import { SkyModalService } from '@skyux/modals';
2
+ import { SkySelectionModalInstance } from './types/selection-modal-instance';
3
+ import { SkySelectionModalOpenArgs } from './types/selection-modal-open-args';
4
+ import * as i0 from "@angular/core";
5
+ /**
6
+ * Displays a modal for selecting one or more values.
7
+ */
8
+ export declare class SkySelectionModalService {
9
+ #private;
10
+ constructor(modalSvc: SkyModalService);
11
+ /**
12
+ * Opens the selection modal.
13
+ * @param args Parameters for the selection modal.
14
+ */
15
+ open(args: SkySelectionModalOpenArgs): SkySelectionModalInstance;
16
+ static ɵfac: i0.ɵɵFactoryDeclaration<SkySelectionModalService, never>;
17
+ static ɵprov: i0.ɵɵInjectableDeclaration<SkySelectionModalService>;
18
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Specifies the information for the callback used when adding a new item to a selection modal instance.
3
+ */
4
+ export interface SkySelectionModalAddCallbackArgs {
5
+ /**
6
+ * The new item which has been added to the data. This item will be automatically selected.
7
+ */
8
+ item: any;
9
+ }
@@ -0,0 +1,11 @@
1
+ import { SkySelectionModalAddCallbackArgs } from './selection-modal-add-click-callback-args';
2
+ /**
3
+ * Specifies a callback function for the consumer to use to notify the selection modal that a new item has been added.
4
+ */
5
+ export interface SkySelectionModalAddClickEventArgs {
6
+ /**
7
+ * A callback function for the consumer to use to notify the selection modal that a new item has been added.
8
+ * @param args Specifies information about the item that was added.
9
+ */
10
+ itemAdded: (args: SkySelectionModalAddCallbackArgs) => void;
11
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The result from the selection modal.
3
+ */
4
+ export interface SkySelectionModalCloseArgs {
5
+ /**
6
+ * Indicates why the selection modal was closed.
7
+ */
8
+ reason: 'cancel' | 'close' | 'save';
9
+ /**
10
+ * A collection of items the user selected. This property is only
11
+ * set when the `result` property is set to `save`.
12
+ */
13
+ selectedItems?: unknown[];
14
+ }
@@ -0,0 +1,18 @@
1
+ import { SkyAutocompleteSearchAsyncFunction } from '../../autocomplete/types/autocomplete-search-async-function';
2
+ import { SkyLookupSelectModeType } from '../../lookup/types/lookup-select-mode-type';
3
+ import { SkyLookupShowMoreNativePickerConfig } from '../../lookup/types/lookup-show-more-native-picker-config';
4
+ /**
5
+ * @internal
6
+ * Context for the selection modal. These values are provided by the selection modal service.
7
+ */
8
+ export declare class SkySelectionModalContext {
9
+ descriptorProperty: string;
10
+ idProperty: string;
11
+ initialSearch: string;
12
+ initialValue: unknown[];
13
+ searchAsync: SkyAutocompleteSearchAsyncFunction;
14
+ selectMode: SkyLookupSelectModeType;
15
+ showAddButton: boolean;
16
+ userConfig: SkyLookupShowMoreNativePickerConfig;
17
+ constructor(descriptorProperty: string, idProperty: string, initialSearch: string, initialValue: unknown[], searchAsync: SkyAutocompleteSearchAsyncFunction, selectMode: SkyLookupSelectModeType, showAddButton: boolean, userConfig: SkyLookupShowMoreNativePickerConfig);
18
+ }
@@ -0,0 +1,33 @@
1
+ import { Observable } from 'rxjs';
2
+ import { SkySelectionModalCloseArgs } from './selection-modal-close-args';
3
+ /**
4
+ * Represents an instance of a selection modal.
5
+ */
6
+ export declare class SkySelectionModalInstance {
7
+ #private;
8
+ /**
9
+ * An event that the selection modal instance emits when it closes.
10
+ * It emits a `SkySelectionModalCloseArgs` object with a `selectedItems` property that includes
11
+ * items selected by users on close or save and a `reason` property that indicates
12
+ * whether the selection modal was saved or closed without saving.
13
+ * The `reason` property accepts `"cancel"`, `"close"`, and `"save"`.
14
+ */
15
+ get closed(): Observable<SkySelectionModalCloseArgs>;
16
+ /**
17
+ * @internal
18
+ */
19
+ get itemAdded(): Observable<unknown>;
20
+ /**
21
+ * @internal
22
+ */
23
+ id: string;
24
+ constructor(id: string);
25
+ /**
26
+ * @internal
27
+ */
28
+ close(args: SkySelectionModalCloseArgs): void;
29
+ /**
30
+ * @internal
31
+ */
32
+ addItem(itemToAdd: unknown): void;
33
+ }
@@ -0,0 +1,58 @@
1
+ import { TemplateRef } from '@angular/core';
2
+ import { Observable } from 'rxjs';
3
+ import { SkyLookupSelectModeType } from '../../lookup/types/lookup-select-mode-type';
4
+ import { SkySelectionModalAddClickEventArgs } from './selection-modal-add-click-event-args';
5
+ import { SkySelectionModalSearchArgs } from './selection-modal-search-args';
6
+ import { SkySelectionModalSearchResult } from './selection-modal-search-result';
7
+ /**
8
+ * Parameters for the selection modal.
9
+ */
10
+ export interface SkySelectionModalOpenArgs {
11
+ /**
12
+ * The template to format each option in the search results. The selection modal
13
+ * injects values into the template as `item` variables that reference all the object
14
+ * properties of the options. If you do not specify a template, the item's descriptor
15
+ * property value is displayed.
16
+ */
17
+ itemTemplate?: TemplateRef<unknown>;
18
+ /**
19
+ * The title for the selection modal.
20
+ * @default "Select an option/Select options"
21
+ */
22
+ title?: string;
23
+ /**
24
+ * The initial value for the selection modal.
25
+ */
26
+ value?: unknown[];
27
+ /**
28
+ * Specifies an object property to display in the text input after users
29
+ * select an item in the dropdown list.
30
+ */
31
+ descriptorProperty: string;
32
+ /**
33
+ * An object property that represents the object's unique identifier.
34
+ */
35
+ idProperty: string;
36
+ /**
37
+ * The initial search text.
38
+ */
39
+ initialSearch?: string;
40
+ /**
41
+ * Called when users enter new search information and returns results via an observable.
42
+ */
43
+ searchAsync: (args: SkySelectionModalSearchArgs) => Observable<SkySelectionModalSearchResult> | undefined;
44
+ /**
45
+ * Specifies whether users can select one option or multiple options.
46
+ * @default "multiple"
47
+ */
48
+ selectMode: SkyLookupSelectModeType;
49
+ /**
50
+ * Whether to display a button that lets users add options to the list.
51
+ * @default false
52
+ */
53
+ showAddButton?: boolean;
54
+ /**
55
+ * Called when users select the button to add options to the list.
56
+ */
57
+ addClick?: (args: SkySelectionModalAddClickEventArgs) => void;
58
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The result from the selection modal.
3
+ */
4
+ export interface SkySelectionModalResult {
5
+ /**
6
+ * Indicates whether the user saved or canceled the modal.
7
+ */
8
+ result: 'save' | 'cancel';
9
+ /**
10
+ * A collection of items the user selected. This property is only
11
+ * set when the `result` property is set to `save`.
12
+ */
13
+ selectedItems?: unknown[];
14
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Arguments passed when an asynchronous search is executed from the
3
+ * selection modal service.
4
+ */
5
+ export interface SkySelectionModalSearchArgs {
6
+ /**
7
+ * The search text entered by the user.
8
+ */
9
+ searchText: string;
10
+ /**
11
+ * The offset index of the first result to return. When search is executed
12
+ * as a result of an infinite scroll event, for example, offset will be set
13
+ * to the number of items already displayed.
14
+ */
15
+ offset: number;
16
+ /**
17
+ * A continuation token which can be set and then will be passed back with any future searches.
18
+ * This is helpful for applications which utilize a token instead of an offset when fetching data.
19
+ */
20
+ continuationData?: unknown;
21
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * The result of searching for items to display in a selection modal.
3
+ */
4
+ export interface SkySelectionModalSearchResult {
5
+ /**
6
+ * Data provided on "load more" search result requests. Use this property for
7
+ * information such as a continuation token for paged database queries.
8
+ */
9
+ continuationData?: unknown;
10
+ /**
11
+ * Indicates whether there are more results that match the search criteria.
12
+ */
13
+ hasMore?: boolean;
14
+ /**
15
+ * A list of items matching the search criteria. When there are more items that match
16
+ * the search criteria, set the `hasMore` property to `true` more records can be lazy-loaded
17
+ * as the user scrolls through the search results.
18
+ */
19
+ items: unknown[];
20
+ /**
21
+ * The total number of records that match the search criteria, including items not returned in
22
+ * the current list of items.
23
+ */
24
+ totalCount: number;
25
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyux/lookup",
3
- "version": "7.3.0",
3
+ "version": "7.4.1",
4
4
  "author": "Blackbaud, Inc.",
5
5
  "keywords": [
6
6
  "blackbaud",
@@ -46,15 +46,15 @@
46
46
  "@angular/core": "^14.2.11",
47
47
  "@angular/forms": "^14.2.11",
48
48
  "@angular/platform-browser": "^14.2.11",
49
- "@skyux-sdk/testing": "7.3.0",
50
- "@skyux/core": "7.3.0",
51
- "@skyux/forms": "7.3.0",
52
- "@skyux/i18n": "7.3.0",
53
- "@skyux/indicators": "7.3.0",
54
- "@skyux/layout": "7.3.0",
55
- "@skyux/lists": "7.3.0",
56
- "@skyux/modals": "7.3.0",
57
- "@skyux/theme": "7.3.0"
49
+ "@skyux-sdk/testing": "7.4.1",
50
+ "@skyux/core": "7.4.1",
51
+ "@skyux/forms": "7.4.1",
52
+ "@skyux/i18n": "7.4.1",
53
+ "@skyux/indicators": "7.4.1",
54
+ "@skyux/layout": "7.4.1",
55
+ "@skyux/lists": "7.4.1",
56
+ "@skyux/modals": "7.4.1",
57
+ "@skyux/theme": "7.4.1"
58
58
  },
59
59
  "dependencies": {
60
60
  "intl-tel-input": "17.0.19",
@@ -1,4 +1,5 @@
1
- import { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';
1
+ import { HarnessPredicate } from '@angular/cdk/testing';
2
+ import { SkySelectionModalHarness } from '../selection-modal/selection-modal-harness';
2
3
  import { SkyLookupShowMorePickerHarnessFilters } from './lookup-show-more-picker-harness-filters';
3
4
  import { SkyLookupShowMorePickerSearchResultHarness } from './lookup-show-more-picker-search-result-harness';
4
5
  import { SkyLookupShowMorePickerSearchResultHarnessFilters } from './lookup-show-more-picker-search-result-harness-filters';
@@ -6,57 +7,18 @@ import { SkyLookupShowMorePickerSearchResultHarnessFilters } from './lookup-show
6
7
  * Harness for interacting with a lookup's "Show more" picker in tests.
7
8
  * @internal
8
9
  */
9
- export declare class SkyLookupShowMorePickerHarness extends ComponentHarness {
10
- #private;
11
- /**
12
- * Use the class name since the async and non-async pickers use different
13
- * host components but share the same wrapper CSS class.
14
- * @internal
15
- */
16
- static hostSelector: string;
10
+ export declare class SkyLookupShowMorePickerHarness extends SkySelectionModalHarness {
17
11
  /**
18
12
  * Gets a `HarnessPredicate` that can be used to search for a
19
13
  * `SkyLookupShowMorePickerHarness` that meets certain criteria.
20
14
  */
21
15
  static with(filters: SkyLookupShowMorePickerHarnessFilters): HarnessPredicate<SkyLookupShowMorePickerHarness>;
22
- /**
23
- * Clears the text of the search input.
24
- */
25
- clearSearchText(): Promise<void>;
26
- /**
27
- * Enters text into the search input and performs a search.
28
- */
29
- enterSearchText(value: string): Promise<void>;
30
16
  /**
31
17
  * Selects multiple search results based on a set of criteria.
32
18
  */
33
19
  selectSearchResult(filters?: SkyLookupShowMorePickerSearchResultHarnessFilters): Promise<void>;
34
- /**
35
- * Saves any selections made and closes the picker.
36
- */
37
- saveAndClose(): Promise<void>;
38
- /**
39
- * Closes the picker without saving any selections made.
40
- */
41
- cancel(): Promise<void>;
42
20
  /**
43
21
  * Gets a list of search results.
44
22
  */
45
23
  getSearchResults(filters?: SkyLookupShowMorePickerSearchResultHarnessFilters): Promise<SkyLookupShowMorePickerSearchResultHarness[]>;
46
- /**
47
- * Clears all selections made.
48
- */
49
- clearAll(): Promise<void>;
50
- /**
51
- * Whether the picker is configured to allow multiple selections.
52
- */
53
- isMultiselect(): Promise<boolean>;
54
- /**
55
- * Selects all search results.
56
- */
57
- selectAll(): Promise<void>;
58
- /**
59
- * Loads more results in the picker.
60
- */
61
- loadMore(): Promise<void>;
62
24
  }
@@ -1,7 +1,7 @@
1
- import { SkyRepeaterItemHarnessFilters } from '@skyux/lists/testing';
1
+ import { SkySelectionModalSearchResultHarnessFilters } from '../selection-modal/selection-modal-search-result-harness-filters';
2
2
  /**
3
3
  * A set of criteria that can be used to filter a list of `SkyLookupShowMorePickerSearchResultHarness` instances.
4
4
  * @internal
5
5
  */
6
- export interface SkyLookupShowMorePickerSearchResultHarnessFilters extends Omit<SkyRepeaterItemHarnessFilters, 'titleText' | 'ancestor'> {
6
+ export interface SkyLookupShowMorePickerSearchResultHarnessFilters extends SkySelectionModalSearchResultHarnessFilters {
7
7
  }
@@ -1,7 +1,7 @@
1
- import { SkyRepeaterItemHarness } from '@skyux/lists/testing';
1
+ import { SkySelectionModalSearchResultHarness } from '../selection-modal/selection-modal-search-result-harness';
2
2
  /**
3
3
  * Harness for interacting with a lookup's "Show more" picker search results in tests.
4
4
  * @internal
5
5
  */
6
- export declare class SkyLookupShowMorePickerSearchResultHarness extends SkyRepeaterItemHarness {
6
+ export declare class SkyLookupShowMorePickerSearchResultHarness extends SkySelectionModalSearchResultHarness {
7
7
  }
@@ -17,3 +17,6 @@ export * from './search/search-fixture';
17
17
  export * from './search/search-harness';
18
18
  export * from './search/search-harness-filters';
19
19
  export * from './search/search-testing.module';
20
+ export * from './selection-modal/selection-modal-harness';
21
+ export * from './selection-modal/selection-modal-search-result-harness';
22
+ export * from './selection-modal/selection-modal-search-result-harness-filters';
@@ -0,0 +1,61 @@
1
+ import { ComponentHarness } from '@angular/cdk/testing';
2
+ import { SkySelectionModalSearchResultHarness } from './selection-modal-search-result-harness';
3
+ import { SkySelectionModalSearchResultHarnessFilters } from './selection-modal-search-result-harness-filters';
4
+ /**
5
+ * Harness for interacting with a selection modal in tests.
6
+ */
7
+ export declare class SkySelectionModalHarness extends ComponentHarness {
8
+ #private;
9
+ /**
10
+ * @internal
11
+ */
12
+ static hostSelector: string;
13
+ /**
14
+ * Clears the text of the search input.
15
+ */
16
+ clearSearchText(): Promise<void>;
17
+ /**
18
+ * Enters text into the search input and performs a search.
19
+ */
20
+ enterSearchText(value: string): Promise<void>;
21
+ /**
22
+ * Selects multiple search results based on a set of criteria.
23
+ */
24
+ selectSearchResult(filters?: SkySelectionModalSearchResultHarnessFilters): Promise<void>;
25
+ /**
26
+ * Saves any selections made and closes the modal.
27
+ */
28
+ saveAndClose(): Promise<void>;
29
+ /**
30
+ * Closes the picker without saving any selections made.
31
+ */
32
+ cancel(): Promise<void>;
33
+ /**
34
+ * Gets a list of search results.
35
+ */
36
+ getSearchResults(filters?: SkySelectionModalSearchResultHarnessFilters): Promise<SkySelectionModalSearchResultHarness[]>;
37
+ /**
38
+ * Clears all selections made.
39
+ */
40
+ clearAll(): Promise<void>;
41
+ /**
42
+ * Whether the selection modal is configured to allow multiple selections.
43
+ */
44
+ isMultiselect(): Promise<boolean>;
45
+ /**
46
+ * Selects all search results.
47
+ */
48
+ selectAll(): Promise<void>;
49
+ /**
50
+ * Loads more results in the picker.
51
+ */
52
+ loadMore(): Promise<void>;
53
+ /**
54
+ * Whether the selection modal is configured to show the add button.
55
+ */
56
+ hasAddButton(): Promise<boolean>;
57
+ /**
58
+ * Clicks the add button.
59
+ */
60
+ clickAddButton(): Promise<void>;
61
+ }
@@ -0,0 +1,6 @@
1
+ import { SkyRepeaterItemHarnessFilters } from '@skyux/lists/testing';
2
+ /**
3
+ * A set of criteria that can be used to filter a list of `SkySelectionModalSearchResultHarness` instances.
4
+ */
5
+ export interface SkySelectionModalSearchResultHarnessFilters extends Omit<SkyRepeaterItemHarnessFilters, 'titleText' | 'ancestor'> {
6
+ }
@@ -0,0 +1,6 @@
1
+ import { SkyRepeaterItemHarness } from '@skyux/lists/testing';
2
+ /**
3
+ * Harness for interacting with a selection modal's search results in tests.
4
+ */
5
+ export declare class SkySelectionModalSearchResultHarness extends SkyRepeaterItemHarness {
6
+ }
@@ -1,16 +0,0 @@
1
- import { Pipe } from '@angular/core';
2
- import * as i0 from "@angular/core";
3
- export class SkyLookupItemSelectedPipe {
4
- transform(id, selectedIdMap) {
5
- return selectedIdMap.has(id);
6
- }
7
- }
8
- SkyLookupItemSelectedPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: SkyLookupItemSelectedPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
9
- SkyLookupItemSelectedPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.2.11", ngImport: i0, type: SkyLookupItemSelectedPipe, name: "skyLookupItemSelected" });
10
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: SkyLookupItemSelectedPipe, decorators: [{
11
- type: Pipe,
12
- args: [{
13
- name: 'skyLookupItemSelected',
14
- }]
15
- }] });
16
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9va3VwLWl0ZW0tc2VsZWN0ZWQucGlwZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uL2xpYnMvY29tcG9uZW50cy9sb29rdXAvc3JjL2xpYi9tb2R1bGVzL2xvb2t1cC9sb29rdXAtaXRlbS1zZWxlY3RlZC5waXBlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxJQUFJLEVBQWlCLE1BQU0sZUFBZSxDQUFDOztBQUtwRCxNQUFNLE9BQU8seUJBQXlCO0lBQzdCLFNBQVMsQ0FBQyxFQUFXLEVBQUUsYUFBb0M7UUFDaEUsT0FBTyxhQUFhLENBQUMsR0FBRyxDQUFDLEVBQUUsQ0FBQyxDQUFDO0lBQy9CLENBQUM7O3VIQUhVLHlCQUF5QjtxSEFBekIseUJBQXlCOzRGQUF6Qix5QkFBeUI7a0JBSHJDLElBQUk7bUJBQUM7b0JBQ0osSUFBSSxFQUFFLHVCQUF1QjtpQkFDOUIiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBQaXBlLCBQaXBlVHJhbnNmb3JtIH0gZnJvbSAnQGFuZ3VsYXIvY29yZSc7XG5cbkBQaXBlKHtcbiAgbmFtZTogJ3NreUxvb2t1cEl0ZW1TZWxlY3RlZCcsXG59KVxuZXhwb3J0IGNsYXNzIFNreUxvb2t1cEl0ZW1TZWxlY3RlZFBpcGUgaW1wbGVtZW50cyBQaXBlVHJhbnNmb3JtIHtcbiAgcHVibGljIHRyYW5zZm9ybShpZDogdW5rbm93biwgc2VsZWN0ZWRJZE1hcDogTWFwPHVua25vd24sIHVua25vd24+KTogYm9vbGVhbiB7XG4gICAgcmV0dXJuIHNlbGVjdGVkSWRNYXAuaGFzKGlkKTtcbiAgfVxufVxuIl19