1e41f4b71Sopenharmony_ci# ArkUI Subsystem Changelog
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci
4e41f4b71Sopenharmony_ci## cl.arkui.1 Reporting of Unexpected Number of @Extend/@AnimatableExtend Parameters
5e41f4b71Sopenharmony_ci
6e41f4b71Sopenharmony_ciThe @Extend and @AnimatableExtend decorators allow for only one parameter.
7e41f4b71Sopenharmony_ci
8e41f4b71Sopenharmony_ci**Change Impact**
9e41f4b71Sopenharmony_ci
10e41f4b71Sopenharmony_ciWhen there are multiple parameters for the @Extend/@AnimatableExtend decorator, a compilation error is reported.
11e41f4b71Sopenharmony_ci
12e41f4b71Sopenharmony_ci**Example (incorrect)**:
13e41f4b71Sopenharmony_ci
14e41f4b71Sopenharmony_ci```ts
15e41f4b71Sopenharmony_ci// xxx.ets
16e41f4b71Sopenharmony_ci
17e41f4b71Sopenharmony_ci@Extend(Text, Button)  // Compilation error: @Extend should have one and only one parameter.
18e41f4b71Sopenharmony_cifunction fancy() {
19e41f4b71Sopenharmony_ci  .width(100)
20e41f4b71Sopenharmony_ci}
21e41f4b71Sopenharmony_ci
22e41f4b71Sopenharmony_ci@AnimatableExtend(Text, Polyline)  //Compilation error: @AnimatableExtend should have one and only one parameter.
23e41f4b71Sopenharmony_cifunction fancy2() {
24e41f4b71Sopenharmony_ci  .height(100)
25e41f4b71Sopenharmony_ci}
26e41f4b71Sopenharmony_ci
27e41f4b71Sopenharmony_ci@Entry
28e41f4b71Sopenharmony_ci@Component
29e41f4b71Sopenharmony_cistruct Example {
30e41f4b71Sopenharmony_ci  build() {
31e41f4b71Sopenharmony_ci    Column() {
32e41f4b71Sopenharmony_ci      Text('text')
33e41f4b71Sopenharmony_ci        .fancy()
34e41f4b71Sopenharmony_ci        .fancy2()
35e41f4b71Sopenharmony_ci    }
36e41f4b71Sopenharmony_ci  }
37e41f4b71Sopenharmony_ci}
38e41f4b71Sopenharmony_ci```
39e41f4b71Sopenharmony_ci
40e41f4b71Sopenharmony_ci**Key API/Component Changes**
41e41f4b71Sopenharmony_ci
42e41f4b71Sopenharmony_ciN/A
43e41f4b71Sopenharmony_ci
44e41f4b71Sopenharmony_ci**Adaptation Guide**
45e41f4b71Sopenharmony_ci
46e41f4b71Sopenharmony_ciMake sure the @Extend and @AnimatableExtend decorators contain only one parameter.
47e41f4b71Sopenharmony_ci
48e41f4b71Sopenharmony_ciThe code snippet is as follows:
49e41f4b71Sopenharmony_ci```ts
50e41f4b71Sopenharmony_ci// xxx.ets
51e41f4b71Sopenharmony_ci
52e41f4b71Sopenharmony_ci@Extend(Text)
53e41f4b71Sopenharmony_cifunction fancy() {
54e41f4b71Sopenharmony_ci  .width(100)
55e41f4b71Sopenharmony_ci}
56e41f4b71Sopenharmony_ci
57e41f4b71Sopenharmony_ci@AnimatableExtend(Text)
58e41f4b71Sopenharmony_cifunction fancy2() {
59e41f4b71Sopenharmony_ci  .height(100)
60e41f4b71Sopenharmony_ci}
61e41f4b71Sopenharmony_ci
62e41f4b71Sopenharmony_ci@Entry
63e41f4b71Sopenharmony_ci@Component
64e41f4b71Sopenharmony_cistruct Example {
65e41f4b71Sopenharmony_ci  build() {
66e41f4b71Sopenharmony_ci    Column() {
67e41f4b71Sopenharmony_ci      Text('text')
68e41f4b71Sopenharmony_ci        .fancy()
69e41f4b71Sopenharmony_ci        .fancy2()
70e41f4b71Sopenharmony_ci    }
71e41f4b71Sopenharmony_ci  }
72e41f4b71Sopenharmony_ci}
73e41f4b71Sopenharmony_ci```
74e41f4b71Sopenharmony_ci
75e41f4b71Sopenharmony_ci## cl.arkui.2 Reporting of @Link/@ObjectLink Member Variables Not Being Configured from Parent Components
76e41f4b71Sopenharmony_ci
77e41f4b71Sopenharmony_ciThe value of an @Link or @ObjectLink decorated member variable in a component must be from the parent component.
78e41f4b71Sopenharmony_ci
79e41f4b71Sopenharmony_ci**Change Impact**
80e41f4b71Sopenharmony_ci
81e41f4b71Sopenharmony_ciWhen the value of an @Link/@ObjectLink decorated member variable in a component is not configured from the parent component, a compilation error is reported.
82e41f4b71Sopenharmony_ci
83e41f4b71Sopenharmony_ci**Example (incorrect)**:
84e41f4b71Sopenharmony_ci
85e41f4b71Sopenharmony_ci```ts
86e41f4b71Sopenharmony_ci// xxx.ets
87e41f4b71Sopenharmony_ci
88e41f4b71Sopenharmony_ci@Observed
89e41f4b71Sopenharmony_ciclass Count {
90e41f4b71Sopenharmony_ci  message: string = 'count'
91e41f4b71Sopenharmony_ci}
92e41f4b71Sopenharmony_ci
93e41f4b71Sopenharmony_ci@Entry
94e41f4b71Sopenharmony_ci@Component
95e41f4b71Sopenharmony_cistruct Parent {
96e41f4b71Sopenharmony_ci  @State state1: string = 'state1';
97e41f4b71Sopenharmony_ci  @State state2: Count = new Count();
98e41f4b71Sopenharmony_ci  build() {
99e41f4b71Sopenharmony_ci    Column() {
100e41f4b71Sopenharmony_ci      Child()  // Compilation error: Property 'link' in the custom component 'Child' is missing (mandatory to specify).
101e41f4b71Sopenharmony_ci               // Compilation error: Property 'objectLink' in the custom component 'Child' is missing (mandatory to specify).
102e41f4b71Sopenharmony_ci    }
103e41f4b71Sopenharmony_ci  }
104e41f4b71Sopenharmony_ci}
105e41f4b71Sopenharmony_ci
106e41f4b71Sopenharmony_ci@Component
107e41f4b71Sopenharmony_cistruct Child {
108e41f4b71Sopenharmony_ci  @Link link: string;
109e41f4b71Sopenharmony_ci  @ObjectLink objectLink: Count;
110e41f4b71Sopenharmony_ci  build() {
111e41f4b71Sopenharmony_ci    Column() {
112e41f4b71Sopenharmony_ci      Text(this.link)
113e41f4b71Sopenharmony_ci        .fontSize(50)
114e41f4b71Sopenharmony_ci      Text(this.objectLink.message)
115e41f4b71Sopenharmony_ci        .fontSize(50)
116e41f4b71Sopenharmony_ci    }
117e41f4b71Sopenharmony_ci  }
118e41f4b71Sopenharmony_ci}
119e41f4b71Sopenharmony_ci```
120e41f4b71Sopenharmony_ci
121e41f4b71Sopenharmony_ci**Key API/Component Changes**
122e41f4b71Sopenharmony_ci
123e41f4b71Sopenharmony_ciN/A
124e41f4b71Sopenharmony_ci
125e41f4b71Sopenharmony_ci**Adaptation Guide**
126e41f4b71Sopenharmony_ci
127e41f4b71Sopenharmony_ciConfigure the @Link and @ObjectLink decorated member variables in components to get their values from the parent component.
128e41f4b71Sopenharmony_ci
129e41f4b71Sopenharmony_ciThe code snippet is as follows:
130e41f4b71Sopenharmony_ci```ts
131e41f4b71Sopenharmony_ci// xxx.ets
132e41f4b71Sopenharmony_ci
133e41f4b71Sopenharmony_ci@Observed
134e41f4b71Sopenharmony_ciclass Count {
135e41f4b71Sopenharmony_ci  message: string = 'count'
136e41f4b71Sopenharmony_ci}
137e41f4b71Sopenharmony_ci
138e41f4b71Sopenharmony_ci@Entry
139e41f4b71Sopenharmony_ci@Component
140e41f4b71Sopenharmony_cistruct Parent {
141e41f4b71Sopenharmony_ci  @State state1: string = 'state1';
142e41f4b71Sopenharmony_ci  @State state2: Count = new Count();
143e41f4b71Sopenharmony_ci  build() {
144e41f4b71Sopenharmony_ci    Column() {
145e41f4b71Sopenharmony_ci      Child({link: $state1, objectLink: this.state2})
146e41f4b71Sopenharmony_ci    }
147e41f4b71Sopenharmony_ci  }
148e41f4b71Sopenharmony_ci}
149e41f4b71Sopenharmony_ci
150e41f4b71Sopenharmony_ci@Component
151e41f4b71Sopenharmony_cistruct Child {
152e41f4b71Sopenharmony_ci  @Link link: string;
153e41f4b71Sopenharmony_ci  @ObjectLink objectLink: Count;
154e41f4b71Sopenharmony_ci  build() {
155e41f4b71Sopenharmony_ci    Column() {
156e41f4b71Sopenharmony_ci      Text(this.link)
157e41f4b71Sopenharmony_ci        .fontSize(50)
158e41f4b71Sopenharmony_ci      Text(this.objectLink.message)
159e41f4b71Sopenharmony_ci        .fontSize(50)
160e41f4b71Sopenharmony_ci    }
161e41f4b71Sopenharmony_ci  }
162e41f4b71Sopenharmony_ci}
163e41f4b71Sopenharmony_ci```
164e41f4b71Sopenharmony_ci## cl.arkui.3 Behavior Change of the onReady Event for \<Canvas>
165e41f4b71Sopenharmony_ci
166e41f4b71Sopenharmony_ci**Description**
167e41f4b71Sopenharmony_ciThe **onReady** event is triggered when the component is ready or when the component size changes. After it is triggered, the canvas is cleared.
168e41f4b71Sopenharmony_ci
169e41f4b71Sopenharmony_ci**Example**
170e41f4b71Sopenharmony_ci```ts
171e41f4b71Sopenharmony_ci@Entry
172e41f4b71Sopenharmony_ci@Component
173e41f4b71Sopenharmony_cistruct OnReadyDiff {
174e41f4b71Sopenharmony_ci  @State message: string = 'init '
175e41f4b71Sopenharmony_ci  @State isShow: boolean = false
176e41f4b71Sopenharmony_ci  @State myHeight: number = 300
177e41f4b71Sopenharmony_ci  private settings: RenderingContextSettings = new RenderingContextSettings(true);
178e41f4b71Sopenharmony_ci  private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings);
179e41f4b71Sopenharmony_ci
180e41f4b71Sopenharmony_ci  build() {
181e41f4b71Sopenharmony_ci    Row() {
182e41f4b71Sopenharmony_ci      Column() {
183e41f4b71Sopenharmony_ci        Text(this.message)
184e41f4b71Sopenharmony_ci          .fontSize(50)
185e41f4b71Sopenharmony_ci          .fontWeight(FontWeight.Bold)
186e41f4b71Sopenharmony_ci        Button('ChangePosition')
187e41f4b71Sopenharmony_ci          .onClick(()=>{
188e41f4b71Sopenharmony_ci            this.isShow = !this.isShow
189e41f4b71Sopenharmony_ci          })
190e41f4b71Sopenharmony_ci        if (this.isShow) {
191e41f4b71Sopenharmony_ci          Button('new button')
192e41f4b71Sopenharmony_ci            .height(200)
193e41f4b71Sopenharmony_ci        }
194e41f4b71Sopenharmony_ci        Button('ChangeHeight')
195e41f4b71Sopenharmony_ci          .onClick(()=>{
196e41f4b71Sopenharmony_ci            this.myHeight = this.myHeight==300?500:300
197e41f4b71Sopenharmony_ci          })
198e41f4b71Sopenharmony_ci
199e41f4b71Sopenharmony_ci        Canvas(this.context)
200e41f4b71Sopenharmony_ci          .width(300)
201e41f4b71Sopenharmony_ci          .height(this.myHeight)
202e41f4b71Sopenharmony_ci          .backgroundColor('#ffff00')
203e41f4b71Sopenharmony_ci          .onReady(() =>{
204e41f4b71Sopenharmony_ci            this.context.fillRect(0, 0, 100, 100)
205e41f4b71Sopenharmony_ci            this.message += 'a '
206e41f4b71Sopenharmony_ci          })
207e41f4b71Sopenharmony_ci        Button('draw another')
208e41f4b71Sopenharmony_ci          .onClick(()=>{
209e41f4b71Sopenharmony_ci            this.context.fillRect(100, 100, 100, 100)
210e41f4b71Sopenharmony_ci          })
211e41f4b71Sopenharmony_ci      }
212e41f4b71Sopenharmony_ci      .width('100%')
213e41f4b71Sopenharmony_ci    }
214e41f4b71Sopenharmony_ci    .height('100%')
215e41f4b71Sopenharmony_ci  }
216e41f4b71Sopenharmony_ci}
217e41f4b71Sopenharmony_ci```
218e41f4b71Sopenharmony_ci
219e41f4b71Sopenharmony_ciAPI version 9: The **onReady** event is triggered when the component is ready, when the component location changes, or when the component size changes.
220e41f4b71Sopenharmony_ci
221e41f4b71Sopenharmony_ci![stack](figures/api9onReady.gif)
222e41f4b71Sopenharmony_ci
223e41f4b71Sopenharmony_ciAPI version 10 and later: The **onReady** event is triggered when the component is ready or when the component size changes. It is not triggered when the component location changes.
224e41f4b71Sopenharmony_ci
225e41f4b71Sopenharmony_ci![stack](figures/api10onReady.gif)
226e41f4b71Sopenharmony_ci
227e41f4b71Sopenharmony_ci**Change Impact**
228e41f4b71Sopenharmony_ci
229e41f4b71Sopenharmony_ciWhen the component location changes, the **onReady** event is triggered in API version 9 and earlier versions, but not in API version 10 and later versions.
230e41f4b71Sopenharmony_ci
231e41f4b71Sopenharmony_ci## cl.arkui.4 Change of How Percentage Is Calculated for Margin
232e41f4b71Sopenharmony_ci
233e41f4b71Sopenharmony_ciBefore the change: The margin is calculated twice when set in percentage. The second calculation is conducted after the result of the first calculation has been subtracted from the percentage reference. After the change: The first margin calculation result is used as the final result, and the second calculation is not conducted.
234e41f4b71Sopenharmony_ci
235e41f4b71Sopenharmony_ci**Change Impact**
236e41f4b71Sopenharmony_ci
237e41f4b71Sopenharmony_ciThis change affects calculation of margins set in percentage.
238e41f4b71Sopenharmony_ci
239e41f4b71Sopenharmony_ci**Example (incorrect)**:
240e41f4b71Sopenharmony_ci
241e41f4b71Sopenharmony_ci```ts
242e41f4b71Sopenharmony_ci// xxx.ets
243e41f4b71Sopenharmony_ci@Entry
244e41f4b71Sopenharmony_ci@Component
245e41f4b71Sopenharmony_cistruct TextInputExample {
246e41f4b71Sopenharmony_ci  @State text: string = ''
247e41f4b71Sopenharmony_ci  controller: TextInputController = new TextInputController()
248e41f4b71Sopenharmony_ci
249e41f4b71Sopenharmony_ci  build() {
250e41f4b71Sopenharmony_ci    Column(){
251e41f4b71Sopenharmony_ci      Row().margin({left:"50%"}).width(100).height(100)
252e41f4b71Sopenharmony_ci    }.width("100%").height("100%")
253e41f4b71Sopenharmony_ci  }
254e41f4b71Sopenharmony_ci}
255e41f4b71Sopenharmony_ci```
256e41f4b71Sopenharmony_ci
257e41f4b71Sopenharmony_ci**Key API/Component Changes**
258e41f4b71Sopenharmony_ci
259e41f4b71Sopenharmony_ciN/A
260e41f4b71Sopenharmony_ci
261e41f4b71Sopenharmony_ci**Adaptation Guide**
262e41f4b71Sopenharmony_ci
263e41f4b71Sopenharmony_ciAfter the change, the margin percentage reference is fixed at the parent component's width minus its padding, and does not subtract the result of the first margin calculation. As a result, the margin percentage is slightly greater than that before the change. Account for this change when setting the margin percentage.
264e41f4b71Sopenharmony_ci
265e41f4b71Sopenharmony_ci## cl.arkui.5 Change of SwipeActionItem in the \<ListItem> Component
266e41f4b71Sopenharmony_ci
267e41f4b71Sopenharmony_ciChanged **Delete** in the parameters of the **SwipeActionItem** API of the **\<ListItem>** component to **Action**, and deleted the **useDefaultDeleteAnimation** API.
268e41f4b71Sopenharmony_ci
269e41f4b71Sopenharmony_ci**Change Impact**
270e41f4b71Sopenharmony_ci
271e41f4b71Sopenharmony_ciWhen developing an application based on OpenHarmony 4.0.9.3 or a later SDK version, you need to use the new APIs.
272e41f4b71Sopenharmony_ci
273e41f4b71Sopenharmony_ci**Key API/Component Changes**
274e41f4b71Sopenharmony_ci
275e41f4b71Sopenharmony_ci| API Before Change    |  API After Change    |
276e41f4b71Sopenharmony_ci| ------ | ------------------------------ |
277e41f4b71Sopenharmony_ci| deleteAreaDistance   | actionAreaDistance |
278e41f4b71Sopenharmony_ci| onDelete   |  onAction |
279e41f4b71Sopenharmony_ci| onEnterDeleteArea   | onEnterActionArea |
280e41f4b71Sopenharmony_ci| onExitDeleteArea   | onExitActionArea |
281e41f4b71Sopenharmony_ci| useDefaultDeleteAnimation | Deleted|
282e41f4b71Sopenharmony_ci
283e41f4b71Sopenharmony_ci**Adaptation Guide**
284e41f4b71Sopenharmony_ci
285e41f4b71Sopenharmony_ciWhen developing an application based on OpenHarmony 4.0.9.3 or a later SDK version, use the new APIs of **SwipeActionItem**. When developing an application based on OpenHarmony 4.0.9.2 or an earlier SDK version, use the original APIs of **SwipeActionItem**.
286e41f4b71Sopenharmony_ci
287e41f4b71Sopenharmony_ciThe code snippet is as follows:
288e41f4b71Sopenharmony_ci
289e41f4b71Sopenharmony_ci```ts
290e41f4b71Sopenharmony_ci// xxx.ets
291e41f4b71Sopenharmony_ci@Entry
292e41f4b71Sopenharmony_ci@Component
293e41f4b71Sopenharmony_cistruct ListItemExample2 {
294e41f4b71Sopenharmony_ci  @State message: string = 'Hello World'
295e41f4b71Sopenharmony_ci  @State arr: number[] = [0, 1, 2, 3, 4]
296e41f4b71Sopenharmony_ci  @State enterEndDeleteAreaString: string = "not enterEndDeleteArea"
297e41f4b71Sopenharmony_ci  @State exitEndDeleteAreaString: string = "not exitEndDeleteArea"
298e41f4b71Sopenharmony_ci
299e41f4b71Sopenharmony_ci  @Builder itemEnd() {
300e41f4b71Sopenharmony_ci    Row() {
301e41f4b71Sopenharmony_ci      Button("Delete").margin("4vp")
302e41f4b71Sopenharmony_ci      Button("Set").margin("4vp")
303e41f4b71Sopenharmony_ci    }.padding("4vp").justifyContent(FlexAlign.SpaceEvenly)
304e41f4b71Sopenharmony_ci  }
305e41f4b71Sopenharmony_ci
306e41f4b71Sopenharmony_ci  build() {
307e41f4b71Sopenharmony_ci    Column() {
308e41f4b71Sopenharmony_ci      List({ space: 10 }) {
309e41f4b71Sopenharmony_ci        ForEach(this.arr, (item) => {
310e41f4b71Sopenharmony_ci          ListItem() {
311e41f4b71Sopenharmony_ci            Text("item" + item)
312e41f4b71Sopenharmony_ci              .width('100%')
313e41f4b71Sopenharmony_ci              .height(100)
314e41f4b71Sopenharmony_ci              .fontSize(16)
315e41f4b71Sopenharmony_ci              .textAlign(TextAlign.Center)
316e41f4b71Sopenharmony_ci              .borderRadius(10)
317e41f4b71Sopenharmony_ci              .backgroundColor(0xFFFFFF)
318e41f4b71Sopenharmony_ci          }
319e41f4b71Sopenharmony_ci          .transition({ type: TransitionType.Delete, opacity: 0 })
320e41f4b71Sopenharmony_ci          .swipeAction({
321e41f4b71Sopenharmony_ci            end: {
322e41f4b71Sopenharmony_ci              builder: this.itemEnd.bind(this, item),
323e41f4b71Sopenharmony_ci              onAction: () => {
324e41f4b71Sopenharmony_ci                animateTo({ duration: 1000 }, () => {
325e41f4b71Sopenharmony_ci                  let index = this.arr.indexOf(item)
326e41f4b71Sopenharmony_ci                  this.arr.splice(index, 1)
327e41f4b71Sopenharmony_ci                })
328e41f4b71Sopenharmony_ci              },
329e41f4b71Sopenharmony_ci              actionAreaDistance: 80,
330e41f4b71Sopenharmony_ci              onEnterActionArea: () => {
331e41f4b71Sopenharmony_ci                this.enterEndDeleteAreaString = "enterEndDeleteArea"
332e41f4b71Sopenharmony_ci                this.exitEndDeleteAreaString = "not exitEndDeleteArea"
333e41f4b71Sopenharmony_ci              },
334e41f4b71Sopenharmony_ci              onExitActionArea: () => {
335e41f4b71Sopenharmony_ci                this.enterEndDeleteAreaString = "not enterEndDeleteArea"
336e41f4b71Sopenharmony_ci                this.exitEndDeleteAreaString = "exitEndDeleteArea"
337e41f4b71Sopenharmony_ci              }
338e41f4b71Sopenharmony_ci            }
339e41f4b71Sopenharmony_ci          })
340e41f4b71Sopenharmony_ci        }, item => item)
341e41f4b71Sopenharmony_ci      }
342e41f4b71Sopenharmony_ci      Text(this.enterEndDeleteAreaString).fontSize(20)
343e41f4b71Sopenharmony_ci      Text(this.exitEndDeleteAreaString).fontSize(20)
344e41f4b71Sopenharmony_ci    }
345e41f4b71Sopenharmony_ci    .padding(10)
346e41f4b71Sopenharmony_ci    .backgroundColor(0xDCDCDC)
347e41f4b71Sopenharmony_ci    .width('100%')
348e41f4b71Sopenharmony_ci    .height('100%')
349e41f4b71Sopenharmony_ci  }
350e41f4b71Sopenharmony_ci}
351e41f4b71Sopenharmony_ci```
352