@dative-gpi/foundation-core-domain 1.0.36 → 1.0.38

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.
@@ -55,6 +55,7 @@ export interface UpdateDashboardOrganisationTypeDTO {
55
55
  image: string | null;
56
56
  labelDefault: string;
57
57
  code: string;
58
+ colors: string[];
58
59
  icon: string;
59
60
  tags: string[];
60
61
  translations: DashboardTranslationDTO[];
@@ -1,8 +1,4 @@
1
- import type { CreateDashboardVariableValueDTO } from "../dashboardVariableValues";
2
-
3
1
  export interface CreateDashboardShallowVariableDTO {
4
2
  hiddenCode: string;
5
- defaultValue: string;
6
- useOnlyAllowedValues: boolean;
7
- allowedValues: CreateDashboardVariableValueDTO[];
3
+ value: string;
8
4
  }
@@ -1,23 +1,14 @@
1
- import type { DashboardVariableValueDTO } from "../dashboardVariableValues";
2
- import { DashboardVariableValue } from "../dashboardVariableValues";
3
-
4
1
  export class DashboardShallowVariableInfos {
5
2
  hiddenCode: string;
6
- defaultValue: string;
7
- useOnlyAllowedValues: boolean;
8
- allowedValues: DashboardVariableValue[];
3
+ value: string;
9
4
 
10
5
  constructor(params: DashboardShallowVariableInfosDTO) {
11
6
  this.hiddenCode = params.hiddenCode;
12
- this.defaultValue = params.defaultValue;
13
- this.useOnlyAllowedValues = params.useOnlyAllowedValues;
14
- this.allowedValues = params.allowedValues.map(dto => new DashboardVariableValue(dto));
7
+ this.value = params.value;
15
8
  }
16
9
  }
17
10
 
18
11
  export interface DashboardShallowVariableInfosDTO {
19
12
  hiddenCode: string;
20
- defaultValue: string;
21
- useOnlyAllowedValues: boolean;
22
- allowedValues: DashboardVariableValueDTO[];
13
+ value: string;
23
14
  }
@@ -1,3 +1,5 @@
1
+ import { translate } from "@dative-gpi/foundation-shared-services/tools";
2
+
1
3
  import type { CreateDashboardShallowEntityPresetDTO, DashboardShallowEntityPresetInfosDTO } from "../dashboardShallowEntityPresets";
2
4
  import { DashboardShallowEntityPresetInfos } from "../dashboardShallowEntityPresets";
3
5
  import type { CreateDashboardShallowDatePresetDTO, DashboardShallowDatePresetInfosDTO } from "../dashboardShallowDatePresets";
@@ -19,43 +21,86 @@ import { WidgetInfos } from "../widgets/widgetInfos";
19
21
  import type { PathCrumbDTO } from "../shared/pathCrumb";
20
22
  import { PathCrumb } from "../shared/pathCrumb";
21
23
 
24
+
22
25
  export class DashboardShallowDetails extends DashboardShallowInfos {
23
26
  labelDefault: string;
27
+ translations: DashboardTranslation[];
24
28
  path: PathCrumb[];
29
+ widgets: WidgetInfos[];
30
+
31
+ // @ts-expect-error ts(2611)
32
+ get label() {
33
+ return translate(this.translations, t => t.label, this.labelDefault);
34
+ }
35
+
36
+ defaultEntityPresetCode: string | null;
37
+ defaultDatePresetCode: string | null;
38
+ defaultVariableCode: string | null;
39
+ defaultDatePresets: DashboardDatePresetInfos[];
40
+ defaultEntityPresets: DashboardEntityPresetInfos[];
41
+ defaultVariables: DashboardVariableInfos[];
42
+
25
43
  overrideEntityPresetCode: string | null;
26
44
  overrideDatePresetCode: string | null;
27
45
  overrideVariableCode: string | null;
28
46
  overrideDatePresets: DashboardShallowDatePresetInfos[];
29
47
  overrideEntityPresets: DashboardShallowEntityPresetInfos[];
30
48
  overrideVariables: DashboardShallowVariableInfos[];
31
- translations: DashboardTranslation[];
32
- entityPresetCode: string | null;
33
- datePresetCode: string | null;
34
- variableCode: string | null;
35
- datePresets: DashboardDatePresetInfos[];
36
- entityPresets: DashboardEntityPresetInfos[];
37
- variables: DashboardVariableInfos[];
38
- widgets: WidgetInfos[];
49
+
50
+ get entityPresetCode() {
51
+ return this.overrideEntityPresetCode ?? this.defaultEntityPresetCode;
52
+ }
53
+
54
+ get datePresetCode() {
55
+ return this.overrideDatePresetCode ?? this.defaultDatePresetCode;
56
+ }
57
+
58
+ get variableCode() {
59
+ return this.overrideVariableCode ?? this.defaultVariableCode;
60
+ }
61
+
62
+ get datePresets() : DashboardDatePresetInfos[] {
63
+ return this.defaultDatePresets.map(d => {
64
+ const override = this.overrideDatePresets.find(od => od.hiddenCode === d.hiddenCode);
65
+ return override ? new DashboardDatePresetInfos({ ...d, ...override }) : d;
66
+ })
67
+ }
68
+
69
+ get entityPresets() {
70
+ return this.defaultEntityPresets.map(d => {
71
+ const override = this.overrideEntityPresets.find(od => od.hiddenCode === d.hiddenCode);
72
+ return override ? new DashboardEntityPresetInfos({ ...d, ...override }) : d;
73
+ })
74
+ }
75
+
76
+ get variables() {
77
+ return this.defaultVariables.map(d => {
78
+ const override = this.overrideVariables.find(od => od.hiddenCode === d.hiddenCode);
79
+ return override ? new DashboardVariableInfos({ ...d, ...override }) : d;
80
+ })
81
+ }
39
82
 
40
83
  constructor(params: DashboardShallowDetailsDTO) {
41
84
  super(params);
42
-
85
+
43
86
  this.labelDefault = params.labelDefault;
44
87
  this.path = params.path.map(dto => new PathCrumb(dto)).sort((a, b) => b.index - a.index);
88
+ this.translations = params.translations.map(t => new DashboardTranslation(t));
89
+ this.widgets = params.widgets.map(dto => new WidgetInfos(dto));
90
+
45
91
  this.overrideEntityPresetCode = params.overrideEntityPresetCode;
46
92
  this.overrideDatePresetCode = params.overrideDatePresetCode;
47
93
  this.overrideVariableCode = params.overrideVariableCode;
48
94
  this.overrideDatePresets = params.overrideDatePresets.map(dto => new DashboardShallowDatePresetInfos(dto));
49
95
  this.overrideEntityPresets = params.overrideEntityPresets.map(dto => new DashboardShallowEntityPresetInfos(dto));
50
96
  this.overrideVariables = params.overrideVariables.map(dto => new DashboardShallowVariableInfos(dto));
51
- this.translations = params.translations.map(t => new DashboardTranslation(t));
52
- this.entityPresetCode = params.entityPresetCode;
53
- this.datePresetCode = params.datePresetCode;
54
- this.variableCode = params.variableCode;
55
- this.datePresets = params.datePresets.map(dto => new DashboardDatePresetInfos(dto));
56
- this.entityPresets = params.entityPresets.map(dto => new DashboardEntityPresetInfos(dto));
57
- this.variables = params.variables.map(dto => new DashboardVariableInfos(dto));
58
- this.widgets = params.widgets.map(dto => new WidgetInfos(dto));
97
+
98
+ this.defaultEntityPresetCode = params.entityPresetCode;
99
+ this.defaultDatePresetCode = params.datePresetCode;
100
+ this.defaultVariableCode = params.variableCode;
101
+ this.defaultDatePresets = params.datePresets.map(dto => new DashboardDatePresetInfos(dto));
102
+ this.defaultEntityPresets = params.entityPresets.map(dto => new DashboardEntityPresetInfos(dto));
103
+ this.defaultVariables = params.variables.map(dto => new DashboardVariableInfos(dto));
59
104
  }
60
105
  }
61
106
 
@@ -90,6 +135,7 @@ export interface UpdateDashboardShallowDTO {
90
135
  image: string | null;
91
136
  labelDefault: string;
92
137
  code: string;
138
+ colors: string[];
93
139
  icon: string;
94
140
  tags: string[];
95
141
  overrideEntityPresetCode: string | null;
@@ -8,8 +8,8 @@ export interface CreateDashboardVariableDTO {
8
8
  variableType: DashboardVariableType;
9
9
  labelDefault: string;
10
10
  code: string;
11
- defaultValue: string;
11
+ value: string;
12
12
  useOnlyAllowedValues: boolean;
13
13
  allowedValues: CreateDashboardVariableValueDTO[];
14
14
  translations: DashboardVariableTranslationDTO[];
15
- }
15
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dative-gpi/foundation-core-domain",
3
3
  "sideEffects": false,
4
- "version": "1.0.36",
4
+ "version": "1.0.38",
5
5
  "description": "",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -10,8 +10,8 @@
10
10
  "author": "",
11
11
  "license": "ISC",
12
12
  "dependencies": {
13
- "@dative-gpi/foundation-shared-domain": "1.0.36",
14
- "@dative-gpi/foundation-shared-services": "1.0.36"
13
+ "@dative-gpi/foundation-shared-domain": "1.0.38",
14
+ "@dative-gpi/foundation-shared-services": "1.0.38"
15
15
  },
16
- "gitHead": "687d6ae60b16a75dc332400cd6eee19cb306767b"
16
+ "gitHead": "7dd002e8bf0aeccec7302ebb76be82a0c530c376"
17
17
  }