sr-npm 1.2.63 → 1.2.65
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 +25 -21
package/package.json
CHANGED
|
@@ -8,12 +8,10 @@ async function handlePrimarySearch(_$w, allvaluesobjects) {
|
|
|
8
8
|
// wait for the jobs dataset to be ready
|
|
9
9
|
await _$w("#jobsDataset").onReadyAsync();
|
|
10
10
|
|
|
11
|
-
loadPrimarySearchRepeater(_$w);
|
|
12
11
|
await bindPrimarySearch(_$w, allvaluesobjects);
|
|
13
12
|
}
|
|
14
13
|
|
|
15
|
-
function
|
|
16
|
-
// handle category state
|
|
14
|
+
function handleCategoryResultsRepeater(_$w) {
|
|
17
15
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.CATEGORY_RESULTS_REPEATER).onItemReady(async ($item, itemData) => {
|
|
18
16
|
$item(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_CATEGORY_BUTTON).label = itemData.title || '';
|
|
19
17
|
});
|
|
@@ -36,12 +34,15 @@ function getSearchQuery(_$w) {
|
|
|
36
34
|
|
|
37
35
|
async function bindPrimarySearch(_$w, allvaluesobjects) {
|
|
38
36
|
|
|
37
|
+
handleCategoryResultsRepeater(_$w);
|
|
39
38
|
await handleSearchInput(_$w, allvaluesobjects);
|
|
40
39
|
|
|
40
|
+
// on mouse out collapse the results container
|
|
41
41
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.RESULTS_CONTAINER).onMouseOut(async () => {
|
|
42
42
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.RESULTS_CONTAINER).collapse();
|
|
43
43
|
});
|
|
44
44
|
|
|
45
|
+
// handle the click on the search button
|
|
45
46
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_BUTTON).onClick(async () => {
|
|
46
47
|
if(getSearchQuery(_$w) === '') {
|
|
47
48
|
const baseUrl = await location.baseUrl();
|
|
@@ -61,39 +62,43 @@ async function handleSearchInput(_$w, allvaluesobjects) {
|
|
|
61
62
|
await queryPrimarySearchResults(_$w, getSearchQuery(_$w));
|
|
62
63
|
}
|
|
63
64
|
|
|
65
|
+
// handle the input on the search input
|
|
64
66
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).onInput(async () => {
|
|
65
|
-
await debounce(() => handleSearchInput(),
|
|
67
|
+
await debounce(() => handleSearchInput(), 300);
|
|
66
68
|
});
|
|
67
|
-
|
|
68
|
-
|
|
69
|
+
|
|
70
|
+
// handle the click on the search input
|
|
71
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).onClick(async () => {
|
|
69
72
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.RESULTS_CONTAINER).expand();
|
|
70
73
|
|
|
71
74
|
const searchQuery = getSearchQuery(_$w);
|
|
72
75
|
if(searchQuery !== '') {
|
|
73
|
-
|
|
76
|
+
await queryPrimarySearchResults(_$w, searchQuery);
|
|
74
77
|
}
|
|
75
78
|
else {
|
|
76
|
-
|
|
79
|
+
await loadCategoriesListPrimarySearch(_$w,allvaluesobjects);
|
|
77
80
|
}
|
|
78
81
|
});
|
|
79
82
|
|
|
83
|
+
// handle the key press on the search input
|
|
80
84
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).onKeyPress(async (event) => {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
85
|
+
if( event.key === 'Enter') {
|
|
86
|
+
if(getSearchQuery(_$w) === '') {
|
|
87
|
+
// _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.RESULTS_CONTAINER).collapse();
|
|
88
|
+
const baseUrl = await location.baseUrl();
|
|
89
|
+
location.to(`${baseUrl}/search`);
|
|
90
|
+
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
let encodedKeyWord=encodeURIComponent(_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_INPUT).value);
|
|
94
|
+
const baseUrl = await location.baseUrl();
|
|
95
|
+
location.to(`${baseUrl}/search?keyword=${encodedKeyWord}`);
|
|
96
|
+
}
|
|
92
97
|
}
|
|
93
|
-
}
|
|
94
98
|
});
|
|
95
99
|
|
|
96
100
|
}
|
|
101
|
+
|
|
97
102
|
async function loadCategoriesListPrimarySearch(_$w, allvaluesobjects) {
|
|
98
103
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.PRIMARY_SEARCH_MULTI_BOX).changeState("categoryResults");
|
|
99
104
|
|
|
@@ -145,7 +150,6 @@ return count > 0;
|
|
|
145
150
|
}
|
|
146
151
|
|
|
147
152
|
module.exports = {
|
|
148
|
-
loadPrimarySearchRepeater,
|
|
149
153
|
bindPrimarySearch,
|
|
150
154
|
queryPrimarySearchResults,
|
|
151
155
|
handlePrimarySearch,
|