@etsoo/appscript 1.6.26 → 1.6.28

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,5 +1,4 @@
1
1
  import { ArrayUtils } from "@etsoo/shared";
2
- import { CultureGridItem } from "../../src";
3
2
  import { BusinessUtils } from "../../src/business/BusinessUtils";
4
3
 
5
4
  // Import the ArrayUtils
@@ -12,35 +11,3 @@ test("Tests for BusinessUtils.formatAvatarTitle", () => {
12
11
  expect(BusinessUtils.formatAvatarTitle("Etsoo", 3, "E")).toBe("E");
13
12
  expect(BusinessUtils.formatAvatarTitle("Etsoo", 5)).toBe("ETSOO");
14
13
  });
15
-
16
- test("Tests for BusinessUtils.formatCultues", () => {
17
- // Arrange
18
- const cultures = [
19
- {
20
- id: "zh-Hans",
21
- label: "中文(简体), Chinese (Simplified)"
22
- },
23
- {
24
- id: "en",
25
- label: "英语, English"
26
- },
27
- {
28
- id: "de",
29
- label: "德语, German"
30
- },
31
- {
32
- id: "zh-Hant",
33
- label: "中文(繁体), Chinese (Traditional)"
34
- }
35
- ];
36
- const data: { cultures: CultureGridItem[] } = {
37
- cultures: [{ id: "zh-Hant", title: "繁体" }]
38
- };
39
-
40
- // Act
41
- BusinessUtils.formatCultues(cultures, data);
42
-
43
- // Assert
44
- expect(data.cultures[0].id).toBe("en");
45
- expect(data.cultures.slice(-1)[0].id).toBe("zh-Hant");
46
- });
@@ -1,5 +1,4 @@
1
- import { ListType, ListType1 } from "@etsoo/shared";
2
- import { CultureGridItem } from "./CultureItem";
1
+ import { ListType } from "@etsoo/shared";
3
2
  /**
4
3
  * Business utils
5
4
  */
@@ -12,14 +11,6 @@ export declare namespace BusinessUtils {
12
11
  * @returns Result
13
12
  */
14
13
  function formatAvatarTitle(title?: string, maxChars?: number, defaultTitle?: string): string;
15
- /**
16
- * Format cultures for data
17
- * @param cultures Supported cultures
18
- * @param data Data to format
19
- */
20
- function formatCultues(cultures: ListType1[], data: {
21
- cultures?: CultureGridItem[];
22
- }): void;
23
14
  /**
24
15
  * Get 12-month items
25
16
  * @param monthLabels Month labels
@@ -38,27 +38,6 @@ var BusinessUtils;
38
38
  return defaultTitle;
39
39
  }
40
40
  BusinessUtils.formatAvatarTitle = formatAvatarTitle;
41
- /**
42
- * Format cultures for data
43
- * @param cultures Supported cultures
44
- * @param data Data to format
45
- */
46
- function formatCultues(cultures, data) {
47
- // Add the lost cultures
48
- const allCultures = data.cultures ?? [];
49
- cultures.forEach((culture) => {
50
- if (!allCultures.some((a) => a.id === culture.id)) {
51
- allCultures.push({ id: culture.id, title: "" });
52
- }
53
- });
54
- // Remove the default culture
55
- allCultures.remove((a) => a.id === cultures[0].id);
56
- // Sort
57
- allCultures.sortByProperty("id", cultures.map((c) => c.id));
58
- // Set back
59
- data.cultures = allCultures;
60
- }
61
- BusinessUtils.formatCultues = formatCultues;
62
41
  /**
63
42
  * Get 12-month items
64
43
  * @param monthLabels Month labels
@@ -1,46 +1,42 @@
1
1
  /**
2
- * Culture item for multilingual labels
2
+ * Culture item
3
+ * 文化项目
4
+ * @see com.etsoo.Utils.Serialization.Country.CultureItem
3
5
  */
4
6
  export type CultureItem = {
5
7
  /**
6
- * Target id
8
+ * Id, like zh-Hans-CN
9
+ * 编号,如zh-Hans-CN
7
10
  */
8
- id: number;
9
- /**
10
- * Culture, like zh-Hans
11
- */
12
- culture: string;
11
+ id: string;
13
12
  /**
14
- * Title / label
13
+ * Two characters id, like zh
14
+ * 两个字符编号
15
15
  */
16
- title: string;
16
+ id2: string;
17
17
  /**
18
- * Description
18
+ * Three characters id, like zho
19
+ * 三个字符编号
19
20
  */
20
- description?: string;
21
+ id3: string;
21
22
  /**
22
- * JSON data related
23
+ * Parent culture, like zh-Hans
24
+ * 父文化
23
25
  */
24
- jsonData?: string;
25
- };
26
- /**
27
- * Culture grid item for editing
28
- */
29
- export type CultureGridItem = {
30
- /**
31
- * Culture
32
- */
33
- id: string;
26
+ parent: string;
34
27
  /**
35
- * Title / label
28
+ * Name
29
+ * 名称
36
30
  */
37
- title: string;
31
+ name: string;
38
32
  /**
39
- * Description
33
+ * Native name, like 中文(简体,中国)
34
+ * 原生名
40
35
  */
41
- description?: string;
36
+ nativeName: string;
42
37
  /**
43
- * JSON data related
38
+ * English name, like Chinese (Simplified, China)
39
+ * 英文名
44
40
  */
45
- jsonData?: string;
41
+ englishName: string;
46
42
  };
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Custom culture
3
+ */
4
+ export type CustomCulture = {
5
+ /**
6
+ * Target id
7
+ */
8
+ id: string;
9
+ /**
10
+ * Culture, like zh-Hans
11
+ */
12
+ culture: string;
13
+ /**
14
+ * Organization id
15
+ */
16
+ organizationId?: number;
17
+ /**
18
+ * Title / label
19
+ */
20
+ title: string;
21
+ /**
22
+ * Description
23
+ */
24
+ description?: string;
25
+ /**
26
+ * JSON data related
27
+ * Use Utils.parseString of @etsoo/shared to parse the string to JSON object
28
+ */
29
+ jsonData?: string;
30
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -19,6 +19,7 @@
19
19
  "city": "City",
20
20
  "clear": "Clear",
21
21
  "clearInput": "Clear input",
22
+ "clickToChoose": "Click to choose",
22
23
  "close": "Close",
23
24
  "confirm": "Confirm",
24
25
  "confirmAction": "Are you sure you want to {0}?",
@@ -19,6 +19,7 @@
19
19
  "city": "城市",
20
20
  "clear": "清除",
21
21
  "clearInput": "清除输入",
22
+ "clickToChoose": "点击选择",
22
23
  "close": "关闭",
23
24
  "confirm": "确认",
24
25
  "confirmAction": "确定要{0}吗?",
@@ -19,6 +19,7 @@
19
19
  "city": "城市",
20
20
  "clear": "清除",
21
21
  "clearInput": "清除輸入",
22
+ "clickToChoose": "點擊選擇",
22
23
  "close": "關閉",
23
24
  "confirm": "確認",
24
25
  "confirmAction": "確定要{0}嗎?",
@@ -59,6 +59,7 @@ export * from "./business/RepeatOption";
59
59
  export * from "./business/ShoppingCart";
60
60
  export * from "./custom/CustomField";
61
61
  export * from "./custom/CustomFieldData";
62
+ export * from "./def/CustomCulture";
62
63
  export * from "./def/ListItem";
63
64
  export * from "./i18n/Culture";
64
65
  export { ApiAuthorizationScheme, ApiDataError, ApiMethod, ApiResponseType, createClient, createClientAsync } from "@etsoo/restclient";
package/lib/cjs/index.js CHANGED
@@ -83,6 +83,7 @@ __exportStar(require("./business/ShoppingCart"), exports);
83
83
  __exportStar(require("./custom/CustomField"), exports);
84
84
  __exportStar(require("./custom/CustomFieldData"), exports);
85
85
  // def
86
+ __exportStar(require("./def/CustomCulture"), exports);
86
87
  __exportStar(require("./def/ListItem"), exports);
87
88
  // i18n
88
89
  __exportStar(require("./i18n/Culture"), exports);
@@ -1,5 +1,4 @@
1
- import { ListType, ListType1 } from "@etsoo/shared";
2
- import { CultureGridItem } from "./CultureItem";
1
+ import { ListType } from "@etsoo/shared";
3
2
  /**
4
3
  * Business utils
5
4
  */
@@ -12,14 +11,6 @@ export declare namespace BusinessUtils {
12
11
  * @returns Result
13
12
  */
14
13
  function formatAvatarTitle(title?: string, maxChars?: number, defaultTitle?: string): string;
15
- /**
16
- * Format cultures for data
17
- * @param cultures Supported cultures
18
- * @param data Data to format
19
- */
20
- function formatCultues(cultures: ListType1[], data: {
21
- cultures?: CultureGridItem[];
22
- }): void;
23
14
  /**
24
15
  * Get 12-month items
25
16
  * @param monthLabels Month labels
@@ -35,27 +35,6 @@ export var BusinessUtils;
35
35
  return defaultTitle;
36
36
  }
37
37
  BusinessUtils.formatAvatarTitle = formatAvatarTitle;
38
- /**
39
- * Format cultures for data
40
- * @param cultures Supported cultures
41
- * @param data Data to format
42
- */
43
- function formatCultues(cultures, data) {
44
- // Add the lost cultures
45
- const allCultures = data.cultures ?? [];
46
- cultures.forEach((culture) => {
47
- if (!allCultures.some((a) => a.id === culture.id)) {
48
- allCultures.push({ id: culture.id, title: "" });
49
- }
50
- });
51
- // Remove the default culture
52
- allCultures.remove((a) => a.id === cultures[0].id);
53
- // Sort
54
- allCultures.sortByProperty("id", cultures.map((c) => c.id));
55
- // Set back
56
- data.cultures = allCultures;
57
- }
58
- BusinessUtils.formatCultues = formatCultues;
59
38
  /**
60
39
  * Get 12-month items
61
40
  * @param monthLabels Month labels
@@ -1,46 +1,42 @@
1
1
  /**
2
- * Culture item for multilingual labels
2
+ * Culture item
3
+ * 文化项目
4
+ * @see com.etsoo.Utils.Serialization.Country.CultureItem
3
5
  */
4
6
  export type CultureItem = {
5
7
  /**
6
- * Target id
8
+ * Id, like zh-Hans-CN
9
+ * 编号,如zh-Hans-CN
7
10
  */
8
- id: number;
9
- /**
10
- * Culture, like zh-Hans
11
- */
12
- culture: string;
11
+ id: string;
13
12
  /**
14
- * Title / label
13
+ * Two characters id, like zh
14
+ * 两个字符编号
15
15
  */
16
- title: string;
16
+ id2: string;
17
17
  /**
18
- * Description
18
+ * Three characters id, like zho
19
+ * 三个字符编号
19
20
  */
20
- description?: string;
21
+ id3: string;
21
22
  /**
22
- * JSON data related
23
+ * Parent culture, like zh-Hans
24
+ * 父文化
23
25
  */
24
- jsonData?: string;
25
- };
26
- /**
27
- * Culture grid item for editing
28
- */
29
- export type CultureGridItem = {
30
- /**
31
- * Culture
32
- */
33
- id: string;
26
+ parent: string;
34
27
  /**
35
- * Title / label
28
+ * Name
29
+ * 名称
36
30
  */
37
- title: string;
31
+ name: string;
38
32
  /**
39
- * Description
33
+ * Native name, like 中文(简体,中国)
34
+ * 原生名
40
35
  */
41
- description?: string;
36
+ nativeName: string;
42
37
  /**
43
- * JSON data related
38
+ * English name, like Chinese (Simplified, China)
39
+ * 英文名
44
40
  */
45
- jsonData?: string;
41
+ englishName: string;
46
42
  };
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Custom culture
3
+ */
4
+ export type CustomCulture = {
5
+ /**
6
+ * Target id
7
+ */
8
+ id: string;
9
+ /**
10
+ * Culture, like zh-Hans
11
+ */
12
+ culture: string;
13
+ /**
14
+ * Organization id
15
+ */
16
+ organizationId?: number;
17
+ /**
18
+ * Title / label
19
+ */
20
+ title: string;
21
+ /**
22
+ * Description
23
+ */
24
+ description?: string;
25
+ /**
26
+ * JSON data related
27
+ * Use Utils.parseString of @etsoo/shared to parse the string to JSON object
28
+ */
29
+ jsonData?: string;
30
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -19,6 +19,7 @@
19
19
  "city": "City",
20
20
  "clear": "Clear",
21
21
  "clearInput": "Clear input",
22
+ "clickToChoose": "Click to choose",
22
23
  "close": "Close",
23
24
  "confirm": "Confirm",
24
25
  "confirmAction": "Are you sure you want to {0}?",
@@ -19,6 +19,7 @@
19
19
  "city": "城市",
20
20
  "clear": "清除",
21
21
  "clearInput": "清除输入",
22
+ "clickToChoose": "点击选择",
22
23
  "close": "关闭",
23
24
  "confirm": "确认",
24
25
  "confirmAction": "确定要{0}吗?",
@@ -19,6 +19,7 @@
19
19
  "city": "城市",
20
20
  "clear": "清除",
21
21
  "clearInput": "清除輸入",
22
+ "clickToChoose": "點擊選擇",
22
23
  "close": "關閉",
23
24
  "confirm": "確認",
24
25
  "confirmAction": "確定要{0}嗎?",
@@ -59,6 +59,7 @@ export * from "./business/RepeatOption";
59
59
  export * from "./business/ShoppingCart";
60
60
  export * from "./custom/CustomField";
61
61
  export * from "./custom/CustomFieldData";
62
+ export * from "./def/CustomCulture";
62
63
  export * from "./def/ListItem";
63
64
  export * from "./i18n/Culture";
64
65
  export { ApiAuthorizationScheme, ApiDataError, ApiMethod, ApiResponseType, createClient, createClientAsync } from "@etsoo/restclient";
package/lib/mjs/index.js CHANGED
@@ -66,6 +66,7 @@ export * from "./business/ShoppingCart";
66
66
  export * from "./custom/CustomField";
67
67
  export * from "./custom/CustomFieldData";
68
68
  // def
69
+ export * from "./def/CustomCulture";
69
70
  export * from "./def/ListItem";
70
71
  // i18n
71
72
  export * from "./i18n/Culture";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/appscript",
3
- "version": "1.6.26",
3
+ "version": "1.6.28",
4
4
  "description": "Applications shared TypeScript framework",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -50,6 +50,6 @@
50
50
  "@vitejs/plugin-react": "^4.4.1",
51
51
  "jsdom": "^26.1.0",
52
52
  "typescript": "^5.8.3",
53
- "vitest": "^3.1.1"
53
+ "vitest": "^3.1.2"
54
54
  }
55
55
  }
@@ -1,5 +1,4 @@
1
- import { ListType, ListType1 } from "@etsoo/shared";
2
- import { CultureGridItem } from "./CultureItem";
1
+ import { ListType } from "@etsoo/shared";
3
2
 
4
3
  /**
5
4
  * Business utils
@@ -44,35 +43,6 @@ export namespace BusinessUtils {
44
43
  return defaultTitle;
45
44
  }
46
45
 
47
- /**
48
- * Format cultures for data
49
- * @param cultures Supported cultures
50
- * @param data Data to format
51
- */
52
- export function formatCultues(
53
- cultures: ListType1[],
54
- data: { cultures?: CultureGridItem[] }
55
- ) {
56
- // Add the lost cultures
57
- const allCultures = data.cultures ?? [];
58
- cultures.forEach((culture) => {
59
- if (!allCultures.some((a) => a.id === culture.id)) {
60
- allCultures.push({ id: culture.id, title: "" });
61
- }
62
- });
63
-
64
- // Remove the default culture
65
- allCultures.remove((a) => a.id === cultures[0].id);
66
- // Sort
67
- allCultures.sortByProperty(
68
- "id",
69
- cultures.map((c) => c.id)
70
- );
71
-
72
- // Set back
73
- data.cultures = allCultures;
74
- }
75
-
76
46
  /**
77
47
  * Get 12-month items
78
48
  * @param monthLabels Month labels
@@ -1,54 +1,48 @@
1
1
  /**
2
- * Culture item for multilingual labels
2
+ * Culture item
3
+ * 文化项目
4
+ * @see com.etsoo.Utils.Serialization.Country.CultureItem
3
5
  */
4
6
  export type CultureItem = {
5
7
  /**
6
- * Target id
8
+ * Id, like zh-Hans-CN
9
+ * 编号,如zh-Hans-CN
7
10
  */
8
- id: number;
9
-
10
- /**
11
- * Culture, like zh-Hans
12
- */
13
- culture: string;
14
-
15
- /**
16
- * Title / label
17
- */
18
- title: string;
11
+ id: string;
19
12
 
20
13
  /**
21
- * Description
14
+ * Two characters id, like zh
15
+ * 两个字符编号
22
16
  */
23
- description?: string;
17
+ id2: string;
24
18
 
25
19
  /**
26
- * JSON data related
20
+ * Three characters id, like zho
21
+ * 三个字符编号
27
22
  */
28
- jsonData?: string;
29
- };
23
+ id3: string;
30
24
 
31
- /**
32
- * Culture grid item for editing
33
- */
34
- export type CultureGridItem = {
35
25
  /**
36
- * Culture
26
+ * Parent culture, like zh-Hans
27
+ * 父文化
37
28
  */
38
- id: string;
29
+ parent: string;
39
30
 
40
31
  /**
41
- * Title / label
32
+ * Name
33
+ * 名称
42
34
  */
43
- title: string;
35
+ name: string;
44
36
 
45
37
  /**
46
- * Description
38
+ * Native name, like 中文(简体,中国)
39
+ * 原生名
47
40
  */
48
- description?: string;
41
+ nativeName: string;
49
42
 
50
43
  /**
51
- * JSON data related
44
+ * English name, like Chinese (Simplified, China)
45
+ * 英文名
52
46
  */
53
- jsonData?: string;
47
+ englishName: string;
54
48
  };
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Custom culture
3
+ */
4
+ export type CustomCulture = {
5
+ /**
6
+ * Target id
7
+ */
8
+ id: string;
9
+
10
+ /**
11
+ * Culture, like zh-Hans
12
+ */
13
+ culture: string;
14
+
15
+ /**
16
+ * Organization id
17
+ */
18
+ organizationId?: number;
19
+
20
+ /**
21
+ * Title / label
22
+ */
23
+ title: string;
24
+
25
+ /**
26
+ * Description
27
+ */
28
+ description?: string;
29
+
30
+ /**
31
+ * JSON data related
32
+ * Use Utils.parseString of @etsoo/shared to parse the string to JSON object
33
+ */
34
+ jsonData?: string;
35
+ };
package/src/i18n/en.json CHANGED
@@ -19,6 +19,7 @@
19
19
  "city": "City",
20
20
  "clear": "Clear",
21
21
  "clearInput": "Clear input",
22
+ "clickToChoose": "Click to choose",
22
23
  "close": "Close",
23
24
  "confirm": "Confirm",
24
25
  "confirmAction": "Are you sure you want to {0}?",
@@ -19,6 +19,7 @@
19
19
  "city": "城市",
20
20
  "clear": "清除",
21
21
  "clearInput": "清除输入",
22
+ "clickToChoose": "点击选择",
22
23
  "close": "关闭",
23
24
  "confirm": "确认",
24
25
  "confirmAction": "确定要{0}吗?",
@@ -19,6 +19,7 @@
19
19
  "city": "城市",
20
20
  "clear": "清除",
21
21
  "clearInput": "清除輸入",
22
+ "clickToChoose": "點擊選擇",
22
23
  "close": "關閉",
23
24
  "confirm": "確認",
24
25
  "confirmAction": "確定要{0}嗎?",
package/src/index.ts CHANGED
@@ -74,6 +74,7 @@ export * from "./custom/CustomField";
74
74
  export * from "./custom/CustomFieldData";
75
75
 
76
76
  // def
77
+ export * from "./def/CustomCulture";
77
78
  export * from "./def/ListItem";
78
79
 
79
80
  // i18n