sr-npm 1.7.669 → 1.7.671
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
CHANGED
|
@@ -133,12 +133,49 @@ async function loadJobs(_$w) {
|
|
|
133
133
|
valueToJobs[city._id]=city.jobIds;
|
|
134
134
|
}
|
|
135
135
|
// 2) Load all values once and group them by referenced field
|
|
136
|
-
|
|
136
|
+
let found=false;
|
|
137
137
|
let valuesByFieldId = groupValuesByField(allvaluesobjects, CUSTOM_VALUES_COLLECTION_FIELDS.CUSTOM_FIELD);
|
|
138
138
|
valuesByFieldId.set("Location",cities)
|
|
139
139
|
valuesByFieldIdGlobal = valuesByFieldId; // store globally
|
|
140
140
|
console.log("valuesByFieldId: ",valuesByFieldId)
|
|
141
|
-
|
|
141
|
+
|
|
142
|
+
for(const elemenet of Object.keys(valuesByFieldId)) {
|
|
143
|
+
console.log("elemenet: ",elemenet)
|
|
144
|
+
for(const field of fields) {
|
|
145
|
+
if(field._id===elemenet && field.title==="Category") {
|
|
146
|
+
updateOptionsUI(_$w,field.title, field._id, ''); // no search query
|
|
147
|
+
console.log("field: ",field)
|
|
148
|
+
console.log("elemenet: ",elemenet)
|
|
149
|
+
console.log("valuesByFieldId.get(elemenet): ",valuesByFieldId.get(elemenet))
|
|
150
|
+
//_$w("#CategoryCheckBox").options = valuesByFieldId.get(elemenet);
|
|
151
|
+
_$w(`${field.title}CheckBox`).onChange(async (ev) => {
|
|
152
|
+
dontUpdateThisCheckBox=field._id;
|
|
153
|
+
const selected = ev.target.value; // array of selected value IDs
|
|
154
|
+
if (selected && selected.length) {
|
|
155
|
+
selectedByField.set(field._id, selected);
|
|
156
|
+
} else {
|
|
157
|
+
selectedByField.delete(field._id);
|
|
158
|
+
}
|
|
159
|
+
await applyJobFilters(_$w,field._id); // re-query jobs
|
|
160
|
+
// await refreshFacetCounts(_$w); // recompute and update counts in all lists
|
|
161
|
+
// await updateSelectedValuesRepeater(_$w);
|
|
162
|
+
updateTotalJobsCountText(_$w);
|
|
163
|
+
});
|
|
164
|
+
const runFilter = debounce(() => {
|
|
165
|
+
const query = (_$w(`${field.title}input`).value || '').toLowerCase().trim();
|
|
166
|
+
updateOptionsUI(_$w, field.title, field._id, query);
|
|
167
|
+
}, 150);
|
|
168
|
+
_$w(`${field.title}input`).onInput(runFilter);
|
|
169
|
+
found=true;
|
|
170
|
+
break;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
if(found) {
|
|
174
|
+
break;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
//
|
|
142
179
|
|
|
143
180
|
|
|
144
181
|
|
|
@@ -241,7 +278,7 @@ async function loadJobs(_$w) {
|
|
|
241
278
|
};
|
|
242
279
|
};
|
|
243
280
|
|
|
244
|
-
function updateOptionsUI($
|
|
281
|
+
function updateOptionsUI(_$w,fieldTitle, fieldId, searchQuery) {
|
|
245
282
|
let base = optionsByFieldId.get(fieldId) || [];
|
|
246
283
|
const countsMap = countsByFieldId.get(fieldId) || new Map();
|
|
247
284
|
if(dontUpdateThisCheckBox===fieldId)
|
|
@@ -271,12 +308,13 @@ async function loadJobs(_$w) {
|
|
|
271
308
|
: withCounts;
|
|
272
309
|
|
|
273
310
|
// Preserve currently selected values that are still visible
|
|
274
|
-
|
|
311
|
+
// const prevSelected = $item(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_REPEATER_ITEM_CHECKBOX).value || [];
|
|
312
|
+
const prevSelected = _$w(`${fieldTitle}CheckBox`).value || [];
|
|
275
313
|
const visibleSet = new Set(filtered.map(o => o.value));
|
|
276
314
|
const preserved = prevSelected.filter(v => visibleSet.has(v));
|
|
277
315
|
|
|
278
|
-
$
|
|
279
|
-
$
|
|
316
|
+
_$w(`${fieldTitle}CheckBox`).options = filtered;
|
|
317
|
+
_$w(`${fieldTitle}CheckBox`).value = preserved;
|
|
280
318
|
|
|
281
319
|
}
|
|
282
320
|
|