@skyux/lookup 5.7.2 → 6.0.0-beta.2
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/documentation.json +2 -2
- package/esm2020/index.mjs +32 -0
- package/esm2020/lib/modules/autocomplete/autocomplete-adapter.service.mjs +61 -0
- package/esm2020/lib/modules/autocomplete/autocomplete-default-search-function.mjs +39 -0
- package/esm2020/lib/modules/autocomplete/autocomplete-input.directive.mjs +221 -0
- package/esm2020/lib/modules/autocomplete/autocomplete-search-async-disabled.pipe.mjs +19 -0
- package/esm2020/lib/modules/autocomplete/autocomplete.component.mjs +739 -0
- package/esm2020/lib/modules/autocomplete/autocomplete.module.mjs +65 -0
- package/esm2020/lib/modules/autocomplete/types/autocomplete-default-search-function-options.mjs +2 -0
- package/esm2020/lib/modules/autocomplete/types/autocomplete-input-text-change.mjs +2 -0
- package/esm2020/lib/modules/autocomplete/types/autocomplete-message-type.mjs +15 -0
- package/esm2020/lib/modules/autocomplete/types/autocomplete-message.mjs +2 -0
- package/esm2020/lib/modules/autocomplete/types/autocomplete-search-async-args.mjs +2 -0
- package/esm2020/lib/modules/autocomplete/types/autocomplete-search-async-function.mjs +2 -0
- package/esm2020/lib/modules/autocomplete/types/autocomplete-search-async-result-display-type.mjs +2 -0
- package/esm2020/lib/modules/autocomplete/types/autocomplete-search-async-result.mjs +2 -0
- package/esm2020/lib/modules/autocomplete/types/autocomplete-search-function-filter.mjs +2 -0
- package/esm2020/lib/modules/autocomplete/types/autocomplete-search-function-response.mjs +2 -0
- package/esm2020/lib/modules/autocomplete/types/autocomplete-search-function.mjs +2 -0
- package/esm2020/lib/modules/autocomplete/types/autocomplete-selection-change.mjs +2 -0
- package/esm2020/lib/modules/autocomplete/types/autocomplete-show-more-args.mjs +2 -0
- package/esm2020/lib/modules/country-field/country-field.component.mjs +397 -0
- package/esm2020/lib/modules/country-field/country-field.module.mjs +49 -0
- package/esm2020/lib/modules/country-field/types/country.mjs +2 -0
- package/esm2020/lib/modules/lookup/lookup-adapter.service.mjs +21 -0
- package/esm2020/lib/modules/lookup/lookup-autocomplete-adapter.mjs +78 -0
- package/esm2020/lib/modules/lookup/lookup-item-selected.pipe.mjs +16 -0
- package/esm2020/lib/modules/lookup/lookup-show-more-async-modal.component.mjs +181 -0
- package/esm2020/lib/modules/lookup/lookup-show-more-modal.component.mjs +249 -0
- package/esm2020/lib/modules/lookup/lookup.component.mjs +601 -0
- package/esm2020/lib/modules/lookup/lookup.module.mjs +90 -0
- package/esm2020/lib/modules/lookup/types/lookup-add-click-callback-args.mjs +2 -0
- package/esm2020/lib/modules/lookup/types/lookup-add-click-event-args.mjs +2 -0
- package/esm2020/lib/modules/lookup/types/lookup-select-mode-type.mjs +2 -0
- package/esm2020/lib/modules/lookup/types/lookup-select-mode.mjs +16 -0
- package/esm2020/lib/modules/lookup/types/lookup-show-more-config.mjs +2 -0
- package/esm2020/lib/modules/lookup/types/lookup-show-more-custom-picker-context.mjs +7 -0
- package/esm2020/lib/modules/lookup/types/lookup-show-more-custom-picker.mjs +2 -0
- package/esm2020/lib/modules/lookup/types/lookup-show-more-native-picker-async-context.mjs +7 -0
- package/esm2020/lib/modules/lookup/types/lookup-show-more-native-picker-config.mjs +2 -0
- package/esm2020/lib/modules/lookup/types/lookup-show-more-native-picker-context.mjs +7 -0
- package/esm2020/lib/modules/search/search-adapter.service.mjs +45 -0
- package/esm2020/lib/modules/search/search.component.mjs +253 -0
- package/esm2020/lib/modules/search/search.module.mjs +46 -0
- package/esm2020/lib/modules/shared/sky-lookup-resources.module.mjs +72 -0
- package/esm2020/lib/modules/shared/sky-lookup-string-utils.mjs +8 -0
- package/esm2020/skyux-lookup.mjs +5 -0
- package/esm2020/testing/country-field/country-field-fixture.mjs +114 -0
- package/esm2020/testing/country-field/country-field-testing.module.mjs +15 -0
- package/esm2020/testing/public-api.mjs +5 -0
- package/esm2020/testing/search/search-fixture.mjs +57 -0
- package/esm2020/testing/search/search-testing.module.mjs +15 -0
- package/esm2020/testing/skyux-lookup-testing.mjs +5 -0
- package/fesm2015/{skyux-lookup-testing.js → skyux-lookup-testing.mjs} +9 -9
- package/fesm2015/skyux-lookup-testing.mjs.map +1 -0
- package/fesm2015/skyux-lookup.mjs +3153 -0
- package/fesm2015/skyux-lookup.mjs.map +1 -0
- package/fesm2020/skyux-lookup-testing.mjs +203 -0
- package/fesm2020/skyux-lookup-testing.mjs.map +1 -0
- package/fesm2020/skyux-lookup.mjs +3144 -0
- package/fesm2020/skyux-lookup.mjs.map +1 -0
- package/package.json +45 -21
- package/testing/package.json +5 -5
- package/bundles/skyux-lookup-testing.umd.js +0 -620
- package/bundles/skyux-lookup.umd.js +0 -3793
- package/esm2015/index.js +0 -32
- package/esm2015/index.js.map +0 -1
- package/esm2015/lib/modules/autocomplete/autocomplete-adapter.service.js +0 -61
- package/esm2015/lib/modules/autocomplete/autocomplete-adapter.service.js.map +0 -1
- package/esm2015/lib/modules/autocomplete/autocomplete-default-search-function.js +0 -39
- package/esm2015/lib/modules/autocomplete/autocomplete-default-search-function.js.map +0 -1
- package/esm2015/lib/modules/autocomplete/autocomplete-input.directive.js +0 -221
- package/esm2015/lib/modules/autocomplete/autocomplete-input.directive.js.map +0 -1
- package/esm2015/lib/modules/autocomplete/autocomplete-search-async-disabled.pipe.js +0 -19
- package/esm2015/lib/modules/autocomplete/autocomplete-search-async-disabled.pipe.js.map +0 -1
- package/esm2015/lib/modules/autocomplete/autocomplete.component.js +0 -745
- package/esm2015/lib/modules/autocomplete/autocomplete.component.js.map +0 -1
- package/esm2015/lib/modules/autocomplete/autocomplete.module.js +0 -65
- package/esm2015/lib/modules/autocomplete/autocomplete.module.js.map +0 -1
- package/esm2015/lib/modules/autocomplete/types/autocomplete-default-search-function-options.js +0 -2
- package/esm2015/lib/modules/autocomplete/types/autocomplete-default-search-function-options.js.map +0 -1
- package/esm2015/lib/modules/autocomplete/types/autocomplete-input-text-change.js +0 -2
- package/esm2015/lib/modules/autocomplete/types/autocomplete-input-text-change.js.map +0 -1
- package/esm2015/lib/modules/autocomplete/types/autocomplete-message-type.js +0 -15
- package/esm2015/lib/modules/autocomplete/types/autocomplete-message-type.js.map +0 -1
- package/esm2015/lib/modules/autocomplete/types/autocomplete-message.js +0 -2
- package/esm2015/lib/modules/autocomplete/types/autocomplete-message.js.map +0 -1
- package/esm2015/lib/modules/autocomplete/types/autocomplete-search-async-args.js +0 -2
- package/esm2015/lib/modules/autocomplete/types/autocomplete-search-async-args.js.map +0 -1
- package/esm2015/lib/modules/autocomplete/types/autocomplete-search-async-function.js +0 -2
- package/esm2015/lib/modules/autocomplete/types/autocomplete-search-async-function.js.map +0 -1
- package/esm2015/lib/modules/autocomplete/types/autocomplete-search-async-result-display-type.js +0 -2
- package/esm2015/lib/modules/autocomplete/types/autocomplete-search-async-result-display-type.js.map +0 -1
- package/esm2015/lib/modules/autocomplete/types/autocomplete-search-async-result.js +0 -2
- package/esm2015/lib/modules/autocomplete/types/autocomplete-search-async-result.js.map +0 -1
- package/esm2015/lib/modules/autocomplete/types/autocomplete-search-function-filter.js +0 -2
- package/esm2015/lib/modules/autocomplete/types/autocomplete-search-function-filter.js.map +0 -1
- package/esm2015/lib/modules/autocomplete/types/autocomplete-search-function-response.js +0 -2
- package/esm2015/lib/modules/autocomplete/types/autocomplete-search-function-response.js.map +0 -1
- package/esm2015/lib/modules/autocomplete/types/autocomplete-search-function.js +0 -2
- package/esm2015/lib/modules/autocomplete/types/autocomplete-search-function.js.map +0 -1
- package/esm2015/lib/modules/autocomplete/types/autocomplete-selection-change.js +0 -2
- package/esm2015/lib/modules/autocomplete/types/autocomplete-selection-change.js.map +0 -1
- package/esm2015/lib/modules/autocomplete/types/autocomplete-show-more-args.js +0 -2
- package/esm2015/lib/modules/autocomplete/types/autocomplete-show-more-args.js.map +0 -1
- package/esm2015/lib/modules/country-field/country-field.component.js +0 -404
- package/esm2015/lib/modules/country-field/country-field.component.js.map +0 -1
- package/esm2015/lib/modules/country-field/country-field.module.js +0 -49
- package/esm2015/lib/modules/country-field/country-field.module.js.map +0 -1
- package/esm2015/lib/modules/country-field/types/country.js +0 -2
- package/esm2015/lib/modules/country-field/types/country.js.map +0 -1
- package/esm2015/lib/modules/lookup/lookup-adapter.service.js +0 -21
- package/esm2015/lib/modules/lookup/lookup-adapter.service.js.map +0 -1
- package/esm2015/lib/modules/lookup/lookup-autocomplete-adapter.js +0 -78
- package/esm2015/lib/modules/lookup/lookup-autocomplete-adapter.js.map +0 -1
- package/esm2015/lib/modules/lookup/lookup-item-selected.pipe.js +0 -16
- package/esm2015/lib/modules/lookup/lookup-item-selected.pipe.js.map +0 -1
- package/esm2015/lib/modules/lookup/lookup-show-more-async-modal.component.js +0 -186
- package/esm2015/lib/modules/lookup/lookup-show-more-async-modal.component.js.map +0 -1
- package/esm2015/lib/modules/lookup/lookup-show-more-modal.component.js +0 -258
- package/esm2015/lib/modules/lookup/lookup-show-more-modal.component.js.map +0 -1
- package/esm2015/lib/modules/lookup/lookup.component.js +0 -610
- package/esm2015/lib/modules/lookup/lookup.component.js.map +0 -1
- package/esm2015/lib/modules/lookup/lookup.module.js +0 -94
- package/esm2015/lib/modules/lookup/lookup.module.js.map +0 -1
- package/esm2015/lib/modules/lookup/types/lookup-add-click-callback-args.js +0 -2
- package/esm2015/lib/modules/lookup/types/lookup-add-click-callback-args.js.map +0 -1
- package/esm2015/lib/modules/lookup/types/lookup-add-click-event-args.js +0 -2
- package/esm2015/lib/modules/lookup/types/lookup-add-click-event-args.js.map +0 -1
- package/esm2015/lib/modules/lookup/types/lookup-select-mode-type.js +0 -2
- package/esm2015/lib/modules/lookup/types/lookup-select-mode-type.js.map +0 -1
- package/esm2015/lib/modules/lookup/types/lookup-select-mode.js +0 -16
- package/esm2015/lib/modules/lookup/types/lookup-select-mode.js.map +0 -1
- package/esm2015/lib/modules/lookup/types/lookup-show-more-config.js +0 -2
- package/esm2015/lib/modules/lookup/types/lookup-show-more-config.js.map +0 -1
- package/esm2015/lib/modules/lookup/types/lookup-show-more-custom-picker-context.js +0 -7
- package/esm2015/lib/modules/lookup/types/lookup-show-more-custom-picker-context.js.map +0 -1
- package/esm2015/lib/modules/lookup/types/lookup-show-more-custom-picker.js +0 -2
- package/esm2015/lib/modules/lookup/types/lookup-show-more-custom-picker.js.map +0 -1
- package/esm2015/lib/modules/lookup/types/lookup-show-more-native-picker-async-context.js +0 -7
- package/esm2015/lib/modules/lookup/types/lookup-show-more-native-picker-async-context.js.map +0 -1
- package/esm2015/lib/modules/lookup/types/lookup-show-more-native-picker-config.js +0 -2
- package/esm2015/lib/modules/lookup/types/lookup-show-more-native-picker-config.js.map +0 -1
- package/esm2015/lib/modules/lookup/types/lookup-show-more-native-picker-context.js +0 -7
- package/esm2015/lib/modules/lookup/types/lookup-show-more-native-picker-context.js.map +0 -1
- package/esm2015/lib/modules/search/search-adapter.service.js +0 -45
- package/esm2015/lib/modules/search/search-adapter.service.js.map +0 -1
- package/esm2015/lib/modules/search/search.component.js +0 -260
- package/esm2015/lib/modules/search/search.component.js.map +0 -1
- package/esm2015/lib/modules/search/search.module.js +0 -46
- package/esm2015/lib/modules/search/search.module.js.map +0 -1
- package/esm2015/lib/modules/shared/sky-lookup-resources.module.js +0 -72
- package/esm2015/lib/modules/shared/sky-lookup-resources.module.js.map +0 -1
- package/esm2015/lib/modules/shared/sky-lookup-string-utils.js +0 -8
- package/esm2015/lib/modules/shared/sky-lookup-string-utils.js.map +0 -1
- package/esm2015/skyux-lookup.js +0 -5
- package/esm2015/skyux-lookup.js.map +0 -1
- package/esm2015/testing/country-field/country-field-fixture.js +0 -123
- package/esm2015/testing/country-field/country-field-fixture.js.map +0 -1
- package/esm2015/testing/country-field/country-field-testing.module.js +0 -15
- package/esm2015/testing/country-field/country-field-testing.module.js.map +0 -1
- package/esm2015/testing/public-api.js +0 -5
- package/esm2015/testing/public-api.js.map +0 -1
- package/esm2015/testing/search/search-fixture.js +0 -57
- package/esm2015/testing/search/search-fixture.js.map +0 -1
- package/esm2015/testing/search/search-testing.module.js +0 -15
- package/esm2015/testing/search/search-testing.module.js.map +0 -1
- package/esm2015/testing/skyux-lookup-testing.js +0 -5
- package/esm2015/testing/skyux-lookup-testing.js.map +0 -1
- package/fesm2015/skyux-lookup-testing.js.map +0 -1
- package/fesm2015/skyux-lookup.js +0 -3191
- package/fesm2015/skyux-lookup.js.map +0 -1
|
@@ -1,260 +0,0 @@
|
|
|
1
|
-
import { animate, state, style, transition, trigger, } from '@angular/animations';
|
|
2
|
-
import { ChangeDetectorRef, Component, ElementRef, EventEmitter, Input, Output, ViewEncapsulation, } from '@angular/core';
|
|
3
|
-
import { SkyMediaBreakpoints, SkyMediaQueryService } from '@skyux/core';
|
|
4
|
-
import { Subject } from 'rxjs';
|
|
5
|
-
import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
|
|
6
|
-
import { SkySearchAdapterService } from './search-adapter.service';
|
|
7
|
-
import * as i0 from "@angular/core";
|
|
8
|
-
import * as i1 from "@skyux/core";
|
|
9
|
-
import * as i2 from "./search-adapter.service";
|
|
10
|
-
import * as i3 from "@skyux/forms";
|
|
11
|
-
import * as i4 from "@skyux/indicators";
|
|
12
|
-
import * as i5 from "@angular/common";
|
|
13
|
-
import * as i6 from "@angular/forms";
|
|
14
|
-
import * as i7 from "@skyux/theme";
|
|
15
|
-
import * as i8 from "@skyux/i18n";
|
|
16
|
-
const INPUT_SHOWN_STATE = 'inputShown';
|
|
17
|
-
const INPUT_HIDDEN_STATE = 'inputHidden';
|
|
18
|
-
const EXPAND_MODE_RESPONSIVE = 'responsive';
|
|
19
|
-
const EXPAND_MODE_FIT = 'fit';
|
|
20
|
-
const EXPAND_MODE_NONE = 'none';
|
|
21
|
-
export class SkySearchComponent {
|
|
22
|
-
constructor(mediaQueryService, elRef, searchAdapter, changeRef) {
|
|
23
|
-
this.mediaQueryService = mediaQueryService;
|
|
24
|
-
this.elRef = elRef;
|
|
25
|
-
this.searchAdapter = searchAdapter;
|
|
26
|
-
this.changeRef = changeRef;
|
|
27
|
-
/**
|
|
28
|
-
* Fires when the search text is applied.
|
|
29
|
-
*/
|
|
30
|
-
this.searchApply = new EventEmitter();
|
|
31
|
-
/**
|
|
32
|
-
* Fires when the search text is changed.
|
|
33
|
-
*/
|
|
34
|
-
this.searchChange = new EventEmitter();
|
|
35
|
-
/**
|
|
36
|
-
* Fires when the search text is cleared.
|
|
37
|
-
*/
|
|
38
|
-
this.searchClear = new EventEmitter();
|
|
39
|
-
/**
|
|
40
|
-
* Specifies the expand mode for the search input. The valid options
|
|
41
|
-
* include `"responsive"` to collapse the search input into a button on
|
|
42
|
-
* mobile devices, `"none"` to *not* collapse the search input on mobile
|
|
43
|
-
* devices, and `"fit"` to extend the search input to fit the width of its container.
|
|
44
|
-
* @default "responsive"
|
|
45
|
-
*/
|
|
46
|
-
this.expandMode = EXPAND_MODE_RESPONSIVE;
|
|
47
|
-
/**
|
|
48
|
-
* Specifies how many milliseconds to wait before searching after users enter text in the search input.
|
|
49
|
-
* @default 0
|
|
50
|
-
*/
|
|
51
|
-
this.debounceTime = 0;
|
|
52
|
-
/**
|
|
53
|
-
* Indicates whether to disable the filter button.
|
|
54
|
-
* @default false
|
|
55
|
-
*/
|
|
56
|
-
this.disabled = false;
|
|
57
|
-
this.isFullWidth = false;
|
|
58
|
-
this.isCollapsible = true;
|
|
59
|
-
this.inputAnimate = INPUT_SHOWN_STATE;
|
|
60
|
-
this.searchButtonShown = false;
|
|
61
|
-
this.mobileSearchShown = false;
|
|
62
|
-
this.dismissButtonShown = false;
|
|
63
|
-
this.clearButtonShown = false;
|
|
64
|
-
this.searchUpdated = new Subject();
|
|
65
|
-
}
|
|
66
|
-
ngOnInit() {
|
|
67
|
-
if (this.searchShouldCollapse()) {
|
|
68
|
-
this.breakpointSubscription = this.mediaQueryService.subscribe((args) => {
|
|
69
|
-
this.mediaQueryCallback(args);
|
|
70
|
-
this.changeRef.detectChanges();
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
this.searchUpdated
|
|
74
|
-
.asObservable()
|
|
75
|
-
.pipe(debounceTime(this.debounceTime), distinctUntilChanged())
|
|
76
|
-
.subscribe((value) => {
|
|
77
|
-
this.searchChange.emit(value);
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
ngOnChanges(changes) {
|
|
81
|
-
if (this.expandModeBindingChanged(changes)) {
|
|
82
|
-
switch (this.expandMode) {
|
|
83
|
-
case EXPAND_MODE_NONE:
|
|
84
|
-
this.isCollapsible = false;
|
|
85
|
-
this.isFullWidth = false;
|
|
86
|
-
break;
|
|
87
|
-
case EXPAND_MODE_FIT:
|
|
88
|
-
this.isCollapsible = false;
|
|
89
|
-
this.isFullWidth = true;
|
|
90
|
-
break;
|
|
91
|
-
default:
|
|
92
|
-
this.isCollapsible = true;
|
|
93
|
-
this.isFullWidth = false;
|
|
94
|
-
break;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
if (this.searchBindingChanged(changes)) {
|
|
98
|
-
this.clearButtonShown = this.searchText && this.searchText !== '';
|
|
99
|
-
if (this.shouldOpenInput()) {
|
|
100
|
-
this.inputAnimate = INPUT_SHOWN_STATE;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
this.changeRef.detectChanges();
|
|
104
|
-
}
|
|
105
|
-
clearSearchText() {
|
|
106
|
-
this.searchText = '';
|
|
107
|
-
this.clearButtonShown = false;
|
|
108
|
-
this.searchAdapter.focusInput(this.elRef);
|
|
109
|
-
this.searchChange.emit(this.searchText);
|
|
110
|
-
this.searchApply.emit(this.searchText);
|
|
111
|
-
this.searchClear.emit();
|
|
112
|
-
}
|
|
113
|
-
enterPress(event, searchText) {
|
|
114
|
-
if (event.code === 'Enter' || event.code === 'NumpadEnter') {
|
|
115
|
-
this.applySearchText(searchText);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
applySearchText(searchText) {
|
|
119
|
-
// Double check that search text is defined before attempting to trim off whitespace
|
|
120
|
-
if (searchText) {
|
|
121
|
-
searchText = searchText.trim();
|
|
122
|
-
}
|
|
123
|
-
if (searchText !== this.searchText) {
|
|
124
|
-
this.searchText = searchText;
|
|
125
|
-
}
|
|
126
|
-
this.clearButtonShown = searchText && searchText !== '';
|
|
127
|
-
if (searchText && searchText !== '') {
|
|
128
|
-
this.searchAdapter.selectInput(this.elRef);
|
|
129
|
-
}
|
|
130
|
-
this.searchApply.emit(searchText);
|
|
131
|
-
}
|
|
132
|
-
searchTextChanged(searchText) {
|
|
133
|
-
this.searchText = searchText;
|
|
134
|
-
this.searchUpdated.next(searchText);
|
|
135
|
-
}
|
|
136
|
-
toggleSearchInput(showInput) {
|
|
137
|
-
if (this.searchShouldCollapse()) {
|
|
138
|
-
if (showInput) {
|
|
139
|
-
this.inputAnimate = INPUT_SHOWN_STATE;
|
|
140
|
-
}
|
|
141
|
-
else {
|
|
142
|
-
this.inputAnimate = INPUT_HIDDEN_STATE;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
inputAnimationStart(event) {
|
|
147
|
-
if (this.searchShouldCollapse()) {
|
|
148
|
-
this.searchAdapter.startInputAnimation(this.elRef);
|
|
149
|
-
if (event.toState === INPUT_SHOWN_STATE &&
|
|
150
|
-
this.mediaQueryService.current === SkyMediaBreakpoints.xs) {
|
|
151
|
-
this.mobileSearchShown = true;
|
|
152
|
-
this.searchButtonShown = false;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
inputAnimationEnd(event) {
|
|
157
|
-
if (this.searchShouldCollapse()) {
|
|
158
|
-
this.searchAdapter.endInputAnimation(this.elRef);
|
|
159
|
-
this.searchButtonShown =
|
|
160
|
-
event.toState === INPUT_HIDDEN_STATE &&
|
|
161
|
-
this.mediaQueryService.current === SkyMediaBreakpoints.xs;
|
|
162
|
-
if ((event.toState === INPUT_HIDDEN_STATE &&
|
|
163
|
-
this.mediaQueryService.current === SkyMediaBreakpoints.xs) ||
|
|
164
|
-
this.mediaQueryService.current !== SkyMediaBreakpoints.xs) {
|
|
165
|
-
this.mobileSearchShown = false;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
ngOnDestroy() {
|
|
170
|
-
if (this.breakpointSubscription) {
|
|
171
|
-
this.breakpointSubscription.unsubscribe();
|
|
172
|
-
}
|
|
173
|
-
this.searchUpdated.complete();
|
|
174
|
-
}
|
|
175
|
-
searchBindingChanged(changes) {
|
|
176
|
-
return (changes['searchText'] &&
|
|
177
|
-
changes['searchText'].previousValue !== changes['searchText'].currentValue);
|
|
178
|
-
}
|
|
179
|
-
expandModeBindingChanged(changes) {
|
|
180
|
-
return (changes['expandMode'] &&
|
|
181
|
-
changes['expandMode'].previousValue !== changes['expandMode'].currentValue);
|
|
182
|
-
}
|
|
183
|
-
shouldOpenInput() {
|
|
184
|
-
return (this.searchText !== '' &&
|
|
185
|
-
this.mediaQueryService.current === SkyMediaBreakpoints.xs &&
|
|
186
|
-
this.searchShouldCollapse());
|
|
187
|
-
}
|
|
188
|
-
mediaQueryCallback(args) {
|
|
189
|
-
if (this.searchShouldCollapse()) {
|
|
190
|
-
if (args === SkyMediaBreakpoints.xs) {
|
|
191
|
-
this.inputAnimate = INPUT_HIDDEN_STATE;
|
|
192
|
-
}
|
|
193
|
-
else if (this.inputAnimate !== INPUT_SHOWN_STATE) {
|
|
194
|
-
this.inputAnimate = INPUT_SHOWN_STATE;
|
|
195
|
-
}
|
|
196
|
-
else {
|
|
197
|
-
this.mobileSearchShown = false;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
this.changeRef.markForCheck();
|
|
201
|
-
}
|
|
202
|
-
searchShouldCollapse() {
|
|
203
|
-
return ((this.isCollapsible || this.isCollapsible === undefined) &&
|
|
204
|
-
this.isFullWidth !== true);
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
SkySearchComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkySearchComponent, deps: [{ token: i1.SkyMediaQueryService }, { token: i0.ElementRef }, { token: i2.SkySearchAdapterService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
208
|
-
SkySearchComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkySearchComponent, selector: "sky-search", inputs: { searchText: "searchText", expandMode: "expandMode", debounceTime: "debounceTime", disabled: "disabled", placeholderText: "placeholderText" }, outputs: { searchApply: "searchApply", searchChange: "searchChange", searchClear: "searchClear" }, providers: [SkySearchAdapterService], usesOnChanges: true, ngImport: i0, template: "<div class=\"sky-search-container\">\n <div class=\"sky-search-button-container\">\n <button\n class=\"sky-btn sky-btn-default sky-btn-icon sky-search-btn-open\"\n type=\"button\"\n [attr.aria-label]=\"'skyux_search_open' | skyLibResources\"\n [hidden]=\"!searchButtonShown\"\n [ngClass]=\"{ 'sky-search-btn-open-applied': clearButtonShown }\"\n (click)=\"toggleSearchInput(true)\"\n >\n <ng-container *ngTemplateOutlet=\"searchIconTemplate\"></ng-container>\n </button>\n </div>\n <div\n class=\"sky-search-dismiss-container\"\n [hidden]=\"searchButtonShown\"\n [ngClass]=\"{\n 'sky-search-dismiss-absolute': mobileSearchShown || isFullWidth\n }\"\n >\n <div class=\"sky-search-item-input\">\n <div\n class=\"sky-search-input-container\"\n [@inputState]=\"inputAnimate\"\n (@inputState.start)=\"inputAnimationStart($event)\"\n (@inputState.done)=\"inputAnimationEnd($event)\"\n [ngClass]=\"{\n 'sky-search-input-container-has-value': searchText?.trim()\n }\"\n >\n <sky-input-box>\n <input\n class=\"sky-form-control sky-search-input sky-rounded-corners\"\n type=\"text\"\n [attr.aria-label]=\"'skyux_search_label' | skyLibResources\"\n [attr.placeholder]=\"\n placeholderText || ('skyux_search_placeholder' | skyLibResources)\n \"\n [disabled]=\"disabled\"\n [ngModel]=\"searchText\"\n (keyup)=\"enterPress($event, searchText)\"\n (ngModelChange)=\"searchTextChanged($event)\"\n skyId\n #searchInput=\"skyId\"\n />\n <span\n class=\"\n sky-input-group-btn sky-input-group-clear sky-input-box-btn-inset\n \"\n [hidden]=\"!clearButtonShown\"\n >\n <button\n aria-hidden=\"true\"\n class=\"\n sky-btn sky-btn-default sky-search-btn sky-search-btn-clear\n \"\n tabindex=\"-1\"\n type=\"button\"\n [disabled]=\"disabled\"\n (click)=\"clearSearchText()\"\n >\n <sky-icon *skyThemeIf=\"'default'\" icon=\"times\"></sky-icon>\n <sky-icon\n *skyThemeIf=\"'modern'\"\n icon=\"close\"\n iconType=\"skyux\"\n size=\"sm\"\n ></sky-icon>\n </button>\n </span>\n <span\n *skyThemeIf=\"'default'\"\n class=\"sky-input-group-btn sky-input-box-btn-inset\"\n >\n <button\n class=\"\n sky-btn sky-btn-default sky-search-btn sky-search-btn-apply\n \"\n type=\"button\"\n [attr.aria-label]=\"'skyux_search_label' | skyLibResources\"\n [disabled]=\"disabled\"\n (click)=\"applySearchText(searchText)\"\n >\n <ng-container\n *ngTemplateOutlet=\"searchIconTemplate\"\n ></ng-container>\n </button>\n </span>\n <div\n *skyThemeIf=\"'modern'\"\n aria-hidden=\"true\"\n class=\"sky-input-group-icon sky-input-box-icon-inset-left\"\n >\n <ng-container *ngTemplateOutlet=\"searchIconTemplate\"></ng-container>\n </div>\n </sky-input-box>\n </div>\n </div>\n <div class=\"sky-search-item-dismiss\">\n <button\n *ngIf=\"mobileSearchShown\"\n class=\"sky-btn sky-btn-secondary sky-search-btn-dismiss\"\n type=\"button\"\n [attr.title]=\"'skyux_search_dismiss' | skyLibResources\"\n (click)=\"toggleSearchInput(false)\"\n >\n <sky-icon *skyThemeIf=\"'default'\" icon=\"chevron-circle-left\" size=\"lg\">\n </sky-icon>\n <sky-icon\n *skyThemeIf=\"'modern'\"\n icon=\"double-chevron-left\"\n iconType=\"skyux\"\n >\n </sky-icon>\n </button>\n </div>\n </div>\n</div>\n\n<ng-template #searchIconTemplate>\n <sky-icon *skyThemeIf=\"'default'\" icon=\"search\" size=\"lg\"></sky-icon>\n <sky-icon\n *skyThemeIf=\"'modern'\"\n icon=\"search\"\n iconType=\"skyux\"\n size=\"lg\"\n ></sky-icon>\n</ng-template>\n", styles: ["sky-search .sky-search-container .sky-form-group{margin-bottom:0}sky-search .sky-search-input{border-top-right-radius:0;border-bottom-right-radius:0;border-right:0 none}sky-search .sky-search-input:focus{border:0 none;box-shadow:none;outline:none}sky-search .sky-search-input::-ms-clear{display:none}sky-search .sky-search-btn{border-left:0 none}sky-search .sky-search-btn:hover,sky-search .sky-search-btn:focus{background-color:#fff}sky-search .sky-search-btn-apply{padding-left:6px;border-top:1px solid #cdcfd2;border-bottom:1px solid #cdcfd2;border-right:1px solid #cdcfd2}sky-search .sky-search-btn-clear{border-right:0 none;padding-right:6px;border-top:1px solid #cdcfd2;border-bottom:1px solid #cdcfd2}sky-search .sky-search-input-focused .sky-search-btn{border-color:transparent;border-top:0 none;border-bottom:0 none}sky-search .sky-search-input-focused .sky-search-btn-apply{border-right:0 none}sky-search .sky-search-input-container .sky-input-group-btn>button:focus{z-index:3}sky-search .sky-search-input-container{min-width:auto}sky-search .sky-responsive-container-xs .sky-search-input-container,sky-search .sky-responsive-container-sm .sky-search-input-container,sky-search .sky-responsive-container-md .sky-search-input-container,sky-search .sky-responsive-container-lg .sky-search-input-container{min-width:auto}@media (min-width: 768px){sky-search .sky-search-input-container{min-width:300px}}sky-search .sky-responsive-container-sm .sky-search-input-container,sky-search .sky-responsive-container-md .sky-search-input-container,sky-search .sky-responsive-container-lg .sky-search-input-container{min-width:300px}@media (max-width: 767px){sky-search .sky-search-input,sky-search .sky-search-btn-apply,sky-search .sky-search-btn-clear{font-size:15px}}sky-search .sky-search-btn-open-applied.sky-search-btn-open,sky-search .sky-search-btn-open-applied.sky-search-btn-open:hover{color:#72bf44;border:2px solid #72bf44;padding:5px 11px}sky-search .sky-search-dismiss-container{display:flex}sky-search .sky-search-item-dismiss{flex-shrink:0;display:flex}sky-search .sky-search-item-dismiss>.sky-btn{border-color:transparent}sky-search .sky-search-item-input{flex-grow:1;display:flex}sky-search .sky-search-dismiss-absolute{align-items:center;position:absolute;background-color:#fff;top:0;left:0;bottom:0;right:0;padding:5px}.sky-theme-modern sky-search .sky-input-box .sky-input-group-btn .sky-btn.sky-search-btn{width:40px}.sky-theme-modern sky-search .sky-input-box .sky-input-group-btn .sky-btn.sky-search-btn .sky-icon.sky-i-close{color:#1c1d1f;font-size:inherit}.sky-theme-modern sky-search .sky-search-btn-open-applied.sky-search-btn-open,.sky-theme-modern sky-search .sky-search-btn-open-applied.sky-search-btn-open:hover{border:none;box-shadow:inset 0 0 0 2px #72bf44;padding:8px 14px}.sky-theme-modern sky-search .sky-search-container .sky-search-input-container.sky-search-input-container-has-value .sky-input-box-group-form-control:not(.sky-input-box-group-form-control-focus,:hover) .sky-form-group{border:none;border-radius:unset;box-shadow:inset 0 -1px #1870b8}.sky-theme-modern sky-search .sky-search-container .sky-search-input-container .sky-input-box-icon-inset-left-wrapper .sky-input-box-icon-inset-left{padding:0 10px}.sky-theme-modern sky-search .sky-search-container .sky-search-input-container .sky-input-group-icon .sky-icon{font-size:17.3333px;color:#1c1d1f}.sky-theme-modern sky-search .sky-search-container .sky-search-input-container .sky-input-box-group .sky-form-group{box-shadow:none}.sky-theme-modern sky-search .sky-search-container .sky-search-input-container .sky-input-box-group .sky-form-group .sky-input-box-form-group-inner input{flex-basis:auto;width:auto;padding:10px 10px 10px 0;margin:0}.sky-theme-modern sky-search .sky-search-container .sky-search-input-container .sky-input-box-group .sky-form-group .sky-input-box-form-group-inner input::placeholder{font-style:normal;color:inherit;font-weight:400}.sky-theme-modern sky-search .sky-search-container .sky-search-input-container .sky-input-box-group .sky-form-group .sky-input-box-form-group-inner input:focus::placeholder{color:transparent}.sky-theme-modern.sky-theme-mode-dark .sky-search-dismiss-absolute{background-color:#121212}.sky-theme-modern.sky-theme-mode-dark .sky-search-btn-open-applied.sky-search-btn-open,.sky-theme-modern.sky-theme-mode-dark .sky-search-btn-open-applied.sky-search-btn-open:hover{color:#72bf44}.sky-theme-modern.sky-theme-mode-dark sky-search .sky-input-box .sky-input-group-btn .sky-btn.sky-search-btn .sky-icon.sky-i-close{color:#fbfcfe}.sky-theme-modern.sky-theme-mode-dark sky-search .sky-input-group-icon .sky-icon{font-size:17.333px;color:#fbfcfe}\n"], components: [{ type: i3.λ10, selector: "sky-input-box", inputs: ["hasErrors", "disabled"] }, { type: i4.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }], directives: [{ type: i5.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i6.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i1.λ2, selector: "[skyId]", exportAs: ["skyId"] }, { type: i6.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i6.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i7.λ3, selector: "[skyThemeIf]", inputs: ["skyThemeIf"] }, { type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "skyLibResources": i8.SkyLibResourcesPipe }, animations: [
|
|
209
|
-
trigger('inputState', [
|
|
210
|
-
state(INPUT_HIDDEN_STATE, style({
|
|
211
|
-
opacity: 0,
|
|
212
|
-
width: 0,
|
|
213
|
-
})),
|
|
214
|
-
state(INPUT_SHOWN_STATE, style({
|
|
215
|
-
opacity: 1,
|
|
216
|
-
width: '100%',
|
|
217
|
-
})),
|
|
218
|
-
transition('* <=> *', animate('150ms')),
|
|
219
|
-
]),
|
|
220
|
-
], encapsulation: i0.ViewEncapsulation.None });
|
|
221
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkySearchComponent, decorators: [{
|
|
222
|
-
type: Component,
|
|
223
|
-
args: [{
|
|
224
|
-
selector: 'sky-search',
|
|
225
|
-
templateUrl: './search.component.html',
|
|
226
|
-
styleUrls: ['./search.component.scss'],
|
|
227
|
-
encapsulation: ViewEncapsulation.None,
|
|
228
|
-
animations: [
|
|
229
|
-
trigger('inputState', [
|
|
230
|
-
state(INPUT_HIDDEN_STATE, style({
|
|
231
|
-
opacity: 0,
|
|
232
|
-
width: 0,
|
|
233
|
-
})),
|
|
234
|
-
state(INPUT_SHOWN_STATE, style({
|
|
235
|
-
opacity: 1,
|
|
236
|
-
width: '100%',
|
|
237
|
-
})),
|
|
238
|
-
transition('* <=> *', animate('150ms')),
|
|
239
|
-
]),
|
|
240
|
-
],
|
|
241
|
-
providers: [SkySearchAdapterService],
|
|
242
|
-
}]
|
|
243
|
-
}], ctorParameters: function () { return [{ type: i1.SkyMediaQueryService }, { type: i0.ElementRef }, { type: i2.SkySearchAdapterService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { searchApply: [{
|
|
244
|
-
type: Output
|
|
245
|
-
}], searchChange: [{
|
|
246
|
-
type: Output
|
|
247
|
-
}], searchClear: [{
|
|
248
|
-
type: Output
|
|
249
|
-
}], searchText: [{
|
|
250
|
-
type: Input
|
|
251
|
-
}], expandMode: [{
|
|
252
|
-
type: Input
|
|
253
|
-
}], debounceTime: [{
|
|
254
|
-
type: Input
|
|
255
|
-
}], disabled: [{
|
|
256
|
-
type: Input
|
|
257
|
-
}], placeholderText: [{
|
|
258
|
-
type: Input
|
|
259
|
-
}] } });
|
|
260
|
-
//# sourceMappingURL=search.component.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"search.component.js","sourceRoot":"","sources":["../../../../../../../../libs/components/lookup/src/lib/modules/search/search.component.ts","../../../../../../../../libs/components/lookup/src/lib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ACD,SAAS,EAAE,CAAC,uBAAuB,CAAC;iBACrC;0MAMQ,WAAW;sBADjB,MAAM;gBAOA,YAAY;sBADlB,MAAM;gBAOA,WAAW;sBADjB,MAAM;gBAOA,UAAU;sBADhB,KAAK;gBAWC,UAAU;sBADhB,KAAK;gBAQC,YAAY;sBADlB,KAAK;gBAQC,QAAQ;sBADd,KAAK;gBAaC,eAAe;sBADrB,KAAK","sourcesContent":["import {\n AnimationEvent,\n animate,\n state,\n style,\n transition,\n trigger,\n} from '@angular/animations';\nimport {\n ChangeDetectorRef,\n Component,\n ElementRef,\n EventEmitter,\n Input,\n OnChanges,\n OnDestroy,\n OnInit,\n Output,\n SimpleChanges,\n ViewEncapsulation,\n} from '@angular/core';\nimport { SkyMediaBreakpoints, SkyMediaQueryService } from '@skyux/core';\n\nimport { Subject, Subscription } from 'rxjs';\nimport { debounceTime, distinctUntilChanged } from 'rxjs/operators';\n\nimport { SkySearchAdapterService } from './search-adapter.service';\n\nconst INPUT_SHOWN_STATE = 'inputShown';\nconst INPUT_HIDDEN_STATE = 'inputHidden';\nconst EXPAND_MODE_RESPONSIVE = 'responsive';\nconst EXPAND_MODE_FIT = 'fit';\nconst EXPAND_MODE_NONE = 'none';\n\n@Component({\n selector: 'sky-search',\n templateUrl: './search.component.html',\n styleUrls: ['./search.component.scss'],\n encapsulation: ViewEncapsulation.None,\n animations: [\n trigger('inputState', [\n state(\n INPUT_HIDDEN_STATE,\n style({\n opacity: 0,\n width: 0,\n })\n ),\n state(\n INPUT_SHOWN_STATE,\n style({\n opacity: 1,\n width: '100%',\n })\n ),\n transition('* <=> *', animate('150ms')),\n ]),\n ],\n providers: [SkySearchAdapterService],\n})\nexport class SkySearchComponent implements OnDestroy, OnInit, OnChanges {\n /**\n * Fires when the search text is applied.\n */\n @Output()\n public searchApply = new EventEmitter<string>();\n\n /**\n * Fires when the search text is changed.\n */\n @Output()\n public searchChange = new EventEmitter<string>();\n\n /**\n * Fires when the search text is cleared.\n */\n @Output()\n public searchClear = new EventEmitter<void>();\n\n /**\n * Specifies default search criteria for the input.\n */\n @Input()\n public searchText: string;\n\n /**\n * Specifies the expand mode for the search input. The valid options\n * include `\"responsive\"` to collapse the search input into a button on\n * mobile devices, `\"none\"` to *not* collapse the search input on mobile\n * devices, and `\"fit\"` to extend the search input to fit the width of its container.\n * @default \"responsive\"\n */\n @Input()\n public expandMode: string = EXPAND_MODE_RESPONSIVE;\n\n /**\n * Specifies how many milliseconds to wait before searching after users enter text in the search input.\n * @default 0\n */\n @Input()\n public debounceTime = 0;\n\n /**\n * Indicates whether to disable the filter button.\n * @default false\n */\n @Input()\n public disabled = false;\n\n public isFullWidth = false;\n\n public isCollapsible = true;\n\n /**\n * Specifies placeholder text to display in the search input until users\n * enter search criteria.\n * @default \"Find in this list\"\n */\n @Input()\n public placeholderText: string;\n\n public inputAnimate: string = INPUT_SHOWN_STATE;\n public breakpointSubscription: Subscription;\n public searchButtonShown = false;\n public mobileSearchShown = false;\n public dismissButtonShown = false;\n public clearButtonShown = false;\n\n private searchUpdated: Subject<string> = new Subject<string>();\n\n constructor(\n private mediaQueryService: SkyMediaQueryService,\n private elRef: ElementRef,\n private searchAdapter: SkySearchAdapterService,\n private changeRef: ChangeDetectorRef\n ) {}\n\n public ngOnInit() {\n if (this.searchShouldCollapse()) {\n this.breakpointSubscription = this.mediaQueryService.subscribe(\n (args: SkyMediaBreakpoints) => {\n this.mediaQueryCallback(args);\n this.changeRef.detectChanges();\n }\n );\n }\n\n this.searchUpdated\n .asObservable()\n .pipe(debounceTime(this.debounceTime), distinctUntilChanged())\n .subscribe((value) => {\n this.searchChange.emit(value);\n });\n }\n\n public ngOnChanges(changes: SimpleChanges) {\n if (this.expandModeBindingChanged(changes)) {\n switch (this.expandMode) {\n case EXPAND_MODE_NONE:\n this.isCollapsible = false;\n this.isFullWidth = false;\n break;\n case EXPAND_MODE_FIT:\n this.isCollapsible = false;\n this.isFullWidth = true;\n break;\n default:\n this.isCollapsible = true;\n this.isFullWidth = false;\n break;\n }\n }\n\n if (this.searchBindingChanged(changes)) {\n this.clearButtonShown = this.searchText && this.searchText !== '';\n if (this.shouldOpenInput()) {\n this.inputAnimate = INPUT_SHOWN_STATE;\n }\n }\n this.changeRef.detectChanges();\n }\n\n public clearSearchText() {\n this.searchText = '';\n this.clearButtonShown = false;\n\n this.searchAdapter.focusInput(this.elRef);\n this.searchChange.emit(this.searchText);\n\n this.searchApply.emit(this.searchText);\n\n this.searchClear.emit();\n }\n\n public enterPress(event: KeyboardEvent, searchText: string) {\n if (event.code === 'Enter' || event.code === 'NumpadEnter') {\n this.applySearchText(searchText);\n }\n }\n\n public applySearchText(searchText: string) {\n // Double check that search text is defined before attempting to trim off whitespace\n if (searchText) {\n searchText = searchText.trim();\n }\n\n if (searchText !== this.searchText) {\n this.searchText = searchText;\n }\n this.clearButtonShown = searchText && searchText !== '';\n if (searchText && searchText !== '') {\n this.searchAdapter.selectInput(this.elRef);\n }\n\n this.searchApply.emit(searchText);\n }\n\n public searchTextChanged(searchText: string) {\n this.searchText = searchText;\n this.searchUpdated.next(searchText);\n }\n\n public toggleSearchInput(showInput: boolean) {\n if (this.searchShouldCollapse()) {\n if (showInput) {\n this.inputAnimate = INPUT_SHOWN_STATE;\n } else {\n this.inputAnimate = INPUT_HIDDEN_STATE;\n }\n }\n }\n\n public inputAnimationStart(event: AnimationEvent) {\n if (this.searchShouldCollapse()) {\n this.searchAdapter.startInputAnimation(this.elRef);\n\n if (\n event.toState === INPUT_SHOWN_STATE &&\n this.mediaQueryService.current === SkyMediaBreakpoints.xs\n ) {\n this.mobileSearchShown = true;\n this.searchButtonShown = false;\n }\n }\n }\n\n public inputAnimationEnd(event: AnimationEvent) {\n if (this.searchShouldCollapse()) {\n this.searchAdapter.endInputAnimation(this.elRef);\n\n this.searchButtonShown =\n event.toState === INPUT_HIDDEN_STATE &&\n this.mediaQueryService.current === SkyMediaBreakpoints.xs;\n\n if (\n (event.toState === INPUT_HIDDEN_STATE &&\n this.mediaQueryService.current === SkyMediaBreakpoints.xs) ||\n this.mediaQueryService.current !== SkyMediaBreakpoints.xs\n ) {\n this.mobileSearchShown = false;\n }\n }\n }\n\n public ngOnDestroy() {\n if (this.breakpointSubscription) {\n this.breakpointSubscription.unsubscribe();\n }\n\n this.searchUpdated.complete();\n }\n private searchBindingChanged(changes: SimpleChanges) {\n return (\n changes['searchText'] &&\n changes['searchText'].previousValue !== changes['searchText'].currentValue\n );\n }\n\n private expandModeBindingChanged(changes: SimpleChanges) {\n return (\n changes['expandMode'] &&\n changes['expandMode'].previousValue !== changes['expandMode'].currentValue\n );\n }\n\n private shouldOpenInput() {\n return (\n this.searchText !== '' &&\n this.mediaQueryService.current === SkyMediaBreakpoints.xs &&\n this.searchShouldCollapse()\n );\n }\n\n private mediaQueryCallback(args: SkyMediaBreakpoints) {\n if (this.searchShouldCollapse()) {\n if (args === SkyMediaBreakpoints.xs) {\n this.inputAnimate = INPUT_HIDDEN_STATE;\n } else if (this.inputAnimate !== INPUT_SHOWN_STATE) {\n this.inputAnimate = INPUT_SHOWN_STATE;\n } else {\n this.mobileSearchShown = false;\n }\n }\n this.changeRef.markForCheck();\n }\n\n private searchShouldCollapse() {\n return (\n (this.isCollapsible || this.isCollapsible === undefined) &&\n this.isFullWidth !== true\n );\n }\n}\n","<div class=\"sky-search-container\">\n <div class=\"sky-search-button-container\">\n <button\n class=\"sky-btn sky-btn-default sky-btn-icon sky-search-btn-open\"\n type=\"button\"\n [attr.aria-label]=\"'skyux_search_open' | skyLibResources\"\n [hidden]=\"!searchButtonShown\"\n [ngClass]=\"{ 'sky-search-btn-open-applied': clearButtonShown }\"\n (click)=\"toggleSearchInput(true)\"\n >\n <ng-container *ngTemplateOutlet=\"searchIconTemplate\"></ng-container>\n </button>\n </div>\n <div\n class=\"sky-search-dismiss-container\"\n [hidden]=\"searchButtonShown\"\n [ngClass]=\"{\n 'sky-search-dismiss-absolute': mobileSearchShown || isFullWidth\n }\"\n >\n <div class=\"sky-search-item-input\">\n <div\n class=\"sky-search-input-container\"\n [@inputState]=\"inputAnimate\"\n (@inputState.start)=\"inputAnimationStart($event)\"\n (@inputState.done)=\"inputAnimationEnd($event)\"\n [ngClass]=\"{\n 'sky-search-input-container-has-value': searchText?.trim()\n }\"\n >\n <sky-input-box>\n <input\n class=\"sky-form-control sky-search-input sky-rounded-corners\"\n type=\"text\"\n [attr.aria-label]=\"'skyux_search_label' | skyLibResources\"\n [attr.placeholder]=\"\n placeholderText || ('skyux_search_placeholder' | skyLibResources)\n \"\n [disabled]=\"disabled\"\n [ngModel]=\"searchText\"\n (keyup)=\"enterPress($event, searchText)\"\n (ngModelChange)=\"searchTextChanged($event)\"\n skyId\n #searchInput=\"skyId\"\n />\n <span\n class=\"\n sky-input-group-btn sky-input-group-clear sky-input-box-btn-inset\n \"\n [hidden]=\"!clearButtonShown\"\n >\n <button\n aria-hidden=\"true\"\n class=\"\n sky-btn sky-btn-default sky-search-btn sky-search-btn-clear\n \"\n tabindex=\"-1\"\n type=\"button\"\n [disabled]=\"disabled\"\n (click)=\"clearSearchText()\"\n >\n <sky-icon *skyThemeIf=\"'default'\" icon=\"times\"></sky-icon>\n <sky-icon\n *skyThemeIf=\"'modern'\"\n icon=\"close\"\n iconType=\"skyux\"\n size=\"sm\"\n ></sky-icon>\n </button>\n </span>\n <span\n *skyThemeIf=\"'default'\"\n class=\"sky-input-group-btn sky-input-box-btn-inset\"\n >\n <button\n class=\"\n sky-btn sky-btn-default sky-search-btn sky-search-btn-apply\n \"\n type=\"button\"\n [attr.aria-label]=\"'skyux_search_label' | skyLibResources\"\n [disabled]=\"disabled\"\n (click)=\"applySearchText(searchText)\"\n >\n <ng-container\n *ngTemplateOutlet=\"searchIconTemplate\"\n ></ng-container>\n </button>\n </span>\n <div\n *skyThemeIf=\"'modern'\"\n aria-hidden=\"true\"\n class=\"sky-input-group-icon sky-input-box-icon-inset-left\"\n >\n <ng-container *ngTemplateOutlet=\"searchIconTemplate\"></ng-container>\n </div>\n </sky-input-box>\n </div>\n </div>\n <div class=\"sky-search-item-dismiss\">\n <button\n *ngIf=\"mobileSearchShown\"\n class=\"sky-btn sky-btn-secondary sky-search-btn-dismiss\"\n type=\"button\"\n [attr.title]=\"'skyux_search_dismiss' | skyLibResources\"\n (click)=\"toggleSearchInput(false)\"\n >\n <sky-icon *skyThemeIf=\"'default'\" icon=\"chevron-circle-left\" size=\"lg\">\n </sky-icon>\n <sky-icon\n *skyThemeIf=\"'modern'\"\n icon=\"double-chevron-left\"\n iconType=\"skyux\"\n >\n </sky-icon>\n </button>\n </div>\n </div>\n</div>\n\n<ng-template #searchIconTemplate>\n <sky-icon *skyThemeIf=\"'default'\" icon=\"search\" size=\"lg\"></sky-icon>\n <sky-icon\n *skyThemeIf=\"'modern'\"\n icon=\"search\"\n iconType=\"skyux\"\n size=\"lg\"\n ></sky-icon>\n</ng-template>\n"]}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { CommonModule } from '@angular/common';
|
|
2
|
-
import { NgModule } from '@angular/core';
|
|
3
|
-
import { FormsModule } from '@angular/forms';
|
|
4
|
-
import { SkyIdModule } from '@skyux/core';
|
|
5
|
-
import { SkyInputBoxModule } from '@skyux/forms';
|
|
6
|
-
import { SkyIconModule } from '@skyux/indicators';
|
|
7
|
-
import { SkyThemeModule } from '@skyux/theme';
|
|
8
|
-
import { SkyLookupResourcesModule } from '../shared/sky-lookup-resources.module';
|
|
9
|
-
import { SkySearchComponent } from './search.component';
|
|
10
|
-
import * as i0 from "@angular/core";
|
|
11
|
-
export class SkySearchModule {
|
|
12
|
-
}
|
|
13
|
-
SkySearchModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkySearchModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
14
|
-
SkySearchModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkySearchModule, declarations: [SkySearchComponent], imports: [CommonModule,
|
|
15
|
-
SkyInputBoxModule,
|
|
16
|
-
SkyLookupResourcesModule,
|
|
17
|
-
FormsModule,
|
|
18
|
-
SkyIconModule,
|
|
19
|
-
SkyThemeModule,
|
|
20
|
-
SkyIdModule], exports: [SkySearchComponent] });
|
|
21
|
-
SkySearchModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkySearchModule, imports: [[
|
|
22
|
-
CommonModule,
|
|
23
|
-
SkyInputBoxModule,
|
|
24
|
-
SkyLookupResourcesModule,
|
|
25
|
-
FormsModule,
|
|
26
|
-
SkyIconModule,
|
|
27
|
-
SkyThemeModule,
|
|
28
|
-
SkyIdModule,
|
|
29
|
-
]] });
|
|
30
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkySearchModule, decorators: [{
|
|
31
|
-
type: NgModule,
|
|
32
|
-
args: [{
|
|
33
|
-
declarations: [SkySearchComponent],
|
|
34
|
-
imports: [
|
|
35
|
-
CommonModule,
|
|
36
|
-
SkyInputBoxModule,
|
|
37
|
-
SkyLookupResourcesModule,
|
|
38
|
-
FormsModule,
|
|
39
|
-
SkyIconModule,
|
|
40
|
-
SkyThemeModule,
|
|
41
|
-
SkyIdModule,
|
|
42
|
-
],
|
|
43
|
-
exports: [SkySearchComponent],
|
|
44
|
-
}]
|
|
45
|
-
}] });
|
|
46
|
-
//# sourceMappingURL=search.module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"search.module.js","sourceRoot":"","sources":["../../../../../../../../libs/components/lookup/src/lib/modules/search/search.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AAEjF,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;;AAexD,MAAM,OAAO,eAAe;;6GAAf,eAAe;8GAAf,eAAe,iBAZX,kBAAkB,aAE/B,YAAY;QACZ,iBAAiB;QACjB,wBAAwB;QACxB,WAAW;QACX,aAAa;QACb,cAAc;QACd,WAAW,aAEH,kBAAkB;8GAEjB,eAAe,YAXjB;YACP,YAAY;YACZ,iBAAiB;YACjB,wBAAwB;YACxB,WAAW;YACX,aAAa;YACb,cAAc;YACd,WAAW;SACZ;4FAGU,eAAe;kBAb3B,QAAQ;mBAAC;oBACR,YAAY,EAAE,CAAC,kBAAkB,CAAC;oBAClC,OAAO,EAAE;wBACP,YAAY;wBACZ,iBAAiB;wBACjB,wBAAwB;wBACxB,WAAW;wBACX,aAAa;wBACb,cAAc;wBACd,WAAW;qBACZ;oBACD,OAAO,EAAE,CAAC,kBAAkB,CAAC;iBAC9B","sourcesContent":["import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { SkyIdModule } from '@skyux/core';\nimport { SkyInputBoxModule } from '@skyux/forms';\nimport { SkyIconModule } from '@skyux/indicators';\nimport { SkyThemeModule } from '@skyux/theme';\n\nimport { SkyLookupResourcesModule } from '../shared/sky-lookup-resources.module';\n\nimport { SkySearchComponent } from './search.component';\n\n@NgModule({\n declarations: [SkySearchComponent],\n imports: [\n CommonModule,\n SkyInputBoxModule,\n SkyLookupResourcesModule,\n FormsModule,\n SkyIconModule,\n SkyThemeModule,\n SkyIdModule,\n ],\n exports: [SkySearchComponent],\n})\nexport class SkySearchModule {}\n"]}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* NOTICE: DO NOT MODIFY THIS FILE!
|
|
3
|
-
* The contents of this file were automatically generated by
|
|
4
|
-
* the 'ng generate @skyux/i18n:lib-resources-module lib/modules/shared/sky-lookup' schematic.
|
|
5
|
-
* To update this file, simply rerun the command.
|
|
6
|
-
*/
|
|
7
|
-
import { NgModule } from '@angular/core';
|
|
8
|
-
import { SKY_LIB_RESOURCES_PROVIDERS, SkyI18nModule, getLibStringForLocale, } from '@skyux/i18n';
|
|
9
|
-
import * as i0 from "@angular/core";
|
|
10
|
-
const RESOURCES = {
|
|
11
|
-
'EN-US': {
|
|
12
|
-
skyux_autocomplete_add: { message: 'New' },
|
|
13
|
-
skyux_autocomplete_no_results: { message: 'No matches found' },
|
|
14
|
-
skyux_autocomplete_show_all: { message: 'Show all' },
|
|
15
|
-
skyux_autocomplete_show_all_count: { message: 'Show all {0}' },
|
|
16
|
-
skyux_autocomplete_show_matches_count: { message: 'Show matches ({0})' },
|
|
17
|
-
skyux_country_field_search_placeholder: { message: 'Search for a country' },
|
|
18
|
-
skyux_lookup_search_icon: { message: 'Search' },
|
|
19
|
-
skyux_lookup_search_button_show_more: {
|
|
20
|
-
message: 'Show all search results',
|
|
21
|
-
},
|
|
22
|
-
skyux_lookup_show_more_add: { message: 'New' },
|
|
23
|
-
skyux_lookup_show_more_select_all_button_title: { message: 'Select all' },
|
|
24
|
-
skyux_lookup_show_more_clear_all_button_title: { message: 'Clear all' },
|
|
25
|
-
skyux_lookup_show_more_show_selected_option_title: {
|
|
26
|
-
message: 'Show only selected items',
|
|
27
|
-
},
|
|
28
|
-
skyux_lookup_show_more_cancel: { message: 'Cancel' },
|
|
29
|
-
skyux_lookup_show_more_modal_title_single: { message: 'Select an option' },
|
|
30
|
-
skyux_lookup_show_more_modal_title_multiple: { message: 'Select options' },
|
|
31
|
-
skyux_lookup_show_more_no_results: { message: 'No matches found' },
|
|
32
|
-
skyux_lookup_show_more_select: { message: 'Select' },
|
|
33
|
-
skyux_lookup_tokens_summary: { message: '{0} items selected' },
|
|
34
|
-
skyux_search_dismiss: { message: 'Dismiss search' },
|
|
35
|
-
skyux_search_label: { message: 'Search items' },
|
|
36
|
-
skyux_search_open: { message: 'Open search' },
|
|
37
|
-
skyux_search_placeholder: { message: 'Find in this list' },
|
|
38
|
-
},
|
|
39
|
-
};
|
|
40
|
-
export class SkyLookupResourcesProvider {
|
|
41
|
-
getString(localeInfo, name) {
|
|
42
|
-
return getLibStringForLocale(RESOURCES, localeInfo.locale, name);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Import into any component library module that needs to use resource strings.
|
|
47
|
-
*/
|
|
48
|
-
export class SkyLookupResourcesModule {
|
|
49
|
-
}
|
|
50
|
-
SkyLookupResourcesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLookupResourcesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
51
|
-
SkyLookupResourcesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLookupResourcesModule, exports: [SkyI18nModule] });
|
|
52
|
-
SkyLookupResourcesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLookupResourcesModule, providers: [
|
|
53
|
-
{
|
|
54
|
-
provide: SKY_LIB_RESOURCES_PROVIDERS,
|
|
55
|
-
useClass: SkyLookupResourcesProvider,
|
|
56
|
-
multi: true,
|
|
57
|
-
},
|
|
58
|
-
], imports: [SkyI18nModule] });
|
|
59
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyLookupResourcesModule, decorators: [{
|
|
60
|
-
type: NgModule,
|
|
61
|
-
args: [{
|
|
62
|
-
exports: [SkyI18nModule],
|
|
63
|
-
providers: [
|
|
64
|
-
{
|
|
65
|
-
provide: SKY_LIB_RESOURCES_PROVIDERS,
|
|
66
|
-
useClass: SkyLookupResourcesProvider,
|
|
67
|
-
multi: true,
|
|
68
|
-
},
|
|
69
|
-
],
|
|
70
|
-
}]
|
|
71
|
-
}] });
|
|
72
|
-
//# sourceMappingURL=sky-lookup-resources.module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sky-lookup-resources.module.js","sourceRoot":"","sources":["../../../../../../../../libs/components/lookup/src/lib/modules/shared/sky-lookup-resources.module.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EACL,2BAA2B,EAE3B,aAAa,EAGb,qBAAqB,GACtB,MAAM,aAAa,CAAC;;AAErB,MAAM,SAAS,GAA0C;IACvD,OAAO,EAAE;QACP,sBAAsB,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE;QAC1C,6BAA6B,EAAE,EAAE,OAAO,EAAE,kBAAkB,EAAE;QAC9D,2BAA2B,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;QACpD,iCAAiC,EAAE,EAAE,OAAO,EAAE,cAAc,EAAE;QAC9D,qCAAqC,EAAE,EAAE,OAAO,EAAE,oBAAoB,EAAE;QACxE,sCAAsC,EAAE,EAAE,OAAO,EAAE,sBAAsB,EAAE;QAC3E,wBAAwB,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE;QAC/C,oCAAoC,EAAE;YACpC,OAAO,EAAE,yBAAyB;SACnC;QACD,0BAA0B,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE;QAC9C,8CAA8C,EAAE,EAAE,OAAO,EAAE,YAAY,EAAE;QACzE,6CAA6C,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE;QACvE,iDAAiD,EAAE;YACjD,OAAO,EAAE,0BAA0B;SACpC;QACD,6BAA6B,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE;QACpD,yCAAyC,EAAE,EAAE,OAAO,EAAE,kBAAkB,EAAE;QAC1E,2CAA2C,EAAE,EAAE,OAAO,EAAE,gBAAgB,EAAE;QAC1E,iCAAiC,EAAE,EAAE,OAAO,EAAE,kBAAkB,EAAE;QAClE,6BAA6B,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE;QACpD,2BAA2B,EAAE,EAAE,OAAO,EAAE,oBAAoB,EAAE;QAC9D,oBAAoB,EAAE,EAAE,OAAO,EAAE,gBAAgB,EAAE;QACnD,kBAAkB,EAAE,EAAE,OAAO,EAAE,cAAc,EAAE;QAC/C,iBAAiB,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE;QAC7C,wBAAwB,EAAE,EAAE,OAAO,EAAE,mBAAmB,EAAE;KAC3D;CACF,CAAC;AAEF,MAAM,OAAO,0BAA0B;IAC9B,SAAS,CACd,UAA4B,EAC5B,IAAY;QAEZ,OAAO,qBAAqB,CAAC,SAAS,EAAE,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACnE,CAAC;CACF;AAED;;GAEG;AAWH,MAAM,OAAO,wBAAwB;;sHAAxB,wBAAwB;uHAAxB,wBAAwB,YATzB,aAAa;uHASZ,wBAAwB,aARxB;QACT;YACE,OAAO,EAAE,2BAA2B;YACpC,QAAQ,EAAE,0BAA0B;YACpC,KAAK,EAAE,IAAI;SACZ;KACF,YAPS,aAAa;4FASZ,wBAAwB;kBAVpC,QAAQ;mBAAC;oBACR,OAAO,EAAE,CAAC,aAAa,CAAC;oBACxB,SAAS,EAAE;wBACT;4BACE,OAAO,EAAE,2BAA2B;4BACpC,QAAQ,EAAE,0BAA0B;4BACpC,KAAK,EAAE,IAAI;yBACZ;qBACF;iBACF","sourcesContent":["/**\n * NOTICE: DO NOT MODIFY THIS FILE!\n * The contents of this file were automatically generated by\n * the 'ng generate @skyux/i18n:lib-resources-module lib/modules/shared/sky-lookup' schematic.\n * To update this file, simply rerun the command.\n */\nimport { NgModule } from '@angular/core';\nimport {\n SKY_LIB_RESOURCES_PROVIDERS,\n SkyAppLocaleInfo,\n SkyI18nModule,\n SkyLibResources,\n SkyLibResourcesProvider,\n getLibStringForLocale,\n} from '@skyux/i18n';\n\nconst RESOURCES: { [locale: string]: SkyLibResources } = {\n 'EN-US': {\n skyux_autocomplete_add: { message: 'New' },\n skyux_autocomplete_no_results: { message: 'No matches found' },\n skyux_autocomplete_show_all: { message: 'Show all' },\n skyux_autocomplete_show_all_count: { message: 'Show all {0}' },\n skyux_autocomplete_show_matches_count: { message: 'Show matches ({0})' },\n skyux_country_field_search_placeholder: { message: 'Search for a country' },\n skyux_lookup_search_icon: { message: 'Search' },\n skyux_lookup_search_button_show_more: {\n message: 'Show all search results',\n },\n skyux_lookup_show_more_add: { message: 'New' },\n skyux_lookup_show_more_select_all_button_title: { message: 'Select all' },\n skyux_lookup_show_more_clear_all_button_title: { message: 'Clear all' },\n skyux_lookup_show_more_show_selected_option_title: {\n message: 'Show only selected items',\n },\n skyux_lookup_show_more_cancel: { message: 'Cancel' },\n skyux_lookup_show_more_modal_title_single: { message: 'Select an option' },\n skyux_lookup_show_more_modal_title_multiple: { message: 'Select options' },\n skyux_lookup_show_more_no_results: { message: 'No matches found' },\n skyux_lookup_show_more_select: { message: 'Select' },\n skyux_lookup_tokens_summary: { message: '{0} items selected' },\n skyux_search_dismiss: { message: 'Dismiss search' },\n skyux_search_label: { message: 'Search items' },\n skyux_search_open: { message: 'Open search' },\n skyux_search_placeholder: { message: 'Find in this list' },\n },\n};\n\nexport class SkyLookupResourcesProvider implements SkyLibResourcesProvider {\n public getString(\n localeInfo: SkyAppLocaleInfo,\n name: string\n ): string | undefined {\n return getLibStringForLocale(RESOURCES, localeInfo.locale, name);\n }\n}\n\n/**\n * Import into any component library module that needs to use resource strings.\n */\n@NgModule({\n exports: [SkyI18nModule],\n providers: [\n {\n provide: SKY_LIB_RESOURCES_PROVIDERS,\n useClass: SkyLookupResourcesProvider,\n multi: true,\n },\n ],\n})\nexport class SkyLookupResourcesModule {}\n"]}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Removes diacritical characters from strings and replaces them with their normalized equivalent.
|
|
3
|
-
* For example: è becomes e, Å becomes A.
|
|
4
|
-
*/
|
|
5
|
-
export function normalizeDiacritics(value) {
|
|
6
|
-
return value.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=sky-lookup-string-utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sky-lookup-string-utils.js","sourceRoot":"","sources":["../../../../../../../../libs/components/lookup/src/lib/modules/shared/sky-lookup-string-utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAa;IAC/C,OAAO,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAAC;AAChE,CAAC","sourcesContent":["/**\n * Removes diacritical characters from strings and replaces them with their normalized equivalent.\n * For example: è becomes e, Å becomes A.\n */\nexport function normalizeDiacritics(value: string): string {\n return value.normalize('NFD').replace(/[\\u0300-\\u036f]/g, '');\n}\n"]}
|
package/esm2015/skyux-lookup.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"skyux-lookup.js","sourceRoot":"","sources":["../../../../../libs/components/lookup/src/skyux-lookup.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,SAAS,CAAC","sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"]}
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import { __awaiter } from "tslib";
|
|
2
|
-
import { By } from '@angular/platform-browser';
|
|
3
|
-
import { SkyAppTestUtility } from '@skyux-sdk/testing';
|
|
4
|
-
/**
|
|
5
|
-
* Allows interaction with a SKY UX country field component.
|
|
6
|
-
*/
|
|
7
|
-
export class SkyCountryFieldFixture {
|
|
8
|
-
constructor(fixture, skyTestId) {
|
|
9
|
-
this.fixture = fixture;
|
|
10
|
-
this.debugEl = SkyAppTestUtility.getDebugElementByTestId(fixture, skyTestId, 'sky-country-field');
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* The value of the input field's autocomplete attribute.
|
|
14
|
-
*/
|
|
15
|
-
get autocompleteAttribute() {
|
|
16
|
-
return this.getInputElement().getAttribute('autocomplete');
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* A flag indicating if the country flag is currently visible.
|
|
20
|
-
* The flag will be visible only if a selection has been made
|
|
21
|
-
* and if the hideSelectedCountryFlag option is false.
|
|
22
|
-
*/
|
|
23
|
-
get countryFlagIsVisible() {
|
|
24
|
-
const flag = this.getCountryFlag();
|
|
25
|
-
return flag !== null;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* A flag indicating whether or not the input has been disabled.
|
|
29
|
-
*/
|
|
30
|
-
get disabled() {
|
|
31
|
-
return this.getInputElement().disabled;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* The value of the input field.
|
|
35
|
-
*/
|
|
36
|
-
get searchText() {
|
|
37
|
-
return this.getInputElement().value;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Enters the search text into the input field displaying search results, but making no selection.
|
|
41
|
-
* @param searchText The name of the country to select.
|
|
42
|
-
* @returns The list of country names matching the search text.
|
|
43
|
-
*/
|
|
44
|
-
search(searchText) {
|
|
45
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
-
const resultNodes = yield this.searchAndGetResults(searchText, this.fixture);
|
|
47
|
-
const resultArray = Array.prototype.slice.call(resultNodes);
|
|
48
|
-
const results = resultArray.map((result) => {
|
|
49
|
-
const countryNameEl = result.querySelector('.sky-highlight-mark');
|
|
50
|
-
const countryName = SkyAppTestUtility.getText(countryNameEl);
|
|
51
|
-
return countryName;
|
|
52
|
-
});
|
|
53
|
-
this.fixture.detectChanges();
|
|
54
|
-
yield this.fixture.whenStable();
|
|
55
|
-
return results;
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Enters the search text into the input field and selects the first result (if any).
|
|
60
|
-
* @param searchText The name of the country to select.
|
|
61
|
-
*/
|
|
62
|
-
searchAndSelectFirstResult(searchText) {
|
|
63
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
-
yield this.searchAndSelect(searchText, 0, this.fixture);
|
|
65
|
-
this.fixture.detectChanges();
|
|
66
|
-
return this.fixture.whenStable();
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Clears the country selection and input field.
|
|
71
|
-
*/
|
|
72
|
-
clear() {
|
|
73
|
-
this.enterSearch('', this.fixture);
|
|
74
|
-
this.fixture.detectChanges();
|
|
75
|
-
return this.fixture.whenStable();
|
|
76
|
-
}
|
|
77
|
-
//#region helpers
|
|
78
|
-
getCountryFlag() {
|
|
79
|
-
return this.debugEl.query(By.css('.sky-country-field-flag'));
|
|
80
|
-
}
|
|
81
|
-
getAutocompleteElement() {
|
|
82
|
-
return document.querySelector('.sky-autocomplete-results');
|
|
83
|
-
}
|
|
84
|
-
getInputElement() {
|
|
85
|
-
const debugEl = this.debugEl.query(By.css('textarea'));
|
|
86
|
-
return debugEl.nativeElement;
|
|
87
|
-
}
|
|
88
|
-
blurInput(fixture) {
|
|
89
|
-
SkyAppTestUtility.fireDomEvent(this.getInputElement(), 'blur');
|
|
90
|
-
fixture.detectChanges();
|
|
91
|
-
return fixture.whenStable();
|
|
92
|
-
}
|
|
93
|
-
enterSearch(newValue, fixture) {
|
|
94
|
-
const inputElement = this.getInputElement();
|
|
95
|
-
inputElement.value = newValue;
|
|
96
|
-
SkyAppTestUtility.fireDomEvent(inputElement, 'keyup');
|
|
97
|
-
SkyAppTestUtility.fireDomEvent(inputElement, 'input');
|
|
98
|
-
fixture.detectChanges();
|
|
99
|
-
return fixture.whenStable();
|
|
100
|
-
}
|
|
101
|
-
searchAndGetResults(newValue, fixture) {
|
|
102
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
103
|
-
yield this.enterSearch(newValue, fixture);
|
|
104
|
-
fixture.detectChanges();
|
|
105
|
-
yield fixture.whenStable();
|
|
106
|
-
return this.getAutocompleteElement().querySelectorAll('.sky-autocomplete-result');
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
searchAndSelect(newValue, index, fixture) {
|
|
110
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
111
|
-
const inputElement = this.getInputElement();
|
|
112
|
-
const searchResults = yield this.searchAndGetResults(newValue, fixture);
|
|
113
|
-
if (searchResults.length < index + 1) {
|
|
114
|
-
throw new Error('Index out of range for results');
|
|
115
|
-
}
|
|
116
|
-
// Note: the ordering of these events is important!
|
|
117
|
-
SkyAppTestUtility.fireDomEvent(inputElement, 'change');
|
|
118
|
-
SkyAppTestUtility.fireDomEvent(searchResults[index], 'mousedown');
|
|
119
|
-
this.blurInput(fixture);
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
//# sourceMappingURL=country-field-fixture.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"country-field-fixture.js","sourceRoot":"","sources":["../../../../../../../libs/components/lookup/testing/src/country-field/country-field-fixture.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,2BAA2B,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD;;GAEG;AACH,MAAM,OAAO,sBAAsB;IAkCjC,YAAoB,OAA8B,EAAE,SAAiB;QAAjD,YAAO,GAAP,OAAO,CAAuB;QAChD,IAAI,CAAC,OAAO,GAAG,iBAAiB,CAAC,uBAAuB,CACtD,OAAO,EACP,SAAS,EACT,mBAAmB,CACpB,CAAC;IACJ,CAAC;IArCD;;OAEG;IACH,IAAW,qBAAqB;QAC9B,OAAO,IAAI,CAAC,eAAe,EAAE,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OAA8B;;YAE9B,MAAM,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YAC1C,OAAO,CAAC,aAAa,EAAE,CAAC;YACxB,MAAM,OAAO,CAAC,UAAU,EAAE,CAAC;YAC3B,OAAO,IAAI,CAAC,sBAAsB,EAAE,CAAC,gBAAgB,CACnD,0BAA0B,CAC3B,CAAC;QACJ,CAAC;KAAA;IAEa,eAAe,CAC3B,QAAgB,EAChB,KAAa,EACb,OAA8B;;YAE9B,MAAM,YAAY,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;YAC5C,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YAExE,IAAI,aAAa,CAAC,MAAM,GAAG,KAAK,GAAG,CAAC,EAAE;gBACpC,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;aACnD;YAED,mDAAmD;YACnD,iBAAiB,CAAC,YAAY,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;YACvD,iBAAiB,CAAC,YAAY,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,WAAW,CAAC,CAAC;YAClE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QAC1B,CAAC;KAAA;CAGF","sourcesContent":["import { DebugElement } from '@angular/core';\nimport { ComponentFixture } from '@angular/core/testing';\nimport { By } from '@angular/platform-browser';\nimport { SkyAppTestUtility } from '@skyux-sdk/testing';\n\n/**\n * Allows interaction with a SKY UX country field component.\n */\nexport class SkyCountryFieldFixture {\n private debugEl: DebugElement;\n\n /**\n * The value of the input field's autocomplete attribute.\n */\n public get autocompleteAttribute(): string {\n return this.getInputElement().getAttribute('autocomplete');\n }\n\n /**\n * A flag indicating if the country flag is currently visible.\n * The flag will be visible only if a selection has been made\n * and if the hideSelectedCountryFlag option is false.\n */\n public get countryFlagIsVisible(): boolean {\n const flag = this.getCountryFlag();\n return flag !== null;\n }\n\n /**\n * A flag indicating whether or not the input has been disabled.\n */\n public get disabled(): boolean {\n return this.getInputElement().disabled;\n }\n\n /**\n * The value of the input field.\n */\n public get searchText(): string {\n return this.getInputElement().value;\n }\n\n constructor(private fixture: ComponentFixture<any>, skyTestId: string) {\n this.debugEl = SkyAppTestUtility.getDebugElementByTestId(\n fixture,\n skyTestId,\n 'sky-country-field'\n );\n }\n\n /**\n * Enters the search text into the input field displaying search results, but making no selection.\n * @param searchText The name of the country to select.\n * @returns The list of country names matching the search text.\n */\n public async search(searchText: string): Promise<string[]> {\n const resultNodes = await this.searchAndGetResults(\n searchText,\n this.fixture\n );\n const resultArray = Array.prototype.slice.call(resultNodes);\n const results = resultArray.map((result: HTMLElement) => {\n const countryNameEl = result.querySelector('.sky-highlight-mark');\n const countryName = SkyAppTestUtility.getText(countryNameEl);\n return countryName;\n });\n\n this.fixture.detectChanges();\n await this.fixture.whenStable();\n\n return results;\n }\n\n /**\n * Enters the search text into the input field and selects the first result (if any).\n * @param searchText The name of the country to select.\n */\n public async searchAndSelectFirstResult(searchText: string): Promise<void> {\n await this.searchAndSelect(searchText, 0, this.fixture);\n\n this.fixture.detectChanges();\n return this.fixture.whenStable();\n }\n\n /**\n * Clears the country selection and input field.\n */\n public clear(): Promise<void> {\n this.enterSearch('', this.fixture);\n\n this.fixture.detectChanges();\n return this.fixture.whenStable();\n }\n\n //#region helpers\n\n private getCountryFlag(): DebugElement {\n return this.debugEl.query(By.css('.sky-country-field-flag'));\n }\n\n private getAutocompleteElement(): HTMLElement {\n return document.querySelector('.sky-autocomplete-results') as HTMLElement;\n }\n\n private getInputElement(): HTMLTextAreaElement {\n const debugEl = this.debugEl.query(By.css('textarea'));\n return debugEl.nativeElement as HTMLTextAreaElement;\n }\n\n private blurInput(fixture: ComponentFixture<any>): Promise<void> {\n SkyAppTestUtility.fireDomEvent(this.getInputElement(), 'blur');\n fixture.detectChanges();\n return fixture.whenStable();\n }\n\n private enterSearch(\n newValue: string,\n fixture: ComponentFixture<any>\n ): Promise<void> {\n const inputElement = this.getInputElement();\n inputElement.value = newValue;\n SkyAppTestUtility.fireDomEvent(inputElement, 'keyup');\n SkyAppTestUtility.fireDomEvent(inputElement, 'input');\n fixture.detectChanges();\n return fixture.whenStable();\n }\n\n private async searchAndGetResults(\n newValue: string,\n fixture: ComponentFixture<any>\n ): Promise<NodeListOf<HTMLElement>> {\n await this.enterSearch(newValue, fixture);\n fixture.detectChanges();\n await fixture.whenStable();\n return this.getAutocompleteElement().querySelectorAll(\n '.sky-autocomplete-result'\n );\n }\n\n private async searchAndSelect(\n newValue: string,\n index: number,\n fixture: ComponentFixture<any>\n ): Promise<void> {\n const inputElement = this.getInputElement();\n const searchResults = await this.searchAndGetResults(newValue, fixture);\n\n if (searchResults.length < index + 1) {\n throw new Error('Index out of range for results');\n }\n\n // Note: the ordering of these events is important!\n SkyAppTestUtility.fireDomEvent(inputElement, 'change');\n SkyAppTestUtility.fireDomEvent(searchResults[index], 'mousedown');\n this.blurInput(fixture);\n }\n\n //#endregion helpers\n}\n"]}
|