@hestia-earth/ui-components 0.41.51 → 0.41.52

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.
@@ -6582,14 +6582,37 @@ class CyclesEmissionsCategoryService {
6582
6582
  constructor() {
6583
6583
  this.data = loadResourceKey('emission-groupings.json');
6584
6584
  this.categoryLabel = (key) => (key ? keyToLabel(key.replace(/category/gi, '')) : 'Unset');
6585
+ /**
6586
+ * The list of all available categories.
6587
+ */
6585
6588
  this.categories = Object.keys(this.data)
6586
6589
  .filter(key => key.toLowerCase().endsWith('category'))
6587
6590
  .map(key => ({
6588
6591
  key,
6589
6592
  label: this.categoryLabel(key)
6590
6593
  }));
6591
- this.emissionCategories = (id) => Object.keys(this.data[id]).filter(key => !!this.data[id][key]);
6592
- this.emissionCategoryValue = (id, category) => this.data[id]?.[category];
6594
+ /**
6595
+ * Return all possible values for a specific Category.
6596
+ *
6597
+ * @param category {string} The specific category
6598
+ * @returns List of all values possible for this Category.
6599
+ */
6600
+ this.categoryValues = (category) => this.data[category];
6601
+ /**
6602
+ * Return the different categories available for a single Emission.
6603
+ *
6604
+ * @param emissionId The `@id` of the Emission
6605
+ * @returns List of categories.
6606
+ */
6607
+ this.emissionCategories = (emissionId) => Object.keys(this.data[emissionId]).filter(key => !!this.data[emissionId][key]);
6608
+ /**
6609
+ * Return the Category value for a specific Emission and Category.
6610
+ *
6611
+ * @param emissionId The `@id` of the Emission
6612
+ * @param category The Category
6613
+ * @returns The value
6614
+ */
6615
+ this.emissionCategoryValue = (emissionId, category) => this.data[emissionId]?.[category];
6593
6616
  }
6594
6617
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: CyclesEmissionsCategoryService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
6595
6618
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: CyclesEmissionsCategoryService, providedIn: 'root' }); }