sr-npm 1.7.576 → 1.7.578
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
|
@@ -36,11 +36,12 @@ async function careersMultiBoxesPageOnReady(_$w) {
|
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
38
|
|
|
39
|
-
applyJobFilters(JOBS_COLLECTION_FIELDS.MULTI_REF_JOBS_CUSTOM_VALUES);
|
|
40
|
-
refreshFacetCounts();
|
|
41
|
-
updateSelectedValuesRepeater();
|
|
39
|
+
applyJobFilters(_$w,JOBS_COLLECTION_FIELDS.MULTI_REF_JOBS_CUSTOM_VALUES);
|
|
40
|
+
refreshFacetCounts(_$w);
|
|
41
|
+
updateSelectedValuesRepeater(_$w);
|
|
42
42
|
});
|
|
43
43
|
});
|
|
44
|
+
updateSelectedValuesRepeater(_$w);
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
async function loadJobs(_$w) {
|
|
@@ -72,7 +73,7 @@ async function loadJobs(_$w) {
|
|
|
72
73
|
|
|
73
74
|
|
|
74
75
|
// 3) Bind each filter repeater item
|
|
75
|
-
$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_REPEATER).onItemReady(async ($item, itemData) => {
|
|
76
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_REPEATER).onItemReady(async ($item, itemData) => {
|
|
76
77
|
$item(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_LABEL).onClick(()=>{
|
|
77
78
|
$item(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_CHECKBOX_CONTAINER).collapsed ? $item(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_CHECKBOX_CONTAINER).expand() : $item(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_CHECKBOX_CONTAINER).collapse()
|
|
78
79
|
})
|
|
@@ -107,8 +108,8 @@ async function loadJobs(_$w) {
|
|
|
107
108
|
} else {
|
|
108
109
|
selectedByField.delete(fieldId);
|
|
109
110
|
}
|
|
110
|
-
applyJobFilters(); // re-query jobs
|
|
111
|
-
refreshFacetCounts(); // recompute and update counts in all lists
|
|
111
|
+
applyJobFilters(_$w,JOBS_COLLECTION_FIELDS.MULTI_REF_JOBS_CUSTOM_VALUES); // re-query jobs
|
|
112
|
+
refreshFacetCounts(_$w); // recompute and update counts in all lists
|
|
112
113
|
|
|
113
114
|
});
|
|
114
115
|
|
|
@@ -120,7 +121,7 @@ async function loadJobs(_$w) {
|
|
|
120
121
|
$item(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_LABEL).onInput(runFilter);
|
|
121
122
|
});
|
|
122
123
|
|
|
123
|
-
await refreshFacetCounts();
|
|
124
|
+
await refreshFacetCounts(_$w);
|
|
124
125
|
// After counts are ready, re-render all items to show numbers
|
|
125
126
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_REPEATER).forEachItem(($item, itemData) => {
|
|
126
127
|
const query = ($item(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_LABEL).value || '').toLowerCase().trim();
|
|
@@ -183,7 +184,7 @@ async function loadJobs(_$w) {
|
|
|
183
184
|
$item(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_REPEATER_ITEM_CHECKBOX).value = preserved;
|
|
184
185
|
}
|
|
185
186
|
|
|
186
|
-
function applyJobFilters(filterByField) {
|
|
187
|
+
function applyJobFilters(_$w,filterByField) {
|
|
187
188
|
let q = wixData.query(COLLECTIONS.JOBS)
|
|
188
189
|
|
|
189
190
|
// AND across categories, OR within each category
|
|
@@ -199,7 +200,7 @@ async function loadJobs(_$w) {
|
|
|
199
200
|
}
|
|
200
201
|
|
|
201
202
|
|
|
202
|
-
async function refreshFacetCounts() {
|
|
203
|
+
async function refreshFacetCounts(_$w) {
|
|
203
204
|
if (!valuesByFieldIdGlobal)
|
|
204
205
|
{
|
|
205
206
|
return;
|
|
@@ -268,6 +269,21 @@ async function refreshFacetCounts() {
|
|
|
268
269
|
return map;
|
|
269
270
|
}
|
|
270
271
|
|
|
272
|
+
function updateSelectedValuesRepeater(_$w) {
|
|
273
|
+
const selectedItems = [];
|
|
274
|
+
for (const [fieldId, valueIds] of selectedByField.entries()) {
|
|
275
|
+
const opts = optionsByFieldId.get(fieldId) || [];
|
|
276
|
+
const byId = new Map(opts.map(o => [o.value, o.label]));
|
|
277
|
+
for (const id of valueIds) {
|
|
278
|
+
const label = byId.get(id);
|
|
279
|
+
if (label) {
|
|
280
|
+
selectedItems.push({ _id: `${fieldId}:${id}`, label, fieldId, valueId: id });
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.SELECTED_VALUES_REPEATER).data = selectedItems;
|
|
285
|
+
}
|
|
286
|
+
|
|
271
287
|
|
|
272
288
|
module.exports = {
|
|
273
289
|
careersMultiBoxesPageOnReady
|