annil 1.7.5-beta.4 → 1.7.5
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/CHANGELOG.md +7 -0
- package/README.md +43 -37
- package/dist/api/DefineComponent/ReturnType/ComponentType.d.ts +18 -0
- package/dist/api/DefineComponent/ReturnType/ComponentType.js +2 -0
- package/dist/api/DefineComponent/ReturnType/ComponentType.js.map +1 -0
- package/dist/api/DefineComponent/ReturnType/CreateComponentDoc.d.ts +3 -3
- package/dist/api/DefineComponent/ReturnType/CreatePageDoc.d.ts +2 -2
- package/dist/api/DefineComponent/ReturnType/GetCustomEventDocOfSubDoc.d.ts +3 -3
- package/dist/api/DefineComponent/RootComponent/RootComponentOption.d.ts +2 -2
- package/dist/api/DefineComponent/SubComponents/SubComponentsOption.d.ts +2 -2
- package/dist/api/DefineComponent/index.d.ts +5 -5
- package/dist/api/DefineComponent/normalizeOptions/computedWatchHandle/computedUpdater.js +2 -2
- package/dist/api/DefineComponent/normalizeOptions/computedWatchHandle/computedUpdater.js.map +1 -1
- package/dist/api/DefineComponent/normalizeOptions/computedWatchHandle/index.js +2 -2
- package/dist/api/DefineComponent/normalizeOptions/computedWatchHandle/index.js.map +1 -1
- package/dist/api/DefineComponent/normalizeOptions/index.js +1 -1
- package/dist/api/DefineComponent/normalizeOptions/index.js.map +1 -1
- package/dist/api/RootComponent/Events/EventsConstraint.d.ts +4 -4
- package/dist/api/RootComponent/{RootComponentDoc.d.ts → RootComponentType.d.ts} +16 -15
- package/dist/api/RootComponent/RootComponentType.js +2 -0
- package/dist/api/RootComponent/RootComponentType.js.map +1 -0
- package/dist/api/RootComponent/index.d.ts +3 -3
- package/dist/api/SubComponent/{SubComponentDoc.d.ts → SubComponentType.d.ts} +3 -3
- package/dist/api/SubComponent/SubComponentType.js +2 -0
- package/dist/api/SubComponent/SubComponentType.js.map +1 -0
- package/dist/api/SubComponent/SubEvents/SubEventsConstraint.d.ts +2 -2
- package/dist/api/SubComponent/SubInherit/SubInheritConstraint.d.ts +2 -2
- package/dist/api/SubComponent/index.d.ts +5 -5
- package/dist/behaviors/BStore.d.ts +1 -1
- package/dist/behaviors/BStore.js +31 -18
- package/dist/behaviors/BStore.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/types/CreateComponentType.d.ts +23 -2
- package/dist/types/ExtendComponentType.d.ts +34 -0
- package/dist/types/ExtendComponentType.js +6 -0
- package/dist/types/ExtendComponentType.js.map +1 -0
- package/dist/types/GetComponentPrefix.d.ts +2 -2
- package/dist/types/ReplacePrefix.d.ts +2 -2
- package/dist/{api/DefineComponent/normalizeOptions/computedWatchHandle/isEqual.d.ts → utils/deepEqual.d.ts} +1 -1
- package/dist/{api/DefineComponent/normalizeOptions/computedWatchHandle/isEqual.js → utils/deepEqual.js} +3 -3
- package/dist/utils/deepEqual.js.map +1 -0
- package/package.json +2 -3
- package/src/api/DefineComponent/NameOrPage/test/error.test.ts +6 -6
- package/src/api/DefineComponent/ReturnType/{ComponentDoc.ts → ComponentType.ts} +6 -7
- package/src/api/DefineComponent/ReturnType/CreateComponentDoc.ts +4 -4
- package/src/api/DefineComponent/ReturnType/CreatePageDoc.ts +2 -2
- package/src/api/DefineComponent/ReturnType/GetCustomEventDocOfSubDoc.ts +3 -3
- package/src/api/DefineComponent/ReturnType/GetPropertiesDocOfSubDoc.ts +3 -3
- package/src/api/DefineComponent/ReturnType/test/normalComponentDoc.test.ts +5 -5
- package/src/api/DefineComponent/RootComponent/RootComponentOption.ts +2 -2
- package/src/api/DefineComponent/SubComponents/SubComponentsOption.ts +2 -2
- package/src/api/DefineComponent/SubComponents/test/normal.test.ts +3 -3
- package/src/api/DefineComponent/index.ts +7 -7
- package/src/api/DefineComponent/normalizeOptions/computedWatchHandle/computedUpdater.ts +2 -2
- package/src/api/DefineComponent/normalizeOptions/computedWatchHandle/index.ts +2 -2
- package/src/api/DefineComponent/normalizeOptions/index.ts +1 -1
- package/src/api/RootComponent/Events/EventsConstraint.ts +5 -5
- package/src/api/RootComponent/Events/test/normal.test.ts +5 -5
- package/src/api/RootComponent/{RootComponentDoc.ts → RootComponentType.ts} +16 -15
- package/src/api/RootComponent/index.ts +3 -3
- package/src/api/SubComponent/{SubComponentDoc.ts → SubComponentType.ts} +3 -3
- package/src/api/SubComponent/SubComputed/test/error.test.ts +3 -3
- package/src/api/SubComponent/SubComputed/test/normal.test.ts +4 -4
- package/src/api/SubComponent/SubData/test/error.test.ts +3 -3
- package/src/api/SubComponent/SubData/test/normal.test.ts +2 -2
- package/src/api/SubComponent/SubEvents/SubEventsConstraint.ts +2 -2
- package/src/api/SubComponent/SubEvents/test/error.test.ts +3 -3
- package/src/api/SubComponent/SubEvents/test/normal.test.ts +2 -2
- package/src/api/SubComponent/SubInherit/SubInheritConstraint.ts +2 -2
- package/src/api/SubComponent/SubInherit/test/error.test.ts +6 -6
- package/src/api/SubComponent/SubInherit/test/normal.test.ts +4 -4
- package/src/api/SubComponent/SubInstance/test/error.test.ts +2 -2
- package/src/api/SubComponent/SubInstance/test/normal.test.ts +4 -4
- package/src/api/SubComponent/SubMethods/test/error.test.ts +4 -4
- package/src/api/SubComponent/SubMethods/test/normarl.test.ts +4 -4
- package/src/api/SubComponent/SubReturnType/test/error.test.ts +2 -2
- package/src/api/SubComponent/SubReturnType/test/normal.test.ts +2 -2
- package/src/api/SubComponent/SubStore/test/error.test.ts +2 -2
- package/src/api/SubComponent/SubStore/test/normal.test.ts +2 -2
- package/src/api/SubComponent/SubWatch/test/WatchComputed.test.ts +4 -4
- package/src/api/SubComponent/SubWatch/test/WatchRootData.test.ts +2 -2
- package/src/api/SubComponent/SubWatch/test/WatchSubData.test.ts +2 -2
- package/src/api/SubComponent/index.ts +9 -9
- package/src/behaviors/BStore.ts +35 -23
- package/src/index.ts +2 -2
- package/src/types/CreateComponentType.ts +23 -2
- package/src/types/ExtendComponentType.ts +60 -0
- package/src/types/GetComponentPrefix.ts +2 -2
- package/src/types/GetPropertiesDuplicatedKeys.ts +3 -3
- package/src/types/ReplacePrefix.ts +2 -2
- package/src/{api/DefineComponent/normalizeOptions/computedWatchHandle/isEqual.ts → utils/deepEqual.ts} +2 -3
- package/dist/api/DefineComponent/ReturnType/ComponentDoc.d.ts +0 -18
- package/dist/api/DefineComponent/ReturnType/ComponentDoc.js +0 -2
- package/dist/api/DefineComponent/ReturnType/ComponentDoc.js.map +0 -1
- package/dist/api/DefineComponent/normalizeOptions/computedWatchHandle/isEqual.js.map +0 -1
- package/dist/api/RootComponent/RootComponentDoc.js +0 -2
- package/dist/api/RootComponent/RootComponentDoc.js.map +0 -1
- package/dist/api/SubComponent/SubComponentDoc.js +0 -2
- package/dist/api/SubComponent/SubComponentDoc.js.map +0 -1
- package/dist/types/DocAssign.d.ts +0 -10
- package/dist/types/DocAssign.js +0 -6
- package/dist/types/DocAssign.js.map +0 -1
- package/src/types/DocAssign.ts +0 -36
- package/tsconfig.json +0 -23
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Func } from "hry-types/src/Misc/_api";
|
|
2
|
-
import { instanceConfig } from "../../..";
|
|
3
2
|
import { BBeforeCreate } from "../../../behaviors/BbeforeCreated";
|
|
4
3
|
import { BStore } from "../../../behaviors/BStore";
|
|
5
4
|
import { isEmptyObject } from "../../../utils/isEmptyObject";
|
|
5
|
+
import { instanceConfig } from "../../InstanceInject/instanceConfig";
|
|
6
6
|
import type { ComputedConstraint } from "../../RootComponent/Computed/ComputedConstraint";
|
|
7
7
|
import type { DataConstraint } from "../../RootComponent/Data/DataConstraint";
|
|
8
8
|
import type { LifetimesConstraint } from "../../RootComponent/Lifetimes/LifetimesConstraint";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import type { IfExtends } from "hry-types/src/Any/_api";
|
|
3
3
|
import type { Select } from "hry-types/src/Object/_api";
|
|
4
4
|
import type { Detail, WMBaseEvent } from "../../../types/OfficialTypeAlias";
|
|
5
|
-
import type {
|
|
5
|
+
import type { ComponentType } from "../../DefineComponent/ReturnType/ComponentType";
|
|
6
6
|
import type { CustomEventsDoc } from "../CustomEvents/CustomEventsDoc";
|
|
7
7
|
import type {
|
|
8
8
|
Bubbles,
|
|
@@ -18,9 +18,9 @@ type FilterNormalFields<O extends object> = Select<O, Bubbles | Capture, "contai
|
|
|
18
18
|
|
|
19
19
|
// 获取冒泡或捕获的事件
|
|
20
20
|
type GetBubblesOrCaptureEventsFromCompDoc<
|
|
21
|
-
ComponentDocList extends
|
|
21
|
+
ComponentDocList extends ComponentType[],
|
|
22
22
|
Result extends CustomEventsDoc = {},
|
|
23
|
-
> = ComponentDocList extends [infer Head extends
|
|
23
|
+
> = ComponentDocList extends [infer Head extends ComponentType, ...infer Rest extends ComponentType[]]
|
|
24
24
|
? GetBubblesOrCaptureEventsFromCompDoc<
|
|
25
25
|
Rest,
|
|
26
26
|
Result & (FilterNormalFields<Head["customEvents"] & {}>)
|
|
@@ -50,7 +50,7 @@ type TransformCustomEventsDocTypeToFunctionTypeAndAddSuffix<T extends CustomEven
|
|
|
50
50
|
|
|
51
51
|
// 所有子组件自定义事件(过滤掉非冒泡或捕获)的key加入后缀并把值(detail)转换为函数类型
|
|
52
52
|
type GetAllSubCustomEventsConstraint<
|
|
53
|
-
ComponentDocList extends
|
|
53
|
+
ComponentDocList extends ComponentType[],
|
|
54
54
|
AllCustomEvents extends CustomEventsDoc = GetBubblesOrCaptureEventsFromCompDoc<ComponentDocList>,
|
|
55
55
|
> = IfExtends<
|
|
56
56
|
{},
|
|
@@ -66,7 +66,7 @@ type BaseEvent = Record<string, (e: WMBaseEvent) => unknown>;
|
|
|
66
66
|
/**
|
|
67
67
|
* events字段约束 由自身事件和冒泡的子组件事件组成。带前缀是子组件事件,带后缀(_catch)表示阻止冒泡
|
|
68
68
|
*/
|
|
69
|
-
export type EventsConstraint<ComponentDocList extends
|
|
69
|
+
export type EventsConstraint<ComponentDocList extends ComponentType[] = []> = IfExtends<
|
|
70
70
|
[],
|
|
71
71
|
ComponentDocList,
|
|
72
72
|
BaseEvent,
|
|
@@ -11,7 +11,7 @@ import type {
|
|
|
11
11
|
WMCustomEvent,
|
|
12
12
|
} from "../../../../types/OfficialTypeAlias";
|
|
13
13
|
import { assertNonNullable } from "../../../../utils/assertNonNullable";
|
|
14
|
-
import type {
|
|
14
|
+
import type { ComponentType } from "../../../DefineComponent/ReturnType/ComponentType";
|
|
15
15
|
import { RootComponent } from "../..";
|
|
16
16
|
import type { Bubbles, Capture } from "../../CustomEvents/CustomEventsTag";
|
|
17
17
|
|
|
@@ -34,13 +34,13 @@ RootComponent()({
|
|
|
34
34
|
// 2.1 通过WMCustomEvent定义detai,mark,CurrentTargetDataset,targetDataset数据类型
|
|
35
35
|
customA(
|
|
36
36
|
e: WMCustomEvent<
|
|
37
|
-
|
|
37
|
+
string,
|
|
38
38
|
{ markData: { id: string } },
|
|
39
39
|
{ currentTargetDatasetData: string },
|
|
40
40
|
{ targetDatasetData: number }
|
|
41
41
|
>,
|
|
42
42
|
) {
|
|
43
|
-
Checking<typeof e.detail
|
|
43
|
+
Checking<typeof e.detail, string, Test.Pass>;
|
|
44
44
|
|
|
45
45
|
const markData = assertNonNullable(e.mark).markData;
|
|
46
46
|
|
|
@@ -71,7 +71,7 @@ RootComponent()({
|
|
|
71
71
|
},
|
|
72
72
|
});
|
|
73
73
|
|
|
74
|
-
type ComponentDocA =
|
|
74
|
+
type ComponentDocA = ComponentType<{
|
|
75
75
|
properties: {
|
|
76
76
|
aaa_str: string;
|
|
77
77
|
};
|
|
@@ -81,7 +81,7 @@ type ComponentDocA = ComponentDoc<{
|
|
|
81
81
|
};
|
|
82
82
|
}>;
|
|
83
83
|
|
|
84
|
-
type ComponentDocB =
|
|
84
|
+
type ComponentDocB = ComponentType<{
|
|
85
85
|
customEvents: {
|
|
86
86
|
bbb_str: string;
|
|
87
87
|
bbb_num: number | Capture;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { WMCompPageLifetimes, WMPageLifetimes } from "../../types/OfficialTypeAlias";
|
|
2
2
|
import type { LifetimesConstraint } from "./Lifetimes/LifetimesConstraint";
|
|
3
3
|
|
|
4
|
-
type
|
|
4
|
+
type _RootComponentType = {
|
|
5
5
|
isPage?: boolean;
|
|
6
6
|
properties?: object;
|
|
7
7
|
data?: object;
|
|
@@ -24,20 +24,21 @@ type _Validator<O, Doc, ErrKeys = Exclude<keyof O, keyof Doc>> = [ErrKeys] exten
|
|
|
24
24
|
/**
|
|
25
25
|
* RootComponent Api 返回的类型
|
|
26
26
|
* ```ts
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
27
|
+
* {
|
|
28
|
+
* isPage?: boolean;
|
|
29
|
+
* properties?: object;
|
|
30
|
+
* data?: object;
|
|
31
|
+
* computed?: object;
|
|
32
|
+
* customEvents?: object;
|
|
33
|
+
* methods?: object;
|
|
34
|
+
* events?: object;
|
|
35
|
+
* store?: object;
|
|
36
|
+
* watch?: Record<string, AnyFunction>;
|
|
37
|
+
* lifetimes?: LifetimesConstraint;
|
|
38
|
+
* pageLifetimes?: Partial<WMCompPageLifetimes & { load:AnyFunction }> | Partial<WMPageLifetimes>;
|
|
39
|
+
* export?:AnyFunction
|
|
40
|
+
* externalClasses?: string[];
|
|
40
41
|
* };
|
|
41
42
|
* ```
|
|
42
43
|
*/
|
|
43
|
-
export type
|
|
44
|
+
export type RootComponentType<O extends _Validator<O, _RootComponentType> = _RootComponentType> = O;
|
|
@@ -4,7 +4,7 @@ import type { Func } from "hry-types/src/Misc/Func";
|
|
|
4
4
|
import type { ComputeIntersection } from "hry-types/src/Object/_api";
|
|
5
5
|
import type { ComputeObject } from "../../types/ComputeObj";
|
|
6
6
|
import type { WMCompOtherOption } from "../../types/OfficialTypeAlias";
|
|
7
|
-
import type {
|
|
7
|
+
import type { ComponentType } from "../DefineComponent/ReturnType/ComponentType";
|
|
8
8
|
import type { IInjectAllData, IInjectStore } from "../InstanceInject/instanceConfig";
|
|
9
9
|
import type { ComputedConstraint } from "./Computed/ComputedConstraint";
|
|
10
10
|
import type { ComputedOption } from "./Computed/ComputedOption";
|
|
@@ -88,7 +88,7 @@ type RootComponentOptions<
|
|
|
88
88
|
>
|
|
89
89
|
>;
|
|
90
90
|
|
|
91
|
-
type RootComponentConstructor<TComponentDocList extends
|
|
91
|
+
type RootComponentConstructor<TComponentDocList extends ComponentType[]> = <
|
|
92
92
|
// TEvents 不能有默认值 {} 会引起事件参数类型(e)失效
|
|
93
93
|
TEvents extends EventsConstraint<TComponentDocList>,
|
|
94
94
|
TIsPage extends boolean = false,
|
|
@@ -137,7 +137,7 @@ ComputeIntersection<
|
|
|
137
137
|
|
|
138
138
|
export function RootComponent<
|
|
139
139
|
// TComponentDocList泛型为了给events字段提供类型约束
|
|
140
|
-
TComponentDocList extends
|
|
140
|
+
TComponentDocList extends ComponentType[] = [],
|
|
141
141
|
>(): RootComponentConstructor<
|
|
142
142
|
TComponentDocList
|
|
143
143
|
> {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { SelectKeys } from "hry-types/src/Object/_api";
|
|
2
2
|
import type { Composed, CustomEventsTags } from "../RootComponent/CustomEvents/CustomEventsTag";
|
|
3
3
|
|
|
4
|
-
type
|
|
4
|
+
type _SubComponentType = {
|
|
5
5
|
[k in string]:
|
|
6
6
|
| string
|
|
7
7
|
| number
|
|
@@ -15,7 +15,7 @@ type _SubComponentDoc = {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
type _Validator<O, ErrKeys = Exclude<keyof O, SelectKeys<O, Composed, "contains->">>> = [ErrKeys] extends [never]
|
|
18
|
-
?
|
|
18
|
+
? _SubComponentType
|
|
19
19
|
: `${ErrKeys & string} 不是穿透事件`;
|
|
20
20
|
|
|
21
21
|
/**
|
|
@@ -27,4 +27,4 @@ type _Validator<O, ErrKeys = Exclude<keyof O, SelectKeys<O, Composed, "contains-
|
|
|
27
27
|
* };
|
|
28
28
|
* ```
|
|
29
29
|
*/
|
|
30
|
-
export type
|
|
30
|
+
export type SubComponentType<O extends _Validator<O> = _SubComponentType> = O;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComponentType } from "../../../DefineComponent/ReturnType/ComponentType";
|
|
2
2
|
import { SubComponent } from "../..";
|
|
3
3
|
|
|
4
|
-
type OnlyCustomCompDoc =
|
|
4
|
+
type OnlyCustomCompDoc = ComponentType<{
|
|
5
5
|
customEvents: { aaa_str: string };
|
|
6
6
|
}>;
|
|
7
7
|
|
|
@@ -15,7 +15,7 @@ SubComponent<{}, OnlyCustomCompDoc>()({
|
|
|
15
15
|
},
|
|
16
16
|
});
|
|
17
17
|
|
|
18
|
-
type OnlyPropsCompDoc =
|
|
18
|
+
type OnlyPropsCompDoc = ComponentType<{
|
|
19
19
|
properties: {
|
|
20
20
|
aaa_str: "a" | "b";
|
|
21
21
|
aaa_num?: number;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Checking, type Test } from "hry-types";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ComponentType } from "../../../DefineComponent/ReturnType/ComponentType";
|
|
3
3
|
|
|
4
4
|
import type { ComputeIntersection } from "hry-types/src/Object/ComputeIntersection";
|
|
5
5
|
import type { IInjectAllData } from "../../../InstanceInject/instanceConfig";
|
|
6
6
|
import type { Mock_User } from "../../../RootComponent/Properties/test/normalRequired.test";
|
|
7
7
|
import { SubComponent } from "../..";
|
|
8
8
|
|
|
9
|
-
type OnlyCustomCompDoc =
|
|
9
|
+
type OnlyCustomCompDoc = ComponentType<{
|
|
10
10
|
customEvents: { aaa_str: string };
|
|
11
11
|
}>;
|
|
12
12
|
|
|
@@ -31,7 +31,7 @@ interface Root {
|
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
type $aaa =
|
|
34
|
+
type $aaa = ComponentType<
|
|
35
35
|
{ properties: { aaa_str: string; aaa_user: User | null; aaa_num: number; aaa_age: number } }
|
|
36
36
|
>;
|
|
37
37
|
|
|
@@ -40,7 +40,7 @@ SubComponent<{}, OnlyCustomCompDoc>()({
|
|
|
40
40
|
computed: {},
|
|
41
41
|
});
|
|
42
42
|
|
|
43
|
-
type OnlyPropsCompDoc =
|
|
43
|
+
type OnlyPropsCompDoc = ComponentType<{
|
|
44
44
|
properties: {
|
|
45
45
|
aaa_str: "a" | "b";
|
|
46
46
|
aaa_num?: number;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComponentType } from "../../../DefineComponent/ReturnType/ComponentType";
|
|
2
2
|
|
|
3
3
|
import type { Mock_User } from "../../../RootComponent/Properties/test/normalRequired.test";
|
|
4
4
|
import { SubComponent } from "../..";
|
|
5
5
|
|
|
6
|
-
type OnlyCustomCompDoc =
|
|
6
|
+
type OnlyCustomCompDoc = ComponentType<{
|
|
7
7
|
customEvents: { aaa_str: string };
|
|
8
8
|
}>;
|
|
9
9
|
|
|
@@ -16,7 +16,7 @@ SubComponent<{}, OnlyCustomCompDoc>()({
|
|
|
16
16
|
},
|
|
17
17
|
});
|
|
18
18
|
|
|
19
|
-
type OnlyPropsCompDoc =
|
|
19
|
+
type OnlyPropsCompDoc = ComponentType<{
|
|
20
20
|
properties: {
|
|
21
21
|
aaa_str: "a" | "b";
|
|
22
22
|
aaa_num?: number;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Checking, type Test } from "hry-types";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ComponentType } from "../../../DefineComponent/ReturnType/ComponentType";
|
|
3
3
|
|
|
4
4
|
import type { ComputeIntersection } from "hry-types/src/Object/ComputeIntersection";
|
|
5
5
|
import type { IInjectAllData } from "../../../InstanceInject/instanceConfig";
|
|
6
6
|
import type { Mock_User } from "../../../RootComponent/Properties/test/normalRequired.test";
|
|
7
7
|
import { SubComponent } from "../..";
|
|
8
8
|
|
|
9
|
-
type CompDoc =
|
|
9
|
+
type CompDoc = ComponentType<{
|
|
10
10
|
properties: {
|
|
11
11
|
aaa_str: "a" | "b";
|
|
12
12
|
aaa_num?: number;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { Contains } from "hry-types/src/Any/Contains";
|
|
2
2
|
import type { IfExtends } from "hry-types/src/Any/IfExtends";
|
|
3
3
|
import type { Detail, WMBaseEvent } from "../../../types/OfficialTypeAlias";
|
|
4
|
-
import type {
|
|
4
|
+
import type { ComponentType } from "../../DefineComponent/ReturnType/ComponentType";
|
|
5
5
|
import type { Bubbles, Capture, CustomEventsTags } from "../../RootComponent/CustomEvents/CustomEventsTag";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* 把组件事件类型转为函数类型,冒泡事件捕获事件会多一个加后缀(_catch)的key,表示阻止事件冒泡和捕获。
|
|
9
9
|
*/
|
|
10
10
|
export type SubEventsConstraint<
|
|
11
|
-
CompDoc extends
|
|
11
|
+
CompDoc extends ComponentType,
|
|
12
12
|
> = {
|
|
13
13
|
[
|
|
14
14
|
k in keyof CompDoc["customEvents"] as Contains<CompDoc["customEvents"][k], Bubbles | Capture> extends true
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComponentType } from "../../../DefineComponent/ReturnType/ComponentType";
|
|
2
2
|
import type { Bubbles } from "../../../RootComponent/CustomEvents/CustomEventsTag";
|
|
3
3
|
import { SubComponent } from "../..";
|
|
4
4
|
|
|
5
|
-
type CompDoc =
|
|
5
|
+
type CompDoc = ComponentType<{
|
|
6
6
|
properties: {
|
|
7
7
|
aaa_str: string;
|
|
8
8
|
};
|
|
@@ -16,7 +16,7 @@ SubComponent<{}, CompDoc>()({
|
|
|
16
16
|
},
|
|
17
17
|
});
|
|
18
18
|
|
|
19
|
-
type CompDoc1 =
|
|
19
|
+
type CompDoc1 = ComponentType<{
|
|
20
20
|
customEvents: {
|
|
21
21
|
aaa_str: string | Bubbles;
|
|
22
22
|
};
|
|
@@ -4,7 +4,7 @@ import { Checking, type Test } from "hry-types";
|
|
|
4
4
|
import type { Wm } from "../../../../thirdLib";
|
|
5
5
|
|
|
6
6
|
import type { Detail, Mark, WMBaseEvent } from "../../../..";
|
|
7
|
-
import type {
|
|
7
|
+
import type { ComponentType } from "../../../DefineComponent/ReturnType/ComponentType";
|
|
8
8
|
import type {
|
|
9
9
|
Bubbles,
|
|
10
10
|
BubblesCapture,
|
|
@@ -16,7 +16,7 @@ import type {
|
|
|
16
16
|
import type { Mock_User } from "../../../RootComponent/Properties/test/normalRequired.test";
|
|
17
17
|
import { SubComponent } from "../..";
|
|
18
18
|
|
|
19
|
-
type CompDoc =
|
|
19
|
+
type CompDoc = ComponentType<{
|
|
20
20
|
customEvents: {
|
|
21
21
|
aaa_str: string;
|
|
22
22
|
aaa_bubbles: string | Bubbles;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SelectKeys } from "hry-types/src/Object/_api";
|
|
2
2
|
import type { RemoveInnerData } from "../../../types/RemoveInnerData";
|
|
3
|
-
import type {
|
|
3
|
+
import type { ComponentType } from "../../DefineComponent/ReturnType/ComponentType";
|
|
4
4
|
|
|
5
5
|
type WXMLSign = "wxml";
|
|
6
6
|
|
|
@@ -10,7 +10,7 @@ type unionAddList<Keys extends string> = Keys | Keys[];
|
|
|
10
10
|
* 子组件inherit字段约束,key为构建组件所需的properties字段,类型为根组件数据的key或key[]或`WXMLSign`。要求根数据类型为子数据类型的子类型。当key的值来自wxml(循环产生的子数据等情况)时用`WXMLSign`表示。
|
|
11
11
|
* @returns object
|
|
12
12
|
*/
|
|
13
|
-
export type InheritConstraint<AllRootData extends object, TComponentDoc extends
|
|
13
|
+
export type InheritConstraint<AllRootData extends object, TComponentDoc extends ComponentType> = {
|
|
14
14
|
[k in keyof TComponentDoc["properties"]]?:
|
|
15
15
|
| unionAddList<RemoveInnerData<SelectKeys<AllRootData, TComponentDoc["properties"][k]> & string>>
|
|
16
16
|
| WXMLSign;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Checking, type Test } from "hry-types";
|
|
2
2
|
import { DefineComponent } from "../../../DefineComponent";
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
3
|
+
import type { ComponentType } from "../../../DefineComponent/ReturnType/ComponentType";
|
|
4
|
+
import type { RootComponentType } from "../../../RootComponent/RootComponentType";
|
|
5
5
|
import { SubComponent } from "../..";
|
|
6
|
-
import type {
|
|
6
|
+
import type { SubComponentType } from "../../SubComponentType";
|
|
7
7
|
|
|
8
|
-
type Mock_RootDoc =
|
|
8
|
+
type Mock_RootDoc = RootComponentType<{
|
|
9
9
|
properties: {
|
|
10
10
|
required_num: number;
|
|
11
11
|
optional_literal_num?: 123 | 456 | 789;
|
|
@@ -25,7 +25,7 @@ type Mock_RootDoc = RootComponentDoc<{
|
|
|
25
25
|
};
|
|
26
26
|
}>;
|
|
27
27
|
|
|
28
|
-
type Mock_CompDoc =
|
|
28
|
+
type Mock_CompDoc = ComponentType<{
|
|
29
29
|
properties: {
|
|
30
30
|
aaa_num: number;
|
|
31
31
|
aaa_literal_num: 123 | 456;
|
|
@@ -55,7 +55,7 @@ const subDoc = SubComponent<Mock_RootDoc, Mock_CompDoc>()({
|
|
|
55
55
|
},
|
|
56
56
|
});
|
|
57
57
|
|
|
58
|
-
void Checking<typeof subDoc,
|
|
58
|
+
void Checking<typeof subDoc, SubComponentType, Test.Fail>;
|
|
59
59
|
|
|
60
60
|
DefineComponent({
|
|
61
61
|
name: "xxx",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { ComponentType } from "../../../DefineComponent/ReturnType/ComponentType";
|
|
2
|
+
import type { RootComponentType } from "../../../RootComponent/RootComponentType";
|
|
3
3
|
import { SubComponent } from "../..";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* inherit字段最终会在选项中删除,它用ts开发类型检测。
|
|
7
7
|
*/
|
|
8
|
-
type Mock_RootDoc =
|
|
8
|
+
type Mock_RootDoc = RootComponentType<{
|
|
9
9
|
properties: {
|
|
10
10
|
required_num: number;
|
|
11
11
|
optional_literal_num?: 123 | 456 | 789;
|
|
@@ -23,7 +23,7 @@ type Mock_RootDoc = RootComponentDoc<{
|
|
|
23
23
|
};
|
|
24
24
|
}>;
|
|
25
25
|
|
|
26
|
-
type Mock_CompDoc =
|
|
26
|
+
type Mock_CompDoc = ComponentType<{
|
|
27
27
|
properties: {
|
|
28
28
|
aaa_num: number;
|
|
29
29
|
aaa_literal_num: 123 | 456;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { View } from "../../../../thirdLib/wm";
|
|
2
|
-
import type {
|
|
2
|
+
import type { RootComponentType } from "../../../RootComponent/RootComponentType";
|
|
3
3
|
import { SubComponent } from "../..";
|
|
4
4
|
|
|
5
|
-
type RootDoc =
|
|
5
|
+
type RootDoc = RootComponentType<{
|
|
6
6
|
events: {
|
|
7
7
|
RootE1: () => string;
|
|
8
8
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Checking, type Test } from "hry-types";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ComponentType } from "../../../DefineComponent/ReturnType/ComponentType";
|
|
3
3
|
|
|
4
4
|
import type { ComputeIntersection } from "hry-types/src/Object/ComputeIntersection";
|
|
5
5
|
import type { IInjectAllData } from "../../../InstanceInject/instanceConfig";
|
|
6
6
|
import type { Mock_User } from "../../../RootComponent/Properties/test/normalRequired.test";
|
|
7
|
-
import type {
|
|
7
|
+
import type { RootComponentType } from "../../../RootComponent/RootComponentType";
|
|
8
8
|
import { SubComponent } from "../..";
|
|
9
9
|
|
|
10
|
-
type RootDoc =
|
|
10
|
+
type RootDoc = RootComponentType<{
|
|
11
11
|
properties: {
|
|
12
12
|
Pstr: string;
|
|
13
13
|
Pobj: Mock_User | null;
|
|
@@ -30,7 +30,7 @@ type RootDoc = RootComponentDoc<{
|
|
|
30
30
|
};
|
|
31
31
|
}>;
|
|
32
32
|
|
|
33
|
-
type CompDoc =
|
|
33
|
+
type CompDoc = ComponentType<{
|
|
34
34
|
properties: {
|
|
35
35
|
aaa_str: string;
|
|
36
36
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComponentType } from "../../../DefineComponent/ReturnType/ComponentType";
|
|
2
2
|
import type { Bubbles } from "../../../RootComponent/CustomEvents/CustomEventsTag";
|
|
3
|
-
import type {
|
|
3
|
+
import type { RootComponentType } from "../../../RootComponent/RootComponentType";
|
|
4
4
|
import { SubComponent } from "../..";
|
|
5
5
|
|
|
6
|
-
type RootDoc =
|
|
6
|
+
type RootDoc = RootComponentType<{
|
|
7
7
|
methods: {
|
|
8
8
|
Mstr: () => string;
|
|
9
9
|
};
|
|
@@ -15,7 +15,7 @@ type RootDoc = RootComponentDoc<{
|
|
|
15
15
|
};
|
|
16
16
|
}>;
|
|
17
17
|
|
|
18
|
-
type CompDoc =
|
|
18
|
+
type CompDoc = ComponentType<{
|
|
19
19
|
customEvents: {
|
|
20
20
|
aaa_str: string | Bubbles;
|
|
21
21
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { ComponentType } from "../../../DefineComponent/ReturnType/ComponentType";
|
|
2
|
+
import type { RootComponentType } from "../../../RootComponent/RootComponentType";
|
|
3
3
|
import { SubComponent } from "../..";
|
|
4
4
|
|
|
5
|
-
type RootDoc =
|
|
5
|
+
type RootDoc = RootComponentType<{
|
|
6
6
|
methods: {
|
|
7
7
|
Mstr: () => string;
|
|
8
8
|
};
|
|
9
9
|
}>;
|
|
10
10
|
|
|
11
|
-
type CompDoc =
|
|
11
|
+
type CompDoc = ComponentType<{
|
|
12
12
|
customEvents: {
|
|
13
13
|
aaa_str: string;
|
|
14
14
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Checking, type Test } from "hry-types";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ComponentType } from "../../../DefineComponent/ReturnType/ComponentType";
|
|
3
3
|
import { SubComponent } from "../..";
|
|
4
4
|
|
|
5
|
-
type CompDoc =
|
|
5
|
+
type CompDoc = ComponentType<{
|
|
6
6
|
properties: {
|
|
7
7
|
aaa_str: string;
|
|
8
8
|
aaa_bool: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Checking, type Test } from "hry-types";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ComponentType } from "../../../DefineComponent/ReturnType/ComponentType";
|
|
3
3
|
import type {
|
|
4
4
|
Bubbles,
|
|
5
5
|
BubblesCaptureComposed,
|
|
@@ -9,7 +9,7 @@ import type {
|
|
|
9
9
|
} from "../../../RootComponent/CustomEvents/CustomEventsTag";
|
|
10
10
|
import { SubComponent } from "../..";
|
|
11
11
|
|
|
12
|
-
type CompDoc =
|
|
12
|
+
type CompDoc = ComponentType<{
|
|
13
13
|
properties: {
|
|
14
14
|
aaa_str: string;
|
|
15
15
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { observable } from "mobx";
|
|
2
2
|
|
|
3
|
-
import type {
|
|
3
|
+
import type { ComponentType } from "../../../DefineComponent/ReturnType/ComponentType";
|
|
4
4
|
import { SubComponent } from "../..";
|
|
5
5
|
const user = observable({
|
|
6
6
|
name: "zhao",
|
|
7
7
|
age: 20,
|
|
8
8
|
});
|
|
9
9
|
|
|
10
|
-
type DocA =
|
|
10
|
+
type DocA = ComponentType<{
|
|
11
11
|
properties: {
|
|
12
12
|
aaa_str: string;
|
|
13
13
|
aaa_num: number;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { observable } from "mobx";
|
|
2
2
|
|
|
3
|
-
import type {
|
|
3
|
+
import type { ComponentType } from "../../../DefineComponent/ReturnType/ComponentType";
|
|
4
4
|
import { SubComponent } from "../..";
|
|
5
5
|
const user = observable({
|
|
6
6
|
name: "zhao",
|
|
7
7
|
age: 20,
|
|
8
8
|
});
|
|
9
9
|
|
|
10
|
-
type DocA =
|
|
10
|
+
type DocA = ComponentType<{
|
|
11
11
|
properties: {
|
|
12
12
|
aaa_str: string;
|
|
13
13
|
aaa_num: number;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Checking, type Test } from "hry-types";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ComponentType } from "../../../DefineComponent/ReturnType/ComponentType";
|
|
3
3
|
import type { Mock_User } from "../../../RootComponent/Properties/test/normalRequired.test";
|
|
4
|
-
import type {
|
|
4
|
+
import type { RootComponentType } from "../../../RootComponent/RootComponentType";
|
|
5
5
|
import { SubComponent } from "../..";
|
|
6
6
|
|
|
7
|
-
type RootDoc =
|
|
7
|
+
type RootDoc = RootComponentType<{
|
|
8
8
|
properties: {
|
|
9
9
|
obj: Mock_User | null;
|
|
10
10
|
};
|
|
@@ -16,7 +16,7 @@ type RootDoc = RootComponentDoc<{
|
|
|
16
16
|
};
|
|
17
17
|
}>;
|
|
18
18
|
|
|
19
|
-
type CompDoc =
|
|
19
|
+
type CompDoc = ComponentType<{
|
|
20
20
|
properties: {
|
|
21
21
|
aaa_obj: Mock_User | null;
|
|
22
22
|
aaa_str: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Checking, type Test } from "hry-types";
|
|
2
2
|
|
|
3
|
-
import type {
|
|
3
|
+
import type { ComponentType } from "../../../DefineComponent/ReturnType/ComponentType";
|
|
4
4
|
|
|
5
5
|
import type { Mock_User } from "../../../RootComponent/Properties/test/normalRequired.test";
|
|
6
6
|
import { SubComponent } from "../..";
|
|
@@ -9,7 +9,7 @@ interface TestObj {
|
|
|
9
9
|
subObj: Mock_User;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
type CompDoc =
|
|
12
|
+
type CompDoc = ComponentType<{
|
|
13
13
|
properties: {
|
|
14
14
|
aaa_str: string;
|
|
15
15
|
aaa_num: number;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Checking, type Test } from "hry-types";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ComponentType } from "../../../DefineComponent/ReturnType/ComponentType";
|
|
3
3
|
import { SubComponent } from "../..";
|
|
4
4
|
|
|
5
|
-
type CompDoc =
|
|
5
|
+
type CompDoc = ComponentType<{
|
|
6
6
|
properties: {
|
|
7
7
|
aaa_str: string;
|
|
8
8
|
aaa_num: number;
|