annil 1.14.0 → 1.16.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 +32 -0
- package/README.md +15 -3
- package/dist/api/DefineComponent/{NameOrPage → NameOrPath}/NameOrPathOption.d.ts +2 -2
- package/dist/api/DefineComponent/NameOrPath/NameOrPathOption.js.map +1 -0
- package/dist/api/DefineComponent/SubComponents/SubComponentsOption.d.ts +3 -3
- package/dist/api/DefineComponent/index.d.ts +5 -5
- 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/handleStore/reactionRegister.js +31 -15
- package/dist/api/DefineComponent/normalizeOptions/handleStore/reactionRegister.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/hijackHandle/index.js +0 -4
- package/dist/api/DefineComponent/normalizeOptions/hijackHandle/index.js.map +1 -1
- package/dist/api/DefineComponent/normalizeOptions/index.js +2 -2
- package/dist/api/DefineComponent/normalizeOptions/index.js.map +1 -1
- package/dist/api/DefineComponent/normalizeOptions/initComputed/index.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.d.ts +1 -1
- package/dist/api/DefineComponent/normalizeOptions/watchHandler/index.js +6 -6
- 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/RootComponent/PageLifetimes/PageLifetimesOption.d.ts +2 -6
- package/dist/api/RootComponent/Properties/GetPropertiesDef.d.ts +3 -2
- package/dist/api/RootComponent/Properties/PropertiesOption.d.ts +1 -3
- package/dist/api/RootComponent/Store/StoreOption.d.ts +1 -2
- 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} +2 -2
- 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/dist/thirdLib/index.js +2 -1
- package/dist/thirdLib/index.js.map +1 -1
- package/package.json +5 -4
- package/src/api/DefineComponent/{NameOrPage → NameOrPath}/NameOrPathOption.ts +3 -3
- 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 +9 -9
- package/src/api/DefineComponent/normalizeOptions/__throttleDebounce__FieldCheck.ts +2 -3
- package/src/api/DefineComponent/normalizeOptions/handleStore/reactionRegister.ts +56 -17
- package/src/api/DefineComponent/normalizeOptions/handleSubComponents.ts +2 -2
- package/src/api/DefineComponent/normalizeOptions/hijackHandle/index.ts +5 -5
- package/src/api/DefineComponent/normalizeOptions/hijackHandle/loadReceivedDataHandle.ts +22 -22
- package/src/api/DefineComponent/normalizeOptions/index.ts +2 -2
- package/src/api/DefineComponent/normalizeOptions/initComputed/index.ts +0 -9
- package/src/api/DefineComponent/normalizeOptions/sameFuncFieldsCollect.ts +2 -2
- package/src/api/DefineComponent/normalizeOptions/watchHandler/index.ts +23 -6
- 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/RootComponent/Instance/test/properties/mormal.test.ts +1 -1
- package/src/api/RootComponent/PageLifetimes/PageLifetimesOption.ts +2 -15
- package/src/api/RootComponent/PageLifetimes/test/error.test.ts +0 -3
- package/src/api/RootComponent/PageLifetimes/test/normal.test.ts +3 -36
- package/src/api/RootComponent/Properties/GetPropertiesDef.ts +4 -7
- package/src/api/RootComponent/Properties/PropertiesOption.ts +3 -4
- package/src/api/RootComponent/Store/StoreOption.ts +1 -1
- package/src/api/RootComponent/Store/test/error.test.ts +1 -8
- package/src/api/RootComponent/Store/test/normal.test.ts +20 -9
- 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} +2 -2
- package/src/api/{CustomComponent/CustomStore/CustomStoreOption.ts → SubComponent/SubStore/SubStoreOption.ts} +1 -1
- package/src/api/{CustomComponent/CustomStore → SubComponent/SubStore}/test/error.test.ts +6 -6
- package/src/api/{CustomComponent/CustomStore → SubComponent/SubStore}/test/normal.test.ts +13 -6
- 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 +50 -62
- package/src/api/{CustomComponent → SubComponent}/returnType.ts +6 -7
- package/src/index.ts +2 -4
- package/src/thirdLib/wm/swiper.test.ts +2 -2
- package/tsconfig.json +3 -3
- 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/dist/api/DefineComponent/NameOrPage/NameOrPathOption.js.map +0 -1
- package/dist/api/DefineComponent/normalizeOptions/hijackHandle/loadReceivedDataHandle.d.ts +0 -3
- package/dist/api/DefineComponent/normalizeOptions/hijackHandle/loadReceivedDataHandle.js +0 -12
- package/dist/api/DefineComponent/normalizeOptions/hijackHandle/loadReceivedDataHandle.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/DefineComponent/{NameOrPage → NameOrPath}/NameOrPathOption.js +0 -0
- /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/DefineComponent/{NameOrPage → NameOrPath}/test/error.test.ts +0 -0
- /package/src/api/DefineComponent/{NameOrPage → NameOrPath}/test/normal.test.ts +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
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
// /**
|
|
2
|
+
// * 针对通过 navigateTo传过来的数据对组件load周期传入数据解析
|
|
3
|
+
// * @param option - option中的url是拼接了encodeURIComponent转码的data对象的,key为INNERMARKER.url
|
|
4
|
+
// */
|
|
5
5
|
|
|
6
|
-
import { INNERMARKER } from "../../../../utils/InnerMarker";
|
|
7
|
-
import type { PageInstance } from "../../../RootComponent/Instance/RootComponentInstance";
|
|
6
|
+
// import { INNERMARKER } from "../../../../utils/InnerMarker";
|
|
7
|
+
// import type { PageInstance } from "../../../RootComponent/Instance/RootComponentInstance";
|
|
8
8
|
|
|
9
|
-
/* istanbul ignore next miniprogram-simulate(当前版本 1.6.1) 无法测试load */
|
|
10
|
-
export function loadReceivedDataHandle(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
9
|
+
// /* istanbul ignore next miniprogram-simulate(当前版本 1.6.1) 无法测试load */
|
|
10
|
+
// export function loadReceivedDataHandle(
|
|
11
|
+
// this: PageInstance,
|
|
12
|
+
// option: Record<typeof INNERMARKER.url, string>,
|
|
13
|
+
// ) {
|
|
14
|
+
// const innerData: string | undefined = option[INNERMARKER.url];
|
|
15
|
+
// // 未使用自定义的navigateTo
|
|
16
|
+
// if (innerData === undefined) return;
|
|
17
|
+
// // 使用navigateTo API
|
|
18
|
+
// const decodeOption = JSON.parse(decodeURIComponent(innerData));
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
20
|
+
// for (const key in decodeOption) {
|
|
21
|
+
// option[key] = decodeOption[key];
|
|
22
|
+
// }
|
|
23
|
+
// // 给onLoad劫持函数一个标记,判断在新框架下已经被解析过了
|
|
24
|
+
// option[INNERMARKER.url] = INNERMARKER.url;
|
|
25
|
+
// }
|
|
@@ -18,7 +18,7 @@ import type { ComputedCache } from "./initComputed/initComputedAndGetCache";
|
|
|
18
18
|
import { injectInfoHandler } from "./injectInfoHandler";
|
|
19
19
|
import { InternalFieldProtection } from "./internalFieldProtection";
|
|
20
20
|
import { sameFuncOptionsHandle } from "./sameFuncOptionsHandle";
|
|
21
|
-
import {
|
|
21
|
+
import { handleWatchConfig } from "./watchHandler";
|
|
22
22
|
// 因为watch字段可能有多个变量,所以在这里定义的value是一个数组
|
|
23
23
|
export type WatchOldValue = Record<string, unknown[]>;
|
|
24
24
|
export type ThrottleDebounce = Partial<Record<"throttle" | "debounce", Record<string, number>>>;
|
|
@@ -116,7 +116,7 @@ export function normalizeOptions(
|
|
|
116
116
|
applyDebounceAndThrottle(finalOptionsForComponent.methods);
|
|
117
117
|
|
|
118
118
|
// 处理watch配置,注意的是 oldValue中的计算属性初始赋值在计算属性初始化完毕后,即计算属性初始化后,再变化时才会被watch到。
|
|
119
|
-
|
|
119
|
+
handleWatchConfig(finalOptionsForComponent);
|
|
120
120
|
|
|
121
121
|
// BBeforeCreate在最后面,让BeforeCreate生命周期运行在最终建立组件时。用于测试。
|
|
122
122
|
finalOptionsForComponent.behaviors.push(BBeforeCreate);
|
|
@@ -7,15 +7,6 @@ import type { Instance } from "../../../RootComponent/Instance/RootComponentInst
|
|
|
7
7
|
import { getPathsValue } from "../watchHandler/getPathsValue";
|
|
8
8
|
import { hasComputedPath } from "../watchHandler/hasComputedPath";
|
|
9
9
|
import { initComputedAndGetCache } from "./initComputedAndGetCache";
|
|
10
|
-
// function initWatchOldValue(this: Instance, watchConfig: object): WatchOldValue {
|
|
11
|
-
// const watchOldValue: Record<string, unknown[]> = {};
|
|
12
|
-
// for (const key in watchConfig) {
|
|
13
|
-
// watchOldValue[key] = deepClone(getPathsValue(this.data, key));
|
|
14
|
-
// }
|
|
15
|
-
|
|
16
|
-
// return watchOldValue;
|
|
17
|
-
// }
|
|
18
|
-
|
|
19
10
|
/**
|
|
20
11
|
* 初始化会在2个时间渲染,一个是observers.**的回调函数,一个是attached周期。
|
|
21
12
|
* @param computedConfig
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { Func } from "hry-types/src/Misc/Func";
|
|
2
2
|
|
|
3
|
-
import type { CustomComponentDefinitionRuntime } from "../../CustomComponent/returnType";
|
|
4
3
|
import type { RootComponentDefinitionRuntime } from "../../RootComponent/returnType";
|
|
4
|
+
import type { SubComponentDefinitionRuntime } from "../../SubComponent/returnType";
|
|
5
5
|
import type { SameFuncOptions } from ".";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* 把配置为函数的字段方法收集到funcOptions中
|
|
9
9
|
*/
|
|
10
10
|
export function sameFuncFieldsCollect(
|
|
11
|
-
options:
|
|
11
|
+
options: SubComponentDefinitionRuntime | RootComponentDefinitionRuntime,
|
|
12
12
|
funcOptions: SameFuncOptions,
|
|
13
13
|
) {
|
|
14
14
|
let key: keyof SameFuncOptions;
|
|
@@ -6,7 +6,8 @@ import { getPathsValue } from "./getPathsValue";
|
|
|
6
6
|
import { getPropertiesValue } from "./getPropertiesValue";
|
|
7
7
|
import { hasComputedPath } from "./hasComputedPath";
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
// 初始化watch监控字段的旧值对象,排除有计算属性的字段。
|
|
10
|
+
function initWatchOldValuesWithoutComputed(
|
|
10
11
|
data: FinalOptionsOfComponent["data"],
|
|
11
12
|
watchConfig: object,
|
|
12
13
|
computedKeys: string[],
|
|
@@ -27,6 +28,7 @@ function observerHandler(
|
|
|
27
28
|
watchHadle: Func,
|
|
28
29
|
...newValue: unknown[]
|
|
29
30
|
) {
|
|
31
|
+
// 先调用原生observers的回调函数,再调用watch的回调函数。因为watch的回调函数可能会用到原生observers回调函数中更新的数据。
|
|
30
32
|
originObserversHandle?.call(this, ...newValue);
|
|
31
33
|
const watchOldValue = nonNullable(this.data.__watchOldValue__);
|
|
32
34
|
const oldValue = watchOldValue[key];
|
|
@@ -34,7 +36,15 @@ function observerHandler(
|
|
|
34
36
|
watchOldValue[key] = deepClone(newValue);
|
|
35
37
|
watchHadle.call(this, ...newValue, ...oldValue);
|
|
36
38
|
}
|
|
37
|
-
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* 把watch配置转换成observers配置的形式,并在回调函数中调用watch的回调函数。
|
|
42
|
+
* 小程序的observers是通过监控setData字段,来触发的,不会比较值的变化,小程序底层代码可以监控到properties变化时的setData动作.
|
|
43
|
+
* watch字段的目的是数据变化时才触发回调函数,但由于实例中无法通过setData的调用来监听到properties字段变化,所以watch字段的实现方式是通过在observers回调函数中比较新旧值来实现的。
|
|
44
|
+
* 还要在组件实例上维护一个__watchOldValue__对象来存储watch监控字段的旧值,以便在回调函数中进行比较。
|
|
45
|
+
* @param finalOptionsForComponent
|
|
46
|
+
*/
|
|
47
|
+
export function handleWatchConfig(
|
|
38
48
|
finalOptionsForComponent: FinalOptionsOfComponent,
|
|
39
49
|
) {
|
|
40
50
|
const { observers: observersConfig, watch: watchConfig, data, properties, computed: computedConfig } =
|
|
@@ -42,17 +52,24 @@ export function watchHandler(
|
|
|
42
52
|
if (!isEmptyObject(watchConfig)) {
|
|
43
53
|
const rawPropertiesValue = getPropertiesValue(properties);
|
|
44
54
|
const computedKeys = Object.keys(computedConfig);
|
|
45
|
-
|
|
55
|
+
|
|
56
|
+
data.__watchOldValue__ = initWatchOldValuesWithoutComputed(
|
|
57
|
+
{ ...data, ...rawPropertiesValue },
|
|
58
|
+
watchConfig,
|
|
59
|
+
computedKeys,
|
|
60
|
+
);
|
|
46
61
|
for (const key in watchConfig) {
|
|
47
62
|
const watchHadle = watchConfig[key];
|
|
48
63
|
const originObserversHandle = observersConfig[key] as Func | undefined;
|
|
49
64
|
// 在监控多个数据时,参数是多个值
|
|
50
|
-
observersConfig[key] = function(this: Instance, ...
|
|
65
|
+
observersConfig[key] = function(this: Instance, ...values: unknown[]) {
|
|
66
|
+
// 计算属性初始化完成时直接调用。
|
|
51
67
|
if (this.data.__computedInited__) {
|
|
52
|
-
observerHandler.call(this, key, originObserversHandle, watchHadle, ...
|
|
68
|
+
observerHandler.call(this, key, originObserversHandle, watchHadle, ...values);
|
|
53
69
|
} else {
|
|
70
|
+
// 计算属性未初始化完成时,先把watch的回调函数注册到实例上,等计算属性初始化完成时再调用。因为计算属性初始化完成时会把data中的值setData一次,会触发observers回调函数,所以在这里注册watch的回调函数,就能保证计算属性初始化完成后能正确调用watch的回调函数。
|
|
54
71
|
(this.data.__oberverHandler__ ||= []).push(
|
|
55
|
-
observerHandler.bind(this, key, originObserversHandle, watchHadle, ...
|
|
72
|
+
observerHandler.bind(this, key, originObserversHandle, watchHadle, ...values),
|
|
56
73
|
);
|
|
57
74
|
}
|
|
58
75
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
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 { CustomComponentDefinition } from "../../CustomComponent/returnType";
|
|
4
3
|
import type { RootComponentDefinition } from "../../RootComponent/returnType";
|
|
4
|
+
import type { SubComponentDefinition } from "../../SubComponent/returnType";
|
|
5
5
|
import type { GetCustomEventDocOfSubDoc } from "./GetCustomEventDocOfSubDoc";
|
|
6
6
|
|
|
7
7
|
// 获取RootComponetDoc中events字段类型阻止事件(后最为catch)的key `${ 组件前缀 }_${infer Key}_${ bubbles | capture }_catch`
|
|
@@ -13,7 +13,7 @@ type GetStopKeys<O> = { [k in keyof O]: k extends `${string}_${infer Key}_${stri
|
|
|
13
13
|
export type GenerateComponentDoc<
|
|
14
14
|
TRootDoc extends RootComponentDefinition,
|
|
15
15
|
TName extends string,
|
|
16
|
-
TSubComponentTuple extends
|
|
16
|
+
TSubComponentTuple extends SubComponentDefinition[],
|
|
17
17
|
// 获取RootDoc和SubComponent[]中所有的properties字段类型
|
|
18
18
|
AllPropertiesDoc extends unknown | object = TRootDoc["properties"],
|
|
19
19
|
AllEventsDoc extends unknown | object =
|
|
@@ -2,16 +2,16 @@ import type { IsNever, IsUnion } from "hry-types/src/Any/_api";
|
|
|
2
2
|
import type { UnionTwoObject } from "hry-types/src/Object/UnionTwoObject";
|
|
3
3
|
import type { Last } from "hry-types/src/Union/Last";
|
|
4
4
|
import type { Assert } from "../../../types/Assert";
|
|
5
|
-
import type {
|
|
5
|
+
import type { SubComponentDefinition } from "../../SubComponent/returnType";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* 因为子组件文档customEvents字段有可能相同(无前缀),所以使用UnionTwoObject
|
|
9
9
|
* 由于SubComponentDoc为空时返回never而不`{}`,所以`Exclude<U, TLast>`不影响结果。
|
|
10
10
|
*/
|
|
11
11
|
type _GetCustomEventDocOfSubDoc<
|
|
12
|
-
U extends
|
|
12
|
+
U extends SubComponentDefinition,
|
|
13
13
|
Result = {},
|
|
14
|
-
TLast extends
|
|
14
|
+
TLast extends SubComponentDefinition = Assert<Last<U>, SubComponentDefinition>,
|
|
15
15
|
> = IsNever<U> extends true ? Result
|
|
16
16
|
: _GetCustomEventDocOfSubDoc<Exclude<U, TLast>, UnionTwoObject<Result, TLast["composedEvents"]>>;
|
|
17
17
|
|
|
@@ -19,6 +19,6 @@ type _GetCustomEventDocOfSubDoc<
|
|
|
19
19
|
* 获取子组件自定义事件文档
|
|
20
20
|
* @remarks U 中 相同字段类型联合,所以使用元组推导不如Last性能好。
|
|
21
21
|
*/
|
|
22
|
-
export type GetCustomEventDocOfSubDoc<UnionSubDoc extends
|
|
22
|
+
export type GetCustomEventDocOfSubDoc<UnionSubDoc extends SubComponentDefinition> = IsUnion<UnionSubDoc> extends true
|
|
23
23
|
? _GetCustomEventDocOfSubDoc<UnionSubDoc>
|
|
24
24
|
: UnionSubDoc["composedEvents"];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-unused-expressions */
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
3
3
|
import { Checking, type Test } from "hry-types";
|
|
4
|
-
import {
|
|
4
|
+
import { type DetailedType, RootComponent, SubComponent } from "../../../..";
|
|
5
5
|
// import type { CustomEventConstraint } from "../../../rootComponent/CustomEvents/CustomEventConstraint";
|
|
6
6
|
import type {
|
|
7
7
|
Bubbles,
|
|
@@ -14,11 +14,11 @@ import type {
|
|
|
14
14
|
} from "../../../RootComponent/CustomEvents/CustomEventsTag";
|
|
15
15
|
|
|
16
16
|
import type { ComputeIntersection } from "hry-types/src/Object/ComputeIntersection";
|
|
17
|
-
import type { CustomComponentDefinition } from "../../../CustomComponent/returnType";
|
|
18
17
|
import type { CustomEventConstraint } from "../../../RootComponent/CustomEvents/CustomEventConstraint";
|
|
19
18
|
import type { PropertiesConstraint } from "../../../RootComponent/Properties/PropertiesConstraint";
|
|
20
19
|
import type { Mock_User } from "../../../RootComponent/Properties/test/normalRequired.test";
|
|
21
20
|
import type { RootComponentDefinition } from "../../../RootComponent/returnType";
|
|
21
|
+
import type { SubComponentDefinition } from "../../../SubComponent/returnType";
|
|
22
22
|
import { DefineComponent } from "../..";
|
|
23
23
|
|
|
24
24
|
const properties = {
|
|
@@ -134,7 +134,7 @@ const compDoc = DefineComponent({
|
|
|
134
134
|
|
|
135
135
|
Checking<typeof compDoc, ComputeIntersection<CompOnlyCustomEventsExpected & OnlyPropertiesExpected>, Test.Pass>;
|
|
136
136
|
|
|
137
|
-
type SubA =
|
|
137
|
+
type SubA = SubComponentDefinition<{
|
|
138
138
|
composedEvents: {
|
|
139
139
|
str: string | Bubbles | Composed;
|
|
140
140
|
num: number | Capture | Composed;
|
|
@@ -158,7 +158,7 @@ type customEventsRootDocExpect = {
|
|
|
158
158
|
|
|
159
159
|
Checking<typeof customEventsRootDoc, customEventsRootDocExpect, Test.Pass>;
|
|
160
160
|
|
|
161
|
-
type SubB =
|
|
161
|
+
type SubB = SubComponentDefinition<{
|
|
162
162
|
composedEvents: {
|
|
163
163
|
str: number | Bubbles | Composed;
|
|
164
164
|
num: string | Capture | Composed;
|
|
@@ -225,9 +225,9 @@ const rootComponent8 = RootComponent()({
|
|
|
225
225
|
|
|
226
226
|
Checking<(typeof rootComponent8)["customEvents"]["decrease"], Mock_User, Test.Pass>;
|
|
227
227
|
|
|
228
|
-
const subA =
|
|
228
|
+
const subA = SubComponent<RootComponentDefinition, { properties: { subA_num: number } }>()({});
|
|
229
229
|
// SubComponent中计算属性字段函数若不写返回值,会造成结果中没有计算属性字段类型,若没有其他字段,结果就为'{}'
|
|
230
|
-
const subB =
|
|
230
|
+
const subB = SubComponent<RootComponentDefinition, { properties: { subB_str: string } }>()({
|
|
231
231
|
computed: {
|
|
232
232
|
subB_str() {
|
|
233
233
|
return this.data.injectStr;
|
|
@@ -1,24 +1,12 @@
|
|
|
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 { ComputeObject } from "../../../types/ComputeObject";
|
|
4
3
|
import type { WMCompPageLifetimes, WMPageLifetimes } from "../../../types/OfficialTypeAlias";
|
|
5
|
-
import type { RemoveNullOfRequired } from "../../../types/RemoveNullOfRequired";
|
|
6
4
|
|
|
7
5
|
export type PageLifetimesOption<TIsPage extends boolean, PropertiesDoc extends object> = IfExtends<
|
|
8
6
|
TIsPage,
|
|
9
7
|
false,
|
|
10
8
|
{
|
|
11
|
-
pageLifetimes?:
|
|
12
|
-
// 官方组件页面生命周期
|
|
13
|
-
& Partial<WMCompPageLifetimes>
|
|
14
|
-
& {
|
|
15
|
-
/**
|
|
16
|
-
* 周期发生在组件attached之后,页面onLoad之前,要求组件为同步组件
|
|
17
|
-
* 最低基础库: `3.0.2`
|
|
18
|
-
*/
|
|
19
|
-
load?: (props?: object) => void;
|
|
20
|
-
}
|
|
21
|
-
>;
|
|
9
|
+
pageLifetimes?: Partial<WMCompPageLifetimes>;
|
|
22
10
|
},
|
|
23
11
|
{
|
|
24
12
|
/**
|
|
@@ -33,8 +21,7 @@ export type PageLifetimesOption<TIsPage extends boolean, PropertiesDoc extends o
|
|
|
33
21
|
* 页面加载时触发。一个页面只会调用一次,可以在 onLoad 的参数中获取Properties定义的数据。
|
|
34
22
|
*/
|
|
35
23
|
onLoad?: (
|
|
36
|
-
|
|
37
|
-
props: ComputeObject<RemoveNullOfRequired<PropertiesDoc>>,
|
|
24
|
+
props: Required<PropertiesDoc>,
|
|
38
25
|
) => void | Promise<void>;
|
|
39
26
|
}
|
|
40
27
|
>;
|
|
@@ -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
|
*/
|
|
@@ -21,11 +18,6 @@ RootComponent()({
|
|
|
21
18
|
show() {
|
|
22
19
|
void 0;
|
|
23
20
|
},
|
|
24
|
-
// 1 glass-easel(最低版本库3.0.2)支持的周期函数
|
|
25
|
-
load(obj) {
|
|
26
|
-
void obj;
|
|
27
|
-
void Checking<typeof obj, object | undefined, Test.Pass>;
|
|
28
|
-
},
|
|
29
21
|
},
|
|
30
22
|
});
|
|
31
23
|
|
|
@@ -54,8 +46,8 @@ RootComponent()({
|
|
|
54
46
|
void Checking<
|
|
55
47
|
typeof props,
|
|
56
48
|
{
|
|
57
|
-
union
|
|
58
|
-
optionalObject
|
|
49
|
+
union: Mock_User;
|
|
50
|
+
optionalObject: Mock_User | null;
|
|
59
51
|
str: string;
|
|
60
52
|
obj: object;
|
|
61
53
|
},
|
|
@@ -77,28 +69,3 @@ RootComponent()({
|
|
|
77
69
|
// ...
|
|
78
70
|
},
|
|
79
71
|
});
|
|
80
|
-
// prop中必传对象没有null,但在实例中却需要有null
|
|
81
|
-
RootComponent()({
|
|
82
|
-
isPage: true,
|
|
83
|
-
properties: {
|
|
84
|
-
optionalObj: {
|
|
85
|
-
type: Object,
|
|
86
|
-
value: {},
|
|
87
|
-
},
|
|
88
|
-
requiredObj: Object as DetailedType<User>,
|
|
89
|
-
},
|
|
90
|
-
|
|
91
|
-
pageLifetimes: {
|
|
92
|
-
onLoad(prop) {
|
|
93
|
-
void prop;
|
|
94
|
-
// 页面外部传值时没必要传null,组件时有需要的。
|
|
95
|
-
void Checking<typeof prop.requiredObj, User, true>;
|
|
96
|
-
// 虽然传值不应该是null,但由于实例建立时默认为null,所以实例类型加上null
|
|
97
|
-
void Checking<typeof this.data.requiredObj, User, true>;
|
|
98
|
-
// 页面传入的可选对象不需要null,有undefined
|
|
99
|
-
void Checking<typeof prop.optionalObj, object | undefined, true>;
|
|
100
|
-
// 实例中的可选对象不需要null,有默认值。
|
|
101
|
-
void Checking<typeof this.data.optionalObj, object, true>;
|
|
102
|
-
},
|
|
103
|
-
},
|
|
104
|
-
});
|
|
@@ -3,17 +3,14 @@ import type { Select } from "hry-types/src/Object/Select";
|
|
|
3
3
|
import type { ComputeIntersection } from "hry-types/src/Object/_api";
|
|
4
4
|
import type { GetOptionalDef } from "./GetOptionalDef";
|
|
5
5
|
|
|
6
|
+
import type { As } from "hry-types/src/Any/As";
|
|
6
7
|
import type { GetRequiredDef } from "./GetRequiredDef";
|
|
7
|
-
import type { OptionalType, PropertiesConstraint } from "./PropertiesConstraint";
|
|
8
|
+
import type { OptionalType, PropertiesConstraint, RequiredType } from "./PropertiesConstraint";
|
|
8
9
|
|
|
9
10
|
type _GetPropertiesDef<
|
|
10
11
|
TProperties extends PropertiesConstraint,
|
|
11
|
-
OptionalDef extends object =
|
|
12
|
-
|
|
13
|
-
GetOptionalDef<Select<TProperties, OptionalType>>,
|
|
14
|
-
RequiredDef extends object =
|
|
15
|
-
// @ts-expect-error dddf
|
|
16
|
-
GetRequiredDef<Omit<TProperties, keyof OptionalDef>>,
|
|
12
|
+
OptionalDef extends object = GetOptionalDef<As<Select<TProperties, OptionalType>, Record<string, OptionalType>>>,
|
|
13
|
+
RequiredDef extends object = GetRequiredDef<As<Omit<TProperties, keyof OptionalDef>, Record<string, RequiredType>>>,
|
|
17
14
|
> = ComputeIntersection<OptionalDef & RequiredDef>;
|
|
18
15
|
|
|
19
16
|
/**
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { G } from "hry-types";
|
|
2
1
|
import type { Validators } from "../../../types/Validators";
|
|
3
2
|
import type { PropertiesConstraint } from "./PropertiesConstraint";
|
|
4
3
|
import type { PropertiesValueValidator } from "./PropertiesValueValidator";
|
|
@@ -12,7 +11,7 @@ export type PropertiesOption<
|
|
|
12
11
|
*
|
|
13
12
|
* 禁用observable字段(watch代替)
|
|
14
13
|
*
|
|
15
|
-
*
|
|
14
|
+
* 简写 → 必传,单一类型。对象写法 + optionalTypes → 必传,联合类型。对象写法 + value → 可选传(有默认值),可同时配合 optionalTypes。
|
|
16
15
|
*
|
|
17
16
|
* 有value类型检测和非法字段检测(例如value写出values)
|
|
18
17
|
*/
|
|
@@ -20,7 +19,7 @@ export type PropertiesOption<
|
|
|
20
19
|
& TProperties
|
|
21
20
|
& Validators<[
|
|
22
21
|
PropertiesValueValidator<TProperties>,
|
|
23
|
-
// 放在最后一个,正常返回不是unknown 而是Record<string,unknown>
|
|
24
|
-
G.IllegalFieldValidator<TProperties, "value" | "type" | "optionalTypes", 1>,
|
|
22
|
+
// // 放在最后一个,正常返回不是unknown 而是Record<string,unknown>
|
|
23
|
+
// G.IllegalFieldValidator<TProperties, "value" | "type" | "optionalTypes", 1>,
|
|
25
24
|
]>;
|
|
26
25
|
};
|
|
@@ -8,7 +8,7 @@ const user = observable({
|
|
|
8
8
|
// 1 约束错误
|
|
9
9
|
RootComponent()({
|
|
10
10
|
store: {
|
|
11
|
-
// @ts-expect-error 1.1 不能将类型“string”分配给类型“
|
|
11
|
+
// @ts-expect-error 1.1 不能将类型“string”分配给类型“Getter<{}, unknown>”
|
|
12
12
|
userName: user.name,
|
|
13
13
|
},
|
|
14
14
|
});
|
|
@@ -28,10 +28,3 @@ RootComponent()({
|
|
|
28
28
|
userAge: () => user.age,
|
|
29
29
|
},
|
|
30
30
|
});
|
|
31
|
-
// 3. 返回类型错误
|
|
32
|
-
RootComponent()({
|
|
33
|
-
store: {
|
|
34
|
-
// @ts-expect-error 3.1 返回类型中不可以包含undefined
|
|
35
|
-
xxx: () => "xxx" as string | undefined,
|
|
36
|
-
},
|
|
37
|
-
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Checking, type Test } from "hry-types";
|
|
2
1
|
import { observable } from "mobx";
|
|
2
|
+
import { typeEqual } from "../../../../utils/_utils";
|
|
3
3
|
import { RootComponent } from "../..";
|
|
4
4
|
const user = observable({
|
|
5
5
|
name: "zhao",
|
|
@@ -7,18 +7,29 @@ const user = observable({
|
|
|
7
7
|
});
|
|
8
8
|
|
|
9
9
|
const storeDoc = RootComponent()({
|
|
10
|
+
properties: {
|
|
11
|
+
condition: Number,
|
|
12
|
+
},
|
|
10
13
|
store: {
|
|
14
|
+
// normal
|
|
11
15
|
userName: () => user.name,
|
|
12
|
-
|
|
16
|
+
// 条件反应式,当condition>10时,响应式,否则不可响应式(返回undefined),但不报错(有警告).
|
|
17
|
+
userAge: (props) => {
|
|
18
|
+
if (props.condition > 10) {
|
|
19
|
+
return user.age;
|
|
20
|
+
}
|
|
21
|
+
return undefined;
|
|
22
|
+
},
|
|
13
23
|
},
|
|
14
24
|
});
|
|
15
|
-
|
|
16
|
-
|
|
25
|
+
|
|
26
|
+
type StoreDocExpected = {
|
|
27
|
+
properties: {
|
|
28
|
+
condition: number;
|
|
29
|
+
};
|
|
17
30
|
store: {
|
|
18
31
|
userName: string;
|
|
19
|
-
userAge: number;
|
|
32
|
+
userAge: number | undefined;
|
|
20
33
|
};
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// 返回类型为函数返回类型
|
|
24
|
-
void Checking<typeof storeDoc, StoreDocExpected, Test.Pass>;
|
|
34
|
+
};
|
|
35
|
+
typeEqual<StoreDocExpected>()(storeDoc);
|
|
@@ -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 {
|