sr-npm 3.1.13 → 3.1.15
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.
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
const CAREERS_MULTI_BOXES_PAGE_CONSTS={
|
|
2
2
|
JOBS_DATASET: '#jobsDataset',
|
|
3
|
-
LINK_JOBS_TITLE: 'link-jobs-title',
|
|
4
|
-
LINK_JOBS_REF_ID_SLUG: 'link-jobs-refId-slug',
|
|
5
3
|
FILTER_REPEATER: '#filterReapter',
|
|
6
4
|
JOBS_REPEATER: '#jobsReapter',
|
|
7
5
|
JOBS_REPEATER_ITEM_TITLE: '#jobTitle',
|
package/package.json
CHANGED
|
@@ -435,16 +435,20 @@ function getValueFromValueId(valueIds, value) {
|
|
|
435
435
|
function updateOptionsUI(_$w,fieldTitle, fieldId, searchQuery,clearAll=false) {
|
|
436
436
|
let base = optionsByFieldId.get(fieldId) || [];
|
|
437
437
|
const countsMap = countsByFieldId.get(fieldId) || new Map();
|
|
438
|
-
if(dontUpdateThisCheckBox===fieldId && !clearAll)
|
|
438
|
+
if(dontUpdateThisCheckBox===fieldId && !clearAll && selectedByField.has(fieldId) )
|
|
439
439
|
{
|
|
440
|
-
|
|
441
|
-
|
|
440
|
+
dontUpdateThisCheckBox=null;
|
|
441
|
+
return;
|
|
442
442
|
}
|
|
443
443
|
let filteredbase=[]
|
|
444
444
|
for (const element of base)
|
|
445
445
|
{
|
|
446
446
|
if(countsMap.get(element.value))
|
|
447
447
|
{
|
|
448
|
+
if(countsMap.get(element.value)==-1)
|
|
449
|
+
{
|
|
450
|
+
countsMap.set(element.value,0);
|
|
451
|
+
}
|
|
448
452
|
filteredbase.push(element)
|
|
449
453
|
}
|
|
450
454
|
}
|
|
@@ -462,19 +466,31 @@ function getValueFromValueId(valueIds, value) {
|
|
|
462
466
|
: withCounts;
|
|
463
467
|
|
|
464
468
|
// Preserve currently selected values that are still visible
|
|
465
|
-
|
|
466
|
-
|
|
469
|
+
// let prevSelected=[]
|
|
470
|
+
// clearAll? prevSelected=[]:prevSelected= _$w(`#${FiltersIds[fieldTitle]}CheckBox`).value;
|
|
467
471
|
const visibleSet = new Set(filtered.map(o => o.value));
|
|
468
|
-
const preserved = prevSelected.filter(v => visibleSet.has(v));
|
|
472
|
+
//const preserved = prevSelected.filter(v => visibleSet.has(v));
|
|
469
473
|
if(filtered.length===0) {
|
|
470
474
|
_$w(`#${FiltersIds[fieldTitle]}MultiBox`).changeState(`${FiltersIds[fieldTitle]}NoResults`);
|
|
471
475
|
}
|
|
472
476
|
else{
|
|
473
477
|
_$w(`#${FiltersIds[fieldTitle]}MultiBox`).changeState(`${FiltersIds[fieldTitle]}Results`);
|
|
474
478
|
_$w(`#${FiltersIds[fieldTitle]}CheckBox`).options = filtered;
|
|
475
|
-
_$w(`#${FiltersIds[fieldTitle]}CheckBox`).value =
|
|
479
|
+
clearAll?_$w(`#${FiltersIds[fieldTitle]}CheckBox`).value=[]:_$w(`#${FiltersIds[fieldTitle]}CheckBox`).value = visibleSet
|
|
480
|
+
if(visibleSet.size>0 && selectedByField.has(fieldId)) {
|
|
481
|
+
let selectedindices=[];
|
|
482
|
+
for(const value of selectedByField.get(fieldId)) {
|
|
483
|
+
const options = optionsByFieldId.get(fieldId) || [];
|
|
484
|
+
const option = getCorrectOption(value,options,fieldTitle);
|
|
485
|
+
if(option) {
|
|
486
|
+
const optionIndex = getOptionIndexFromCheckBox(_$w(`#${FiltersIds[fieldTitle]}CheckBox`).options,option.value);
|
|
487
|
+
selectedindices.push(optionIndex);
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
_$w(`#${FiltersIds[fieldTitle]}CheckBox`).selectedIndices = selectedindices;
|
|
476
491
|
}
|
|
477
492
|
}
|
|
493
|
+
}
|
|
478
494
|
|
|
479
495
|
async function applyJobFilters(_$w) {
|
|
480
496
|
let tempFilteredJobs=[];
|
|
@@ -587,7 +603,18 @@ async function refreshFacetCounts(_$w,clearAll=false) {
|
|
|
587
603
|
counter.set(option.value, (counter.get(option.value) || 0) + 1);
|
|
588
604
|
}
|
|
589
605
|
}
|
|
606
|
+
|
|
607
|
+
}
|
|
608
|
+
if(selectedByField.has(fieldId)) {
|
|
609
|
+
for (const value of selectedByField.get(fieldId)) {
|
|
610
|
+
console.log("value: ",value)
|
|
611
|
+
if(counter.get(value)===undefined)
|
|
612
|
+
{
|
|
613
|
+
//it is -1 as a flag, so in case it was selected and after selecting more filters from different field and suddenly no more jobs have it, we will show 0
|
|
614
|
+
counter.set(value, -1);
|
|
615
|
+
}
|
|
590
616
|
}
|
|
617
|
+
}
|
|
591
618
|
countsByFieldId.set(fieldId, counter);
|
|
592
619
|
}
|
|
593
620
|
}
|
package/pages/pagesUtils.js
CHANGED
|
@@ -81,10 +81,12 @@ function getFieldByTitle(title,allFields) {
|
|
|
81
81
|
|
|
82
82
|
function getCorrectOption(value,options,param) {
|
|
83
83
|
const standardizedValue = normalizeString(value.toLowerCase())
|
|
84
|
-
if(param==="employmenttype") //employmenttype have a problematic value
|
|
84
|
+
if(param==="employmenttype" || param==="Employment Type" || param==="Store Name") //employmenttype have a problematic value, added Employment Type for updateOptionsUI fuinction, added Store Name because Store name and location have for example Blenheim
|
|
85
85
|
{
|
|
86
|
+
//option.value is the id,
|
|
86
87
|
return options.find(option=>normalizeString(option.value.toLowerCase())===standardizedValue);
|
|
87
88
|
}
|
|
89
|
+
//option.label is what we see live in the UI
|
|
88
90
|
return options.find(option=>normalizeString(option.label.toLowerCase())===standardizedValue);
|
|
89
91
|
}
|
|
90
92
|
|