@dative-gpi/foundation-core-domain 1.0.136-override-widgets → 1.0.137-editable-components

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.
@@ -1,32 +1,42 @@
1
- import { type CreateDashboardShallowEntityPresetDTO, DashboardShallowEntityPresetInfos, type DashboardShallowEntityPresetInfosDTO } from "../dashboardShallowEntityPresets";
2
- import { type CreateDashboardShallowDatePresetDTO, DashboardShallowDatePresetInfos, type DashboardShallowDatePresetInfosDTO } from "../dashboardShallowDatePresets";
3
- import { type CreateDashboardShallowVariableDTO, DashboardShallowVariableInfos, type DashboardShallowVariableInfosDTO } from "../dashboardShallowVariables";
4
- import { type CreateDashboardShallowWidgetDTO, DashboardShallowWidgetInfos, type DashboardShallowWidgetInfosDTO } from "../dashboardShallowWidgets";
5
- import { DashboardEntityPresetInfos, type DashboardEntityPresetInfosDTO } from "../dashboardEntityPresets";
6
- import { DashboardDatePresetInfos, type DashboardDatePresetInfosDTO } from "../dashboardDatePresets";
7
- import { DashboardVariableInfos, type DashboardVariableInfosDTO } from "../dashboardVariables";
8
- import { DashboardShallowInfos, type DashboardShallowInfosDTO } from "./dashboardShallowInfos";
9
- import { DashboardTranslation, type DashboardTranslationDTO } from "../dashboards";
10
- import { WidgetInfos, type WidgetInfosDTO } from "../widgets/widgetInfos";
11
- import { PathCrumb, type PathCrumbDTO } from "../shared/pathCrumb";
1
+ import type { CreateDashboardShallowEntityPresetDTO, DashboardShallowEntityPresetInfosDTO } from "../dashboardShallowEntityPresets";
2
+ import { DashboardShallowEntityPresetInfos } from "../dashboardShallowEntityPresets";
3
+ import type { CreateDashboardShallowDatePresetDTO, DashboardShallowDatePresetInfosDTO } from "../dashboardShallowDatePresets";
4
+ import { DashboardShallowDatePresetInfos } from "../dashboardShallowDatePresets";
5
+ import type { CreateDashboardShallowVariableDTO, DashboardShallowVariableInfosDTO } from "../dashboardShallowVariables";
6
+ import { DashboardShallowVariableInfos } from "../dashboardShallowVariables";
7
+ import type { DashboardEntityPresetInfosDTO } from "../dashboardEntityPresets";
8
+ import { DashboardEntityPresetInfos } from "../dashboardEntityPresets";
9
+ import type { DashboardDatePresetInfosDTO } from "../dashboardDatePresets";
10
+ import { DashboardDatePresetInfos } from "../dashboardDatePresets";
11
+ import type { DashboardVariableInfosDTO } from "../dashboardVariables";
12
+ import { DashboardVariableInfos } from "../dashboardVariables";
13
+ import type { DashboardShallowInfosDTO } from "./dashboardShallowInfos";
14
+ import { DashboardShallowInfos } from "./dashboardShallowInfos";
15
+ import type { DashboardTranslationDTO } from "../dashboards";
16
+ import { DashboardTranslation } from "../dashboards";
17
+ import type { WidgetInfosDTO } from "../widgets/widgetInfos";
18
+ import { WidgetInfos } from "../widgets/widgetInfos";
19
+ import type { PathCrumbDTO } from "../shared/pathCrumb";
20
+ import { PathCrumb } from "../shared/pathCrumb";
21
+
12
22
 
13
23
  export class DashboardShallowDetails extends DashboardShallowInfos {
14
24
  labelDefault: string;
15
25
  translations: DashboardTranslation[];
16
26
  path: PathCrumb[];
17
27
 
28
+ widgets: WidgetInfos[];
29
+
18
30
  entityPresetCode: string | null;
19
31
  datePresetCode: string | null;
20
32
  variableCode: string | null;
21
33
  defaultDatePresets: DashboardDatePresetInfos[];
22
34
  defaultEntityPresets: DashboardEntityPresetInfos[];
23
35
  defaultVariables: DashboardVariableInfos[];
24
- defaultWidgets: WidgetInfos[];
25
36
 
26
37
  overrideDatePresets: DashboardShallowDatePresetInfos[];
27
38
  overrideEntityPresets: DashboardShallowEntityPresetInfos[];
28
39
  overrideVariables: DashboardShallowVariableInfos[];
29
- overrideWidgets: DashboardShallowWidgetInfos[];
30
40
 
31
41
  get datePresets() : DashboardDatePresetInfos[] {
32
42
  return this.defaultDatePresets.map(d => {
@@ -49,24 +59,17 @@ export class DashboardShallowDetails extends DashboardShallowInfos {
49
59
  });
50
60
  }
51
61
 
52
- get widgets() {
53
- return this.defaultWidgets.map(d => {
54
- const override = this.overrideWidgets.find(od => od.widgetId === d.id);
55
- return override ? new WidgetInfos({ ...d, ...override }) : d;
56
- });
57
- }
58
-
59
62
  constructor(params: DashboardShallowDetailsDTO) {
60
63
  super(params);
61
64
 
62
65
  this.labelDefault = params.labelDefault;
63
66
  this.path = params.path.map(dto => new PathCrumb(dto)).sort((a, b) => b.index - a.index);
64
67
  this.translations = params.translations.map(t => new DashboardTranslation(t));
68
+ this.widgets = params.widgets.map(dto => new WidgetInfos(dto));
65
69
 
66
70
  this.overrideDatePresets = params.overrideDatePresets.map(dto => new DashboardShallowDatePresetInfos(dto));
67
71
  this.overrideEntityPresets = params.overrideEntityPresets.map(dto => new DashboardShallowEntityPresetInfos(dto));
68
72
  this.overrideVariables = params.overrideVariables.map(dto => new DashboardShallowVariableInfos(dto));
69
- this.overrideWidgets = params.overrideWidgets.map(dto => new DashboardShallowWidgetInfos(dto));
70
73
 
71
74
  this.entityPresetCode = params.entityPresetCode;
72
75
  this.datePresetCode = params.datePresetCode;
@@ -74,7 +77,6 @@ export class DashboardShallowDetails extends DashboardShallowInfos {
74
77
  this.defaultDatePresets = params.defaultDatePresets.map(dto => new DashboardDatePresetInfos(dto));
75
78
  this.defaultEntityPresets = params.defaultEntityPresets.map(dto => new DashboardEntityPresetInfos(dto));
76
79
  this.defaultVariables = params.defaultVariables.map(dto => new DashboardVariableInfos(dto));
77
- this.defaultWidgets = params.defaultWidgets.map(dto => new WidgetInfos(dto));
78
80
  }
79
81
  }
80
82
 
@@ -84,7 +86,6 @@ export interface DashboardShallowDetailsDTO extends DashboardShallowInfosDTO {
84
86
  overrideDatePresets: DashboardShallowDatePresetInfosDTO[];
85
87
  overrideEntityPresets: DashboardShallowEntityPresetInfosDTO[];
86
88
  overrideVariables: DashboardShallowVariableInfosDTO[];
87
- overrideWidgets: DashboardShallowWidgetInfosDTO[];
88
89
  translations: DashboardTranslationDTO[];
89
90
  dashboardId: string;
90
91
  scope: number;
@@ -94,7 +95,7 @@ export interface DashboardShallowDetailsDTO extends DashboardShallowInfosDTO {
94
95
  defaultDatePresets: DashboardDatePresetInfosDTO[];
95
96
  defaultEntityPresets: DashboardEntityPresetInfosDTO[];
96
97
  defaultVariables: DashboardVariableInfosDTO[];
97
- defaultWidgets: WidgetInfosDTO[];
98
+ widgets: WidgetInfosDTO[];
98
99
  }
99
100
 
100
101
  export interface CreateDashboardShallowDTO {
@@ -113,7 +114,6 @@ export interface UpdateDashboardShallowDTO {
113
114
  overrideDatePresets: CreateDashboardShallowDatePresetDTO[];
114
115
  overrideEntityPresets: CreateDashboardShallowEntityPresetDTO[];
115
116
  overrideVariables: CreateDashboardShallowVariableDTO[];
116
- overrideWidgets: CreateDashboardShallowWidgetDTO[];
117
117
  translations: DashboardTranslationDTO[];
118
118
  }
119
119
 
package/models/index.ts CHANGED
@@ -19,7 +19,6 @@ export * from "./dashboardShallowDatePresets"; // No service
19
19
  export * from "./dashboardShallowEntityPresets"; // No service
20
20
  export * from "./dashboardShallows";
21
21
  export * from "./dashboardShallowVariables"; // No service
22
- export * from "./dashboardShallowWidgets"; // No service
23
22
  export * from "./dashboardVariables"; // No service
24
23
  export * from "./dashboardVariableValues"; // No service
25
24
  export * from "./dataCategories";
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.136-override-widgets",
4
+ "version": "1.0.137-editable-components",
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.136-override-widgets",
14
- "@dative-gpi/foundation-shared-services": "1.0.136-override-widgets"
13
+ "@dative-gpi/foundation-shared-domain": "1.0.137-editable-components",
14
+ "@dative-gpi/foundation-shared-services": "1.0.137-editable-components"
15
15
  },
16
- "gitHead": "c2765a250ad2c493b88f3801f13ddd71405e898a"
16
+ "gitHead": "7aa074aa1903f6d293e4606d198321e9832f030d"
17
17
  }
@@ -1,4 +0,0 @@
1
- export interface CreateDashboardShallowWidgetDTO {
2
- widgetId: string;
3
- meta: { [key: string]: string };
4
- }
@@ -1,30 +0,0 @@
1
- import _ from "lodash";
2
-
3
- const clean = <T>(meta: T): T => {
4
- const newMeta = _.cloneDeepWith(meta, (value) => {
5
- if (typeof value === "string") {
6
- try {
7
- return JSON.parse(value as string);
8
- }
9
- catch {
10
- return value
11
- }
12
- }
13
- });
14
- return newMeta;
15
- }
16
-
17
- export class DashboardShallowWidgetInfos {
18
- widgetId: string;
19
- meta: { [key: string]: string };
20
-
21
- constructor(params: DashboardShallowWidgetInfosDTO) {
22
- this.widgetId = params.widgetId;
23
- this.meta = clean(params.meta);
24
- }
25
- }
26
-
27
- export interface DashboardShallowWidgetInfosDTO {
28
- widgetId: string;
29
- meta: { [key: string]: string };
30
- }
@@ -1,2 +0,0 @@
1
- export * from "./dashboardShallowWidgetDetails";
2
- export * from "./dashboardShallowWidgetInfos";