@etsoo/appscript 1.4.89 → 1.4.91

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/README.md CHANGED
@@ -86,6 +86,12 @@ $ yarn add @etsoo/appscript
86
86
  #### RepeatOption.ts ####
87
87
  - RepeatOption - Repeat options
88
88
 
89
+ ### custom - Custom dynamic component rendering
90
+
91
+ #### CustomFieldData.ts ####
92
+ - CustomFieldSpace - Custom field space (12 columns)
93
+ - CustomFieldData - Custom field data
94
+
89
95
  ### def - Type definition
90
96
 
91
97
  #### ListItem.ts ####
@@ -0,0 +1,32 @@
1
+ import { CustomFieldData } from './CustomFieldData';
2
+ /**
3
+ * Custom field reference
4
+ * 自定义字段引用
5
+ */
6
+ export type CustomFieldRef = {
7
+ /**
8
+ * Get value
9
+ */
10
+ getValue(): unknown;
11
+ /**
12
+ * Set value
13
+ * @param value Value
14
+ */
15
+ setValue(value: unknown): void;
16
+ };
17
+ /**
18
+ * Custom field props
19
+ * 自定义字段属性
20
+ */
21
+ export type CustomFieldProps<D extends CustomFieldData> = {
22
+ field: D;
23
+ onChange: (name: string, value: unknown) => void;
24
+ defaultValue?: unknown;
25
+ };
26
+ /**
27
+ * Custom field interface
28
+ * 自定义字段接口
29
+ */
30
+ export interface ICustomField<D extends CustomFieldData, R> {
31
+ (props: CustomFieldProps<D>): R;
32
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,48 @@
1
+ import { IdType, ListType2 } from '@etsoo/shared';
2
+ /**
3
+ * Custom field space (12 columns)
4
+ * 自定义字段空间(12列)
5
+ */
6
+ export type CustomFieldSpace = 'quater' | 'half' | 'half1' | 'full' | 'five' | 'seven';
7
+ /**
8
+ * Custom field data
9
+ * 自定义字段数据
10
+ */
11
+ export type CustomFieldData = {
12
+ /**
13
+ * Type
14
+ */
15
+ type: string;
16
+ /**
17
+ * Field name
18
+ */
19
+ name?: string;
20
+ /**
21
+ * Options
22
+ */
23
+ options?: ListType2[];
24
+ /**
25
+ * Refs
26
+ */
27
+ refs?: [string, ...IdType[]];
28
+ /**
29
+ * Space
30
+ */
31
+ space?: CustomFieldSpace;
32
+ /**
33
+ * Grid item proerties
34
+ */
35
+ gridItemProps?: Record<string, any>;
36
+ /**
37
+ * Main slot properties
38
+ */
39
+ mainSlotProps?: Record<string, any>;
40
+ /**
41
+ * Label
42
+ */
43
+ label?: string;
44
+ /**
45
+ * Helper text
46
+ */
47
+ helperText?: string;
48
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -38,7 +38,11 @@ class EntityApi extends BaseApi_1.BaseApi {
38
38
  * @returns Result
39
39
  */
40
40
  listBase(rq, payload) {
41
- return this.api.post(`${this.flag}/List`, rq, payload);
41
+ let { queryPaging, ...rest } = rq;
42
+ if (typeof queryPaging === 'number') {
43
+ queryPaging = { currentPage: 0, batchSize: queryPaging };
44
+ }
45
+ return this.api.post(`${this.flag}/List`, { queryPaging, ...rest }, payload);
42
46
  }
43
47
  /**
44
48
  * Merge
@@ -33,7 +33,7 @@ class OrgApi extends EntityApi_1.EntityApi {
33
33
  else {
34
34
  if (typeof serviceId === 'object')
35
35
  return undefined;
36
- return this.listBase({ items, serviceId }, { defaultValue: [], showLoading: false });
36
+ return this.listBase({ queryPaging: items, serviceId }, { defaultValue: [], showLoading: false });
37
37
  }
38
38
  }
39
39
  /**
@@ -1,4 +1,5 @@
1
1
  import { IdType } from '@etsoo/shared';
2
+ import { QueryPagingData } from './QueryPagingData';
2
3
  /**
3
4
  * Tiplist request data
4
5
  * com.etsoo.CoreFramework.Models.TiplistRQ
@@ -17,7 +18,7 @@ export type TiplistRQ<T extends IdType = number> = {
17
18
  */
18
19
  keyword?: string;
19
20
  /**
20
- * Max items to return
21
+ * Query paging data or items to read
21
22
  */
22
- items?: number;
23
+ queryPaging?: QueryPagingData | number;
23
24
  };
@@ -25,6 +25,8 @@ export * from './business/EntityStatus';
25
25
  export * from './business/ProductUnit';
26
26
  export * from './business/RepeatOption';
27
27
  export * from './business/ShoppingCart';
28
+ export * from './custom/CustomField';
29
+ export * from './custom/CustomFieldData';
28
30
  export * from './def/ListItem';
29
31
  export * from './erp/dto/AuditLineDto';
30
32
  export * from './erp/dto/CurrencyDto';
package/lib/cjs/index.js CHANGED
@@ -46,6 +46,9 @@ __exportStar(require("./business/EntityStatus"), exports);
46
46
  __exportStar(require("./business/ProductUnit"), exports);
47
47
  __exportStar(require("./business/RepeatOption"), exports);
48
48
  __exportStar(require("./business/ShoppingCart"), exports);
49
+ // custom
50
+ __exportStar(require("./custom/CustomField"), exports);
51
+ __exportStar(require("./custom/CustomFieldData"), exports);
49
52
  // def
50
53
  __exportStar(require("./def/ListItem"), exports);
51
54
  // erp dto
@@ -0,0 +1,32 @@
1
+ import { CustomFieldData } from './CustomFieldData';
2
+ /**
3
+ * Custom field reference
4
+ * 自定义字段引用
5
+ */
6
+ export type CustomFieldRef = {
7
+ /**
8
+ * Get value
9
+ */
10
+ getValue(): unknown;
11
+ /**
12
+ * Set value
13
+ * @param value Value
14
+ */
15
+ setValue(value: unknown): void;
16
+ };
17
+ /**
18
+ * Custom field props
19
+ * 自定义字段属性
20
+ */
21
+ export type CustomFieldProps<D extends CustomFieldData> = {
22
+ field: D;
23
+ onChange: (name: string, value: unknown) => void;
24
+ defaultValue?: unknown;
25
+ };
26
+ /**
27
+ * Custom field interface
28
+ * 自定义字段接口
29
+ */
30
+ export interface ICustomField<D extends CustomFieldData, R> {
31
+ (props: CustomFieldProps<D>): R;
32
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,48 @@
1
+ import { IdType, ListType2 } from '@etsoo/shared';
2
+ /**
3
+ * Custom field space (12 columns)
4
+ * 自定义字段空间(12列)
5
+ */
6
+ export type CustomFieldSpace = 'quater' | 'half' | 'half1' | 'full' | 'five' | 'seven';
7
+ /**
8
+ * Custom field data
9
+ * 自定义字段数据
10
+ */
11
+ export type CustomFieldData = {
12
+ /**
13
+ * Type
14
+ */
15
+ type: string;
16
+ /**
17
+ * Field name
18
+ */
19
+ name?: string;
20
+ /**
21
+ * Options
22
+ */
23
+ options?: ListType2[];
24
+ /**
25
+ * Refs
26
+ */
27
+ refs?: [string, ...IdType[]];
28
+ /**
29
+ * Space
30
+ */
31
+ space?: CustomFieldSpace;
32
+ /**
33
+ * Grid item proerties
34
+ */
35
+ gridItemProps?: Record<string, any>;
36
+ /**
37
+ * Main slot properties
38
+ */
39
+ mainSlotProps?: Record<string, any>;
40
+ /**
41
+ * Label
42
+ */
43
+ label?: string;
44
+ /**
45
+ * Helper text
46
+ */
47
+ helperText?: string;
48
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -35,7 +35,11 @@ export class EntityApi extends BaseApi {
35
35
  * @returns Result
36
36
  */
37
37
  listBase(rq, payload) {
38
- return this.api.post(`${this.flag}/List`, rq, payload);
38
+ let { queryPaging, ...rest } = rq;
39
+ if (typeof queryPaging === 'number') {
40
+ queryPaging = { currentPage: 0, batchSize: queryPaging };
41
+ }
42
+ return this.api.post(`${this.flag}/List`, { queryPaging, ...rest }, payload);
39
43
  }
40
44
  /**
41
45
  * Merge
@@ -30,7 +30,7 @@ export class OrgApi extends EntityApi {
30
30
  else {
31
31
  if (typeof serviceId === 'object')
32
32
  return undefined;
33
- return this.listBase({ items, serviceId }, { defaultValue: [], showLoading: false });
33
+ return this.listBase({ queryPaging: items, serviceId }, { defaultValue: [], showLoading: false });
34
34
  }
35
35
  }
36
36
  /**
@@ -1,4 +1,5 @@
1
1
  import { IdType } from '@etsoo/shared';
2
+ import { QueryPagingData } from './QueryPagingData';
2
3
  /**
3
4
  * Tiplist request data
4
5
  * com.etsoo.CoreFramework.Models.TiplistRQ
@@ -17,7 +18,7 @@ export type TiplistRQ<T extends IdType = number> = {
17
18
  */
18
19
  keyword?: string;
19
20
  /**
20
- * Max items to return
21
+ * Query paging data or items to read
21
22
  */
22
- items?: number;
23
+ queryPaging?: QueryPagingData | number;
23
24
  };
@@ -25,6 +25,8 @@ export * from './business/EntityStatus';
25
25
  export * from './business/ProductUnit';
26
26
  export * from './business/RepeatOption';
27
27
  export * from './business/ShoppingCart';
28
+ export * from './custom/CustomField';
29
+ export * from './custom/CustomFieldData';
28
30
  export * from './def/ListItem';
29
31
  export * from './erp/dto/AuditLineDto';
30
32
  export * from './erp/dto/CurrencyDto';
package/lib/mjs/index.js CHANGED
@@ -29,6 +29,9 @@ export * from './business/EntityStatus';
29
29
  export * from './business/ProductUnit';
30
30
  export * from './business/RepeatOption';
31
31
  export * from './business/ShoppingCart';
32
+ // custom
33
+ export * from './custom/CustomField';
34
+ export * from './custom/CustomFieldData';
32
35
  // def
33
36
  export * from './def/ListItem';
34
37
  // erp dto
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/appscript",
3
- "version": "1.4.89",
3
+ "version": "1.4.91",
4
4
  "description": "Applications shared TypeScript framework",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -53,7 +53,7 @@
53
53
  "homepage": "https://github.com/ETSOO/AppScript#readme",
54
54
  "dependencies": {
55
55
  "@etsoo/notificationbase": "^1.1.42",
56
- "@etsoo/restclient": "^1.1.4",
56
+ "@etsoo/restclient": "^1.1.5",
57
57
  "@etsoo/shared": "^1.2.40",
58
58
  "crypto-js": "^4.2.0"
59
59
  },
@@ -67,7 +67,7 @@
67
67
  "@types/jest": "^29.5.12",
68
68
  "jest": "^29.7.0",
69
69
  "jest-environment-jsdom": "^29.7.0",
70
- "ts-jest": "^29.1.2",
70
+ "ts-jest": "^29.1.3",
71
71
  "typescript": "^5.4.5"
72
72
  }
73
73
  }
@@ -0,0 +1,36 @@
1
+ import { CustomFieldData } from './CustomFieldData';
2
+
3
+ /**
4
+ * Custom field reference
5
+ * 自定义字段引用
6
+ */
7
+ export type CustomFieldRef = {
8
+ /**
9
+ * Get value
10
+ */
11
+ getValue(): unknown;
12
+
13
+ /**
14
+ * Set value
15
+ * @param value Value
16
+ */
17
+ setValue(value: unknown): void;
18
+ };
19
+
20
+ /**
21
+ * Custom field props
22
+ * 自定义字段属性
23
+ */
24
+ export type CustomFieldProps<D extends CustomFieldData> = {
25
+ field: D;
26
+ onChange: (name: string, value: unknown) => void;
27
+ defaultValue?: unknown;
28
+ };
29
+
30
+ /**
31
+ * Custom field interface
32
+ * 自定义字段接口
33
+ */
34
+ export interface ICustomField<D extends CustomFieldData, R> {
35
+ (props: CustomFieldProps<D>): R;
36
+ }
@@ -0,0 +1,64 @@
1
+ import { IdType, ListType2 } from '@etsoo/shared';
2
+
3
+ /**
4
+ * Custom field space (12 columns)
5
+ * 自定义字段空间(12列)
6
+ */
7
+ export type CustomFieldSpace =
8
+ | 'quater'
9
+ | 'half'
10
+ | 'half1'
11
+ | 'full'
12
+ | 'five'
13
+ | 'seven';
14
+
15
+ /**
16
+ * Custom field data
17
+ * 自定义字段数据
18
+ */
19
+ export type CustomFieldData = {
20
+ /**
21
+ * Type
22
+ */
23
+ type: string;
24
+
25
+ /**
26
+ * Field name
27
+ */
28
+ name?: string;
29
+
30
+ /**
31
+ * Options
32
+ */
33
+ options?: ListType2[];
34
+
35
+ /**
36
+ * Refs
37
+ */
38
+ refs?: [string, ...IdType[]];
39
+
40
+ /**
41
+ * Space
42
+ */
43
+ space?: CustomFieldSpace;
44
+
45
+ /**
46
+ * Grid item proerties
47
+ */
48
+ gridItemProps?: Record<string, any>;
49
+
50
+ /**
51
+ * Main slot properties
52
+ */
53
+ mainSlotProps?: Record<string, any>;
54
+
55
+ /**
56
+ * Label
57
+ */
58
+ label?: string;
59
+
60
+ /**
61
+ * Helper text
62
+ */
63
+ helperText?: string;
64
+ };
@@ -74,7 +74,15 @@ export class EntityApi<T extends IApp = IApp> extends BaseApi<T> {
74
74
  RQ extends TiplistRQ<T>,
75
75
  R extends object
76
76
  >(rq: RQ, payload?: IApiPayload<R[]>) {
77
- return this.api.post(`${this.flag}/List`, rq, payload);
77
+ let { queryPaging, ...rest } = rq;
78
+ if (typeof queryPaging === 'number') {
79
+ queryPaging = { currentPage: 0, batchSize: queryPaging };
80
+ }
81
+ return this.api.post(
82
+ `${this.flag}/List`,
83
+ { queryPaging, ...rest },
84
+ payload
85
+ );
78
86
  }
79
87
 
80
88
  /**
package/src/erp/OrgApi.ts CHANGED
@@ -58,7 +58,7 @@ export class OrgApi extends EntityApi {
58
58
  } else {
59
59
  if (typeof serviceId === 'object') return undefined;
60
60
  return this.listBase<number, OrgListRQ, ListType>(
61
- { items, serviceId },
61
+ { queryPaging: items, serviceId },
62
62
  { defaultValue: [], showLoading: false }
63
63
  );
64
64
  }
@@ -1,4 +1,5 @@
1
1
  import { IdType } from '@etsoo/shared';
2
+ import { QueryPagingData } from './QueryPagingData';
2
3
 
3
4
  /**
4
5
  * Tiplist request data
@@ -21,7 +22,7 @@ export type TiplistRQ<T extends IdType = number> = {
21
22
  keyword?: string;
22
23
 
23
24
  /**
24
- * Max items to return
25
+ * Query paging data or items to read
25
26
  */
26
- items?: number;
27
+ queryPaging?: QueryPagingData | number;
27
28
  };
package/src/index.ts CHANGED
@@ -33,6 +33,10 @@ export * from './business/ProductUnit';
33
33
  export * from './business/RepeatOption';
34
34
  export * from './business/ShoppingCart';
35
35
 
36
+ // custom
37
+ export * from './custom/CustomField';
38
+ export * from './custom/CustomFieldData';
39
+
36
40
  // def
37
41
  export * from './def/ListItem';
38
42