sr-npm 1.7.672 → 1.7.673

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sr-npm",
3
- "version": "1.7.672",
3
+ "version": "1.7.673",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -148,7 +148,7 @@ async function loadJobs(_$w) {
148
148
  console.log("elemenet: ",key)
149
149
  console.log("valuesByFieldId.get(elemenet): ",valuesByFieldId.get(key))
150
150
  //_$w("#CategoryCheckBox").options = valuesByFieldId.get(elemenet);
151
- _$w(`${field.title}CheckBox`).onChange(async (ev) => {
151
+ _$w(`#${field.title}CheckBox`).onChange(async (ev) => {
152
152
  dontUpdateThisCheckBox=field._id;
153
153
  const selected = ev.target.value; // array of selected value IDs
154
154
  if (selected && selected.length) {
@@ -157,15 +157,16 @@ async function loadJobs(_$w) {
157
157
  selectedByField.delete(field._id);
158
158
  }
159
159
  await applyJobFilters(_$w,field._id); // re-query jobs
160
- // await refreshFacetCounts(_$w); // recompute and update counts in all lists
160
+ await refreshFacetCounts(_$w,field.title); // recompute and update counts in all lists
161
161
  // await updateSelectedValuesRepeater(_$w);
162
162
  updateTotalJobsCountText(_$w);
163
163
  });
164
- const runFilter = debounce(() => {
165
- const query = (_$w(`${field.title}input`).value || '').toLowerCase().trim();
164
+
165
+ const runFilter = debounce(() => {
166
+ const query = (_$w(`#${field.title}input`).value || '').toLowerCase().trim();
166
167
  updateOptionsUI(_$w, field.title, field._id, query);
167
168
  }, 150);
168
- _$w(`${field.title}input`).onInput(runFilter);
169
+ _$w(`#${field.title}input`).onInput(runFilter);
169
170
  found=true;
170
171
  break;
171
172
  }
@@ -175,6 +176,15 @@ async function loadJobs(_$w) {
175
176
  }
176
177
  }
177
178
 
179
+ await refreshFacetCounts(_$w);
180
+ // _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_REPEATER).forEachItem(($item, itemData) => {
181
+ // const query = ($item(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_LABEL).value || '').toLowerCase().trim();
182
+ // updateOptionsUI($item, itemData._id, query);
183
+
184
+
185
+
186
+
187
+
178
188
  //
179
189
 
180
190
 
@@ -309,12 +319,15 @@ async function loadJobs(_$w) {
309
319
 
310
320
  // Preserve currently selected values that are still visible
311
321
  // const prevSelected = $item(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_REPEATER_ITEM_CHECKBOX).value || [];
312
- const prevSelected = _$w(`${fieldTitle}CheckBox`).value || [];
322
+ const prevSelected = _$w(`#${fieldTitle}CheckBox`).value || [];
313
323
  const visibleSet = new Set(filtered.map(o => o.value));
314
324
  const preserved = prevSelected.filter(v => visibleSet.has(v));
325
+ console.log("preserved: ",preserved)
326
+ console.log("filtered: ",filtered)
327
+ console.log("fieldTitle: ",fieldTitle)
315
328
 
316
- _$w(`${fieldTitle}CheckBox`).options = filtered;
317
- _$w(`${fieldTitle}CheckBox`).value = preserved;
329
+ _$w(`#${fieldTitle}CheckBox`).options = filtered;
330
+ _$w(`#${fieldTitle}CheckBox`).value = preserved;
318
331
 
319
332
  }
320
333
 
@@ -355,7 +368,7 @@ async function loadJobs(_$w) {
355
368
  }
356
369
 
357
370
 
358
- async function refreshFacetCounts(_$w) {
371
+ async function refreshFacetCounts(_$w,fieldTitle) {
359
372
  const fieldIds = Array.from(optionsByFieldId.keys());
360
373
  const currentJobsIds=currentJobs.map(job=>job._id);
361
374
  for (const fieldId of fieldIds) {
@@ -371,10 +384,14 @@ async function refreshFacetCounts(_$w) {
371
384
  countsByFieldId.set(fieldId, counter);
372
385
  }
373
386
  // // After counts are ready, update all items currently rendered
374
- _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_REPEATER).forEachItem(($item, itemData) => {
375
- const query = ($item(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_LABEL).value || '').toLowerCase().trim();
376
- updateOptionsUI($item, itemData._id, query);
377
- });
387
+ // _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_REPEATER).forEachItem(($item, itemData) => {
388
+ // const query = ($item(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_LABEL).value || '').toLowerCase().trim();
389
+ // updateOptionsUI($item, itemData._id, query);
390
+ // });
391
+ for(const fieldId of fieldIds) {
392
+ const query = (_$w(`#${fieldTitle}input`).value || '').toLowerCase().trim();
393
+ updateOptionsUI(_$w,fieldTitle, fieldId, query); // no search query
394
+ }
378
395
  }
379
396
 
380
397
  function groupValuesByField(values, refKey) {