@etsoo/appscript 1.5.63 → 1.5.65

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.
Files changed (196) hide show
  1. package/.github/workflows/main.yml +6 -5
  2. package/README.md +97 -71
  3. package/__tests__/app/CoreApp.ts +141 -143
  4. package/__tests__/app/Culture.ts +23 -23
  5. package/__tests__/app/TestApp.ts +107 -105
  6. package/__tests__/business/BusinessUtils.ts +37 -37
  7. package/__tests__/result/ActionResult.ts +14 -14
  8. package/__tests__/tsconfig.json +16 -16
  9. package/babel.config.json +8 -8
  10. package/lib/cjs/address/AddressAutocomplete.d.ts +1 -1
  11. package/lib/cjs/address/AddressPlace.d.ts +3 -3
  12. package/lib/cjs/address/AddressPlaceBase.d.ts +1 -1
  13. package/lib/cjs/address/AddressRegion.d.ts +2 -2
  14. package/lib/cjs/address/AddressRegion.js +12 -12
  15. package/lib/cjs/address/AddressUtils.d.ts +1 -1
  16. package/lib/cjs/api/AuthApi.d.ts +14 -14
  17. package/lib/cjs/api/AuthApi.js +17 -17
  18. package/lib/cjs/api/BaseApi.d.ts +1 -1
  19. package/lib/cjs/api/EntityApi.d.ts +8 -8
  20. package/lib/cjs/api/EntityApi.js +4 -4
  21. package/lib/cjs/api/dto/AuditLineDto.d.ts +24 -0
  22. package/lib/cjs/api/dto/AuditLineDto.js +2 -0
  23. package/lib/cjs/api/dto/IdLabelDto.d.ts +1 -1
  24. package/lib/cjs/api/dto/IdLabelPrimaryDto.d.ts +1 -1
  25. package/lib/cjs/api/dto/PinDto.d.ts +61 -0
  26. package/lib/cjs/api/dto/PinDto.js +2 -0
  27. package/lib/cjs/api/dto/ResultPayload.d.ts +2 -2
  28. package/lib/cjs/api/rq/AuthRequest.d.ts +1 -1
  29. package/lib/cjs/api/rq/LoginRQ.d.ts +2 -2
  30. package/lib/cjs/api/rq/MergeRQ.d.ts +1 -1
  31. package/lib/cjs/api/rq/QueryRQ.d.ts +2 -2
  32. package/lib/cjs/api/rq/StatusQueryRQ.d.ts +3 -3
  33. package/lib/cjs/api/rq/UpdateModel.d.ts +2 -2
  34. package/lib/cjs/api/rq/UpdateStatusRQ.d.ts +2 -2
  35. package/lib/cjs/app/AppSettings.d.ts +3 -3
  36. package/lib/cjs/bridges/FlutterHost.d.ts +2 -2
  37. package/lib/cjs/bridges/FlutterHost.js +11 -11
  38. package/lib/cjs/business/BusinessTax.js +6 -6
  39. package/lib/cjs/business/BusinessUtils.d.ts +2 -2
  40. package/lib/cjs/business/BusinessUtils.js +5 -5
  41. package/lib/cjs/business/Currency.d.ts +1 -1
  42. package/lib/cjs/business/Currency.js +10 -10
  43. package/lib/cjs/business/ProductUnit.d.ts +1 -1
  44. package/lib/cjs/business/ShoppingCart.d.ts +9 -9
  45. package/lib/cjs/business/ShoppingCart.js +11 -11
  46. package/lib/cjs/custom/CustomField.d.ts +1 -1
  47. package/lib/cjs/custom/CustomFieldData.d.ts +2 -2
  48. package/lib/cjs/i18n/Culture.d.ts +31 -0
  49. package/lib/cjs/i18n/Culture.js +51 -0
  50. package/lib/cjs/index.d.ts +3 -4
  51. package/lib/cjs/index.js +3 -4
  52. package/lib/cjs/result/ActionResult.d.ts +1 -1
  53. package/lib/cjs/result/ActionResultError.d.ts +1 -1
  54. package/lib/cjs/result/ActionResultError.js +3 -3
  55. package/lib/cjs/result/InitCallResult.d.ts +1 -1
  56. package/lib/cjs/state/Culture.d.ts +2 -2
  57. package/lib/cjs/state/User.d.ts +1 -1
  58. package/lib/mjs/address/AddressAutocomplete.d.ts +1 -1
  59. package/lib/mjs/address/AddressPlace.d.ts +3 -3
  60. package/lib/mjs/address/AddressPlaceBase.d.ts +1 -1
  61. package/lib/mjs/address/AddressRegion.d.ts +2 -2
  62. package/lib/mjs/address/AddressRegion.js +13 -13
  63. package/lib/mjs/address/AddressUtils.d.ts +1 -1
  64. package/lib/mjs/address/AddressUtils.js +1 -1
  65. package/lib/mjs/api/AuthApi.d.ts +14 -14
  66. package/lib/mjs/api/AuthApi.js +19 -19
  67. package/lib/mjs/api/BaseApi.d.ts +1 -1
  68. package/lib/mjs/api/EntityApi.d.ts +8 -8
  69. package/lib/mjs/api/EntityApi.js +5 -5
  70. package/lib/mjs/api/dto/AuditLineDto.d.ts +24 -0
  71. package/lib/mjs/api/dto/AuditLineDto.js +1 -0
  72. package/lib/mjs/api/dto/IdLabelDto.d.ts +1 -1
  73. package/lib/mjs/api/dto/IdLabelPrimaryDto.d.ts +1 -1
  74. package/lib/mjs/api/dto/PinDto.d.ts +61 -0
  75. package/lib/mjs/api/dto/PinDto.js +1 -0
  76. package/lib/mjs/api/dto/ResultPayload.d.ts +2 -2
  77. package/lib/mjs/api/rq/AuthRequest.d.ts +1 -1
  78. package/lib/mjs/api/rq/LoginRQ.d.ts +2 -2
  79. package/lib/mjs/api/rq/MergeRQ.d.ts +1 -1
  80. package/lib/mjs/api/rq/QueryRQ.d.ts +2 -2
  81. package/lib/mjs/api/rq/StatusQueryRQ.d.ts +3 -3
  82. package/lib/mjs/api/rq/UpdateModel.d.ts +2 -2
  83. package/lib/mjs/api/rq/UpdateStatusRQ.d.ts +2 -2
  84. package/lib/mjs/app/AppSettings.d.ts +3 -3
  85. package/lib/mjs/bridges/FlutterHost.d.ts +2 -2
  86. package/lib/mjs/bridges/FlutterHost.js +13 -13
  87. package/lib/mjs/business/BusinessTax.js +6 -6
  88. package/lib/mjs/business/BusinessUtils.d.ts +2 -2
  89. package/lib/mjs/business/BusinessUtils.js +5 -5
  90. package/lib/mjs/business/Currency.d.ts +1 -1
  91. package/lib/mjs/business/Currency.js +10 -10
  92. package/lib/mjs/business/ProductUnit.d.ts +1 -1
  93. package/lib/mjs/business/ProductUnit.js +1 -1
  94. package/lib/mjs/business/ShoppingCart.d.ts +9 -9
  95. package/lib/mjs/business/ShoppingCart.js +12 -12
  96. package/lib/mjs/custom/CustomField.d.ts +1 -1
  97. package/lib/mjs/custom/CustomFieldData.d.ts +2 -2
  98. package/lib/mjs/i18n/Culture.d.ts +31 -0
  99. package/lib/mjs/i18n/Culture.js +48 -0
  100. package/lib/mjs/index.d.ts +3 -4
  101. package/lib/mjs/index.js +3 -4
  102. package/lib/mjs/result/ActionResult.d.ts +1 -1
  103. package/lib/mjs/result/ActionResult.js +1 -1
  104. package/lib/mjs/result/ActionResultError.d.ts +1 -1
  105. package/lib/mjs/result/ActionResultError.js +3 -3
  106. package/lib/mjs/result/InitCallResult.d.ts +1 -1
  107. package/lib/mjs/state/Culture.d.ts +2 -2
  108. package/lib/mjs/state/User.d.ts +1 -1
  109. package/package.json +1 -1
  110. package/src/address/AddressAutocomplete.ts +16 -16
  111. package/src/address/AddressCity.ts +12 -12
  112. package/src/address/AddressContinent.ts +35 -35
  113. package/src/address/AddressDistrict.ts +12 -12
  114. package/src/address/AddressLocation.ts +8 -8
  115. package/src/address/AddressPlace.ts +23 -23
  116. package/src/address/AddressPlaceBase.ts +31 -31
  117. package/src/address/AddressRegion.ts +286 -286
  118. package/src/address/AddressState.ts +12 -12
  119. package/src/address/AddressUtils.ts +27 -27
  120. package/src/api/AuthApi.ts +194 -194
  121. package/src/api/BaseApi.ts +13 -13
  122. package/src/api/EntityApi.ts +181 -194
  123. package/src/api/dto/AntiforgeryRequestToken.ts +15 -15
  124. package/src/api/dto/ApiRefreshTokenDto.ts +16 -16
  125. package/src/api/dto/AuditLineDto.ts +27 -0
  126. package/src/api/dto/IdLabelDto.ts +3 -3
  127. package/src/api/dto/IdLabelPrimaryDto.ts +7 -7
  128. package/src/api/dto/InitCallDto.ts +12 -12
  129. package/src/api/dto/PinDto.ts +71 -0
  130. package/src/api/dto/ResultPayload.ts +6 -6
  131. package/src/api/rq/ApiRefreshTokenRQ.ts +8 -8
  132. package/src/api/rq/AuthRequest.ts +40 -40
  133. package/src/api/rq/GetLogInUrlRQ.ts +8 -8
  134. package/src/api/rq/LoginIdRQ.ts +12 -12
  135. package/src/api/rq/LoginRQ.ts +18 -18
  136. package/src/api/rq/MergeRQ.ts +13 -13
  137. package/src/api/rq/QueryPagingData.ts +16 -16
  138. package/src/api/rq/QueryRQ.ts +22 -22
  139. package/src/api/rq/RefreshTokenRQ.ts +4 -4
  140. package/src/api/rq/ResetPasswordRQ.ts +20 -20
  141. package/src/api/rq/SignoutRQ.ts +8 -8
  142. package/src/api/rq/StatusQueryRQ.ts +11 -11
  143. package/src/api/rq/SwitchOrgRQ.ts +8 -8
  144. package/src/api/rq/TokenRQ.ts +4 -4
  145. package/src/api/rq/UpdateModel.ts +12 -12
  146. package/src/api/rq/UpdateStatusRQ.ts +10 -10
  147. package/src/app/AppSettings.ts +27 -27
  148. package/src/app/UserRole.ts +44 -44
  149. package/src/bridges/FlutterHost.ts +92 -97
  150. package/src/bridges/IBridgeHost.ts +49 -51
  151. package/src/business/ApiService.ts +25 -25
  152. package/src/business/BusinessTax.ts +63 -63
  153. package/src/business/BusinessUtils.ts +75 -75
  154. package/src/business/CultureItem.ts +43 -43
  155. package/src/business/Currency.ts +11 -11
  156. package/src/business/DataPrivacy.ts +35 -35
  157. package/src/business/EntityStatus.ts +44 -44
  158. package/src/business/ProductUnit.ts +58 -58
  159. package/src/business/RepeatOption.ts +50 -50
  160. package/src/business/ShoppingCart.ts +696 -706
  161. package/src/custom/CustomField.ts +20 -20
  162. package/src/custom/CustomFieldData.ts +43 -43
  163. package/src/def/ListItem.ts +12 -12
  164. package/src/i18n/Culture.ts +60 -0
  165. package/src/i18n/en.json +244 -244
  166. package/src/i18n/zh-Hans.json +244 -244
  167. package/src/i18n/zh-Hant.json +244 -244
  168. package/src/index.ts +3 -4
  169. package/src/result/ActionResult.ts +19 -19
  170. package/src/result/ActionResultError.ts +30 -30
  171. package/src/result/InitCallResult.ts +21 -21
  172. package/src/state/Culture.ts +3 -3
  173. package/src/state/State.ts +5 -5
  174. package/src/state/User.ts +92 -92
  175. package/tsconfig.cjs.json +17 -17
  176. package/tsconfig.json +17 -17
  177. package/lib/cjs/i18n/CultureUtils.d.ts +0 -13
  178. package/lib/cjs/i18n/CultureUtils.js +0 -32
  179. package/lib/cjs/i18n/en.d.ts +0 -6
  180. package/lib/cjs/i18n/en.js +0 -12
  181. package/lib/cjs/i18n/zhHans.d.ts +0 -6
  182. package/lib/cjs/i18n/zhHans.js +0 -12
  183. package/lib/cjs/i18n/zhHant.d.ts +0 -6
  184. package/lib/cjs/i18n/zhHant.js +0 -12
  185. package/lib/mjs/i18n/CultureUtils.d.ts +0 -13
  186. package/lib/mjs/i18n/CultureUtils.js +0 -29
  187. package/lib/mjs/i18n/en.d.ts +0 -6
  188. package/lib/mjs/i18n/en.js +0 -8
  189. package/lib/mjs/i18n/zhHans.d.ts +0 -6
  190. package/lib/mjs/i18n/zhHans.js +0 -8
  191. package/lib/mjs/i18n/zhHant.d.ts +0 -6
  192. package/lib/mjs/i18n/zhHant.js +0 -8
  193. package/src/i18n/CultureUtils.ts +0 -36
  194. package/src/i18n/en.ts +0 -10
  195. package/src/i18n/zhHans.ts +0 -10
  196. package/src/i18n/zhHant.ts +0 -10
@@ -1,22 +1,22 @@
1
- import { CustomFieldData } from './CustomFieldData';
1
+ import { CustomFieldData } from "./CustomFieldData";
2
2
 
3
3
  /**
4
4
  * Custom field reference
5
5
  * 自定义字段引用
6
6
  */
7
7
  export type CustomFieldRef<V> = {
8
- /**
9
- * Get value
10
- */
11
- getValue(): V | undefined;
8
+ /**
9
+ * Get value
10
+ */
11
+ getValue(): V | undefined;
12
12
 
13
- /**
14
- * Set value
15
- * Its type is 'unknown' because the 'type' configuration of the CustomField may be changed
16
- * First time editing with the new 'type' may break the component
17
- * @param value Value, similar with the 'defaultValue' of the component
18
- */
19
- setValue(value: unknown): void;
13
+ /**
14
+ * Set value
15
+ * Its type is 'unknown' because the 'type' configuration of the CustomField may be changed
16
+ * First time editing with the new 'type' may break the component
17
+ * @param value Value, similar with the 'defaultValue' of the component
18
+ */
19
+ setValue(value: unknown): void;
20
20
  };
21
21
 
22
22
  /**
@@ -24,9 +24,9 @@ export type CustomFieldRef<V> = {
24
24
  * 自定义字段属性
25
25
  */
26
26
  export type CustomFieldProps<D extends CustomFieldData, V> = {
27
- field: D;
28
- onChange: (name: string, value: V | undefined) => void;
29
- defaultValue?: unknown;
27
+ field: D;
28
+ onChange: (name: string, value: V | undefined) => void;
29
+ defaultValue?: unknown;
30
30
  };
31
31
 
32
32
  /**
@@ -34,10 +34,10 @@ export type CustomFieldProps<D extends CustomFieldData, V> = {
34
34
  * 自定义字段接口
35
35
  */
36
36
  export interface ICustomField<
37
- V,
38
- D extends CustomFieldData,
39
- P extends CustomFieldProps<D, V>,
40
- R
37
+ V,
38
+ D extends CustomFieldData,
39
+ P extends CustomFieldProps<D, V>,
40
+ R
41
41
  > {
42
- (props: P): R;
42
+ (props: P): R;
43
43
  }
@@ -1,64 +1,64 @@
1
- import { IdType, ListType2 } from '@etsoo/shared';
1
+ import { IdType, ListType2 } from "@etsoo/shared";
2
2
 
3
3
  /**
4
4
  * Custom field space (12 columns)
5
5
  * 自定义字段空间(12列)
6
6
  */
7
7
  export type CustomFieldSpace =
8
- | 'quater'
9
- | 'half'
10
- | 'half1'
11
- | 'full'
12
- | 'five'
13
- | 'seven';
8
+ | "quater"
9
+ | "half"
10
+ | "half1"
11
+ | "full"
12
+ | "five"
13
+ | "seven";
14
14
 
15
15
  /**
16
16
  * Custom field data
17
17
  * 自定义字段数据
18
18
  */
19
19
  export type CustomFieldData = {
20
- /**
21
- * Type
22
- */
23
- type: string;
20
+ /**
21
+ * Type
22
+ */
23
+ type: string;
24
24
 
25
- /**
26
- * Field name
27
- */
28
- name?: string;
25
+ /**
26
+ * Field name
27
+ */
28
+ name?: string;
29
29
 
30
- /**
31
- * Options
32
- */
33
- options?: ListType2[];
30
+ /**
31
+ * Options
32
+ */
33
+ options?: ListType2[];
34
34
 
35
- /**
36
- * Refs
37
- */
38
- refs?: [string, ...IdType[]];
35
+ /**
36
+ * Refs
37
+ */
38
+ refs?: [string, ...IdType[]];
39
39
 
40
- /**
41
- * Space
42
- */
43
- space?: CustomFieldSpace;
40
+ /**
41
+ * Space
42
+ */
43
+ space?: CustomFieldSpace;
44
44
 
45
- /**
46
- * Grid item proerties
47
- */
48
- gridItemProps?: Record<string, any>;
45
+ /**
46
+ * Grid item proerties
47
+ */
48
+ gridItemProps?: Record<string, any>;
49
49
 
50
- /**
51
- * Main slot properties
52
- */
53
- mainSlotProps?: Record<string, any>;
50
+ /**
51
+ * Main slot properties
52
+ */
53
+ mainSlotProps?: Record<string, any>;
54
54
 
55
- /**
56
- * Label
57
- */
58
- label?: string;
55
+ /**
56
+ * Label
57
+ */
58
+ label?: string;
59
59
 
60
- /**
61
- * Helper text
62
- */
63
- helperText?: string;
60
+ /**
61
+ * Helper text
62
+ */
63
+ helperText?: string;
64
64
  };
@@ -2,18 +2,18 @@
2
2
  * List item definition
3
3
  */
4
4
  export type ListItem<T, E = any> = {
5
- /**
6
- * Label, '-' for divider
7
- */
8
- label: string;
5
+ /**
6
+ * Label, '-' for divider
7
+ */
8
+ label: string;
9
9
 
10
- /**
11
- * Icon
12
- */
13
- icon?: T;
10
+ /**
11
+ * Icon
12
+ */
13
+ icon?: T;
14
14
 
15
- /**
16
- * Action, string for URL, any for state
17
- */
18
- action?: string | [string, any] | ((event: E) => PromiseLike<void> | void);
15
+ /**
16
+ * Action, string for URL, any for state
17
+ */
18
+ action?: string | [string, any] | ((event: E) => PromiseLike<void> | void);
19
19
  };
@@ -0,0 +1,60 @@
1
+ import { DataTypes, DomUtils } from "@etsoo/shared";
2
+
3
+ /**
4
+ * Culture namespace
5
+ */
6
+ export namespace Culture {
7
+ /**
8
+ * Make culture
9
+ * @param cultureMaker Culture maker
10
+ * @param resources Resources
11
+ * @returns Culture
12
+ */
13
+ export function make(
14
+ cultureMaker: typeof DomUtils.zhHans,
15
+ ...resources: (object | (() => Promise<object>))[]
16
+ ) {
17
+ return cultureMaker(async () => {
18
+ const rs = await Promise.all(
19
+ resources.map(
20
+ (resource) =>
21
+ new Promise<object>((resolve) => {
22
+ if (typeof resource === "object") {
23
+ resolve(resource);
24
+ } else {
25
+ resource().then((result) => resolve(result));
26
+ }
27
+ })
28
+ )
29
+ );
30
+ return rs.reduce((prev, curr) => ({
31
+ ...prev,
32
+ ...curr
33
+ })) as DataTypes.StringRecord;
34
+ });
35
+ }
36
+
37
+ /**
38
+ * Get en neutral culture
39
+ * @param localResources Local resources
40
+ * @returns Full culture
41
+ */
42
+ export const en = (...resources: (object | (() => Promise<object>))[]) =>
43
+ make(DomUtils.en, import("./en.json"), ...resources);
44
+
45
+ /**
46
+ * Get zh-Hans neutral cultrue
47
+ * @param localResources Local resources
48
+ * @returns Full culture
49
+ */
50
+ export const zhHans = (...resources: (object | (() => Promise<object>))[]) =>
51
+ make(DomUtils.zhHans, import("./zh-Hans.json"), ...resources);
52
+
53
+ /**
54
+ * Get zh-Hant neutral cultrue
55
+ * @param localResources Local resources
56
+ * @returns Full culture
57
+ */
58
+ export const zhHant = (...resources: (object | (() => Promise<object>))[]) =>
59
+ make(DomUtils.zhHant, import("./zh-Hant.json"), ...resources);
60
+ }