From bf929a2ee6684e59603ebf648662a70692811e91 Mon Sep 17 00:00:00 2001 From: hexagon1337 Date: Mon, 26 Aug 2024 10:42:23 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=82=E9=85=8D=E6=96=B0=E7=89=88=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E7=AE=A1=E7=90=86=E8=A3=85=E9=A5=B0=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: hexagon1337 --- CHANGELOG.md | 3 +++ README.md | 4 ++-- build-profile.json5 | 6 ++--- entry/oh-package.json5 | 2 +- .../main/ets/pages/index_adapter_animator.ets | 16 ++++++------- .../main/ets/pages/index_item_animator.ets | 20 ++++++++-------- entry/src/main/ets/pages/main.ets | 2 +- library/oh-package.json5 | 2 +- .../src/main/ets/components/RecyclerView.ets | 13 +++++----- .../AlphaInAnimationAdapter.ets | 14 +++++------ .../ScaleInAnimationAdapter.ets | 14 +++++------ .../SlideInBottomAnimationAdapter.ets | 14 +++++------ .../SlideInLeftAnimationAdapter.ets | 14 +++++------ .../SlideInRightAnimationAdapter.ets | 14 +++++------ .../itemAnimator/FadeInAnimator.ets | 14 +++++------ .../itemAnimator/FadeInDownAnimator.ets | 16 ++++++------- .../itemAnimator/FadeInLeftAnimator.ets | 16 ++++++------- .../itemAnimator/FadeInRightAnimator.ets | 16 ++++++------- .../itemAnimator/FadeInUpAnimator.ets | 16 ++++++------- .../itemAnimator/LandingAnimator.ets | 16 ++++++------- .../itemAnimator/OvershootInLeftAnimator.ets | 24 +++++++++---------- .../itemAnimator/OvershootInRightAnimator.ets | 24 +++++++++---------- .../itemAnimator/ScaleInAnimator.ets | 16 ++++++------- .../itemAnimator/ScaleInBottomAnimator.ets | 16 ++++++------- .../itemAnimator/ScaleInLeftAnimator.ets | 16 ++++++------- .../itemAnimator/ScaleInRightAnimator.ets | 16 ++++++------- .../itemAnimator/ScaleInTopAnimator.ets | 16 ++++++------- .../itemAnimator/SlideInDownAnimator.ets | 24 +++++++++---------- .../itemAnimator/SlideInLeftAnimator.ets | 24 +++++++++---------- .../itemAnimator/SlideInRightAnimator.ets | 24 +++++++++---------- .../itemAnimator/SlideInUpAnimator.ets | 24 +++++++++---------- oh-package.json5 | 2 +- 32 files changed, 231 insertions(+), 227 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a518dcd..2541c67 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 a7641a6..a5a0e15 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 f0668ed..f27fe2a 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 8cbfdc8..8f7d2fb 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 36bcb2f..71ec162 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 54d42d7..abbdc93 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 6a13a0b..a2155d8 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 0da36e4..ba58034 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 fce5272..7d3078e 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 d0f0881..efb8ff7 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 c21f2a2..63216e2 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 ea9135a..3ba15d2 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 1d5982b..c4aaff5 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 e8c8d47..0936a05 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 6350e38..49670f9 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 03d74ce..0239510 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 c45a227..8e49803 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 7ed054e..7686252 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 dff4d66..d77c3d2 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 34da84d..73fa96a 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 13a695c..374d292 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 cb8935f..534758c 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 2a502ab..d351c5c 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 c17b0f9..8185155 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 cc62f58..199400e 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 444c95c..e7d15ec 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 b05dd36..908dc1b 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 7455d92..f685e56 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 26253e4..b774bf3 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 cc3d661..6697f63 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 2ddb710..f478d45 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 2094d00..910925e 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 -- Gitee