@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
|
@@ -289,89 +289,33 @@ const BiggiveCampaignCardFilterGrid = class {
|
|
|
289
289
|
this.locationsPlaceHolderText = 'Select location';
|
|
290
290
|
this.fundingPlaceHolderText = 'Select funding';
|
|
291
291
|
this.categoryFilterSelectionChanged = (value) => {
|
|
292
|
-
this.
|
|
292
|
+
this.newSelectedFilterCategory = value;
|
|
293
293
|
};
|
|
294
294
|
this.beneficiarySelectionChanged = (value) => {
|
|
295
|
-
this.
|
|
295
|
+
this.newSelectedFilterBeneficiary = value;
|
|
296
296
|
};
|
|
297
297
|
this.locationSelectionChanged = (value) => {
|
|
298
|
-
this.
|
|
298
|
+
this.newSelectedFilterLocation = value;
|
|
299
299
|
};
|
|
300
300
|
this.fundingSelectionChanged = (value) => {
|
|
301
|
-
this.
|
|
301
|
+
this.newSelectedFilterFunding = value;
|
|
302
302
|
};
|
|
303
303
|
this.sortBySelectionChanged = (value) => {
|
|
304
304
|
this.selectedSortByOption = value;
|
|
305
305
|
this.doSearchAndFilterUpdate.emit(this.getSearchAndFilterObject());
|
|
306
306
|
};
|
|
307
307
|
this.handleApplyFilterButtonClick = () => {
|
|
308
|
-
var _a, _b;
|
|
308
|
+
var _a, _b, _c, _d, _e;
|
|
309
|
+
this.selectedFilterCategory = (_a = this.newSelectedFilterCategory) !== null && _a !== void 0 ? _a : this.selectedFilterCategory;
|
|
310
|
+
this.selectedFilterBeneficiary = (_b = this.newSelectedFilterBeneficiary) !== null && _b !== void 0 ? _b : this.selectedFilterBeneficiary;
|
|
311
|
+
this.selectedFilterLocation = (_c = this.newSelectedFilterLocation) !== null && _c !== void 0 ? _c : this.selectedFilterLocation;
|
|
312
|
+
this.selectedFilterFunding = (_d = this.newSelectedFilterFunding) !== null && _d !== void 0 ? _d : this.selectedFilterFunding;
|
|
309
313
|
const searchAndFilterObj = this.getSearchAndFilterObject();
|
|
310
314
|
this.doSearchAndFilterUpdate.emit(searchAndFilterObj);
|
|
311
|
-
const filterPopup = (
|
|
315
|
+
const filterPopup = (_e = this.el.shadowRoot) === null || _e === void 0 ? void 0 : _e.getElementById('filter-popup');
|
|
312
316
|
if (filterPopup) {
|
|
313
317
|
filterPopup.closeFromOutside();
|
|
314
318
|
}
|
|
315
|
-
const selectedFilters = (_b = this.el.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('.selected-filters');
|
|
316
|
-
if (selectedFilters) {
|
|
317
|
-
selectedFilters.querySelectorAll('.button').forEach(button => {
|
|
318
|
-
button.remove();
|
|
319
|
-
});
|
|
320
|
-
}
|
|
321
|
-
let filters = {
|
|
322
|
-
beneficiaries: searchAndFilterObj.filterBeneficiary,
|
|
323
|
-
categories: searchAndFilterObj.filterCategory,
|
|
324
|
-
funding: searchAndFilterObj.filterFunding,
|
|
325
|
-
locations: searchAndFilterObj.filterLocation,
|
|
326
|
-
};
|
|
327
|
-
const keys = Object.keys(filters);
|
|
328
|
-
for (const filterKey of keys) {
|
|
329
|
-
// https://stackoverflow.com/a/69757191/2803757
|
|
330
|
-
const filterValue = filters[filterKey];
|
|
331
|
-
if (filterValue === null || filterValue.length === 0) {
|
|
332
|
-
continue;
|
|
333
|
-
}
|
|
334
|
-
let button = document.createElement('span');
|
|
335
|
-
button.classList.add('button');
|
|
336
|
-
button.dataset.id = filterKey;
|
|
337
|
-
button.innerText = filterValue;
|
|
338
|
-
if (selectedFilters) {
|
|
339
|
-
selectedFilters.appendChild(button);
|
|
340
|
-
}
|
|
341
|
-
button.addEventListener('click', () => {
|
|
342
|
-
var _a;
|
|
343
|
-
switch (filterKey) {
|
|
344
|
-
case 'beneficiaries':
|
|
345
|
-
this.selectedFilterBeneficiary = null;
|
|
346
|
-
break;
|
|
347
|
-
case 'categories':
|
|
348
|
-
this.selectedFilterCategory = null;
|
|
349
|
-
break;
|
|
350
|
-
case 'funding':
|
|
351
|
-
this.selectedFilterFunding = null;
|
|
352
|
-
break;
|
|
353
|
-
case 'locations':
|
|
354
|
-
this.selectedFilterLocation = null;
|
|
355
|
-
break;
|
|
356
|
-
default:
|
|
357
|
-
// This asks the compiler to check that we are in dead code, i.e. we covered all the possible filter keys
|
|
358
|
-
// above. If we missed one we would get a compile error trying to assign a string to a never.
|
|
359
|
-
const exhaustiveSwitch = filterKey;
|
|
360
|
-
console.error(exhaustiveSwitch);
|
|
361
|
-
}
|
|
362
|
-
button.remove();
|
|
363
|
-
this.doSearchAndFilterUpdate.emit(this.getSearchAndFilterObject());
|
|
364
|
-
if (button.dataset.id === undefined) {
|
|
365
|
-
return;
|
|
366
|
-
}
|
|
367
|
-
const selectEl = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById(button.dataset.id);
|
|
368
|
-
if (!selectEl) {
|
|
369
|
-
return;
|
|
370
|
-
}
|
|
371
|
-
selectEl.selectedLabel = null;
|
|
372
|
-
selectEl.selectedValue = null;
|
|
373
|
-
});
|
|
374
|
-
}
|
|
375
319
|
this.filtersApplied =
|
|
376
320
|
typeof searchAndFilterObj.filterBeneficiary === 'string' ||
|
|
377
321
|
typeof searchAndFilterObj.filterCategory === 'string' ||
|
|
@@ -459,6 +403,35 @@ const BiggiveCampaignCardFilterGrid = class {
|
|
|
459
403
|
filterLocation: this.selectedFilterLocation,
|
|
460
404
|
};
|
|
461
405
|
}
|
|
406
|
+
removeFilter(filterKey) {
|
|
407
|
+
var _a;
|
|
408
|
+
switch (filterKey) {
|
|
409
|
+
case 'beneficiaries':
|
|
410
|
+
this.selectedFilterBeneficiary = null;
|
|
411
|
+
break;
|
|
412
|
+
case 'categories':
|
|
413
|
+
this.selectedFilterCategory = null;
|
|
414
|
+
break;
|
|
415
|
+
case 'funding':
|
|
416
|
+
this.selectedFilterFunding = null;
|
|
417
|
+
break;
|
|
418
|
+
case 'locations':
|
|
419
|
+
this.selectedFilterLocation = null;
|
|
420
|
+
break;
|
|
421
|
+
default:
|
|
422
|
+
// This asks the compiler to check that we are in dead code, i.e. we covered all the possible filter keys
|
|
423
|
+
// above. If we missed one we would get a compile error trying to assign a string to a never.
|
|
424
|
+
const exhaustiveSwitch = filterKey;
|
|
425
|
+
console.error(exhaustiveSwitch);
|
|
426
|
+
}
|
|
427
|
+
const selectEl = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById(filterKey);
|
|
428
|
+
if (!selectEl) {
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
selectEl.selectedLabel = null;
|
|
432
|
+
selectEl.selectedValue = null;
|
|
433
|
+
this.doSearchAndFilterUpdate.emit(this.getSearchAndFilterObject());
|
|
434
|
+
}
|
|
462
435
|
componentWillRender() {
|
|
463
436
|
this.filtersApplied =
|
|
464
437
|
this.selectedFilterCategory !== null || this.selectedFilterBeneficiary !== null || this.selectedFilterFunding !== null || this.selectedFilterLocation !== null;
|
|
@@ -466,10 +439,18 @@ const BiggiveCampaignCardFilterGrid = class {
|
|
|
466
439
|
}
|
|
467
440
|
render() {
|
|
468
441
|
var _a;
|
|
469
|
-
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: [
|
|
442
|
+
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: [
|
|
470
443
|
{ value: 'amountRaised', label: 'Most raised' },
|
|
471
444
|
{ value: 'matchFundsRemaining', label: 'Match funds remaining' },
|
|
472
|
-
], 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" }
|
|
445
|
+
], 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: () => {
|
|
446
|
+
this.removeFilter('categories');
|
|
447
|
+
} }, this.selectedFilterCategory)), this.selectedFilterBeneficiary && (h("span", { class: "button", onClick: () => {
|
|
448
|
+
this.removeFilter('beneficiaries');
|
|
449
|
+
} }, this.selectedFilterBeneficiary)), this.selectedFilterLocation && (h("span", { class: "button", onClick: () => {
|
|
450
|
+
this.removeFilter('locations');
|
|
451
|
+
} }, this.selectedFilterLocation)), this.selectedFilterFunding && (h("span", { class: "button", onClick: () => {
|
|
452
|
+
this.removeFilter('funding');
|
|
453
|
+
} }, this.selectedFilterFunding))), h("div", { class: "clear-all" }, h("a", { onClick: this.handleClearAll }, "Clear all"))), h("div", { class: "campaign-grid" }, h("slot", { name: "campaign-grid" })))));
|
|
473
454
|
}
|
|
474
455
|
optionsToArray(options) {
|
|
475
456
|
if (typeof options === 'string') {
|
|
@@ -89,6 +89,13 @@ export declare class BiggiveCampaignCardFilterGrid {
|
|
|
89
89
|
*/
|
|
90
90
|
filtersApplied: boolean;
|
|
91
91
|
private initialSortByOption;
|
|
92
|
+
/**
|
|
93
|
+
* This and similar properties represent selections made in the popup but not yet applied.
|
|
94
|
+
*/
|
|
95
|
+
private newSelectedFilterCategory;
|
|
96
|
+
private newSelectedFilterBeneficiary;
|
|
97
|
+
private newSelectedFilterLocation;
|
|
98
|
+
private newSelectedFilterFunding;
|
|
92
99
|
private categoryFilterSelectionChanged;
|
|
93
100
|
private beneficiarySelectionChanged;
|
|
94
101
|
private locationSelectionChanged;
|
|
@@ -96,6 +103,7 @@ export declare class BiggiveCampaignCardFilterGrid {
|
|
|
96
103
|
private sortBySelectionChanged;
|
|
97
104
|
private getSearchAndFilterObject;
|
|
98
105
|
private handleApplyFilterButtonClick;
|
|
106
|
+
private removeFilter;
|
|
99
107
|
private handleSearchButtonPressed;
|
|
100
108
|
private handleSearchTextChanged;
|
|
101
109
|
private handleEnterPressed;
|
package/hydrate/index.js
CHANGED
|
@@ -6792,89 +6792,33 @@ class BiggiveCampaignCardFilterGrid {
|
|
|
6792
6792
|
this.locationsPlaceHolderText = 'Select location';
|
|
6793
6793
|
this.fundingPlaceHolderText = 'Select funding';
|
|
6794
6794
|
this.categoryFilterSelectionChanged = (value) => {
|
|
6795
|
-
this.
|
|
6795
|
+
this.newSelectedFilterCategory = value;
|
|
6796
6796
|
};
|
|
6797
6797
|
this.beneficiarySelectionChanged = (value) => {
|
|
6798
|
-
this.
|
|
6798
|
+
this.newSelectedFilterBeneficiary = value;
|
|
6799
6799
|
};
|
|
6800
6800
|
this.locationSelectionChanged = (value) => {
|
|
6801
|
-
this.
|
|
6801
|
+
this.newSelectedFilterLocation = value;
|
|
6802
6802
|
};
|
|
6803
6803
|
this.fundingSelectionChanged = (value) => {
|
|
6804
|
-
this.
|
|
6804
|
+
this.newSelectedFilterFunding = value;
|
|
6805
6805
|
};
|
|
6806
6806
|
this.sortBySelectionChanged = (value) => {
|
|
6807
6807
|
this.selectedSortByOption = value;
|
|
6808
6808
|
this.doSearchAndFilterUpdate.emit(this.getSearchAndFilterObject());
|
|
6809
6809
|
};
|
|
6810
6810
|
this.handleApplyFilterButtonClick = () => {
|
|
6811
|
-
var _a, _b;
|
|
6811
|
+
var _a, _b, _c, _d, _e;
|
|
6812
|
+
this.selectedFilterCategory = (_a = this.newSelectedFilterCategory) !== null && _a !== void 0 ? _a : this.selectedFilterCategory;
|
|
6813
|
+
this.selectedFilterBeneficiary = (_b = this.newSelectedFilterBeneficiary) !== null && _b !== void 0 ? _b : this.selectedFilterBeneficiary;
|
|
6814
|
+
this.selectedFilterLocation = (_c = this.newSelectedFilterLocation) !== null && _c !== void 0 ? _c : this.selectedFilterLocation;
|
|
6815
|
+
this.selectedFilterFunding = (_d = this.newSelectedFilterFunding) !== null && _d !== void 0 ? _d : this.selectedFilterFunding;
|
|
6812
6816
|
const searchAndFilterObj = this.getSearchAndFilterObject();
|
|
6813
6817
|
this.doSearchAndFilterUpdate.emit(searchAndFilterObj);
|
|
6814
|
-
const filterPopup = (
|
|
6818
|
+
const filterPopup = (_e = this.el.shadowRoot) === null || _e === void 0 ? void 0 : _e.getElementById('filter-popup');
|
|
6815
6819
|
if (filterPopup) {
|
|
6816
6820
|
filterPopup.closeFromOutside();
|
|
6817
6821
|
}
|
|
6818
|
-
const selectedFilters = (_b = this.el.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('.selected-filters');
|
|
6819
|
-
if (selectedFilters) {
|
|
6820
|
-
selectedFilters.querySelectorAll('.button').forEach(button => {
|
|
6821
|
-
button.remove();
|
|
6822
|
-
});
|
|
6823
|
-
}
|
|
6824
|
-
let filters = {
|
|
6825
|
-
beneficiaries: searchAndFilterObj.filterBeneficiary,
|
|
6826
|
-
categories: searchAndFilterObj.filterCategory,
|
|
6827
|
-
funding: searchAndFilterObj.filterFunding,
|
|
6828
|
-
locations: searchAndFilterObj.filterLocation,
|
|
6829
|
-
};
|
|
6830
|
-
const keys = Object.keys(filters);
|
|
6831
|
-
for (const filterKey of keys) {
|
|
6832
|
-
// https://stackoverflow.com/a/69757191/2803757
|
|
6833
|
-
const filterValue = filters[filterKey];
|
|
6834
|
-
if (filterValue === null || filterValue.length === 0) {
|
|
6835
|
-
continue;
|
|
6836
|
-
}
|
|
6837
|
-
let button = document.createElement('span');
|
|
6838
|
-
button.classList.add('button');
|
|
6839
|
-
button.dataset.id = filterKey;
|
|
6840
|
-
button.innerText = filterValue;
|
|
6841
|
-
if (selectedFilters) {
|
|
6842
|
-
selectedFilters.appendChild(button);
|
|
6843
|
-
}
|
|
6844
|
-
button.addEventListener('click', () => {
|
|
6845
|
-
var _a;
|
|
6846
|
-
switch (filterKey) {
|
|
6847
|
-
case 'beneficiaries':
|
|
6848
|
-
this.selectedFilterBeneficiary = null;
|
|
6849
|
-
break;
|
|
6850
|
-
case 'categories':
|
|
6851
|
-
this.selectedFilterCategory = null;
|
|
6852
|
-
break;
|
|
6853
|
-
case 'funding':
|
|
6854
|
-
this.selectedFilterFunding = null;
|
|
6855
|
-
break;
|
|
6856
|
-
case 'locations':
|
|
6857
|
-
this.selectedFilterLocation = null;
|
|
6858
|
-
break;
|
|
6859
|
-
default:
|
|
6860
|
-
// This asks the compiler to check that we are in dead code, i.e. we covered all the possible filter keys
|
|
6861
|
-
// above. If we missed one we would get a compile error trying to assign a string to a never.
|
|
6862
|
-
const exhaustiveSwitch = filterKey;
|
|
6863
|
-
console.error(exhaustiveSwitch);
|
|
6864
|
-
}
|
|
6865
|
-
button.remove();
|
|
6866
|
-
this.doSearchAndFilterUpdate.emit(this.getSearchAndFilterObject());
|
|
6867
|
-
if (button.dataset.id === undefined) {
|
|
6868
|
-
return;
|
|
6869
|
-
}
|
|
6870
|
-
const selectEl = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById(button.dataset.id);
|
|
6871
|
-
if (!selectEl) {
|
|
6872
|
-
return;
|
|
6873
|
-
}
|
|
6874
|
-
selectEl.selectedLabel = null;
|
|
6875
|
-
selectEl.selectedValue = null;
|
|
6876
|
-
});
|
|
6877
|
-
}
|
|
6878
6822
|
this.filtersApplied =
|
|
6879
6823
|
typeof searchAndFilterObj.filterBeneficiary === 'string' ||
|
|
6880
6824
|
typeof searchAndFilterObj.filterCategory === 'string' ||
|
|
@@ -6962,6 +6906,35 @@ class BiggiveCampaignCardFilterGrid {
|
|
|
6962
6906
|
filterLocation: this.selectedFilterLocation,
|
|
6963
6907
|
};
|
|
6964
6908
|
}
|
|
6909
|
+
removeFilter(filterKey) {
|
|
6910
|
+
var _a;
|
|
6911
|
+
switch (filterKey) {
|
|
6912
|
+
case 'beneficiaries':
|
|
6913
|
+
this.selectedFilterBeneficiary = null;
|
|
6914
|
+
break;
|
|
6915
|
+
case 'categories':
|
|
6916
|
+
this.selectedFilterCategory = null;
|
|
6917
|
+
break;
|
|
6918
|
+
case 'funding':
|
|
6919
|
+
this.selectedFilterFunding = null;
|
|
6920
|
+
break;
|
|
6921
|
+
case 'locations':
|
|
6922
|
+
this.selectedFilterLocation = null;
|
|
6923
|
+
break;
|
|
6924
|
+
default:
|
|
6925
|
+
// This asks the compiler to check that we are in dead code, i.e. we covered all the possible filter keys
|
|
6926
|
+
// above. If we missed one we would get a compile error trying to assign a string to a never.
|
|
6927
|
+
const exhaustiveSwitch = filterKey;
|
|
6928
|
+
console.error(exhaustiveSwitch);
|
|
6929
|
+
}
|
|
6930
|
+
const selectEl = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById(filterKey);
|
|
6931
|
+
if (!selectEl) {
|
|
6932
|
+
return;
|
|
6933
|
+
}
|
|
6934
|
+
selectEl.selectedLabel = null;
|
|
6935
|
+
selectEl.selectedValue = null;
|
|
6936
|
+
this.doSearchAndFilterUpdate.emit(this.getSearchAndFilterObject());
|
|
6937
|
+
}
|
|
6965
6938
|
componentWillRender() {
|
|
6966
6939
|
this.filtersApplied =
|
|
6967
6940
|
this.selectedFilterCategory !== null || this.selectedFilterBeneficiary !== null || this.selectedFilterFunding !== null || this.selectedFilterLocation !== null;
|
|
@@ -6969,10 +6942,18 @@ class BiggiveCampaignCardFilterGrid {
|
|
|
6969
6942
|
}
|
|
6970
6943
|
render() {
|
|
6971
6944
|
var _a;
|
|
6972
|
-
return (hAsync("div", { class: 'container space-below-' + this.spaceBelow }, hAsync("div", { class: "sleeve" }, hAsync("div", { class: "search-wrap" }, hAsync("h4", null, this.intro), hAsync("div", { class: "field-wrap" }, hAsync("div", { class: "input-wrap" }, hAsync("svg", { xmlns: "http://www.w3.org/2000/svg", class: "icon", viewBox: "0 0 512 512" }, hAsync("path", { d: faMagnifyingGlass.icon[4].toString() })), hAsync("input", { type: "text", value: (_a = this.searchText) !== null && _a !== void 0 ? _a : '', class: "input-text", placeholder: this.placeholderText, onInput: this.handleSearchTextChanged, onKeyDown: this.handleEnterPressed })), hAsync("biggive-button", { onClick: this.handleSearchButtonPressed, label: this.buttonText }))), hAsync("div", { class: "sort-filter-wrap" }, hAsync("div", { class: "filter-wrap" }, hAsync("biggive-button", { class: "filter", colourScheme: "primary", onClick: this.handleFilterButtonClick, label: "Filter", fullWidth: true, "space-below": "0" }), hAsync("biggive-popup", { id: "filter-popup" }, hAsync("h4", { class: "space-above-0 space-below-3 text-colour-primary" }, "Filters"), hAsync("div", { class: "select-wrapper-1" }, hAsync("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" })), hAsync("div", { class: "select-wrapper-2" }, hAsync("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" })), hAsync("div", { class: "select-wrapper-3" }, hAsync("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" })), hAsync("div", { class: "select-wrapper-4" }, hAsync("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" })), hAsync("div", { class: "align-right" }, hAsync("biggive-button", { label: "Apply filters", onClick: this.handleApplyFilterButtonClick })))), hAsync("div", { class: "sort-wrap" }, hAsync("biggive-form-field-select", { options: [
|
|
6945
|
+
return (hAsync("div", { class: 'container space-below-' + this.spaceBelow }, hAsync("div", { class: "sleeve" }, hAsync("div", { class: "search-wrap" }, hAsync("h4", null, this.intro), hAsync("div", { class: "field-wrap" }, hAsync("div", { class: "input-wrap" }, hAsync("svg", { xmlns: "http://www.w3.org/2000/svg", class: "icon", viewBox: "0 0 512 512" }, hAsync("path", { d: faMagnifyingGlass.icon[4].toString() })), hAsync("input", { type: "text", value: (_a = this.searchText) !== null && _a !== void 0 ? _a : '', class: "input-text", placeholder: this.placeholderText, onInput: this.handleSearchTextChanged, onKeyDown: this.handleEnterPressed })), hAsync("biggive-button", { onClick: this.handleSearchButtonPressed, label: this.buttonText }))), hAsync("div", { class: "sort-filter-wrap" }, hAsync("div", { class: "filter-wrap" }, hAsync("biggive-button", { class: "filter", colourScheme: "primary", onClick: this.handleFilterButtonClick, label: "Filter", fullWidth: true, "space-below": "0" }), hAsync("biggive-popup", { id: "filter-popup" }, hAsync("h4", { class: "space-above-0 space-below-3 text-colour-primary" }, "Filters"), hAsync("div", { class: "select-wrapper-1" }, hAsync("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" })), hAsync("div", { class: "select-wrapper-2" }, hAsync("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" })), hAsync("div", { class: "select-wrapper-3" }, hAsync("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" })), hAsync("div", { class: "select-wrapper-4" }, hAsync("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" })), hAsync("div", { class: "align-right" }, hAsync("biggive-button", { label: "Apply filters", onClick: this.handleApplyFilterButtonClick })))), hAsync("div", { class: "sort-wrap" }, hAsync("biggive-form-field-select", { options: [
|
|
6973
6946
|
{ value: 'amountRaised', label: 'Most raised' },
|
|
6974
6947
|
{ value: 'matchFundsRemaining', label: 'Match funds remaining' },
|
|
6975
|
-
], prompt: null, "select-style": "underlined", placeholder: this.sortByPlaceholderText, selectedLabel: this.selectedSortByOption, selectionChanged: this.sortBySelectionChanged, id: "sort-by" }, hAsync("biggive-form-field-select-option", { value: "amountRaised", label: "Most raised" }), hAsync("biggive-form-field-select-option", { value: "matchFundsRemaining", label: "Match funds remaining" }), (this.searchText || '').length > 0 ? hAsync("biggive-form-field-select-option", { value: "Relevance", label: "Relevance" }) : null))), hAsync("div", { class: "selected-filter-wrap" }, hAsync("div", { class: "selected-filters" }
|
|
6948
|
+
], prompt: null, "select-style": "underlined", placeholder: this.sortByPlaceholderText, selectedLabel: this.selectedSortByOption, selectionChanged: this.sortBySelectionChanged, id: "sort-by" }, hAsync("biggive-form-field-select-option", { value: "amountRaised", label: "Most raised" }), hAsync("biggive-form-field-select-option", { value: "matchFundsRemaining", label: "Match funds remaining" }), (this.searchText || '').length > 0 ? hAsync("biggive-form-field-select-option", { value: "Relevance", label: "Relevance" }) : null))), hAsync("div", { class: "selected-filter-wrap" }, hAsync("div", { class: "selected-filters" }, this.selectedFilterCategory && (hAsync("span", { class: "button", onClick: () => {
|
|
6949
|
+
this.removeFilter('categories');
|
|
6950
|
+
} }, this.selectedFilterCategory)), this.selectedFilterBeneficiary && (hAsync("span", { class: "button", onClick: () => {
|
|
6951
|
+
this.removeFilter('beneficiaries');
|
|
6952
|
+
} }, this.selectedFilterBeneficiary)), this.selectedFilterLocation && (hAsync("span", { class: "button", onClick: () => {
|
|
6953
|
+
this.removeFilter('locations');
|
|
6954
|
+
} }, this.selectedFilterLocation)), this.selectedFilterFunding && (hAsync("span", { class: "button", onClick: () => {
|
|
6955
|
+
this.removeFilter('funding');
|
|
6956
|
+
} }, this.selectedFilterFunding))), hAsync("div", { class: "clear-all" }, hAsync("a", { onClick: this.handleClearAll }, "Clear all"))), hAsync("div", { class: "campaign-grid" }, hAsync("slot", { name: "campaign-grid" })))));
|
|
6976
6957
|
}
|
|
6977
6958
|
optionsToArray(options) {
|
|
6978
6959
|
if (typeof options === 'string') {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@biggive/components",
|
|
3
3
|
"_comment": "Version number below is automatically replaced during CircleCI build.",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "202311211301.0.0",
|
|
5
5
|
"description": "Big Give Components",
|
|
6
6
|
"main": "dist/index.cjs.js",
|
|
7
7
|
"module": "dist/index.js",
|