@dative-gpi/foundation-shared-domain 0.0.103 → 0.0.105
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/models/languages/languageInfos.ts +1 -1
- package/models/organisationTypes/organisationTypeInfos.ts +1 -1
- package/models/organisations/organisationInfos.ts +1 -1
- package/models/timeZones/timeZoneInfos.ts +9 -9
- package/models/users/userInfos.ts +1 -1
- package/package.json +2 -2
- package/tools/datesTools.ts +1 -1
- package/tools/index.ts +0 -1
- package/tools/customPropertiesTools.ts +0 -49
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
export class TimeZoneInfos {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
id: string;
|
|
3
|
+
offset: string;
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
constructor(params: TimeZoneInfosDTO) {
|
|
6
|
+
this.id = params.id;
|
|
7
|
+
this.offset = params.offset;
|
|
8
|
+
}
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export interface TimeZoneInfosDTO {
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
id: string;
|
|
13
|
+
offset: string;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export interface TimeZoneFilters {
|
|
17
|
-
|
|
17
|
+
search?: string | null;
|
|
18
18
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dative-gpi/foundation-shared-domain",
|
|
3
3
|
"sideEffects": false,
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.105",
|
|
5
5
|
"description": "",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -12,5 +12,5 @@
|
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"date-fns": "^3.6.0"
|
|
14
14
|
},
|
|
15
|
-
"gitHead": "
|
|
15
|
+
"gitHead": "87c3913599bcfc96f33e3f2528e2be91a252726e"
|
|
16
16
|
}
|
package/tools/datesTools.ts
CHANGED
|
@@ -64,7 +64,7 @@ const fromExpression = (expression: string, variant: 'default' | 'before-after')
|
|
|
64
64
|
return false;
|
|
65
65
|
}
|
|
66
66
|
return true;
|
|
67
|
-
}
|
|
67
|
+
};
|
|
68
68
|
|
|
69
69
|
export const isoTimeFormat = (timeZone: boolean = false): string => {
|
|
70
70
|
return `yyyy-MM-dd'T'HH:mm:ss${timeZone ? "X" : ""}`;
|
package/tools/index.ts
CHANGED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import _ from "lodash";
|
|
2
|
-
|
|
3
|
-
import { CustomPropertyInfos, PropertyDataType } from "@dative-gpi/foundation-core-domain/models";
|
|
4
|
-
import { FSGridItem } from "@dative-gpi/foundation-shared-components/models";
|
|
5
|
-
|
|
6
|
-
export const CustomPropertyTools = {
|
|
7
|
-
showCategory: (properties: CustomPropertyInfos[], category: string): boolean => {
|
|
8
|
-
return properties.some(cp => cp.categoryLabel === category);
|
|
9
|
-
},
|
|
10
|
-
getExtraGridItems: (properties: CustomPropertyInfos[], category: string): FSGridItem[] => {
|
|
11
|
-
return properties.filter(cp => cp.categoryLabel === category).map(cp => ({
|
|
12
|
-
label: cp.label,
|
|
13
|
-
code: `meta.${cp.code}`,
|
|
14
|
-
value: "",
|
|
15
|
-
hideDefault: cp.dataType === PropertyDataType.Boolean || cp.dataType === PropertyDataType.Icon
|
|
16
|
-
}));
|
|
17
|
-
},
|
|
18
|
-
getExtraGrids: (properties: CustomPropertyInfos[], categories: string[]): { [key: string]: FSGridItem[] } => {
|
|
19
|
-
const extraGrids: { [key: string]: FSGridItem[] } = {};
|
|
20
|
-
const extraCategories = _.groupBy(properties.filter(cp => !categories.includes(cp.categoryLabel)), cp => cp.categoryLabel);
|
|
21
|
-
for (const category in extraCategories) {
|
|
22
|
-
extraGrids[category] = extraCategories[category].map(cp => ({
|
|
23
|
-
label: cp.label,
|
|
24
|
-
code: `meta.${cp.code}`,
|
|
25
|
-
value: "",
|
|
26
|
-
hideDefault: cp.dataType === PropertyDataType.Boolean || cp.dataType === PropertyDataType.Icon
|
|
27
|
-
}));
|
|
28
|
-
}
|
|
29
|
-
return extraGrids;
|
|
30
|
-
},
|
|
31
|
-
getExtraFields: (properties: CustomPropertyInfos[], category: string): CustomPropertyInfos[] => {
|
|
32
|
-
return properties.filter(cp => cp.categoryLabel === category && !cp.readOnlyCore);
|
|
33
|
-
},
|
|
34
|
-
getExtraCategories: (properties: CustomPropertyInfos[], categories: string[], sortFirst: string[]): { [key: string]: CustomPropertyInfos[] } => {
|
|
35
|
-
const unordered = _.groupBy(properties.filter(cp => !categories.includes(cp.categoryLabel) && !cp.readOnlyCore), cp => cp.categoryLabel);
|
|
36
|
-
|
|
37
|
-
return Object.keys(unordered).sort((a: string, b: string) => {
|
|
38
|
-
const aIndex = sortFirst.indexOf(a);
|
|
39
|
-
const bIndex = sortFirst.indexOf(b);
|
|
40
|
-
if ((aIndex !== -1 && bIndex !== -1) || aIndex === bIndex) {
|
|
41
|
-
return 0;
|
|
42
|
-
}
|
|
43
|
-
return bIndex - aIndex;
|
|
44
|
-
}).reduce((obj: { [key: string]: any }, key: string) => {
|
|
45
|
-
obj[key] = unordered[key];
|
|
46
|
-
return obj
|
|
47
|
-
}, {});
|
|
48
|
-
}
|
|
49
|
-
}
|