@skyux/lookup 5.2.2 → 5.5.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.
- package/README.md +6 -4
- package/documentation.json +409 -23
- package/esm2015/index.js +32 -0
- package/esm2015/index.js.map +1 -0
- package/esm2015/lib/modules/autocomplete/autocomplete-adapter.service.js +62 -0
- package/esm2015/lib/modules/autocomplete/autocomplete-adapter.service.js.map +1 -0
- package/esm2015/lib/modules/autocomplete/autocomplete-default-search-function.js +39 -0
- package/esm2015/lib/modules/autocomplete/autocomplete-default-search-function.js.map +1 -0
- package/esm2015/lib/modules/autocomplete/autocomplete-input.directive.js +220 -0
- package/esm2015/lib/modules/autocomplete/autocomplete-input.directive.js.map +1 -0
- package/esm2015/lib/modules/autocomplete/autocomplete-search-async-disabled.pipe.js +19 -0
- package/esm2015/lib/modules/autocomplete/autocomplete-search-async-disabled.pipe.js.map +1 -0
- package/esm2015/lib/modules/autocomplete/autocomplete.component.js +732 -0
- package/esm2015/lib/modules/autocomplete/autocomplete.component.js.map +1 -0
- package/esm2015/lib/modules/autocomplete/autocomplete.module.js +65 -0
- package/esm2015/lib/modules/autocomplete/autocomplete.module.js.map +1 -0
- package/esm2015/lib/modules/autocomplete/types/autocomplete-default-search-function-options.js +2 -0
- package/esm2015/lib/modules/autocomplete/types/autocomplete-default-search-function-options.js.map +1 -0
- package/esm2015/lib/modules/autocomplete/types/autocomplete-input-text-change.js +2 -0
- package/esm2015/lib/modules/autocomplete/types/autocomplete-input-text-change.js.map +1 -0
- package/esm2015/lib/modules/autocomplete/types/autocomplete-message-type.js +15 -0
- package/esm2015/lib/modules/autocomplete/types/autocomplete-message-type.js.map +1 -0
- package/esm2015/lib/modules/autocomplete/types/autocomplete-message.js +2 -0
- package/esm2015/lib/modules/autocomplete/types/autocomplete-message.js.map +1 -0
- package/esm2015/lib/modules/autocomplete/types/autocomplete-search-async-args.js +2 -0
- package/esm2015/lib/modules/autocomplete/types/autocomplete-search-async-args.js.map +1 -0
- package/esm2015/lib/modules/autocomplete/types/autocomplete-search-async-function.js +2 -0
- package/esm2015/lib/modules/autocomplete/types/autocomplete-search-async-function.js.map +1 -0
- package/esm2015/lib/modules/autocomplete/types/autocomplete-search-async-result-display-type.js +2 -0
- package/esm2015/lib/modules/autocomplete/types/autocomplete-search-async-result-display-type.js.map +1 -0
- package/esm2015/lib/modules/autocomplete/types/autocomplete-search-async-result.js +2 -0
- package/esm2015/lib/modules/autocomplete/types/autocomplete-search-async-result.js.map +1 -0
- package/esm2015/lib/modules/autocomplete/types/autocomplete-search-function-filter.js +2 -0
- package/esm2015/lib/modules/autocomplete/types/autocomplete-search-function-filter.js.map +1 -0
- package/esm2015/lib/modules/autocomplete/types/autocomplete-search-function-response.js +2 -0
- package/esm2015/lib/modules/autocomplete/types/autocomplete-search-function-response.js.map +1 -0
- package/esm2015/lib/modules/autocomplete/types/autocomplete-search-function.js +2 -0
- package/esm2015/lib/modules/autocomplete/types/autocomplete-search-function.js.map +1 -0
- package/esm2015/lib/modules/autocomplete/types/autocomplete-selection-change.js +2 -0
- package/esm2015/lib/modules/autocomplete/types/autocomplete-selection-change.js.map +1 -0
- package/esm2015/lib/modules/autocomplete/types/autocomplete-show-more-args.js +2 -0
- package/esm2015/lib/modules/autocomplete/types/autocomplete-show-more-args.js.map +1 -0
- package/esm2015/{modules → lib/modules}/country-field/country-field.component.js +5 -2
- package/esm2015/lib/modules/country-field/country-field.component.js.map +1 -0
- package/esm2015/lib/modules/country-field/country-field.module.js +49 -0
- package/esm2015/lib/modules/country-field/country-field.module.js.map +1 -0
- package/esm2015/lib/modules/country-field/types/country.js +2 -0
- package/esm2015/lib/modules/country-field/types/country.js.map +1 -0
- package/esm2015/lib/modules/lookup/lookup-adapter.service.js +21 -0
- package/esm2015/lib/modules/lookup/lookup-adapter.service.js.map +1 -0
- package/esm2015/lib/modules/lookup/lookup-autocomplete-adapter.js +72 -0
- package/esm2015/lib/modules/lookup/lookup-autocomplete-adapter.js.map +1 -0
- package/esm2015/lib/modules/lookup/lookup-item-selected.pipe.js +16 -0
- package/esm2015/lib/modules/lookup/lookup-item-selected.pipe.js.map +1 -0
- package/esm2015/lib/modules/lookup/lookup-show-more-async-modal.component.js +186 -0
- package/esm2015/lib/modules/lookup/lookup-show-more-async-modal.component.js.map +1 -0
- package/esm2015/lib/modules/lookup/lookup-show-more-modal.component.js +258 -0
- package/esm2015/lib/modules/lookup/lookup-show-more-modal.component.js.map +1 -0
- package/esm2015/lib/modules/lookup/lookup.component.js +608 -0
- package/esm2015/lib/modules/lookup/lookup.component.js.map +1 -0
- package/esm2015/lib/modules/lookup/lookup.module.js +94 -0
- package/esm2015/lib/modules/lookup/lookup.module.js.map +1 -0
- package/esm2015/lib/modules/lookup/types/lookup-add-click-callback-args.js +2 -0
- package/esm2015/lib/modules/lookup/types/lookup-add-click-callback-args.js.map +1 -0
- package/esm2015/lib/modules/lookup/types/lookup-add-click-event-args.js +2 -0
- package/esm2015/lib/modules/lookup/types/lookup-add-click-event-args.js.map +1 -0
- package/esm2015/lib/modules/lookup/types/lookup-select-mode-type.js +2 -0
- package/esm2015/lib/modules/lookup/types/lookup-select-mode-type.js.map +1 -0
- package/esm2015/lib/modules/lookup/types/lookup-select-mode.js +16 -0
- package/esm2015/lib/modules/lookup/types/lookup-select-mode.js.map +1 -0
- package/esm2015/lib/modules/lookup/types/lookup-show-more-config.js +2 -0
- package/esm2015/lib/modules/lookup/types/lookup-show-more-config.js.map +1 -0
- package/esm2015/lib/modules/lookup/types/lookup-show-more-custom-picker-context.js +7 -0
- package/esm2015/lib/modules/lookup/types/lookup-show-more-custom-picker-context.js.map +1 -0
- package/esm2015/lib/modules/lookup/types/lookup-show-more-custom-picker.js +2 -0
- package/esm2015/lib/modules/lookup/types/lookup-show-more-custom-picker.js.map +1 -0
- package/esm2015/lib/modules/lookup/types/lookup-show-more-native-picker-async-context.js +7 -0
- package/esm2015/lib/modules/lookup/types/lookup-show-more-native-picker-async-context.js.map +1 -0
- package/esm2015/lib/modules/lookup/types/lookup-show-more-native-picker-config.js +2 -0
- package/esm2015/lib/modules/lookup/types/lookup-show-more-native-picker-config.js.map +1 -0
- package/esm2015/lib/modules/lookup/types/lookup-show-more-native-picker-context.js +7 -0
- package/esm2015/lib/modules/lookup/types/lookup-show-more-native-picker-context.js.map +1 -0
- package/esm2015/lib/modules/search/search-adapter.service.js +45 -0
- package/esm2015/lib/modules/search/search-adapter.service.js.map +1 -0
- package/esm2015/lib/modules/search/search.component.js +260 -0
- package/esm2015/lib/modules/search/search.component.js.map +1 -0
- package/esm2015/lib/modules/search/search.module.js +46 -0
- package/esm2015/lib/modules/search/search.module.js.map +1 -0
- package/esm2015/lib/modules/shared/sky-lookup-resources.module.js +72 -0
- package/esm2015/lib/modules/shared/sky-lookup-resources.module.js.map +1 -0
- package/esm2015/lib/modules/shared/sky-lookup-string-utils.js +8 -0
- package/esm2015/lib/modules/shared/sky-lookup-string-utils.js.map +1 -0
- package/esm2015/lib/polyfills.js +30 -0
- package/esm2015/lib/polyfills.js.map +1 -0
- package/esm2015/skyux-lookup.js +2 -2
- package/esm2015/skyux-lookup.js.map +1 -0
- package/esm2015/testing/country-field/country-field-fixture.js +1 -1
- package/esm2015/testing/country-field/country-field-fixture.js.map +1 -0
- package/esm2015/testing/country-field/country-field-testing.module.js +1 -1
- package/esm2015/testing/country-field/country-field-testing.module.js.map +1 -0
- package/esm2015/testing/public-api.js +1 -1
- package/esm2015/testing/public-api.js.map +1 -0
- package/esm2015/testing/search/search-fixture.js +1 -1
- package/esm2015/testing/search/search-fixture.js.map +1 -0
- package/esm2015/testing/search/search-testing.module.js +1 -1
- package/esm2015/testing/search/search-testing.module.js.map +1 -0
- package/esm2015/testing/skyux-lookup-testing.js +1 -1
- package/esm2015/testing/skyux-lookup-testing.js.map +1 -0
- package/fesm2015/skyux-lookup-testing.js.map +1 -1
- package/fesm2015/skyux-lookup.js +2 -2
- package/fesm2015/skyux-lookup.js.map +1 -1
- package/index.d.ts +27 -0
- package/{modules → lib/modules}/autocomplete/autocomplete-adapter.service.d.ts +0 -0
- package/{modules → lib/modules}/autocomplete/autocomplete-default-search-function.d.ts +0 -0
- package/{modules → lib/modules}/autocomplete/autocomplete-input.directive.d.ts +0 -0
- package/{modules → lib/modules}/autocomplete/autocomplete-search-async-disabled.pipe.d.ts +0 -0
- package/{modules → lib/modules}/autocomplete/autocomplete.component.d.ts +0 -0
- package/{modules → lib/modules}/autocomplete/autocomplete.module.d.ts +0 -0
- package/{modules → lib/modules}/autocomplete/types/autocomplete-default-search-function-options.d.ts +0 -0
- package/{modules → lib/modules}/autocomplete/types/autocomplete-input-text-change.d.ts +0 -0
- package/{modules → lib/modules}/autocomplete/types/autocomplete-message-type.d.ts +0 -0
- package/{modules → lib/modules}/autocomplete/types/autocomplete-message.d.ts +0 -0
- package/{modules → lib/modules}/autocomplete/types/autocomplete-search-async-args.d.ts +0 -0
- package/{modules → lib/modules}/autocomplete/types/autocomplete-search-async-function.d.ts +0 -0
- package/{modules → lib/modules}/autocomplete/types/autocomplete-search-async-result-display-type.d.ts +0 -0
- package/{modules → lib/modules}/autocomplete/types/autocomplete-search-async-result.d.ts +0 -0
- package/{modules → lib/modules}/autocomplete/types/autocomplete-search-function-filter.d.ts +0 -0
- package/{modules → lib/modules}/autocomplete/types/autocomplete-search-function-response.d.ts +0 -0
- package/{modules → lib/modules}/autocomplete/types/autocomplete-search-function.d.ts +0 -0
- package/{modules → lib/modules}/autocomplete/types/autocomplete-selection-change.d.ts +0 -0
- package/{modules → lib/modules}/autocomplete/types/autocomplete-show-more-args.d.ts +0 -0
- package/{modules → lib/modules}/country-field/country-field.component.d.ts +0 -0
- package/{modules → lib/modules}/country-field/country-field.module.d.ts +0 -0
- package/{modules → lib/modules}/country-field/types/country.d.ts +0 -0
- package/{modules → lib/modules}/lookup/lookup-adapter.service.d.ts +0 -0
- package/{modules → lib/modules}/lookup/lookup-autocomplete-adapter.d.ts +0 -0
- package/{modules → lib/modules}/lookup/lookup-item-selected.pipe.d.ts +0 -0
- package/{modules → lib/modules}/lookup/lookup-show-more-async-modal.component.d.ts +0 -0
- package/{modules → lib/modules}/lookup/lookup-show-more-modal.component.d.ts +0 -0
- package/{modules → lib/modules}/lookup/lookup.component.d.ts +0 -0
- package/{modules → lib/modules}/lookup/lookup.module.d.ts +0 -0
- package/{modules → lib/modules}/lookup/types/lookup-add-click-callback-args.d.ts +0 -0
- package/{modules → lib/modules}/lookup/types/lookup-add-click-event-args.d.ts +0 -0
- package/{modules → lib/modules}/lookup/types/lookup-select-mode-type.d.ts +0 -0
- package/{modules → lib/modules}/lookup/types/lookup-select-mode.d.ts +0 -0
- package/{modules → lib/modules}/lookup/types/lookup-show-more-config.d.ts +0 -0
- package/{modules → lib/modules}/lookup/types/lookup-show-more-custom-picker-context.d.ts +0 -0
- package/{modules → lib/modules}/lookup/types/lookup-show-more-custom-picker.d.ts +0 -0
- package/{modules → lib/modules}/lookup/types/lookup-show-more-native-picker-async-context.d.ts +0 -0
- package/{modules → lib/modules}/lookup/types/lookup-show-more-native-picker-config.d.ts +0 -0
- package/{modules → lib/modules}/lookup/types/lookup-show-more-native-picker-context.d.ts +0 -0
- package/{modules → lib/modules}/search/search-adapter.service.d.ts +0 -0
- package/{modules → lib/modules}/search/search.component.d.ts +0 -0
- package/{modules → lib/modules}/search/search.module.d.ts +0 -0
- package/{modules → lib/modules}/shared/sky-lookup-resources.module.d.ts +0 -0
- package/{modules → lib/modules}/shared/sky-lookup-string-utils.d.ts +0 -0
- package/{polyfills.d.ts → lib/polyfills.d.ts} +0 -0
- package/package.json +23 -9
- package/skyux-lookup.d.ts +1 -1
- package/LICENSE +0 -21
- package/esm2015/modules/autocomplete/autocomplete-adapter.service.js +0 -61
- package/esm2015/modules/autocomplete/autocomplete-default-search-function.js +0 -39
- package/esm2015/modules/autocomplete/autocomplete-input.directive.js +0 -220
- package/esm2015/modules/autocomplete/autocomplete-search-async-disabled.pipe.js +0 -19
- package/esm2015/modules/autocomplete/autocomplete.component.js +0 -731
- package/esm2015/modules/autocomplete/autocomplete.module.js +0 -65
- package/esm2015/modules/autocomplete/types/autocomplete-default-search-function-options.js +0 -2
- package/esm2015/modules/autocomplete/types/autocomplete-input-text-change.js +0 -2
- package/esm2015/modules/autocomplete/types/autocomplete-message-type.js +0 -15
- package/esm2015/modules/autocomplete/types/autocomplete-message.js +0 -2
- package/esm2015/modules/autocomplete/types/autocomplete-search-async-args.js +0 -2
- package/esm2015/modules/autocomplete/types/autocomplete-search-async-function.js +0 -2
- package/esm2015/modules/autocomplete/types/autocomplete-search-async-result-display-type.js +0 -2
- package/esm2015/modules/autocomplete/types/autocomplete-search-async-result.js +0 -2
- package/esm2015/modules/autocomplete/types/autocomplete-search-function-filter.js +0 -2
- package/esm2015/modules/autocomplete/types/autocomplete-search-function-response.js +0 -2
- package/esm2015/modules/autocomplete/types/autocomplete-search-function.js +0 -2
- package/esm2015/modules/autocomplete/types/autocomplete-selection-change.js +0 -2
- package/esm2015/modules/autocomplete/types/autocomplete-show-more-args.js +0 -2
- package/esm2015/modules/country-field/country-field.module.js +0 -49
- package/esm2015/modules/country-field/types/country.js +0 -2
- package/esm2015/modules/lookup/lookup-adapter.service.js +0 -21
- package/esm2015/modules/lookup/lookup-autocomplete-adapter.js +0 -72
- package/esm2015/modules/lookup/lookup-item-selected.pipe.js +0 -16
- package/esm2015/modules/lookup/lookup-show-more-async-modal.component.js +0 -184
- package/esm2015/modules/lookup/lookup-show-more-modal.component.js +0 -256
- package/esm2015/modules/lookup/lookup.component.js +0 -602
- package/esm2015/modules/lookup/lookup.module.js +0 -94
- package/esm2015/modules/lookup/types/lookup-add-click-callback-args.js +0 -2
- package/esm2015/modules/lookup/types/lookup-add-click-event-args.js +0 -2
- package/esm2015/modules/lookup/types/lookup-select-mode-type.js +0 -2
- package/esm2015/modules/lookup/types/lookup-select-mode.js +0 -16
- package/esm2015/modules/lookup/types/lookup-show-more-config.js +0 -2
- package/esm2015/modules/lookup/types/lookup-show-more-custom-picker-context.js +0 -7
- package/esm2015/modules/lookup/types/lookup-show-more-custom-picker.js +0 -2
- package/esm2015/modules/lookup/types/lookup-show-more-native-picker-async-context.js +0 -7
- package/esm2015/modules/lookup/types/lookup-show-more-native-picker-config.js +0 -2
- package/esm2015/modules/lookup/types/lookup-show-more-native-picker-context.js +0 -7
- package/esm2015/modules/search/search-adapter.service.js +0 -45
- package/esm2015/modules/search/search.component.js +0 -260
- package/esm2015/modules/search/search.module.js +0 -46
- package/esm2015/modules/shared/sky-lookup-resources.module.js +0 -72
- package/esm2015/modules/shared/sky-lookup-string-utils.js +0 -8
- package/esm2015/polyfills.js +0 -30
- package/esm2015/public-api.js +0 -32
- package/public-api.d.ts +0 -27
|
@@ -0,0 +1,608 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, EventEmitter, Input, Optional, Output, Self, TemplateRef, ViewChild, ViewEncapsulation, } from '@angular/core';
|
|
2
|
+
import { NgControl } from '@angular/forms';
|
|
3
|
+
import { fromEvent as observableFromEvent, Subject } from 'rxjs';
|
|
4
|
+
import { take, takeUntil } from 'rxjs/operators';
|
|
5
|
+
import { SkyAppWindowRef } from '@skyux/core';
|
|
6
|
+
import { SkyInputBoxHostService } from '@skyux/forms';
|
|
7
|
+
import { SkyLibResourcesService } from '@skyux/i18n';
|
|
8
|
+
import { SkyTokensMessageType, } from '@skyux/indicators';
|
|
9
|
+
import { SkyModalService } from '@skyux/modals';
|
|
10
|
+
import { SkyThemeService } from '@skyux/theme';
|
|
11
|
+
import { SkyAutocompleteMessageType } from '../autocomplete/types/autocomplete-message-type';
|
|
12
|
+
import { SkyAutocompleteInputDirective } from '../autocomplete/autocomplete-input.directive';
|
|
13
|
+
import { SkyLookupAutocompleteAdapter } from './lookup-autocomplete-adapter';
|
|
14
|
+
import { SkyLookupAdapterService } from './lookup-adapter.service';
|
|
15
|
+
import { SkyLookupShowMoreModalComponent } from './lookup-show-more-modal.component';
|
|
16
|
+
import { SkyLookupShowMoreNativePickerContext } from './types/lookup-show-more-native-picker-context';
|
|
17
|
+
import { SkyLookupShowMoreAsyncModalComponent } from './lookup-show-more-async-modal.component';
|
|
18
|
+
import { SkyLookupShowMoreNativePickerAsyncContext } from './types/lookup-show-more-native-picker-async-context';
|
|
19
|
+
import * as i0 from "@angular/core";
|
|
20
|
+
import * as i1 from "@skyux/core";
|
|
21
|
+
import * as i2 from "@angular/forms";
|
|
22
|
+
import * as i3 from "./lookup-adapter.service";
|
|
23
|
+
import * as i4 from "@skyux/modals";
|
|
24
|
+
import * as i5 from "@skyux/i18n";
|
|
25
|
+
import * as i6 from "@skyux/forms";
|
|
26
|
+
import * as i7 from "@skyux/theme";
|
|
27
|
+
import * as i8 from "../autocomplete/autocomplete.component";
|
|
28
|
+
import * as i9 from "@skyux/indicators";
|
|
29
|
+
import * as i10 from "@angular/common";
|
|
30
|
+
import * as i11 from "../autocomplete/autocomplete-input.directive";
|
|
31
|
+
export class SkyLookupComponent extends SkyLookupAutocompleteAdapter {
|
|
32
|
+
constructor(changeDetector, elementRef, windowRef, ngControl, adapter, modalService, resourcesService, inputBoxHostSvc, themeSvc) {
|
|
33
|
+
super();
|
|
34
|
+
this.changeDetector = changeDetector;
|
|
35
|
+
this.elementRef = elementRef;
|
|
36
|
+
this.windowRef = windowRef;
|
|
37
|
+
this.adapter = adapter;
|
|
38
|
+
this.modalService = modalService;
|
|
39
|
+
this.resourcesService = resourcesService;
|
|
40
|
+
this.inputBoxHostSvc = inputBoxHostSvc;
|
|
41
|
+
this.themeSvc = themeSvc;
|
|
42
|
+
/**
|
|
43
|
+
* Indicates whether to disable the lookup field.
|
|
44
|
+
*/
|
|
45
|
+
this.disabled = false;
|
|
46
|
+
/**
|
|
47
|
+
* Indicates whether to enable users to open a picker where they can view all options.
|
|
48
|
+
*/
|
|
49
|
+
this.enableShowMore = false;
|
|
50
|
+
/**
|
|
51
|
+
* Indicates whether to display a button that lets users add options to the list.
|
|
52
|
+
*/
|
|
53
|
+
this.showAddButton = false;
|
|
54
|
+
/**
|
|
55
|
+
* Fires when users select the button to add options to the list.
|
|
56
|
+
*/
|
|
57
|
+
this.addClick = new EventEmitter();
|
|
58
|
+
this.autocompleteController = new Subject();
|
|
59
|
+
this.isInputFocused = false;
|
|
60
|
+
this.tokensController = new Subject();
|
|
61
|
+
this.ngUnsubscribe = new Subject();
|
|
62
|
+
this.idle = new Subject();
|
|
63
|
+
this.markForTokenFocusOnKeyUp = false;
|
|
64
|
+
// Angular automatically constructs these methods.
|
|
65
|
+
/* istanbul ignore next */
|
|
66
|
+
this.onChange = (value) => { };
|
|
67
|
+
/* istanbul ignore next */
|
|
68
|
+
this.onTouched = () => { };
|
|
69
|
+
ngControl.valueAccessor = this;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Specifies a data source for the lookup component to search when users
|
|
73
|
+
* enter text. You can specify static data such as an array of objects, or
|
|
74
|
+
* you can pull data from a database.
|
|
75
|
+
* @default []
|
|
76
|
+
*/
|
|
77
|
+
set data(value) {
|
|
78
|
+
this._data = value;
|
|
79
|
+
if (this.openNativePicker && this.searchAsync.observers.length === 0) {
|
|
80
|
+
this.openNativePicker.componentInstance.updateItemData(value);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
get data() {
|
|
84
|
+
return this._data;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Specifies whether users can select one option or multiple options.
|
|
88
|
+
* @default "mulitple"
|
|
89
|
+
*/
|
|
90
|
+
set selectMode(value) {
|
|
91
|
+
let multipleToSingle = value === 'single' && this.selectMode === 'multiple';
|
|
92
|
+
this._selectMode = value;
|
|
93
|
+
this.updateForSelectMode();
|
|
94
|
+
if (multipleToSingle) {
|
|
95
|
+
if (this.value && this.value.length > 1) {
|
|
96
|
+
// The `setTimeout` is needed to avoid a `ExpressionChangedAfterItHasBeenCheckedError` error in template forms.
|
|
97
|
+
setTimeout(() => {
|
|
98
|
+
this.writeValue([this.value[0]]);
|
|
99
|
+
this.changeDetector.detectChanges();
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
get selectMode() {
|
|
105
|
+
return this._selectMode || 'multiple';
|
|
106
|
+
}
|
|
107
|
+
get tokens() {
|
|
108
|
+
return this._tokens;
|
|
109
|
+
}
|
|
110
|
+
set tokens(value) {
|
|
111
|
+
// Collapse the tokens into a single token if the user has selected many options.
|
|
112
|
+
if (this.enableShowMore && this.value.length > 5) {
|
|
113
|
+
this.resourcesService
|
|
114
|
+
.getString('skyux_lookup_tokens_summary', this.value.length.toString())
|
|
115
|
+
.pipe(take(1))
|
|
116
|
+
.subscribe((label) => {
|
|
117
|
+
this._tokens = [
|
|
118
|
+
{
|
|
119
|
+
value: { [this.descriptorProperty]: label },
|
|
120
|
+
},
|
|
121
|
+
];
|
|
122
|
+
this.changeDetector.markForCheck();
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
this._tokens = value;
|
|
127
|
+
this.changeDetector.markForCheck();
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
get value() {
|
|
131
|
+
return this._value ? this._value : [];
|
|
132
|
+
}
|
|
133
|
+
set value(newValue) {
|
|
134
|
+
this._value = newValue;
|
|
135
|
+
if (!this.openNativePicker) {
|
|
136
|
+
this.tokens = this.parseTokens(newValue);
|
|
137
|
+
}
|
|
138
|
+
this.onChange(this._value);
|
|
139
|
+
this.onTouched();
|
|
140
|
+
}
|
|
141
|
+
set autocompleteInputDirective(value) {
|
|
142
|
+
this._autocompleteInputDirective = value;
|
|
143
|
+
this.updateForSelectMode();
|
|
144
|
+
}
|
|
145
|
+
get autocompleteInputDirective() {
|
|
146
|
+
return this._autocompleteInputDirective;
|
|
147
|
+
}
|
|
148
|
+
ngOnInit() {
|
|
149
|
+
if (this.inputBoxHostSvc) {
|
|
150
|
+
this.inputBoxHostSvc.populate({
|
|
151
|
+
inputTemplate: this.inputTemplateRef,
|
|
152
|
+
buttonsTemplate: this.enableShowMore
|
|
153
|
+
? this.showMoreButtonTemplateRef
|
|
154
|
+
: undefined,
|
|
155
|
+
iconsInsetTemplate: this.enableShowMore
|
|
156
|
+
? undefined
|
|
157
|
+
: this.searchIconTemplateRef,
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
/* istanbul ignore else */
|
|
161
|
+
if (this.themeSvc) {
|
|
162
|
+
// This is required for the autocomplete directive to be set after elements
|
|
163
|
+
// are rearranged when switching themes.
|
|
164
|
+
this.themeSvc.settingsChange
|
|
165
|
+
.pipe(takeUntil(this.ngUnsubscribe))
|
|
166
|
+
.subscribe(() => {
|
|
167
|
+
this.changeDetector.markForCheck();
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
ngAfterViewInit() {
|
|
172
|
+
if (!this.disabled) {
|
|
173
|
+
this.addEventListeners();
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
ngOnDestroy() {
|
|
177
|
+
this.removeEventListeners();
|
|
178
|
+
this.ngUnsubscribe.next();
|
|
179
|
+
this.ngUnsubscribe.complete();
|
|
180
|
+
this.tokensController.complete();
|
|
181
|
+
}
|
|
182
|
+
addButtonClicked() {
|
|
183
|
+
this.addClick.emit({
|
|
184
|
+
itemAdded: (args) => this.onAddButtonComplete(args),
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
onAutocompleteSelectionChange(change) {
|
|
188
|
+
/* istanbul ignore else */
|
|
189
|
+
if (change.selectedItem) {
|
|
190
|
+
this.addToSelected(change.selectedItem);
|
|
191
|
+
}
|
|
192
|
+
else if (this.selectMode === 'single') {
|
|
193
|
+
this.writeValue([]);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
onAutocompleteBlur() {
|
|
197
|
+
this.onTouched();
|
|
198
|
+
}
|
|
199
|
+
onTokensChange(change) {
|
|
200
|
+
if (!change) {
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
if (this.tokens !== change) {
|
|
204
|
+
if (change.length === 0) {
|
|
205
|
+
this.focusInput();
|
|
206
|
+
}
|
|
207
|
+
// NOTE: We do this here instead of just using the `value` setter because we need to use the
|
|
208
|
+
// set of tokens returned here for the purposes of setting focus (see `onTokensKeyUp`).
|
|
209
|
+
this._value = change.map((token) => {
|
|
210
|
+
return token.value;
|
|
211
|
+
});
|
|
212
|
+
this.tokens = change;
|
|
213
|
+
this.sendAutocompleteMessage(SkyAutocompleteMessageType.RepositionDropdown);
|
|
214
|
+
this.onChange(this._value);
|
|
215
|
+
this.onTouched();
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
onTokensFocusIndexOverRange() {
|
|
219
|
+
this.windowRef.nativeWindow.setTimeout(() => {
|
|
220
|
+
this.focusInput();
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
onTokensKeyUp(event) {
|
|
224
|
+
/* istanbul ignore else */
|
|
225
|
+
if (this.selectMode !== 'single') {
|
|
226
|
+
/* tslint:disable-next-line:switch-default */
|
|
227
|
+
switch (event.key) {
|
|
228
|
+
case 'Backspace':
|
|
229
|
+
this.sendTokensMessage(SkyTokensMessageType.RemoveActiveToken);
|
|
230
|
+
this.sendTokensMessage(SkyTokensMessageType.FocusPreviousToken);
|
|
231
|
+
event.preventDefault();
|
|
232
|
+
break;
|
|
233
|
+
case 'Del':
|
|
234
|
+
case 'Delete':
|
|
235
|
+
this.sendTokensMessage(SkyTokensMessageType.RemoveActiveToken);
|
|
236
|
+
this.windowRef.nativeWindow.setTimeout(() => {
|
|
237
|
+
this.sendTokensMessage(SkyTokensMessageType.FocusActiveToken);
|
|
238
|
+
});
|
|
239
|
+
event.preventDefault();
|
|
240
|
+
break;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
writeValue(value) {
|
|
245
|
+
this.value = value ? value : [];
|
|
246
|
+
this.updateForSelectMode();
|
|
247
|
+
}
|
|
248
|
+
registerOnChange(fn) {
|
|
249
|
+
this.onChange = fn;
|
|
250
|
+
}
|
|
251
|
+
registerOnTouched(fn) {
|
|
252
|
+
this.onTouched = fn;
|
|
253
|
+
}
|
|
254
|
+
// Allows Angular to disable the input.
|
|
255
|
+
setDisabledState(disabled) {
|
|
256
|
+
this.removeEventListeners();
|
|
257
|
+
if (!disabled) {
|
|
258
|
+
this.addEventListeners();
|
|
259
|
+
}
|
|
260
|
+
this.disabled = disabled;
|
|
261
|
+
this.changeDetector.markForCheck();
|
|
262
|
+
}
|
|
263
|
+
clearSearchText() {
|
|
264
|
+
this.autocompleteInputDirective.value = undefined;
|
|
265
|
+
this.autocompleteInputDirective.inputTextValue = undefined;
|
|
266
|
+
}
|
|
267
|
+
// Handles when to focus on the tokens.
|
|
268
|
+
// Check for empty search text on keydown, before the escape key is fully pressed.
|
|
269
|
+
// (Otherwise, a single character being escaped would register as empty on keyup.)
|
|
270
|
+
// If empty on keydown, set a flag so that the appropriate action can be taken on keyup.
|
|
271
|
+
inputKeydown(event, value) {
|
|
272
|
+
/* Sanity check as this should only be called when in multiple select mode */
|
|
273
|
+
/* istanbul ignore else */
|
|
274
|
+
if (this.selectMode !== 'single') {
|
|
275
|
+
switch (event.key) {
|
|
276
|
+
case 'Enter':
|
|
277
|
+
event.preventDefault();
|
|
278
|
+
break;
|
|
279
|
+
case 'ArrowLeft':
|
|
280
|
+
case 'Backspace':
|
|
281
|
+
case 'Left':
|
|
282
|
+
if (value) {
|
|
283
|
+
this.markForTokenFocusOnKeyUp = false;
|
|
284
|
+
}
|
|
285
|
+
else {
|
|
286
|
+
this.markForTokenFocusOnKeyUp = true;
|
|
287
|
+
}
|
|
288
|
+
break;
|
|
289
|
+
default:
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
inputKeyup(event) {
|
|
294
|
+
/* Sanity check as this should only be called when in multiple select mode */
|
|
295
|
+
/* istanbul ignore else */
|
|
296
|
+
if (this.selectMode !== 'single') {
|
|
297
|
+
switch (event.key) {
|
|
298
|
+
case 'Esc':
|
|
299
|
+
case 'Escape':
|
|
300
|
+
this.clearSearchText();
|
|
301
|
+
event.preventDefault();
|
|
302
|
+
break;
|
|
303
|
+
case 'ArrowLeft':
|
|
304
|
+
case 'Backspace':
|
|
305
|
+
case 'Left':
|
|
306
|
+
/* istanbul ignore else */
|
|
307
|
+
if (this.markForTokenFocusOnKeyUp) {
|
|
308
|
+
this.sendTokensMessage(SkyTokensMessageType.FocusLastToken);
|
|
309
|
+
event.preventDefault();
|
|
310
|
+
}
|
|
311
|
+
break;
|
|
312
|
+
default:
|
|
313
|
+
}
|
|
314
|
+
event.stopPropagation();
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
onSearchButtonClick() {
|
|
318
|
+
/*istanbul ignore next*/
|
|
319
|
+
if (this.disabled) {
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
this.sendAutocompleteMessage(SkyAutocompleteMessageType.CloseDropdown);
|
|
323
|
+
let isValueInTextBox = false;
|
|
324
|
+
if (this.selectMode === 'single') {
|
|
325
|
+
isValueInTextBox =
|
|
326
|
+
this.autocompleteInputDirective.inputTextValue ===
|
|
327
|
+
this.autocompleteInputDirective.value[this.descriptorProperty];
|
|
328
|
+
}
|
|
329
|
+
this.openPicker(isValueInTextBox ? '' : this.autocompleteInputDirective.inputTextValue);
|
|
330
|
+
this.autocompleteInputDirective.restoreInputTextValueToPreviousState();
|
|
331
|
+
}
|
|
332
|
+
onShowMoreClick(event) {
|
|
333
|
+
/* Sanity check */
|
|
334
|
+
/* istanbul ignore else*/
|
|
335
|
+
if (event) {
|
|
336
|
+
this.openPicker(event.inputValue);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
createNativePickerInstance(initialSearch) {
|
|
340
|
+
var _a;
|
|
341
|
+
let initialValue = this.value;
|
|
342
|
+
const modalConfig = ((_a = this.showMoreConfig) === null || _a === void 0 ? void 0 : _a.nativePickerConfig) || {};
|
|
343
|
+
if (!modalConfig.itemTemplate) {
|
|
344
|
+
modalConfig.itemTemplate = this.searchResultTemplate;
|
|
345
|
+
}
|
|
346
|
+
let contextProviderType;
|
|
347
|
+
let contextProviderValue;
|
|
348
|
+
let modalComponentType;
|
|
349
|
+
if (this.searchAsync.observers.length > 0) {
|
|
350
|
+
contextProviderType = SkyLookupShowMoreNativePickerAsyncContext;
|
|
351
|
+
modalComponentType = SkyLookupShowMoreAsyncModalComponent;
|
|
352
|
+
contextProviderValue = new SkyLookupShowMoreNativePickerAsyncContext();
|
|
353
|
+
contextProviderValue.idProperty = this.idProperty;
|
|
354
|
+
contextProviderValue.searchAsync = (args) => {
|
|
355
|
+
this.searchAsync.emit(args);
|
|
356
|
+
return args.result;
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
else {
|
|
360
|
+
contextProviderType = SkyLookupShowMoreNativePickerContext;
|
|
361
|
+
modalComponentType = SkyLookupShowMoreModalComponent;
|
|
362
|
+
contextProviderValue = new SkyLookupShowMoreNativePickerContext();
|
|
363
|
+
contextProviderValue.items = this.data;
|
|
364
|
+
contextProviderValue.search = this.search;
|
|
365
|
+
}
|
|
366
|
+
contextProviderValue.descriptorProperty = this.descriptorProperty;
|
|
367
|
+
contextProviderValue.initialSearch = initialSearch;
|
|
368
|
+
contextProviderValue.initialValue = initialValue;
|
|
369
|
+
contextProviderValue.selectMode = this.selectMode;
|
|
370
|
+
contextProviderValue.showAddButton = this.showAddButton;
|
|
371
|
+
contextProviderValue.userConfig = modalConfig;
|
|
372
|
+
return this.modalService.open(modalComponentType, {
|
|
373
|
+
providers: [
|
|
374
|
+
{
|
|
375
|
+
provide: contextProviderType,
|
|
376
|
+
useValue: contextProviderValue,
|
|
377
|
+
},
|
|
378
|
+
],
|
|
379
|
+
wrapperClass: this.wrapperClass,
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
openPicker(initialSearch) {
|
|
383
|
+
var _a;
|
|
384
|
+
if ((_a = this.showMoreConfig) === null || _a === void 0 ? void 0 : _a.customPicker) {
|
|
385
|
+
this.showMoreConfig.customPicker.open({
|
|
386
|
+
items: this.data,
|
|
387
|
+
initialSearch: initialSearch,
|
|
388
|
+
initialValue: this.value,
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
else {
|
|
392
|
+
let initialValue = this.value;
|
|
393
|
+
this.openNativePicker = this.createNativePickerInstance(initialSearch);
|
|
394
|
+
this.openNativePicker.componentInstance.addClick.subscribe(() => {
|
|
395
|
+
this.addButtonClicked();
|
|
396
|
+
});
|
|
397
|
+
this.openNativePicker.closed.subscribe((closeArgs) => {
|
|
398
|
+
this.openNativePicker = undefined;
|
|
399
|
+
if (closeArgs.reason === 'save') {
|
|
400
|
+
let selectedItems = [];
|
|
401
|
+
if (this.searchAsync.observers.length > 0) {
|
|
402
|
+
selectedItems = closeArgs.data.map((item) => item.itemData);
|
|
403
|
+
}
|
|
404
|
+
else {
|
|
405
|
+
this.data.forEach((item, dataIndex) => {
|
|
406
|
+
if (closeArgs.data.some((savedItem) => {
|
|
407
|
+
return savedItem.index === dataIndex;
|
|
408
|
+
})) {
|
|
409
|
+
selectedItems.push(item);
|
|
410
|
+
}
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
this.writeValue(selectedItems);
|
|
414
|
+
}
|
|
415
|
+
else {
|
|
416
|
+
this.writeValue(initialValue);
|
|
417
|
+
}
|
|
418
|
+
this.focusInput();
|
|
419
|
+
this.changeDetector.markForCheck();
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
onSearchAsync(args) {
|
|
424
|
+
this.searchAsync.emit(args);
|
|
425
|
+
}
|
|
426
|
+
addToSelected(item) {
|
|
427
|
+
let selectedItems;
|
|
428
|
+
if (this.selectMode === 'single') {
|
|
429
|
+
selectedItems = [item];
|
|
430
|
+
}
|
|
431
|
+
else {
|
|
432
|
+
selectedItems = this.value;
|
|
433
|
+
// If items have a unique identifier, don't allow the same item to be added twice.
|
|
434
|
+
if (!this.idProperty ||
|
|
435
|
+
!this.value.some((existingItem) => existingItem[this.idProperty] === item[this.idProperty])) {
|
|
436
|
+
selectedItems.push(item);
|
|
437
|
+
}
|
|
438
|
+
this.clearSearchText();
|
|
439
|
+
}
|
|
440
|
+
this.writeValue(selectedItems);
|
|
441
|
+
}
|
|
442
|
+
addEventListeners() {
|
|
443
|
+
this.idle = new Subject();
|
|
444
|
+
this.focusInputOnHostClick();
|
|
445
|
+
}
|
|
446
|
+
removeEventListeners() {
|
|
447
|
+
this.idle.next();
|
|
448
|
+
this.idle.complete();
|
|
449
|
+
}
|
|
450
|
+
focusInputOnHostClick() {
|
|
451
|
+
let hostElement = !this.inputBoxHostSvc
|
|
452
|
+
? this.elementRef.nativeElement
|
|
453
|
+
: this.lookupWrapperRef.nativeElement;
|
|
454
|
+
const documentObj = this.windowRef.nativeWindow.document;
|
|
455
|
+
// Handles focusing the input when the host is clicked.
|
|
456
|
+
// The input should NOT be focused if other elements (tokens, etc.)
|
|
457
|
+
// are currently focused or being tabbed through.
|
|
458
|
+
observableFromEvent(documentObj, 'mousedown')
|
|
459
|
+
.pipe(takeUntil(this.idle))
|
|
460
|
+
.subscribe((event) => {
|
|
461
|
+
hostElement = !this.inputBoxHostSvc
|
|
462
|
+
? this.elementRef.nativeElement
|
|
463
|
+
: this.lookupWrapperRef.nativeElement;
|
|
464
|
+
this.isInputFocused = hostElement.contains(event.target);
|
|
465
|
+
this.changeDetector.markForCheck();
|
|
466
|
+
});
|
|
467
|
+
observableFromEvent(documentObj, 'focusin')
|
|
468
|
+
.pipe(takeUntil(this.idle))
|
|
469
|
+
.subscribe((event) => {
|
|
470
|
+
hostElement = !this.inputBoxHostSvc
|
|
471
|
+
? this.elementRef.nativeElement
|
|
472
|
+
: this.lookupWrapperRef.nativeElement;
|
|
473
|
+
this.isInputFocused = hostElement.contains(event.target);
|
|
474
|
+
this.changeDetector.markForCheck();
|
|
475
|
+
});
|
|
476
|
+
observableFromEvent(hostElement, 'mouseup')
|
|
477
|
+
.pipe(takeUntil(this.idle))
|
|
478
|
+
.subscribe(() => {
|
|
479
|
+
const classList = documentObj.activeElement.classList;
|
|
480
|
+
if (!classList || !classList.contains('sky-token')) {
|
|
481
|
+
this.focusInput();
|
|
482
|
+
}
|
|
483
|
+
});
|
|
484
|
+
}
|
|
485
|
+
focusInput() {
|
|
486
|
+
this.adapter.focusInput(this.lookupWrapperRef);
|
|
487
|
+
}
|
|
488
|
+
onAddButtonComplete(args) {
|
|
489
|
+
if (args.data) {
|
|
490
|
+
this.data = args.data;
|
|
491
|
+
}
|
|
492
|
+
if (this.data.indexOf(args.item) >= 0) {
|
|
493
|
+
if (this.openNativePicker) {
|
|
494
|
+
(this.openNativePicker.componentInstance).onItemSelect(true, { value: args.item, selected: false });
|
|
495
|
+
}
|
|
496
|
+
else {
|
|
497
|
+
let newValue = this.value;
|
|
498
|
+
if (this.selectMode === 'multiple') {
|
|
499
|
+
newValue = this.value.concat(args.item);
|
|
500
|
+
}
|
|
501
|
+
else {
|
|
502
|
+
newValue = [args.item];
|
|
503
|
+
}
|
|
504
|
+
this.writeValue(newValue);
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
parseTokens(data) {
|
|
509
|
+
return data.map((item) => {
|
|
510
|
+
return {
|
|
511
|
+
value: item,
|
|
512
|
+
};
|
|
513
|
+
});
|
|
514
|
+
}
|
|
515
|
+
sendAutocompleteMessage(type) {
|
|
516
|
+
this.autocompleteController.next({ type });
|
|
517
|
+
}
|
|
518
|
+
sendTokensMessage(type) {
|
|
519
|
+
this.tokensController.next({ type });
|
|
520
|
+
}
|
|
521
|
+
updateForSelectMode() {
|
|
522
|
+
if (this.autocompleteInputDirective) {
|
|
523
|
+
if (this.selectMode === 'single') {
|
|
524
|
+
this.autocompleteInputDirective.value = this.value && this.value[0];
|
|
525
|
+
}
|
|
526
|
+
else {
|
|
527
|
+
this.clearSearchText();
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
SkyLookupComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLookupComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: i1.SkyAppWindowRef }, { token: i2.NgControl, optional: true, self: true }, { token: i3.SkyLookupAdapterService }, { token: i4.SkyModalService }, { token: i5.SkyLibResourcesService }, { token: i6.SkyInputBoxHostService, optional: true }, { token: i7.SkyThemeService, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
533
|
+
SkyLookupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyLookupComponent, selector: "sky-lookup", inputs: { ariaLabel: "ariaLabel", ariaLabelledBy: "ariaLabelledBy", autocompleteAttribute: "autocompleteAttribute", data: "data", disabled: "disabled", enableShowMore: "enableShowMore", placeholderText: "placeholderText", idProperty: "idProperty", showAddButton: "showAddButton", showMoreConfig: "showMoreConfig", selectMode: "selectMode", wrapperClass: "wrapperClass" }, outputs: { addClick: "addClick" }, providers: [SkyLookupAdapterService], viewQueries: [{ propertyName: "autocompleteInputDirective", first: true, predicate: SkyAutocompleteInputDirective, descendants: true, read: SkyAutocompleteInputDirective }, { propertyName: "showMoreButtonTemplateRef", first: true, predicate: ["showMoreButtonTemplateRef"], descendants: true, read: TemplateRef, static: true }, { propertyName: "inputTemplateRef", first: true, predicate: ["inputTemplateRef"], descendants: true, read: TemplateRef, static: true }, { propertyName: "lookupWrapperRef", first: true, predicate: ["lookupWrapper"], descendants: true, read: ElementRef }, { propertyName: "searchIconTemplateRef", first: true, predicate: ["searchIconTemplateRef"], descendants: true, read: TemplateRef, static: true }], usesInheritance: true, ngImport: i0, template: "<ng-container *ngIf=\"!inputBoxHostSvc\">\n <ng-container *ngTemplateOutlet=\"inputTemplateRef\"></ng-container>\n</ng-container>\n\n<ng-template #inputTemplateRef>\n <div\n class=\"sky-lookup\"\n [ngClass]=\"{\n 'sky-lookup-focused': isInputFocused,\n 'sky-lookup-disabled': disabled,\n 'sky-lookup-single': selectMode === 'single'\n }\"\n #lookupWrapper\n >\n <sky-autocomplete\n [ariaLabelledBy]=\"ariaLabelledBy\"\n [data]=\"data\"\n [debounceTime]=\"debounceTime\"\n [descriptorProperty]=\"descriptorProperty\"\n [enableShowMore]=\"enableShowMore\"\n [messageStream]=\"autocompleteController\"\n [propertiesToSearch]=\"propertiesToSearch\"\n [search]=\"search\"\n [searchAsyncDisabled]=\"searchAsync.observers.length === 0\"\n [searchFilters]=\"searchFilters\"\n [searchResultsLimit]=\"searchResultsLimit\"\n [searchResultTemplate]=\"searchResultTemplate\"\n [searchTextMinimumCharacters]=\"searchTextMinimumCharacters\"\n [showAddButton]=\"showAddButton\"\n [wrapperClass]=\"wrapperClass\"\n (addClick)=\"addButtonClicked()\"\n (searchAsync)=\"onSearchAsync($event)\"\n (selectionChange)=\"onAutocompleteSelectionChange($event)\"\n (showMoreClick)=\"onShowMoreClick($event)\"\n >\n <div class=\"sky-lookup-search-flex-wrapper\">\n <div\n class=\"sky-lookup-search\"\n [ngClass]=\"{\n 'sky-field-status-active': isInputFocused && !disabled\n }\"\n >\n <sky-tokens\n *ngIf=\"selectMode === 'multiple'\"\n class=\"sky-lookup-tokens\"\n [disabled]=\"disabled\"\n [displayWith]=\"descriptorProperty\"\n [focusable]=\"false\"\n [messageStream]=\"tokensController\"\n [trackWith]=\"idProperty\"\n [tokens]=\"tokens\"\n (keyup)=\"onTokensKeyUp($event)\"\n (tokensChange)=\"onTokensChange($event)\"\n (tokenSelected)=\"enableShowMore ? openPicker(undefined) : undefined\"\n (focusIndexOverRange)=\"onTokensFocusIndexOverRange()\"\n >\n <textarea\n class=\"sky-form-control sky-lookup-input\"\n rows=\"1\"\n skyAutocomplete\n wrap=\"off\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.aria-labelledby]=\"ariaLabelledBy\"\n [attr.placeholder]=\"placeholderText\"\n [autocompleteAttribute]=\"autocompleteAttribute\"\n [disabled]=\"disabled\"\n (blur)=\"onAutocompleteBlur()\"\n (keydown)=\"inputKeydown($event, $event.target.value)\"\n (keyup)=\"inputKeyup($event)\"\n ></textarea>\n </sky-tokens>\n <div\n *ngIf=\"selectMode === 'single'\"\n class=\"sky-lookup-single-control\"\n >\n <textarea\n class=\"sky-form-control sky-lookup-input\"\n rows=\"1\"\n skyAutocomplete\n wrap=\"off\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.aria-labelledby]=\"ariaLabelledBy\"\n [attr.placeholder]=\"placeholderText\"\n [autocompleteAttribute]=\"autocompleteAttribute\"\n [disabled]=\"disabled\"\n (blur)=\"onAutocompleteBlur()\"\n ></textarea>\n </div>\n </div>\n <ng-container *ngIf=\"!inputBoxHostSvc && enableShowMore\">\n <ng-container\n *ngTemplateOutlet=\"showMoreButtonTemplateRef\"\n ></ng-container>\n </ng-container>\n <ng-container *ngIf=\"!inputBoxHostSvc && !enableShowMore\">\n <ng-container\n *ngTemplateOutlet=\"searchIconTemplateRef\"\n ></ng-container>\n </ng-container>\n </div>\n </sky-autocomplete>\n </div>\n</ng-template>\n\n<ng-template #showMoreButtonTemplateRef>\n <div class=\"sky-input-group-btn\">\n <button\n class=\"sky-btn sky-btn-default\"\n [disabled]=\"disabled\"\n [ngClass]=\"{ 'sky-btn-disabled': disabled }\"\n type=\"button\"\n [attr.aria-label]=\"\n 'skyux_lookup_search_button_show_more' | skyLibResources\n \"\n (click)=\"onSearchButtonClick()\"\n >\n <sky-icon *skyThemeIf=\"'default'\" icon=\"search\"></sky-icon>\n <sky-icon\n *skyThemeIf=\"'modern'\"\n iconType=\"skyux\"\n icon=\"search\"\n ></sky-icon>\n </button>\n </div>\n</ng-template>\n\n<ng-template #searchIconTemplateRef>\n <div\n class=\"sky-input-group-icon sky-input-box-icon-inset\"\n [ngClass]=\"{ 'sky-lookup-disabled': disabled }\"\n >\n <sky-icon\n *skyThemeIf=\"'default'\"\n icon=\"search\"\n [attr.aria-label]=\"'skyux_lookup_search_icon' | skyLibResources\"\n ></sky-icon>\n <sky-icon\n *skyThemeIf=\"'modern'\"\n iconType=\"skyux\"\n icon=\"search\"\n [attr.aria-label]=\"'skyux_lookup_search_icon' | skyLibResources\"\n ></sky-icon>\n </div>\n</ng-template>\n", styles: [".sky-lookup .sky-lookup-input.sky-form-control{resize:none;border:0;box-sizing:content-box;height:1.428571429em;overflow:hidden;padding:0;background-color:transparent}.sky-lookup .sky-lookup-input.sky-form-control:focus{outline:none;box-shadow:none}.sky-lookup .sky-lookup-search-flex-wrapper{display:flex}.sky-lookup.sky-lookup-disabled .sky-lookup-search{background-color:#cdcfd2}.sky-lookup sky-tokens.sky-lookup-tokens:focus{outline:none}.sky-lookup sky-tokens.sky-lookup-tokens .sky-tokens{margin-top:-5px;margin-bottom:-5px}.sky-lookup sky-tokens.sky-lookup-tokens .sky-tokens .sky-tokens-content{padding-top:5px;padding-bottom:5px;padding-left:10px;flex-basis:100px}.sky-lookup .sky-lookup-single-control{display:inline-flex;padding-left:7px;width:100%}.sky-lookup-search{cursor:text;background-color:#fff;line-height:1.428571429em;padding:6px 12px 6px 3px;flex-grow:1}.sky-lookup-search:not(.sky-field-status-active){border-top:1px solid #cdcfd2;border-bottom:1px solid #cdcfd2;border-left:1px solid #cdcfd2;border-right:1px solid #cdcfd2}.sky-lookup-disabled .sky-lookup-search{cursor:default}.sky-lookup-focused .sky-tokens-content{flex-basis:100px}.sky-lookup-single sky-tokens.sky-lookup-tokens sky-token{display:none}sky-lookup.ng-invalid.ng-touched .sky-lookup-search{box-shadow:0 0 8px #ef404499;border:1px solid #ef4044;outline:none}sky-input-box .sky-lookup{width:100%}sky-input-box .sky-lookup .sky-lookup-search{border:none;padding-bottom:5px;width:100%}:host-context(.sky-theme-modern) sky-tokens.sky-lookup-tokens .sky-tokens{margin-top:-6px}:host-context(.sky-theme-modern) sky-input-box .sky-lookup sky-tokens.sky-lookup-tokens .sky-tokens{margin-top:0;margin-bottom:0}:host-context(.sky-theme-modern) sky-input-box .sky-lookup sky-tokens.sky-lookup-tokens .sky-tokens sky-token{padding-bottom:0;padding-top:0}:host-context(.sky-theme-modern) sky-input-box .sky-lookup sky-tokens.sky-lookup-tokens .sky-tokens .sky-tokens-content{padding-bottom:0;padding-top:0}:host-context(.sky-theme-modern) sky-input-box .sky-lookup sky-tokens.sky-lookup-tokens .sky-tokens .sky-tokens-content:first-child{padding-left:0}:host-context(.sky-theme-modern) sky-input-box .sky-lookup.sky-lookup-single sky-tokens.sky-lookup-tokens .sky-tokens-content{padding-left:0}:host-context(.sky-theme-modern) sky-input-box .sky-lookup .sky-lookup-search{background-color:transparent;padding:0 0 0 15px}:host-context(.sky-theme-modern) sky-input-box .sky-lookup .sky-lookup-search.sky-field-status-active{box-shadow:none}:host-context(.sky-theme-modern) sky-input-box .sky-lookup textarea.sky-lookup-input.sky-form-control{padding-left:0;resize:none}:host-context(.sky-theme-modern) sky-input-box .sky-lookup .sky-lookup-single-control{padding-left:0}.sky-theme-modern sky-tokens.sky-lookup-tokens .sky-tokens{margin-top:-6px}.sky-theme-modern sky-input-box .sky-lookup sky-tokens.sky-lookup-tokens .sky-tokens{margin-top:0;margin-bottom:0}.sky-theme-modern sky-input-box .sky-lookup sky-tokens.sky-lookup-tokens .sky-tokens sky-token{padding-bottom:0;padding-top:0}.sky-theme-modern sky-input-box .sky-lookup sky-tokens.sky-lookup-tokens .sky-tokens .sky-tokens-content{padding-bottom:0;padding-top:0}.sky-theme-modern sky-input-box .sky-lookup sky-tokens.sky-lookup-tokens .sky-tokens .sky-tokens-content:first-child{padding-left:0}.sky-theme-modern sky-input-box .sky-lookup.sky-lookup-single sky-tokens.sky-lookup-tokens .sky-tokens-content{padding-left:0}.sky-theme-modern sky-input-box .sky-lookup .sky-lookup-search{background-color:transparent;padding:0 0 0 15px}.sky-theme-modern sky-input-box .sky-lookup .sky-lookup-search.sky-field-status-active{box-shadow:none}.sky-theme-modern sky-input-box .sky-lookup textarea.sky-lookup-input.sky-form-control{padding-left:0;resize:none}.sky-theme-modern sky-input-box .sky-lookup .sky-lookup-single-control{padding-left:0}\n"], components: [{ type: i8.SkyAutocompleteComponent, selector: "sky-autocomplete", inputs: ["ariaLabelledBy", "data", "debounceTime", "descriptorProperty", "enableShowMore", "messageStream", "wrapperClass", "propertiesToSearch", "search", "searchResultTemplate", "searchTextMinimumCharacters", "searchFilters", "searchResultsLimit", "showAddButton", "noResultsFoundText", "searchAsyncDisabled"], outputs: ["addClick", "showMoreClick", "selectionChange", "searchAsync"] }, { type: i9.λ13, selector: "sky-tokens", inputs: ["disabled", "dismissible", "displayWith", "trackWith", "focusable", "tokens", "messageStream"], outputs: ["focusIndexOverRange", "focusIndexUnderRange", "tokenSelected", "tokensChange"] }, { type: i9.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }], directives: [{ type: i10.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i10.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i10.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i11.SkyAutocompleteInputDirective, selector: "input[skyAutocomplete], textarea[skyAutocomplete]", inputs: ["autocompleteAttribute", "disabled"] }, { type: i7.λ3, selector: "[skyThemeIf]", inputs: ["skyThemeIf"] }], pipes: { "skyLibResources": i5.SkyLibResourcesPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
534
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLookupComponent, decorators: [{
|
|
535
|
+
type: Component,
|
|
536
|
+
args: [{
|
|
537
|
+
selector: 'sky-lookup',
|
|
538
|
+
templateUrl: './lookup.component.html',
|
|
539
|
+
styleUrls: ['./lookup.component.scss'],
|
|
540
|
+
providers: [SkyLookupAdapterService],
|
|
541
|
+
encapsulation: ViewEncapsulation.None,
|
|
542
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
543
|
+
}]
|
|
544
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: i1.SkyAppWindowRef }, { type: i2.NgControl, decorators: [{
|
|
545
|
+
type: Self
|
|
546
|
+
}, {
|
|
547
|
+
type: Optional
|
|
548
|
+
}] }, { type: i3.SkyLookupAdapterService }, { type: i4.SkyModalService }, { type: i5.SkyLibResourcesService }, { type: i6.SkyInputBoxHostService, decorators: [{
|
|
549
|
+
type: Optional
|
|
550
|
+
}] }, { type: i7.SkyThemeService, decorators: [{
|
|
551
|
+
type: Optional
|
|
552
|
+
}] }]; }, propDecorators: { ariaLabel: [{
|
|
553
|
+
type: Input
|
|
554
|
+
}], ariaLabelledBy: [{
|
|
555
|
+
type: Input
|
|
556
|
+
}], autocompleteAttribute: [{
|
|
557
|
+
type: Input
|
|
558
|
+
}], data: [{
|
|
559
|
+
type: Input
|
|
560
|
+
}], disabled: [{
|
|
561
|
+
type: Input
|
|
562
|
+
}], enableShowMore: [{
|
|
563
|
+
type: Input
|
|
564
|
+
}], placeholderText: [{
|
|
565
|
+
type: Input
|
|
566
|
+
}], idProperty: [{
|
|
567
|
+
type: Input
|
|
568
|
+
}], showAddButton: [{
|
|
569
|
+
type: Input
|
|
570
|
+
}], showMoreConfig: [{
|
|
571
|
+
type: Input
|
|
572
|
+
}], selectMode: [{
|
|
573
|
+
type: Input
|
|
574
|
+
}], wrapperClass: [{
|
|
575
|
+
type: Input
|
|
576
|
+
}], addClick: [{
|
|
577
|
+
type: Output
|
|
578
|
+
}], autocompleteInputDirective: [{
|
|
579
|
+
type: ViewChild,
|
|
580
|
+
args: [SkyAutocompleteInputDirective, {
|
|
581
|
+
read: SkyAutocompleteInputDirective,
|
|
582
|
+
static: false,
|
|
583
|
+
}]
|
|
584
|
+
}], showMoreButtonTemplateRef: [{
|
|
585
|
+
type: ViewChild,
|
|
586
|
+
args: ['showMoreButtonTemplateRef', {
|
|
587
|
+
read: TemplateRef,
|
|
588
|
+
static: true,
|
|
589
|
+
}]
|
|
590
|
+
}], inputTemplateRef: [{
|
|
591
|
+
type: ViewChild,
|
|
592
|
+
args: ['inputTemplateRef', {
|
|
593
|
+
read: TemplateRef,
|
|
594
|
+
static: true,
|
|
595
|
+
}]
|
|
596
|
+
}], lookupWrapperRef: [{
|
|
597
|
+
type: ViewChild,
|
|
598
|
+
args: ['lookupWrapper', {
|
|
599
|
+
read: ElementRef,
|
|
600
|
+
}]
|
|
601
|
+
}], searchIconTemplateRef: [{
|
|
602
|
+
type: ViewChild,
|
|
603
|
+
args: ['searchIconTemplateRef', {
|
|
604
|
+
read: TemplateRef,
|
|
605
|
+
static: true,
|
|
606
|
+
}]
|
|
607
|
+
}] } });
|
|
608
|
+
//# sourceMappingURL=lookup.component.js.map
|