annil 1.2.1 → 1.3.0-dev.202312100

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 (49) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +2 -4
  3. package/dist/api/DefineComponent/NameOrPage/NameOrPathOption.d.ts +1 -1
  4. package/dist/api/DefineComponent/collectOptionsForComponent.d.ts +24 -4
  5. package/dist/api/DefineComponent/collectOptionsForComponent.js +4 -2
  6. package/dist/api/DefineComponent/collectOptionsForComponent.js.map +1 -1
  7. package/dist/api/DefineComponent/index.d.ts +8 -23
  8. package/dist/api/DefineComponent/index.js +1 -1
  9. package/dist/api/DefineComponent/index.js.map +1 -1
  10. package/dist/api/RootComponent/CustomEvents/CustomEventConstraint.d.ts +1 -1
  11. package/dist/api/RootComponent/CustomEvents/GetCustomEventDoc.d.ts +1 -1
  12. package/dist/api/RootComponent/CustomEvents/test/GetCustomEventDoc.test.d.ts +1 -0
  13. package/dist/api/RootComponent/CustomEvents/test/GetCustomEventDoc.test.js.map +1 -1
  14. package/dist/api/RootComponent/CustomEvents/test/normal.test.d.ts +2 -0
  15. package/dist/api/RootComponent/CustomEvents/test/normal.test.js +1 -0
  16. package/dist/api/RootComponent/CustomEvents/test/normal.test.js.map +1 -1
  17. package/dist/api/RootComponent/Instance/CustomEventMethods.d.ts +1 -1
  18. package/dist/api/RootComponent/Instance/test/CustomEventsDoc.test.js +2 -0
  19. package/dist/api/RootComponent/Instance/test/CustomEventsDoc.test.js.map +1 -1
  20. package/dist/api/RootComponent/Instance/test/customEvents/normal.test.js +2 -0
  21. package/dist/api/RootComponent/Instance/test/customEvents/normal.test.js.map +1 -1
  22. package/dist/api/RootComponent/Lifetimes/LifetimesConstraint.d.ts +1 -1
  23. package/dist/behaviors/BComputedAndWatch/computedUpdater.js +1 -1
  24. package/dist/behaviors/BComputedAndWatch/computedUpdater.js.map +1 -1
  25. package/dist/behaviors/BComputedAndWatch/getPathsValue.d.ts +1 -1
  26. package/dist/behaviors/BComputedAndWatch/getPathsValue.js +13 -8
  27. package/dist/behaviors/BComputedAndWatch/getPathsValue.js.map +1 -1
  28. package/dist/behaviors/BComputedAndWatch/index.js +4 -4
  29. package/dist/behaviors/BComputedAndWatch/index.js.map +1 -1
  30. package/dist/behaviors/BComputedAndWatch/types.d.ts +1 -1
  31. package/dist/behaviors/BStore.js.map +1 -1
  32. package/package.json +1 -1
  33. package/src/api/DefineComponent/NameOrPage/NameOrPathOption.ts +1 -1
  34. package/src/api/DefineComponent/collectOptionsForComponent.ts +60 -106
  35. package/src/api/DefineComponent/index.ts +8 -32
  36. package/src/api/RootComponent/CustomEvents/CustomEventConstraint.ts +1 -1
  37. package/src/api/RootComponent/CustomEvents/GetCustomEventDoc.ts +1 -0
  38. package/src/api/RootComponent/CustomEvents/test/GetCustomEventDoc.test.ts +1 -0
  39. package/src/api/RootComponent/CustomEvents/test/normal.test.ts +2 -0
  40. package/src/api/RootComponent/Instance/CustomEventMethods.ts +2 -2
  41. package/src/api/RootComponent/Instance/test/CustomEventsDoc.test.ts +5 -2
  42. package/src/api/RootComponent/Instance/test/customEvents/normal.test.ts +5 -2
  43. package/src/api/RootComponent/Lifetimes/LifetimesConstraint.ts +1 -1
  44. package/src/behaviors/BComputedAndWatch/computedUpdater.ts +2 -1
  45. package/src/behaviors/BComputedAndWatch/getPathsValue.ts +25 -9
  46. package/src/behaviors/BComputedAndWatch/index.ts +7 -6
  47. package/src/behaviors/BComputedAndWatch/types.ts +1 -1
  48. package/src/behaviors/BStore.ts +2 -1
  49. package/src/behaviors/BbeforeCreated.ts +1 -1
package/CHANGELOG.md CHANGED
@@ -4,6 +4,20 @@
4
4
 
5
5
  * 解决DetailedType不接收接口类型的错误 ([ae8acbf](https://github.com/missannil/annil/commit/ae8acbfc2e62f99db565c448ad9253aa549e78bb))
6
6
 
7
+ ## [1.3.0-dev.202312100](https://github.com/missannil/annil/compare/v1.2.2-dev.202312100...v1.3.0-dev.202312100) (2023-12-11)
8
+
9
+
10
+ ### Features
11
+
12
+ * watch支持配置单个字段监控多个数据,但没有类型提示 ([37db28a](https://github.com/missannil/annil/commit/37db28a87a7f3af145a7c141e05d2a3b35e6bcb7))
13
+
14
+ ## [1.2.2-dev.202312100](https://github.com/missannil/annil/compare/v1.2.1...v1.2.2-dev.202312100) (2023-12-10)
15
+
16
+
17
+ ### type
18
+
19
+ * 修改了customEvents字段的类型,允许undefined类型 ([2c1c35a](https://github.com/missannil/annil/commit/2c1c35a8581016c2e0eb9cfeb01f2ed6e4f8d53c))
20
+
7
21
  ## [1.2.1](https://github.com/missannil/annil/compare/v1.2.0...v1.2.1) (2023-12-09)
8
22
 
9
23
 
package/README.md CHANGED
@@ -27,12 +27,10 @@ annil(安奈儿)是微信小程序原生开发插件,提供了新的组件构建
27
27
 
28
28
  ### 特点
29
29
 
30
- - **API功能更全面**
30
+ - **API功能更全面 **
31
31
 
32
- 新的组件API(相较原生Component/Page)加入了`computed`、`watch`、`store(全局响应式数据基于mobx)`等功能,使开发更便捷。
32
+ 新的组件API(相较原生Component/Page)加入了`computed`、`watch`、`store(全局响应式数据基于mobx)`等功能,使开发更便捷。[示例](./doc/demo/firstMeeting.md)
33
33
 
34
- ```ts
35
- ```
36
34
  - **复杂组件解决方案**
37
35
 
38
36
  新的组件API把组件逻辑部分解耦为根组件逻辑和子组件逻辑,与wxml元素一一对应。彻底解决原生API书写复杂组件时代码逻辑耦合的问题。
@@ -1,6 +1,6 @@
1
1
  import type { IfExtends } from "hry-types/src/Any/IfExtends";
2
2
  import type { Includes } from "../../../types/includes";
3
- export type NameOrPageOption<TName extends string, TPath extends `/${string}`, IsPage extends boolean> = IsPage extends true ? {
3
+ export type NameOrPathOption<TName extends string, TPath extends `/${string}`, IsPage extends boolean> = IsPage extends true ? {
4
4
  path: TPath;
5
5
  } : {
6
6
  name: TName & IfExtends<TName, "", () => "⚠️组件名不可为空⚠️", IfExtends<Includes<TName, "_">, true, () => "⚠️组件名不可包含下划线 _ ⚠️", unknown>>;
@@ -1,4 +1,24 @@
1
- import type { RootComponentTrueOptions } from "../RootComponent";
2
- import type { SubComponentTrueOptions } from "../SubComponent";
3
- import type { FinalOptionsOfComponent } from ".";
4
- export declare function collectOptionsForComponent(rootComponentOption: RootComponentTrueOptions | undefined, subComponentsList: SubComponentTrueOptions[] | undefined): FinalOptionsOfComponent;
1
+ import type { Func } from "hry-types/src/Misc/_api";
2
+ import type { WMComponent } from "../../types/OfficialTypeAlias";
3
+ import type { ComputedConstraint } from "../RootComponent/Computed/ComputedConstraint";
4
+ import type { DataConstraint } from "../RootComponent/Data/DataConstraint";
5
+ import type { LifetimesConstraint } from "../RootComponent/Lifetimes/LifetimesConstraint";
6
+ import type { MethodsConstraint } from "../RootComponent/Methods/MethodsConstraint";
7
+ import type { PageLifetimesOption } from "../RootComponent/PageLifetimes/PageLifetimesOption";
8
+ import type { StoreConstraint } from "../RootComponent/Store/StoreConstraint";
9
+ import type { DefineComponentOption } from ".";
10
+ export type FuncOptions = Record<"pageLifetimes" | "lifetimes" | "watch", Record<string, Func[]>>;
11
+ export type FinalOptionsOfComponent = {
12
+ isPage?: boolean;
13
+ options?: WMComponent.Options;
14
+ properties?: Record<string, any>;
15
+ data?: DataConstraint;
16
+ store?: StoreConstraint;
17
+ computed?: ComputedConstraint;
18
+ observers?: Record<string, Func>;
19
+ behaviors?: string[];
20
+ methods?: MethodsConstraint;
21
+ watch?: Record<string, Func>;
22
+ lifetimes?: LifetimesConstraint;
23
+ } & PageLifetimesOption<false, object>;
24
+ export declare function collectOptionsForComponent(defineComponentOption: DefineComponentOption): FinalOptionsOfComponent;
@@ -19,7 +19,7 @@ function onLoadReceivedDataHandle(option) {
19
19
  }
20
20
  function loadReceivedDataHandle(option) {
21
21
  const innerData = option[INNERMARKER.url];
22
- if (innerData === undefined)
22
+ if (innerData === undefined || innerData == INNERMARKER.url)
23
23
  return;
24
24
  const decodeOption = JSON.parse(decodeURIComponent(innerData));
25
25
  for (const key in decodeOption) {
@@ -124,8 +124,10 @@ function collectRootComponentOption(finalOptions, funcOptions, rootComponentOpti
124
124
  funcFieldsCollect(rootComponentOptions, funcOptions);
125
125
  otherFieldsHandle(finalOptions, rootComponentOptions);
126
126
  }
127
- export function collectOptionsForComponent(rootComponentOption, subComponentsList) {
127
+ export function collectOptionsForComponent(defineComponentOption) {
128
128
  var _a, _b;
129
+ const rootComponentOption = defineComponentOption.rootComponent;
130
+ const subComponentsList = defineComponentOption.subComponents;
129
131
  const finalOptionsForComponent = {
130
132
  options: {
131
133
  addGlobalClass: true,
@@ -1 +1 @@
1
- {"version":3,"file":"collectOptionsForComponent.js","sourceRoot":"","sources":["../../../src/api/DefineComponent/collectOptionsForComponent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,gDAAgD,CAAC;AAE9E,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAmB1D,SAAS,wBAAwB,CAE/B,MAA8C;IAE9C,MAAM,SAAS,GAAuB,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAG9D,IAAI,SAAS,KAAK,SAAS;QAAE,OAAO;IACpC,IAAI,SAAS,KAAK,WAAW,CAAC,GAAG,EAAE,CAAC;QAElC,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC,CAAC;QAC/D,KAAK,MAAM,GAAG,IAAI,YAAY,EAAE,CAAC;YAC/B,MAAM,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;QAClC,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC,WAAW,C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CAAC,CAAC;IAChF,CAAC;IAGD,gBAAgB,CAAC,wBAAwB,EAAE,mBAAmB,aAAnB,mBAAmB,uBAAnB,mBAAmB,CAAE,MAAM,EAAE,WAAW,CAAC,CAAC;IAErF,wBAAwB,CAAC,OAAO,IAAI,uBAAuB,CAAC,wBAAwB,CAAC,OAAO,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;IAG5G,CAAA,MAAA,wBAAwB,CAAC,OAAO,0CAAE,MAAM;WACnC,MAAM,CAAC,wBAAwB,CAAC,OAAO,EAAE,QAAQ,EAAE,CAAC,wBAAwB,EAAE,YAAY,CAAC,EAAE,EAAE,CAAC,CAAC;IAGtG,CAAA,MAAA,wBAAwB,CAAC,aAAa,0CAAE,IAAI;WACvC,MAAM,CAAC,wBAAwB,CAAC,aAAa,EAAE,MAAM,EAAE,CAAC,sBAAsB,CAAC,EAAE,EAAE,CAAC,CAAC;IAK1F,IAAI,wBAAwB,CAAC,MAAM,EAAE,CAAC;QAEpC,OAAO,CAAC,cAAc,CAAC,wBAAwB,CAAC,OAAQ,EAAE,aAAa,CAAC,CAAC;IAC3E,CAAC;IAED,wBAAwB,CAAC,SAAU,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAExD,OAAO,wBAAwB,CAAC;AAClC,CAAC"}
@@ -1,37 +1,22 @@
1
1
  import type { IfExtends } from "hry-types/src/Any/IfExtends";
2
- import type { Func } from "hry-types/src/Misc/Func";
3
- import type { WMComponent } from "../../types/OfficialTypeAlias";
4
- import type { LifetimesConstraint } from "../RootComponent/Lifetimes/LifetimesConstraint";
5
2
  import type { RootComponentDoc } from "../RootComponent/RootComponentDoc";
6
3
  import type { SubComponentDoc } from "../SubComponent/SubComponentDoc";
7
- import type { NameOrPageOption as NameOrPathOption } from "./NameOrPage/NameOrPathOption";
4
+ import type { NameOrPathOption } from "./NameOrPage/NameOrPathOption";
8
5
  import type { CreateComponentDoc } from "./ReturnType/CreateComponentDoc";
9
6
  import type { CreatePageDoc } from "./ReturnType/CreatePageDoc";
10
7
  import type { RootComponentOption } from "./RootComponent/RootComponentOption";
11
8
  import type { SubComponentsOption } from "./SubComponents/SubComponentsOption";
12
- import type { ComputedConstraint } from "../RootComponent/Computed/ComputedConstraint";
13
- import type { DataConstraint } from "../RootComponent/Data/DataConstraint";
14
- import type { MethodsConstraint } from "../RootComponent/Methods/MethodsConstraint";
15
- import type { PageLifetimesOption } from "../RootComponent/PageLifetimes/PageLifetimesOption";
16
- import type { StoreConstraint } from "../RootComponent/Store/StoreConstraint";
9
+ import type { RootComponentTrueOptions } from "../RootComponent";
17
10
  type Path = `/${string}`;
18
11
  type RootOptions<TRootComponentDoc extends RootComponentDoc, TSubComponentTuple extends SubComponentDoc[], TName extends string, TPath extends Path> = NameOrPathOption<TName, TPath, TRootComponentDoc["isPage"] & {}> & RootComponentOption<TRootComponentDoc> & SubComponentsOption<TSubComponentTuple>;
19
12
  interface DefineComponentConstructor {
20
13
  <TRootComponentDoc extends RootComponentDoc = {}, TSubComponentTuple extends SubComponentDoc[] = [], TName extends string = "", TPath extends Path = "/">(options: RootOptions<TRootComponentDoc, TSubComponentTuple, TName, TPath>): IfExtends<"", TName, CreatePageDoc<TRootComponentDoc, TPath>, CreateComponentDoc<TRootComponentDoc, TName, TSubComponentTuple>>;
21
14
  }
22
- export type FuncOptions = Record<"pageLifetimes" | "lifetimes" | "watch", Record<string, Func[]>>;
23
- export type FinalOptionsOfComponent = {
24
- isPage?: boolean;
25
- options?: WMComponent.Options;
26
- properties?: Record<string, any>;
27
- data?: DataConstraint;
28
- store?: StoreConstraint;
29
- computed?: ComputedConstraint;
30
- observers?: Record<string, Func>;
31
- behaviors?: string[];
32
- methods?: MethodsConstraint;
33
- watch?: Record<string, Func>;
34
- lifetimes?: LifetimesConstraint;
35
- } & PageLifetimesOption<false, object>;
15
+ export type DefineComponentOption = {
16
+ name?: string;
17
+ path?: string;
18
+ rootComponent?: RootComponentTrueOptions;
19
+ subComponents?: SubComponentDoc[];
20
+ };
36
21
  export declare const DefineComponent: DefineComponentConstructor;
37
22
  export {};
@@ -1,5 +1,5 @@
1
1
  import { collectOptionsForComponent } from "./collectOptionsForComponent";
2
2
  export const DefineComponent = function (options) {
3
- Component(collectOptionsForComponent(options.rootComponent, options.subComponents));
3
+ Component(collectOptionsForComponent(options));
4
4
  };
5
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/DefineComponent/index.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AA2D1E,MAAM,CAAC,MAAM,eAAe,GAA+B,UAAS,OAAO;IAEzE,SAAS,CACP,0BAA0B,CAAC,OAAO,CAAC,aAAyC,EAAE,OAAO,CAAC,aAAa,CAAC,CACrG,CAAC;AACJ,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/DefineComponent/index.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AA2C1E,MAAM,CAAC,MAAM,eAAe,GAA+B,UAAS,OAAO;IAEzE,SAAS,CACP,0BAA0B,CAAC,OAAgC,CAAC,CAC7D,CAAC;AACJ,CAAC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import type { DetailedType } from "../../../types/DetailedType";
2
- type SimpleCustomeEvents = DetailedType | null;
2
+ type SimpleCustomeEvents = DetailedType | null | undefined;
3
3
  export type SimpleCustomeEventsList = SimpleCustomeEvents[];
4
4
  export type ShortCustomeEvents = SimpleCustomeEvents | SimpleCustomeEventsList;
5
5
  type BubblesConfig = {
@@ -2,7 +2,7 @@ import type { DetailedType } from "../../../types/DetailedType";
2
2
  import type { InferDetailedType } from "../../../types/InferDetailedType";
3
3
  import type { CustomEventConstraint, FullCustomEvents, ShortCustomeEvents, SimpleCustomeEventsList } from "./CustomEventConstraint";
4
4
  import type { AddTagForCustomEventsDoc } from "./CustomEventsTag";
5
- export type GetShortCustomEventsDoc<T extends ShortCustomeEvents> = T extends DetailedType ? InferDetailedType<T> : T extends null ? null : T extends SimpleCustomeEventsList ? GetShortCustomEventsDoc<T[number]> : never;
5
+ export type GetShortCustomEventsDoc<T extends ShortCustomeEvents> = T extends DetailedType ? InferDetailedType<T> : T extends null ? null : T extends undefined ? undefined : T extends SimpleCustomeEventsList ? GetShortCustomEventsDoc<T[number]> : never;
6
6
  export type GetFullCustomEventsDoc<T extends FullCustomEvents> = GetShortCustomEventsDoc<T["detail"]> | AddTagForCustomEventsDoc<T["options"]>;
7
7
  export type GetCustomEventDoc<T extends CustomEventConstraint> = {
8
8
  [k in keyof T]: T[k] extends ShortCustomeEvents ? GetShortCustomEventsDoc<T[k]> : GetShortCustomEventsDoc<T[k]["detail"]> | AddTagForCustomEventsDoc<T[k]["options"]>;
@@ -3,6 +3,7 @@ import { type ListExpected, type NullExpected, type StrExpected, type UnionStrEx
3
3
  export type Mock_CustomEventsDocExpected = {
4
4
  str: StrExpected;
5
5
  null: NullExpected;
6
+ nothing: undefined;
6
7
  unionStr: UnionStrExpected;
7
8
  union: ListExpected;
8
9
  bubbles: bubblesExpected;
@@ -1 +1 @@
1
- {"version":3,"file":"GetCustomEventDoc.test.js","sourceRoot":"","sources":["../../../../../src/api/RootComponent/CustomEvents/test/GetCustomEventDoc.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAa,MAAM,WAAW,CAAC;AAYhD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAiBlD,QAAuE,CAAC"}
1
+ {"version":3,"file":"GetCustomEventDoc.test.js","sourceRoot":"","sources":["../../../../../src/api/RootComponent/CustomEvents/test/GetCustomEventDoc.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAa,MAAM,WAAW,CAAC;AAYhD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAkBlD,QAAuE,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import { type DetailedType } from "../../../..";
2
2
  export declare const mock_shortCustomEvents: {
3
3
  str: StringConstructor;
4
+ nothing: undefined;
4
5
  null: null;
5
6
  unionStr: DetailedType<"male" | "female">;
6
7
  union: (StringConstructor | DetailedType<0 | 1 | 2> | null)[];
@@ -91,6 +92,7 @@ export declare const mock_customEvents: {
91
92
  };
92
93
  };
93
94
  str: StringConstructor;
95
+ nothing: undefined;
94
96
  null: null;
95
97
  unionStr: DetailedType<"male" | "female">;
96
98
  union: (StringConstructor | DetailedType<0 | 1 | 2> | null)[];
@@ -2,6 +2,7 @@ import { Checking } from "hry-types";
2
2
  import { RootComponent } from "../../../..";
3
3
  export const mock_shortCustomEvents = {
4
4
  str: String,
5
+ nothing: undefined,
5
6
  null: null,
6
7
  unionStr: String,
7
8
  union: [String, Number, null],
@@ -1 +1 @@
1
- {"version":3,"file":"normal.test.js","sourceRoot":"","sources":["../../../../../src/api/RootComponent/CustomEvents/test/normal.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAa,MAAM,WAAW,CAAC;AAChD,OAAO,EAAqB,aAAa,EAAE,MAAM,aAAa,CAAC;AAc/D,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,GAAG,EAAE,MAAM;IACX,IAAI,EAAE,IAAI;IACV,QAAQ,EAAE,MAAyC;IACnD,KAAK,EAAE,CAAC,MAAM,EAAE,MAAiC,EAAE,IAAI,CAAC;CACZ,CAAC;AAK/C,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,OAAO,EAAE;QACP,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;KAC3B;IACD,YAAY,EAAE;QACZ,MAAM,EAAE,IAAI;QACZ,OAAO,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE;KAChC;IACD,oBAAoB,EAAE;QACpB,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;QACxB,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE;KAC/C;IACD,gBAAgB,EAAE;QAChB,MAAM,EAAE,MAAyC;QACjD,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;KAC3C;IACD,qBAAqB,EAAE;QACrB,MAAM,EAAE,CAAC,MAAM,EAAE,MAAiC,EAAE,IAAI,CAAC;QACzD,OAAO,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;KAChD;IACD,6BAA6B,EAAE;QAC7B,MAAM,EAAE,OAAO;QACf,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;KAC/D;CACyC,CAAC;AAE7C,MAAM,CAAC,MAAM,iBAAiB,GAAG,gCAC5B,sBAAsB,GACtB,qBAAqB,CACO,CAAC;AAElC,MAAM,OAAO,GAAG,aAAa,EAAE,CAAC;IAC9B,YAAY,EAAE,iBAAiB;CAChC,CAAC,CAAC;AAoBH,QAA4C,CAAC;AAE7C,MAAM,YAAY,GAAG,aAAa,EAAE,CAAC;IACnC,YAAY,EAAE,EAAE;CACjB,CAAC,CAAC;AAGH,QAA4C,CAAC;AAE7C,MAAM,eAAe,GAAG,aAAa,EAAE,CAAC,EAAE,CAAC,CAAC;AAG5C,QAA+C,CAAC"}
1
+ {"version":3,"file":"normal.test.js","sourceRoot":"","sources":["../../../../../src/api/RootComponent/CustomEvents/test/normal.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAa,MAAM,WAAW,CAAC;AAChD,OAAO,EAAqB,aAAa,EAAE,MAAM,aAAa,CAAC;AAc/D,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,GAAG,EAAE,MAAM;IACX,OAAO,EAAE,SAAS;IAClB,IAAI,EAAE,IAAI;IACV,QAAQ,EAAE,MAAyC;IACnD,KAAK,EAAE,CAAC,MAAM,EAA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CAAC"}
@@ -1,5 +1,5 @@
1
1
  import type { IfExtends } from "hry-types/src/Any/IfExtends";
2
2
  import type { CustomEventsTags } from "../CustomEvents/CustomEventsTag";
3
3
  export type CustomEventMethods<O extends object> = {
4
- [k in keyof O]: IfExtends<Exclude<O[k], CustomEventsTags> & {}, never, () => void, (detail: Exclude<O[k], CustomEventsTags>) => void>;
4
+ [k in keyof O]: IfExtends<Exclude<O[k], CustomEventsTags>, undefined, () => void, (detail: Exclude<O[k], CustomEventsTags>) => void>;
5
5
  };
@@ -6,6 +6,7 @@ RootComponent()({
6
6
  num: Number,
7
7
  union: [String, Number],
8
8
  null: null,
9
+ undefined: undefined,
9
10
  bubbles: {
10
11
  detail: String,
11
12
  options: {
@@ -52,6 +53,7 @@ RootComponent()({
52
53
  Checking;
53
54
  Checking;
54
55
  Checking;
56
+ Checking;
55
57
  },
56
58
  },
57
59
  });
@@ -1 +1 @@
1
- {"version":3,"file":"CustomEventsDoc.test.js","sourceRoot":"","sources":["../../../../../src/api/RootComponent/Instance/test/CustomEventsDoc.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAa,MAAM,WAAW,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,aAAa,EAAE,CAAC;IACd,YAAY,EAAE;QACZ,GAAG,EAAE,MAAM;QACX,GAAG,EAAE,MAA6B;QAClC,KAAK,EAAE,CAAC,MAAwC,EAAE,MAAM,CAAC;QACzD,IAAI,EAAE,IAAI;QACV,OAAO,EAAE;YACP,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,IAAI;aACd;SACF;QACD,YAAY,EAAE;YACZ,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,YAAY,EAAE,IAAI;aACnB;SACF;QACD,eAAe,EAAE;YACf,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,IAAI;gBACb,QAAQ,EAAE,IAAI;aACf;SACF;QACD,oBAAoB,EAAE;YACpB,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,YAAY,EAAE,IAAI;gBAClB,QAAQ,EAAE,IAAI;aACf;SACF;QACD,2BAA2B,EAAE;YAC3B,MAAM,EAAE,IAAI;YACZ,OAAO,EAAE;gBACP,OAAO,EAAE,IAAI;gBACb,YAAY,EAAE,IAAI;gBAClB,QAAQ,EAAE,IAAI;aACf;SACF;KACF;IACD,OAAO,EAAE;QACP,EAAE;YACA,QAA8D,CAAC;YAE/D,QAA6D,CAAC;YAE9D,QAAmF,CAAC;YAEpF,QAAiD,CAAC;YAElD,QAA8D,CAAC;YAE/D,QAAuE,CAAC;YAExE,QAA0E,CAAC;YAE3E,QAA+E,CAAC;YAEhF,QAAwE,CAAC;QAC3E,CAAC;KACF;CACF,CAAC,CAAC"}
1
+ {"version":3,"file":"CustomEventsDoc.test.js","sourceRoot":"","sources":["../../../../../src/api/RootComponent/Instance/test/CustomEventsDoc.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAa,MAAM,WAAW,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,aAAa,EAAE,CAAC;IACd,YAAY,EAAE;QACZ,GAAG,EAAE,MAAM;QACX,GAAG,EAAE,MAA6B;QAClC,KAAK,EAAE,CAAC,MAAwC,EAAE,MAAM,CAAC;QACzD,IAAI,EAAE,IAAI;QACV,SAAS,EAAE,SAAS;QACpB,OAAO,EAAE;YACP,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,IAAI;aACd;SACF;QACD,YAAY,EAAE;YACZ,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,YAAY,EAAE,IAAI;aACnB;SACF;QACD,eAAe,EAAE;YACf,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,IAAI;gBACb,QAAQ,EAAE,IAAI;aACf;SACF;QACD,oBAAoB,EAAE;YACpB,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,YAAY,EAAE,IAAI;gBAClB,QAAQ,EAAE,IAAI;aACf;SACF;QACD,2BAA2B,EAAE;YAC3B,MAAM,EAAE,IAAI;YACZ,OAAO,EAAE;gBACP,OAAO,EAAE,IAAI;gBACb,YAAY,EAAE,IAAI;gBAClB,QAAQ,EAAE,IAAI;aACf;SACF;KACF;IACD,OAAO,EAAE;QACP,EAAE;YACA,QAA8D,CAAC;YAE/D,QAA6D,CAAC;YAE9D,QAAmF,CAAC;YAEpF,QAA6D,CAAC;YAE9D,QAAsD,CAAC;YAEvD,QAA8D,CAAC;YAE/D,QAAuE,CAAC;YAExE,QAA0E,CAAC;YAE3E,QAA+E,CAAC;YAEhF,QAAoF,CAAC;QACvF,CAAC;KACF;CACF,CAAC,CAAC"}
@@ -6,6 +6,7 @@ RootComponent()({
6
6
  num: Number,
7
7
  union: [String, Number],
8
8
  null: null,
9
+ undefined: undefined,
9
10
  bubbles: {
10
11
  detail: String,
11
12
  options: {
@@ -52,6 +53,7 @@ RootComponent()({
52
53
  Checking;
53
54
  Checking;
54
55
  Checking;
56
+ Checking;
55
57
  },
56
58
  },
57
59
  });
@@ -1 +1 @@
1
- {"version":3,"file":"normal.test.js","sourceRoot":"","sources":["../../../../../../src/api/RootComponent/Instance/test/customEvents/normal.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAa,MAAM,WAAW,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,aAAa,EAAE,CAAC;IACd,YAAY,EAAE;QACZ,GAAG,EAAE,MAAM;QACX,GAAG,EAAE,MAA6B;QAClC,KAAK,EAAE,CAAC,MAAwC,EAAE,MAAM,CAAC;QACzD,IAAI,EAAE,IAAI;QACV,OAAO,EAAE;YACP,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,IAAI;aACd;SACF;QACD,YAAY,EAAE;YACZ,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,YAAY,EAAE,IAAI;aACnB;SACF;QACD,eAAe,EAAE;YACf,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,IAAI;gBACb,QAAQ,EAAE,IAAI;aACf;SACF;QACD,oBAAoB,EAAE;YACpB,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,YAAY,EAAE,IAAI;gBAClB,QAAQ,EAAE,IAAI;aACf;SACF;QACD,2BAA2B,EAAE;YAC3B,MAAM,EAAE,IAAI;YACZ,OAAO,EAAE;gBACP,OAAO,EAAE,IAAI;gBACb,YAAY,EAAE,IAAI;gBAClB,QAAQ,EAAE,IAAI;aACf;SACF;KACF;IACD,OAAO,EAAE;QACP,EAAE;YACA,QAA8D,CAAC;YAE/D,QAA6D,CAAC;YAE9D,QAAmF,CAAC;YAEpF,QAAiD,CAAC;YAElD,QAA8D,CAAC;YAE/D,QAAuE,CAAC;YAExE,QAA0E,CAAC;YAE3E,QAA+E,CAAC;YAEhF,QAAwE,CAAC;QAC3E,CAAC;KACF;CACF,CAAC,CAAC"}
1
+ {"version":3,"file":"normal.test.js","sourceRoot":"","sources":["../../../../../../src/api/RootComponent/Instance/test/customEvents/normal.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAa,MAAM,WAAW,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,aAAa,EAAE,CAAC;IACd,YAAY,EAAE;QACZ,GAAG,EAAE,MAAM;QACX,GAAG,EAAE,MAA6B;QAClC,KAAK,EAAE,CAAC,MAAwC,EAAE,MAAM,CAAC;QACzD,IAAI,EAAE,IAAI;QACV,SAAS,EAAE,SAAS;QACpB,OAAO,EAAE;YACP,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,IAAI;aACd;SACF;QACD,YAAY,EAAE;YACZ,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,YAAY,EAAE,IAAI;aACnB;SACF;QACD,eAAe,EAAE;YACf,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,IAAI;gBACb,QAAQ,EAAE,IAAI;aACf;SACF;QACD,oBAAoB,EAAE;YACpB,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,YAAY,EAAE,IAAI;gBAClB,QAAQ,EAAE,IAAI;aACf;SACF;QACD,2BAA2B,EAAE;YAC3B,MAAM,EAAE,IAAI;YACZ,OAAO,EAAE;gBACP,OAAO,EAAE,IAAI;gBACb,YAAY,EAAE,IAAI;gBAClB,QAAQ,EAAE,IAAI;aACf;SACF;KACF;IACD,OAAO,EAAE;QACP,EAAE;YACA,QAA8D,CAAC;YAE/D,QAA6D,CAAC;YAE9D,QAAmF,CAAC;YAEpF,QAA6D,CAAC;YAE9D,QAAsD,CAAC;YAEvD,QAA8D,CAAC;YAE/D,QAAuE,CAAC;YAExE,QAA0E,CAAC;YAE3E,QAA+E,CAAC;YAEhF,QAAoF,CAAC;QACvF,CAAC;KACF;CACF,CAAC,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import type { ComputeIntersection } from "hry-types/src/Object/ComputeIntersection";
2
2
  import type { WMCompLifetimes } from "../../../types/OfficialTypeAlias";
3
- import type { FinalOptionsOfComponent } from "../../DefineComponent";
3
+ import type { FinalOptionsOfComponent } from "../../DefineComponent/collectOptionsForComponent";
4
4
  export type LifetimesConstraint = ComputeIntersection<WMCompLifetimes["lifetimes"] & {
5
5
  beforeCreate?: (options: FinalOptionsOfComponent) => void;
6
6
  }>;
@@ -6,7 +6,7 @@ export function computedUpdater(isUpdated = false) {
6
6
  const itemCache = this.__computedCache__[key];
7
7
  let changed = false;
8
8
  for (const dep of itemCache.dependences) {
9
- const curVal = getPathsValue.call(this, dep.paths);
9
+ const curVal = getPathsValue.call(this, dep.paths.join("."))[0];
10
10
  if (!isEqual(curVal, dep.val)) {
11
11
  changed = true;
12
12
  break;
@@ -1 +1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AEf,MAAM;YACR,CAAC;QACH,CAAC;QACD,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,cAAc,GAAyB,EAAE,CAAC;YAEhD,MAAM,KAAK,GAAG,IAAI,CAAC;YACnB,MAAM,YAAY,GAAG,IAAI,KAAK,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,cAAc,CAAC,EAAE,EAAE;gBAC7E,GAAG,CAAC,MAAM,EAAE,GAAG;oBACb,IAAI,GAAG,KAAK,MAAM,EAAE,CAAC;wBACnB,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;oBAClC,CAAC;oBAED,OAAO,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;gBACjC,CAAC;aACF,CAAC,CAAC;YAEH,MAAM,QAAQ,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YAGrD,IAAI,CAAC,OAAO,CAAC;gBACX,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC;aACxB,CAAC,CAAC;YAEH,SAAS,GAAG,IAAI,CAAC;YAGjB,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,WAAW,GAAG,cAAc,CAAC;YAGzD,OAAO,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -1,2 +1,2 @@
1
1
  import type { Instance } from "./types";
2
- export declare function getPathsValue(this: Instance, paths: string[]): any;
2
+ export declare function getPathsValue(this: Instance, paths: string): unknown[];
@@ -1,11 +1,16 @@
1
1
  export function getPathsValue(paths) {
2
- return paths.reduce((pre, path) => {
3
- try {
4
- return pre[path];
5
- }
6
- catch (error) {
7
- return undefined;
8
- }
9
- }, this.data);
2
+ const valueList = [];
3
+ paths.split(",").forEach(path => {
4
+ const value = path.split(".").reduce((pre, path) => {
5
+ try {
6
+ return pre[path];
7
+ }
8
+ catch (error) {
9
+ return undefined;
10
+ }
11
+ }, this.data);
12
+ valueList.push(value);
13
+ });
14
+ return valueList;
10
15
  }
11
16
  //# sourceMappingURL=getPathsValue.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getPathsValue.js","sourceRoot":"","sources":["../../../src/behaviors/BComputedAndWatch/getPathsValue.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,aAAa,CAAiB,KAAe;IAC3D,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,GAAQ,EAAE,IAAI,EAAE,EAAE;QAErC,IAAI,CAAC;YACH,OAAO,GAAG,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,SAAS,CAAC;QACnB,CAAC;IACH,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC"}
1
+ {"version":3,"file":"getPathsValue.js","sourceRoot":"","sources":["../../../src/behaviors/BComputedAndWatch/getPathsValue.ts"],"names":[],"mappings":"AAQA,MAAM,UAAU,aAAa,CAAiB,KAAa;IACzD,MAAM,SAAS,GAAc,EAAE,CAAC;IAGhC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QAE9B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,GAAQ,EAAE,IAAI,EAAE,EAAE;YAEtD,IAAI,CAAC;gBACH,OAAO,GAAG,CAAC,IAAI,CAAC,CAAC;YACnB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,SAAS,CAAC;YACnB,CAAC;QACH,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAEd,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACxB,CAAC,CAAC,CAAC;IAEH,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -8,7 +8,7 @@ import { isPage } from "./IsPage";
8
8
  function initWatchOldValue(watchConfig) {
9
9
  const watchOldValue = {};
10
10
  for (const key in watchConfig) {
11
- watchOldValue[key] = deepClone(getPathsValue.call(this, key.split(".")));
11
+ watchOldValue[key] = deepClone(getPathsValue.call(this, key));
12
12
  }
13
13
  return watchOldValue;
14
14
  }
@@ -56,13 +56,13 @@ export const BComputedAndWatch = Behavior({
56
56
  const observersConfig = options.observers || (options.observers = {});
57
57
  for (const key in watchConfig) {
58
58
  const watchHadle = watchConfig[key];
59
- observersConfig[key] = function (newValue) {
59
+ observersConfig[key] = function (...newValue) {
60
60
  const watchOldValue = this.__watchOldValue__;
61
61
  const oldValue = watchOldValue[key];
62
- if ((newValue === undefined) || isEqual(newValue, oldValue))
62
+ if (isEqual(newValue, oldValue))
63
63
  return;
64
64
  watchOldValue[key] = deepClone(newValue);
65
- watchHadle.call(this, newValue, oldValue);
65
+ watchHadle.call(this, ...newValue, ...oldValue);
66
66
  };
67
67
  }
68
68
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/behaviors/BComputedAndWatch/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,SAAS,iBAAiB,CAAiB,WAAmB;IAC5D,MAAM,aAAa,GAAG,EAAE,CAAC;IACzB,KAAK,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;QAC9B,aAAa,CAA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AAC,CAAC"}
@@ -19,4 +19,4 @@ export type ComputedCache = Record<string, {
19
19
  method: Func;
20
20
  value: unknown;
21
21
  }>;
22
- export type WatchOldValue = Record<string, unknown>;
22
+ export type WatchOldValue = Record<string, unknown[]>;
@@ -1 +1 @@
1
- {"version":3,"file":"BStore.js","sourceRoot":"","sources":["../../src/behaviors/BStore.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAG7D,MAAM,CAAC,MAAM,MAAM,GAAG,QAAQ,CAAC;IAC7B,gBAAgB,CAAC,OAAgC;QAE/C,MAAM,WAAW,GAAG,OAAO,CAAC,KAAK,CAAC;QAClC,IAAI,CAAC,WAAW;YAAE,OAAO;QACzB,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,MAAM,CAAgB,CAAC;QAChD,KAAK,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;YAC9B,OAAO,CAAC,IAAI,KAAZ,OAAO,CAAC,IAAI,GAAK,EAAE,EAAC;YAEpB,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAG7C,OAAO,CAAC,OAAO,KAAf,OAAO,CAAC,OAAO,GAAK,EAAE,EAAC;YAEvB,OAAO,CAAC,OAAO,CAAC,eAAe,GAAG,GAAG,EAAE,CAAC,WAAW,CAAC;YAEpD,OAAO,OAAO,CAAC,KAAK,CAAC;QACvB,CAAC;IACH,CAAC;IACD,SAAS,EAAE;QACT,OAAO;;YAEL,MAAM,WAAW,GAAG,MAAA,IAAI,CAAC,eAAe,oDAAI,CAAC;YAC7C,IAAI,CAAC,WAAW;gBAAE,OAAO;YACzB,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,MAAM,CAAgB,CAAC;YAEpE,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;YAEnB,KAAK,MAAM,G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vB,OAAO,CAAC,OAAO,CAAC,eAAe,GAAG,GAAG,EAAE,CAAC,WAAW,CAAC;YAEpD,OAAO,OAAO,CAAC,KAAK,CAAC;QACvB,CAAC;IACH,CAAC;IACD,SAAS,EAAE;QACT,OAAO;;YAEL,MAAM,WAAW,GAAG,MAAA,IAAI,CAAC,eAAe,oDAAI,CAAC;YAC7C,IAAI,CAAC,WAAW;gBAAE,OAAO;YACzB,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,MAAM,CAAgB,CAAC;YAEpE,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;YAEnB,KAAK,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;gBAE9B,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,QAAQ,CAC3B,WAAW,CAAC,GAAG,CAAC,EAChB,CAAC,KAAc,EAAE,EAAE;oBAEjB,IAAI,CAAC,OAAO,CAAC;wBACX,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC;qBACnB,CAAC,CAAC;gBACL,CAAC,EACD;oBACE,MAAM,EAAE,QAAQ,CAAC,UAAU;iBAC5B,CACF,CAAC;YACJ,CAAC;YACD,gBAAgB,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC;QAC5C,CAAC;QAED,QAAQ;YAEN,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;gBAChC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YACvB,CAAC;QACH,CAAC;KACF;CACF,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "annil",
3
- "version": "1.2.1",
3
+ "version": "1.3.0-dev.202312100",
4
4
  "description": "微信小程序(原生开发)插件",
5
5
  "main": "dist/index.js",
6
6
  "types": "src/index.ts",
@@ -4,7 +4,7 @@ import type { Includes } from "../../../types/includes";
4
4
  /**
5
5
  * 根据IsPage,生成name或path字段
6
6
  */
7
- export type NameOrPageOption<
7
+ export type NameOrPathOption<
8
8
  TName extends string,
9
9
  TPath extends `/${string}`,
10
10
  IsPage extends boolean,
@@ -4,18 +4,48 @@ import { BComputedAndWatch } from "../../behaviors/BComputedAndWatch";
4
4
  import { initComputed } from "../../behaviors/BComputedAndWatch/initComputed";
5
5
  import type { Instance } from "../../behaviors/BComputedAndWatch/types";
6
6
  import { BStore } from "../../behaviors/BStore";
7
+ import type { WMComponent } from "../../types/OfficialTypeAlias";
7
8
  import { INNERMARKER } from "../../utils/InnerMarker";
8
9
  import { isEmptyObject } from "../../utils/isEmptyObject";
9
10
  import type { RootComponentTrueOptions } from "../RootComponent";
11
+ import type { ComputedConstraint } from "../RootComponent/Computed/ComputedConstraint";
10
12
  import type {
11
13
  CustomEventConstraint,
12
14
  CustomEvents,
13
15
  FullCustomEvents,
14
16
  } from "../RootComponent/CustomEvents/CustomEventConstraint";
17
+ import type { DataConstraint } from "../RootComponent/Data/DataConstraint";
15
18
  import type { EventsConstraint } from "../RootComponent/Events/EventsConstraint";
16
19
  import type { PageInstance } from "../RootComponent/Instance/RootComponentInstance";
20
+ import type { LifetimesConstraint } from "../RootComponent/Lifetimes/LifetimesConstraint";
21
+ import type { MethodsConstraint } from "../RootComponent/Methods/MethodsConstraint";
22
+ import type { PageLifetimesOption } from "../RootComponent/PageLifetimes/PageLifetimesOption";
23
+ import type { StoreConstraint } from "../RootComponent/Store/StoreConstraint";
17
24
  import type { SubComponentTrueOptions } from "../SubComponent";
18
- import type { FinalOptionsOfComponent, FuncOptions } from ".";
25
+ import type { DefineComponentOption } from ".";
26
+ /**
27
+ * 临时的函数配置项
28
+ * 把根组件与子组件中配置类型为函数的相同字段配置收集在一起(数组)
29
+ */
30
+ export type FuncOptions = Record<"pageLifetimes" | "lifetimes" | "watch", Record<string, Func[]>>;
31
+
32
+ /**
33
+ * 最终传入原生Component的配置项
34
+ */
35
+ export type FinalOptionsOfComponent = {
36
+ isPage?: boolean;
37
+ options?: WMComponent.Options;
38
+ properties?: Record<string, any>;
39
+ data?: DataConstraint;
40
+ store?: StoreConstraint;
41
+ computed?: ComputedConstraint;
42
+ observers?: Record<string, Func>;
43
+ behaviors?: string[];
44
+ methods?: MethodsConstraint;
45
+ watch?: Record<string, Func>;
46
+ lifetimes?: LifetimesConstraint;
47
+ } & PageLifetimesOption<false, object>;
48
+
19
49
  /**
20
50
  * 原生Component会对传入的对象字段匹配的properties字段setData赋值。不符合字段或Page时不会赋值。
21
51
  * 此函数为给实例setData赋值,默认传递值与properties相符(ts类型安全)。
@@ -44,6 +74,27 @@ function onLoadReceivedDataHandle(
44
74
 
45
75
  this.setData(option);
46
76
  }
77
+ // 类型保护
78
+ // function isPageInstance(ins: Instance): ins is PageInstance & InstanceCustomFields {
79
+ // return (ins as PageInstance).route !== undefined;
80
+ // }
81
+ /**
82
+ * 验证path是否正确
83
+ * @param path - 配置路径
84
+ * @returns
85
+ */
86
+ // function pathCheck(path: string | undefined) {
87
+ // return function(this: Instance) {
88
+ // if (isPageInstance(this)) {
89
+ // const route = this.route;
90
+ // if (route !== path) {
91
+ // throw Error(
92
+ // `[ /${route} ] DefinedComponent的配置字段path值错误,应为: /${route}`,
93
+ // );
94
+ // }
95
+ // }
96
+ // };
97
+ // }
47
98
  /**
48
99
  * 针对通过 navigateTo传过来的数据对组件load周期传入数据解析
49
100
  * @param option - option中的url是拼接了encodeURIComponent转码的data对象的,key为INNERMARKER.url
@@ -54,8 +105,8 @@ function loadReceivedDataHandle(
54
105
  option: Record<typeof INNERMARKER.url, string>,
55
106
  ) {
56
107
  const innerData: string | undefined = option[INNERMARKER.url];
57
- // 未使用自定义的navigateTo
58
- if (innerData === undefined) return;
108
+ // 未使用自定义的navigateTo 或者在之前的load中已经被解析过了
109
+ if (innerData === undefined || innerData == INNERMARKER.url) return;
59
110
  const decodeOption = JSON.parse(decodeURIComponent(innerData));
60
111
 
61
112
  // 使用navigateTo API
@@ -83,64 +134,6 @@ function hijack(config: object, field: string, before: Func[] = [], after: Func[
83
134
  return;
84
135
  }
85
136
 
86
- /**
87
- * onLoad生命周期劫持函数
88
- */
89
- /* istanbul ignore next: miniprogram-simulate(当前版本 1.6.1) 无法测试页面 */
90
- // function onLoadHijack(
91
- // options: FinalOptionsOfComponent,
92
- // before: Func[],
93
- // after: Func[] = [],
94
- // ) {
95
- // options.methods ||= {};
96
-
97
- // const cloneOpt = deepClone(options);
98
- // const originalOnLoad: Func | undefined = options.methods.onLoad;
99
-
100
- // options.methods.onLoad = function(props: unknown) {
101
- // before.forEach((func) => {
102
- // func.call(this, props, cloneOpt);
103
- // });
104
-
105
- // originalOnLoad?.call(this, props);
106
-
107
- // after.forEach((func) => {
108
- // func.call(this, props, cloneOpt);
109
- // });
110
- // };
111
- // }
112
- /**
113
- * 劫持pageLifetimes中的load字段
114
- */
115
- /* istanbul ignore next */
116
- // function loadHijack(
117
- // options: FinalOptionsOfComponent,
118
- // before: Func[],
119
- // after: Func[] = [],
120
- // ) {
121
- // /* istanbul ignore next: miniprogram-simulate(当前版本 1.6.1) 无法测试页面 */
122
- // options.lifetimes ||= {};
123
-
124
- // const originalAttached: Func | undefined = options.lifetimes.attached;
125
-
126
- // options.lifetimes.attached = function() {
127
- // before.forEach((func) => {
128
- // func.call(this, options);
129
- // });
130
-
131
- // originalAttached?.call(this);
132
-
133
- // /* istanbul ignore next */
134
- // after.forEach((func) => {
135
- // func.call(this, options);
136
- // });
137
- // };
138
- // }
139
- /**
140
- * 内部保护字段 即不允许配置的字段名(所有方法下)
141
- */
142
- // const INNERFIELDS = ["disposer"];
143
-
144
137
  /**
145
138
  * 报错的形式避免输入字段和内部字段冲突,保证config下不包含内部预定字段(列表)
146
139
  */
@@ -277,49 +270,6 @@ function customEventsHandle(
277
270
  }
278
271
  }
279
272
  }
280
- /**
281
- * 触发各个组件的页面load事件
282
- */
283
- /* istanbul ignore next */
284
- // function triggerCompLoad(this: Instance, props: object) {
285
- // if (!this.__compLoadList__) return;
286
- // this.__compLoadList__.forEach((loadFunc) => {
287
- // loadFunc(props);
288
- // });
289
- // }
290
- /* istanbul ignore next */
291
- // function getPageInstance(pageId: string): Instance {
292
- // const pagestack = getCurrentPages() as unknown as Instance[];
293
- // let pageInstance: Instance;
294
- // pagestack.some((instance) => {
295
- // if (instance.getPageId() === pageId) {
296
- // pageInstance = instance;
297
-
298
- // return true;
299
- // }
300
-
301
- // return false;
302
- // });
303
-
304
- // // @ts-ignore pagestack中一定赋值了
305
- // return pageInstance;
306
- // }
307
- /**
308
- * 收集组件pageLifetimes下的load周期函数到页面实例的__loadFunList__
309
- */
310
- /* istanbul ignore next */
311
- // function collectLoadLifetimesOfComponent(this: Instance, finalOptionsForComponent: FinalOptionsOfComponent) {
312
- // const loadFunc = finalOptionsForComponent.pageLifetimes?.load;
313
-
314
- // console.log(loadFunc, finalOptionsForComponent);
315
-
316
- // if (!loadFunc) return;
317
-
318
- // const pageInstance = getPageInstance(this.getPageId());
319
- // const __compLoadList__: Function[] = (pageInstance.__compLoadList__ ||= []);
320
-
321
- // __compLoadList__.push(loadFunc.bind(this));
322
- // }
323
273
  /**
324
274
  * 收集 rootComponentOptions 配置到 finalOptions 和 funcOptions 中
325
275
  * @param finalOptions - 收集配置对象
@@ -343,6 +293,7 @@ function collectRootComponentOption(
343
293
 
344
294
  otherFieldsHandle(finalOptions, rootComponentOptions);
345
295
  }
296
+
346
297
  /**
347
298
  * 返回一个由rootComponentOption和subComponentsList配置整合的对象
348
299
  * @param rootComponentOption -
@@ -350,9 +301,10 @@ function collectRootComponentOption(
350
301
  * @returns FinalOptionsForComponent
351
302
  */
352
303
  export function collectOptionsForComponent(
353
- rootComponentOption: RootComponentTrueOptions | undefined,
354
- subComponentsList: SubComponentTrueOptions[] | undefined,
304
+ defineComponentOption: DefineComponentOption,
355
305
  ): FinalOptionsOfComponent {
306
+ const rootComponentOption = defineComponentOption.rootComponent;
307
+ const subComponentsList = defineComponentOption.subComponents;
356
308
  const finalOptionsForComponent: FinalOptionsOfComponent = {
357
309
  // default options
358
310
  options: {
@@ -394,6 +346,8 @@ export function collectOptionsForComponent(
394
346
  finalOptionsForComponent.pageLifetimes?.load
395
347
  && hijack(finalOptionsForComponent.pageLifetimes, "load", [loadReceivedDataHandle], []);
396
348
 
349
+ // hijack(finalOptionsForComponent.lifetimes!, "attached", [pathCheck(defineComponentOption.path)], []);
350
+
397
351
  /* istanbul ignore next: miniprogram-simulate(当前版本 1.6.1) 无法测试页面 */
398
352
  if (finalOptionsForComponent.isPage) {
399
353
  // 页面时删除预设的虚拟组件字段
@@ -1,22 +1,14 @@
1
1
  import type { IfExtends } from "hry-types/src/Any/IfExtends";
2
- import type { Func } from "hry-types/src/Misc/Func";
3
- import type { WMComponent } from "../../types/OfficialTypeAlias";
4
2
 
5
- import type { LifetimesConstraint } from "../RootComponent/Lifetimes/LifetimesConstraint";
6
3
  import type { RootComponentDoc } from "../RootComponent/RootComponentDoc";
7
4
  import type { SubComponentDoc } from "../SubComponent/SubComponentDoc";
8
- import type { NameOrPageOption as NameOrPathOption } from "./NameOrPage/NameOrPathOption";
5
+ import type { NameOrPathOption } from "./NameOrPage/NameOrPathOption";
9
6
  import type { CreateComponentDoc } from "./ReturnType/CreateComponentDoc";
10
7
  import type { CreatePageDoc } from "./ReturnType/CreatePageDoc";
11
8
  import type { RootComponentOption } from "./RootComponent/RootComponentOption";
12
9
  import type { SubComponentsOption } from "./SubComponents/SubComponentsOption";
13
10
 
14
11
  import type { RootComponentTrueOptions } from "../RootComponent";
15
- import type { ComputedConstraint } from "../RootComponent/Computed/ComputedConstraint";
16
- import type { DataConstraint } from "../RootComponent/Data/DataConstraint";
17
- import type { MethodsConstraint } from "../RootComponent/Methods/MethodsConstraint";
18
- import type { PageLifetimesOption } from "../RootComponent/PageLifetimes/PageLifetimesOption";
19
- import type { StoreConstraint } from "../RootComponent/Store/StoreConstraint";
20
12
  import { collectOptionsForComponent } from "./collectOptionsForComponent";
21
13
 
22
14
  type Path = `/${string}`;
@@ -50,28 +42,12 @@ interface DefineComponentConstructor {
50
42
  >;
51
43
  }
52
44
 
53
- /**
54
- * 临时的函数配置项
55
- * 把根组件与子组件中配置类型为函数的相同字段配置收集在一起(数组)
56
- */
57
- export type FuncOptions = Record<"pageLifetimes" | "lifetimes" | "watch", Record<string, Func[]>>;
58
-
59
- /**
60
- * 最终传入原生Component的配置项
61
- */
62
- export type FinalOptionsOfComponent = {
63
- isPage?: boolean;
64
- options?: WMComponent.Options;
65
- properties?: Record<string, any>;
66
- data?: DataConstraint;
67
- store?: StoreConstraint;
68
- computed?: ComputedConstraint;
69
- observers?: Record<string, Func>;
70
- behaviors?: string[];
71
- methods?: MethodsConstraint;
72
- watch?: Record<string, Func>;
73
- lifetimes?: LifetimesConstraint;
74
- } & PageLifetimesOption<false, object>;
45
+ export type DefineComponentOption = {
46
+ name?: string;
47
+ path?: string;
48
+ rootComponent?: RootComponentTrueOptions;
49
+ subComponents?: SubComponentDoc[];
50
+ };
75
51
 
76
52
  /**
77
53
  * 把根组件选项和子组件选项转化为原生Component API选项并执行
@@ -79,6 +55,6 @@ export type FinalOptionsOfComponent = {
79
55
  export const DefineComponent: DefineComponentConstructor = function(options): any {
80
56
  // console.log("---------------------------");
81
57
  Component(
82
- collectOptionsForComponent(options.rootComponent as RootComponentTrueOptions, options.subComponents),
58
+ collectOptionsForComponent(options as DefineComponentOption),
83
59
  );
84
60
  };
@@ -1,6 +1,6 @@
1
1
  import type { DetailedType } from "../../../types/DetailedType";
2
2
 
3
- type SimpleCustomeEvents = DetailedType | null;
3
+ type SimpleCustomeEvents = DetailedType | null | undefined;
4
4
 
5
5
  export type SimpleCustomeEventsList = SimpleCustomeEvents[];
6
6
 
@@ -10,6 +10,7 @@ import type { AddTagForCustomEventsDoc } from "./CustomEventsTag";
10
10
 
11
11
  export type GetShortCustomEventsDoc<T extends ShortCustomeEvents> = T extends DetailedType ? InferDetailedType<T>
12
12
  : T extends null ? null
13
+ : T extends undefined ? undefined
13
14
  : T extends SimpleCustomeEventsList ? GetShortCustomEventsDoc<T[number]>
14
15
  : never;
15
16
 
@@ -17,6 +17,7 @@ type Mock_CustomEventsDoc = GetCustomEventDoc<typeof mock_customEvents>;
17
17
  export type Mock_CustomEventsDocExpected = {
18
18
  str: StrExpected;
19
19
  null: NullExpected;
20
+ nothing: undefined;
20
21
  unionStr: UnionStrExpected;
21
22
  union: ListExpected;
22
23
  bubbles: bubblesExpected;
@@ -15,6 +15,7 @@ import type {
15
15
  */
16
16
  export const mock_shortCustomEvents = {
17
17
  str: String,
18
+ nothing: undefined,
18
19
  null: null,
19
20
  unionStr: String as DetailedType<"male" | "female">,
20
21
  union: [String, Number as DetailedType<0 | 1 | 2>, null],
@@ -64,6 +65,7 @@ type RootDoc = {
64
65
  // 简写字段 值类型为事件参数e的detail类型
65
66
  str: string;
66
67
  null: null;
68
+ nothing: undefined;
67
69
  unionStr: "male" | "female";
68
70
  union: string | 0 | 1 | 2 | null;
69
71
  // 带options字段 通过联合类型加入。
@@ -3,8 +3,8 @@ import type { CustomEventsTags } from "../CustomEvents/CustomEventsTag";
3
3
 
4
4
  export type CustomEventMethods<O extends object> = {
5
5
  [k in keyof O]: IfExtends<
6
- Exclude<O[k], CustomEventsTags> & {},
7
- never,
6
+ Exclude<O[k], CustomEventsTags>,
7
+ undefined,
8
8
  () => void,
9
9
  (detail: Exclude<O[k], CustomEventsTags>) => void
10
10
  >;
@@ -7,6 +7,7 @@ RootComponent()({
7
7
  num: Number as DetailedType<1 | 2>,
8
8
  union: [String as DetailedType<"male" | "femal">, Number],
9
9
  null: null,
10
+ undefined: undefined,
10
11
  bubbles: {
11
12
  detail: String,
12
13
  options: {
@@ -50,7 +51,9 @@ RootComponent()({
50
51
 
51
52
  Checking<(detail: "male" | "femal" | number) => void, typeof this.union, Test.Pass>;
52
53
 
53
- Checking<() => void, typeof this.null, Test.Pass>;
54
+ Checking<(detail: null) => void, typeof this.null, Test.Pass>;
55
+
56
+ Checking<() => void, typeof this.undefined, Test.Pass>;
54
57
 
55
58
  Checking<(detail: string) => void, typeof this.str, Test.Pass>;
56
59
 
@@ -60,7 +63,7 @@ RootComponent()({
60
63
 
61
64
  Checking<(detail: number) => void, typeof this.capturePhaseComposed, Test.Pass>;
62
65
 
63
- Checking<() => void, typeof this.bubblesCapturePhaseComposed, Test.Pass>;
66
+ Checking<(detail: null) => void, typeof this.bubblesCapturePhaseComposed, Test.Pass>;
64
67
  },
65
68
  },
66
69
  });
@@ -8,6 +8,7 @@ RootComponent()({
8
8
  num: Number as DetailedType<1 | 2>,
9
9
  union: [String as DetailedType<"male" | "femal">, Number],
10
10
  null: null,
11
+ undefined: undefined,
11
12
  bubbles: {
12
13
  detail: String,
13
14
  options: {
@@ -51,7 +52,9 @@ RootComponent()({
51
52
 
52
53
  Checking<(detail: "male" | "femal" | number) => void, typeof this.union, Test.Pass>;
53
54
 
54
- Checking<() => void, typeof this.null, Test.Pass>;
55
+ Checking<(detail: null) => void, typeof this.null, Test.Pass>;
56
+
57
+ Checking<() => void, typeof this.undefined, Test.Pass>;
55
58
 
56
59
  Checking<(detail: string) => void, typeof this.str, Test.Pass>;
57
60
 
@@ -61,7 +64,7 @@ RootComponent()({
61
64
 
62
65
  Checking<(detail: number) => void, typeof this.capturePhaseComposed, Test.Pass>;
63
66
 
64
- Checking<() => void, typeof this.bubblesCapturePhaseComposed, Test.Pass>;
67
+ Checking<(detail: null) => void, typeof this.bubblesCapturePhaseComposed, Test.Pass>;
65
68
  },
66
69
  },
67
70
  });
@@ -1,6 +1,6 @@
1
1
  import type { ComputeIntersection } from "hry-types/src/Object/ComputeIntersection";
2
2
  import type { WMCompLifetimes } from "../../../types/OfficialTypeAlias";
3
- import type { FinalOptionsOfComponent } from "../../DefineComponent";
3
+ import type { FinalOptionsOfComponent } from "../../DefineComponent/collectOptionsForComponent";
4
4
 
5
5
  export type LifetimesConstraint = // 官方组件生命周期
6
6
  ComputeIntersection<
@@ -16,7 +16,8 @@ export function computedUpdater(this: Instance, isUpdated = false): boolean {
16
16
  const itemCache = this.__computedCache__[key];
17
17
  let changed = false;
18
18
  for (const dep of itemCache.dependences) {
19
- const curVal = getPathsValue.call(this, dep.paths);
19
+ // getPathsValue返回的是数组
20
+ const curVal = getPathsValue.call(this, dep.paths.join("."))[0];
20
21
 
21
22
  // 检查依赖是否更新
22
23
  if (!isEqual(curVal, dep.val)) {
@@ -1,12 +1,28 @@
1
1
  import type { Instance } from "./types";
2
2
 
3
- export function getPathsValue(this: Instance, paths: string[]) {
4
- return paths.reduce((pre: any, path) => {
5
- // pre有可能为undefined|null,比如paths(['computedUser','name'])的首路径为还未初始化的计算属性(undefined),还有可能是properties的对象类型(默认为null)
6
- try {
7
- return pre[path];
8
- } catch (error) {
9
- return undefined;
10
- }
11
- }, this.data);
3
+ /**
4
+ * 获取指定paths的值
5
+ * @param this - 组件实例 Instance
6
+ * @param paths - 支持多字段(用`,`分开) 例如 'obj.xxx,a,b' 监控了3个字段
7
+ * @returns unknown[] 每项对应paths每项的值
8
+ */
9
+ export function getPathsValue(this: Instance, paths: string) {
10
+ const valueList: unknown[] = [];
11
+
12
+ // ['obj.xxx','a','b'].forEach
13
+ paths.split(",").forEach(path => {
14
+ // path : 'obj.xxx' | 'a' | 'b'
15
+ const value = path.split(".").reduce((pre: any, path) => {
16
+ // pre有可能为undefined|null,比如obj是未初始化的计算属性(undefined),还有可能是properties的对象类型(默认为null)
17
+ try {
18
+ return pre[path];
19
+ } catch (error) {
20
+ return undefined;
21
+ }
22
+ }, this.data);
23
+
24
+ valueList.push(value);
25
+ });
26
+
27
+ return valueList;
12
28
  }
@@ -1,5 +1,6 @@
1
1
  import type { Func } from "hry-types/src/Misc/Func";
2
- import type { FinalOptionsOfComponent } from "../../api/DefineComponent";
2
+
3
+ import type { FinalOptionsOfComponent } from "../../api/DefineComponent/collectOptionsForComponent";
3
4
  import { deepClone } from "../../utils/deepClone";
4
5
  import { deleteProtoField } from "../../utils/deleteProtoField";
5
6
  import { isEmptyObject } from "../../utils/isEmptyObject";
@@ -11,7 +12,7 @@ import type { Instance, WatchOldValue } from "./types";
11
12
  function initWatchOldValue(this: Instance, watchConfig: object): WatchOldValue {
12
13
  const watchOldValue = {};
13
14
  for (const key in watchConfig) {
14
- watchOldValue[key] = deepClone(getPathsValue.call(this, key.split(".")));
15
+ watchOldValue[key] = deepClone(getPathsValue.call(this, key));
15
16
  }
16
17
 
17
18
  return watchOldValue;
@@ -99,14 +100,14 @@ export const BComputedAndWatch = Behavior({
99
100
  for (const key in watchConfig) {
100
101
  const watchHadle = watchConfig[key];
101
102
 
102
- observersConfig[key] = function(this: Instance, newValue: unknown) {
103
+ // 在监控多个数据时,参数是多个值
104
+ observersConfig[key] = function(this: Instance, ...newValue: unknown[]) {
103
105
  const watchOldValue = this.__watchOldValue__!;
104
106
  const oldValue = watchOldValue[key];
105
- // 当watch对象的子属性时,有可能对象为null(properties默认值)
106
- if ((newValue === undefined) || isEqual(newValue, oldValue)) return;
107
+ if (isEqual(newValue, oldValue)) return;
107
108
  watchOldValue[key] = deepClone(newValue);
108
109
 
109
- watchHadle.call(this, newValue, oldValue);
110
+ watchHadle.call(this, ...newValue, ...oldValue);
110
111
  };
111
112
  }
112
113
  }
@@ -26,4 +26,4 @@ export type ComputedCache = Record<
26
26
  }
27
27
  >;
28
28
 
29
- export type WatchOldValue = Record<string, unknown>;
29
+ export type WatchOldValue = Record<string, unknown[]>;
@@ -1,5 +1,6 @@
1
1
  import type mobx from "mobx";
2
- import type { FinalOptionsOfComponent } from "../api/DefineComponent";
2
+
3
+ import type { FinalOptionsOfComponent } from "../api/DefineComponent/collectOptionsForComponent";
3
4
  import { deleteProtoField } from "../utils/deleteProtoField";
4
5
  import type { Instance } from "./BComputedAndWatch/types";
5
6
 
@@ -1,4 +1,4 @@
1
- import type { FinalOptionsOfComponent } from "../api/DefineComponent";
1
+ import type { FinalOptionsOfComponent } from "../api/DefineComponent/collectOptionsForComponent";
2
2
 
3
3
  export const BBeforeCreate = Behavior({
4
4
  definitionFilter(options: FinalOptionsOfComponent) {