annil 1.0.1 → 1.0.4
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 +12 -0
- package/README.md +36 -6
- package/dist/api/DefineComponent/collectOptionsForComponent.d.ts +4 -0
- package/dist/api/DefineComponent/collectOptionsForComponent.js +152 -0
- package/dist/api/DefineComponent/collectOptionsForComponent.js.map +1 -0
- package/dist/api/DefineComponent/index.d.ts +4 -28
- package/dist/api/DefineComponent/index.js +2 -37
- package/dist/api/DefineComponent/index.js.map +1 -1
- package/dist/api/RootComponent/CustomEvents/CustomEventConstraint.d.ts +2 -1
- package/dist/api/RootComponent/Data/DataConstraint.d.ts +1 -0
- package/dist/api/RootComponent/Data/DataConstraint.js +2 -0
- package/dist/api/RootComponent/Data/DataConstraint.js.map +1 -0
- package/dist/api/RootComponent/Lifetimes/LifetimesConstraint.d.ts +2 -2
- package/dist/api/RootComponent/Lifetimes/test/error.test.js +1 -0
- package/dist/api/RootComponent/Lifetimes/test/error.test.js.map +1 -1
- package/dist/api/RootComponent/Lifetimes/test/normal.test.js +3 -0
- package/dist/api/RootComponent/Lifetimes/test/normal.test.js.map +1 -1
- package/dist/api/RootComponent/Properties/test/normalOptional.test.js +15 -0
- package/dist/api/RootComponent/Properties/test/normalOptional.test.js.map +1 -1
- package/dist/api/RootComponent/index.d.ts +19 -2
- package/dist/api/RootComponent/index.js +1 -1
- package/dist/api/RootComponent/index.js.map +1 -1
- package/dist/api/SubComponent/index.d.ts +1 -1
- package/dist/api/SubComponent/index.js.map +1 -1
- package/dist/{utils → behaviors/BComputedAndWatch}/computedUpdater.d.ts +1 -1
- package/dist/{utils → behaviors/BComputedAndWatch}/computedUpdater.js +2 -2
- package/dist/behaviors/BComputedAndWatch/computedUpdater.js.map +1 -0
- package/dist/{utils → behaviors/BComputedAndWatch}/getPathsValue.d.ts +1 -1
- package/dist/behaviors/BComputedAndWatch/getPathsValue.js.map +1 -0
- package/dist/behaviors/BComputedAndWatch/index.js +8 -1
- package/dist/behaviors/BComputedAndWatch/index.js.map +1 -1
- package/dist/behaviors/BComputedAndWatch/initComputed.js +1 -1
- package/dist/behaviors/BComputedAndWatch/initComputed.js.map +1 -1
- package/dist/behaviors/BStore.js.map +1 -1
- package/dist/behaviors/BbeforeCreated.js +1 -2
- package/dist/behaviors/BbeforeCreated.js.map +1 -1
- package/dist/types/OfficialTypeAlias.d.ts +2 -2
- package/package.json +3 -3
- package/src/api/DefineComponent/collectOptionsForComponent.ts +290 -0
- package/src/api/DefineComponent/index.ts +12 -85
- package/src/api/RootComponent/CustomEvents/CustomEventConstraint.ts +3 -1
- package/src/api/RootComponent/Data/DataConstraint.ts +1 -0
- package/src/api/RootComponent/IsPage/IsPageOption.ts +6 -1
- package/src/api/RootComponent/Lifetimes/LifetimesConstraint.ts +2 -2
- package/src/api/RootComponent/Lifetimes/test/error.test.ts +1 -1
- package/src/api/RootComponent/Lifetimes/test/normal.test.ts +3 -3
- package/src/api/RootComponent/Properties/test/normalOptional.test.ts +20 -0
- package/src/api/RootComponent/index.ts +19 -3
- package/src/api/SubComponent/index.ts +2 -3
- package/src/{utils → behaviors/BComputedAndWatch}/computedUpdater.ts +5 -4
- package/src/{utils → behaviors/BComputedAndWatch}/getPathsValue.ts +1 -1
- package/src/behaviors/BComputedAndWatch/index.ts +13 -4
- package/src/behaviors/BComputedAndWatch/initComputed.ts +1 -1
- package/src/behaviors/BStore.ts +2 -2
- package/src/behaviors/BbeforeCreated.ts +3 -3
- package/src/types/OfficialTypeAlias.ts +2 -2
- package/src/types/SpecificType.ts +0 -4
- package/tsconfig.json +6 -15
- package/dist/utils/InternalFieldProtection.d.ts +0 -2
- package/dist/utils/InternalFieldProtection.js +0 -11
- package/dist/utils/InternalFieldProtection.js.map +0 -1
- package/dist/utils/collector.d.ts +0 -5
- package/dist/utils/collector.js +0 -21
- package/dist/utils/collector.js.map +0 -1
- package/dist/utils/computedUpdater.js.map +0 -1
- package/dist/utils/createdHijack.d.ts +0 -0
- package/dist/utils/createdHijack.js +0 -2
- package/dist/utils/createdHijack.js.map +0 -1
- package/dist/utils/customEventsHandle.d.ts +0 -2
- package/dist/utils/customEventsHandle.js +0 -20
- package/dist/utils/customEventsHandle.js.map +0 -1
- package/dist/utils/eventsHandle.d.ts +0 -2
- package/dist/utils/eventsHandle.js +0 -5
- package/dist/utils/eventsHandle.js.map +0 -1
- package/dist/utils/funcConfigHandle.d.ts +0 -2
- package/dist/utils/funcConfigHandle.js +0 -18
- package/dist/utils/funcConfigHandle.js.map +0 -1
- package/dist/utils/getPathsValue.js.map +0 -1
- package/dist/utils/initWatchOldValue.d.ts +0 -2
- package/dist/utils/initWatchOldValue.js +0 -10
- package/dist/utils/initWatchOldValue.js.map +0 -1
- package/dist/utils/onLoadHijack.d.ts +0 -3
- package/dist/utils/onLoadHijack.js +0 -16
- package/dist/utils/onLoadHijack.js.map +0 -1
- package/dist/utils/onLoadReceivedDataHandle.d.ts +0 -3
- package/dist/utils/onLoadReceivedDataHandle.js +0 -14
- package/dist/utils/onLoadReceivedDataHandle.js.map +0 -1
- package/dist/utils/rootComponentFieldHandle.d.ts +0 -3
- package/dist/utils/rootComponentFieldHandle.js +0 -13
- package/dist/utils/rootComponentFieldHandle.js.map +0 -1
- package/dist/utils/subComponentsHandle.d.ts +0 -3
- package/dist/utils/subComponentsHandle.js +0 -12
- package/dist/utils/subComponentsHandle.js.map +0 -1
- package/src/utils/InternalFieldProtection.ts +0 -18
- package/src/utils/collector.ts +0 -41
- package/src/utils/createdHijack.ts +0 -21
- package/src/utils/customEventsHandle.ts +0 -31
- package/src/utils/eventsHandle.ts +0 -10
- package/src/utils/funcConfigHandle.ts +0 -30
- package/src/utils/initWatchOldValue.ts +0 -12
- package/src/utils/onLoadHijack.ts +0 -30
- package/src/utils/onLoadReceivedDataHandle.ts +0 -31
- package/src/utils/rootComponentFieldHandle.ts +0 -27
- package/src/utils/subComponentsHandle.ts +0 -25
- /package/dist/{utils → behaviors/BComputedAndWatch}/getPathsValue.js +0 -0
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { PageInstance } from "../api/RootComponent/Instance/RootComponentInstance";
|
|
2
|
-
import { INNERMARKER } from "./InnerMarker";
|
|
3
|
-
/**
|
|
4
|
-
* 对页面onLoad的参数data处理
|
|
5
|
-
* 1. 多余字段检测
|
|
6
|
-
* 2. 少传字段报错
|
|
7
|
-
* 3. 类型错误报错
|
|
8
|
-
* 针对通过 navigateTo传过来的数据解析
|
|
9
|
-
* @param option - option中的url是拼接了encodeURIComponent转码的data对象的,key为INNERMARKER.url
|
|
10
|
-
*/
|
|
11
|
-
export function onLoadReceivedDataHandle(
|
|
12
|
-
this: PageInstance,
|
|
13
|
-
option: Record<typeof INNERMARKER.url, string>,
|
|
14
|
-
) {
|
|
15
|
-
const innerData: string | undefined = option[INNERMARKER.url];
|
|
16
|
-
// 未使用自定义的navigateTo
|
|
17
|
-
if (innerData === undefined) return;
|
|
18
|
-
const optionData = JSON.parse(decodeURIComponent(innerData));
|
|
19
|
-
|
|
20
|
-
// 使用navigateTo
|
|
21
|
-
for (const key in optionData) {
|
|
22
|
-
option[key] = optionData[key];
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// setData会触发计算属性 继承属性等 。
|
|
26
|
-
this.setData(option as any);
|
|
27
|
-
|
|
28
|
-
delete option[INNERMARKER.url];
|
|
29
|
-
|
|
30
|
-
delete this.data[INNERMARKER.url];
|
|
31
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { ComponentOptions, FuncConfig } from "../api/DefineComponent";
|
|
2
|
-
import type { RootComponentDoc } from "../api/RootComponent/RootComponentDoc";
|
|
3
|
-
import { funcFieldsCollect, otherFieldsHandle } from "./collector";
|
|
4
|
-
|
|
5
|
-
import { customEventsHandle } from "./customEventsHandle";
|
|
6
|
-
import { eventsHandle } from "./eventsHandle";
|
|
7
|
-
|
|
8
|
-
export function rootComponentFieldHandle(
|
|
9
|
-
rootComponentConfig: RootComponentDoc,
|
|
10
|
-
componentOptions: ComponentOptions,
|
|
11
|
-
funcConfig: FuncConfig,
|
|
12
|
-
) {
|
|
13
|
-
rootComponentConfig.customEvents && customEventsHandle(componentOptions, rootComponentConfig.customEvents);
|
|
14
|
-
|
|
15
|
-
rootComponentConfig.events && eventsHandle(componentOptions, rootComponentConfig.events);
|
|
16
|
-
|
|
17
|
-
// 框架不支持测试页面
|
|
18
|
-
/* istanbul ignore next */
|
|
19
|
-
rootComponentConfig.pageLifetimes
|
|
20
|
-
&& funcFieldsCollect(rootComponentConfig.pageLifetimes, funcConfig, "pageLifetimes");
|
|
21
|
-
|
|
22
|
-
rootComponentConfig.lifetimes && funcFieldsCollect(rootComponentConfig.lifetimes, funcConfig, "lifetimes");
|
|
23
|
-
|
|
24
|
-
rootComponentConfig.watch && funcFieldsCollect(rootComponentConfig.watch, funcConfig, "watch");
|
|
25
|
-
|
|
26
|
-
otherFieldsHandle(componentOptions, rootComponentConfig);
|
|
27
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { ComponentOptions, FuncConfig } from "../api/DefineComponent";
|
|
2
|
-
import type { SubComponentOptions } from "../api/SubComponent";
|
|
3
|
-
import { funcFieldsCollect, otherFieldsHandle } from "./collector";
|
|
4
|
-
|
|
5
|
-
import { eventsHandle } from "./eventsHandle";
|
|
6
|
-
|
|
7
|
-
export function subComponentsHandle(
|
|
8
|
-
componentOptions: ComponentOptions,
|
|
9
|
-
subComponents: SubComponentOptions[],
|
|
10
|
-
funcConfig: FuncConfig,
|
|
11
|
-
) {
|
|
12
|
-
subComponents.forEach((subOption) => {
|
|
13
|
-
subOption.events && eventsHandle(componentOptions, subOption.events);
|
|
14
|
-
|
|
15
|
-
// 框架不支持测试页面
|
|
16
|
-
/* istanbul ignore next */
|
|
17
|
-
subOption.pageLifetimes && funcFieldsCollect(subOption.pageLifetimes, funcConfig, "pageLifetimes");
|
|
18
|
-
|
|
19
|
-
subOption.lifetimes && funcFieldsCollect(subOption.lifetimes, funcConfig, "lifetimes");
|
|
20
|
-
|
|
21
|
-
subOption.watch && funcFieldsCollect(subOption.watch, funcConfig, "watch");
|
|
22
|
-
|
|
23
|
-
otherFieldsHandle(componentOptions, subOption);
|
|
24
|
-
});
|
|
25
|
-
}
|
|
File without changes
|