annil 1.12.0-alpha.6 → 1.12.0-alpha.7
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 +9 -0
- package/dist/api/DefineComponent/ReturnType/CreateComponentDoc.d.ts +1 -2
- package/dist/api/DefineComponent/index.js.map +1 -1
- package/dist/api/DefineComponent/normalizeOptions/handleRootComponent.d.ts +3 -0
- package/dist/api/DefineComponent/normalizeOptions/handleRootComponent.js +19 -0
- package/dist/api/DefineComponent/normalizeOptions/handleRootComponent.js.map +1 -0
- package/dist/api/DefineComponent/normalizeOptions/handleStore/initStore.js +1 -2
- package/dist/api/DefineComponent/normalizeOptions/handleStore/initStore.js.map +1 -1
- package/dist/api/DefineComponent/normalizeOptions/handleSubComponents.d.ts +3 -0
- package/dist/api/DefineComponent/normalizeOptions/handleSubComponents.js +15 -0
- package/dist/api/DefineComponent/normalizeOptions/handleSubComponents.js.map +1 -0
- package/dist/api/DefineComponent/normalizeOptions/hijackHandle/addDetachedData.d.ts +2 -0
- package/dist/api/DefineComponent/normalizeOptions/hijackHandle/addDetachedData.js +10 -0
- package/dist/api/DefineComponent/normalizeOptions/hijackHandle/addDetachedData.js.map +1 -0
- package/dist/api/DefineComponent/normalizeOptions/hijackHandle/hijack.d.ts +3 -0
- package/dist/api/DefineComponent/normalizeOptions/hijackHandle/hijack.js +11 -0
- package/dist/api/DefineComponent/normalizeOptions/hijackHandle/hijack.js.map +1 -0
- package/dist/api/DefineComponent/normalizeOptions/hijackHandle/index.d.ts +1 -2
- package/dist/api/DefineComponent/normalizeOptions/hijackHandle/index.js +25 -8
- package/dist/api/DefineComponent/normalizeOptions/hijackHandle/index.js.map +1 -1
- package/dist/api/DefineComponent/normalizeOptions/index.d.ts +2 -5
- package/dist/api/DefineComponent/normalizeOptions/index.js +15 -47
- package/dist/api/DefineComponent/normalizeOptions/index.js.map +1 -1
- package/dist/api/DefineComponent/normalizeOptions/initComputed/computedUpdater.js +2 -0
- package/dist/api/DefineComponent/normalizeOptions/initComputed/computedUpdater.js.map +1 -1
- package/dist/api/DefineComponent/normalizeOptions/initComputed/index.d.ts +1 -1
- package/dist/api/DefineComponent/normalizeOptions/initComputed/index.js +2 -4
- package/dist/api/DefineComponent/normalizeOptions/initComputed/index.js.map +1 -1
- package/dist/api/DefineComponent/normalizeOptions/internalFieldProtection.js +1 -1
- package/dist/api/DefineComponent/normalizeOptions/internalFieldProtection.js.map +1 -1
- package/dist/api/DefineComponent/normalizeOptions/otherFieldsHandle.js +1 -0
- package/dist/api/DefineComponent/normalizeOptions/otherFieldsHandle.js.map +1 -1
- package/dist/api/DefineComponent/normalizeOptions/watchHandler/index.js +2 -2
- package/dist/api/DefineComponent/normalizeOptions/watchHandler/index.js.map +1 -1
- package/dist/api/RootComponent/Instance/RootComponentInstance.d.ts +1 -1
- package/package.json +1 -1
- package/src/api/DefineComponent/ReturnType/CreateComponentDoc.ts +1 -4
- package/src/api/DefineComponent/ReturnType/test/normalComponentDoc.test.ts +2 -2
- package/src/api/DefineComponent/index.ts +0 -2
- package/src/api/DefineComponent/normalizeOptions/handleRootComponent.ts +32 -0
- package/src/api/DefineComponent/normalizeOptions/handleStore/initStore.ts +1 -3
- package/src/api/DefineComponent/normalizeOptions/handleSubComponents.ts +23 -0
- package/src/api/DefineComponent/normalizeOptions/hijackHandle/addDetachedData.ts +12 -0
- package/src/api/DefineComponent/normalizeOptions/hijackHandle/hijack.ts +26 -0
- package/src/api/DefineComponent/normalizeOptions/hijackHandle/index.ts +40 -20
- package/src/api/DefineComponent/normalizeOptions/index.ts +25 -80
- package/src/api/DefineComponent/normalizeOptions/initComputed/computedUpdater.ts +1 -0
- package/src/api/DefineComponent/normalizeOptions/initComputed/index.ts +3 -6
- package/src/api/DefineComponent/normalizeOptions/internalFieldProtection.ts +1 -1
- package/src/api/DefineComponent/normalizeOptions/otherFieldsHandle.ts +1 -0
- package/src/api/DefineComponent/normalizeOptions/watchHandler/index.ts +4 -6
- package/src/api/RootComponent/Instance/RootComponentInstance.ts +1 -1
- package/dist/api/DefineComponent/normalizeOptions/rootComponentOptionHandle.d.ts +0 -3
- package/dist/api/DefineComponent/normalizeOptions/rootComponentOptionHandle.js +0 -14
- package/dist/api/DefineComponent/normalizeOptions/rootComponentOptionHandle.js.map +0 -1
- package/dist/api/DefineComponent/normalizeOptions/subComponentsOptionHandle.d.ts +0 -3
- package/dist/api/DefineComponent/normalizeOptions/subComponentsOptionHandle.js +0 -11
- package/dist/api/DefineComponent/normalizeOptions/subComponentsOptionHandle.js.map +0 -1
- package/dist/types/AddNullForObject.d.ts +0 -2
- package/dist/types/AddNullForObject.js +0 -2
- package/dist/types/AddNullForObject.js.map +0 -1
- package/src/api/DefineComponent/normalizeOptions/rootComponentOptionHandle.ts +0 -26
- package/src/api/DefineComponent/normalizeOptions/slotComponentsOptionHandle.ts +0 -22
- package/src/api/DefineComponent/normalizeOptions/subComponentsOptionHandle.ts +0 -18
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|
* 解决DetailedType不接收接口类型的错误 ([ae8acbf](https://github.com/missannil/annil/commit/ae8acbfc2e62f99db565c448ad9253aa549e78bb))
|
|
6
6
|
|
|
7
|
+
## [1.12.0-alpha.7](https://github.com/missannil/annil/compare/v1.12.0-alpha.6...v1.12.0-alpha.7) (2025-04-12)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* 去除DefineComponent中针对对象类型加入null ([#241](https://github.com/missannil/annil/issues/241)) ([091485e](https://github.com/missannil/annil/commit/091485e7327c3c94600d61c679e056df845f6222))
|
|
13
|
+
* 在attached周期结束后,如果实例的data字段没有attached字段,则加入attached:true,用于表明组件启动完毕. ([091485e](https://github.com/missannil/annil/commit/091485e7327c3c94600d61c679e056df845f6222))
|
|
14
|
+
* 计算属性初始化在attached周期,之前可能在attach周期会引发计算属性传值时,出现null导致错误的问题 ([091485e](https://github.com/missannil/annil/commit/091485e7327c3c94600d61c679e056df845f6222))
|
|
15
|
+
|
|
7
16
|
## [1.12.0-alpha.6](https://github.com/missannil/annil/compare/v1.12.0-alpha.5...v1.12.0-alpha.6) (2025-04-09)
|
|
8
17
|
|
|
9
18
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { IfExtends } from "hry-types/src/Any/IfExtends";
|
|
2
2
|
import type { ComputeIntersection } from "hry-types/src/Object/ComputeIntersection";
|
|
3
|
-
import type { AddNullForObject } from "../../../types/AddNullForObject";
|
|
4
3
|
import type { CustomComponentType } from "../../CustomComponent/CustomComponentType";
|
|
5
4
|
import type { RootComponentType } from "../../RootComponent/RootComponentType";
|
|
6
5
|
import type { GetCustomEventDocOfSubDoc } from "./GetCustomEventDocOfSubDoc";
|
|
@@ -9,7 +8,7 @@ type GetStopKeys<O> = {
|
|
|
9
8
|
}[keyof O];
|
|
10
9
|
export type CreateComponentDoc<TRootDoc extends RootComponentType, TName extends string, TSubComponentTuple extends CustomComponentType[], AllPropertiesDoc extends unknown | object = TRootDoc["properties"], AllCustomEventsDoc extends unknown | object = TRootDoc["customEvents"] & GetCustomEventDocOfSubDoc<TSubComponentTuple[number]>, StopKeys extends string = GetStopKeys<TRootDoc["events"]>, FinalCustomEventDoc extends object = Omit<AllCustomEventsDoc, StopKeys>> = ComputeIntersection<IfExtends<unknown, AllPropertiesDoc, {}, {
|
|
11
10
|
properties: {
|
|
12
|
-
[k in keyof AllPropertiesDoc as `${TName}_${k & string}`]:
|
|
11
|
+
[k in keyof AllPropertiesDoc as `${TName}_${k & string}`]: AllPropertiesDoc[k];
|
|
13
12
|
};
|
|
14
13
|
}> & IfExtends<{}, FinalCustomEventDoc, {}, {
|
|
15
14
|
customEvents: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/DefineComponent/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/DefineComponent/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AA6CtD,MAAM,CAAC,MAAM,eAAe,GAA+B,UAAS,OAAO;IACzE,SAAS,CAEP,gBAAgB,CAAC,OAAgC,CAAQ,CAC1D,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { RootComponentTrueOptions } from "../../RootComponent";
|
|
2
|
+
import type { FinalOptionsOfComponent, SameFuncOptions } from ".";
|
|
3
|
+
export declare function handleRootComponent(finalOptions: FinalOptionsOfComponent, rootComponent: RootComponentTrueOptions | undefined, funcOptions: SameFuncOptions): void;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { isEmptyObject } from "../../../utils/isEmptyObject";
|
|
2
|
+
import { __throttleDebounce__FieldCheck } from "./__throttleDebounce__FieldCheck";
|
|
3
|
+
import { customEventsHandle } from "./customEventsHandle";
|
|
4
|
+
import { otherFieldsHandle } from "./otherFieldsHandle";
|
|
5
|
+
import { sameFuncFieldsCollect } from "./sameFuncFieldsCollect";
|
|
6
|
+
export function handleRootComponent(finalOptions, rootComponent, funcOptions) {
|
|
7
|
+
if (rootComponent && !isEmptyObject(rootComponent)) {
|
|
8
|
+
__throttleDebounce__FieldCheck(rootComponent);
|
|
9
|
+
if (rootComponent.customEvents)
|
|
10
|
+
customEventsHandle(finalOptions, rootComponent.customEvents);
|
|
11
|
+
delete rootComponent.customEvents;
|
|
12
|
+
if (rootComponent.events)
|
|
13
|
+
Object.assign(finalOptions.methods, rootComponent.events);
|
|
14
|
+
delete rootComponent.events;
|
|
15
|
+
sameFuncFieldsCollect(rootComponent, funcOptions);
|
|
16
|
+
otherFieldsHandle(finalOptions, rootComponent);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=handleRootComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleRootComponent.js","sourceRoot":"","sources":["../../../../src/api/DefineComponent/normalizeOptions/handleRootComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAG7D,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAQhE,MAAM,UAAU,mBAAmB,CACjC,YAAqC,EACrC,aAAmD,EACnD,WAA4B;IAE5B,IAAI,aAAa,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,EAAE,CAAC;QAEnD,8BAA8B,CAAC,aAAa,CAAC,CAAC;QAE9C,IAAI,aAAa,CAAC,YAAY;YAAE,kBAAkB,CAAC,YAAY,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;QAC7F,OAAO,aAAa,CAAC,YAAY,CAAC;QAClC,IAAI,aAAa,CAAC,MAAM;YAAE,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;QACpF,OAAO,aAAa,CAAC,MAAM,CAAC;QAC5B,qBAAqB,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC;QAElD,iBAAiB,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC;IACjD,CAAC;AACH,CAAC"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { reactionRegister } from "./reactionRegister";
|
|
2
2
|
export function initStore(storeConfig) {
|
|
3
3
|
return function () {
|
|
4
|
-
if (!storeConfig
|
|
4
|
+
if (!storeConfig)
|
|
5
5
|
return;
|
|
6
|
-
this.data.__storeInited__ = true;
|
|
7
6
|
reactionRegister.call(this, storeConfig);
|
|
8
7
|
};
|
|
9
8
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initStore.js","sourceRoot":"","sources":["../../../../../src/api/DefineComponent/normalizeOptions/handleStore/initStore.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,MAAM,UAAU,SAAS,CAAC,WAAyD;IACjF,OAAO;QACL,IAAI,CAAC,WAAW
|
|
1
|
+
{"version":3,"file":"initStore.js","sourceRoot":"","sources":["../../../../../src/api/DefineComponent/normalizeOptions/handleStore/initStore.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,MAAM,UAAU,SAAS,CAAC,WAAyD;IACjF,OAAO;QACL,IAAI,CAAC,WAAW;YAAE,OAAO;QACzB,gBAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IAC3C,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { CustomComponentTrueOptions } from "../../CustomComponent";
|
|
2
|
+
import type { FinalOptionsOfComponent, SameFuncOptions } from ".";
|
|
3
|
+
export declare function handleSubComponents(componentOptions: FinalOptionsOfComponent, subComponents: CustomComponentTrueOptions[] | undefined, funcOptions: SameFuncOptions): void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { __throttleDebounce__FieldCheck } from "./__throttleDebounce__FieldCheck";
|
|
2
|
+
import { otherFieldsHandle } from "./otherFieldsHandle";
|
|
3
|
+
import { sameFuncFieldsCollect } from "./sameFuncFieldsCollect";
|
|
4
|
+
export function handleSubComponents(componentOptions, subComponents, funcOptions) {
|
|
5
|
+
if (subComponents && subComponents.length !== 0) {
|
|
6
|
+
__throttleDebounce__FieldCheck(subComponents);
|
|
7
|
+
subComponents.forEach((subOption) => {
|
|
8
|
+
if (subOption.events)
|
|
9
|
+
Object.assign(componentOptions.methods, subOption.events);
|
|
10
|
+
sameFuncFieldsCollect(subOption, funcOptions);
|
|
11
|
+
otherFieldsHandle(componentOptions, subOption);
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=handleSubComponents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleSubComponents.js","sourceRoot":"","sources":["../../../../src/api/DefineComponent/normalizeOptions/handleSubComponents.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,MAAM,UAAU,mBAAmB,CACjC,gBAAyC,EACzC,aAAuD,EACvD,WAA4B;IAE5B,IAAI,aAAa,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAEhD,8BAA8B,CAAC,aAAa,CAAC,CAAC;QAC9C,aAAa,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE;YAClC,IAAI,SAAS,CAAC,MAAM;gBAAE,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;YAEhF,qBAAqB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;YAE9C,iBAAiB,CAAC,gBAAgB,EAAE,SAAS,CAAC,CAAC;QACjD,CAAC,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export function addDetachedData() {
|
|
2
|
+
if (this.data.attached !== undefined)
|
|
3
|
+
return;
|
|
4
|
+
this.data.__notUpdateComputed__ = true;
|
|
5
|
+
this.setData({
|
|
6
|
+
attached: true,
|
|
7
|
+
});
|
|
8
|
+
this.data.__notUpdateComputed__ = false;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=addDetachedData.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addDetachedData.js","sourceRoot":"","sources":["../../../../../src/api/DefineComponent/normalizeOptions/hijackHandle/addDetachedData.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,eAAe;IAE7B,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,KAAK,SAAS;QAAE,OAAO;IAC7C,IAAI,CAAC,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC;IACvC,IAAI,CAAC,OAAO,CAAC;QAEX,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC;IACH,IAAI,CAAC,IAAI,CAAC,qBAAqB,GAAG,KAAK,CAAC;AAC1C,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export function hijack(config, field, before, after = []) {
|
|
2
|
+
const originalFunc = config[field];
|
|
3
|
+
config[field] = function (...args) {
|
|
4
|
+
before.forEach(func => func.call(this, ...args));
|
|
5
|
+
if (originalFunc)
|
|
6
|
+
originalFunc.apply(this, args);
|
|
7
|
+
after.forEach(func => func.call(this, ...args));
|
|
8
|
+
};
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=hijack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hijack.js","sourceRoot":"","sources":["../../../../../src/api/DefineComponent/normalizeOptions/hijackHandle/hijack.ts"],"names":[],"mappings":"AAMA,MAAM,UAAU,MAAM,CACpB,MAAS,EACT,KAAc,EACd,MAAc,EACd,QAAgB,EAAE;IAGlB,MAAM,YAAY,GAAqB,MAAM,CAAC,KAAK,CAAC,CAAC;IAGrD,MAAM,CAAC,KAAK,CAAC,GAAG,UAAS,GAAG,IAAe;QACzC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC;QAEjD,IAAI,YAAY;YAAE,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAEjD,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC;IAClD,CAAC,CAAC;IAEF,OAAO;AACT,CAAC"}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import type { Func } from "hry-types/src/Misc/Func";
|
|
2
1
|
import type { FinalOptionsOfComponent } from "..";
|
|
3
|
-
export declare function
|
|
2
|
+
export declare function hijackHandle(finalOptionsForComponent: FinalOptionsOfComponent, isPage: boolean | undefined, path: string | undefined): void;
|
|
@@ -1,10 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { disposeStore } from "../handleStore/disposeStore";
|
|
2
|
+
import { initStore } from "../handleStore/initStore";
|
|
3
|
+
import { initComputed } from "../initComputed";
|
|
4
|
+
import { computedUpdater } from "../initComputed/computedUpdater";
|
|
5
|
+
import { addDetachedData } from "./addDetachedData";
|
|
6
|
+
import { hijack } from "./hijack";
|
|
7
|
+
import { isPageCheck } from "./isPageCheck";
|
|
8
|
+
import { loadReceivedDataHandle } from "./loadReceivedDataHandle";
|
|
9
|
+
import { onLoadReceivedDataHandle } from "./onLoadReceivedDataHandle";
|
|
10
|
+
import { pagePathCheck } from "./pagePathCheck";
|
|
11
|
+
export function hijackHandle(finalOptionsForComponent, isPage, path) {
|
|
12
|
+
if (finalOptionsForComponent.isPage) {
|
|
13
|
+
hijack(finalOptionsForComponent.pageLifetimes, "load", [loadReceivedDataHandle]);
|
|
14
|
+
}
|
|
15
|
+
hijack(finalOptionsForComponent.methods, "onLoad", [onLoadReceivedDataHandle]);
|
|
16
|
+
hijack(finalOptionsForComponent.observers, "**", [
|
|
17
|
+
computedUpdater,
|
|
18
|
+
]);
|
|
19
|
+
hijack(finalOptionsForComponent.lifetimes, "attached", [
|
|
20
|
+
isPageCheck(isPage),
|
|
21
|
+
pagePathCheck(path),
|
|
22
|
+
initStore(finalOptionsForComponent.store),
|
|
23
|
+
initComputed(finalOptionsForComponent.computed, finalOptionsForComponent.watch),
|
|
24
|
+
], [addDetachedData]);
|
|
25
|
+
hijack(finalOptionsForComponent.lifetimes, "detached", [disposeStore]);
|
|
9
26
|
}
|
|
10
27
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/api/DefineComponent/normalizeOptions/hijackHandle/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/api/DefineComponent/normalizeOptions/hijackHandle/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,MAAM,UAAU,YAAY,CAC1B,wBAAiD,EACjD,MAA2B,EAC3B,IAAwB;IAGxB,IAAI,wBAAwB,CAAC,MAAM,EAAE,CAAC;QACpC,MAAM,CAAC,wBAAwB,CAAC,aAAa,EAAE,MAAM,EAAE,CAAC,sBAAsB,CAAC,CAAC,CAAC;IACnF,CAAC;IAED,MAAM,CAAC,wBAAwB,CAAC,OAAO,EAAE,QAAQ,EAAE,CAAC,wBAAwB,CAAC,CAAC,CAAC;IAC/E,MAAM,CAAC,wBAAwB,CAAC,SAAS,EAAE,IAAI,EAAE;QAC/C,eAAe;KAChB,CAAC,CAAC;IAEH,MAAM,CACJ,wBAAwB,CAAC,SAAS,EAClC,UAAU,EACV;QAEE,WAAW,CAAC,MAAM,CAAC;QAEnB,aAAa,CAAC,IAAI,CAAC;QACnB,SAAS,CAAC,wBAAwB,CAAC,KAAK,CAAC;QACzC,YAAY,CAAC,wBAAwB,CAAC,QAAQ,EAAE,wBAAwB,CAAC,KAAK,CAAC;KAChF,EACD,CAAC,eAAe,CAAC,CAClB,CAAC;IACF,MAAM,CACJ,wBAAwB,CAAC,SAAS,EAClC,UAAU,EACV,CAAC,YAAY,CAAC,CACf,CAAC;AACJ,CAAC"}
|
|
@@ -13,16 +13,13 @@ export type ThrottleDebounce = Partial<Record<"throttle" | "debounce", Record<st
|
|
|
13
13
|
export type OptionsInnerFields = {
|
|
14
14
|
data: {
|
|
15
15
|
__storeInited__?: boolean;
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
attached?: boolean;
|
|
17
|
+
__notUpdateComputed__?: boolean;
|
|
18
18
|
__computedInited__?: boolean;
|
|
19
19
|
__computedCache__?: ComputedCache;
|
|
20
20
|
__watchOldValue__?: WatchOldValue;
|
|
21
21
|
__throttleDebounce__?: ThrottleDebounce;
|
|
22
22
|
};
|
|
23
|
-
methods: {
|
|
24
|
-
__computedUpdater__?: Func;
|
|
25
|
-
};
|
|
26
23
|
};
|
|
27
24
|
export type SameFuncOptions = Record<"pageLifetimes" | "lifetimes" | "watch" | "observers", Record<string, Func[]>>;
|
|
28
25
|
export type FinalOptionsOfComponent = {
|
|
@@ -1,82 +1,50 @@
|
|
|
1
1
|
import { BBeforeCreate } from "../../../behaviors/BbeforeCreated";
|
|
2
2
|
import { BthrottleDebounce } from "../../../behaviors/BthrottleDebounce";
|
|
3
3
|
import { applyDebounceAndThrottle } from "../../../utils/applyDebounceAndThrottle";
|
|
4
|
-
import { isEmptyObject } from "../../../utils/isEmptyObject";
|
|
5
4
|
import { instanceConfig } from "../../InstanceInject/instanceConfig";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { isPageCheck } from "./hijackHandle/isPageCheck";
|
|
10
|
-
import { loadReceivedDataHandle } from "./hijackHandle/loadReceivedDataHandle";
|
|
11
|
-
import { onLoadReceivedDataHandle } from "./hijackHandle/onLoadReceivedDataHandle";
|
|
12
|
-
import { pagePathCheck } from "./hijackHandle/pagePathCheck";
|
|
5
|
+
import { handleRootComponent } from "./handleRootComponent";
|
|
6
|
+
import { handleSubComponents } from "./handleSubComponents";
|
|
7
|
+
import { hijackHandle } from "./hijackHandle";
|
|
13
8
|
import { injectInfoHandler } from "./injectInfoHandler";
|
|
14
9
|
import { InternalFieldProtection } from "./internalFieldProtection";
|
|
15
|
-
import { rootComponentOptionHandle } from "./rootComponentOptionHandle";
|
|
16
10
|
import { sameFuncOptionsHandle } from "./sameFuncOptionsHandle";
|
|
17
|
-
import { disposeStore } from "./handleStore/disposeStore";
|
|
18
|
-
import { initComputed } from "./initComputed";
|
|
19
|
-
import { computedUpdater } from "./initComputed/computedUpdater";
|
|
20
|
-
import { subComponentsOptionHandle } from "./subComponentsOptionHandle";
|
|
21
11
|
import { watchHandler } from "./watchHandler";
|
|
22
12
|
export function normalizeOptions(defineComponentOption) {
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
const
|
|
13
|
+
var _a;
|
|
14
|
+
const { rootComponent, subComponents, path } = defineComponentOption;
|
|
15
|
+
const isPage = (_a = rootComponent === null || rootComponent === void 0 ? void 0 : rootComponent.isPage) !== null && _a !== void 0 ? _a : false;
|
|
16
|
+
const finalOptionsForComponent = {
|
|
26
17
|
observers: {},
|
|
27
18
|
data: {},
|
|
28
19
|
methods: {},
|
|
29
20
|
behaviors: [BthrottleDebounce],
|
|
30
21
|
externalClasses: [],
|
|
31
22
|
pageLifetimes: {},
|
|
32
|
-
isPage
|
|
23
|
+
isPage,
|
|
33
24
|
properties: {},
|
|
34
25
|
computed: {},
|
|
35
26
|
watch: {},
|
|
36
27
|
lifetimes: {},
|
|
37
28
|
options: {},
|
|
38
|
-
}
|
|
29
|
+
};
|
|
30
|
+
injectInfoHandler(finalOptionsForComponent, instanceConfig.injectInfo);
|
|
39
31
|
const sameFuncOptions = {
|
|
40
32
|
pageLifetimes: {},
|
|
41
33
|
lifetimes: {},
|
|
42
34
|
watch: {},
|
|
43
35
|
observers: {},
|
|
44
36
|
};
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
if (subComponentsOptions && subComponentsOptions.length !== 0) {
|
|
50
|
-
__throttleDebounce__FieldCheck(subComponentsOptions);
|
|
51
|
-
subComponentsOptionHandle(finalOptionsForComponent, subComponentsOptions, sameFuncOptions);
|
|
52
|
-
}
|
|
53
|
-
sameFuncOptionsHandle(finalOptionsForComponent, rootComponentOption === null || rootComponentOption === void 0 ? void 0 : rootComponentOption.isPage, sameFuncOptions);
|
|
37
|
+
handleRootComponent(finalOptionsForComponent, rootComponent, sameFuncOptions);
|
|
38
|
+
handleSubComponents(finalOptionsForComponent, subComponents, sameFuncOptions);
|
|
39
|
+
sameFuncOptionsHandle(finalOptionsForComponent, isPage, sameFuncOptions);
|
|
54
40
|
InternalFieldProtection(finalOptionsForComponent);
|
|
55
|
-
if (finalOptionsForComponent.
|
|
56
|
-
hijack(finalOptionsForComponent.pageLifetimes, "load", [loadReceivedDataHandle]);
|
|
57
|
-
}
|
|
58
|
-
hijack(finalOptionsForComponent.methods, "onLoad", [onLoadReceivedDataHandle]);
|
|
59
|
-
hijack(finalOptionsForComponent.observers, "**", [
|
|
60
|
-
initStore(finalOptionsForComponent.store),
|
|
61
|
-
initComputed(finalOptionsForComponent.computed, finalOptionsForComponent.watch),
|
|
62
|
-
computedUpdater,
|
|
63
|
-
]);
|
|
64
|
-
hijack(finalOptionsForComponent.lifetimes, "attached", [
|
|
65
|
-
isPageCheck(rootComponentOption === null || rootComponentOption === void 0 ? void 0 : rootComponentOption.isPage),
|
|
66
|
-
pagePathCheck(defineComponentOption.path),
|
|
67
|
-
initStore(finalOptionsForComponent.store),
|
|
68
|
-
initComputed(finalOptionsForComponent.computed, finalOptionsForComponent.watch),
|
|
69
|
-
function () {
|
|
70
|
-
this.data.__attached__ = true;
|
|
71
|
-
},
|
|
72
|
-
]);
|
|
73
|
-
hijack(finalOptionsForComponent.lifetimes, "detached", [disposeStore]);
|
|
74
|
-
if (finalOptionsForComponent.isPage && finalOptionsForComponent.options) {
|
|
41
|
+
if (isPage && finalOptionsForComponent.options) {
|
|
75
42
|
Reflect.deleteProperty(finalOptionsForComponent.options, "virtualHost");
|
|
76
43
|
}
|
|
77
44
|
applyDebounceAndThrottle(finalOptionsForComponent.methods);
|
|
78
45
|
watchHandler(finalOptionsForComponent);
|
|
79
46
|
finalOptionsForComponent.behaviors.push(BBeforeCreate);
|
|
47
|
+
hijackHandle(finalOptionsForComponent, isPage, path);
|
|
80
48
|
return finalOptionsForComponent;
|
|
81
49
|
}
|
|
82
50
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/api/DefineComponent/normalizeOptions/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/api/DefineComponent/normalizeOptions/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,EAAE,wBAAwB,EAAE,MAAM,yCAAyC,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AASrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAgD9C,MAAM,UAAU,gBAAgB,CAC9B,qBAA4C;;IAE5C,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,IAAI,EAAE,GAAG,qBAAqB,CAAC;IACrE,MAAM,MAAM,GAAG,MAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,MAAM,mCAAI,KAAK,CAAC;IAC9C,MAAM,wBAAwB,GAA4B;QACxD,SAAS,EAAE,EAAE;QACb,IAAI,EAAE,EAAE;QACR,OAAO,EAAE,EAAE;QACX,SAAS,EAAE,CAAC,iBAAiB,CAAC;QAC9B,eAAe,EAAE,EAAE;QACnB,aAAa,EAAE,EAAE;QACjB,MAAM;QACN,UAAU,EAAE,EAAE;QACd,QAAQ,EAAE,EAAE;QACZ,KAAK,EAAE,EAAE;QACT,SAAS,EAAE,EAAE;QACb,OAAO,EAAE,EAAE;KACZ,CAAC;IAEF,iBAAiB,CAAC,wBAAwB,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IAKvE,MAAM,eAAe,GAAoB;QACvC,aAAa,EAAE,EAAE;QACjB,SAAS,EAAE,EAAE;QACb,KAAK,EAAE,EAAE;QACT,SAAS,EAAE,EAAE;KACd,CAAC;IAEF,mBAAmB,CAAC,wBAAwB,EAAE,aAAa,EAAE,eAAe,CAAC,CAAC;IAE9E,mBAAmB,CAAC,wBAAwB,EAAE,aAAa,EAAE,eAAe,CAAC,CAAC;IAE9E,qBAAqB,CAAC,wBAAwB,EAAE,MAAM,EAAE,eAAe,CAAC,CAAC;IAGzE,uBAAuB,CAAC,wBAAwB,CAAC,CAAC;IAGlD,IAAI,MAAM,IAAI,wBAAwB,CAAC,OAAO,EAAE,CAAC;QAC/C,OAAO,CAAC,cAAc,CAAC,wBAAwB,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;IAC1E,CAAC;IAGD,wBAAwB,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC;IAG3D,YAAY,CAAC,wBAAwB,CAAC,CAAC;IAGvC,wBAAwB,CAAC,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAGvD,YAAY,CAAC,wBAAwB,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IAErD,OAAO,wBAAwB,CAAC;AAClC,CAAC"}
|
|
@@ -2,6 +2,8 @@ import { deepEqual } from "../../../../utils/deepEqual";
|
|
|
2
2
|
import { deepProxy, getOriginalValue } from "./data-tracer";
|
|
3
3
|
import { removeSubDependences } from "./dependencesOptimize";
|
|
4
4
|
export function computedUpdater() {
|
|
5
|
+
if (this.data.__notUpdateComputed__)
|
|
6
|
+
return;
|
|
5
7
|
for (const key in this.data.__computedCache__) {
|
|
6
8
|
const itemCache = this.data.__computedCache__[key];
|
|
7
9
|
let changed = false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computedUpdater.js","sourceRoot":"","sources":["../../../../../src/api/DefineComponent/normalizeOptions/initComputed/computedUpdater.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAExD,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAG7D,MAAM,UAAU,eAAe;IAC7B,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAC9C,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC;QACnD,IAAI,OAAO,GAAG,KAAK,CAAC;QACpB,KAAK,MAAM,GAAG,IAAI,SAAS,CAAC,WAAW,EAAE,CAAC;YACxC,IAAI,SAAS,GAAY,IAAI,CAAC,IAAI,CAAC;YACnC,KAAK,MAAM,IAAI,IAAI,GAAG,CAAC,KAAK,EAAE,CAAC;gBAM7B,SAAS,GAAI,SAAqC,CAAC,IAAI,CAAC,CAAC;YAC3D,CAAC;YAED,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;gBACnC,OAAO,GAAG,IAAI,CAAC;gBACf,MAAM;YACR,CAAC;QACH,CAAC;QACD,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,cAAc,GAAyB,EAAE,CAAC;YAChD,MAAM,QAAQ,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,cAAc,CAAC,EAAE,CAAC,CAAC;YAEvF,IAAI,CAAC,OAAO,CAAC;gBACX,CAAC,GAAG,CAAC,EAAE,gBAAgB,CAAC,QAAQ,CAAC;aAClC,CAAC,CAAC;YAEH,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,WAAW,GAAG,oBAAoB,CAAC,cAAc,CAAC,CAAC;YAEpF,OAAO,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACpC,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
1
|
+
{"version":3,"file":"computedUpdater.js","sourceRoot":"","sources":["../../../../../src/api/DefineComponent/normalizeOptions/initComputed/computedUpdater.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAExD,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAG7D,MAAM,UAAU,eAAe;IAC7B,IAAI,IAAI,CAAC,IAAI,CAAC,qBAAqB;QAAE,OAAO;IAC5C,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAC9C,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC;QACnD,IAAI,OAAO,GAAG,KAAK,CAAC;QACpB,KAAK,MAAM,GAAG,IAAI,SAAS,CAAC,WAAW,EAAE,CAAC;YACxC,IAAI,SAAS,GAAY,IAAI,CAAC,IAAI,CAAC;YACnC,KAAK,MAAM,IAAI,IAAI,GAAG,CAAC,KAAK,EAAE,CAAC;gBAM7B,SAAS,GAAI,SAAqC,CAAC,IAAI,CAAC,CAAC;YAC3D,CAAC;YAED,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;gBACnC,OAAO,GAAG,IAAI,CAAC;gBACf,MAAM;YACR,CAAC;QACH,CAAC;QACD,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,cAAc,GAAyB,EAAE,CAAC;YAChD,MAAM,QAAQ,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,cAAc,CAAC,EAAE,CAAC,CAAC;YAEvF,IAAI,CAAC,OAAO,CAAC;gBACX,CAAC,GAAG,CAAC,EAAE,gBAAgB,CAAC,QAAQ,CAAC;aAClC,CAAC,CAAC;YAEH,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,WAAW,GAAG,oBAAoB,CAAC,cAAc,CAAC,CAAC;YAEpF,OAAO,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACpC,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Func } from "hry-types/src/Misc/Func";
|
|
2
2
|
import type { ComputedConstraint } from "../../../RootComponent/Computed/ComputedConstraint";
|
|
3
3
|
import type { Instance } from "../../../RootComponent/Instance/RootComponentInstance";
|
|
4
|
-
export declare function initComputed(computedConfig: ComputedConstraint
|
|
4
|
+
export declare function initComputed(computedConfig: ComputedConstraint, watchConfig: Record<string, Func>): (this: Instance) => void;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { deepClone } from "../../../../utils/deepClone";
|
|
1
2
|
import { isEmptyObject } from "../../../../utils/isEmptyObject";
|
|
2
3
|
import { nonNullable } from "../../../../utils/nonNullable";
|
|
3
4
|
import { getPathsValue } from "../watchHandler/getPathsValue";
|
|
@@ -5,16 +6,13 @@ import { hasComputedPath } from "../watchHandler/hasComputedPath";
|
|
|
5
6
|
import { initComputedAndGetCache } from "./initComputedAndGetCache";
|
|
6
7
|
export function initComputed(computedConfig, watchConfig) {
|
|
7
8
|
return function () {
|
|
8
|
-
if (!computedConfig || this.data.__computedInitializing__ === true)
|
|
9
|
-
return;
|
|
10
|
-
this.data.__computedInitializing__ = true;
|
|
11
9
|
const __computedInitCache__ = initComputedAndGetCache.call(this, computedConfig);
|
|
12
10
|
this.data.__computedCache__ = __computedInitCache__;
|
|
13
11
|
if (!isEmptyObject(watchConfig)) {
|
|
14
12
|
const watchOldValue = nonNullable(this.data.__watchOldValue__);
|
|
15
13
|
for (const path in watchConfig) {
|
|
16
14
|
if (hasComputedPath(path, Object.keys(computedConfig))) {
|
|
17
|
-
watchOldValue[path] = getPathsValue(this.data, path);
|
|
15
|
+
watchOldValue[path] = deepClone(getPathsValue(this.data, path));
|
|
18
16
|
}
|
|
19
17
|
}
|
|
20
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/api/DefineComponent/normalizeOptions/initComputed/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAG5D,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAiBpE,MAAM,UAAU,YAAY,CAC1B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/api/DefineComponent/normalizeOptions/initComputed/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAG5D,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAiBpE,MAAM,UAAU,YAAY,CAC1B,cAAkC,EAClC,WAAiC;IAGjC,OAAO;QAGL,MAAM,qBAAqB,GAAG,uBAAuB,CAAC,IAAI,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;QAEjF,IAAI,CAAC,IAAI,CAAC,iBAAiB,GAAG,qBAAqB,CAAC;QAEpD,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,EAAE,CAAC;YAEhC,MAAM,aAAa,GAA8B,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;YAC1F,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE,CAAC;gBAE/B,IAAI,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC;oBACvD,aAAa,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;gBAClE,CAAC;YACH,CAAC;QACH,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC;IACtC,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internalFieldProtection.js","sourceRoot":"","sources":["../../../../src/api/DefineComponent/normalizeOptions/internalFieldProtection.ts"],"names":[],"mappings":"AAGA,MAAM,aAAa,GAAG;IACpB,OAAO,EAAE,CAAC,UAAU,
|
|
1
|
+
{"version":3,"file":"internalFieldProtection.js","sourceRoot":"","sources":["../../../../src/api/DefineComponent/normalizeOptions/internalFieldProtection.ts"],"names":[],"mappings":"AAGA,MAAM,aAAa,GAAG;IACpB,OAAO,EAAE,CAAC,UAAU,CAAC;IACrB,IAAI,EAAE,CAAC,mBAAmB,EAAE,mBAAmB,CAAC;CACjD,CAAC;AAKF,MAAM,UAAU,uBAAuB,CAAC,wBAAiD;IACvF,MAAM,gBAAgB,GAAG,MAAM,CAAC,IAAI,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC;IACvE,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAC;IAEjE,KAAK,MAAM,GAAG,IAAI,gBAAgB,EAAE,CAAC;QACnC,IAAI,aAAa,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YACxC,MAAM,KAAK,CAAC,cAAc,GAAG,YAAY,CAAC,CAAC;QAC7C,CAAC;IACH,CAAC;IACD,KAAK,MAAM,GAAG,IAAI,aAAa,EAAE,CAAC;QAChC,IAAI,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YAErC,MAAM,KAAK,CAAC,WAAW,GAAG,YAAY,CAAC,CAAC;QAC1C,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -2,6 +2,7 @@ export function otherFieldsHandle(finalOptions, rootComponentOptions) {
|
|
|
2
2
|
let key;
|
|
3
3
|
for (key in rootComponentOptions) {
|
|
4
4
|
const config = rootComponentOptions[key];
|
|
5
|
+
console.log("hry 1", key, config);
|
|
5
6
|
if (config === undefined)
|
|
6
7
|
continue;
|
|
7
8
|
if (key === "behaviors") {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otherFieldsHandle.js","sourceRoot":"","sources":["../../../../src/api/DefineComponent/normalizeOptions/otherFieldsHandle.ts"],"names":[],"mappings":"AAMA,MAAM,UAAU,iBAAiB,CAC/B,YAAqC,EACrC,oBAA+E;IAE/E,IAAI,GAAoE,CAAC;IACzE,KAAK,GAAG,IAAI,oBAAoB,EAAE,CAAC;QACjC,MAAM,MAAM,GAAG,oBAAoB,CAAC,GAAG,CAAC,CAAC;QACzC,IAAI,MAAM,KAAK,SAAS;YAAE,SAAS;QACnC,IAAI,GAAG,KAAK,WAAW,EAAE,CAAC;YACxB,YAAY,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,MAAkB,CAAC,CAAC;QAChD,CAAC;aAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;YAEtC,YAAY,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;YAE5C,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC;QAC3C,CAAC;aAAM,IAAI,OAAO,MAAM,KAAK,SAAS,EAAE,CAAC;YACvC,YAAY,CAAC,GAAe,CAAC,GAAG,MAAM,CAAC;QACzC,CAAC;aAAM,CAAC;YAEN,YAAY,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC;QAC7B,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
1
|
+
{"version":3,"file":"otherFieldsHandle.js","sourceRoot":"","sources":["../../../../src/api/DefineComponent/normalizeOptions/otherFieldsHandle.ts"],"names":[],"mappings":"AAMA,MAAM,UAAU,iBAAiB,CAC/B,YAAqC,EACrC,oBAA+E;IAE/E,IAAI,GAAoE,CAAC;IACzE,KAAK,GAAG,IAAI,oBAAoB,EAAE,CAAC;QACjC,MAAM,MAAM,GAAG,oBAAoB,CAAC,GAAG,CAAC,CAAC;QACzC,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;QAClC,IAAI,MAAM,KAAK,SAAS;YAAE,SAAS;QACnC,IAAI,GAAG,KAAK,WAAW,EAAE,CAAC;YACxB,YAAY,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,MAAkB,CAAC,CAAC;QAChD,CAAC;aAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;YAEtC,YAAY,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;YAE5C,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC;QAC3C,CAAC;aAAM,IAAI,OAAO,MAAM,KAAK,SAAS,EAAE,CAAC;YACvC,YAAY,CAAC,GAAe,CAAC,GAAG,MAAM,CAAC;QACzC,CAAC;aAAM,CAAC;YAEN,YAAY,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC;QAC7B,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -12,10 +12,10 @@ function initWatchOldValue(data, watchConfig, computedKeys) {
|
|
|
12
12
|
return watchOldValue;
|
|
13
13
|
}
|
|
14
14
|
export function watchHandler(finalOptionsForComponent) {
|
|
15
|
-
const { observers: observersConfig, watch: watchConfig, data, properties, computed } = finalOptionsForComponent;
|
|
15
|
+
const { observers: observersConfig, watch: watchConfig, data, properties, computed: computedConfig } = finalOptionsForComponent;
|
|
16
16
|
if (!isEmptyObject(watchConfig)) {
|
|
17
17
|
const rawPropertiesValue = getPropertiesValue(properties);
|
|
18
|
-
const computedKeys = Object.keys(
|
|
18
|
+
const computedKeys = Object.keys(computedConfig);
|
|
19
19
|
data.__watchOldValue__ = initWatchOldValue(Object.assign(Object.assign({}, data), rawPropertiesValue), watchConfig, computedKeys);
|
|
20
20
|
for (const key in watchConfig) {
|
|
21
21
|
const watchHadle = watchConfig[key];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/api/DefineComponent/normalizeOptions/watchHandler/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/api/DefineComponent/normalizeOptions/watchHandler/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAG5F,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,SAAS,iBAAiB,CACxB,IAAqC,EACrC,WAAmB,EACnB,YAAsB;IAEtB,MAAM,aAAa,GAAkB,EAAE,CAAC;IACxC,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE,CAAC;QAE/B,IAAI,eAAe,CAAC,IAAI,EAAE,YAAY,CAAC;YAAE,SAAS;QAClD,aAAa,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;IAC7D,CAAC;IAED,OAAO,aAAa,CAAC;AACvB,CAAC;AACD,MAAM,UAAU,YAAY,CAC1B,wBAAiD;IAEjD,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAE,GAClG,wBAAwB,CAAC;IAC3B,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,EAAE,CAAC;QAChC,MAAM,kBAAkB,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC;QAC1D,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACjD,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,iCAAM,IAAI,GAAK,kBAAkB,GAAI,WAAW,EAAE,YAAY,CAAC,CAAC;QAC1G,KAAK,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;YAC9B,MAAM,UAAU,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;YACpC,MAAM,qBAAqB,GAAG,eAAe,CAAC,GAAG,CAAqB,CAAC;YAEvE,eAAe,CAAC,GAAG,CAAC,GAAG,UAAyB,GAAG,QAAmB;gBACpE,qBAAqB,aAArB,qBAAqB,uBAArB,qBAAqB,CAAE,IAAI,CAAC,IAAI,EAAE,GAAG,QAAQ,CAAC,CAAC;gBAE/C,IAAI,eAAe,CAAC,GAAG,EAAE,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB;oBAAE,OAAO;gBAChF,MAAM,aAAa,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;gBAC/D,MAAM,QAAQ,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;gBACpC,IAAI,SAAS,CAAC,QAAQ,EAAE,QAAQ,CAAC;oBAAE,OAAO;gBAC1C,aAAa,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;gBACzC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,QAAQ,EAAE,GAAG,QAAQ,CAAC,CAAC;YAClD,CAAC,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -22,6 +22,6 @@ type InstanceInnerFields = {
|
|
|
22
22
|
data: OptionsInnerFields["data"];
|
|
23
23
|
disposer: Record<string, Func>;
|
|
24
24
|
cloneData: OptionsInnerFields["data"];
|
|
25
|
-
}
|
|
25
|
+
};
|
|
26
26
|
export type Instance = (ComponentInstance | PageInstance) & InstanceInnerFields;
|
|
27
27
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { IfExtends } from "hry-types/src/Any/IfExtends";
|
|
2
2
|
import type { ComputeIntersection } from "hry-types/src/Object/ComputeIntersection";
|
|
3
|
-
import type { AddNullForObject } from "../../../types/AddNullForObject";
|
|
4
3
|
import type { CustomComponentType } from "../../CustomComponent/CustomComponentType";
|
|
5
4
|
import type { RootComponentType } from "../../RootComponent/RootComponentType";
|
|
6
5
|
import type { GetCustomEventDocOfSubDoc } from "./GetCustomEventDocOfSubDoc";
|
|
@@ -27,9 +26,7 @@ export type CreateComponentDoc<
|
|
|
27
26
|
{
|
|
28
27
|
properties: {
|
|
29
28
|
// AddNullForObject 为了给子组件传值时,可以让异步对象数据初始值为null。
|
|
30
|
-
[k in keyof AllPropertiesDoc as `${TName}_${k & string}`]:
|
|
31
|
-
AllPropertiesDoc[k]
|
|
32
|
-
>;
|
|
29
|
+
[k in keyof AllPropertiesDoc as `${TName}_${k & string}`]: AllPropertiesDoc[k];
|
|
33
30
|
};
|
|
34
31
|
}
|
|
35
32
|
>
|
|
@@ -75,10 +75,10 @@ const onlyProperties = DefineComponent({
|
|
|
75
75
|
// 1. 类型为typeof OnlyPropsRootDoc加前缀(组件名)
|
|
76
76
|
type OnlyPropertiesExpected = {
|
|
77
77
|
properties: {
|
|
78
|
-
test_optionalObj?: Mock_User
|
|
78
|
+
test_optionalObj?: Mock_User;
|
|
79
79
|
test_optionalObjOrNull?: Mock_User | null;
|
|
80
80
|
test_str: string;
|
|
81
|
-
test_obj: Mock_User
|
|
81
|
+
test_obj: Mock_User;
|
|
82
82
|
};
|
|
83
83
|
};
|
|
84
84
|
|
|
@@ -14,12 +14,10 @@ export type Path = `/${string}`;
|
|
|
14
14
|
type RootOptions<
|
|
15
15
|
TRootComponentDoc extends RootComponentType,
|
|
16
16
|
TSubComponentTuple extends CustomComponentType[],
|
|
17
|
-
// TSlotComponents extends unknown[],
|
|
18
17
|
TName extends string,
|
|
19
18
|
TPath extends Path,
|
|
20
19
|
> =
|
|
21
20
|
& NameOrPathOption<TName, TPath, TRootComponentDoc["isPage"] & {}>
|
|
22
|
-
// & { slotComponents?: TSlotComponents }
|
|
23
21
|
& RootComponentOption<TRootComponentDoc>
|
|
24
22
|
& SubComponentsOption<TSubComponentTuple>;
|
|
25
23
|
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { isEmptyObject } from "../../../utils/isEmptyObject";
|
|
2
|
+
import type { RootComponentTrueOptions } from "../../RootComponent";
|
|
3
|
+
import type { FinalOptionsOfComponent, SameFuncOptions } from ".";
|
|
4
|
+
import { __throttleDebounce__FieldCheck } from "./__throttleDebounce__FieldCheck";
|
|
5
|
+
import { customEventsHandle } from "./customEventsHandle";
|
|
6
|
+
import { otherFieldsHandle } from "./otherFieldsHandle";
|
|
7
|
+
import { sameFuncFieldsCollect } from "./sameFuncFieldsCollect";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* 收集 rootComponentOptions 配置到 finalOptions 和 funcOptions 中
|
|
11
|
+
* @param finalOptions - 收集配置对象`
|
|
12
|
+
* @param rootComponent - 被收集的源配置对象
|
|
13
|
+
* @param funcOptions - 收集特殊配置对象字段
|
|
14
|
+
*/
|
|
15
|
+
export function handleRootComponent(
|
|
16
|
+
finalOptions: FinalOptionsOfComponent,
|
|
17
|
+
rootComponent: RootComponentTrueOptions | undefined,
|
|
18
|
+
funcOptions: SameFuncOptions,
|
|
19
|
+
) {
|
|
20
|
+
if (rootComponent && !isEmptyObject(rootComponent)) {
|
|
21
|
+
// 验证配置中是否有内部字段__throttleDebounce__,有则报错,因为在rootComponentOptionHandle中会加入__throttleDebounce__字段到data中
|
|
22
|
+
__throttleDebounce__FieldCheck(rootComponent);
|
|
23
|
+
// 自定义事件处理时,如果配置了防抖节流,则需要在data.__throttleDebounce__保留配置信息,以便后续使用
|
|
24
|
+
if (rootComponent.customEvents) customEventsHandle(finalOptions, rootComponent.customEvents);
|
|
25
|
+
delete rootComponent.customEvents;
|
|
26
|
+
if (rootComponent.events) Object.assign(finalOptions.methods, rootComponent.events);
|
|
27
|
+
delete rootComponent.events;
|
|
28
|
+
sameFuncFieldsCollect(rootComponent, funcOptions);
|
|
29
|
+
|
|
30
|
+
otherFieldsHandle(finalOptions, rootComponent);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -3,9 +3,7 @@ import type { FinalOptionsOfComponent } from "..";
|
|
|
3
3
|
import { reactionRegister } from "./reactionRegister";
|
|
4
4
|
export function initStore(storeConfig: FinalOptionsOfComponent["store"] | undefined) {
|
|
5
5
|
return function(this: Instance) {
|
|
6
|
-
if (!storeConfig
|
|
7
|
-
this.data.__storeInited__ = true; // 切记一定要在这里设置,不能放最下面,因为initStore可能多次触发,导致重复初始化,从而引起dispose无效的问题.
|
|
6
|
+
if (!storeConfig) return;
|
|
8
7
|
reactionRegister.call(this, storeConfig);
|
|
9
|
-
// this.data.__storeInited__ = true; 之前放在这里,导致dispose无效的问题。
|
|
10
8
|
};
|
|
11
9
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { CustomComponentTrueOptions } from "../../CustomComponent";
|
|
2
|
+
import type { FinalOptionsOfComponent, SameFuncOptions } from ".";
|
|
3
|
+
import { __throttleDebounce__FieldCheck } from "./__throttleDebounce__FieldCheck";
|
|
4
|
+
import { otherFieldsHandle } from "./otherFieldsHandle";
|
|
5
|
+
import { sameFuncFieldsCollect } from "./sameFuncFieldsCollect";
|
|
6
|
+
|
|
7
|
+
export function handleSubComponents(
|
|
8
|
+
componentOptions: FinalOptionsOfComponent,
|
|
9
|
+
subComponents: CustomComponentTrueOptions[] | undefined,
|
|
10
|
+
funcOptions: SameFuncOptions,
|
|
11
|
+
) {
|
|
12
|
+
if (subComponents && subComponents.length !== 0) {
|
|
13
|
+
// 验证配置中是否有内部字段__throttleDebounce__,有则报错,因为在rootComponentOptionHandle中会加入__throttleDebounce__字段到data中
|
|
14
|
+
__throttleDebounce__FieldCheck(subComponents);
|
|
15
|
+
subComponents.forEach((subOption) => {
|
|
16
|
+
if (subOption.events) Object.assign(componentOptions.methods, subOption.events);
|
|
17
|
+
|
|
18
|
+
sameFuncFieldsCollect(subOption, funcOptions);
|
|
19
|
+
|
|
20
|
+
otherFieldsHandle(componentOptions, subOption);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Instance } from "../../../RootComponent/Instance/RootComponentInstance";
|
|
2
|
+
|
|
3
|
+
export function addDetachedData(this: Instance) {
|
|
4
|
+
// 如果 attached字段被占用,就不添加了
|
|
5
|
+
if (this.data.attached !== undefined) return;
|
|
6
|
+
this.data.__notUpdateComputed__ = true;
|
|
7
|
+
this.setData({
|
|
8
|
+
// @ts-ignore
|
|
9
|
+
attached: true,
|
|
10
|
+
});
|
|
11
|
+
this.data.__notUpdateComputed__ = false;
|
|
12
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Func } from "hry-types/src/Misc/Func";
|
|
2
|
+
import type { FinalOptionsOfComponent } from "..";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 劫持指定配置字段,在原有配置前执行指定函数
|
|
6
|
+
*/
|
|
7
|
+
export function hijack<T extends FinalOptionsOfComponent[keyof FinalOptionsOfComponent]>(
|
|
8
|
+
config: T,
|
|
9
|
+
field: keyof T,
|
|
10
|
+
before: Func[],
|
|
11
|
+
after: Func[] = [],
|
|
12
|
+
) {
|
|
13
|
+
// @ts-ignore 隐式索引
|
|
14
|
+
const originalFunc: Func | undefined = config[field];
|
|
15
|
+
|
|
16
|
+
// @ts-ignore 隐式索引
|
|
17
|
+
config[field] = function(...args: unknown[]) {
|
|
18
|
+
before.forEach(func => func.call(this, ...args));
|
|
19
|
+
|
|
20
|
+
if (originalFunc) originalFunc.apply(this, args);
|
|
21
|
+
|
|
22
|
+
after.forEach(func => func.call(this, ...args));
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
@@ -1,26 +1,46 @@
|
|
|
1
|
-
import type { Func } from "hry-types/src/Misc/Func";
|
|
2
1
|
import type { FinalOptionsOfComponent } from "..";
|
|
2
|
+
import { disposeStore } from "../handleStore/disposeStore";
|
|
3
|
+
import { initStore } from "../handleStore/initStore";
|
|
4
|
+
import { initComputed } from "../initComputed";
|
|
5
|
+
import { computedUpdater } from "../initComputed/computedUpdater";
|
|
6
|
+
import { addDetachedData } from "./addDetachedData";
|
|
7
|
+
import { hijack } from "./hijack";
|
|
8
|
+
import { isPageCheck } from "./isPageCheck";
|
|
9
|
+
import { loadReceivedDataHandle } from "./loadReceivedDataHandle";
|
|
10
|
+
import { onLoadReceivedDataHandle } from "./onLoadReceivedDataHandle";
|
|
11
|
+
import { pagePathCheck } from "./pagePathCheck";
|
|
3
12
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
config: T,
|
|
9
|
-
field: keyof T,
|
|
10
|
-
before: Func[],
|
|
11
|
-
// after: Func[] = [],
|
|
13
|
+
export function hijackHandle(
|
|
14
|
+
finalOptionsForComponent: FinalOptionsOfComponent,
|
|
15
|
+
isPage: boolean | undefined,
|
|
16
|
+
path: string | undefined,
|
|
12
17
|
) {
|
|
13
|
-
//
|
|
14
|
-
|
|
18
|
+
// 对页面传入参数进行处理 老框架劫持页面methods.onLoad,新框架劫持页面pageLifetimes.load
|
|
19
|
+
if (finalOptionsForComponent.isPage) {
|
|
20
|
+
hijack(finalOptionsForComponent.pageLifetimes, "load", [loadReceivedDataHandle]);
|
|
21
|
+
}
|
|
15
22
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
23
|
+
hijack(finalOptionsForComponent.methods, "onLoad", [onLoadReceivedDataHandle]);
|
|
24
|
+
hijack(finalOptionsForComponent.observers, "**", [
|
|
25
|
+
computedUpdater,
|
|
26
|
+
]);
|
|
19
27
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
28
|
+
hijack(
|
|
29
|
+
finalOptionsForComponent.lifetimes,
|
|
30
|
+
"attached",
|
|
31
|
+
[
|
|
32
|
+
// 验证isPage字段是否配置正确
|
|
33
|
+
isPageCheck(isPage),
|
|
34
|
+
// 验证页面的Path字段是否配置正确
|
|
35
|
+
pagePathCheck(path),
|
|
36
|
+
initStore(finalOptionsForComponent.store),
|
|
37
|
+
initComputed(finalOptionsForComponent.computed, finalOptionsForComponent.watch),
|
|
38
|
+
],
|
|
39
|
+
[addDetachedData],
|
|
40
|
+
);
|
|
41
|
+
hijack(
|
|
42
|
+
finalOptionsForComponent.lifetimes,
|
|
43
|
+
"detached",
|
|
44
|
+
[disposeStore],
|
|
45
|
+
);
|
|
26
46
|
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import type { Func } from "hry-types/src/Misc/_api";
|
|
2
2
|
import { BBeforeCreate } from "../../../behaviors/BbeforeCreated";
|
|
3
|
-
|
|
4
3
|
import { BthrottleDebounce } from "../../../behaviors/BthrottleDebounce";
|
|
5
4
|
import { applyDebounceAndThrottle } from "../../../utils/applyDebounceAndThrottle";
|
|
6
|
-
import { isEmptyObject } from "../../../utils/isEmptyObject";
|
|
7
5
|
import { instanceConfig } from "../../InstanceInject/instanceConfig";
|
|
8
6
|
import type { ComputedConstraint } from "../../RootComponent/Computed/ComputedConstraint";
|
|
9
7
|
import type { DataConstraint } from "../../RootComponent/Data/DataConstraint";
|
|
@@ -13,24 +11,13 @@ import type { PageLifetimesOption } from "../../RootComponent/PageLifetimes/Page
|
|
|
13
11
|
import type { PropertiesConstraint } from "../../RootComponent/Properties/PropertiesConstraint";
|
|
14
12
|
import type { StoreConstraint } from "../../RootComponent/Store/StoreConstraint";
|
|
15
13
|
import type { DefineComponentOption } from "..";
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import { isPageCheck } from "./hijackHandle/isPageCheck";
|
|
21
|
-
import { loadReceivedDataHandle } from "./hijackHandle/loadReceivedDataHandle";
|
|
22
|
-
import { onLoadReceivedDataHandle } from "./hijackHandle/onLoadReceivedDataHandle";
|
|
23
|
-
import { pagePathCheck } from "./hijackHandle/pagePathCheck";
|
|
14
|
+
import { handleRootComponent } from "./handleRootComponent";
|
|
15
|
+
import { handleSubComponents } from "./handleSubComponents";
|
|
16
|
+
import { hijackHandle } from "./hijackHandle";
|
|
17
|
+
import type { ComputedCache } from "./initComputed/initComputedAndGetCache";
|
|
24
18
|
import { injectInfoHandler } from "./injectInfoHandler";
|
|
25
19
|
import { InternalFieldProtection } from "./internalFieldProtection";
|
|
26
|
-
import { rootComponentOptionHandle } from "./rootComponentOptionHandle";
|
|
27
20
|
import { sameFuncOptionsHandle } from "./sameFuncOptionsHandle";
|
|
28
|
-
// import { slotComponentOptionHandle } from "./slotComponentsOptionHandle";
|
|
29
|
-
import { disposeStore } from "./handleStore/disposeStore";
|
|
30
|
-
import { initComputed } from "./initComputed";
|
|
31
|
-
import { computedUpdater } from "./initComputed/computedUpdater";
|
|
32
|
-
import type { ComputedCache } from "./initComputed/initComputedAndGetCache";
|
|
33
|
-
import { subComponentsOptionHandle } from "./subComponentsOptionHandle";
|
|
34
21
|
import { watchHandler } from "./watchHandler";
|
|
35
22
|
// 因为watch字段可能有多个变量,所以在这里定义的value是一个数组
|
|
36
23
|
export type WatchOldValue = Record<string, unknown[]>;
|
|
@@ -38,16 +25,15 @@ export type ThrottleDebounce = Partial<Record<"throttle" | "debounce", Record<st
|
|
|
38
25
|
export type OptionsInnerFields = {
|
|
39
26
|
data: {
|
|
40
27
|
__storeInited__?: boolean;
|
|
41
|
-
|
|
42
|
-
|
|
28
|
+
// 在attach周期结束后,为data.attached赋值为true
|
|
29
|
+
attached?: boolean;
|
|
30
|
+
// 为data.attached赋值为true时会触发Observers["**"]的回调函数,进而运行computedUpdater,所以要设置一个标志位来避免触发computedUpdater。因为这是无意义的。
|
|
31
|
+
__notUpdateComputed__?: boolean;
|
|
43
32
|
__computedInited__?: boolean;
|
|
44
33
|
__computedCache__?: ComputedCache;
|
|
45
34
|
__watchOldValue__?: WatchOldValue;
|
|
46
35
|
__throttleDebounce__?: ThrottleDebounce;
|
|
47
36
|
};
|
|
48
|
-
methods: {
|
|
49
|
-
__computedUpdater__?: Func;
|
|
50
|
-
};
|
|
51
37
|
};
|
|
52
38
|
|
|
53
39
|
/**
|
|
@@ -83,24 +69,24 @@ export type FinalOptionsOfComponent = {
|
|
|
83
69
|
export function normalizeOptions(
|
|
84
70
|
defineComponentOption: DefineComponentOption,
|
|
85
71
|
): FinalOptionsOfComponent {
|
|
86
|
-
const
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
const finalOptionsForComponent: FinalOptionsOfComponent = injectInfoHandler({
|
|
72
|
+
const { rootComponent, subComponents, path } = defineComponentOption;
|
|
73
|
+
const isPage = rootComponent?.isPage ?? false;
|
|
74
|
+
const finalOptionsForComponent: FinalOptionsOfComponent = {
|
|
90
75
|
observers: {},
|
|
91
76
|
data: {},
|
|
92
77
|
methods: {},
|
|
93
78
|
behaviors: [BthrottleDebounce],
|
|
94
79
|
externalClasses: [],
|
|
95
80
|
pageLifetimes: {},
|
|
96
|
-
isPage
|
|
81
|
+
isPage,
|
|
97
82
|
properties: {},
|
|
98
83
|
computed: {},
|
|
99
84
|
watch: {},
|
|
100
85
|
lifetimes: {},
|
|
101
86
|
options: {},
|
|
102
|
-
}
|
|
103
|
-
|
|
87
|
+
};
|
|
88
|
+
// 处理注入的实例配置项
|
|
89
|
+
injectInfoHandler(finalOptionsForComponent, instanceConfig.injectInfo);
|
|
104
90
|
/**
|
|
105
91
|
* 为了更高的效率,在处理rootComponentOption和subComponentsOption数据时,把相同字段配置(pageLifetimes,lifetimes,watch,observers)收集到funcOptions中。
|
|
106
92
|
* 后续再一起处理这些字段,整合进finalOptionsForComponent配置中。即funcConfig是一个临时中介对象。
|
|
@@ -112,73 +98,32 @@ export function normalizeOptions(
|
|
|
112
98
|
observers: {},
|
|
113
99
|
};
|
|
114
100
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
rootComponentOptionHandle(finalOptionsForComponent, rootComponentOption, sameFuncOptions);
|
|
119
|
-
}
|
|
120
|
-
if (subComponentsOptions && subComponentsOptions.length !== 0) {
|
|
121
|
-
// 验证配置中是否有内部字段__throttleDebounce__,有则报错,因为在rootComponentOptionHandle中会加入__throttleDebounce__字段到data中
|
|
122
|
-
__throttleDebounce__FieldCheck(subComponentsOptions);
|
|
123
|
-
subComponentsOptionHandle(finalOptionsForComponent, subComponentsOptions, sameFuncOptions);
|
|
124
|
-
}
|
|
101
|
+
handleRootComponent(finalOptionsForComponent, rootComponent, sameFuncOptions);
|
|
102
|
+
|
|
103
|
+
handleSubComponents(finalOptionsForComponent, subComponents, sameFuncOptions);
|
|
125
104
|
|
|
126
|
-
sameFuncOptionsHandle(finalOptionsForComponent,
|
|
105
|
+
sameFuncOptionsHandle(finalOptionsForComponent, isPage, sameFuncOptions);
|
|
127
106
|
|
|
128
107
|
// 配置与内部字段冲突验证
|
|
129
108
|
InternalFieldProtection(finalOptionsForComponent);
|
|
130
109
|
|
|
131
|
-
// 对页面传入参数进行处理 老框架劫持页面methods.onLoad,新框架劫持页面pageLifetimes.load
|
|
132
|
-
if (finalOptionsForComponent.isPage) {
|
|
133
|
-
hijack(finalOptionsForComponent.pageLifetimes, "load", [loadReceivedDataHandle]);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
hijack(finalOptionsForComponent.methods, "onLoad", [onLoadReceivedDataHandle]);
|
|
137
|
-
// 只要properties不为空且传入的字段在properties中,就会在attached周期之前先触发observers["**"]事件一次
|
|
138
|
-
hijack(finalOptionsForComponent.observers, "**", [
|
|
139
|
-
initStore(finalOptionsForComponent.store),
|
|
140
|
-
initComputed(finalOptionsForComponent.computed, finalOptionsForComponent.watch),
|
|
141
|
-
computedUpdater,
|
|
142
|
-
]);
|
|
143
|
-
|
|
144
|
-
hijack(
|
|
145
|
-
finalOptionsForComponent.lifetimes,
|
|
146
|
-
"attached",
|
|
147
|
-
[
|
|
148
|
-
// 验证isPage字段是否配置正确
|
|
149
|
-
isPageCheck(rootComponentOption?.isPage),
|
|
150
|
-
pagePathCheck(defineComponentOption.path),
|
|
151
|
-
initStore(finalOptionsForComponent.store),
|
|
152
|
-
initComputed(finalOptionsForComponent.computed, finalOptionsForComponent.watch),
|
|
153
|
-
function() {
|
|
154
|
-
// @ts-ignore
|
|
155
|
-
this.data.__attached__ = true;
|
|
156
|
-
},
|
|
157
|
-
],
|
|
158
|
-
);
|
|
159
|
-
hijack(
|
|
160
|
-
finalOptionsForComponent.lifetimes,
|
|
161
|
-
"detached",
|
|
162
|
-
[disposeStore],
|
|
163
|
-
);
|
|
164
110
|
// 页面时删除预设的虚拟组件字段
|
|
165
|
-
if (
|
|
111
|
+
if (isPage && finalOptionsForComponent.options) {
|
|
166
112
|
Reflect.deleteProperty(finalOptionsForComponent.options, "virtualHost");
|
|
167
113
|
}
|
|
168
114
|
|
|
169
115
|
// 处理debounce和throttle前缀的方法(事件)配置
|
|
170
116
|
applyDebounceAndThrottle(finalOptionsForComponent.methods);
|
|
171
117
|
|
|
172
|
-
//
|
|
173
|
-
// initStore(finalOptionsForComponent);
|
|
174
|
-
|
|
175
|
-
// 处理watch配置,注意的是 oldValue中的计算属性初始赋值在计算属性初始化完毕后。
|
|
118
|
+
// 处理watch配置,注意的是 oldValue中的计算属性初始赋值在计算属性初始化完毕后,即计算属性初始化后,再变化时才会被watch到。
|
|
176
119
|
watchHandler(finalOptionsForComponent);
|
|
177
|
-
// 在rootComponentOptionHandle中保留了防抖节流配置,这里处理后,删除data.__throttleDebounce__字段
|
|
178
120
|
|
|
179
|
-
// BBeforeCreate在最后面,让BeforeCreate
|
|
121
|
+
// BBeforeCreate在最后面,让BeforeCreate生命周期运行在最终建立组件时。用于测试。
|
|
180
122
|
finalOptionsForComponent.behaviors.push(BBeforeCreate);
|
|
181
123
|
|
|
124
|
+
// 劫持函数的处理
|
|
125
|
+
hijackHandle(finalOptionsForComponent, isPage, path);
|
|
126
|
+
|
|
182
127
|
return finalOptionsForComponent;
|
|
183
128
|
}
|
|
184
129
|
|
|
@@ -5,6 +5,7 @@ import { removeSubDependences } from "./dependencesOptimize";
|
|
|
5
5
|
import type { ComputedDependence } from "./initComputedAndGetCache";
|
|
6
6
|
|
|
7
7
|
export function computedUpdater(this: Instance): void {
|
|
8
|
+
if (this.data.__notUpdateComputed__) return;
|
|
8
9
|
for (const key in this.data.__computedCache__) {
|
|
9
10
|
const itemCache = this.data.__computedCache__[key];
|
|
10
11
|
let changed = false;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Func } from "hry-types/src/Misc/Func";
|
|
2
|
+
import { deepClone } from "../../../../utils/deepClone";
|
|
2
3
|
import { isEmptyObject } from "../../../../utils/isEmptyObject";
|
|
3
4
|
import { nonNullable } from "../../../../utils/nonNullable";
|
|
4
5
|
import type { ComputedConstraint } from "../../../RootComponent/Computed/ComputedConstraint";
|
|
@@ -23,28 +24,24 @@ import { initComputedAndGetCache } from "./initComputedAndGetCache";
|
|
|
23
24
|
* @returns
|
|
24
25
|
*/
|
|
25
26
|
export function initComputed(
|
|
26
|
-
computedConfig: ComputedConstraint
|
|
27
|
+
computedConfig: ComputedConstraint,
|
|
27
28
|
watchConfig: Record<string, Func>,
|
|
28
29
|
// mark?: string,
|
|
29
30
|
) {
|
|
30
31
|
return function(this: Instance) {
|
|
31
32
|
// __computedCache__ 用来避免重复初始化。
|
|
32
|
-
if (!computedConfig || this.data.__computedInitializing__ === true) return;
|
|
33
|
-
this.data.__computedInitializing__ = true;
|
|
34
33
|
|
|
35
34
|
const __computedInitCache__ = initComputedAndGetCache.call(this, computedConfig);
|
|
36
35
|
// 缓存放入data中
|
|
37
36
|
this.data.__computedCache__ = __computedInitCache__;
|
|
38
37
|
// 为__watchOldValue__赋值(watchPath中包含计算属性的值的key)
|
|
39
|
-
|
|
40
38
|
if (!isEmptyObject(watchConfig)) {
|
|
41
39
|
// 有watchConfig配置时,watchOldValue已经初始过了,所以必有__watchOldValue__
|
|
42
40
|
const watchOldValue: Record<string, unknown[]> = nonNullable(this.data.__watchOldValue__);
|
|
43
41
|
for (const path in watchConfig) {
|
|
44
42
|
// 只针对watchPath中包含计算属性的值的key进行赋值
|
|
45
43
|
if (hasComputedPath(path, Object.keys(computedConfig))) {
|
|
46
|
-
|
|
47
|
-
watchOldValue[path] = getPathsValue(this.data, path);
|
|
44
|
+
watchOldValue[path] = deepClone(getPathsValue(this.data, path));
|
|
48
45
|
}
|
|
49
46
|
}
|
|
50
47
|
}
|
|
@@ -11,6 +11,7 @@ export function otherFieldsHandle(
|
|
|
11
11
|
let key: keyof Omit<RootComponentTrueOptions, "customEvents" | "events">;
|
|
12
12
|
for (key in rootComponentOptions) {
|
|
13
13
|
const config = rootComponentOptions[key];
|
|
14
|
+
console.log("hry 1", key, config);
|
|
14
15
|
if (config === undefined) continue;
|
|
15
16
|
if (key === "behaviors") {
|
|
16
17
|
finalOptions[key].push(...config as string[]);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { Func } from "hry-types/src/Misc/Func";
|
|
2
|
-
|
|
3
2
|
import { deepClone, deepEqual, isEmptyObject, nonNullable } from "../../../../utils/_utils";
|
|
4
3
|
import type { Instance } from "../../../RootComponent/Instance/RootComponentInstance";
|
|
5
4
|
import type { FinalOptionsOfComponent, WatchOldValue } from "..";
|
|
@@ -14,6 +13,7 @@ function initWatchOldValue(
|
|
|
14
13
|
): WatchOldValue {
|
|
15
14
|
const watchOldValue: WatchOldValue = {};
|
|
16
15
|
for (const path in watchConfig) {
|
|
16
|
+
// 有计算属性的路径,跳过会在计算属性初始化后赋值
|
|
17
17
|
if (hasComputedPath(path, computedKeys)) continue;
|
|
18
18
|
watchOldValue[path] = deepClone(getPathsValue(data, path));
|
|
19
19
|
}
|
|
@@ -23,10 +23,11 @@ function initWatchOldValue(
|
|
|
23
23
|
export function watchHandler(
|
|
24
24
|
finalOptionsForComponent: FinalOptionsOfComponent,
|
|
25
25
|
) {
|
|
26
|
-
const { observers: observersConfig, watch: watchConfig, data, properties, computed } =
|
|
26
|
+
const { observers: observersConfig, watch: watchConfig, data, properties, computed: computedConfig } =
|
|
27
|
+
finalOptionsForComponent;
|
|
27
28
|
if (!isEmptyObject(watchConfig)) {
|
|
28
29
|
const rawPropertiesValue = getPropertiesValue(properties);
|
|
29
|
-
const computedKeys = Object.keys(
|
|
30
|
+
const computedKeys = Object.keys(computedConfig);
|
|
30
31
|
data.__watchOldValue__ = initWatchOldValue({ ...data, ...rawPropertiesValue }, watchConfig, computedKeys);
|
|
31
32
|
for (const key in watchConfig) {
|
|
32
33
|
const watchHadle = watchConfig[key];
|
|
@@ -37,12 +38,9 @@ export function watchHandler(
|
|
|
37
38
|
// 包含计算属性的路径,只会在计算属性初始化后才会触发watch函数
|
|
38
39
|
if (hasComputedPath(key, computedKeys) && !this.data.__computedInited__) return;
|
|
39
40
|
const watchOldValue = nonNullable(this.data.__watchOldValue__);
|
|
40
|
-
// 判断watch路径中是否有计算属性字段,有且值为undefined时,则不执行watch,因为计算属性未初始化时值为undefined
|
|
41
41
|
const oldValue = watchOldValue[key];
|
|
42
|
-
|
|
43
42
|
if (deepEqual(newValue, oldValue)) return;
|
|
44
43
|
watchOldValue[key] = deepClone(newValue);
|
|
45
|
-
|
|
46
44
|
watchHadle.call(this, ...newValue, ...oldValue);
|
|
47
45
|
};
|
|
48
46
|
}
|
|
@@ -41,5 +41,5 @@ type InstanceInnerFields = {
|
|
|
41
41
|
data: OptionsInnerFields["data"];
|
|
42
42
|
disposer: Record<string, Func>;
|
|
43
43
|
cloneData: OptionsInnerFields["data"];
|
|
44
|
-
}
|
|
44
|
+
};
|
|
45
45
|
export type Instance = (ComponentInstance | PageInstance) & InstanceInnerFields;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { RootComponentTrueOptions } from "../../RootComponent";
|
|
2
|
-
import type { FinalOptionsOfComponent, SameFuncOptions } from ".";
|
|
3
|
-
export declare function rootComponentOptionHandle(finalOptions: FinalOptionsOfComponent, rootComponentOptions: RootComponentTrueOptions, funcOptions: SameFuncOptions): void;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { customEventsHandle } from "./customEventsHandle";
|
|
2
|
-
import { otherFieldsHandle } from "./otherFieldsHandle";
|
|
3
|
-
import { sameFuncFieldsCollect } from "./sameFuncFieldsCollect";
|
|
4
|
-
export function rootComponentOptionHandle(finalOptions, rootComponentOptions, funcOptions) {
|
|
5
|
-
if (rootComponentOptions.customEvents)
|
|
6
|
-
customEventsHandle(finalOptions, rootComponentOptions.customEvents);
|
|
7
|
-
delete rootComponentOptions.customEvents;
|
|
8
|
-
if (rootComponentOptions.events)
|
|
9
|
-
Object.assign(finalOptions.methods, rootComponentOptions.events);
|
|
10
|
-
delete rootComponentOptions.events;
|
|
11
|
-
sameFuncFieldsCollect(rootComponentOptions, funcOptions);
|
|
12
|
-
otherFieldsHandle(finalOptions, rootComponentOptions);
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=rootComponentOptionHandle.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rootComponentOptionHandle.js","sourceRoot":"","sources":["../../../../src/api/DefineComponent/normalizeOptions/rootComponentOptionHandle.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAQhE,MAAM,UAAU,yBAAyB,CACvC,YAAqC,EACrC,oBAA8C,EAC9C,WAA4B;IAG5B,IAAI,oBAAoB,CAAC,YAAY;QAAE,kBAAkB,CAAC,YAAY,EAAE,oBAAoB,CAAC,YAAY,CAAC,CAAC;IAC3G,OAAO,oBAAoB,CAAC,YAAY,CAAC;IACzC,IAAI,oBAAoB,CAAC,MAAM;QAAE,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,oBAAoB,CAAC,MAAM,CAAC,CAAC;IAClG,OAAO,oBAAoB,CAAC,MAAM,CAAC;IACnC,qBAAqB,CAAC,oBAAoB,EAAE,WAAW,CAAC,CAAC;IAEzD,iBAAiB,CAAC,YAAY,EAAE,oBAAoB,CAAC,CAAC;AACxD,CAAC"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { CustomComponentTrueOptions } from "../../CustomComponent";
|
|
2
|
-
import type { FinalOptionsOfComponent, SameFuncOptions } from ".";
|
|
3
|
-
export declare function subComponentsOptionHandle(componentOptions: FinalOptionsOfComponent, subComponents: CustomComponentTrueOptions[], funcOptions: SameFuncOptions): void;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { otherFieldsHandle } from "./otherFieldsHandle";
|
|
2
|
-
import { sameFuncFieldsCollect } from "./sameFuncFieldsCollect";
|
|
3
|
-
export function subComponentsOptionHandle(componentOptions, subComponents, funcOptions) {
|
|
4
|
-
subComponents.forEach((subOption) => {
|
|
5
|
-
if (subOption.events)
|
|
6
|
-
Object.assign(componentOptions.methods, subOption.events);
|
|
7
|
-
sameFuncFieldsCollect(subOption, funcOptions);
|
|
8
|
-
otherFieldsHandle(componentOptions, subOption);
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=subComponentsOptionHandle.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"subComponentsOptionHandle.js","sourceRoot":"","sources":["../../../../src/api/DefineComponent/normalizeOptions/subComponentsOptionHandle.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,MAAM,UAAU,yBAAyB,CACvC,gBAAyC,EACzC,aAA2C,EAC3C,WAA4B;IAE5B,aAAa,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE;QAClC,IAAI,SAAS,CAAC,MAAM;YAAE,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;QAEhF,qBAAqB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;QAE9C,iBAAiB,CAAC,gBAAgB,EAAE,SAAS,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AddNullForObject.js","sourceRoot":"","sources":["../../src/types/AddNullForObject.ts"],"names":[],"mappings":""}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { RootComponentTrueOptions } from "../../RootComponent";
|
|
2
|
-
import type { FinalOptionsOfComponent, SameFuncOptions } from ".";
|
|
3
|
-
import { customEventsHandle } from "./customEventsHandle";
|
|
4
|
-
import { otherFieldsHandle } from "./otherFieldsHandle";
|
|
5
|
-
import { sameFuncFieldsCollect } from "./sameFuncFieldsCollect";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* 收集 rootComponentOptions 配置到 finalOptions 和 funcOptions 中
|
|
9
|
-
* @param finalOptions - 收集配置对象`
|
|
10
|
-
* @param rootComponentOptions - 被收集的源配置对象
|
|
11
|
-
* @param funcOptions - 收集特殊配置对象字段
|
|
12
|
-
*/
|
|
13
|
-
export function rootComponentOptionHandle(
|
|
14
|
-
finalOptions: FinalOptionsOfComponent,
|
|
15
|
-
rootComponentOptions: RootComponentTrueOptions,
|
|
16
|
-
funcOptions: SameFuncOptions,
|
|
17
|
-
) {
|
|
18
|
-
// 自定义事件处理时,如果配置了防抖节流,则需要在data.__throttleDebounce__保留配置信息,以便后续使用
|
|
19
|
-
if (rootComponentOptions.customEvents) customEventsHandle(finalOptions, rootComponentOptions.customEvents);
|
|
20
|
-
delete rootComponentOptions.customEvents;
|
|
21
|
-
if (rootComponentOptions.events) Object.assign(finalOptions.methods, rootComponentOptions.events);
|
|
22
|
-
delete rootComponentOptions.events;
|
|
23
|
-
sameFuncFieldsCollect(rootComponentOptions, funcOptions);
|
|
24
|
-
|
|
25
|
-
otherFieldsHandle(finalOptions, rootComponentOptions);
|
|
26
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
// import type { SlotComponentReturnType } from "../../ChunkComponent/SlotComponentReturnType";
|
|
2
|
-
// import type { FinalOptionsOfComponent, SameFuncOptions } from ".";
|
|
3
|
-
// import { otherFieldsHandle } from "./otherFieldsHandle";
|
|
4
|
-
// import { sameFuncFieldsCollect } from "./sameFuncFieldsCollect";
|
|
5
|
-
|
|
6
|
-
// /**
|
|
7
|
-
// * 收集 rootComponentOptions 配置到 finalOptions 和 funcOptions 中
|
|
8
|
-
// * @param finalOptions - 收集配置对象
|
|
9
|
-
// * @param funcOptions - 收集特殊配置对象字段
|
|
10
|
-
// * @param slotComponentOptions - 被收集的源配置对象
|
|
11
|
-
// */
|
|
12
|
-
// export function slotComponentOptionHandle(
|
|
13
|
-
// finalOptions: FinalOptionsOfComponent,
|
|
14
|
-
// slotComponentOptions: SlotComponentReturnType,
|
|
15
|
-
// funcOptions: SameFuncOptions,
|
|
16
|
-
// ) {
|
|
17
|
-
// if (slotComponentOptions.events) Object.assign(finalOptions.methods, slotComponentOptions.events);
|
|
18
|
-
|
|
19
|
-
// sameFuncFieldsCollect(slotComponentOptions, funcOptions);
|
|
20
|
-
|
|
21
|
-
// otherFieldsHandle(finalOptions, slotComponentOptions);
|
|
22
|
-
// }
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { CustomComponentTrueOptions } from "../../CustomComponent";
|
|
2
|
-
import type { FinalOptionsOfComponent, SameFuncOptions } from ".";
|
|
3
|
-
import { otherFieldsHandle } from "./otherFieldsHandle";
|
|
4
|
-
import { sameFuncFieldsCollect } from "./sameFuncFieldsCollect";
|
|
5
|
-
|
|
6
|
-
export function subComponentsOptionHandle(
|
|
7
|
-
componentOptions: FinalOptionsOfComponent,
|
|
8
|
-
subComponents: CustomComponentTrueOptions[],
|
|
9
|
-
funcOptions: SameFuncOptions,
|
|
10
|
-
) {
|
|
11
|
-
subComponents.forEach((subOption) => {
|
|
12
|
-
if (subOption.events) Object.assign(componentOptions.methods, subOption.events);
|
|
13
|
-
|
|
14
|
-
sameFuncFieldsCollect(subOption, funcOptions);
|
|
15
|
-
|
|
16
|
-
otherFieldsHandle(componentOptions, subOption);
|
|
17
|
-
});
|
|
18
|
-
}
|