diff --git a/CHANGELOG.md b/CHANGELOG.md index a518dcd0a12f5de2e03298c1d3638024602928bd..2541c67c3566043c2bca269f3866113b412bdd30 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## v2.1.0-rc.0 +1. 适配新版状态管理装饰器 + ## v2.0.0 1. 适配DevEco Studio 版本: 4.1 Canary(4.1.3.317), OpenHarmony SDK: API11 (4.1.0.36) diff --git a/README.md b/README.md index a7641a687aa1f10a77b49445e3be508c7b612fd9..a5a0e159c8c7e719ed541da4fe8f3bbf654e13d2 100644 --- a/README.md +++ b/README.md @@ -67,8 +67,8 @@ build() { 在下述版本验证通过: -- DevEco Studio 版本: 4.1 Canary(4.1.3.317) -- OpenHarmony SDK: API11 (4.1.0.36) +- DevEco Studio NEXT Developer Beta3: 5.0(5.0.3.530) +- SDK: API12 (5.0.0.35(SP3)) ## 目录结构 ```` diff --git a/build-profile.json5 b/build-profile.json5 index f0668edb42e3086ae06cc09687b6843a9f0685bf..f27fe2aedb9853245a9f553a6f5f129c0e78453f 100644 --- a/build-profile.json5 +++ b/build-profile.json5 @@ -5,9 +5,9 @@ { "name": "default", "signingConfig": "default", - "compileSdkVersion": 10, - "compatibleSdkVersion": 10, - "targetSdkVersion": 10, + "compileSdkVersion": 12, + "compatibleSdkVersion": 12, + "targetSdkVersion": 12, "runtimeOS": "OpenHarmony" } ], diff --git a/entry/oh-package.json5 b/entry/oh-package.json5 index 8cbfdc8380eeda67cf483ac3e2b64b624e54569f..8f7d2fb924734b8b698de78c1f4e1695b6925fdb 100644 --- a/entry/oh-package.json5 +++ b/entry/oh-package.json5 @@ -9,7 +9,7 @@ }, "description": "This is an example for using the recyclerview-animators library", "repository": {}, - "version": "2.0.0", + "version": "2.1.0-rc.0", "dependencies": { "@ohos/recyclerview-animators": "file:../library" } diff --git a/entry/src/main/ets/pages/index_adapter_animator.ets b/entry/src/main/ets/pages/index_adapter_animator.ets index 36bcb2f2248f8224a4bd08f03f795d61b803b7c2..71ec16224ae58f9e686518f5f0b57b7a6bafeb63 100644 --- a/entry/src/main/ets/pages/index_adapter_animator.ets +++ b/entry/src/main/ets/pages/index_adapter_animator.ets @@ -17,14 +17,14 @@ import { RecyclerView } from "@ohos/recyclerview-animators" @Entry -@Component +@ComponentV2 struct Index_adapter_animator { private listDatas = ["Apple", "Ball", "Camera", "Day", "Egg", "Foo", "GL", "Hello", - "Iron", "Japan", "Coke", "Dog", "Cat", "Yahoo", "Sony", "Canon", "Fujitsu", "USA", "Nexus", - "LINE", "Haskell", "C++", "Java", "Go", "Swift", "Objective-c", "Ruby", "PHP", "Bash", "ksh", - "C", "Groovy", "Kotlin", "Chip", "Japan", "U.S.A", "San Francisco", "Paris", "Tokyo", - "Silicon Valley", "London", "Spain", "China", "Taiwan", "Asia", "New York", "France", "Kyoto", - "AD", "GL", "iPhone", "iPad", "iPod", "Wasabeef"]; + "Iron", "Japan", "Coke", "Dog", "Cat", "Yahoo", "Sony", "Canon", "Fujitsu", "USA", "Nexus", + "LINE", "Haskell", "C++", "Java", "Go", "Swift", "Objective-c", "Ruby", "PHP", "Bash", "ksh", + "C", "Groovy", "Kotlin", "Chip", "Japan", "U.S.A", "San Francisco", "Paris", "Tokyo", + "Silicon Valley", "London", "Spain", "China", "Taiwan", "Asia", "New York", "France", "Kyoto", + "AD", "GL", "iPhone", "iPad", "iPod", "Wasabeef"]; private animTypes: AnimType[] = [ new AnimType('AlphaIn', RecyclerView.AdapterAnimationType.AlphaIn), new AnimType('ScaleIn', RecyclerView.AdapterAnimationType.ScaleIn), @@ -32,8 +32,8 @@ struct Index_adapter_animator { new AnimType('SlideInLeft', RecyclerView.AdapterAnimationType.SlideInLeft), new AnimType('SlideInRight', RecyclerView.AdapterAnimationType.SlideInRight) ]; - @State controller: RecyclerView.Controller = new RecyclerView.Controller() - @State selectIndex: number = 0 + @Local controller: RecyclerView.Controller = new RecyclerView.Controller() + @Local selectIndex: number = 0 aboutToAppear() { this.controller.setAdapterAnimation(RecyclerView.AdapterAnimationType.AlphaIn) diff --git a/entry/src/main/ets/pages/index_item_animator.ets b/entry/src/main/ets/pages/index_item_animator.ets index 54d42d71fde94abcf2e9b78da20a6a5bd31f24c4..abbdc9300e53f8806304a0e7040b472396a88102 100644 --- a/entry/src/main/ets/pages/index_item_animator.ets +++ b/entry/src/main/ets/pages/index_item_animator.ets @@ -19,14 +19,14 @@ import router from '@ohos.router'; import promptAction from '@ohos.promptAction' @Entry -@Component +@ComponentV2 struct Index_item_animator { private listDatas = ["Apple", "Ball", "Camera", "Day", "Egg", "Foo", "GL", "Hello", - "Iron", "Japan", "Coke", "Dog", "Cat", "Yahoo", "Sony", "Canon", "Fujitsu", "USA", "Nexus", - "LINE", "Haskell", "C++", "Java", "Go", "Swift", "Objective-c", "Ruby", "PHP", "Bash", "ksh", - "C", "Groovy", "Kotlin", "Chip", "Japan", "U.S.A", "San Francisco", "Paris", "Tokyo", - "Silicon Valley", "London", "Spain", "China", "Taiwan", "Asia", "New York", "France", "Kyoto", - "AG", "GL", "iPhone", "iPad", "iPod", "Wasabeef"]; + "Iron", "Japan", "Coke", "Dog", "Cat", "Yahoo", "Sony", "Canon", "Fujitsu", "USA", "Nexus", + "LINE", "Haskell", "C++", "Java", "Go", "Swift", "Objective-c", "Ruby", "PHP", "Bash", "ksh", + "C", "Groovy", "Kotlin", "Chip", "Japan", "U.S.A", "San Francisco", "Paris", "Tokyo", + "Silicon Valley", "London", "Spain", "China", "Taiwan", "Asia", "New York", "France", "Kyoto", + "AG", "GL", "iPhone", "iPad", "iPod", "Wasabeef"]; private animTypes: AnimType[] = [ new AnimType('FadeIn', RecyclerView.ItemAnimationType.FadeIn), new AnimType('FadeInDown', RecyclerView.ItemAnimationType.FadeInDown), @@ -47,10 +47,10 @@ struct Index_item_animator { new AnimType('OvershootInLeft', RecyclerView.ItemAnimationType.OvershootInLeft) ]; - @State controller: RecyclerView.Controller = new RecyclerView.Controller() - @State selectIndex: number = 0 - @State listDataTailFlag: number = this.listDatas.length - 1; - @State addFlag: number = 0; + @Local controller: RecyclerView.Controller = new RecyclerView.Controller() + @Local selectIndex: number = 0 + @Local listDataTailFlag: number = this.listDatas.length - 1; + @Local addFlag: number = 0; aboutToAppear() { diff --git a/entry/src/main/ets/pages/main.ets b/entry/src/main/ets/pages/main.ets index 6a13a0b67dfb8e4c900ee185e1dfbb2e2671c9ec..a2155d88ff463d753e93380b1293c2a2b74f83d6 100644 --- a/entry/src/main/ets/pages/main.ets +++ b/entry/src/main/ets/pages/main.ets @@ -17,7 +17,7 @@ import router from '@ohos.router'; @Entry -@Component +@ComponentV2 struct Index { private isOn: boolean = false diff --git a/library/oh-package.json5 b/library/oh-package.json5 index 0da36e4bc5bf19a5f2db71d09248a8f344673dfa..ba5803479ed55af606182dd85aa013febbb04cd2 100644 --- a/library/oh-package.json5 +++ b/library/oh-package.json5 @@ -13,7 +13,7 @@ "main": "Index.ets", "type": "module", "repository": "https://gitee.com/openharmony-sig/recyclerview-animators", - "version": "2.0.0", + "version": "2.1.0-rc.0", "tags": [ "UI", "Animation", diff --git a/library/src/main/ets/components/RecyclerView.ets b/library/src/main/ets/components/RecyclerView.ets index fce527249d2c9d6464eccc20cf41554ac779c3ec..7d3078e46bf253cf686d26471c8d4017b739ec30 100644 --- a/library/src/main/ets/components/RecyclerView.ets +++ b/library/src/main/ets/components/RecyclerView.ets @@ -37,12 +37,12 @@ import {ScaleInAnimationAdapter} from './adapterAnimator/ScaleInAnimationAdapter import {SlideInRightAnimationAdapter} from './adapterAnimator/SlideInRightAnimationAdapter' import {SlideInBottomAnimationAdapter} from './adapterAnimator/SlideInBottomAnimationAdapter' -@Component +@ComponentV2 struct RecyclerView { - array: Array = [] + @Param array: Array = [] @BuilderParam child: (itemData: ESObject) => void; - @State controller: RecyclerView.Controller = new RecyclerView.Controller() - columnsNum: number = 1 + @Param controller: RecyclerView.Controller = new RecyclerView.Controller() + @Param columnsNum: number = 1 build() { if (this.controller.adapterAnimation !== null) { @@ -278,12 +278,13 @@ namespace RecyclerView { SlideInRight // 从右侧平移进入 } + @ObservedV2 export class Controller { addValueCallback: (index: number, value: ESObject) => void = () => {}; deleteValueCallback: (index: number) => void = () => {}; duration: number = 500 - itemAnimation = RecyclerView.ItemAnimationType.FadeIn - adapterAnimation: ESObject = null + @Trace itemAnimation = RecyclerView.ItemAnimationType.FadeIn + @Trace adapterAnimation: ESObject = null isFirstOnly: boolean = false mWidth: number = 480 mHeight: number = 855 diff --git a/library/src/main/ets/components/adapterAnimator/AlphaInAnimationAdapter.ets b/library/src/main/ets/components/adapterAnimator/AlphaInAnimationAdapter.ets index d0f08811e4325e292f8c9a0389fd84c4fed8f31c..efb8ff7c91ed29f94408cd1a47aad746c349edfa 100644 --- a/library/src/main/ets/components/adapterAnimator/AlphaInAnimationAdapter.ets +++ b/library/src/main/ets/components/adapterAnimator/AlphaInAnimationAdapter.ets @@ -16,15 +16,15 @@ import RecyclerView from '../RecyclerView' -@Component +@ComponentV2 export struct AlphaInAnimationAdapter { - @State array: Array = [] + @Param array: Array = [] @BuilderParam child: (itemData: ESObject) => void; - @State controller: RecyclerView.Controller = new RecyclerView.Controller() - @State private list: Array = [] - @State private animateList: Array = [] - @State private start: number = 0 - @State private end: number = 0 + @Param controller: RecyclerView.Controller = new RecyclerView.Controller() + @Local private list: Array = [] + @Local private animateList: Array = [] + @Local private start: number = 0 + @Local private end: number = 0 aboutToAppear() { this.array.forEach((item: string) => { diff --git a/library/src/main/ets/components/adapterAnimator/ScaleInAnimationAdapter.ets b/library/src/main/ets/components/adapterAnimator/ScaleInAnimationAdapter.ets index c21f2a2fb49844e6362d9805d4ad0cc07f215cd3..63216e2bbb5d389fe67d7b13955c026e9a2e1a61 100644 --- a/library/src/main/ets/components/adapterAnimator/ScaleInAnimationAdapter.ets +++ b/library/src/main/ets/components/adapterAnimator/ScaleInAnimationAdapter.ets @@ -16,15 +16,15 @@ import RecyclerView from '../RecyclerView' -@Component +@ComponentV2 export struct ScaleInAnimationAdapter { - @State array: Array = [] + @Param array: Array = [] @BuilderParam child: (itemData: ESObject) => void; - @State controller: RecyclerView.Controller = new RecyclerView.Controller() - @State private list: Array = [] - @State private animateList: Array = [] - @State private start: number = 0 - @State private end: number = 0 + @Param controller: RecyclerView.Controller = new RecyclerView.Controller() + @Local private list: Array = [] + @Local private animateList: Array = [] + @Local private start: number = 0 + @Local private end: number = 0 aboutToAppear() { this.array.forEach((item: string) => { diff --git a/library/src/main/ets/components/adapterAnimator/SlideInBottomAnimationAdapter.ets b/library/src/main/ets/components/adapterAnimator/SlideInBottomAnimationAdapter.ets index ea9135a16bd0ff759a71764079e14708e07e3807..3ba15d2f3dda000894d62827a39659e5c8d1d84c 100644 --- a/library/src/main/ets/components/adapterAnimator/SlideInBottomAnimationAdapter.ets +++ b/library/src/main/ets/components/adapterAnimator/SlideInBottomAnimationAdapter.ets @@ -16,15 +16,15 @@ import RecyclerView from '../RecyclerView' -@Component +@ComponentV2 export struct SlideInBottomAnimationAdapter { - @State array: Array = [] + @Param array: Array = [] @BuilderParam child: (itemData: ESObject) => void; - @State controller: RecyclerView.Controller = new RecyclerView.Controller() - @State private list: Array = [] - @State private animateList: Array = [] - @State private start: number = 0 - @State private end: number = 0 + @Param controller: RecyclerView.Controller = new RecyclerView.Controller() + @Local private list: Array = [] + @Local private animateList: Array = [] + @Local private start: number = 0 + @Local private end: number = 0 aboutToAppear() { this.array.forEach((item: string) => { diff --git a/library/src/main/ets/components/adapterAnimator/SlideInLeftAnimationAdapter.ets b/library/src/main/ets/components/adapterAnimator/SlideInLeftAnimationAdapter.ets index 1d5982be5ebd834bfae712a6e1299805d5d6f81f..c4aaff546fb57d035e2d4f1c30906de783e7218e 100644 --- a/library/src/main/ets/components/adapterAnimator/SlideInLeftAnimationAdapter.ets +++ b/library/src/main/ets/components/adapterAnimator/SlideInLeftAnimationAdapter.ets @@ -16,15 +16,15 @@ import RecyclerView from '../RecyclerView' -@Component +@ComponentV2 export struct SlideInLeftAnimationAdapter { - @State array: Array = [] + @Param array: Array = [] @BuilderParam child: (itemData: ESObject) => void; - @State controller: RecyclerView.Controller = new RecyclerView.Controller() - @State private list: Array = [] - @State private animateList: Array = [] - @State private start: number = 0 - @State private end: number = 0 + @Param controller: RecyclerView.Controller = new RecyclerView.Controller() + @Local private list: Array = [] + @Local private animateList: Array = [] + @Local private start: number = 0 + @Local private end: number = 0 aboutToAppear() { this.array.forEach((item: string) => { diff --git a/library/src/main/ets/components/adapterAnimator/SlideInRightAnimationAdapter.ets b/library/src/main/ets/components/adapterAnimator/SlideInRightAnimationAdapter.ets index e8c8d4767cbab5c67f765924f2de18aa6c888341..0936a059b3d5e636e49f3b5656d5230fe15290f3 100644 --- a/library/src/main/ets/components/adapterAnimator/SlideInRightAnimationAdapter.ets +++ b/library/src/main/ets/components/adapterAnimator/SlideInRightAnimationAdapter.ets @@ -16,15 +16,15 @@ import RecyclerView from '../RecyclerView' -@Component +@ComponentV2 export struct SlideInRightAnimationAdapter { - @State array: Array = [] + @Param array: Array = [] @BuilderParam child: (itemData: ESObject) => void; - @State controller: RecyclerView.Controller = new RecyclerView.Controller() - @State private list: Array = [] - @State private animateList: Array = [] - @State private start: number = 0 - @State private end: number = 0 + @Param controller: RecyclerView.Controller = new RecyclerView.Controller() + @Local private list: Array = [] + @Local private animateList: Array = [] + @Local private start: number = 0 + @Local private end: number = 0 aboutToAppear() { this.array.forEach((item: string) => { diff --git a/library/src/main/ets/components/itemAnimator/FadeInAnimator.ets b/library/src/main/ets/components/itemAnimator/FadeInAnimator.ets index 6350e38b8913a8e5ba9b285eb35d2fbc080a3e1b..49670f9925e193df688f54b090929789ddc003f8 100644 --- a/library/src/main/ets/components/itemAnimator/FadeInAnimator.ets +++ b/library/src/main/ets/components/itemAnimator/FadeInAnimator.ets @@ -16,16 +16,16 @@ import RecyclerView from '../RecyclerView' -@Component +@ComponentV2 export struct FadeInAnimator { - @State array: Array = [] + @Param array: Array = [] @BuilderParam child: (itemData: ESObject) => void; - @State controller: RecyclerView.Controller = new RecyclerView.Controller() - @State private myArr: Array = [] - @State private duration: number = 0 + @Param controller: RecyclerView.Controller = new RecyclerView.Controller() + @Local private myArr: Array = [] + @Local private duration: number = 0 private isClick: boolean = true - @State private trans: number = 0 - columnsNum: number = 1 + @Local private trans: number = 0 + @Param columnsNum: number = 1 private colNumStr: string = '' aboutToAppear() { diff --git a/library/src/main/ets/components/itemAnimator/FadeInDownAnimator.ets b/library/src/main/ets/components/itemAnimator/FadeInDownAnimator.ets index 03d74ce8f492b11eb4a509a71644f1f4490509b2..02395100ee9561a2aac9f04820fe97ccaeeb1e2a 100644 --- a/library/src/main/ets/components/itemAnimator/FadeInDownAnimator.ets +++ b/library/src/main/ets/components/itemAnimator/FadeInDownAnimator.ets @@ -16,17 +16,17 @@ import RecyclerView from '../RecyclerView' -@Component +@ComponentV2 export struct FadeInDownAnimator { - @State array: Array = [] + @Param array: Array = [] @BuilderParam child: (itemData: ESObject) => void; - @State controller: RecyclerView.Controller = new RecyclerView.Controller() - @State private myArr: Array = [] - @State private duration: number = 0 + @Param controller: RecyclerView.Controller = new RecyclerView.Controller() + @Local private myArr: Array = [] + @Local private duration: number = 0 private isClick: boolean = true - @State private trans: number = 0 - @State offsetY: number = -30 - columnsNum: number = 1 + @Local private trans: number = 0 + @Local offsetY: number = -30 + @Param columnsNum: number = 1 private colNumStr: string = '' aboutToAppear() { diff --git a/library/src/main/ets/components/itemAnimator/FadeInLeftAnimator.ets b/library/src/main/ets/components/itemAnimator/FadeInLeftAnimator.ets index c45a227f59194490383346683131233e26641a85..8e49803f87b18f623db60cde19cdff4a4d3b99d6 100644 --- a/library/src/main/ets/components/itemAnimator/FadeInLeftAnimator.ets +++ b/library/src/main/ets/components/itemAnimator/FadeInLeftAnimator.ets @@ -16,17 +16,17 @@ import RecyclerView from '../RecyclerView' -@Component +@ComponentV2 export struct FadeInLeftAnimator { - @State array: Array = [] + @Param array: Array = [] @BuilderParam child: (itemData: ESObject) => void; - @State controller: RecyclerView.Controller = new RecyclerView.Controller() - @State private myArr: Array = [] - @State private duration: number = 0 + @Param controller: RecyclerView.Controller = new RecyclerView.Controller() + @Local private myArr: Array = [] + @Local private duration: number = 0 private isClick: boolean = true - @State private trans: number = 0 - @State offsetX: number = -50 - columnsNum: number = 1 + @Local private trans: number = 0 + @Local offsetX: number = -50 + @Param columnsNum: number = 1 private colNumStr: string = '' aboutToAppear() { diff --git a/library/src/main/ets/components/itemAnimator/FadeInRightAnimator.ets b/library/src/main/ets/components/itemAnimator/FadeInRightAnimator.ets index 7ed054ee8f50749d06ac42776e6c24fe0a6363f9..76862529bd2680e3b54c4550f6b445ec6350ea7b 100644 --- a/library/src/main/ets/components/itemAnimator/FadeInRightAnimator.ets +++ b/library/src/main/ets/components/itemAnimator/FadeInRightAnimator.ets @@ -16,17 +16,17 @@ import RecyclerView from '../RecyclerView' -@Component +@ComponentV2 export struct FadeInRightAnimator { - @State array: Array = [] + @Param array: Array = [] @BuilderParam child: (itemData: ESObject) => void; - @State controller: RecyclerView.Controller = new RecyclerView.Controller() - @State private myArr: Array = [] - @State private duration: number = 0 + @Param controller: RecyclerView.Controller = new RecyclerView.Controller() + @Local private myArr: Array = [] + @Local private duration: number = 0 private isClick: boolean = true - @State private trans: number = 0 - @State offsetX: number = 50 - columnsNum: number = 1 + @Local private trans: number = 0 + @Local offsetX: number = 50 + @Param columnsNum: number = 1 private colNumStr: string = '' aboutToAppear() { diff --git a/library/src/main/ets/components/itemAnimator/FadeInUpAnimator.ets b/library/src/main/ets/components/itemAnimator/FadeInUpAnimator.ets index dff4d66319ccf0e0aa0d8960ea61252f0f90d009..d77c3d2f2309a4e46326e4d6b16943e6451cadba 100644 --- a/library/src/main/ets/components/itemAnimator/FadeInUpAnimator.ets +++ b/library/src/main/ets/components/itemAnimator/FadeInUpAnimator.ets @@ -16,17 +16,17 @@ import RecyclerView from '../RecyclerView' -@Component +@ComponentV2 export struct FadeInUpAnimator { - @State array: Array = [] + @Param array: Array = [] @BuilderParam child: (itemData: ESObject) => void; - @State controller: RecyclerView.Controller = new RecyclerView.Controller(); - @State private myArr: Array = [] - @State private duration: number = 0 + @Param controller: RecyclerView.Controller = new RecyclerView.Controller(); + @Local private myArr: Array = [] + @Local private duration: number = 0 private isClick: boolean = true - @State private trans: number = 0 - @State offsetY: number = 30 - columnsNum: number = 1 + @Local private trans: number = 0 + @Local offsetY: number = 30 + @Param columnsNum: number = 1 private colNumStr: string = '' aboutToAppear() { diff --git a/library/src/main/ets/components/itemAnimator/LandingAnimator.ets b/library/src/main/ets/components/itemAnimator/LandingAnimator.ets index 34da84d62d5659b3f36d7ba3d9b8cb8fa207ffdc..73fa96a14108dfaf3e16f2847a9dcddc4c8bed80 100644 --- a/library/src/main/ets/components/itemAnimator/LandingAnimator.ets +++ b/library/src/main/ets/components/itemAnimator/LandingAnimator.ets @@ -16,17 +16,17 @@ import RecyclerView from '../RecyclerView' -@Component +@ComponentV2 export struct LandingAnimator { - @State array: Array = [] + @Param array: Array = [] @BuilderParam child: (itemData: ESObject) => void; - @State controller: RecyclerView.Controller = new RecyclerView.Controller() - @State private myArr: Array = [] - @State private duration: number = 0 + @Param controller: RecyclerView.Controller = new RecyclerView.Controller() + @Local private myArr: Array = [] + @Local private duration: number = 0 private isClick: boolean = true - @State private trans: number = 0 - @State landing: number = 1 - columnsNum: number = 1 + @Local private trans: number = 0 + @Local landing: number = 1 + @Param columnsNum: number = 1 private colNumStr: string = '' aboutToAppear() { diff --git a/library/src/main/ets/components/itemAnimator/OvershootInLeftAnimator.ets b/library/src/main/ets/components/itemAnimator/OvershootInLeftAnimator.ets index 13a695cfa83bf8fb06257684896eab14b5225f8a..374d2928ee14c45dd03db8d98588c32081c42a99 100644 --- a/library/src/main/ets/components/itemAnimator/OvershootInLeftAnimator.ets +++ b/library/src/main/ets/components/itemAnimator/OvershootInLeftAnimator.ets @@ -16,18 +16,18 @@ import RecyclerView from '../RecyclerView' -@Component +@ComponentV2 export struct OvershootInLeftAnimator { - @State array: Array = [] + @Param array: Array = [] @BuilderParam child: (itemData: ESObject) => void; - @State controller: RecyclerView.Controller = new RecyclerView.Controller() - @State private myArr: Array = [] - @State private duration: number = 0 + @Param controller: RecyclerView.Controller = new RecyclerView.Controller() + @Local private myArr: Array = [] + @Local private duration: number = 0 private isClick: boolean = true - @State private trans: number = 0 - @State x: string = '0%' - @State y: string = '0%' - columnsNum: number = 1 + @Local private trans: number = 0 + @Local x: string = '0%' + @Local y: string = '0%' + @Param columnsNum: number = 1 private colNumStr: string = '' aboutToAppear() { @@ -117,9 +117,9 @@ export struct OvershootInLeftAnimator { } .opacity(item.isNewValue ? this.trans : 1) .offset(item.isNewValue ? { - x: this.x, - y: this.y - } : {}) + x: this.x, + y: this.y + } : {}) .animation({ duration: this.duration, // 动画时长 curve: Curve.Ease, // 动画曲线 diff --git a/library/src/main/ets/components/itemAnimator/OvershootInRightAnimator.ets b/library/src/main/ets/components/itemAnimator/OvershootInRightAnimator.ets index cb8935fca7b64a584611c65b3c2b9f727bebf844..534758cd854ace012ee45df512226181ee93081b 100644 --- a/library/src/main/ets/components/itemAnimator/OvershootInRightAnimator.ets +++ b/library/src/main/ets/components/itemAnimator/OvershootInRightAnimator.ets @@ -16,19 +16,19 @@ import RecyclerView from '../RecyclerView' -@Component +@ComponentV2 export struct OvershootInRightAnimator { - @State array: Array = [] + @Param array: Array = [] @BuilderParam child: (itemData: ESObject) => void; - @State controller: RecyclerView.Controller = new RecyclerView.Controller() - columnsNum: number = 1 + @Param controller: RecyclerView.Controller = new RecyclerView.Controller() + @Param columnsNum: number = 1 private colNumStr: string = '' - @State private myArr: Array = [] - @State private duration: number = 0 + @Local private myArr: Array = [] + @Local private duration: number = 0 private isClick: boolean = true - @State private trans: number = 0 - @State private x: string = '0%' - @State private y: string = '0%' + @Local private trans: number = 0 + @Local private x: string = '0%' + @Local private y: string = '0%' aboutToAppear() { this.controller.addValueCallback = (index: number, value: ESObject) => { @@ -118,9 +118,9 @@ export struct OvershootInRightAnimator { } .opacity(item.isNewValue ? this.trans : 1) .offset(item.isNewValue ? { - x: this.x, - y: this.y - } : {}) + x: this.x, + y: this.y + } : {}) .animation({ duration: this.duration, // 动画时长 curve: Curve.Ease, // 动画曲线 diff --git a/library/src/main/ets/components/itemAnimator/ScaleInAnimator.ets b/library/src/main/ets/components/itemAnimator/ScaleInAnimator.ets index 2a502ab57696bdbf4669c010cbe9aebf1c92180a..d351c5ca5c25e8e9a7069740a2e2e190dcbe21ab 100644 --- a/library/src/main/ets/components/itemAnimator/ScaleInAnimator.ets +++ b/library/src/main/ets/components/itemAnimator/ScaleInAnimator.ets @@ -16,17 +16,17 @@ import RecyclerView from '../RecyclerView' -@Component +@ComponentV2 export struct ScaleInAnimator { - @State array: Array = [] + @Param array: Array = [] @BuilderParam child: (itemData: ESObject) => void; - @State controller: RecyclerView.Controller = new RecyclerView.Controller() - @State private myArr: Array = [] - @State private duration: number = 0 + @Param controller: RecyclerView.Controller = new RecyclerView.Controller() + @Local private myArr: Array = [] + @Local private duration: number = 0 private isClick: boolean = true - @State private trans: number = 0 - @State landing: number = 1 - columnsNum: number = 1 + @Local private trans: number = 0 + @Local landing: number = 1 + @Param columnsNum: number = 1 private colNumStr: string = '' aboutToAppear() { diff --git a/library/src/main/ets/components/itemAnimator/ScaleInBottomAnimator.ets b/library/src/main/ets/components/itemAnimator/ScaleInBottomAnimator.ets index c17b0f969eac7d9d90edc9e3500838b1f64fe3d8..81851555c687ca167efb5303bf2cbbcf46b627f1 100644 --- a/library/src/main/ets/components/itemAnimator/ScaleInBottomAnimator.ets +++ b/library/src/main/ets/components/itemAnimator/ScaleInBottomAnimator.ets @@ -16,17 +16,17 @@ import RecyclerView from '../RecyclerView' -@Component +@ComponentV2 export struct ScaleInBottomAnimator { - @State array: Array = [] + @Param array: Array = [] @BuilderParam child: (itemData: ESObject) => void; - @State controller: RecyclerView.Controller = new RecyclerView.Controller() - @State private myArr: Array = [] - @State private duration: number = 0 + @Param controller: RecyclerView.Controller = new RecyclerView.Controller() + @Local private myArr: Array = [] + @Local private duration: number = 0 private isClick: boolean = true - @State private trans: number = 0 - @State landing: number = 1 - columnsNum: number = 1 + @Local private trans: number = 0 + @Local landing: number = 1 + @Param columnsNum: number = 1 private colNumStr: string = '' aboutToAppear() { diff --git a/library/src/main/ets/components/itemAnimator/ScaleInLeftAnimator.ets b/library/src/main/ets/components/itemAnimator/ScaleInLeftAnimator.ets index cc62f583b5ceed40cf59eec153da2c3f343a8138..199400e46ed7481406bcb6e5879823cb5ae67f2a 100644 --- a/library/src/main/ets/components/itemAnimator/ScaleInLeftAnimator.ets +++ b/library/src/main/ets/components/itemAnimator/ScaleInLeftAnimator.ets @@ -16,17 +16,17 @@ import RecyclerView from '../RecyclerView' -@Component +@ComponentV2 export struct ScaleInLeftAnimator { - @State array: Array = [] + @Param array: Array = [] @BuilderParam child: (itemData: ESObject) => void; - @State controller: RecyclerView.Controller = new RecyclerView.Controller() - @State private myArr: Array = [] - @State private duration: number = 0 + @Param controller: RecyclerView.Controller = new RecyclerView.Controller() + @Local private myArr: Array = [] + @Local private duration: number = 0 private isClick: boolean = true - @State private trans: number = 0 - @State landing: number = 1 - columnsNum: number = 1 + @Local private trans: number = 0 + @Local landing: number = 1 + @Param columnsNum: number = 1 private colNumStr: string = '' aboutToAppear() { diff --git a/library/src/main/ets/components/itemAnimator/ScaleInRightAnimator.ets b/library/src/main/ets/components/itemAnimator/ScaleInRightAnimator.ets index 444c95c5db9d2913f5d7c2ad0f46df9d9425d587..e7d15ec41945cc2f6ba1567a0c7d580dbdc96658 100644 --- a/library/src/main/ets/components/itemAnimator/ScaleInRightAnimator.ets +++ b/library/src/main/ets/components/itemAnimator/ScaleInRightAnimator.ets @@ -16,17 +16,17 @@ import RecyclerView from '../RecyclerView' -@Component +@ComponentV2 export struct ScaleInRightAnimator { - @State array: Array = [] + @Param array: Array = [] @BuilderParam child: (itemData: ESObject) => void; - @State controller: RecyclerView.Controller = new RecyclerView.Controller() - @State private myArr: Array = [] - @State private duration: number = 0 + @Param controller: RecyclerView.Controller = new RecyclerView.Controller() + @Local private myArr: Array = [] + @Local private duration: number = 0 private isClick: boolean = true - @State private trans: number = 0 - @State landing: number = 1 - columnsNum: number = 1 + @Local private trans: number = 0 + @Local landing: number = 1 + @Param columnsNum: number = 1 private colNumStr: string = '' aboutToAppear() { diff --git a/library/src/main/ets/components/itemAnimator/ScaleInTopAnimator.ets b/library/src/main/ets/components/itemAnimator/ScaleInTopAnimator.ets index b05dd36f22155ff1f68f5daa45ba2ea99ac4f5bc..908dc1b4b0338e32e89564514e498c8721091e59 100644 --- a/library/src/main/ets/components/itemAnimator/ScaleInTopAnimator.ets +++ b/library/src/main/ets/components/itemAnimator/ScaleInTopAnimator.ets @@ -16,17 +16,17 @@ import RecyclerView from '../RecyclerView' -@Component +@ComponentV2 export struct ScaleInTopAnimator { - @State array: Array = [] + @Param array: Array = [] @BuilderParam child: (itemData: ESObject) => void; - @State controller: RecyclerView.Controller = new RecyclerView.Controller() - @State private myArr: Array = [] - @State private duration: number = 0 + @Param controller: RecyclerView.Controller = new RecyclerView.Controller() + @Local private myArr: Array = [] + @Local private duration: number = 0 private isClick: boolean = true - @State private trans: number = 0 - @State landing: number = 1 - columnsNum: number = 1 + @Local private trans: number = 0 + @Local landing: number = 1 + @Param columnsNum: number = 1 private colNumStr: string = '' aboutToAppear() { diff --git a/library/src/main/ets/components/itemAnimator/SlideInDownAnimator.ets b/library/src/main/ets/components/itemAnimator/SlideInDownAnimator.ets index 7455d92acde8c494411c11bb496d72fa3cef697b..f685e56493fecb08f1540e235cb0fe501122afc3 100644 --- a/library/src/main/ets/components/itemAnimator/SlideInDownAnimator.ets +++ b/library/src/main/ets/components/itemAnimator/SlideInDownAnimator.ets @@ -16,18 +16,18 @@ import RecyclerView from '../RecyclerView' -@Component +@ComponentV2 export struct SlideInDownAnimator { - @State array: Array = [] + @Param array: Array = [] @BuilderParam child: (itemData: ESObject) => void; - @State controller: RecyclerView.Controller = new RecyclerView.Controller() - @State private myArr: Array = [] - @State private duration: number = 0 + @Param controller: RecyclerView.Controller = new RecyclerView.Controller() + @Local private myArr: Array = [] + @Local private duration: number = 0 private isClick: boolean = true - @State private trans: number = 0 - @State x: string = '0%' - @State y: string = '0%' - columnsNum: number = 1 + @Local private trans: number = 0 + @Local x: string = '0%' + @Local y: string = '0%' + @Param columnsNum: number = 1 private colNumStr: string = '' aboutToAppear() { @@ -115,9 +115,9 @@ export struct SlideInDownAnimator { this.child(item.value) } .offset(item.isNewValue ? { - x: this.x, - y: this.y - } : {}) + x: this.x, + y: this.y + } : {}) .opacity(item.isNewValue ? this.trans : 1) .animation({ duration: this.duration, // 动画时长 diff --git a/library/src/main/ets/components/itemAnimator/SlideInLeftAnimator.ets b/library/src/main/ets/components/itemAnimator/SlideInLeftAnimator.ets index 26253e4b4987820681b65df479c451cc91744f6e..b774bf30855e3494d6a3d3cf4e56d5b35c59c612 100644 --- a/library/src/main/ets/components/itemAnimator/SlideInLeftAnimator.ets +++ b/library/src/main/ets/components/itemAnimator/SlideInLeftAnimator.ets @@ -16,18 +16,18 @@ import RecyclerView from '../RecyclerView' -@Component +@ComponentV2 export struct SlideInLeftAnimator { - @State array: Array = [] + @Param array: Array = [] @BuilderParam child: (itemData: ESObject) => void; - @State controller: RecyclerView.Controller = new RecyclerView.Controller() - @State private myArr: Array = [] - @State private duration: number = 0 + @Param controller: RecyclerView.Controller = new RecyclerView.Controller() + @Local private myArr: Array = [] + @Local private duration: number = 0 private isClick: boolean = true - @State private trans: number = 0 - @State x: string = '0%' - @State y: string = '0%' - columnsNum: number = 1 + @Local private trans: number = 0 + @Local x: string = '0%' + @Local y: string = '0%' + @Param columnsNum: number = 1 private colNumStr: string = '' aboutToAppear() { @@ -112,9 +112,9 @@ export struct SlideInLeftAnimator { } .opacity(item.isNewValue ? this.trans : 1) .offset(item.isNewValue ? { - x: this.x, - y: this.y - } : {}) + x: this.x, + y: this.y + } : {}) .animation({ duration: this.duration, // 动画时长 curve: Curve.Ease, // 动画曲线 diff --git a/library/src/main/ets/components/itemAnimator/SlideInRightAnimator.ets b/library/src/main/ets/components/itemAnimator/SlideInRightAnimator.ets index cc3d6610f42c9bce441bc36172331fb1590601c8..6697f63bacb6cb3fc1d419884a74828c31122da5 100644 --- a/library/src/main/ets/components/itemAnimator/SlideInRightAnimator.ets +++ b/library/src/main/ets/components/itemAnimator/SlideInRightAnimator.ets @@ -16,18 +16,18 @@ import RecyclerView from '../RecyclerView' -@Component +@ComponentV2 export struct SlideInRightAnimator { - @State array: Array = [] + @Param array: Array = [] @BuilderParam child: (itemData: ESObject) => void; - @State controller: RecyclerView.Controller = new RecyclerView.Controller() - @State private myArr: Array = [] - @State private duration: number = 0 + @Param controller: RecyclerView.Controller = new RecyclerView.Controller() + @Local private myArr: Array = [] + @Local private duration: number = 0 private isClick: boolean = true - @State private trans: number = 0 - @State x: string = '0%' - @State y: string = '0%' - columnsNum: number = 1 + @Local private trans: number = 0 + @Local x: string = '0%' + @Local y: string = '0%' + @Param columnsNum: number = 1 private colNumStr: string = '' aboutToAppear() { @@ -112,9 +112,9 @@ export struct SlideInRightAnimator { } .opacity(item.isNewValue ? this.trans : 1) .offset(item.isNewValue ? { - x: this.x, - y: this.y - } : {}) + x: this.x, + y: this.y + } : {}) .animation({ duration: this.duration, // 动画时长 curve: Curve.Ease, // 动画曲线 diff --git a/library/src/main/ets/components/itemAnimator/SlideInUpAnimator.ets b/library/src/main/ets/components/itemAnimator/SlideInUpAnimator.ets index 2ddb71045248a385a4e4baf29d22661182212b0d..f478d45016a8bb2817fe2423c513362b471ca119 100644 --- a/library/src/main/ets/components/itemAnimator/SlideInUpAnimator.ets +++ b/library/src/main/ets/components/itemAnimator/SlideInUpAnimator.ets @@ -16,18 +16,18 @@ import RecyclerView from '../RecyclerView' -@Component +@ComponentV2 export struct SlideInUpAnimator { - @State array: Array = [] + @Param array: Array = [] @BuilderParam child: (itemData: ESObject) => void; - @State controller: RecyclerView.Controller = new RecyclerView.Controller() - @State private myArr: Array = [] - @State private duration: number = 0 + @Param controller: RecyclerView.Controller = new RecyclerView.Controller() + @Local private myArr: Array = [] + @Local private duration: number = 0 private isClick: boolean = true - @State private trans: number = 0 - @State x: string = '0%' - @State y: string = '0%' - columnsNum: number = 1 + @Local private trans: number = 0 + @Local x: string = '0%' + @Local y: string = '0%' + @Param columnsNum: number = 1 private colNumStr: string = '' aboutToAppear() { @@ -116,9 +116,9 @@ export struct SlideInUpAnimator { } .opacity(item.isNewValue ? this.trans : 1) .offset(item.isNewValue ? { - x: this.x, - y: this.y - } : {}) + x: this.x, + y: this.y + } : {}) .animation({ duration: this.duration, // 动画时长 curve: Curve.Ease, // 动画曲线 diff --git a/oh-package.json5 b/oh-package.json5 index 2094d00ad68378e1c0b106b69d6ec04307e20542..910925ee39ecdcce1b4f385b2b8937e354ee40c2 100644 --- a/oh-package.json5 +++ b/oh-package.json5 @@ -12,6 +12,6 @@ }, "description": "example description", "repository": {}, - "version": "2.0.0", + "version": "2.1.0-rc.0", "dependencies": {} } \ No newline at end of file