@hestia-earth/ui-components 0.3.0 → 0.3.1

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.
Files changed (30) hide show
  1. package/bundles/hestia-earth-ui-components.umd.js +456 -392
  2. package/bundles/hestia-earth-ui-components.umd.js.map +1 -1
  3. package/common/clipboard/clipboard.component.d.ts +1 -0
  4. package/cycles/cycles-activity-logs/cycles-activity-logs.component.d.ts +42 -10
  5. package/cycles/cycles-emissions-logs/cycles-emissions-logs.component.d.ts +42 -6
  6. package/cycles/cycles-practices-logs/cycles-practices-logs.component.d.ts +42 -10
  7. package/cycles/cycles.model.d.ts +3 -4
  8. package/esm2015/common/clipboard/clipboard.component.js +5 -3
  9. package/esm2015/cycles/cycles-activity-logs/cycles-activity-logs.component.js +11 -21
  10. package/esm2015/cycles/cycles-emissions-logs/cycles-emissions-logs.component.js +12 -14
  11. package/esm2015/cycles/cycles-practices-logs/cycles-practices-logs.component.js +10 -21
  12. package/esm2015/cycles/cycles.model.js +4 -5
  13. package/esm2015/impact-assessments/impact-assessments-products/impact-assessments-products.component.js +2 -2
  14. package/esm2015/impact-assessments/impact-assessments-products-logs/impact-assessments-products-logs.component.js +8 -12
  15. package/esm2015/node/node-link/node-link.component.js +2 -2
  16. package/esm2015/node/node-logs-models/node-logs-models.component.js +56 -325
  17. package/esm2015/node/node-logs.model.js +370 -0
  18. package/esm2015/node/node-missing-lookup-factors/node-missing-lookup-factors.component.js +1 -1
  19. package/esm2015/node/node-value-details/node-value-details.component.js +2 -2
  20. package/esm2015/node/node.service.js +1 -1
  21. package/esm2015/sites/sites-measurements-logs/sites-measurements-logs.component.js +8 -12
  22. package/fesm2015/hestia-earth-ui-components.js +325 -253
  23. package/fesm2015/hestia-earth-ui-components.js.map +1 -1
  24. package/impact-assessments/impact-assessments-products-logs/impact-assessments-products-logs.component.d.ts +37 -6
  25. package/node/node-logs-models/node-logs-models.component.d.ts +24 -88
  26. package/node/node-logs.model.d.ts +88 -0
  27. package/node/node-missing-lookup-factors/node-missing-lookup-factors.component.d.ts +2 -1
  28. package/node/node.service.d.ts +1 -31
  29. package/package.json +2 -2
  30. package/sites/sites-measurements-logs/sites-measurements-logs.component.d.ts +39 -6
@@ -1,25 +1,56 @@
1
1
  import { OnInit } from '@angular/core';
2
+ import { DataState } from '@hestia-earth/api';
2
3
  import { Emission, ITermJSONLD, NodeType, TermTermType } from '@hestia-earth/schema';
3
4
  import { HeSearchService } from '../../search/search.service';
4
- import { HeNodeService } from '../../node/node.service';
5
5
  import * as i0 from "@angular/core";
6
6
  export declare class ImpactAssessmentsProductsLogsComponent implements OnInit {
7
7
  private searchService;
8
- private nodeService;
9
8
  private impactAssessment?;
10
9
  key?: string;
11
10
  filterTermTypes?: TermTermType[];
12
11
  originalValues: Emission[];
13
12
  recalculatedValues: Emission[];
14
13
  loading: boolean;
15
- logsUrl?: string;
16
14
  NodeType: typeof NodeType;
17
- logs: any;
18
15
  models: ITermJSONLD[];
19
16
  terms: ITermJSONLD[];
20
- constructor(searchService: HeSearchService, nodeService: HeNodeService);
17
+ constructor(searchService: HeSearchService);
21
18
  ngOnInit(): Promise<void>;
22
- private get node();
19
+ get node(): {
20
+ dataState: DataState;
21
+ version?: string;
22
+ versionDetails?: string;
23
+ organisation?: import("@hestia-earth/schema").Organisation;
24
+ cycle?: import("@hestia-earth/schema").Cycle;
25
+ endDate?: string;
26
+ startDate?: string;
27
+ site?: import("@hestia-earth/schema").Site;
28
+ country?: import("@hestia-earth/schema").Term;
29
+ region?: import("@hestia-earth/schema").Term;
30
+ product?: import("@hestia-earth/schema").Term;
31
+ functionalUnitQuantity?: number;
32
+ allocationMethod?: import("@hestia-earth/schema").ImpactAssessmentAllocationMethod;
33
+ source?: import("@hestia-earth/schema").Source;
34
+ emissionsResourceUse?: import("@hestia-earth/schema").Indicator[];
35
+ impacts?: import("@hestia-earth/schema").Indicator[];
36
+ endpoints?: import("@hestia-earth/schema").Indicator[];
37
+ organic?: boolean;
38
+ irrigated?: boolean;
39
+ autoGenerated?: boolean;
40
+ originalId?: string;
41
+ schemaVersion?: string;
42
+ added?: string[];
43
+ addedVersion?: string[];
44
+ updated?: string[];
45
+ updatedVersion?: string[];
46
+ aggregated?: boolean;
47
+ aggregatedVersion?: string;
48
+ dataPrivate?: boolean;
49
+ '@context': string | (string | import("@hestia-earth/schema").IContext)[];
50
+ '@type': NodeType.ImpactAssessment;
51
+ '@id': string;
52
+ name: string;
53
+ };
23
54
  get includeAllModels(): boolean;
24
55
  static ɵfac: i0.ɵɵFactoryDeclaration<ImpactAssessmentsProductsLogsComponent, never>;
25
56
  static ɵcmp: i0.ɵɵComponentDeclaration<ImpactAssessmentsProductsLogsComponent, "he-impact-assessments-products-logs", never, { "impactAssessment": "impactAssessment"; "key": "key"; "filterTermTypes": "filterTermTypes"; "originalValues": "originalValues"; "recalculatedValues": "recalculatedValues"; }, {}, never, never>;
@@ -1,86 +1,30 @@
1
1
  import { OnInit } from '@angular/core';
2
2
  import { Observable } from 'rxjs';
3
- import { Emission, ITermJSONLD, Product, Input as HestiaInput, Property, SchemaType } from '@hestia-earth/schema';
4
- import { INodeTermLogs, INodeTermLog } from '../node.service';
5
- import { HeEngineService, IModel } from '../../engine/engine.service';
3
+ import { IBlankNodeLogSubValue, IBlankNodeLog, LogStatus, IConfigModel } from '../node-logs.model';
4
+ import { HeNodeService } from '../node.service';
5
+ import { HeEngineService } from '../../engine/engine.service';
6
6
  import { HeSearchService } from '../../search/search.service';
7
7
  import * as i0 from "@angular/core";
8
- declare type blankNode = Emission | Product | HestiaInput | Property;
9
- interface IConfigModel {
10
- methodId: string;
11
- model?: IModel;
12
- }
13
- interface IBlankNodeLogSubValue {
14
- key: string;
15
- originalValue: number | string | boolean;
16
- recalculatedValue: number | string | boolean;
17
- isRecalculated: boolean;
18
- id?: any;
19
- configModels?: IConfigModel[];
20
- }
21
- interface IBlankNodeLog {
22
- isOpen: boolean;
23
- canOpen: boolean;
24
- term: ITermJSONLD;
25
- termId: string;
26
- type?: SchemaType;
27
- configModels: (IConfigModel | IConfigModel[])[];
28
- original: blankNode[];
29
- originalValue: number;
30
- originalValueByMethodId?: {
31
- [methodId: string]: number;
32
- };
33
- recalculated: blankNode[];
34
- recalculatedValue: number;
35
- recalculatedValueByMethodId?: {
36
- [methodId: string]: number;
37
- };
38
- isOriginal: boolean;
39
- isRecalculated: boolean;
40
- hasData: boolean;
41
- isRequired: boolean;
42
- logs?: INodeTermLogs;
43
- keys: IBlankNodeLogSubValue[];
44
- subValues: IBlankNodeLogSubValue[];
45
- allParallel?: boolean;
46
- }
47
- declare enum LogStatus {
48
- success = "successful",
49
- error = "failed",
50
- skipHierarchy = "not run (model higher up hierarchy run instead)",
51
- dataProvided = "not run (user provided data retained)",
52
- notRequired = "not relevant"
53
- }
54
8
  export declare class NodeLogsModelsComponent implements OnInit {
9
+ private nodeService;
55
10
  private searchService;
56
11
  private engineService;
57
- private config?;
58
- private models;
59
12
  private allTerms;
60
13
  private allBlankNodes;
61
- private nodeType?;
14
+ private node?;
62
15
  /**
63
16
  * Restrict models by key.
64
17
  */
65
18
  private nodeKey?;
66
19
  private includeAllModels;
67
- logsUrl?: string;
68
- originalValues: blankNode[];
20
+ private originalValues;
69
21
  private recalculatedValues;
70
22
  private terms;
71
- private logs?;
72
23
  private filterTermTypes?;
24
+ private logsKey?;
25
+ logsUrl?: string;
73
26
  baseUrl: string;
74
27
  isExternal: boolean;
75
- hasLog: (log: INodeTermLog, withOrchestrator?: boolean) => boolean;
76
- propertyValue: (value: string | number | (string | number)[], termId?: string) => number;
77
- loading: boolean;
78
- blankNodes: IBlankNodeLog[];
79
- methodModelsCount: number;
80
- rowsCount: number;
81
- methodsById?: any;
82
- onlyRequired: boolean;
83
- showLegend: boolean;
84
28
  LogStatus: typeof LogStatus;
85
29
  logIcon: {
86
30
  successful: string | string[];
@@ -96,36 +40,28 @@ export declare class NodeLogsModelsComponent implements OnInit {
96
40
  "not run (user provided data retained)": string;
97
41
  "not relevant": string;
98
42
  };
43
+ propertyValue: (value: string | number | (string | number)[], termId?: string) => number;
44
+ getModelsAt: ({ configModels }: IBlankNodeLogSubValue | IBlankNodeLog, index: number) => IConfigModel | IConfigModel[];
45
+ requirementKeys: (requirements: {
46
+ [key: string]: any;
47
+ }) => string[];
48
+ requirementColor: (value: any) => "danger" | "white";
49
+ loading: boolean;
50
+ blankNodes: IBlankNodeLog[];
51
+ methodModelsCount: number;
52
+ rowsCount: number;
53
+ methodsById?: any;
54
+ onlyRequired: boolean;
55
+ showLegend: boolean;
99
56
  term?: string;
100
57
  suggestTerm: (text$: Observable<string>) => Observable<string[]>;
101
- constructor(searchService: HeSearchService, engineService: HeEngineService);
58
+ constructor(nodeService: HeNodeService, searchService: HeSearchService, engineService: HeEngineService);
102
59
  ngOnInit(): Promise<void>;
103
- private fetchAllTerms;
104
60
  private suggestByTerm;
105
61
  trackByBlankNode(_index: number, node: IBlankNodeLog): string;
106
- keyValue(blankNodes: blankNode[], key: string): any;
107
- openPopover(popover: any, { blankNode, methodId, subValue, logs }: {
108
- blankNode: any;
109
- methodId: any;
110
- subValue: any;
111
- logs: any;
112
- }): any;
113
62
  get filteredType(): string;
114
63
  filterResults(): void;
115
- /** Logs **/
116
- private getSubvalueLogs;
117
- getLogs(node: IBlankNodeLog, methodId: string, subValue?: IBlankNodeLogSubValue): any;
118
- private isBackground;
119
- private isUserProvided;
120
- getModelsAt(node: IBlankNodeLog, index: number, subValue?: IBlankNodeLogSubValue): IConfigModel | IConfigModel[];
121
- methodName(node: IBlankNodeLog, methodId: string, subValue?: IBlankNodeLogSubValue): any;
122
- hasLogDetails(node: IBlankNodeLog, methodId: string, subValue?: IBlankNodeLogSubValue): any;
123
- logStatus(node: IBlankNodeLog, methodId: string, subValue?: IBlankNodeLogSubValue): LogStatus;
124
- requirementKeys(requirements: {
125
- [key: string]: any;
126
- }): string[];
127
- requirementColor(value: any): "danger" | "white";
64
+ methodName({ methodId }: IConfigModel): any;
128
65
  static ɵfac: i0.ɵɵFactoryDeclaration<NodeLogsModelsComponent, never>;
129
- static ɵcmp: i0.ɵɵComponentDeclaration<NodeLogsModelsComponent, "he-node-logs-models", never, { "nodeType": "nodeType"; "nodeKey": "nodeKey"; "includeAllModels": "includeAllModels"; "logsUrl": "logsUrl"; "originalValues": "originalValues"; "recalculatedValues": "recalculatedValues"; "terms": "terms"; "logs": "logs"; "filterTermTypes": "filterTermTypes"; }, {}, never, never>;
66
+ static ɵcmp: i0.ɵɵComponentDeclaration<NodeLogsModelsComponent, "he-node-logs-models", never, { "node": "node"; "nodeKey": "nodeKey"; "includeAllModels": "includeAllModels"; "originalValues": "originalValues"; "recalculatedValues": "recalculatedValues"; "terms": "terms"; "filterTermTypes": "filterTermTypes"; "logsKey": "logsKey"; }, {}, never, never>;
130
67
  }
131
- export {};
@@ -0,0 +1,88 @@
1
+ import { Emission, ITermJSONLD, Product, Input as HestiaInput, NodeType, TermTermType, Property, SchemaType } from '@hestia-earth/schema';
2
+ import { IOrchestratorConfig, IModel } from '../engine/engine.service';
3
+ export interface INodeMissingLookupLog {
4
+ filename: string;
5
+ termId: string;
6
+ column: string;
7
+ model?: string;
8
+ term?: string;
9
+ key?: string;
10
+ }
11
+ export interface INodeTermLog {
12
+ runRequired?: boolean;
13
+ shouldRun?: boolean;
14
+ shouldRunOrchestrator?: boolean;
15
+ missingLookups?: INodeMissingLookupLog[];
16
+ requirements?: {
17
+ [key: string]: any;
18
+ };
19
+ logs?: {
20
+ [key: string]: any;
21
+ };
22
+ [key: string]: any;
23
+ input?: string | string[];
24
+ property?: string | string[];
25
+ }
26
+ export interface INodeTermLogs {
27
+ [modelKey: string]: any | INodeTermLog;
28
+ models: string[];
29
+ isKey: boolean;
30
+ }
31
+ export interface INodeLogs {
32
+ [term: string]: INodeTermLogs;
33
+ }
34
+ export declare const groupLogsByModel: (data: string) => INodeLogs;
35
+ export declare const computeTerms: (originalValues: blankNode[], recalculatedValues: blankNode[], terms?: ITermJSONLD[], filterTermTypes?: TermTermType[]) => Promise<any>;
36
+ export declare type blankNode = Emission | Product | HestiaInput | Property;
37
+ export declare enum LogStatus {
38
+ success = "successful",
39
+ error = "failed",
40
+ skipHierarchy = "not run (model higher up hierarchy run instead)",
41
+ dataProvided = "not run (user provided data retained)",
42
+ notRequired = "not relevant"
43
+ }
44
+ export interface IConfigModel {
45
+ methodId: string;
46
+ logs?: INodeTermLog;
47
+ hasLogs?: boolean;
48
+ status?: LogStatus;
49
+ model?: IModel;
50
+ }
51
+ export interface IBlankNodeLogSubValue {
52
+ key: string;
53
+ originalValue: number | string | boolean;
54
+ recalculatedValue: number | string | boolean;
55
+ isRecalculated: boolean;
56
+ isRequired?: boolean;
57
+ id?: any;
58
+ configModels?: IConfigModel[];
59
+ logs?: INodeTermLogs;
60
+ }
61
+ export interface IBlankNodeLog {
62
+ isOpen: boolean;
63
+ canOpen: boolean;
64
+ term: ITermJSONLD;
65
+ termId: string;
66
+ type?: SchemaType;
67
+ configModels: (IConfigModel | IConfigModel[])[];
68
+ original: blankNode[];
69
+ originalValue: number;
70
+ originalValueByMethodId?: {
71
+ [methodId: string]: number;
72
+ };
73
+ recalculated: blankNode[];
74
+ recalculatedValue: number;
75
+ recalculatedValueByMethodId?: {
76
+ [methodId: string]: number;
77
+ };
78
+ isOriginal: boolean;
79
+ isRecalculated: boolean;
80
+ hasData: boolean;
81
+ isRequired: boolean;
82
+ logs?: INodeTermLogs;
83
+ keys: IBlankNodeLogSubValue[];
84
+ subValues: IBlankNodeLogSubValue[];
85
+ allParallel?: boolean;
86
+ }
87
+ export declare const groupLogsByTerm: (nodeType: NodeType, logs: INodeLogs, models: IModel[], config: IOrchestratorConfig, allOriginalValues: blankNode[], allRecalculatedValues: blankNode[], nodeKey?: string) => (term: ITermJSONLD) => IBlankNodeLog;
88
+ export declare const modelCount: (blankNodeLogs: IBlankNodeLog[]) => any;
@@ -1,6 +1,7 @@
1
1
  import { OnInit } from '@angular/core';
2
2
  import { JSONLD, NodeType } from '@hestia-earth/schema';
3
- import { INodeMissingLookupLog, HeNodeService } from '../node.service';
3
+ import { INodeMissingLookupLog } from '../node-logs.model';
4
+ import { HeNodeService } from '../node.service';
4
5
  import * as i0 from "@angular/core";
5
6
  export declare class NodeMissingLookupFactorsComponent implements OnInit {
6
7
  nodeService: HeNodeService;
@@ -1,6 +1,7 @@
1
1
  import { HttpClient } from '@angular/common/http';
2
2
  import { DataState } from '@hestia-earth/api';
3
3
  import { ICycleJSONLD, IImpactAssessmentJSONLD, ISiteJSONLD, NodeType, TermTermType } from '@hestia-earth/schema';
4
+ import { INodeMissingLookupLog } from './node-logs.model';
4
5
  import { HeCommonService } from '../common/common.service';
5
6
  import { HeAuthService } from '../auth/auth.service';
6
7
  import * as i0 from "@angular/core";
@@ -32,37 +33,6 @@ export interface IJSONData {
32
33
  [NodeType.Site]?: ISiteJSONLD[];
33
34
  [NodeType.ImpactAssessment]?: IImpactAssessmentJSONLD[];
34
35
  }
35
- export interface INodeMissingLookupLog {
36
- filename: string;
37
- termId: string;
38
- column: string;
39
- model?: string;
40
- term?: string;
41
- key?: string;
42
- }
43
- export interface INodeTermLog {
44
- model: string;
45
- isKey: boolean;
46
- runRequired?: boolean;
47
- shouldRun?: boolean;
48
- shouldRunOrchestrator?: boolean;
49
- missingLookups?: INodeMissingLookupLog[];
50
- requirements?: {
51
- [key: string]: any;
52
- };
53
- logs?: {
54
- [key: string]: any;
55
- };
56
- [key: string]: any;
57
- input?: string | string[];
58
- property?: string | string[];
59
- }
60
- export interface INodeTermLogs {
61
- [modelKey: string]: INodeTermLog;
62
- }
63
- export interface INodeLogs {
64
- [term: string]: INodeTermLogs;
65
- }
66
36
  export declare class HeNodeService {
67
37
  protected http: HttpClient;
68
38
  protected authService: HeAuthService;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hestia-earth/ui-components",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Hestia reusable components",
5
5
  "repository": {
6
6
  "type": "git",
@@ -23,7 +23,7 @@
23
23
  "@fortawesome/free-solid-svg-icons": "^5.15.4",
24
24
  "@google/markerclustererplus": "^5.1.3",
25
25
  "@hestia-earth/api": ">=0.12.0",
26
- "@hestia-earth/glossary": "^0.5.0",
26
+ "@hestia-earth/glossary": "^0.6.0",
27
27
  "@hestia-earth/json-schema": "^9.0.0",
28
28
  "@hestia-earth/schema": "^9.0.0",
29
29
  "@hestia-earth/schema-convert": "^9.0.0",
@@ -1,24 +1,57 @@
1
1
  import { OnInit } from '@angular/core';
2
2
  import { ISiteJSONLD, ITermJSONLD, Measurement, NodeType, TermTermType } from '@hestia-earth/schema';
3
+ import { DataState } from '@hestia-earth/api';
3
4
  import { HeSearchService } from '../../search/search.service';
4
- import { HeNodeService } from '../../node/node.service';
5
5
  import * as i0 from "@angular/core";
6
6
  export declare class SitesMeasurementsLogsComponent implements OnInit {
7
7
  private searchService;
8
- private nodeService;
9
8
  site?: ISiteJSONLD;
10
9
  originalValues: Measurement[];
11
10
  recalculatedValues: Measurement[];
12
11
  loading: boolean;
13
12
  TermTermType: typeof TermTermType;
14
13
  NodeType: typeof NodeType;
15
- logsUrl?: string;
16
- logs: any;
17
14
  models: ITermJSONLD[];
18
15
  measurements: ITermJSONLD[];
19
- constructor(searchService: HeSearchService, nodeService: HeNodeService);
16
+ constructor(searchService: HeSearchService);
20
17
  ngOnInit(): Promise<void>;
21
- private get node();
18
+ get node(): {
19
+ dataState: DataState;
20
+ description?: string;
21
+ siteType?: import("@hestia-earth/schema").SiteSiteType;
22
+ organisation?: import("@hestia-earth/schema").Organisation;
23
+ tenure?: import("@hestia-earth/schema").SiteTenure;
24
+ defaultSource?: import("@hestia-earth/schema").Source;
25
+ numberOfSites?: number;
26
+ boundary?: any;
27
+ area?: number;
28
+ areaSd?: number;
29
+ latitude?: number;
30
+ longitude?: number;
31
+ country?: import("@hestia-earth/schema").Term;
32
+ region?: import("@hestia-earth/schema").Term;
33
+ ecoregion?: string;
34
+ awareWaterBasinId?: string;
35
+ glnNumber?: string;
36
+ startDate?: string;
37
+ endDate?: string;
38
+ measurements?: Measurement[];
39
+ infrastructure?: import("@hestia-earth/schema").Infrastructure[];
40
+ practices?: import("@hestia-earth/schema").Practice[];
41
+ originalId?: string;
42
+ schemaVersion?: string;
43
+ added?: string[];
44
+ addedVersion?: string[];
45
+ updated?: string[];
46
+ updatedVersion?: string[];
47
+ aggregated?: boolean;
48
+ aggregatedVersion?: string;
49
+ dataPrivate?: boolean;
50
+ '@context': string | (string | import("@hestia-earth/schema").IContext)[];
51
+ '@type': NodeType.Site;
52
+ '@id': string;
53
+ name: string;
54
+ };
22
55
  static ɵfac: i0.ɵɵFactoryDeclaration<SitesMeasurementsLogsComponent, never>;
23
56
  static ɵcmp: i0.ɵɵComponentDeclaration<SitesMeasurementsLogsComponent, "he-sites-measurements-logs", never, { "site": "site"; "originalValues": "originalValues"; "recalculatedValues": "recalculatedValues"; }, {}, never, never>;
24
57
  }