@etsoo/appscript 1.4.91 → 1.4.92

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.
@@ -3,30 +3,30 @@ import { CustomFieldData } from './CustomFieldData';
3
3
  * Custom field reference
4
4
  * 自定义字段引用
5
5
  */
6
- export type CustomFieldRef = {
6
+ export type CustomFieldRef<V> = {
7
7
  /**
8
8
  * Get value
9
9
  */
10
- getValue(): unknown;
10
+ getValue(): V;
11
11
  /**
12
12
  * Set value
13
13
  * @param value Value
14
14
  */
15
- setValue(value: unknown): void;
15
+ setValue(value: V): void;
16
16
  };
17
17
  /**
18
18
  * Custom field props
19
19
  * 自定义字段属性
20
20
  */
21
- export type CustomFieldProps<D extends CustomFieldData> = {
21
+ export type CustomFieldProps<D extends CustomFieldData, V> = {
22
22
  field: D;
23
- onChange: (name: string, value: unknown) => void;
24
- defaultValue?: unknown;
23
+ onChange: (name: string, value: V) => void;
24
+ defaultValue?: V;
25
25
  };
26
26
  /**
27
27
  * Custom field interface
28
28
  * 自定义字段接口
29
29
  */
30
- export interface ICustomField<D extends CustomFieldData, R> {
31
- (props: CustomFieldProps<D>): R;
30
+ export interface ICustomField<V, D extends CustomFieldData, P extends CustomFieldProps<D, V>, R> {
31
+ (props: P): R;
32
32
  }
@@ -3,30 +3,30 @@ import { CustomFieldData } from './CustomFieldData';
3
3
  * Custom field reference
4
4
  * 自定义字段引用
5
5
  */
6
- export type CustomFieldRef = {
6
+ export type CustomFieldRef<V> = {
7
7
  /**
8
8
  * Get value
9
9
  */
10
- getValue(): unknown;
10
+ getValue(): V;
11
11
  /**
12
12
  * Set value
13
13
  * @param value Value
14
14
  */
15
- setValue(value: unknown): void;
15
+ setValue(value: V): void;
16
16
  };
17
17
  /**
18
18
  * Custom field props
19
19
  * 自定义字段属性
20
20
  */
21
- export type CustomFieldProps<D extends CustomFieldData> = {
21
+ export type CustomFieldProps<D extends CustomFieldData, V> = {
22
22
  field: D;
23
- onChange: (name: string, value: unknown) => void;
24
- defaultValue?: unknown;
23
+ onChange: (name: string, value: V) => void;
24
+ defaultValue?: V;
25
25
  };
26
26
  /**
27
27
  * Custom field interface
28
28
  * 自定义字段接口
29
29
  */
30
- export interface ICustomField<D extends CustomFieldData, R> {
31
- (props: CustomFieldProps<D>): R;
30
+ export interface ICustomField<V, D extends CustomFieldData, P extends CustomFieldProps<D, V>, R> {
31
+ (props: P): R;
32
32
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/appscript",
3
- "version": "1.4.91",
3
+ "version": "1.4.92",
4
4
  "description": "Applications shared TypeScript framework",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -4,33 +4,38 @@ import { CustomFieldData } from './CustomFieldData';
4
4
  * Custom field reference
5
5
  * 自定义字段引用
6
6
  */
7
- export type CustomFieldRef = {
7
+ export type CustomFieldRef<V> = {
8
8
  /**
9
9
  * Get value
10
10
  */
11
- getValue(): unknown;
11
+ getValue(): V;
12
12
 
13
13
  /**
14
14
  * Set value
15
15
  * @param value Value
16
16
  */
17
- setValue(value: unknown): void;
17
+ setValue(value: V): void;
18
18
  };
19
19
 
20
20
  /**
21
21
  * Custom field props
22
22
  * 自定义字段属性
23
23
  */
24
- export type CustomFieldProps<D extends CustomFieldData> = {
24
+ export type CustomFieldProps<D extends CustomFieldData, V> = {
25
25
  field: D;
26
- onChange: (name: string, value: unknown) => void;
27
- defaultValue?: unknown;
26
+ onChange: (name: string, value: V) => void;
27
+ defaultValue?: V;
28
28
  };
29
29
 
30
30
  /**
31
31
  * Custom field interface
32
32
  * 自定义字段接口
33
33
  */
34
- export interface ICustomField<D extends CustomFieldData, R> {
35
- (props: CustomFieldProps<D>): R;
34
+ export interface ICustomField<
35
+ V,
36
+ D extends CustomFieldData,
37
+ P extends CustomFieldProps<D, V>,
38
+ R
39
+ > {
40
+ (props: P): R;
36
41
  }