sr-npm 1.2.71 → 1.2.73
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/public/primarySearchUtils.js +16 -11
package/package.json
CHANGED
|
@@ -29,24 +29,27 @@ function loadPrimarySearchRepeater(_$w) {
|
|
|
29
29
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
function getSearchQuery(_$w) {
|
|
33
|
+
return _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value?.toLowerCase().trim() || '';
|
|
34
|
+
}
|
|
35
|
+
|
|
32
36
|
async function handleSearchInput(_$w, allvaluesobjects) {
|
|
37
|
+
_$w('primarySearchInput').enable();
|
|
38
|
+
|
|
33
39
|
const callQueryPrimarySearchResults = async () => {
|
|
34
|
-
|
|
35
|
-
await queryPrimarySearchResults(_$w, query);
|
|
40
|
+
await queryPrimarySearchResults(_$w, getSearchQuery(_$w));
|
|
36
41
|
}
|
|
37
|
-
|
|
38
|
-
const primarySearchDebounced = debounce(() => callQueryPrimarySearchResults(), 400);
|
|
39
|
-
|
|
42
|
+
|
|
40
43
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).onInput(async () => {
|
|
41
|
-
|
|
44
|
+
await debounce(() => callQueryPrimarySearchResults(), 300)();
|
|
42
45
|
});
|
|
43
46
|
|
|
44
47
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).onClick(async () => {
|
|
45
48
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.RESULTS_CONTAINER).expand();
|
|
46
49
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
await queryPrimarySearchResults(_$w,
|
|
50
|
+
const searchQuery = getSearchQuery(_$w);
|
|
51
|
+
if(searchQuery!=='') {
|
|
52
|
+
await queryPrimarySearchResults(_$w, searchQuery);
|
|
50
53
|
}
|
|
51
54
|
else {
|
|
52
55
|
await loadCategoriesListPrimarySearch(_$w, allvaluesobjects);
|
|
@@ -55,7 +58,7 @@ async function handleSearchInput(_$w, allvaluesobjects) {
|
|
|
55
58
|
|
|
56
59
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).onKeyPress(async (event) => {
|
|
57
60
|
if( event.key === 'Enter') {
|
|
58
|
-
if(_$w
|
|
61
|
+
if(getSearchQuery(_$w) === '') {
|
|
59
62
|
// _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.RESULTS_CONTAINER).collapse();
|
|
60
63
|
const baseUrl = await location.baseUrl();
|
|
61
64
|
location.to(`${baseUrl}/search`);
|
|
@@ -69,16 +72,18 @@ async function handleSearchInput(_$w, allvaluesobjects) {
|
|
|
69
72
|
}
|
|
70
73
|
});
|
|
71
74
|
}
|
|
72
|
-
async function bindPrimarySearch(_$w, allvaluesobjects) {
|
|
73
75
|
|
|
76
|
+
async function bindPrimarySearch(_$w, allvaluesobjects) {
|
|
74
77
|
loadPrimarySearchRepeater(_$w);
|
|
75
78
|
|
|
76
79
|
await handleSearchInput(_$w, allvaluesobjects);
|
|
77
80
|
|
|
81
|
+
// on mouse out collapse the results container
|
|
78
82
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.RESULTS_CONTAINER).onMouseOut(async () => {
|
|
79
83
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.RESULTS_CONTAINER).collapse();
|
|
80
84
|
});
|
|
81
85
|
|
|
86
|
+
// handle the click on the search button
|
|
82
87
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_BUTTON).onClick(async () => {
|
|
83
88
|
if(_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value.trim()==='') {
|
|
84
89
|
const baseUrl = await location.baseUrl();
|