@biggive/components 202311211133.0.0 → 202311211301.0.0
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/dist/biggive/biggive.esm.js +1 -1
- package/dist/biggive/p-fd2a660c.entry.js +1 -0
- package/dist/cjs/biggive-accordion_42.cjs.entry.js +49 -68
- package/dist/collection/components/biggive-campaign-card-filter-grid/biggive-campaign-card-filter-grid.js +49 -68
- package/dist/components/biggive-campaign-card-filter-grid.js +49 -68
- package/dist/esm/biggive-accordion_42.entry.js +49 -68
- package/dist/types/components/biggive-campaign-card-filter-grid/biggive-campaign-card-filter-grid.d.ts +8 -0
- package/hydrate/index.js +49 -68
- package/package.json +1 -1
- package/dist/biggive/p-b7d3a791.entry.js +0 -1
|
@@ -293,89 +293,33 @@ const BiggiveCampaignCardFilterGrid = class {
|
|
|
293
293
|
this.locationsPlaceHolderText = 'Select location';
|
|
294
294
|
this.fundingPlaceHolderText = 'Select funding';
|
|
295
295
|
this.categoryFilterSelectionChanged = (value) => {
|
|
296
|
-
this.
|
|
296
|
+
this.newSelectedFilterCategory = value;
|
|
297
297
|
};
|
|
298
298
|
this.beneficiarySelectionChanged = (value) => {
|
|
299
|
-
this.
|
|
299
|
+
this.newSelectedFilterBeneficiary = value;
|
|
300
300
|
};
|
|
301
301
|
this.locationSelectionChanged = (value) => {
|
|
302
|
-
this.
|
|
302
|
+
this.newSelectedFilterLocation = value;
|
|
303
303
|
};
|
|
304
304
|
this.fundingSelectionChanged = (value) => {
|
|
305
|
-
this.
|
|
305
|
+
this.newSelectedFilterFunding = value;
|
|
306
306
|
};
|
|
307
307
|
this.sortBySelectionChanged = (value) => {
|
|
308
308
|
this.selectedSortByOption = value;
|
|
309
309
|
this.doSearchAndFilterUpdate.emit(this.getSearchAndFilterObject());
|
|
310
310
|
};
|
|
311
311
|
this.handleApplyFilterButtonClick = () => {
|
|
312
|
-
var _a, _b;
|
|
312
|
+
var _a, _b, _c, _d, _e;
|
|
313
|
+
this.selectedFilterCategory = (_a = this.newSelectedFilterCategory) !== null && _a !== void 0 ? _a : this.selectedFilterCategory;
|
|
314
|
+
this.selectedFilterBeneficiary = (_b = this.newSelectedFilterBeneficiary) !== null && _b !== void 0 ? _b : this.selectedFilterBeneficiary;
|
|
315
|
+
this.selectedFilterLocation = (_c = this.newSelectedFilterLocation) !== null && _c !== void 0 ? _c : this.selectedFilterLocation;
|
|
316
|
+
this.selectedFilterFunding = (_d = this.newSelectedFilterFunding) !== null && _d !== void 0 ? _d : this.selectedFilterFunding;
|
|
313
317
|
const searchAndFilterObj = this.getSearchAndFilterObject();
|
|
314
318
|
this.doSearchAndFilterUpdate.emit(searchAndFilterObj);
|
|
315
|
-
const filterPopup = (
|
|
319
|
+
const filterPopup = (_e = this.el.shadowRoot) === null || _e === void 0 ? void 0 : _e.getElementById('filter-popup');
|
|
316
320
|
if (filterPopup) {
|
|
317
321
|
filterPopup.closeFromOutside();
|
|
318
322
|
}
|
|
319
|
-
const selectedFilters = (_b = this.el.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('.selected-filters');
|
|
320
|
-
if (selectedFilters) {
|
|
321
|
-
selectedFilters.querySelectorAll('.button').forEach(button => {
|
|
322
|
-
button.remove();
|
|
323
|
-
});
|
|
324
|
-
}
|
|
325
|
-
let filters = {
|
|
326
|
-
beneficiaries: searchAndFilterObj.filterBeneficiary,
|
|
327
|
-
categories: searchAndFilterObj.filterCategory,
|
|
328
|
-
funding: searchAndFilterObj.filterFunding,
|
|
329
|
-
locations: searchAndFilterObj.filterLocation,
|
|
330
|
-
};
|
|
331
|
-
const keys = Object.keys(filters);
|
|
332
|
-
for (const filterKey of keys) {
|
|
333
|
-
// https://stackoverflow.com/a/69757191/2803757
|
|
334
|
-
const filterValue = filters[filterKey];
|
|
335
|
-
if (filterValue === null || filterValue.length === 0) {
|
|
336
|
-
continue;
|
|
337
|
-
}
|
|
338
|
-
let button = document.createElement('span');
|
|
339
|
-
button.classList.add('button');
|
|
340
|
-
button.dataset.id = filterKey;
|
|
341
|
-
button.innerText = filterValue;
|
|
342
|
-
if (selectedFilters) {
|
|
343
|
-
selectedFilters.appendChild(button);
|
|
344
|
-
}
|
|
345
|
-
button.addEventListener('click', () => {
|
|
346
|
-
var _a;
|
|
347
|
-
switch (filterKey) {
|
|
348
|
-
case 'beneficiaries':
|
|
349
|
-
this.selectedFilterBeneficiary = null;
|
|
350
|
-
break;
|
|
351
|
-
case 'categories':
|
|
352
|
-
this.selectedFilterCategory = null;
|
|
353
|
-
break;
|
|
354
|
-
case 'funding':
|
|
355
|
-
this.selectedFilterFunding = null;
|
|
356
|
-
break;
|
|
357
|
-
case 'locations':
|
|
358
|
-
this.selectedFilterLocation = null;
|
|
359
|
-
break;
|
|
360
|
-
default:
|
|
361
|
-
// This asks the compiler to check that we are in dead code, i.e. we covered all the possible filter keys
|
|
362
|
-
// above. If we missed one we would get a compile error trying to assign a string to a never.
|
|
363
|
-
const exhaustiveSwitch = filterKey;
|
|
364
|
-
console.error(exhaustiveSwitch);
|
|
365
|
-
}
|
|
366
|
-
button.remove();
|
|
367
|
-
this.doSearchAndFilterUpdate.emit(this.getSearchAndFilterObject());
|
|
368
|
-
if (button.dataset.id === undefined) {
|
|
369
|
-
return;
|
|
370
|
-
}
|
|
371
|
-
const selectEl = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById(button.dataset.id);
|
|
372
|
-
if (!selectEl) {
|
|
373
|
-
return;
|
|
374
|
-
}
|
|
375
|
-
selectEl.selectedLabel = null;
|
|
376
|
-
selectEl.selectedValue = null;
|
|
377
|
-
});
|
|
378
|
-
}
|
|
379
323
|
this.filtersApplied =
|
|
380
324
|
typeof searchAndFilterObj.filterBeneficiary === 'string' ||
|
|
381
325
|
typeof searchAndFilterObj.filterCategory === 'string' ||
|
|
@@ -463,6 +407,35 @@ const BiggiveCampaignCardFilterGrid = class {
|
|
|
463
407
|
filterLocation: this.selectedFilterLocation,
|
|
464
408
|
};
|
|
465
409
|
}
|
|
410
|
+
removeFilter(filterKey) {
|
|
411
|
+
var _a;
|
|
412
|
+
switch (filterKey) {
|
|
413
|
+
case 'beneficiaries':
|
|
414
|
+
this.selectedFilterBeneficiary = null;
|
|
415
|
+
break;
|
|
416
|
+
case 'categories':
|
|
417
|
+
this.selectedFilterCategory = null;
|
|
418
|
+
break;
|
|
419
|
+
case 'funding':
|
|
420
|
+
this.selectedFilterFunding = null;
|
|
421
|
+
break;
|
|
422
|
+
case 'locations':
|
|
423
|
+
this.selectedFilterLocation = null;
|
|
424
|
+
break;
|
|
425
|
+
default:
|
|
426
|
+
// This asks the compiler to check that we are in dead code, i.e. we covered all the possible filter keys
|
|
427
|
+
// above. If we missed one we would get a compile error trying to assign a string to a never.
|
|
428
|
+
const exhaustiveSwitch = filterKey;
|
|
429
|
+
console.error(exhaustiveSwitch);
|
|
430
|
+
}
|
|
431
|
+
const selectEl = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById(filterKey);
|
|
432
|
+
if (!selectEl) {
|
|
433
|
+
return;
|
|
434
|
+
}
|
|
435
|
+
selectEl.selectedLabel = null;
|
|
436
|
+
selectEl.selectedValue = null;
|
|
437
|
+
this.doSearchAndFilterUpdate.emit(this.getSearchAndFilterObject());
|
|
438
|
+
}
|
|
466
439
|
componentWillRender() {
|
|
467
440
|
this.filtersApplied =
|
|
468
441
|
this.selectedFilterCategory !== null || this.selectedFilterBeneficiary !== null || this.selectedFilterFunding !== null || this.selectedFilterLocation !== null;
|
|
@@ -470,10 +443,18 @@ const BiggiveCampaignCardFilterGrid = class {
|
|
|
470
443
|
}
|
|
471
444
|
render() {
|
|
472
445
|
var _a;
|
|
473
|
-
return (index.h("div", { class: 'container space-below-' + this.spaceBelow }, index.h("div", { class: "sleeve" }, index.h("div", { class: "search-wrap" }, index.h("h4", null, this.intro), index.h("div", { class: "field-wrap" }, index.h("div", { class: "input-wrap" }, index.h("svg", { xmlns: "http://www.w3.org/2000/svg", class: "icon", viewBox: "0 0 512 512" }, index.h("path", { d: fontawesomeIcons.faMagnifyingGlass.icon[4].toString() })), index.h("input", { type: "text", value: (_a = this.searchText) !== null && _a !== void 0 ? _a : '', class: "input-text", placeholder: this.placeholderText, onInput: this.handleSearchTextChanged, onKeyDown: this.handleEnterPressed })), index.h("biggive-button", { onClick: this.handleSearchButtonPressed, label: this.buttonText }))), index.h("div", { class: "sort-filter-wrap" }, index.h("div", { class: "filter-wrap" }, index.h("biggive-button", { class: "filter", colourScheme: "primary", onClick: this.handleFilterButtonClick, label: "Filter", fullWidth: true, "space-below": "0" }), index.h("biggive-popup", { id: "filter-popup" }, index.h("h4", { class: "space-above-0 space-below-3 text-colour-primary" }, "Filters"), index.h("div", { class: "select-wrapper-1" }, index.h("biggive-form-field-select", { backgroundColour: "white", prompt: "Category", placeholder: this.categoriesPlaceHolderText, selectedLabel: this.selectedFilterCategory, options: this.optionsToArray(this.categoryOptions || []), selectionChanged: this.categoryFilterSelectionChanged, id: "categories", "space-below": "2" })), index.h("div", { class: "select-wrapper-2" }, index.h("biggive-form-field-select", { backgroundColour: "white", prompt: "Beneficiary", placeholder: this.beneficiariesPlaceHolderText, selectedLabel: this.selectedFilterBeneficiary, options: this.optionsToArray(this.beneficiaryOptions || []), selectionChanged: this.beneficiarySelectionChanged, id: "beneficiaries", "space-below": "2" })), index.h("div", { class: "select-wrapper-3" }, index.h("biggive-form-field-select", { backgroundColour: "white", prompt: "Location", placeholder: this.locationsPlaceHolderText, selectedLabel: this.selectedFilterLocation, options: this.optionsToArray(this.locationOptions || []), selectionChanged: this.locationSelectionChanged, id: "locations", "space-below": "2" })), index.h("div", { class: "select-wrapper-4" }, index.h("biggive-form-field-select", { backgroundColour: "white", prompt: "Funding", placeholder: this.fundingPlaceHolderText, selectedLabel: this.selectedFilterFunding, options: this.optionsToArray(this.fundingOptions || []), selectionChanged: this.fundingSelectionChanged, id: "funding", "space-below": "2" })), index.h("div", { class: "align-right" }, index.h("biggive-button", { label: "Apply filters", onClick: this.handleApplyFilterButtonClick })))), index.h("div", { class: "sort-wrap" }, index.h("biggive-form-field-select", { options: [
|
|
446
|
+
return (index.h("div", { class: 'container space-below-' + this.spaceBelow }, index.h("div", { class: "sleeve" }, index.h("div", { class: "search-wrap" }, index.h("h4", null, this.intro), index.h("div", { class: "field-wrap" }, index.h("div", { class: "input-wrap" }, index.h("svg", { xmlns: "http://www.w3.org/2000/svg", class: "icon", viewBox: "0 0 512 512" }, index.h("path", { d: fontawesomeIcons.faMagnifyingGlass.icon[4].toString() })), index.h("input", { type: "text", value: (_a = this.searchText) !== null && _a !== void 0 ? _a : '', class: "input-text", placeholder: this.placeholderText, onInput: this.handleSearchTextChanged, onKeyDown: this.handleEnterPressed })), index.h("biggive-button", { onClick: this.handleSearchButtonPressed, label: this.buttonText }))), index.h("div", { class: "sort-filter-wrap" }, index.h("div", { class: "filter-wrap" }, index.h("biggive-button", { class: "filter", colourScheme: "primary", onClick: this.handleFilterButtonClick, label: "Filter", fullWidth: true, "space-below": "0" }), index.h("biggive-popup", { id: "filter-popup" }, index.h("h4", { class: "space-above-0 space-below-3 text-colour-primary" }, "Filters"), index.h("div", { class: "select-wrapper-1" }, index.h("biggive-form-field-select", { backgroundColour: "white", prompt: "Category", placeholder: this.categoriesPlaceHolderText, selectedLabel: this.selectedFilterCategory, selectedValue: this.selectedFilterCategory, options: this.optionsToArray(this.categoryOptions || []), selectionChanged: this.categoryFilterSelectionChanged, id: "categories", "space-below": "2" })), index.h("div", { class: "select-wrapper-2" }, index.h("biggive-form-field-select", { backgroundColour: "white", prompt: "Beneficiary", placeholder: this.beneficiariesPlaceHolderText, selectedLabel: this.selectedFilterBeneficiary, selectedValue: this.selectedFilterBeneficiary, options: this.optionsToArray(this.beneficiaryOptions || []), selectionChanged: this.beneficiarySelectionChanged, id: "beneficiaries", "space-below": "2" })), index.h("div", { class: "select-wrapper-3" }, index.h("biggive-form-field-select", { backgroundColour: "white", prompt: "Location", placeholder: this.locationsPlaceHolderText, selectedLabel: this.selectedFilterLocation, selectedValue: this.selectedFilterLocation, options: this.optionsToArray(this.locationOptions || []), selectionChanged: this.locationSelectionChanged, id: "locations", "space-below": "2" })), index.h("div", { class: "select-wrapper-4" }, index.h("biggive-form-field-select", { backgroundColour: "white", prompt: "Funding", placeholder: this.fundingPlaceHolderText, selectedLabel: this.selectedFilterFunding, selectedValue: this.selectedFilterFunding, options: this.optionsToArray(this.fundingOptions || []), selectionChanged: this.fundingSelectionChanged, id: "funding", "space-below": "2" })), index.h("div", { class: "align-right" }, index.h("biggive-button", { label: "Apply filters", onClick: this.handleApplyFilterButtonClick })))), index.h("div", { class: "sort-wrap" }, index.h("biggive-form-field-select", { options: [
|
|
474
447
|
{ value: 'amountRaised', label: 'Most raised' },
|
|
475
448
|
{ value: 'matchFundsRemaining', label: 'Match funds remaining' },
|
|
476
|
-
], prompt: null, "select-style": "underlined", placeholder: this.sortByPlaceholderText, selectedLabel: this.selectedSortByOption, selectionChanged: this.sortBySelectionChanged, id: "sort-by" }, index.h("biggive-form-field-select-option", { value: "amountRaised", label: "Most raised" }), index.h("biggive-form-field-select-option", { value: "matchFundsRemaining", label: "Match funds remaining" }), (this.searchText || '').length > 0 ? index.h("biggive-form-field-select-option", { value: "Relevance", label: "Relevance" }) : null))), index.h("div", { class: "selected-filter-wrap" }, index.h("div", { class: "selected-filters" }
|
|
449
|
+
], prompt: null, "select-style": "underlined", placeholder: this.sortByPlaceholderText, selectedLabel: this.selectedSortByOption, selectionChanged: this.sortBySelectionChanged, id: "sort-by" }, index.h("biggive-form-field-select-option", { value: "amountRaised", label: "Most raised" }), index.h("biggive-form-field-select-option", { value: "matchFundsRemaining", label: "Match funds remaining" }), (this.searchText || '').length > 0 ? index.h("biggive-form-field-select-option", { value: "Relevance", label: "Relevance" }) : null))), index.h("div", { class: "selected-filter-wrap" }, index.h("div", { class: "selected-filters" }, this.selectedFilterCategory && (index.h("span", { class: "button", onClick: () => {
|
|
450
|
+
this.removeFilter('categories');
|
|
451
|
+
} }, this.selectedFilterCategory)), this.selectedFilterBeneficiary && (index.h("span", { class: "button", onClick: () => {
|
|
452
|
+
this.removeFilter('beneficiaries');
|
|
453
|
+
} }, this.selectedFilterBeneficiary)), this.selectedFilterLocation && (index.h("span", { class: "button", onClick: () => {
|
|
454
|
+
this.removeFilter('locations');
|
|
455
|
+
} }, this.selectedFilterLocation)), this.selectedFilterFunding && (index.h("span", { class: "button", onClick: () => {
|
|
456
|
+
this.removeFilter('funding');
|
|
457
|
+
} }, this.selectedFilterFunding))), index.h("div", { class: "clear-all" }, index.h("a", { onClick: this.handleClearAll }, "Clear all"))), index.h("div", { class: "campaign-grid" }, index.h("slot", { name: "campaign-grid" })))));
|
|
477
458
|
}
|
|
478
459
|
optionsToArray(options) {
|
|
479
460
|
if (typeof options === 'string') {
|
|
@@ -8,89 +8,33 @@ export class BiggiveCampaignCardFilterGrid {
|
|
|
8
8
|
this.locationsPlaceHolderText = 'Select location';
|
|
9
9
|
this.fundingPlaceHolderText = 'Select funding';
|
|
10
10
|
this.categoryFilterSelectionChanged = (value) => {
|
|
11
|
-
this.
|
|
11
|
+
this.newSelectedFilterCategory = value;
|
|
12
12
|
};
|
|
13
13
|
this.beneficiarySelectionChanged = (value) => {
|
|
14
|
-
this.
|
|
14
|
+
this.newSelectedFilterBeneficiary = value;
|
|
15
15
|
};
|
|
16
16
|
this.locationSelectionChanged = (value) => {
|
|
17
|
-
this.
|
|
17
|
+
this.newSelectedFilterLocation = value;
|
|
18
18
|
};
|
|
19
19
|
this.fundingSelectionChanged = (value) => {
|
|
20
|
-
this.
|
|
20
|
+
this.newSelectedFilterFunding = value;
|
|
21
21
|
};
|
|
22
22
|
this.sortBySelectionChanged = (value) => {
|
|
23
23
|
this.selectedSortByOption = value;
|
|
24
24
|
this.doSearchAndFilterUpdate.emit(this.getSearchAndFilterObject());
|
|
25
25
|
};
|
|
26
26
|
this.handleApplyFilterButtonClick = () => {
|
|
27
|
-
var _a, _b;
|
|
27
|
+
var _a, _b, _c, _d, _e;
|
|
28
|
+
this.selectedFilterCategory = (_a = this.newSelectedFilterCategory) !== null && _a !== void 0 ? _a : this.selectedFilterCategory;
|
|
29
|
+
this.selectedFilterBeneficiary = (_b = this.newSelectedFilterBeneficiary) !== null && _b !== void 0 ? _b : this.selectedFilterBeneficiary;
|
|
30
|
+
this.selectedFilterLocation = (_c = this.newSelectedFilterLocation) !== null && _c !== void 0 ? _c : this.selectedFilterLocation;
|
|
31
|
+
this.selectedFilterFunding = (_d = this.newSelectedFilterFunding) !== null && _d !== void 0 ? _d : this.selectedFilterFunding;
|
|
28
32
|
const searchAndFilterObj = this.getSearchAndFilterObject();
|
|
29
33
|
this.doSearchAndFilterUpdate.emit(searchAndFilterObj);
|
|
30
|
-
const filterPopup = (
|
|
34
|
+
const filterPopup = (_e = this.el.shadowRoot) === null || _e === void 0 ? void 0 : _e.getElementById('filter-popup');
|
|
31
35
|
if (filterPopup) {
|
|
32
36
|
filterPopup.closeFromOutside();
|
|
33
37
|
}
|
|
34
|
-
const selectedFilters = (_b = this.el.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('.selected-filters');
|
|
35
|
-
if (selectedFilters) {
|
|
36
|
-
selectedFilters.querySelectorAll('.button').forEach(button => {
|
|
37
|
-
button.remove();
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
let filters = {
|
|
41
|
-
beneficiaries: searchAndFilterObj.filterBeneficiary,
|
|
42
|
-
categories: searchAndFilterObj.filterCategory,
|
|
43
|
-
funding: searchAndFilterObj.filterFunding,
|
|
44
|
-
locations: searchAndFilterObj.filterLocation,
|
|
45
|
-
};
|
|
46
|
-
const keys = Object.keys(filters);
|
|
47
|
-
for (const filterKey of keys) {
|
|
48
|
-
// https://stackoverflow.com/a/69757191/2803757
|
|
49
|
-
const filterValue = filters[filterKey];
|
|
50
|
-
if (filterValue === null || filterValue.length === 0) {
|
|
51
|
-
continue;
|
|
52
|
-
}
|
|
53
|
-
let button = document.createElement('span');
|
|
54
|
-
button.classList.add('button');
|
|
55
|
-
button.dataset.id = filterKey;
|
|
56
|
-
button.innerText = filterValue;
|
|
57
|
-
if (selectedFilters) {
|
|
58
|
-
selectedFilters.appendChild(button);
|
|
59
|
-
}
|
|
60
|
-
button.addEventListener('click', () => {
|
|
61
|
-
var _a;
|
|
62
|
-
switch (filterKey) {
|
|
63
|
-
case 'beneficiaries':
|
|
64
|
-
this.selectedFilterBeneficiary = null;
|
|
65
|
-
break;
|
|
66
|
-
case 'categories':
|
|
67
|
-
this.selectedFilterCategory = null;
|
|
68
|
-
break;
|
|
69
|
-
case 'funding':
|
|
70
|
-
this.selectedFilterFunding = null;
|
|
71
|
-
break;
|
|
72
|
-
case 'locations':
|
|
73
|
-
this.selectedFilterLocation = null;
|
|
74
|
-
break;
|
|
75
|
-
default:
|
|
76
|
-
// This asks the compiler to check that we are in dead code, i.e. we covered all the possible filter keys
|
|
77
|
-
// above. If we missed one we would get a compile error trying to assign a string to a never.
|
|
78
|
-
const exhaustiveSwitch = filterKey;
|
|
79
|
-
console.error(exhaustiveSwitch);
|
|
80
|
-
}
|
|
81
|
-
button.remove();
|
|
82
|
-
this.doSearchAndFilterUpdate.emit(this.getSearchAndFilterObject());
|
|
83
|
-
if (button.dataset.id === undefined) {
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
const selectEl = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById(button.dataset.id);
|
|
87
|
-
if (!selectEl) {
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
selectEl.selectedLabel = null;
|
|
91
|
-
selectEl.selectedValue = null;
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
38
|
this.filtersApplied =
|
|
95
39
|
typeof searchAndFilterObj.filterBeneficiary === 'string' ||
|
|
96
40
|
typeof searchAndFilterObj.filterCategory === 'string' ||
|
|
@@ -178,6 +122,35 @@ export class BiggiveCampaignCardFilterGrid {
|
|
|
178
122
|
filterLocation: this.selectedFilterLocation,
|
|
179
123
|
};
|
|
180
124
|
}
|
|
125
|
+
removeFilter(filterKey) {
|
|
126
|
+
var _a;
|
|
127
|
+
switch (filterKey) {
|
|
128
|
+
case 'beneficiaries':
|
|
129
|
+
this.selectedFilterBeneficiary = null;
|
|
130
|
+
break;
|
|
131
|
+
case 'categories':
|
|
132
|
+
this.selectedFilterCategory = null;
|
|
133
|
+
break;
|
|
134
|
+
case 'funding':
|
|
135
|
+
this.selectedFilterFunding = null;
|
|
136
|
+
break;
|
|
137
|
+
case 'locations':
|
|
138
|
+
this.selectedFilterLocation = null;
|
|
139
|
+
break;
|
|
140
|
+
default:
|
|
141
|
+
// This asks the compiler to check that we are in dead code, i.e. we covered all the possible filter keys
|
|
142
|
+
// above. If we missed one we would get a compile error trying to assign a string to a never.
|
|
143
|
+
const exhaustiveSwitch = filterKey;
|
|
144
|
+
console.error(exhaustiveSwitch);
|
|
145
|
+
}
|
|
146
|
+
const selectEl = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById(filterKey);
|
|
147
|
+
if (!selectEl) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
selectEl.selectedLabel = null;
|
|
151
|
+
selectEl.selectedValue = null;
|
|
152
|
+
this.doSearchAndFilterUpdate.emit(this.getSearchAndFilterObject());
|
|
153
|
+
}
|
|
181
154
|
componentWillRender() {
|
|
182
155
|
this.filtersApplied =
|
|
183
156
|
this.selectedFilterCategory !== null || this.selectedFilterBeneficiary !== null || this.selectedFilterFunding !== null || this.selectedFilterLocation !== null;
|
|
@@ -185,10 +158,18 @@ export class BiggiveCampaignCardFilterGrid {
|
|
|
185
158
|
}
|
|
186
159
|
render() {
|
|
187
160
|
var _a;
|
|
188
|
-
return (h("div", { class: 'container space-below-' + this.spaceBelow }, h("div", { class: "sleeve" }, h("div", { class: "search-wrap" }, h("h4", null, this.intro), h("div", { class: "field-wrap" }, h("div", { class: "input-wrap" }, h("svg", { xmlns: "http://www.w3.org/2000/svg", class: "icon", viewBox: "0 0 512 512" }, h("path", { d: faMagnifyingGlass.icon[4].toString() })), h("input", { type: "text", value: (_a = this.searchText) !== null && _a !== void 0 ? _a : '', class: "input-text", placeholder: this.placeholderText, onInput: this.handleSearchTextChanged, onKeyDown: this.handleEnterPressed })), h("biggive-button", { onClick: this.handleSearchButtonPressed, label: this.buttonText }))), h("div", { class: "sort-filter-wrap" }, h("div", { class: "filter-wrap" }, h("biggive-button", { class: "filter", colourScheme: "primary", onClick: this.handleFilterButtonClick, label: "Filter", fullWidth: true, "space-below": "0" }), h("biggive-popup", { id: "filter-popup" }, h("h4", { class: "space-above-0 space-below-3 text-colour-primary" }, "Filters"), h("div", { class: "select-wrapper-1" }, h("biggive-form-field-select", { backgroundColour: "white", prompt: "Category", placeholder: this.categoriesPlaceHolderText, selectedLabel: this.selectedFilterCategory, options: this.optionsToArray(this.categoryOptions || []), selectionChanged: this.categoryFilterSelectionChanged, id: "categories", "space-below": "2" })), h("div", { class: "select-wrapper-2" }, h("biggive-form-field-select", { backgroundColour: "white", prompt: "Beneficiary", placeholder: this.beneficiariesPlaceHolderText, selectedLabel: this.selectedFilterBeneficiary, options: this.optionsToArray(this.beneficiaryOptions || []), selectionChanged: this.beneficiarySelectionChanged, id: "beneficiaries", "space-below": "2" })), h("div", { class: "select-wrapper-3" }, h("biggive-form-field-select", { backgroundColour: "white", prompt: "Location", placeholder: this.locationsPlaceHolderText, selectedLabel: this.selectedFilterLocation, options: this.optionsToArray(this.locationOptions || []), selectionChanged: this.locationSelectionChanged, id: "locations", "space-below": "2" })), h("div", { class: "select-wrapper-4" }, h("biggive-form-field-select", { backgroundColour: "white", prompt: "Funding", placeholder: this.fundingPlaceHolderText, selectedLabel: this.selectedFilterFunding, options: this.optionsToArray(this.fundingOptions || []), selectionChanged: this.fundingSelectionChanged, id: "funding", "space-below": "2" })), h("div", { class: "align-right" }, h("biggive-button", { label: "Apply filters", onClick: this.handleApplyFilterButtonClick })))), h("div", { class: "sort-wrap" }, h("biggive-form-field-select", { options: [
|
|
161
|
+
return (h("div", { class: 'container space-below-' + this.spaceBelow }, h("div", { class: "sleeve" }, h("div", { class: "search-wrap" }, h("h4", null, this.intro), h("div", { class: "field-wrap" }, h("div", { class: "input-wrap" }, h("svg", { xmlns: "http://www.w3.org/2000/svg", class: "icon", viewBox: "0 0 512 512" }, h("path", { d: faMagnifyingGlass.icon[4].toString() })), h("input", { type: "text", value: (_a = this.searchText) !== null && _a !== void 0 ? _a : '', class: "input-text", placeholder: this.placeholderText, onInput: this.handleSearchTextChanged, onKeyDown: this.handleEnterPressed })), h("biggive-button", { onClick: this.handleSearchButtonPressed, label: this.buttonText }))), h("div", { class: "sort-filter-wrap" }, h("div", { class: "filter-wrap" }, h("biggive-button", { class: "filter", colourScheme: "primary", onClick: this.handleFilterButtonClick, label: "Filter", fullWidth: true, "space-below": "0" }), h("biggive-popup", { id: "filter-popup" }, h("h4", { class: "space-above-0 space-below-3 text-colour-primary" }, "Filters"), h("div", { class: "select-wrapper-1" }, h("biggive-form-field-select", { backgroundColour: "white", prompt: "Category", placeholder: this.categoriesPlaceHolderText, selectedLabel: this.selectedFilterCategory, selectedValue: this.selectedFilterCategory, options: this.optionsToArray(this.categoryOptions || []), selectionChanged: this.categoryFilterSelectionChanged, id: "categories", "space-below": "2" })), h("div", { class: "select-wrapper-2" }, h("biggive-form-field-select", { backgroundColour: "white", prompt: "Beneficiary", placeholder: this.beneficiariesPlaceHolderText, selectedLabel: this.selectedFilterBeneficiary, selectedValue: this.selectedFilterBeneficiary, options: this.optionsToArray(this.beneficiaryOptions || []), selectionChanged: this.beneficiarySelectionChanged, id: "beneficiaries", "space-below": "2" })), h("div", { class: "select-wrapper-3" }, h("biggive-form-field-select", { backgroundColour: "white", prompt: "Location", placeholder: this.locationsPlaceHolderText, selectedLabel: this.selectedFilterLocation, selectedValue: this.selectedFilterLocation, options: this.optionsToArray(this.locationOptions || []), selectionChanged: this.locationSelectionChanged, id: "locations", "space-below": "2" })), h("div", { class: "select-wrapper-4" }, h("biggive-form-field-select", { backgroundColour: "white", prompt: "Funding", placeholder: this.fundingPlaceHolderText, selectedLabel: this.selectedFilterFunding, selectedValue: this.selectedFilterFunding, options: this.optionsToArray(this.fundingOptions || []), selectionChanged: this.fundingSelectionChanged, id: "funding", "space-below": "2" })), h("div", { class: "align-right" }, h("biggive-button", { label: "Apply filters", onClick: this.handleApplyFilterButtonClick })))), h("div", { class: "sort-wrap" }, h("biggive-form-field-select", { options: [
|
|
189
162
|
{ value: 'amountRaised', label: 'Most raised' },
|
|
190
163
|
{ value: 'matchFundsRemaining', label: 'Match funds remaining' },
|
|
191
|
-
], prompt: null, "select-style": "underlined", placeholder: this.sortByPlaceholderText, selectedLabel: this.selectedSortByOption, selectionChanged: this.sortBySelectionChanged, id: "sort-by" }, h("biggive-form-field-select-option", { value: "amountRaised", label: "Most raised" }), h("biggive-form-field-select-option", { value: "matchFundsRemaining", label: "Match funds remaining" }), (this.searchText || '').length > 0 ? h("biggive-form-field-select-option", { value: "Relevance", label: "Relevance" }) : null))), h("div", { class: "selected-filter-wrap" }, h("div", { class: "selected-filters" }
|
|
164
|
+
], prompt: null, "select-style": "underlined", placeholder: this.sortByPlaceholderText, selectedLabel: this.selectedSortByOption, selectionChanged: this.sortBySelectionChanged, id: "sort-by" }, h("biggive-form-field-select-option", { value: "amountRaised", label: "Most raised" }), h("biggive-form-field-select-option", { value: "matchFundsRemaining", label: "Match funds remaining" }), (this.searchText || '').length > 0 ? h("biggive-form-field-select-option", { value: "Relevance", label: "Relevance" }) : null))), h("div", { class: "selected-filter-wrap" }, h("div", { class: "selected-filters" }, this.selectedFilterCategory && (h("span", { class: "button", onClick: () => {
|
|
165
|
+
this.removeFilter('categories');
|
|
166
|
+
} }, this.selectedFilterCategory)), this.selectedFilterBeneficiary && (h("span", { class: "button", onClick: () => {
|
|
167
|
+
this.removeFilter('beneficiaries');
|
|
168
|
+
} }, this.selectedFilterBeneficiary)), this.selectedFilterLocation && (h("span", { class: "button", onClick: () => {
|
|
169
|
+
this.removeFilter('locations');
|
|
170
|
+
} }, this.selectedFilterLocation)), this.selectedFilterFunding && (h("span", { class: "button", onClick: () => {
|
|
171
|
+
this.removeFilter('funding');
|
|
172
|
+
} }, this.selectedFilterFunding))), h("div", { class: "clear-all" }, h("a", { onClick: this.handleClearAll }, "Clear all"))), h("div", { class: "campaign-grid" }, h("slot", { name: "campaign-grid" })))));
|
|
192
173
|
}
|
|
193
174
|
optionsToArray(options) {
|
|
194
175
|
if (typeof options === 'string') {
|
|
@@ -18,89 +18,33 @@ const BiggiveCampaignCardFilterGrid$1 = /*@__PURE__*/ proxyCustomElement(class e
|
|
|
18
18
|
this.locationsPlaceHolderText = 'Select location';
|
|
19
19
|
this.fundingPlaceHolderText = 'Select funding';
|
|
20
20
|
this.categoryFilterSelectionChanged = (value) => {
|
|
21
|
-
this.
|
|
21
|
+
this.newSelectedFilterCategory = value;
|
|
22
22
|
};
|
|
23
23
|
this.beneficiarySelectionChanged = (value) => {
|
|
24
|
-
this.
|
|
24
|
+
this.newSelectedFilterBeneficiary = value;
|
|
25
25
|
};
|
|
26
26
|
this.locationSelectionChanged = (value) => {
|
|
27
|
-
this.
|
|
27
|
+
this.newSelectedFilterLocation = value;
|
|
28
28
|
};
|
|
29
29
|
this.fundingSelectionChanged = (value) => {
|
|
30
|
-
this.
|
|
30
|
+
this.newSelectedFilterFunding = value;
|
|
31
31
|
};
|
|
32
32
|
this.sortBySelectionChanged = (value) => {
|
|
33
33
|
this.selectedSortByOption = value;
|
|
34
34
|
this.doSearchAndFilterUpdate.emit(this.getSearchAndFilterObject());
|
|
35
35
|
};
|
|
36
36
|
this.handleApplyFilterButtonClick = () => {
|
|
37
|
-
var _a, _b;
|
|
37
|
+
var _a, _b, _c, _d, _e;
|
|
38
|
+
this.selectedFilterCategory = (_a = this.newSelectedFilterCategory) !== null && _a !== void 0 ? _a : this.selectedFilterCategory;
|
|
39
|
+
this.selectedFilterBeneficiary = (_b = this.newSelectedFilterBeneficiary) !== null && _b !== void 0 ? _b : this.selectedFilterBeneficiary;
|
|
40
|
+
this.selectedFilterLocation = (_c = this.newSelectedFilterLocation) !== null && _c !== void 0 ? _c : this.selectedFilterLocation;
|
|
41
|
+
this.selectedFilterFunding = (_d = this.newSelectedFilterFunding) !== null && _d !== void 0 ? _d : this.selectedFilterFunding;
|
|
38
42
|
const searchAndFilterObj = this.getSearchAndFilterObject();
|
|
39
43
|
this.doSearchAndFilterUpdate.emit(searchAndFilterObj);
|
|
40
|
-
const filterPopup = (
|
|
44
|
+
const filterPopup = (_e = this.el.shadowRoot) === null || _e === void 0 ? void 0 : _e.getElementById('filter-popup');
|
|
41
45
|
if (filterPopup) {
|
|
42
46
|
filterPopup.closeFromOutside();
|
|
43
47
|
}
|
|
44
|
-
const selectedFilters = (_b = this.el.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('.selected-filters');
|
|
45
|
-
if (selectedFilters) {
|
|
46
|
-
selectedFilters.querySelectorAll('.button').forEach(button => {
|
|
47
|
-
button.remove();
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
let filters = {
|
|
51
|
-
beneficiaries: searchAndFilterObj.filterBeneficiary,
|
|
52
|
-
categories: searchAndFilterObj.filterCategory,
|
|
53
|
-
funding: searchAndFilterObj.filterFunding,
|
|
54
|
-
locations: searchAndFilterObj.filterLocation,
|
|
55
|
-
};
|
|
56
|
-
const keys = Object.keys(filters);
|
|
57
|
-
for (const filterKey of keys) {
|
|
58
|
-
// https://stackoverflow.com/a/69757191/2803757
|
|
59
|
-
const filterValue = filters[filterKey];
|
|
60
|
-
if (filterValue === null || filterValue.length === 0) {
|
|
61
|
-
continue;
|
|
62
|
-
}
|
|
63
|
-
let button = document.createElement('span');
|
|
64
|
-
button.classList.add('button');
|
|
65
|
-
button.dataset.id = filterKey;
|
|
66
|
-
button.innerText = filterValue;
|
|
67
|
-
if (selectedFilters) {
|
|
68
|
-
selectedFilters.appendChild(button);
|
|
69
|
-
}
|
|
70
|
-
button.addEventListener('click', () => {
|
|
71
|
-
var _a;
|
|
72
|
-
switch (filterKey) {
|
|
73
|
-
case 'beneficiaries':
|
|
74
|
-
this.selectedFilterBeneficiary = null;
|
|
75
|
-
break;
|
|
76
|
-
case 'categories':
|
|
77
|
-
this.selectedFilterCategory = null;
|
|
78
|
-
break;
|
|
79
|
-
case 'funding':
|
|
80
|
-
this.selectedFilterFunding = null;
|
|
81
|
-
break;
|
|
82
|
-
case 'locations':
|
|
83
|
-
this.selectedFilterLocation = null;
|
|
84
|
-
break;
|
|
85
|
-
default:
|
|
86
|
-
// This asks the compiler to check that we are in dead code, i.e. we covered all the possible filter keys
|
|
87
|
-
// above. If we missed one we would get a compile error trying to assign a string to a never.
|
|
88
|
-
const exhaustiveSwitch = filterKey;
|
|
89
|
-
console.error(exhaustiveSwitch);
|
|
90
|
-
}
|
|
91
|
-
button.remove();
|
|
92
|
-
this.doSearchAndFilterUpdate.emit(this.getSearchAndFilterObject());
|
|
93
|
-
if (button.dataset.id === undefined) {
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
const selectEl = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById(button.dataset.id);
|
|
97
|
-
if (!selectEl) {
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
selectEl.selectedLabel = null;
|
|
101
|
-
selectEl.selectedValue = null;
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
48
|
this.filtersApplied =
|
|
105
49
|
typeof searchAndFilterObj.filterBeneficiary === 'string' ||
|
|
106
50
|
typeof searchAndFilterObj.filterCategory === 'string' ||
|
|
@@ -188,6 +132,35 @@ const BiggiveCampaignCardFilterGrid$1 = /*@__PURE__*/ proxyCustomElement(class e
|
|
|
188
132
|
filterLocation: this.selectedFilterLocation,
|
|
189
133
|
};
|
|
190
134
|
}
|
|
135
|
+
removeFilter(filterKey) {
|
|
136
|
+
var _a;
|
|
137
|
+
switch (filterKey) {
|
|
138
|
+
case 'beneficiaries':
|
|
139
|
+
this.selectedFilterBeneficiary = null;
|
|
140
|
+
break;
|
|
141
|
+
case 'categories':
|
|
142
|
+
this.selectedFilterCategory = null;
|
|
143
|
+
break;
|
|
144
|
+
case 'funding':
|
|
145
|
+
this.selectedFilterFunding = null;
|
|
146
|
+
break;
|
|
147
|
+
case 'locations':
|
|
148
|
+
this.selectedFilterLocation = null;
|
|
149
|
+
break;
|
|
150
|
+
default:
|
|
151
|
+
// This asks the compiler to check that we are in dead code, i.e. we covered all the possible filter keys
|
|
152
|
+
// above. If we missed one we would get a compile error trying to assign a string to a never.
|
|
153
|
+
const exhaustiveSwitch = filterKey;
|
|
154
|
+
console.error(exhaustiveSwitch);
|
|
155
|
+
}
|
|
156
|
+
const selectEl = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById(filterKey);
|
|
157
|
+
if (!selectEl) {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
selectEl.selectedLabel = null;
|
|
161
|
+
selectEl.selectedValue = null;
|
|
162
|
+
this.doSearchAndFilterUpdate.emit(this.getSearchAndFilterObject());
|
|
163
|
+
}
|
|
191
164
|
componentWillRender() {
|
|
192
165
|
this.filtersApplied =
|
|
193
166
|
this.selectedFilterCategory !== null || this.selectedFilterBeneficiary !== null || this.selectedFilterFunding !== null || this.selectedFilterLocation !== null;
|
|
@@ -195,10 +168,18 @@ const BiggiveCampaignCardFilterGrid$1 = /*@__PURE__*/ proxyCustomElement(class e
|
|
|
195
168
|
}
|
|
196
169
|
render() {
|
|
197
170
|
var _a;
|
|
198
|
-
return (h("div", { class: 'container space-below-' + this.spaceBelow }, h("div", { class: "sleeve" }, h("div", { class: "search-wrap" }, h("h4", null, this.intro), h("div", { class: "field-wrap" }, h("div", { class: "input-wrap" }, h("svg", { xmlns: "http://www.w3.org/2000/svg", class: "icon", viewBox: "0 0 512 512" }, h("path", { d: faMagnifyingGlass.icon[4].toString() })), h("input", { type: "text", value: (_a = this.searchText) !== null && _a !== void 0 ? _a : '', class: "input-text", placeholder: this.placeholderText, onInput: this.handleSearchTextChanged, onKeyDown: this.handleEnterPressed })), h("biggive-button", { onClick: this.handleSearchButtonPressed, label: this.buttonText }))), h("div", { class: "sort-filter-wrap" }, h("div", { class: "filter-wrap" }, h("biggive-button", { class: "filter", colourScheme: "primary", onClick: this.handleFilterButtonClick, label: "Filter", fullWidth: true, "space-below": "0" }), h("biggive-popup", { id: "filter-popup" }, h("h4", { class: "space-above-0 space-below-3 text-colour-primary" }, "Filters"), h("div", { class: "select-wrapper-1" }, h("biggive-form-field-select", { backgroundColour: "white", prompt: "Category", placeholder: this.categoriesPlaceHolderText, selectedLabel: this.selectedFilterCategory, options: this.optionsToArray(this.categoryOptions || []), selectionChanged: this.categoryFilterSelectionChanged, id: "categories", "space-below": "2" })), h("div", { class: "select-wrapper-2" }, h("biggive-form-field-select", { backgroundColour: "white", prompt: "Beneficiary", placeholder: this.beneficiariesPlaceHolderText, selectedLabel: this.selectedFilterBeneficiary, options: this.optionsToArray(this.beneficiaryOptions || []), selectionChanged: this.beneficiarySelectionChanged, id: "beneficiaries", "space-below": "2" })), h("div", { class: "select-wrapper-3" }, h("biggive-form-field-select", { backgroundColour: "white", prompt: "Location", placeholder: this.locationsPlaceHolderText, selectedLabel: this.selectedFilterLocation, options: this.optionsToArray(this.locationOptions || []), selectionChanged: this.locationSelectionChanged, id: "locations", "space-below": "2" })), h("div", { class: "select-wrapper-4" }, h("biggive-form-field-select", { backgroundColour: "white", prompt: "Funding", placeholder: this.fundingPlaceHolderText, selectedLabel: this.selectedFilterFunding, options: this.optionsToArray(this.fundingOptions || []), selectionChanged: this.fundingSelectionChanged, id: "funding", "space-below": "2" })), h("div", { class: "align-right" }, h("biggive-button", { label: "Apply filters", onClick: this.handleApplyFilterButtonClick })))), h("div", { class: "sort-wrap" }, h("biggive-form-field-select", { options: [
|
|
171
|
+
return (h("div", { class: 'container space-below-' + this.spaceBelow }, h("div", { class: "sleeve" }, h("div", { class: "search-wrap" }, h("h4", null, this.intro), h("div", { class: "field-wrap" }, h("div", { class: "input-wrap" }, h("svg", { xmlns: "http://www.w3.org/2000/svg", class: "icon", viewBox: "0 0 512 512" }, h("path", { d: faMagnifyingGlass.icon[4].toString() })), h("input", { type: "text", value: (_a = this.searchText) !== null && _a !== void 0 ? _a : '', class: "input-text", placeholder: this.placeholderText, onInput: this.handleSearchTextChanged, onKeyDown: this.handleEnterPressed })), h("biggive-button", { onClick: this.handleSearchButtonPressed, label: this.buttonText }))), h("div", { class: "sort-filter-wrap" }, h("div", { class: "filter-wrap" }, h("biggive-button", { class: "filter", colourScheme: "primary", onClick: this.handleFilterButtonClick, label: "Filter", fullWidth: true, "space-below": "0" }), h("biggive-popup", { id: "filter-popup" }, h("h4", { class: "space-above-0 space-below-3 text-colour-primary" }, "Filters"), h("div", { class: "select-wrapper-1" }, h("biggive-form-field-select", { backgroundColour: "white", prompt: "Category", placeholder: this.categoriesPlaceHolderText, selectedLabel: this.selectedFilterCategory, selectedValue: this.selectedFilterCategory, options: this.optionsToArray(this.categoryOptions || []), selectionChanged: this.categoryFilterSelectionChanged, id: "categories", "space-below": "2" })), h("div", { class: "select-wrapper-2" }, h("biggive-form-field-select", { backgroundColour: "white", prompt: "Beneficiary", placeholder: this.beneficiariesPlaceHolderText, selectedLabel: this.selectedFilterBeneficiary, selectedValue: this.selectedFilterBeneficiary, options: this.optionsToArray(this.beneficiaryOptions || []), selectionChanged: this.beneficiarySelectionChanged, id: "beneficiaries", "space-below": "2" })), h("div", { class: "select-wrapper-3" }, h("biggive-form-field-select", { backgroundColour: "white", prompt: "Location", placeholder: this.locationsPlaceHolderText, selectedLabel: this.selectedFilterLocation, selectedValue: this.selectedFilterLocation, options: this.optionsToArray(this.locationOptions || []), selectionChanged: this.locationSelectionChanged, id: "locations", "space-below": "2" })), h("div", { class: "select-wrapper-4" }, h("biggive-form-field-select", { backgroundColour: "white", prompt: "Funding", placeholder: this.fundingPlaceHolderText, selectedLabel: this.selectedFilterFunding, selectedValue: this.selectedFilterFunding, options: this.optionsToArray(this.fundingOptions || []), selectionChanged: this.fundingSelectionChanged, id: "funding", "space-below": "2" })), h("div", { class: "align-right" }, h("biggive-button", { label: "Apply filters", onClick: this.handleApplyFilterButtonClick })))), h("div", { class: "sort-wrap" }, h("biggive-form-field-select", { options: [
|
|
199
172
|
{ value: 'amountRaised', label: 'Most raised' },
|
|
200
173
|
{ value: 'matchFundsRemaining', label: 'Match funds remaining' },
|
|
201
|
-
], prompt: null, "select-style": "underlined", placeholder: this.sortByPlaceholderText, selectedLabel: this.selectedSortByOption, selectionChanged: this.sortBySelectionChanged, id: "sort-by" }, h("biggive-form-field-select-option", { value: "amountRaised", label: "Most raised" }), h("biggive-form-field-select-option", { value: "matchFundsRemaining", label: "Match funds remaining" }), (this.searchText || '').length > 0 ? h("biggive-form-field-select-option", { value: "Relevance", label: "Relevance" }) : null))), h("div", { class: "selected-filter-wrap" }, h("div", { class: "selected-filters" }
|
|
174
|
+
], prompt: null, "select-style": "underlined", placeholder: this.sortByPlaceholderText, selectedLabel: this.selectedSortByOption, selectionChanged: this.sortBySelectionChanged, id: "sort-by" }, h("biggive-form-field-select-option", { value: "amountRaised", label: "Most raised" }), h("biggive-form-field-select-option", { value: "matchFundsRemaining", label: "Match funds remaining" }), (this.searchText || '').length > 0 ? h("biggive-form-field-select-option", { value: "Relevance", label: "Relevance" }) : null))), h("div", { class: "selected-filter-wrap" }, h("div", { class: "selected-filters" }, this.selectedFilterCategory && (h("span", { class: "button", onClick: () => {
|
|
175
|
+
this.removeFilter('categories');
|
|
176
|
+
} }, this.selectedFilterCategory)), this.selectedFilterBeneficiary && (h("span", { class: "button", onClick: () => {
|
|
177
|
+
this.removeFilter('beneficiaries');
|
|
178
|
+
} }, this.selectedFilterBeneficiary)), this.selectedFilterLocation && (h("span", { class: "button", onClick: () => {
|
|
179
|
+
this.removeFilter('locations');
|
|
180
|
+
} }, this.selectedFilterLocation)), this.selectedFilterFunding && (h("span", { class: "button", onClick: () => {
|
|
181
|
+
this.removeFilter('funding');
|
|
182
|
+
} }, this.selectedFilterFunding))), h("div", { class: "clear-all" }, h("a", { onClick: this.handleClearAll }, "Clear all"))), h("div", { class: "campaign-grid" }, h("slot", { name: "campaign-grid" })))));
|
|
202
183
|
}
|
|
203
184
|
optionsToArray(options) {
|
|
204
185
|
if (typeof options === 'string') {
|