annil 1.15.1 → 1.17.0
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 +14 -0
- package/README.md +0 -2
- package/dist/api/DefineComponent/SubComponents/SubComponentsOption.d.ts +3 -3
- package/dist/api/DefineComponent/index.d.ts +4 -4
- package/dist/api/DefineComponent/normalizeOptions/__throttleDebounce__FieldCheck.d.ts +2 -3
- package/dist/api/DefineComponent/normalizeOptions/__throttleDebounce__FieldCheck.js.map +1 -1
- package/dist/api/DefineComponent/normalizeOptions/handleSubComponents.d.ts +2 -2
- package/dist/api/DefineComponent/normalizeOptions/handleSubComponents.js.map +1 -1
- package/dist/api/DefineComponent/normalizeOptions/initComputed/index.js.map +1 -1
- package/dist/api/DefineComponent/normalizeOptions/injectInfoHandler.js +1 -1
- package/dist/api/DefineComponent/normalizeOptions/injectInfoHandler.js.map +1 -1
- package/dist/api/DefineComponent/normalizeOptions/sameFuncFieldsCollect.d.ts +2 -2
- package/dist/api/DefineComponent/normalizeOptions/sameFuncFieldsCollect.js.map +1 -1
- package/dist/api/DefineComponent/normalizeOptions/watchHandler/index.js +3 -3
- package/dist/api/DefineComponent/normalizeOptions/watchHandler/index.js.map +1 -1
- package/dist/api/DefineComponent/returnType/GenerateComponentDoc.d.ts +2 -2
- package/dist/api/DefineComponent/returnType/GetCustomEventDocOfSubDoc.d.ts +3 -3
- package/dist/api/InstanceInject/instanceConfig.d.ts +2 -2
- package/dist/api/InstanceInject/instanceConfig.js.map +1 -1
- package/dist/api/RootComponent/PageLifetimes/PageLifetimesOption.d.ts +1 -3
- package/dist/api/RootComponent/index.d.ts +3 -3
- package/dist/api/RootComponent/index.js.map +1 -1
- package/dist/api/SubComponent/SubComputed/GetSubComputedDoc.d.ts +3 -0
- package/dist/api/SubComponent/SubComputed/GetSubComputedDoc.js +2 -0
- package/dist/api/SubComponent/SubComputed/GetSubComputedDoc.js.map +1 -0
- package/dist/api/SubComponent/SubComputed/SubComputedConstraint.d.ts +3 -0
- package/dist/api/SubComponent/SubComputed/SubComputedConstraint.js +2 -0
- package/dist/api/SubComponent/SubComputed/SubComputedConstraint.js.map +1 -0
- package/dist/api/{CustomComponent/CustomComputed/CustomComputedOption.d.ts → SubComponent/SubComputed/SubComputedOption.d.ts} +1 -1
- package/dist/api/SubComponent/SubComputed/SubComputedOption.js +2 -0
- package/dist/api/SubComponent/SubComputed/SubComputedOption.js.map +1 -0
- package/dist/api/SubComponent/SubData/SubDataConstraint.d.ts +3 -0
- package/dist/api/SubComponent/SubData/SubDataConstraint.js +2 -0
- package/dist/api/SubComponent/SubData/SubDataConstraint.js.map +1 -0
- package/dist/api/{CustomComponent/CustomData/CustomDataOption.d.ts → SubComponent/SubData/SubDataOption.d.ts} +1 -1
- package/dist/api/SubComponent/SubData/SubDataOption.js +2 -0
- package/dist/api/SubComponent/SubData/SubDataOption.js.map +1 -0
- package/dist/api/{CustomComponent/CustomEvents/CustomEventsConstraint.d.ts → SubComponent/SubEvents/SubEventsConstraint.d.ts} +1 -1
- package/dist/api/SubComponent/SubEvents/SubEventsConstraint.js +2 -0
- package/dist/api/SubComponent/SubEvents/SubEventsConstraint.js.map +1 -0
- package/dist/api/{CustomComponent/CustomEvents/CustomEventsOption.d.ts → SubComponent/SubEvents/SubEventsOption.d.ts} +1 -1
- package/dist/api/SubComponent/SubEvents/SubEventsOption.js +2 -0
- package/dist/api/SubComponent/SubEvents/SubEventsOption.js.map +1 -0
- package/dist/api/{CustomComponent/CustomInherit/CustomInheritConstraint.d.ts → SubComponent/SubInherit/SubInheritConstraint.d.ts} +1 -1
- package/dist/api/SubComponent/SubInherit/SubInheritConstraint.js +2 -0
- package/dist/api/SubComponent/SubInherit/SubInheritConstraint.js.map +1 -0
- package/dist/api/{CustomComponent/CustomInherit/CustomInheritOption.d.ts → SubComponent/SubInherit/SubInheritOption.d.ts} +1 -1
- package/dist/api/SubComponent/SubInherit/SubInheritOption.js +2 -0
- package/dist/api/SubComponent/SubInherit/SubInheritOption.js.map +1 -0
- package/dist/api/SubComponent/SubInstance/SubInstance.d.ts +2 -0
- package/dist/api/SubComponent/SubInstance/SubInstance.js.map +1 -0
- package/dist/api/{CustomComponent/CustomLifetimes → SubComponent/SubLifetimes}/SubLifetimesOption.d.ts +1 -1
- package/dist/api/SubComponent/SubLifetimes/SubLifetimesOption.js.map +1 -0
- package/dist/api/SubComponent/SubMethods/SubMethodsConstraint.d.ts +2 -0
- package/dist/api/SubComponent/SubMethods/SubMethodsConstraint.js +2 -0
- package/dist/api/SubComponent/SubMethods/SubMethodsConstraint.js.map +1 -0
- package/dist/api/SubComponent/SubMethods/SubMethodsOption.d.ts +5 -0
- package/dist/api/SubComponent/SubMethods/SubMethodsOption.js +2 -0
- package/dist/api/SubComponent/SubMethods/SubMethodsOption.js.map +1 -0
- package/dist/api/SubComponent/SubObservers/SubObserversOption.d.ts +2 -0
- package/dist/api/SubComponent/SubObservers/SubObserversOption.js +2 -0
- package/dist/api/SubComponent/SubObservers/SubObserversOption.js.map +1 -0
- package/dist/api/SubComponent/SubPageLifetimes/SubPageLifetimesOption.d.ts +2 -0
- package/dist/api/SubComponent/SubPageLifetimes/SubPageLifetimesOption.js +2 -0
- package/dist/api/SubComponent/SubPageLifetimes/SubPageLifetimesOption.js.map +1 -0
- package/dist/api/{CustomComponent/CustomReturnType/CreateCustomComponentDoc.d.ts → SubComponent/SubReturnType/CreateSubComponentDoc.d.ts} +1 -1
- package/dist/api/SubComponent/SubReturnType/CreateSubComponentDoc.js +2 -0
- package/dist/api/SubComponent/SubReturnType/CreateSubComponentDoc.js.map +1 -0
- package/dist/api/{CustomComponent/CustomStore/CustomStoreConstraint.d.ts → SubComponent/SubStore/SubStoreConstraint.d.ts} +1 -1
- package/dist/api/SubComponent/SubStore/SubStoreConstraint.js +2 -0
- package/dist/api/SubComponent/SubStore/SubStoreConstraint.js.map +1 -0
- package/dist/api/{CustomComponent/CustomStore/CustomStoreOption.d.ts → SubComponent/SubStore/SubStoreOption.d.ts} +1 -1
- package/dist/api/SubComponent/SubStore/SubStoreOption.js +2 -0
- package/dist/api/SubComponent/SubStore/SubStoreOption.js.map +1 -0
- package/dist/api/SubComponent/SubWatch/SubWatchOption.d.ts +2 -0
- package/dist/api/SubComponent/SubWatch/SubWatchOption.js +2 -0
- package/dist/api/SubComponent/SubWatch/SubWatchOption.js.map +1 -0
- package/dist/api/SubComponent/index.d.ts +49 -0
- package/dist/api/SubComponent/index.js +4 -0
- package/dist/api/SubComponent/index.js.map +1 -0
- package/dist/api/{CustomComponent → SubComponent}/returnType.d.ts +3 -3
- package/dist/api/SubComponent/returnType.js.map +1 -0
- package/dist/index.d.ts +2 -3
- package/dist/index.js +2 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/api/DefineComponent/SubComponents/SubComponentsOption.ts +3 -4
- package/src/api/DefineComponent/SubComponents/test/normal.test.ts +3 -3
- package/src/api/DefineComponent/index.ts +8 -8
- package/src/api/DefineComponent/normalizeOptions/__throttleDebounce__FieldCheck.ts +2 -3
- package/src/api/DefineComponent/normalizeOptions/handleSubComponents.ts +2 -2
- package/src/api/DefineComponent/normalizeOptions/initComputed/index.ts +0 -9
- package/src/api/DefineComponent/normalizeOptions/injectInfoHandler.ts +1 -1
- package/src/api/DefineComponent/normalizeOptions/sameFuncFieldsCollect.ts +2 -2
- package/src/api/DefineComponent/normalizeOptions/watchHandler/index.ts +6 -3
- package/src/api/DefineComponent/returnType/GenerateComponentDoc.ts +2 -2
- package/src/api/DefineComponent/returnType/GetCustomEventDocOfSubDoc.ts +4 -4
- package/src/api/DefineComponent/returnType/test/normalComponentDoc.test.ts +6 -6
- package/src/api/InstanceInject/inject.ts +7 -2
- package/src/api/InstanceInject/instanceConfig.ts +3 -4
- package/src/api/InstanceInject/test/normal.test.ts +7 -6
- package/src/api/RootComponent/Instance/test/datas/mormal.test.ts +43 -0
- package/src/api/RootComponent/Instance/test/methods/mormal.test.ts +11 -2
- package/src/api/RootComponent/Instance/test/properties/mormal.test.ts +1 -1
- package/src/api/RootComponent/PageLifetimes/PageLifetimesOption.ts +1 -4
- package/src/api/RootComponent/PageLifetimes/test/normal.test.ts +3 -31
- package/src/api/RootComponent/Store/test/normal.test.ts +24 -4
- package/src/api/RootComponent/index.ts +20 -7
- package/src/api/{CustomComponent/CustomComputed/GetCustomComputedDoc.ts → SubComponent/SubComputed/GetSubComputedDoc.ts} +1 -1
- package/src/api/SubComponent/SubComputed/SubComputedConstraint.ts +1 -0
- package/src/api/{CustomComponent/CustomComputed/CustomComputedOption.ts → SubComponent/SubComputed/SubComputedOption.ts} +1 -1
- package/src/api/{CustomComponent/CustomComputed → SubComponent/SubComputed}/test/error.test.ts +7 -7
- package/src/api/{CustomComponent/CustomComputed → SubComponent/SubComputed}/test/normal.test.ts +9 -9
- package/src/api/{CustomComponent/CustomData/CustomDataConstraint.ts → SubComponent/SubData/SubDataConstraint.ts} +1 -1
- package/src/api/{CustomComponent/CustomData/CustomDataOption.ts → SubComponent/SubData/SubDataOption.ts} +1 -1
- package/src/api/{CustomComponent/CustomData → SubComponent/SubData}/test/error.test.ts +5 -5
- package/src/api/{CustomComponent/CustomData → SubComponent/SubData}/test/normal.test.ts +6 -6
- package/src/api/{CustomComponent/CustomEvents/CustomEventsConstraint.ts → SubComponent/SubEvents/SubEventsConstraint.ts} +1 -1
- package/src/api/{CustomComponent/CustomEvents/CustomEventsOption.ts → SubComponent/SubEvents/SubEventsOption.ts} +1 -1
- package/src/api/{CustomComponent/CustomEvents → SubComponent/SubEvents}/test/error.test.ts +3 -3
- package/src/api/{CustomComponent/CustomEvents → SubComponent/SubEvents}/test/normal.test.ts +10 -10
- package/src/api/{CustomComponent/CustomInherit/CustomInheritConstraint.ts → SubComponent/SubInherit/SubInheritConstraint.ts} +1 -1
- package/src/api/{CustomComponent/CustomInherit/CustomInheritOption.ts → SubComponent/SubInherit/SubInheritOption.ts} +1 -1
- package/src/api/{CustomComponent/CustomInherit → SubComponent/SubInherit}/test/error.test.ts +7 -7
- package/src/api/{CustomComponent/CustomInherit → SubComponent/SubInherit}/test/normal.test.ts +5 -5
- package/src/api/{CustomComponent/CustomInstance → SubComponent/SubInstance}/SubInstance.ts +1 -1
- package/src/api/{CustomComponent/CustomInstance → SubComponent/SubInstance}/test/error.test.ts +2 -2
- package/src/api/{CustomComponent/CustomInstance → SubComponent/SubInstance}/test/normal.test.ts +2 -2
- package/src/api/{CustomComponent/CustomLifetimes → SubComponent/SubLifetimes}/SubLifetimesOption.ts +1 -1
- package/src/api/SubComponent/SubMethods/SubMethodsConstraint.ts +3 -0
- package/src/api/{CustomComponent/CustomMethods/CustomMethodsOption.ts → SubComponent/SubMethods/SubMethodsOption.ts} +3 -3
- package/src/api/{CustomComponent/CustomMethods → SubComponent/SubMethods}/test/error.test.ts +3 -3
- package/src/api/{CustomComponent/CustomMethods → SubComponent/SubMethods}/test/normarl.test.ts +3 -3
- package/src/api/SubComponent/SubObservers/SubObserversOption.ts +3 -0
- package/src/api/{CustomComponent/CustomPageLifetimes/CustomPageLifetimesOption.ts → SubComponent/SubPageLifetimes/SubPageLifetimesOption.ts} +1 -1
- package/src/api/{CustomComponent/CustomReturnType/CreateCustomComponentDoc.ts → SubComponent/SubReturnType/CreateSubComponentDoc.ts} +1 -1
- package/src/api/{CustomComponent/CustomReturnType → SubComponent/SubReturnType}/test/error.test.ts +2 -2
- package/src/api/{CustomComponent/CustomReturnType → SubComponent/SubReturnType}/test/normal.test.ts +4 -4
- package/src/api/{CustomComponent/CustomStore/CustomStoreConstraint.ts → SubComponent/SubStore/SubStoreConstraint.ts} +1 -1
- package/src/api/{CustomComponent/CustomStore/CustomStoreOption.ts → SubComponent/SubStore/SubStoreOption.ts} +1 -1
- package/src/api/{CustomComponent/CustomStore → SubComponent/SubStore}/test/error.test.ts +4 -4
- package/src/api/{CustomComponent/CustomStore → SubComponent/SubStore}/test/normal.test.ts +5 -5
- package/src/api/SubComponent/SubWatch/SubWatchOption.ts +3 -0
- package/src/api/{CustomComponent/CustomWatch → SubComponent/SubWatch}/test/WatchComputed.test.ts +2 -2
- package/src/api/{CustomComponent/CustomWatch → SubComponent/SubWatch}/test/WatchProperties.test.ts +2 -2
- package/src/api/{CustomComponent/CustomWatch → SubComponent/SubWatch}/test/WatchRootData.test.ts +2 -2
- package/src/api/{CustomComponent/CustomWatch → SubComponent/SubWatch}/test/WatchSubData.test.ts +3 -3
- package/src/api/{CustomComponent/CustomWatch → SubComponent/SubWatch}/test/WtachInject.test.ts +2 -2
- package/src/api/{CustomComponent/CustomWatch → SubComponent/SubWatch}/test/error.test.ts +5 -5
- package/src/api/{CustomComponent → SubComponent}/index.ts +49 -49
- package/src/api/{CustomComponent → SubComponent}/returnType.ts +6 -6
- package/src/index.ts +2 -4
- package/src/thirdLib/wm/swiper.test.ts +2 -2
- package/dist/api/ChunkComponent/ChunkComputed/ChunkComputedConstraint.d.ts +0 -1
- package/dist/api/ChunkComponent/ChunkComputed/ChunkComputedConstraint.js +0 -2
- package/dist/api/ChunkComponent/ChunkComputed/ChunkComputedConstraint.js.map +0 -1
- package/dist/api/ChunkComponent/ChunkComputed/ChunkComputedOption.d.ts +0 -10
- package/dist/api/ChunkComponent/ChunkComputed/ChunkComputedOption.js +0 -2
- package/dist/api/ChunkComponent/ChunkComputed/ChunkComputedOption.js.map +0 -1
- package/dist/api/ChunkComponent/ChunkData/chunkDataOption.d.ts +0 -9
- package/dist/api/ChunkComponent/ChunkData/chunkDataOption.js +0 -2
- package/dist/api/ChunkComponent/ChunkData/chunkDataOption.js.map +0 -1
- package/dist/api/ChunkComponent/ChunkData/validatePrefix.d.ts +0 -2
- package/dist/api/ChunkComponent/ChunkData/validatePrefix.js +0 -2
- package/dist/api/ChunkComponent/ChunkData/validatePrefix.js.map +0 -1
- package/dist/api/ChunkComponent/ChunkMethods/ChunkMethodsOption.d.ts +0 -10
- package/dist/api/ChunkComponent/ChunkMethods/ChunkMethodsOption.js +0 -2
- package/dist/api/ChunkComponent/ChunkMethods/ChunkMethodsOption.js.map +0 -1
- package/dist/api/ChunkComponent/ChunkStore/ChunkStoreConstraint.d.ts +0 -2
- package/dist/api/ChunkComponent/ChunkStore/ChunkStoreConstraint.js +0 -2
- package/dist/api/ChunkComponent/ChunkStore/ChunkStoreConstraint.js.map +0 -1
- package/dist/api/ChunkComponent/ChunkStore/ChunkStoreOption.d.ts +0 -12
- package/dist/api/ChunkComponent/ChunkStore/ChunkStoreOption.js +0 -2
- package/dist/api/ChunkComponent/ChunkStore/ChunkStoreOption.js.map +0 -1
- package/dist/api/ChunkComponent/ChunklEvents/ChunkEventsConstraint.d.ts +0 -2
- package/dist/api/ChunkComponent/ChunklEvents/ChunkEventsConstraint.js +0 -2
- package/dist/api/ChunkComponent/ChunklEvents/ChunkEventsConstraint.js.map +0 -1
- package/dist/api/ChunkComponent/ChunklEvents/ChunkEventsOption.d.ts +0 -10
- package/dist/api/ChunkComponent/ChunklEvents/ChunkEventsOption.js +0 -2
- package/dist/api/ChunkComponent/ChunklEvents/ChunkEventsOption.js.map +0 -1
- package/dist/api/ChunkComponent/SlotComponentReturnType.d.ts +0 -20
- package/dist/api/ChunkComponent/SlotComponentReturnType.js +0 -2
- package/dist/api/ChunkComponent/SlotComponentReturnType.js.map +0 -1
- package/dist/api/ChunkComponent/index.d.ts +0 -24
- package/dist/api/ChunkComponent/index.js +0 -4
- package/dist/api/ChunkComponent/index.js.map +0 -1
- package/dist/api/CustomComponent/CustomComputed/CustomComputedConstraint.d.ts +0 -3
- package/dist/api/CustomComponent/CustomComputed/CustomComputedConstraint.js +0 -2
- package/dist/api/CustomComponent/CustomComputed/CustomComputedConstraint.js.map +0 -1
- package/dist/api/CustomComponent/CustomComputed/CustomComputedOption.js +0 -2
- package/dist/api/CustomComponent/CustomComputed/CustomComputedOption.js.map +0 -1
- package/dist/api/CustomComponent/CustomComputed/GetCustomComputedDoc.d.ts +0 -3
- package/dist/api/CustomComponent/CustomComputed/GetCustomComputedDoc.js +0 -2
- package/dist/api/CustomComponent/CustomComputed/GetCustomComputedDoc.js.map +0 -1
- package/dist/api/CustomComponent/CustomData/CustomDataConstraint.d.ts +0 -3
- package/dist/api/CustomComponent/CustomData/CustomDataConstraint.js +0 -2
- package/dist/api/CustomComponent/CustomData/CustomDataConstraint.js.map +0 -1
- package/dist/api/CustomComponent/CustomData/CustomDataOption.js +0 -2
- package/dist/api/CustomComponent/CustomData/CustomDataOption.js.map +0 -1
- package/dist/api/CustomComponent/CustomEvents/CustomEventsConstraint.js +0 -2
- package/dist/api/CustomComponent/CustomEvents/CustomEventsConstraint.js.map +0 -1
- package/dist/api/CustomComponent/CustomEvents/CustomEventsOption.js +0 -2
- package/dist/api/CustomComponent/CustomEvents/CustomEventsOption.js.map +0 -1
- package/dist/api/CustomComponent/CustomInherit/CustomInheritConstraint.js +0 -2
- package/dist/api/CustomComponent/CustomInherit/CustomInheritConstraint.js.map +0 -1
- package/dist/api/CustomComponent/CustomInherit/CustomInheritOption.js +0 -2
- package/dist/api/CustomComponent/CustomInherit/CustomInheritOption.js.map +0 -1
- package/dist/api/CustomComponent/CustomInstance/SubInstance.d.ts +0 -2
- package/dist/api/CustomComponent/CustomInstance/SubInstance.js.map +0 -1
- package/dist/api/CustomComponent/CustomLifetimes/SubLifetimesOption.js.map +0 -1
- package/dist/api/CustomComponent/CustomMethods/CustomMethodsConstraint.d.ts +0 -2
- package/dist/api/CustomComponent/CustomMethods/CustomMethodsConstraint.js +0 -2
- package/dist/api/CustomComponent/CustomMethods/CustomMethodsConstraint.js.map +0 -1
- package/dist/api/CustomComponent/CustomMethods/CustomMethodsOption.d.ts +0 -5
- package/dist/api/CustomComponent/CustomMethods/CustomMethodsOption.js +0 -2
- package/dist/api/CustomComponent/CustomMethods/CustomMethodsOption.js.map +0 -1
- package/dist/api/CustomComponent/CustomObservers/CustomObserversOption.d.ts +0 -2
- package/dist/api/CustomComponent/CustomObservers/CustomObserversOption.js +0 -2
- package/dist/api/CustomComponent/CustomObservers/CustomObserversOption.js.map +0 -1
- package/dist/api/CustomComponent/CustomPageLifetimes/CustomPageLifetimesOption.d.ts +0 -2
- package/dist/api/CustomComponent/CustomPageLifetimes/CustomPageLifetimesOption.js +0 -2
- package/dist/api/CustomComponent/CustomPageLifetimes/CustomPageLifetimesOption.js.map +0 -1
- package/dist/api/CustomComponent/CustomReturnType/CreateCustomComponentDoc.js +0 -2
- package/dist/api/CustomComponent/CustomReturnType/CreateCustomComponentDoc.js.map +0 -1
- package/dist/api/CustomComponent/CustomStore/CustomStoreConstraint.js +0 -2
- package/dist/api/CustomComponent/CustomStore/CustomStoreConstraint.js.map +0 -1
- package/dist/api/CustomComponent/CustomStore/CustomStoreOption.js +0 -2
- package/dist/api/CustomComponent/CustomStore/CustomStoreOption.js.map +0 -1
- package/dist/api/CustomComponent/CustomWatch/CustomWatchOption.d.ts +0 -2
- package/dist/api/CustomComponent/CustomWatch/CustomWatchOption.js +0 -2
- package/dist/api/CustomComponent/CustomWatch/CustomWatchOption.js.map +0 -1
- package/dist/api/CustomComponent/index.d.ts +0 -49
- package/dist/api/CustomComponent/index.js +0 -4
- package/dist/api/CustomComponent/index.js.map +0 -1
- package/dist/api/CustomComponent/returnType.js.map +0 -1
- package/src/api/ChunkComponent/ChunkComputed/ChunkComputedConstraint.ts +0 -1
- package/src/api/ChunkComponent/ChunkComputed/ChunkComputedOption.ts +0 -46
- package/src/api/ChunkComponent/ChunkComputed/GetChunkComputedDoc.ts +0 -9
- package/src/api/ChunkComponent/ChunkComputed/test/SlotGetComputedDoc.test.ts +0 -25
- package/src/api/ChunkComponent/ChunkComputed/test/error.test.ts +0 -33
- package/src/api/ChunkComponent/ChunkComputed/test/mock.ts +0 -37
- package/src/api/ChunkComponent/ChunkComputed/test/normal.test.ts +0 -86
- package/src/api/ChunkComponent/ChunkData/chunkDataConstraint.ts +0 -9
- package/src/api/ChunkComponent/ChunkData/chunkDataOption.ts +0 -17
- package/src/api/ChunkComponent/ChunkData/test/error.test.ts +0 -28
- package/src/api/ChunkComponent/ChunkData/test/mock.ts +0 -44
- package/src/api/ChunkComponent/ChunkData/test/normal.test.ts +0 -18
- package/src/api/ChunkComponent/ChunkData/validatePrefix.ts +0 -4
- package/src/api/ChunkComponent/ChunkLifetimes/ChunkLifetimes.test.ts +0 -24
- package/src/api/ChunkComponent/ChunkLifetimes/ChunkPageLifetimes.test.ts +0 -26
- package/src/api/ChunkComponent/ChunkMethods/ChunkMethodsOption.ts +0 -27
- package/src/api/ChunkComponent/ChunkMethods/test/error.test.ts +0 -31
- package/src/api/ChunkComponent/ChunkMethods/test/normal.test.ts +0 -21
- package/src/api/ChunkComponent/ChunkStore/ChunkStoreConstraint.ts +0 -3
- package/src/api/ChunkComponent/ChunkStore/ChunkStoreOption.ts +0 -33
- package/src/api/ChunkComponent/ChunkStore/test/error.test.ts +0 -36
- package/src/api/ChunkComponent/ChunkStore/test/mock.ts +0 -32
- package/src/api/ChunkComponent/ChunkStore/test/normal.test.ts +0 -52
- package/src/api/ChunkComponent/ChunkWatch/test/error.test.ts +0 -28
- package/src/api/ChunkComponent/ChunkWatch/test/normal.test.ts +0 -58
- package/src/api/ChunkComponent/ChunklEvents/ChunkEventsConstraint.ts +0 -3
- package/src/api/ChunkComponent/ChunklEvents/ChunkEventsOption.ts +0 -27
- package/src/api/ChunkComponent/ChunklEvents/test/error.test.ts +0 -24
- package/src/api/ChunkComponent/ChunklEvents/test/normal.test.ts +0 -26
- package/src/api/ChunkComponent/SlotComponentReturnType.ts +0 -32
- package/src/api/ChunkComponent/index.ts +0 -165
- package/src/api/CustomComponent/CustomComputed/CustomComputedConstraint.ts +0 -1
- package/src/api/CustomComponent/CustomMethods/CustomMethodsConstraint.ts +0 -3
- package/src/api/CustomComponent/CustomObservers/CustomObserversOption.ts +0 -3
- package/src/api/CustomComponent/CustomWatch/CustomWatchOption.ts +0 -3
- /package/dist/api/{CustomComponent/CustomInstance → SubComponent/SubInstance}/SubInstance.js +0 -0
- /package/dist/api/{CustomComponent/CustomLifetimes → SubComponent/SubLifetimes}/SubLifetimesOption.js +0 -0
- /package/dist/api/{CustomComponent → SubComponent}/returnType.js +0 -0
- /package/src/api/{CustomComponent/CustomPageLifetimes → SubComponent/SubPageLifetimes}/test/error.test.ts +0 -0
- /package/src/api/{CustomComponent/CustomPageLifetimes → SubComponent/SubPageLifetimes}/test/normal.test.ts +0 -0
|
@@ -2,10 +2,7 @@ import { Checking, type Test } from "hry-types";
|
|
|
2
2
|
import { type DetailedType, RootComponent } from "../../../..";
|
|
3
3
|
|
|
4
4
|
import type { Mock_User } from "../../Properties/test/normalRequired.test";
|
|
5
|
-
|
|
6
|
-
name: string;
|
|
7
|
-
age?: number;
|
|
8
|
-
};
|
|
5
|
+
|
|
9
6
|
/**
|
|
10
7
|
* 组件时
|
|
11
8
|
*/
|
|
@@ -49,8 +46,8 @@ RootComponent()({
|
|
|
49
46
|
void Checking<
|
|
50
47
|
typeof props,
|
|
51
48
|
{
|
|
52
|
-
union
|
|
53
|
-
optionalObject
|
|
49
|
+
union: Mock_User;
|
|
50
|
+
optionalObject: Mock_User | null;
|
|
54
51
|
str: string;
|
|
55
52
|
obj: object;
|
|
56
53
|
},
|
|
@@ -72,28 +69,3 @@ RootComponent()({
|
|
|
72
69
|
// ...
|
|
73
70
|
},
|
|
74
71
|
});
|
|
75
|
-
// prop中必传对象没有null,但在实例中却需要有null
|
|
76
|
-
RootComponent()({
|
|
77
|
-
isPage: true,
|
|
78
|
-
properties: {
|
|
79
|
-
optionalObj: {
|
|
80
|
-
type: Object,
|
|
81
|
-
value: {},
|
|
82
|
-
},
|
|
83
|
-
requiredObj: Object as DetailedType<User>,
|
|
84
|
-
},
|
|
85
|
-
|
|
86
|
-
pageLifetimes: {
|
|
87
|
-
onLoad(prop) {
|
|
88
|
-
void prop;
|
|
89
|
-
// 页面外部传值时没必要传null,组件时有需要的。
|
|
90
|
-
void Checking<typeof prop.requiredObj, User, true>;
|
|
91
|
-
// 虽然传值不应该是null,但由于实例建立时默认为null,所以实例类型加上null
|
|
92
|
-
void Checking<typeof this.data.requiredObj, User, true>;
|
|
93
|
-
// 页面传入的可选对象不需要null,有undefined
|
|
94
|
-
void Checking<typeof prop.optionalObj, object | undefined, true>;
|
|
95
|
-
// 实例中的可选对象不需要null,有默认值。
|
|
96
|
-
void Checking<typeof this.data.optionalObj, object, true>;
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Checking, type Test } from "hry-types";
|
|
1
2
|
import { observable } from "mobx";
|
|
2
3
|
import { typeEqual } from "../../../../utils/_utils";
|
|
3
4
|
import { RootComponent } from "../..";
|
|
@@ -9,15 +10,30 @@ const user = observable({
|
|
|
9
10
|
const storeDoc = RootComponent()({
|
|
10
11
|
properties: {
|
|
11
12
|
condition: Number,
|
|
13
|
+
optional: {
|
|
14
|
+
type: Number,
|
|
15
|
+
value: 10,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
data: {
|
|
19
|
+
injectStr: 123,
|
|
12
20
|
},
|
|
13
21
|
store: {
|
|
14
|
-
//
|
|
22
|
+
// 1. 简单的箭头函数写法
|
|
15
23
|
userName: () => user.name,
|
|
16
|
-
//
|
|
17
|
-
userAge: (
|
|
18
|
-
|
|
24
|
+
// 2. 使用参数 datas
|
|
25
|
+
userAge: (datas) => {
|
|
26
|
+
// 参数类型为Required<PropertiesDef> & DataDef & Omit<InjectData, keyof (PropertiesDef & DataDef).
|
|
27
|
+
Checking<
|
|
28
|
+
typeof datas,
|
|
29
|
+
{ condition: number; optional: number; injectStr: number; injectNum: number },
|
|
30
|
+
Test.Pass
|
|
31
|
+
>();
|
|
32
|
+
|
|
33
|
+
if (datas.condition > 10) {
|
|
19
34
|
return user.age;
|
|
20
35
|
}
|
|
36
|
+
// 返回undefined时字段不会被响应式追踪,不会报错(有警告).
|
|
21
37
|
return undefined;
|
|
22
38
|
},
|
|
23
39
|
},
|
|
@@ -25,8 +41,12 @@ const storeDoc = RootComponent()({
|
|
|
25
41
|
|
|
26
42
|
type StoreDocExpected = {
|
|
27
43
|
properties: {
|
|
44
|
+
optional?: number;
|
|
28
45
|
condition: number;
|
|
29
46
|
};
|
|
47
|
+
data: {
|
|
48
|
+
injectStr: number;
|
|
49
|
+
};
|
|
30
50
|
store: {
|
|
31
51
|
userName: string;
|
|
32
52
|
userAge: number | undefined;
|
|
@@ -6,7 +6,7 @@ import type { ComputeObject } from "../../types/ComputeObject";
|
|
|
6
6
|
import type { WMCompOtherOption } from "../../types/OfficialTypeAlias";
|
|
7
7
|
import type { RemoveNullOfRequired } from "../../types/RemoveNullOfRequired";
|
|
8
8
|
import type { ComponentDoc } from "../DefineComponent/returnType/ComponentDoc";
|
|
9
|
-
import type { IInjectStore } from "../InstanceInject/instanceConfig";
|
|
9
|
+
import type { IInjectAllData, IInjectMethods, IInjectStore, InjectData } from "../InstanceInject/instanceConfig";
|
|
10
10
|
import type { ComputedConstraint } from "./Computed/ComputedConstraint";
|
|
11
11
|
import type { ComputedOption } from "./Computed/ComputedOption";
|
|
12
12
|
import type { GetComputedDef } from "./Computed/GetComputedDef";
|
|
@@ -46,6 +46,8 @@ type RootComponentOptions<
|
|
|
46
46
|
DataDef extends object,
|
|
47
47
|
StoreDef extends object,
|
|
48
48
|
ComputedDef extends object,
|
|
49
|
+
SelfAllDatas extends object,
|
|
50
|
+
ValidInjectDatas extends object,
|
|
49
51
|
> =
|
|
50
52
|
& MethodsOption<TMethods, keyof (EventsDef & CustomEventsDef)>
|
|
51
53
|
& PropertiesOption<TProperties>
|
|
@@ -57,7 +59,7 @@ type RootComponentOptions<
|
|
|
57
59
|
& ComputedOption<
|
|
58
60
|
TComputed,
|
|
59
61
|
keyof (PropertiesDef & DataDef & StoreDef)
|
|
60
|
-
>
|
|
62
|
+
>
|
|
61
63
|
& PageLifetimesOption<TIsPage, PropertiesDef>
|
|
62
64
|
& LifetimesOption
|
|
63
65
|
& WatchOption<
|
|
@@ -78,9 +80,9 @@ type RootComponentOptions<
|
|
|
78
80
|
& ThisType<
|
|
79
81
|
RootComponentInstance<
|
|
80
82
|
TIsPage,
|
|
81
|
-
TMethods,
|
|
83
|
+
TMethods & Omit<IInjectMethods, keyof TMethods>,
|
|
82
84
|
DataDef,
|
|
83
|
-
|
|
85
|
+
SelfAllDatas & ValidInjectDatas,
|
|
84
86
|
CustomEventsDef,
|
|
85
87
|
StoreDef
|
|
86
88
|
>
|
|
@@ -88,7 +90,9 @@ type RootComponentOptions<
|
|
|
88
90
|
|
|
89
91
|
type RootComponentConstructor<TComponentDocList extends ComponentDoc[]> = <
|
|
90
92
|
TEvents extends EventsConstraint<TComponentDocList>,
|
|
91
|
-
TStore extends StoreConstraint<
|
|
93
|
+
TStore extends StoreConstraint<
|
|
94
|
+
ComputeIntersection<Required<PropertiesDef> & DataDef & Omit<InjectData, keyof (PropertiesDef & DataDef)>>
|
|
95
|
+
>,
|
|
92
96
|
TIsPage extends boolean = false,
|
|
93
97
|
const TProperties extends PropertiesConstraint = {},
|
|
94
98
|
TData extends object = {},
|
|
@@ -100,8 +104,13 @@ type RootComponentConstructor<TComponentDocList extends ComponentDoc[]> = <
|
|
|
100
104
|
CustomEventsDef extends object = GetCustomEventsDef<TCustomEvents>,
|
|
101
105
|
PropertiesDef extends object = GetPropertiesDef<TProperties>,
|
|
102
106
|
DataDef extends object = TData,
|
|
103
|
-
StoreDef extends object = StoreConstraint<
|
|
107
|
+
StoreDef extends object = StoreConstraint<
|
|
108
|
+
ComputeIntersection<Required<PropertiesDef> & DataDef & Omit<InjectData, keyof (PropertiesDef & DataDef)>>
|
|
109
|
+
> extends TStore ? {}
|
|
110
|
+
: GetStoreDef<TStore>,
|
|
104
111
|
ComputedDef extends object = GetComputedDef<TComputed>,
|
|
112
|
+
SelfAllDatas extends object = Required<PropertiesDef> & DataDef & StoreDef & ComputedDef,
|
|
113
|
+
ValidInjectDatas extends object = Omit<IInjectAllData, keyof SelfAllDatas>,
|
|
105
114
|
>(
|
|
106
115
|
options: RootComponentOptions<
|
|
107
116
|
TEvents,
|
|
@@ -118,7 +127,9 @@ type RootComponentConstructor<TComponentDocList extends ComponentDoc[]> = <
|
|
|
118
127
|
PropertiesDef,
|
|
119
128
|
DataDef,
|
|
120
129
|
StoreDef,
|
|
121
|
-
ComputedDef
|
|
130
|
+
ComputedDef,
|
|
131
|
+
SelfAllDatas,
|
|
132
|
+
ValidInjectDatas
|
|
122
133
|
>,
|
|
123
134
|
) => // 生成RootComponentDefinition
|
|
124
135
|
ComputeIntersection<
|
|
@@ -149,3 +160,5 @@ export function RootComponent<
|
|
|
149
160
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
150
161
|
return (options: any) => options;
|
|
151
162
|
}
|
|
163
|
+
|
|
164
|
+
// 全局实例增加 有效的注入数据,store字段参数包含 (prop + data + 有效的注入数据)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2
|
-
export type
|
|
2
|
+
export type GetSubComputedDoc<TComputed extends Record<string, any>> = {
|
|
3
3
|
[k in keyof TComputed]: ReturnType<TComputed[k]>;
|
|
4
4
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type SubComputedConstraint<obj extends object> = { [k in keyof obj]?: () => obj[k] };
|
package/src/api/{CustomComponent/CustomComputed → SubComponent/SubComputed}/test/error.test.ts
RENAMED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { ComponentDoc } from "../../../DefineComponent/returnType/ComponentDoc";
|
|
2
|
-
import {
|
|
2
|
+
import { SubComponent } from "../..";
|
|
3
3
|
|
|
4
4
|
type OnlyCustomCompDoc = ComponentDoc<{
|
|
5
5
|
events: { aaa_str: string };
|
|
6
6
|
}>;
|
|
7
7
|
|
|
8
8
|
// 1 CompDoc的properties为空时,写任何字段都报错
|
|
9
|
-
|
|
9
|
+
SubComponent<{}, OnlyCustomCompDoc>()({
|
|
10
10
|
computed: {
|
|
11
11
|
// @ts-expect-error ⚠️"重复或无效的字段"⚠️
|
|
12
12
|
aaa_xxx() {
|
|
@@ -23,7 +23,7 @@ type OnlyPropsCompDoc = ComponentDoc<{
|
|
|
23
23
|
}>;
|
|
24
24
|
|
|
25
25
|
// 2 去除inhrit和data字段后无组件字段约束时,只可写内部字段
|
|
26
|
-
|
|
26
|
+
SubComponent<{}, OnlyPropsCompDoc>()({
|
|
27
27
|
inherit: {
|
|
28
28
|
aaa_str: "wxml",
|
|
29
29
|
},
|
|
@@ -42,7 +42,7 @@ CustomComponent<{}, OnlyPropsCompDoc>()({
|
|
|
42
42
|
});
|
|
43
43
|
|
|
44
44
|
// 3 类型错误
|
|
45
|
-
|
|
45
|
+
SubComponent<{}, OnlyPropsCompDoc>()({
|
|
46
46
|
inherit: {
|
|
47
47
|
aaa_str: "wxml",
|
|
48
48
|
},
|
|
@@ -54,7 +54,7 @@ CustomComponent<{}, OnlyPropsCompDoc>()({
|
|
|
54
54
|
},
|
|
55
55
|
});
|
|
56
56
|
// 4 与data的内部字段重复
|
|
57
|
-
|
|
57
|
+
SubComponent<{}, OnlyPropsCompDoc>()({
|
|
58
58
|
data: {
|
|
59
59
|
_aaa_fff: 123,
|
|
60
60
|
},
|
|
@@ -66,7 +66,7 @@ CustomComponent<{}, OnlyPropsCompDoc>()({
|
|
|
66
66
|
},
|
|
67
67
|
});
|
|
68
68
|
// 5 与store的内部字段重复
|
|
69
|
-
|
|
69
|
+
SubComponent<{}, OnlyPropsCompDoc>()({
|
|
70
70
|
store: {
|
|
71
71
|
_aaa_ccc: () => 123,
|
|
72
72
|
},
|
|
@@ -78,7 +78,7 @@ CustomComponent<{}, OnlyPropsCompDoc>()({
|
|
|
78
78
|
},
|
|
79
79
|
});
|
|
80
80
|
// 6 与root字段重复
|
|
81
|
-
|
|
81
|
+
SubComponent<{ data: { _aaa_ccc: 123 } }, OnlyPropsCompDoc>()({
|
|
82
82
|
computed: {
|
|
83
83
|
// @ts-expect-error 与store的内部字段重复
|
|
84
84
|
_aaa_ccc(): number {
|
package/src/api/{CustomComponent/CustomComputed → SubComponent/SubComputed}/test/normal.test.ts
RENAMED
|
@@ -4,7 +4,7 @@ import type { ComponentDoc } from "../../../DefineComponent/returnType/Component
|
|
|
4
4
|
import type { ComputeIntersection } from "hry-types/src/Object/ComputeIntersection";
|
|
5
5
|
import type { IInjectAllData } from "../../../InstanceInject/instanceConfig";
|
|
6
6
|
import type { Mock_User } from "../../../RootComponent/Properties/test/normalRequired.test";
|
|
7
|
-
import {
|
|
7
|
+
import { SubComponent } from "../..";
|
|
8
8
|
|
|
9
9
|
type OnlyCustomCompDoc = ComponentDoc<{
|
|
10
10
|
events: { aaa_str: string };
|
|
@@ -35,7 +35,7 @@ type $aaa = ComponentDoc<
|
|
|
35
35
|
{ properties: { aaa_str: string; aaa_user: User | null; aaa_num: number; aaa_age: number } }
|
|
36
36
|
>;
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
SubComponent<{}, OnlyCustomCompDoc>()({
|
|
39
39
|
// 1 CompDoc的properties为空时,可以写{}
|
|
40
40
|
computed: {},
|
|
41
41
|
});
|
|
@@ -49,7 +49,7 @@ type OnlyPropsCompDoc = ComponentDoc<{
|
|
|
49
49
|
};
|
|
50
50
|
}>;
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
SubComponent<Root, OnlyPropsCompDoc>()({
|
|
53
53
|
inherit: {
|
|
54
54
|
aaa_num: "num",
|
|
55
55
|
},
|
|
@@ -67,7 +67,7 @@ CustomComponent<Root, OnlyPropsCompDoc>()({
|
|
|
67
67
|
},
|
|
68
68
|
});
|
|
69
69
|
// 3 computed字段的返回类型应为对应的文档类型,避免返回字面量类型导致与实际文档类型不符
|
|
70
|
-
|
|
70
|
+
SubComponent<Root, OnlyPropsCompDoc>()({
|
|
71
71
|
computed: {
|
|
72
72
|
aaa_num() {
|
|
73
73
|
return 123;
|
|
@@ -127,7 +127,7 @@ CustomComponent<Root, OnlyPropsCompDoc>()({
|
|
|
127
127
|
|
|
128
128
|
// 计算属性可互相引用,但要加返回类型注释
|
|
129
129
|
|
|
130
|
-
|
|
130
|
+
SubComponent<Root, $aaa>()({
|
|
131
131
|
computed: {
|
|
132
132
|
aaa_num(): number {
|
|
133
133
|
return this.data.SNum;
|
|
@@ -144,7 +144,7 @@ CustomComponent<Root, $aaa>()({
|
|
|
144
144
|
},
|
|
145
145
|
});
|
|
146
146
|
// 计算属性this.data可获取store和data的字段中文档中的字段和内部字段(_开头的字段)
|
|
147
|
-
|
|
147
|
+
SubComponent<Root, $aaa>()({
|
|
148
148
|
data: {
|
|
149
149
|
aaa_age: 123,
|
|
150
150
|
_aaa_age1: 123,
|
|
@@ -161,7 +161,7 @@ CustomComponent<Root, $aaa>()({
|
|
|
161
161
|
},
|
|
162
162
|
});
|
|
163
163
|
// computed中可写 额外字段 isReady
|
|
164
|
-
|
|
164
|
+
SubComponent<{ data: { _num: number } }, $aaa>()({
|
|
165
165
|
computed: {
|
|
166
166
|
aaa_isReady() {
|
|
167
167
|
return true;
|
|
@@ -170,7 +170,7 @@ CustomComponent<{ data: { _num: number } }, $aaa>()({
|
|
|
170
170
|
});
|
|
171
171
|
|
|
172
172
|
// computed中可写 内部字段
|
|
173
|
-
|
|
173
|
+
SubComponent<{ data: { _num: number } }, $aaa>()({
|
|
174
174
|
computed: {
|
|
175
175
|
aaa_isReady() {
|
|
176
176
|
return true;
|
|
@@ -185,7 +185,7 @@ CustomComponent<{ data: { _num: number } }, $aaa>()({
|
|
|
185
185
|
type Custom = { type: "custom"; xxx: string };
|
|
186
186
|
type Chunk = { type: "chunk"; yyy: number };
|
|
187
187
|
type Union = Custom | Chunk;
|
|
188
|
-
|
|
188
|
+
SubComponent<{ data: { _num: number }; methods: { IsChunk: (union: Union) => union is Chunk } }, $aaa>()({
|
|
189
189
|
data: {
|
|
190
190
|
_aaa_union: { type: "custom", xxx: "123" } as Union,
|
|
191
191
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { G } from "hry-types";
|
|
2
2
|
|
|
3
|
-
export type
|
|
3
|
+
export type SubDataOption<TData extends object, legalKeys extends PropertyKey, errMsg extends string> = {
|
|
4
4
|
/**
|
|
5
5
|
* 可写子组件所需数据和内部公共数据
|
|
6
6
|
* 非法字段检测和与Inherit字段的重复检测
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { ComponentDoc } from "../../../DefineComponent/returnType/ComponentDoc";
|
|
2
2
|
|
|
3
3
|
import type { Mock_User } from "../../../RootComponent/Properties/test/normalRequired.test";
|
|
4
|
-
import {
|
|
4
|
+
import { SubComponent } from "../..";
|
|
5
5
|
|
|
6
6
|
type OnlyCustomCompDoc = ComponentDoc<{
|
|
7
7
|
events: { aaa_str: string };
|
|
8
8
|
}>;
|
|
9
9
|
|
|
10
10
|
// 1 CompDoc无properties字段时 data字段只可写内部字段
|
|
11
|
-
|
|
11
|
+
SubComponent<{}, OnlyCustomCompDoc>()({
|
|
12
12
|
data: {
|
|
13
13
|
// @ts-expect-error "⚠️ 与Inherit字段重复或组件文档无需字段 ⚠️"
|
|
14
14
|
aaa_str: "str",
|
|
@@ -25,7 +25,7 @@ type OnlyPropsCompDoc = ComponentDoc<{
|
|
|
25
25
|
}>;
|
|
26
26
|
|
|
27
27
|
// 2 CompDoc有properties字段但去除Inherit字段后为空,只可写内部字段
|
|
28
|
-
|
|
28
|
+
SubComponent<{}, OnlyPropsCompDoc>()({
|
|
29
29
|
inherit: {
|
|
30
30
|
aaa_str: "wxml",
|
|
31
31
|
aaa_num: "wxml",
|
|
@@ -41,7 +41,7 @@ CustomComponent<{}, OnlyPropsCompDoc>()({
|
|
|
41
41
|
});
|
|
42
42
|
|
|
43
43
|
// 3 重复字段和非组件所需字段错误
|
|
44
|
-
|
|
44
|
+
SubComponent<{}, OnlyPropsCompDoc>()({
|
|
45
45
|
inherit: {
|
|
46
46
|
aaa_str: "wxml",
|
|
47
47
|
},
|
|
@@ -56,7 +56,7 @@ CustomComponent<{}, OnlyPropsCompDoc>()({
|
|
|
56
56
|
},
|
|
57
57
|
});
|
|
58
58
|
// 4 与root的数据字段重复
|
|
59
|
-
|
|
59
|
+
SubComponent<{ data: { aaa_str: 123 } }, OnlyPropsCompDoc>()({
|
|
60
60
|
data: {
|
|
61
61
|
// @ts-expect-error 与root的data字段重复
|
|
62
62
|
aaa_str: "a",
|
|
@@ -4,7 +4,7 @@ import type { ComponentDoc } from "../../../DefineComponent/returnType/Component
|
|
|
4
4
|
import type { ComputeIntersection } from "hry-types/src/Object/ComputeIntersection";
|
|
5
5
|
import type { IInjectAllData } from "../../../InstanceInject/instanceConfig";
|
|
6
6
|
import type { Mock_User } from "../../../RootComponent/Properties/test/normalRequired.test";
|
|
7
|
-
import {
|
|
7
|
+
import { SubComponent } from "../..";
|
|
8
8
|
|
|
9
9
|
type CompDoc = ComponentDoc<{
|
|
10
10
|
properties: {
|
|
@@ -14,7 +14,7 @@ type CompDoc = ComponentDoc<{
|
|
|
14
14
|
};
|
|
15
15
|
}>;
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
SubComponent<{}, CompDoc>()({
|
|
18
18
|
inherit: {
|
|
19
19
|
aaa_obj: "wxml",
|
|
20
20
|
},
|
|
@@ -27,7 +27,7 @@ CustomComponent<{}, CompDoc>()({
|
|
|
27
27
|
},
|
|
28
28
|
});
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
SubComponent<{ data: { _num: number } }, CompDoc>()({
|
|
31
31
|
inherit: {
|
|
32
32
|
aaa_str: "wxml",
|
|
33
33
|
aaa_num: "wxml",
|
|
@@ -39,7 +39,7 @@ CustomComponent<{ data: { _num: number } }, CompDoc>()({
|
|
|
39
39
|
},
|
|
40
40
|
});
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
SubComponent<{}, CompDoc>()({
|
|
43
43
|
data: {
|
|
44
44
|
aaa_str: "a" as "a" | "b",
|
|
45
45
|
aaa_num: 123 as number,
|
|
@@ -66,7 +66,7 @@ CustomComponent<{}, CompDoc>()({
|
|
|
66
66
|
});
|
|
67
67
|
|
|
68
68
|
// 确保实例和setData中使用的data字段类型为文档中定义的类型而非data配置中的类型(data中配置的类型可能推导默认为字面量类型,通过加入Replace泛型替换为对应的文档类型。),
|
|
69
|
-
|
|
69
|
+
SubComponent<{ data: { _num: number } }, CompDoc>()({
|
|
70
70
|
data: {
|
|
71
71
|
aaa_obj: null, // 类型为null 而非 Mock_User | null
|
|
72
72
|
aaa_str: "a", // 类型为"a" 而非string
|
|
@@ -84,7 +84,7 @@ CustomComponent<{ data: { _num: number } }, CompDoc>()({
|
|
|
84
84
|
},
|
|
85
85
|
});
|
|
86
86
|
// data中可写 额外字段 isReady
|
|
87
|
-
|
|
87
|
+
SubComponent<{ data: { _num: number } }, CompDoc>()({
|
|
88
88
|
data: {
|
|
89
89
|
aaa_isReady: false,
|
|
90
90
|
},
|
|
@@ -7,7 +7,7 @@ import type { Bubbles, Capture, CustomEventsTags } from "../../RootComponent/Cus
|
|
|
7
7
|
/**
|
|
8
8
|
* 把组件事件类型转为函数类型,冒泡事件捕获事件会多一个加后缀(_catch)的key,表示阻止事件冒泡和捕获。
|
|
9
9
|
*/
|
|
10
|
-
export type
|
|
10
|
+
export type SubEventsConstraint<
|
|
11
11
|
CompDoc extends ComponentDoc,
|
|
12
12
|
> = {
|
|
13
13
|
[
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { G } from "hry-types";
|
|
2
2
|
|
|
3
|
-
export type
|
|
3
|
+
export type SubEventsOption<TSubEvents, SubEventsDoc extends object, legalKeys extends PropertyKey> = {
|
|
4
4
|
/**
|
|
5
5
|
* 子组件事件(基础事件|自定义事件)
|
|
6
6
|
* 可使用内部泛型(Detail、Mark、WMBaseEvent、WMCustomEvent、CurrentTargetDataset、TargetDataset)自定义事件类型
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ComponentDoc } from "../../../DefineComponent/returnType/ComponentDoc";
|
|
2
2
|
import type { Bubbles } from "../../../RootComponent/CustomEvents/CustomEventsTag";
|
|
3
|
-
import {
|
|
3
|
+
import { SubComponent } from "../..";
|
|
4
4
|
|
|
5
5
|
type CompDoc = ComponentDoc<{
|
|
6
6
|
properties: {
|
|
@@ -9,7 +9,7 @@ type CompDoc = ComponentDoc<{
|
|
|
9
9
|
}>;
|
|
10
10
|
|
|
11
11
|
// 组件文档无自定义事件时,events字段类型为EmptyObject
|
|
12
|
-
|
|
12
|
+
SubComponent<{}, CompDoc>()({
|
|
13
13
|
events: {
|
|
14
14
|
// @ts-expect-error 非法字段
|
|
15
15
|
xxx: 123,
|
|
@@ -23,7 +23,7 @@ type CompDoc1 = ComponentDoc<{
|
|
|
23
23
|
}>;
|
|
24
24
|
|
|
25
25
|
// 非法字段检测 组件文档有自定义事件时,events下的字段仅可写文档包含字段
|
|
26
|
-
|
|
26
|
+
SubComponent<{}, CompDoc1>()({
|
|
27
27
|
events: {
|
|
28
28
|
aaa_str(e) { // ok
|
|
29
29
|
void e;
|
|
@@ -14,7 +14,7 @@ import type {
|
|
|
14
14
|
CaptureComposed,
|
|
15
15
|
} from "../../../RootComponent/CustomEvents/CustomEventsTag";
|
|
16
16
|
import type { Mock_User } from "../../../RootComponent/Properties/test/normalRequired.test";
|
|
17
|
-
import {
|
|
17
|
+
import { SubComponent } from "../..";
|
|
18
18
|
|
|
19
19
|
type CompDoc = ComponentDoc<{
|
|
20
20
|
events: {
|
|
@@ -29,7 +29,7 @@ type CompDoc = ComponentDoc<{
|
|
|
29
29
|
}>;
|
|
30
30
|
|
|
31
31
|
// 1.1 events字段提示 key为 CompDoc下customEvents的字段,类型为函数(e)=>void,e为对应keys类型去除事件标记(冒泡 捕获 穿透)
|
|
32
|
-
const custom1 =
|
|
32
|
+
const custom1 = SubComponent<{}, CompDoc>()({
|
|
33
33
|
events: {
|
|
34
34
|
aaa_str(e) {
|
|
35
35
|
Checking<typeof e.detail, string, Test.Pass>;
|
|
@@ -76,7 +76,7 @@ type custom1Expected = {
|
|
|
76
76
|
Checking<typeof custom1, custom1Expected, Test.Pass>;
|
|
77
77
|
|
|
78
78
|
// 2.1 key可写入后缀字段(_catch,表示阻止冒泡和捕获事件)。
|
|
79
|
-
const custom2 =
|
|
79
|
+
const custom2 = SubComponent<{}, CompDoc>()({
|
|
80
80
|
events: {
|
|
81
81
|
aaa_BubblesComposed_catch(e) {
|
|
82
82
|
Checking<typeof e.detail, string, Test.Pass>;
|
|
@@ -98,7 +98,7 @@ Checking<typeof custom2, {
|
|
|
98
98
|
// };
|
|
99
99
|
}, Test.Pass>;
|
|
100
100
|
|
|
101
|
-
const custom3 =
|
|
101
|
+
const custom3 = SubComponent<{}, CompDoc>()({
|
|
102
102
|
events: {
|
|
103
103
|
aaa_BubblesComposed_catch(e) {
|
|
104
104
|
Checking<typeof e.detail, string, Test.Pass>;
|
|
@@ -116,7 +116,7 @@ const custom3 = CustomComponent<{}, CompDoc>()({
|
|
|
116
116
|
Checking<typeof custom3, never, Test.Pass>;
|
|
117
117
|
|
|
118
118
|
// 3.1 基础组件基本事件参数为WMBaseEvent
|
|
119
|
-
|
|
119
|
+
SubComponent<{}, Wm.View>()({
|
|
120
120
|
events: {
|
|
121
121
|
view_tap(e) {
|
|
122
122
|
Checking<typeof e, WMBaseEvent, Test.Pass>;
|
|
@@ -129,7 +129,7 @@ CustomComponent<{}, Wm.View>()({
|
|
|
129
129
|
});
|
|
130
130
|
|
|
131
131
|
// 3.1 基础组件自定义事件参数为Detail<object>
|
|
132
|
-
|
|
132
|
+
SubComponent<{}, Wm.ScrollView>()({
|
|
133
133
|
events: {
|
|
134
134
|
scrollView_bindscroll(e) {
|
|
135
135
|
Checking<
|
|
@@ -150,7 +150,7 @@ CustomComponent<{}, Wm.ScrollView>()({
|
|
|
150
150
|
});
|
|
151
151
|
|
|
152
152
|
// 4 可为事件自定义类型
|
|
153
|
-
|
|
153
|
+
SubComponent<{}, Wm.View>()({
|
|
154
154
|
events: {
|
|
155
155
|
view_tap(e: Detail<number>) {
|
|
156
156
|
Checking<typeof e.detail, number, Test.Pass>;
|
|
@@ -163,7 +163,7 @@ CustomComponent<{}, Wm.View>()({
|
|
|
163
163
|
});
|
|
164
164
|
|
|
165
165
|
// 4 可为事件自定义类型
|
|
166
|
-
|
|
166
|
+
SubComponent<{}, Wm.View>()({
|
|
167
167
|
events: {
|
|
168
168
|
view_tap(e: Detail<number>) {
|
|
169
169
|
Checking<typeof e.detail, number, Test.Pass>;
|
|
@@ -176,7 +176,7 @@ CustomComponent<{}, Wm.View>()({
|
|
|
176
176
|
});
|
|
177
177
|
|
|
178
178
|
// 5 可以调用自身事件
|
|
179
|
-
|
|
179
|
+
SubComponent<{ methods: { aaa: () => string } }, Wm.View>()({
|
|
180
180
|
methods: {
|
|
181
181
|
view_xxx() {
|
|
182
182
|
return 123;
|
|
@@ -190,7 +190,7 @@ CustomComponent<{ methods: { aaa: () => string } }, Wm.View>()({
|
|
|
190
190
|
},
|
|
191
191
|
});
|
|
192
192
|
// 5 可以调用自身事件
|
|
193
|
-
|
|
193
|
+
SubComponent<{ methods: { aaa: () => string } }, Wm.Map>()({
|
|
194
194
|
methods: {
|
|
195
195
|
map_xxx() {
|
|
196
196
|
return 123;
|
|
@@ -10,7 +10,7 @@ type unionAddList<Keys extends string> = Keys | Keys[];
|
|
|
10
10
|
* 子组件inherit字段约束,key为构建组件所需的properties字段,类型为根组件数据的key或key[]或`WXMLSign`。要求根数据类型为子数据类型的子类型。当key的值来自wxml(循环产生的子数据等情况)时用`WXMLSign`表示。
|
|
11
11
|
* @returns object
|
|
12
12
|
*/
|
|
13
|
-
export type
|
|
13
|
+
export type SubInheritConstraint<AllRootData extends object, TComponentDoc extends ComponentDoc> = {
|
|
14
14
|
[k in keyof TComponentDoc["properties"]]?:
|
|
15
15
|
| unionAddList<RemoveInnerData<SelectKeys<AllRootData, TComponentDoc["properties"][k]> & string>>
|
|
16
16
|
| WXMLSign;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { G } from "hry-types";
|
|
2
2
|
|
|
3
|
-
export type
|
|
3
|
+
export type SubInheritOption<TInherit extends object, legalKeys extends PropertyKey> = {
|
|
4
4
|
/**
|
|
5
5
|
* 继承来自根组件的数据(key)或'wxml',wxml表示数据来自`.wxml`文件(例如数据来自父元素循环wx:for的数据).
|
|
6
6
|
* inherit字段最终会在选项中删除,它的存在是为了ts开发时提供心智模型(类型检测),js开发好比注释功能.便于代码阅读。
|
package/src/api/{CustomComponent/CustomInherit → SubComponent/SubInherit}/test/error.test.ts
RENAMED
|
@@ -2,8 +2,8 @@ import { Checking, type Test } from "hry-types";
|
|
|
2
2
|
import { DefineComponent } from "../../../DefineComponent";
|
|
3
3
|
import type { ComponentDoc } from "../../../DefineComponent/returnType/ComponentDoc";
|
|
4
4
|
import type { RootComponentDefinition } from "../../../RootComponent/returnType";
|
|
5
|
-
import {
|
|
6
|
-
import type {
|
|
5
|
+
import { SubComponent } from "../..";
|
|
6
|
+
import type { SubComponentDefinition } from "../../returnType";
|
|
7
7
|
|
|
8
8
|
type Mock_RootDoc = RootComponentDefinition<{
|
|
9
9
|
properties: {
|
|
@@ -37,7 +37,7 @@ type Mock_CompDoc = ComponentDoc<{
|
|
|
37
37
|
}>;
|
|
38
38
|
|
|
39
39
|
// 1 继承字段类型错误
|
|
40
|
-
|
|
40
|
+
SubComponent<Mock_RootDoc, Mock_CompDoc>()({
|
|
41
41
|
inherit: {
|
|
42
42
|
// @ts-expect-error 1.1 [string | number] 不是 [number] 的子集
|
|
43
43
|
aaa_num: "unionStrNum",
|
|
@@ -49,13 +49,13 @@ CustomComponent<Mock_RootDoc, Mock_CompDoc>()({
|
|
|
49
49
|
});
|
|
50
50
|
|
|
51
51
|
// 2 inherit字段最终不会在组件配置中,意义在于通过声明继承字段便于类型判断,配置是否满足子组件文档的需求。下面示例中,配置不满足组件需求,Mock_CompDoc需要一些必传字段没有配置,即使这些字段存在在于根组件(或wmxl).而返回的字符串(错误),无法通过DefinedComponent Api 类型检测。
|
|
52
|
-
const customDoc =
|
|
52
|
+
const customDoc = SubComponent<Mock_RootDoc, Mock_CompDoc>()({
|
|
53
53
|
data: {
|
|
54
54
|
aaa_num: 123,
|
|
55
55
|
},
|
|
56
56
|
});
|
|
57
57
|
|
|
58
|
-
void Checking<typeof customDoc,
|
|
58
|
+
void Checking<typeof customDoc, SubComponentDefinition, Test.Fail>;
|
|
59
59
|
|
|
60
60
|
DefineComponent({
|
|
61
61
|
name: "xxx",
|
|
@@ -65,7 +65,7 @@ DefineComponent({
|
|
|
65
65
|
|
|
66
66
|
// 3 错误的key检查
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
SubComponent<Mock_RootDoc, Mock_CompDoc>()({
|
|
69
69
|
inherit: {
|
|
70
70
|
aaa_num: "required_num",
|
|
71
71
|
// @ts-expect-error 3.1 不存在于组件中的key给错误提示
|
|
@@ -76,7 +76,7 @@ CustomComponent<Mock_RootDoc, Mock_CompDoc>()({
|
|
|
76
76
|
});
|
|
77
77
|
// 4 数组时类型错误
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
SubComponent<Mock_RootDoc, Mock_CompDoc>()({
|
|
80
80
|
inherit: {
|
|
81
81
|
// @ts-expect-error 取消了数组类型,之前的版本允许数组类型表示三元表达式
|
|
82
82
|
aaa_num: ["optional_lit1eral_num", "require1d_num"],
|