@etsoo/appscript 1.6.30 → 1.6.32
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/lib/cjs/business/BusinessUtils.d.ts +7 -0
- package/lib/cjs/business/BusinessUtils.js +16 -3
- package/lib/cjs/def/CustomCulture.d.ts +1 -1
- package/lib/cjs/i18n/en.json +1 -0
- package/lib/cjs/i18n/zh-Hans.json +1 -0
- package/lib/cjs/i18n/zh-Hant.json +1 -0
- package/lib/mjs/business/BusinessUtils.d.ts +7 -0
- package/lib/mjs/business/BusinessUtils.js +16 -3
- package/lib/mjs/def/CustomCulture.d.ts +1 -1
- package/lib/mjs/i18n/en.json +1 -0
- package/lib/mjs/i18n/zh-Hans.json +1 -0
- package/lib/mjs/i18n/zh-Hant.json +1 -0
- package/package.json +6 -6
- package/src/business/BusinessUtils.ts +21 -5
- package/src/def/CustomCulture.ts +1 -1
- package/src/i18n/en.json +1 -0
- package/src/i18n/zh-Hans.json +1 -0
- package/src/i18n/zh-Hant.json +1 -0
|
@@ -19,6 +19,13 @@ export declare namespace BusinessUtils {
|
|
|
19
19
|
* @returns 12 months
|
|
20
20
|
*/
|
|
21
21
|
function getMonths(monthLabels: string[], startMonth?: number): ListType[];
|
|
22
|
+
/**
|
|
23
|
+
* Check if the item is a custom culture data
|
|
24
|
+
* @param item Item to check
|
|
25
|
+
* @param hasOrgId Has orgId or not
|
|
26
|
+
* @returns Result
|
|
27
|
+
*/
|
|
28
|
+
function isCustomCultureData(item: unknown, hasOrgId?: boolean): item is CustomCultureData;
|
|
22
29
|
/**
|
|
23
30
|
* Merge custom resources to target collection
|
|
24
31
|
* @param target Target collection merges to
|
|
@@ -56,6 +56,20 @@ var BusinessUtils;
|
|
|
56
56
|
return months;
|
|
57
57
|
}
|
|
58
58
|
BusinessUtils.getMonths = getMonths;
|
|
59
|
+
/**
|
|
60
|
+
* Check if the item is a custom culture data
|
|
61
|
+
* @param item Item to check
|
|
62
|
+
* @param hasOrgId Has orgId or not
|
|
63
|
+
* @returns Result
|
|
64
|
+
*/
|
|
65
|
+
function isCustomCultureData(item, hasOrgId = false) {
|
|
66
|
+
return (item != null &&
|
|
67
|
+
typeof item === "object" &&
|
|
68
|
+
"key" in item &&
|
|
69
|
+
"title" in item &&
|
|
70
|
+
(!hasOrgId || "orgId" in item));
|
|
71
|
+
}
|
|
72
|
+
BusinessUtils.isCustomCultureData = isCustomCultureData;
|
|
59
73
|
/**
|
|
60
74
|
* Merge custom resources to target collection
|
|
61
75
|
* @param target Target collection merges to
|
|
@@ -63,11 +77,10 @@ var BusinessUtils;
|
|
|
63
77
|
*/
|
|
64
78
|
function mergeCustomResources(target, resources) {
|
|
65
79
|
for (const item of resources) {
|
|
66
|
-
if (item.
|
|
80
|
+
if (item.orgId) {
|
|
67
81
|
// Backup
|
|
68
82
|
const backup = target[item.key];
|
|
69
|
-
if (backup != null &&
|
|
70
|
-
(typeof backup !== "object" || !("organizationId" in backup))) {
|
|
83
|
+
if (backup != null && !isCustomCultureData(backup, true)) {
|
|
71
84
|
resourcesCache[item.key] = backup;
|
|
72
85
|
}
|
|
73
86
|
}
|
package/lib/cjs/i18n/en.json
CHANGED
|
@@ -19,6 +19,13 @@ export declare namespace BusinessUtils {
|
|
|
19
19
|
* @returns 12 months
|
|
20
20
|
*/
|
|
21
21
|
function getMonths(monthLabels: string[], startMonth?: number): ListType[];
|
|
22
|
+
/**
|
|
23
|
+
* Check if the item is a custom culture data
|
|
24
|
+
* @param item Item to check
|
|
25
|
+
* @param hasOrgId Has orgId or not
|
|
26
|
+
* @returns Result
|
|
27
|
+
*/
|
|
28
|
+
function isCustomCultureData(item: unknown, hasOrgId?: boolean): item is CustomCultureData;
|
|
22
29
|
/**
|
|
23
30
|
* Merge custom resources to target collection
|
|
24
31
|
* @param target Target collection merges to
|
|
@@ -53,6 +53,20 @@ export var BusinessUtils;
|
|
|
53
53
|
return months;
|
|
54
54
|
}
|
|
55
55
|
BusinessUtils.getMonths = getMonths;
|
|
56
|
+
/**
|
|
57
|
+
* Check if the item is a custom culture data
|
|
58
|
+
* @param item Item to check
|
|
59
|
+
* @param hasOrgId Has orgId or not
|
|
60
|
+
* @returns Result
|
|
61
|
+
*/
|
|
62
|
+
function isCustomCultureData(item, hasOrgId = false) {
|
|
63
|
+
return (item != null &&
|
|
64
|
+
typeof item === "object" &&
|
|
65
|
+
"key" in item &&
|
|
66
|
+
"title" in item &&
|
|
67
|
+
(!hasOrgId || "orgId" in item));
|
|
68
|
+
}
|
|
69
|
+
BusinessUtils.isCustomCultureData = isCustomCultureData;
|
|
56
70
|
/**
|
|
57
71
|
* Merge custom resources to target collection
|
|
58
72
|
* @param target Target collection merges to
|
|
@@ -60,11 +74,10 @@ export var BusinessUtils;
|
|
|
60
74
|
*/
|
|
61
75
|
function mergeCustomResources(target, resources) {
|
|
62
76
|
for (const item of resources) {
|
|
63
|
-
if (item.
|
|
77
|
+
if (item.orgId) {
|
|
64
78
|
// Backup
|
|
65
79
|
const backup = target[item.key];
|
|
66
|
-
if (backup != null &&
|
|
67
|
-
(typeof backup !== "object" || !("organizationId" in backup))) {
|
|
80
|
+
if (backup != null && !isCustomCultureData(backup, true)) {
|
|
68
81
|
resourcesCache[item.key] = backup;
|
|
69
82
|
}
|
|
70
83
|
}
|
package/lib/mjs/i18n/en.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/appscript",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.32",
|
|
4
4
|
"description": "Applications shared TypeScript framework",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/mjs/index.js",
|
|
@@ -41,11 +41,11 @@
|
|
|
41
41
|
"crypto-js": "^4.2.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@babel/cli": "^7.27.
|
|
45
|
-
"@babel/core": "^7.
|
|
46
|
-
"@babel/plugin-transform-runtime": "^7.
|
|
47
|
-
"@babel/preset-env": "^7.
|
|
48
|
-
"@babel/runtime-corejs3": "^7.27.
|
|
44
|
+
"@babel/cli": "^7.27.1",
|
|
45
|
+
"@babel/core": "^7.27.1",
|
|
46
|
+
"@babel/plugin-transform-runtime": "^7.27.1",
|
|
47
|
+
"@babel/preset-env": "^7.27.1",
|
|
48
|
+
"@babel/runtime-corejs3": "^7.27.1",
|
|
49
49
|
"@types/crypto-js": "^4.2.2",
|
|
50
50
|
"@vitejs/plugin-react": "^4.4.1",
|
|
51
51
|
"jsdom": "^26.1.0",
|
|
@@ -66,6 +66,25 @@ export namespace BusinessUtils {
|
|
|
66
66
|
return months;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
+
/**
|
|
70
|
+
* Check if the item is a custom culture data
|
|
71
|
+
* @param item Item to check
|
|
72
|
+
* @param hasOrgId Has orgId or not
|
|
73
|
+
* @returns Result
|
|
74
|
+
*/
|
|
75
|
+
export function isCustomCultureData(
|
|
76
|
+
item: unknown,
|
|
77
|
+
hasOrgId: boolean = false
|
|
78
|
+
): item is CustomCultureData {
|
|
79
|
+
return (
|
|
80
|
+
item != null &&
|
|
81
|
+
typeof item === "object" &&
|
|
82
|
+
"key" in item &&
|
|
83
|
+
"title" in item &&
|
|
84
|
+
(!hasOrgId || "orgId" in item)
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
69
88
|
/**
|
|
70
89
|
* Merge custom resources to target collection
|
|
71
90
|
* @param target Target collection merges to
|
|
@@ -76,13 +95,10 @@ export namespace BusinessUtils {
|
|
|
76
95
|
resources: CustomCultureData[]
|
|
77
96
|
) {
|
|
78
97
|
for (const item of resources) {
|
|
79
|
-
if (item.
|
|
98
|
+
if (item.orgId) {
|
|
80
99
|
// Backup
|
|
81
100
|
const backup = target[item.key];
|
|
82
|
-
if (
|
|
83
|
-
backup != null &&
|
|
84
|
-
(typeof backup !== "object" || !("organizationId" in backup))
|
|
85
|
-
) {
|
|
101
|
+
if (backup != null && !isCustomCultureData(backup, true)) {
|
|
86
102
|
resourcesCache[item.key] = backup;
|
|
87
103
|
}
|
|
88
104
|
}
|
package/src/def/CustomCulture.ts
CHANGED
package/src/i18n/en.json
CHANGED
package/src/i18n/zh-Hans.json
CHANGED