已合并
Add supportEmptyBranchInLazyLoading for ArkUI1.2 #77672
guozejun创建于 2025年12月11日
Add supportEmptyBranchInLazyLoading for ArkUI1.2 #77672
已合并
共 38 个文件变更+496-50
Mframeworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/generated/GridModifier.ets+44-0
| @@ -77,6 +77,8 @@ export class GridModifier extends CommonMethodModifier implements GridAttribute, | |||
| 77 | _layoutDirection_0_0value?: GridDirection | undefined | 77 | _layoutDirection_0_0value?: GridDirection | undefined |
| 78 | _supportAnimation_0_flag: AttributeUpdaterFlag = AttributeUpdaterFlag.INITIAL | 78 | _supportAnimation_0_flag: AttributeUpdaterFlag = AttributeUpdaterFlag.INITIAL |
| 79 | _supportAnimation_0_0value?: boolean | undefined | 79 | _supportAnimation_0_0value?: boolean | undefined |
| 80 | + _supportEmptyBranchInLazyLoading_0_flag: AttributeUpdaterFlag = AttributeUpdaterFlag.INITIAL | ||
| 81 | + _supportEmptyBranchInLazyLoading_0_0value?: boolean | undefined | ||
| 80 | _onItemDragStart_0_flag: AttributeUpdaterFlag = AttributeUpdaterFlag.INITIAL | 82 | _onItemDragStart_0_flag: AttributeUpdaterFlag = AttributeUpdaterFlag.INITIAL |
| 81 | _onItemDragStart_0_0value?: OnItemDragStartCallback | undefined | 83 | _onItemDragStart_0_0value?: OnItemDragStartCallback | undefined |
| 82 | _onItemDragEnter_0_flag: AttributeUpdaterFlag = AttributeUpdaterFlag.INITIAL | 84 | _onItemDragEnter_0_flag: AttributeUpdaterFlag = AttributeUpdaterFlag.INITIAL |
| @@ -436,6 +438,24 @@ export class GridModifier extends CommonMethodModifier implements GridAttribute, | |||
| 436 | } | 438 | } |
| 437 | } | 439 | } |
| 438 | } | 440 | } |
| 441 | + if (this._supportEmptyBranchInLazyLoading_0_flag != AttributeUpdaterFlag.INITIAL) | ||
| 442 | + { | ||
| 443 | + switch (this._supportEmptyBranchInLazyLoading_0_flag) { | ||
| 444 | + case AttributeUpdaterFlag.UPDATE: { | ||
| 445 | + peer.setSupportEmptyBranchInLazyLoadingAttribute((this._supportEmptyBranchInLazyLoading_0_0value as boolean | undefined)); | ||
| 446 | + this._supportEmptyBranchInLazyLoading_0_flag = AttributeUpdaterFlag.RESET; | ||
| 447 | + break; | ||
| 448 | + } | ||
| 449 | + case AttributeUpdaterFlag.SKIP: { | ||
| 450 | + this._supportEmptyBranchInLazyLoading_0_flag = AttributeUpdaterFlag.RESET; | ||
| 451 | + break; | ||
| 452 | + } | ||
| 453 | + default: { | ||
| 454 | + this._supportEmptyBranchInLazyLoading_0_flag = AttributeUpdaterFlag.INITIAL; | ||
| 455 | + peer.setSupportEmptyBranchInLazyLoadingAttribute((undefined as boolean | undefined)); | ||
| 456 | + } | ||
| 457 | + } | ||
| 458 | + } | ||
| 439 | if (this._onItemDragStart_0_flag != AttributeUpdaterFlag.INITIAL) | 459 | if (this._onItemDragStart_0_flag != AttributeUpdaterFlag.INITIAL) |
| 440 | { | 460 | { |
| 441 | switch (this._onItemDragStart_0_flag) { | 461 | switch (this._onItemDragStart_0_flag) { |
| @@ -1075,6 +1095,19 @@ export class GridModifier extends CommonMethodModifier implements GridAttribute, | |||
| 1075 | } | 1095 | } |
| 1076 | } | 1096 | } |
| 1077 | } | 1097 | } |
| 1098 | + if (modifier._supportEmptyBranchInLazyLoading_0_flag != AttributeUpdaterFlag.INITIAL) | ||
| 1099 | + { | ||
| 1100 | + switch (modifier._supportEmptyBranchInLazyLoading_0_flag) { | ||
| 1101 | + case AttributeUpdaterFlag.UPDATE: | ||
| 1102 | + case AttributeUpdaterFlag.SKIP: { | ||
| 1103 | + this.supportEmptyBranchInLazyLoading(modifier._supportEmptyBranchInLazyLoading_0_0value); | ||
| 1104 | + break; | ||
| 1105 | + } | ||
| 1106 | + default: { | ||
| 1107 | + this.supportEmptyBranchInLazyLoading((undefined as boolean | undefined)); | ||
| 1108 | + } | ||
| 1109 | + } | ||
| 1110 | + } | ||
| 1078 | if (modifier._onItemDragStart_0_flag != AttributeUpdaterFlag.INITIAL) | 1111 | if (modifier._onItemDragStart_0_flag != AttributeUpdaterFlag.INITIAL) |
| 1079 | { | 1112 | { |
| 1080 | switch (modifier._onItemDragStart_0_flag) { | 1113 | switch (modifier._onItemDragStart_0_flag) { |
| @@ -1562,6 +1595,17 @@ export class GridModifier extends CommonMethodModifier implements GridAttribute, | |||
| 1562 | } | 1595 | } |
| 1563 | return this | 1596 | return this |
| 1564 | } | 1597 | } |
| 1598 | + supportEmptyBranchInLazyLoading(value: boolean | undefined): this { | ||
| 1599 | + if (((this._supportEmptyBranchInLazyLoading_0_flag) == (AttributeUpdaterFlag.INITIAL)) || ((this._supportEmptyBranchInLazyLoading_0_0value) !== (value))) | ||
| 1600 | + { | ||
| 1601 | + this._supportEmptyBranchInLazyLoading_0_flag = AttributeUpdaterFlag.UPDATE | ||
| 1602 | + this._supportEmptyBranchInLazyLoading_0_0value = value | ||
| 1603 | + } else | ||
| 1604 | + { | ||
| 1605 | + this._supportEmptyBranchInLazyLoading_0_flag = AttributeUpdaterFlag.SKIP | ||
| 1606 | + } | ||
| 1607 | + return this | ||
| 1608 | + } | ||
| 1565 | onItemDragStart(value: OnItemDragStartCallback | undefined): this { | 1609 | onItemDragStart(value: OnItemDragStartCallback | undefined): this { |
| 1566 | if (((this._onItemDragStart_0_flag) == (AttributeUpdaterFlag.INITIAL)) || (true)) | 1610 | if (((this._onItemDragStart_0_flag) == (AttributeUpdaterFlag.INITIAL)) || (true)) |
| 1567 | { | 1611 | { |
Mframeworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/generated/ListModifier.ets+44-0
| @@ -68,6 +68,8 @@ export class ListModifier extends CommonMethodModifier implements ListAttribute, | |||
| 68 | _childrenMainSize_0_0value?: ChildrenMainSize | undefined | 68 | _childrenMainSize_0_0value?: ChildrenMainSize | undefined |
| 69 | _maintainVisibleContentPosition_0_flag: AttributeUpdaterFlag = AttributeUpdaterFlag.INITIAL | 69 | _maintainVisibleContentPosition_0_flag: AttributeUpdaterFlag = AttributeUpdaterFlag.INITIAL |
| 70 | _maintainVisibleContentPosition_0_0value?: boolean | undefined | 70 | _maintainVisibleContentPosition_0_0value?: boolean | undefined |
| 71 | + _supportEmptyBranchInLazyLoading_0_flag: AttributeUpdaterFlag = AttributeUpdaterFlag.INITIAL | ||
| 72 | + _supportEmptyBranchInLazyLoading_0_0value?: boolean | undefined | ||
| 71 | _stackFromEnd_0_flag: AttributeUpdaterFlag = AttributeUpdaterFlag.INITIAL | 73 | _stackFromEnd_0_flag: AttributeUpdaterFlag = AttributeUpdaterFlag.INITIAL |
| 72 | _stackFromEnd_0_0value?: boolean | undefined | 74 | _stackFromEnd_0_0value?: boolean | undefined |
| 73 | _onScrollIndex_0_flag: AttributeUpdaterFlag = AttributeUpdaterFlag.INITIAL | 75 | _onScrollIndex_0_flag: AttributeUpdaterFlag = AttributeUpdaterFlag.INITIAL |
| @@ -370,6 +372,24 @@ export class ListModifier extends CommonMethodModifier implements ListAttribute, | |||
| 370 | } | 372 | } |
| 371 | } | 373 | } |
| 372 | } | 374 | } |
| 375 | + if (this._supportEmptyBranchInLazyLoading_0_flag != AttributeUpdaterFlag.INITIAL) | ||
| 376 | + { | ||
| 377 | + switch (this._supportEmptyBranchInLazyLoading_0_flag) { | ||
| 378 | + case AttributeUpdaterFlag.UPDATE: { | ||
| 379 | + peer.setSupportEmptyBranchInLazyLoadingAttribute((this._supportEmptyBranchInLazyLoading_0_0value as boolean | undefined)); | ||
| 380 | + this._supportEmptyBranchInLazyLoading_0_flag = AttributeUpdaterFlag.RESET; | ||
| 381 | + break; | ||
| 382 | + } | ||
| 383 | + case AttributeUpdaterFlag.SKIP: { | ||
| 384 | + this._supportEmptyBranchInLazyLoading_0_flag = AttributeUpdaterFlag.RESET; | ||
| 385 | + break; | ||
| 386 | + } | ||
| 387 | + default: { | ||
| 388 | + this._supportEmptyBranchInLazyLoading_0_flag = AttributeUpdaterFlag.INITIAL; | ||
| 389 | + peer.setSupportEmptyBranchInLazyLoadingAttribute((undefined as boolean | undefined)); | ||
| 390 | + } | ||
| 391 | + } | ||
| 392 | + } | ||
| 373 | if (this._stackFromEnd_0_flag != AttributeUpdaterFlag.INITIAL) | 393 | if (this._stackFromEnd_0_flag != AttributeUpdaterFlag.INITIAL) |
| 374 | { | 394 | { |
| 375 | switch (this._stackFromEnd_0_flag) { | 395 | switch (this._stackFromEnd_0_flag) { |
| @@ -1083,6 +1103,19 @@ export class ListModifier extends CommonMethodModifier implements ListAttribute, | |||
| 1083 | } | 1103 | } |
| 1084 | } | 1104 | } |
| 1085 | } | 1105 | } |
| 1106 | + if (modifier._supportEmptyBranchInLazyLoading_0_flag != AttributeUpdaterFlag.INITIAL) | ||
| 1107 | + { | ||
| 1108 | + switch (modifier._supportEmptyBranchInLazyLoading_0_flag) { | ||
| 1109 | + case AttributeUpdaterFlag.UPDATE: | ||
| 1110 | + case AttributeUpdaterFlag.SKIP: { | ||
| 1111 | + this.supportEmptyBranchInLazyLoading(modifier._supportEmptyBranchInLazyLoading_0_0value); | ||
| 1112 | + break; | ||
| 1113 | + } | ||
| 1114 | + default: { | ||
| 1115 | + this.supportEmptyBranchInLazyLoading((undefined as boolean | undefined)); | ||
| 1116 | + } | ||
| 1117 | + } | ||
| 1118 | + } | ||
| 1086 | if (modifier._stackFromEnd_0_flag != AttributeUpdaterFlag.INITIAL) | 1119 | if (modifier._stackFromEnd_0_flag != AttributeUpdaterFlag.INITIAL) |
| 1087 | { | 1120 | { |
| 1088 | switch (modifier._stackFromEnd_0_flag) { | 1121 | switch (modifier._stackFromEnd_0_flag) { |
| @@ -1617,6 +1650,17 @@ export class ListModifier extends CommonMethodModifier implements ListAttribute, | |||
| 1617 | } | 1650 | } |
| 1618 | return this | 1651 | return this |
| 1619 | } | 1652 | } |
| 1653 | + supportEmptyBranchInLazyLoading(value: boolean | undefined): this { | ||
| 1654 | + if (((this._supportEmptyBranchInLazyLoading_0_flag) == (AttributeUpdaterFlag.INITIAL)) || ((this._supportEmptyBranchInLazyLoading_0_0value) !== (value))) | ||
| 1655 | + { | ||
| 1656 | + this._supportEmptyBranchInLazyLoading_0_flag = AttributeUpdaterFlag.UPDATE | ||
| 1657 | + this._supportEmptyBranchInLazyLoading_0_0value = value | ||
| 1658 | + } else | ||
| 1659 | + { | ||
| 1660 | + this._supportEmptyBranchInLazyLoading_0_flag = AttributeUpdaterFlag.SKIP | ||
| 1661 | + } | ||
| 1662 | + return this | ||
| 1663 | + } | ||
| 1620 | stackFromEnd(value: boolean | undefined): this { | 1664 | stackFromEnd(value: boolean | undefined): this { |
| 1621 | if (((this._stackFromEnd_0_flag) == (AttributeUpdaterFlag.INITIAL)) || ((this._stackFromEnd_0_0value) !== (value))) | 1665 | if (((this._stackFromEnd_0_flag) == (AttributeUpdaterFlag.INITIAL)) || ((this._stackFromEnd_0_0value) !== (value))) |
| 1622 | { | 1666 | { |
Mframeworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/generated/component/grid.ets+30-3
| @@ -17,7 +17,7 @@ | |||
| 17 | // WARNING! THIS FILE IS AUTO-GENERATED, DO NOT MAKE CHANGES, THEY WILL BE LOST ON NEXT GENERATION! | 17 | // WARNING! THIS FILE IS AUTO-GENERATED, DO NOT MAKE CHANGES, THEY WILL BE LOST ON NEXT GENERATION! |
| 18 | 18 | ||
| 19 | import { ArkThemeScopeManager } from "#arktheme" | 19 | import { ArkThemeScopeManager } from "#arktheme" |
| 20 | -import { SerializerBase, DeserializerBase, nullptr, KPointer, KInt, KBoolean, KStringPtr, runtimeType, RuntimeType, MaterializedBase, toPeerPtr, NativeBuffer, CallbackResource, InteropNativeModule, Tags, KSerializerBuffer, KInt32ArrayPtr } from "@koalaui/interop" | 20 | +import { SerializerBase, DeserializerBase, nullptr, KPointer, KInt, KBoolean, KStringPtr, runtimeType, RuntimeType, MaterializedBase, toPeerPtr, NativeBuffer, CallbackResource, InteropNativeModule, Tags, KSerializerBuffer, KUint8ArrayPtr } from "@koalaui/interop" |
| 21 | import { Scroller_serializer, OnScrollFrameBeginCallback, Scroller } from "./scroll" | 21 | import { Scroller_serializer, OnScrollFrameBeginCallback, Scroller } from "./scroll" |
| 22 | import { Resource_serializer } from "./../framework/resource" | 22 | import { Resource_serializer } from "./../framework/resource" |
| 23 | import { NestedScrollOptions_serializer, EdgeEffectOptions_serializer, ArkScrollableCommonMethodPeer, ScrollableCommonMethod, OnItemDragStartCallback, ItemDragInfo, NestedScrollOptions, OnWillScrollCallback, OnScrollCallback, CommonMethod, EdgeEffectOptions, ArkScrollableCommonMethodComponent, ArkScrollableCommonMethodStyle, ArkCommonMethodComponent, ArkCommonMethodStyle } from "./common" | 23 | import { NestedScrollOptions_serializer, EdgeEffectOptions_serializer, ArkScrollableCommonMethodPeer, ScrollableCommonMethod, OnItemDragStartCallback, ItemDragInfo, NestedScrollOptions, OnWillScrollCallback, OnScrollCallback, CommonMethod, EdgeEffectOptions, ArkScrollableCommonMethodComponent, ArkScrollableCommonMethodStyle, ArkCommonMethodComponent, ArkCommonMethodStyle } from "./common" |
| @@ -30,11 +30,11 @@ import { Resource } from "global.resource" | |||
| 30 | import { Color, BarState, ScrollSource, EdgeEffect } from "./enums" | 30 | import { Color, BarState, ScrollSource, EdgeEffect } from "./enums" |
| 31 | import { ScrollState } from "./list" | 31 | import { ScrollState } from "./list" |
| 32 | import { AttributeModifier, hookGridAttributeModifier, AttributeUpdater } from "#handwritten" | 32 | import { AttributeModifier, hookGridAttributeModifier, AttributeUpdater } from "#handwritten" |
| 33 | -import { ModifierStateManager } from '../CommonModifier'; | ||
| 34 | import { CallbackKind } from "./../framework/peers/CallbackKind" | 33 | import { CallbackKind } from "./../framework/peers/CallbackKind" |
| 35 | import { CallbackTransformer } from "./../CallbackTransformer" | 34 | import { CallbackTransformer } from "./../CallbackTransformer" |
| 36 | import { memo, memo_stable } from "@koalaui/runtime/annotations" | 35 | import { memo, memo_stable } from "@koalaui/runtime/annotations" |
| 37 | import { ComponentBuilder, Builder } from "@koalaui/builderLambda" | 36 | import { ComponentBuilder, Builder } from "@koalaui/builderLambda" |
| 37 | +import { ModifierStateManager } from "./../CommonModifier" | ||
| 38 | import { GridModifier } from "./../GridModifier" | 38 | import { GridModifier } from "./../GridModifier" |
| 39 | import { NodeAttach, remember } from "@koalaui/runtime" | 39 | import { NodeAttach, remember } from "@koalaui/runtime" |
| 40 | export class ArkGridPeer extends ArkScrollableCommonMethodPeer { | 40 | export class ArkGridPeer extends ArkScrollableCommonMethodPeer { |
| @@ -317,6 +317,18 @@ export class ArkGridPeer extends ArkScrollableCommonMethodPeer { | |||
| 317 | ArkUIGeneratedNativeModule._GridAttribute_setSupportAnimation(this.peer.ptr, thisSerializer.asBuffer(), thisSerializer.length()) | 317 | ArkUIGeneratedNativeModule._GridAttribute_setSupportAnimation(this.peer.ptr, thisSerializer.asBuffer(), thisSerializer.length()) |
| 318 | thisSerializer.release() | 318 | thisSerializer.release() |
| 319 | } | 319 | } |
| 320 | + setSupportEmptyBranchInLazyLoadingAttribute(value: boolean | undefined): void { | ||
idlize自动生成代码 ![]() ![]() | |||
| 321 | + const thisSerializer : SerializerBase = SerializerBase.hold() | ||
| 322 | + if (value !== undefined) { | ||
| 323 | + thisSerializer.writeInt8(RuntimeType.OBJECT) | ||
| 324 | + const valueTmpValue = value! | ||
| 325 | + thisSerializer.writeBoolean(valueTmpValue) | ||
| 326 | + } else { | ||
| 327 | + thisSerializer.writeInt8(RuntimeType.UNDEFINED) | ||
| 328 | + } | ||
| 329 | + ArkUIGeneratedNativeModule._GridAttribute_setSupportEmptyBranchInLazyLoading(this.peer.ptr, thisSerializer.asBuffer(), thisSerializer.length()) | ||
| 330 | + thisSerializer.release() | ||
| 331 | + } | ||
| 320 | setOnItemDragStartAttribute(value: OnItemDragStartCallback | undefined): void { | 332 | setOnItemDragStartAttribute(value: OnItemDragStartCallback | undefined): void { |
| 321 | const thisSerializer : SerializerBase = SerializerBase.hold() | 333 | const thisSerializer : SerializerBase = SerializerBase.hold() |
| 322 | if (value !== undefined) { | 334 | if (value !== undefined) { |
| @@ -581,6 +593,9 @@ export interface GridAttribute extends ScrollableCommonMethod { | |||
| 581 | supportAnimation(value: boolean | undefined): this { | 593 | supportAnimation(value: boolean | undefined): this { |
| 582 | throw new Error("Unimplemented method supportAnimation") | 594 | throw new Error("Unimplemented method supportAnimation") |
| 583 | } | 595 | } |
| 596 | + supportEmptyBranchInLazyLoading(value: boolean | undefined): this { | ||
| 597 | + throw new Error("Unimplemented method supportEmptyBranchInLazyLoading") | ||
| 598 | + } | ||
| 584 | onItemDragStart(value: OnItemDragStartCallback | undefined): this { | 599 | onItemDragStart(value: OnItemDragStartCallback | undefined): this { |
| 585 | throw new Error("Unimplemented method onItemDragStart") | 600 | throw new Error("Unimplemented method onItemDragStart") |
| 586 | } | 601 | } |
| @@ -639,6 +654,7 @@ export class ArkGridStyle extends ArkScrollableCommonMethodStyle implements Grid | |||
| 639 | cellLength_value?: double | undefined | 654 | cellLength_value?: double | undefined |
| 640 | layoutDirection_value?: GridDirection | undefined | 655 | layoutDirection_value?: GridDirection | undefined |
| 641 | supportAnimation_value?: boolean | undefined | 656 | supportAnimation_value?: boolean | undefined |
| 657 | + supportEmptyBranchInLazyLoading_value?: boolean | undefined | ||
| 642 | onItemDragStart_value?: OnItemDragStartCallback | undefined | 658 | onItemDragStart_value?: OnItemDragStartCallback | undefined |
| 643 | onItemDragEnter_value?: ((event: ItemDragInfo) => void) | undefined | 659 | onItemDragEnter_value?: ((event: ItemDragInfo) => void) | undefined |
| 644 | onItemDragMove_value?: ((event: ItemDragInfo,itemIndex: int32,insertIndex: int32) => void) | undefined | 660 | onItemDragMove_value?: ((event: ItemDragInfo,itemIndex: int32,insertIndex: int32) => void) | undefined |
| @@ -706,6 +722,9 @@ export class ArkGridStyle extends ArkScrollableCommonMethodStyle implements Grid | |||
| 706 | supportAnimation(value: boolean | undefined): this { | 722 | supportAnimation(value: boolean | undefined): this { |
| 707 | return this | 723 | return this |
| 708 | } | 724 | } |
| 725 | + supportEmptyBranchInLazyLoading(value: boolean | undefined): this { | ||
| 726 | + return this | ||
| 727 | + } | ||
| 709 | onItemDragStart(value: OnItemDragStartCallback | undefined): this { | 728 | onItemDragStart(value: OnItemDragStartCallback | undefined): this { |
| 710 | return this | 729 | return this |
| 711 | } | 730 | } |
| @@ -906,6 +925,14 @@ export class ArkGridComponent extends ArkScrollableCommonMethodComponent impleme | |||
| 906 | } | 925 | } |
| 907 | return this | 926 | return this |
| 908 | } | 927 | } |
| 928 | + public supportEmptyBranchInLazyLoading(value: boolean | undefined): this { | ||
| 929 | + if (this.checkPriority("supportEmptyBranchInLazyLoading")) { | ||
| 930 | + const value_casted = value as (boolean | undefined) | ||
| 931 | + this.getPeer()?.setSupportEmptyBranchInLazyLoadingAttribute(value_casted) | ||
| 932 | + return this | ||
| 933 | + } | ||
| 934 | + return this | ||
| 935 | + } | ||
| 909 | public onItemDragStart(value: OnItemDragStartCallback | undefined): this { | 936 | public onItemDragStart(value: OnItemDragStartCallback | undefined): this { |
| 910 | if (this.checkPriority("onItemDragStart")) { | 937 | if (this.checkPriority("onItemDragStart")) { |
| 911 | const value_casted = value as (OnItemDragStartCallback | undefined) | 938 | const value_casted = value as (OnItemDragStartCallback | undefined) |
| @@ -1022,7 +1049,7 @@ export class ArkGridComponent extends ArkScrollableCommonMethodComponent impleme | |||
| 1022 | } | 1049 | } |
| 1023 | public attributeModifier(value: AttributeModifier<GridAttribute> | AttributeModifier<ScrollableCommonMethod> | AttributeModifier<CommonMethod> | undefined): this { | 1050 | public attributeModifier(value: AttributeModifier<GridAttribute> | AttributeModifier<ScrollableCommonMethod> | AttributeModifier<CommonMethod> | undefined): this { |
| 1024 | ModifierStateManager.INSTANCE.scope(() => { | 1051 | ModifierStateManager.INSTANCE.scope(() => { |
| 1025 | - hookGridAttributeModifier(this, value); | 1052 | + hookGridAttributeModifier(this, value); |
| 1026 | }) | 1053 | }) |
| 1027 | return this | 1054 | return this |
| 1028 | } | 1055 | } |
Mframeworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/generated/component/list.ets+35-7
| @@ -28,12 +28,12 @@ import { ArkUIGeneratedNativeModule, TypeChecker } from "#components" | |||
| 28 | import { Axis, ScrollSource, Color } from "./enums" | 28 | import { Axis, ScrollSource, Color } from "./enums" |
| 29 | import { OnScrollFrameBeginCallback, Scroller, Scroller_serializer, ScrollerInternal, ScrollAlign } from "./scroll" | 29 | import { OnScrollFrameBeginCallback, Scroller, Scroller_serializer, ScrollerInternal, ScrollAlign } from "./scroll" |
| 30 | import { AttributeModifier, hookListAttributeModifier, AttributeUpdater, hookListChildrenMainSizeImpl } from "#handwritten" | 30 | import { AttributeModifier, hookListAttributeModifier, AttributeUpdater, hookListChildrenMainSizeImpl } from "#handwritten" |
| 31 | -import { ModifierStateManager } from '../CommonModifier'; | ||
| 32 | import { Resource } from "global.resource" | 31 | import { Resource } from "global.resource" |
| 33 | import { CallbackKind } from "./../framework/peers/CallbackKind" | 32 | import { CallbackKind } from "./../framework/peers/CallbackKind" |
| 34 | import { CallbackTransformer } from "./../CallbackTransformer" | 33 | import { CallbackTransformer } from "./../CallbackTransformer" |
| 35 | import { memo, memo_stable } from "@koalaui/runtime/annotations" | 34 | import { memo, memo_stable } from "@koalaui/runtime/annotations" |
| 36 | import { ComponentBuilder, Builder } from "@koalaui/builderLambda" | 35 | import { ComponentBuilder, Builder } from "@koalaui/builderLambda" |
| 36 | +import { ModifierStateManager } from "./../CommonModifier" | ||
| 37 | import { ListModifier } from "./../ListModifier" | 37 | import { ListModifier } from "./../ListModifier" |
| 38 | import { NodeAttach, remember } from "@koalaui/runtime" | 38 | import { NodeAttach, remember } from "@koalaui/runtime" |
| 39 | export class ArkListPeer extends ArkScrollableCommonMethodPeer { | 39 | export class ArkListPeer extends ArkScrollableCommonMethodPeer { |
| @@ -49,6 +49,7 @@ export class ArkListPeer extends ArkScrollableCommonMethodPeer { | |||
| 49 | return _peer | 49 | return _peer |
| 50 | } | 50 | } |
| 51 | setListOptionsAttribute(options?: ListOptions): void { | 51 | setListOptionsAttribute(options?: ListOptions): void { |
| 52 | + ArkThemeScopeManager.getInstance().applyThemeScopeIdToNode(this.peer.ptr); | ||
| 52 | const thisSerializer : SerializerBase = SerializerBase.hold() | 53 | const thisSerializer : SerializerBase = SerializerBase.hold() |
| 53 | if (options !== undefined) { | 54 | if (options !== undefined) { |
| 54 | thisSerializer.writeInt8(RuntimeType.OBJECT) | 55 | thisSerializer.writeInt8(RuntimeType.OBJECT) |
| @@ -217,6 +218,18 @@ export class ArkListPeer extends ArkScrollableCommonMethodPeer { | |||
| 217 | ArkUIGeneratedNativeModule._ListAttribute_setMaintainVisibleContentPosition(this.peer.ptr, thisSerializer.asBuffer(), thisSerializer.length()) | 218 | ArkUIGeneratedNativeModule._ListAttribute_setMaintainVisibleContentPosition(this.peer.ptr, thisSerializer.asBuffer(), thisSerializer.length()) |
| 218 | thisSerializer.release() | 219 | thisSerializer.release() |
| 219 | } | 220 | } |
| 221 | + setSupportEmptyBranchInLazyLoadingAttribute(value: boolean | undefined): void { | ||
| 222 | + const thisSerializer : SerializerBase = SerializerBase.hold() | ||
| 223 | + if (value !== undefined) { | ||
| 224 | + thisSerializer.writeInt8(RuntimeType.OBJECT) | ||
| 225 | + const valueTmpValue = value! | ||
| 226 | + thisSerializer.writeBoolean(valueTmpValue) | ||
| 227 | + } else { | ||
| 228 | + thisSerializer.writeInt8(RuntimeType.UNDEFINED) | ||
| 229 | + } | ||
| 230 | + ArkUIGeneratedNativeModule._ListAttribute_setSupportEmptyBranchInLazyLoading(this.peer.ptr, thisSerializer.asBuffer(), thisSerializer.length()) | ||
| 231 | + thisSerializer.release() | ||
| 232 | + } | ||
| 220 | setStackFromEndAttribute(value: boolean | undefined): void { | 233 | setStackFromEndAttribute(value: boolean | undefined): void { |
| 221 | const thisSerializer : SerializerBase = SerializerBase.hold() | 234 | const thisSerializer : SerializerBase = SerializerBase.hold() |
| 222 | if (value !== undefined) { | 235 | if (value !== undefined) { |
| @@ -533,6 +546,9 @@ export interface ListAttribute extends ScrollableCommonMethod { | |||
| 533 | maintainVisibleContentPosition(value: boolean | undefined): this { | 546 | maintainVisibleContentPosition(value: boolean | undefined): this { |
| 534 | throw new Error("Unimplemented method maintainVisibleContentPosition") | 547 | throw new Error("Unimplemented method maintainVisibleContentPosition") |
| 535 | } | 548 | } |
| 549 | + supportEmptyBranchInLazyLoading(value: boolean | undefined): this { | ||
| 550 | + throw new Error("Unimplemented method supportEmptyBranchInLazyLoading") | ||
| 551 | + } | ||
| 536 | stackFromEnd(value: boolean | undefined): this { | 552 | stackFromEnd(value: boolean | undefined): this { |
| 537 | throw new Error("Unimplemented method stackFromEnd") | 553 | throw new Error("Unimplemented method stackFromEnd") |
| 538 | } | 554 | } |
| @@ -593,6 +609,7 @@ export class ArkListStyle extends ArkScrollableCommonMethodStyle implements List | |||
| 593 | scrollSnapAlign_value?: ScrollSnapAlign | undefined | 609 | scrollSnapAlign_value?: ScrollSnapAlign | undefined |
| 594 | childrenMainSize_value?: ChildrenMainSize | undefined | 610 | childrenMainSize_value?: ChildrenMainSize | undefined |
| 595 | maintainVisibleContentPosition_value?: boolean | undefined | 611 | maintainVisibleContentPosition_value?: boolean | undefined |
| 612 | + supportEmptyBranchInLazyLoading_value?: boolean | undefined | ||
| 596 | stackFromEnd_value?: boolean | undefined | 613 | stackFromEnd_value?: boolean | undefined |
| 597 | onScrollIndex_value?: ((start: int32,end: int32,center: int32) => void) | undefined | 614 | onScrollIndex_value?: ((start: int32,end: int32,center: int32) => void) | undefined |
| 598 | onScrollVisibleContentChange_value?: OnScrollVisibleContentChangeCallback | undefined | 615 | onScrollVisibleContentChange_value?: OnScrollVisibleContentChangeCallback | undefined |
| @@ -648,6 +665,9 @@ export class ArkListStyle extends ArkScrollableCommonMethodStyle implements List | |||
| 648 | maintainVisibleContentPosition(value: boolean | undefined): this { | 665 | maintainVisibleContentPosition(value: boolean | undefined): this { |
| 649 | return this | 666 | return this |
| 650 | } | 667 | } |
| 668 | + supportEmptyBranchInLazyLoading(value: boolean | undefined): this { | ||
| 669 | + return this | ||
| 670 | + } | ||
| 651 | stackFromEnd(value: boolean | undefined): this { | 671 | stackFromEnd(value: boolean | undefined): this { |
| 652 | return this | 672 | return this |
| 653 | } | 673 | } |
| @@ -802,7 +822,7 @@ export class ArkListComponent extends ArkScrollableCommonMethodComponent impleme | |||
| 802 | public childrenMainSize(value: ChildrenMainSize | undefined): this { | 822 | public childrenMainSize(value: ChildrenMainSize | undefined): this { |
| 803 | if (this.checkPriority("childrenMainSize")) { | 823 | if (this.checkPriority("childrenMainSize")) { |
| 804 | const value_casted = value as (ChildrenMainSize | undefined) | 824 | const value_casted = value as (ChildrenMainSize | undefined) |
| 805 | - hookListChildrenMainSizeImpl(this, value_casted); | 825 | + hookListChildrenMainSizeImpl(this, value_casted) |
| 806 | return this | 826 | return this |
| 807 | } | 827 | } |
| 808 | return this | 828 | return this |
| @@ -815,6 +835,14 @@ export class ArkListComponent extends ArkScrollableCommonMethodComponent impleme | |||
| 815 | } | 835 | } |
| 816 | return this | 836 | return this |
| 817 | } | 837 | } |
| 838 | + public supportEmptyBranchInLazyLoading(value: boolean | undefined): this { | ||
| 839 | + if (this.checkPriority("supportEmptyBranchInLazyLoading")) { | ||
| 840 | + const value_casted = value as (boolean | undefined) | ||
| 841 | + this.getPeer()?.setSupportEmptyBranchInLazyLoadingAttribute(value_casted) | ||
| 842 | + return this | ||
| 843 | + } | ||
| 844 | + return this | ||
| 845 | + } | ||
| 818 | public stackFromEnd(value: boolean | undefined): this { | 846 | public stackFromEnd(value: boolean | undefined): this { |
| 819 | if (this.checkPriority("stackFromEnd")) { | 847 | if (this.checkPriority("stackFromEnd")) { |
| 820 | const value_casted = value as (boolean | undefined) | 848 | const value_casted = value as (boolean | undefined) |
| @@ -931,7 +959,7 @@ export class ArkListComponent extends ArkScrollableCommonMethodComponent impleme | |||
| 931 | } | 959 | } |
| 932 | public attributeModifier(value: AttributeModifier<ListAttribute> | AttributeModifier<ScrollableCommonMethod> | AttributeModifier<CommonMethod> | undefined): this { | 960 | public attributeModifier(value: AttributeModifier<ListAttribute> | AttributeModifier<ScrollableCommonMethod> | AttributeModifier<CommonMethod> | undefined): this { |
| 933 | ModifierStateManager.INSTANCE.scope(() => { | 961 | ModifierStateManager.INSTANCE.scope(() => { |
| 934 | - hookListAttributeModifier(this, value); | 962 | + hookListAttributeModifier(this, value); |
| 935 | }) | 963 | }) |
| 936 | return this | 964 | return this |
| 937 | } | 965 | } |
| @@ -1468,11 +1496,11 @@ export class ListScroller extends Scroller implements MaterializedBase { | |||
| 1468 | thisSerializer.writeInt8(RuntimeType.UNDEFINED) | 1496 | thisSerializer.writeInt8(RuntimeType.UNDEFINED) |
| 1469 | } | 1497 | } |
| 1470 | try { | 1498 | try { |
| 1471 | - ArkUIGeneratedNativeModule._ListScroller_scrollToItemInGroup(this.peer!.ptr, index, indexInGroup, thisSerializer.asBuffer(), thisSerializer.length()) | 1499 | + ArkUIGeneratedNativeModule._ListScroller_scrollToItemInGroup(this.peer!.ptr, index, indexInGroup, thisSerializer.asBuffer(), thisSerializer.length()) |
| 1472 | } catch (error) { | 1500 | } catch (error) { |
| 1473 | throw error | 1501 | throw error |
| 1474 | } finally { | 1502 | } finally { |
| 1475 | - thisSerializer.release() | 1503 | + thisSerializer.release() |
| 1476 | } | 1504 | } |
| 1477 | } | 1505 | } |
| 1478 | closeAllSwipeActions_serialize(options?: CloseSwipeActionOptions): void { | 1506 | closeAllSwipeActions_serialize(options?: CloseSwipeActionOptions): void { |
| @@ -1485,11 +1513,11 @@ export class ListScroller extends Scroller implements MaterializedBase { | |||
| 1485 | thisSerializer.writeInt8(RuntimeType.UNDEFINED) | 1513 | thisSerializer.writeInt8(RuntimeType.UNDEFINED) |
| 1486 | } | 1514 | } |
| 1487 | try { | 1515 | try { |
| 1488 | - ArkUIGeneratedNativeModule._ListScroller_closeAllSwipeActions(this.peer!.ptr, thisSerializer.asBuffer(), thisSerializer.length()) | 1516 | + ArkUIGeneratedNativeModule._ListScroller_closeAllSwipeActions(this.peer!.ptr, thisSerializer.asBuffer(), thisSerializer.length()) |
| 1489 | } catch (error) { | 1517 | } catch (error) { |
| 1490 | throw error | 1518 | throw error |
| 1491 | } finally { | 1519 | } finally { |
| 1492 | - thisSerializer.release() | 1520 | + thisSerializer.release() |
| 1493 | } | 1521 | } |
| 1494 | } | 1522 | } |
| 1495 | getVisibleListContentInfo_serialize(x: double, y: double): VisibleListContentInfo { | 1523 | getVisibleListContentInfo_serialize(x: double, y: double): VisibleListContentInfo { |
Mframeworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/generated/framework/arkts/ArkUIGeneratedNativeModule.ets+4-0
| @@ -901,6 +901,8 @@ export class ArkUIGeneratedNativeModule { | |||
| 901 | @ani.unsafe.Direct | 901 | @ani.unsafe.Direct |
| 902 | native static _GridAttribute_setSupportAnimation(ptr: KPointer, thisArray: KSerializerBuffer, thisLength: int32): void | 902 | native static _GridAttribute_setSupportAnimation(ptr: KPointer, thisArray: KSerializerBuffer, thisLength: int32): void |
| 903 | @ani.unsafe.Direct | 903 | @ani.unsafe.Direct |
| 904 | + native static _GridAttribute_setSupportEmptyBranchInLazyLoading(ptr: KPointer, thisArray: KSerializerBuffer, thisLength: int32): void | ||
| 905 | + @ani.unsafe.Direct | ||
| 904 | native static _GridAttribute_setOnItemDragStart(ptr: KPointer, thisArray: KSerializerBuffer, thisLength: int32): void | 906 | native static _GridAttribute_setOnItemDragStart(ptr: KPointer, thisArray: KSerializerBuffer, thisLength: int32): void |
| 905 | @ani.unsafe.Direct | 907 | @ani.unsafe.Direct |
| 906 | native static _GridAttribute_setOnItemDragEnter(ptr: KPointer, thisArray: KSerializerBuffer, thisLength: int32): void | 908 | native static _GridAttribute_setOnItemDragEnter(ptr: KPointer, thisArray: KSerializerBuffer, thisLength: int32): void |
| @@ -1157,6 +1159,8 @@ export class ArkUIGeneratedNativeModule { | |||
| 1157 | @ani.unsafe.Direct | 1159 | @ani.unsafe.Direct |
| 1158 | native static _ListAttribute_setMaintainVisibleContentPosition(ptr: KPointer, thisArray: KSerializerBuffer, thisLength: int32): void | 1160 | native static _ListAttribute_setMaintainVisibleContentPosition(ptr: KPointer, thisArray: KSerializerBuffer, thisLength: int32): void |
| 1159 | @ani.unsafe.Direct | 1161 | @ani.unsafe.Direct |
| 1162 | + native static _ListAttribute_setSupportEmptyBranchInLazyLoading(ptr: KPointer, thisArray: KSerializerBuffer, thisLength: int32): void | ||
| 1163 | + @ani.unsafe.Direct | ||
| 1160 | native static _ListAttribute_setStackFromEnd(ptr: KPointer, thisArray: KSerializerBuffer, thisLength: int32): void | 1164 | native static _ListAttribute_setStackFromEnd(ptr: KPointer, thisArray: KSerializerBuffer, thisLength: int32): void |
| 1161 | @ani.unsafe.Direct | 1165 | @ani.unsafe.Direct |
| 1162 | native static _ListAttribute_setOnScrollIndex(ptr: KPointer, thisArray: KSerializerBuffer, thisLength: int32): void | 1166 | native static _ListAttribute_setOnScrollIndex(ptr: KPointer, thisArray: KSerializerBuffer, thisLength: int32): void |
Mframeworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/typedNode/ArkGridNode.ets+5-0
| @@ -287,6 +287,11 @@ export class ArkGridNode extends ArkScrollableNode implements GridAttribute { | |||
| 287 | this.markDirty() | 287 | this.markDirty() |
| 288 | return this | 288 | return this |
| 289 | } | 289 | } |
| 290 | + supportEmptyBranchInLazyLoading(supported: boolean | undefined): this { | ||
| 291 | + this.getPeer()?.setSupportEmptyBranchInLazyLoadingAttribute(supported) | ||
| 292 | + this.markDirty() | ||
| 293 | + return this | ||
| 294 | + } | ||
ArkUI1.2 TypedNode支持 ![]() ![]() | |||
| 290 | attributeModifier(value: AttributeModifier<GridAttribute> | AttributeModifier<ScrollableCommonMethod> | | 295 | attributeModifier(value: AttributeModifier<GridAttribute> | AttributeModifier<ScrollableCommonMethod> | |
| 291 | AttributeModifier<CommonMethod> | undefined): this { | 296 | AttributeModifier<CommonMethod> | undefined): this { |
| 292 | throw new Error('Unimplemented method attributeModifier') | 297 | throw new Error('Unimplemented method attributeModifier') |
Mframeworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/typedNode/ArkListNode.ets+5-0
| @@ -305,6 +305,11 @@ export class ArkListNode extends ArkScrollableNode implements ListAttribute { | |||
| 305 | this.markDirty() | 305 | this.markDirty() |
| 306 | return this | 306 | return this |
| 307 | } | 307 | } |
| 308 | + supportEmptyBranchInLazyLoading(value: boolean | undefined): this { | ||
| 309 | + this.getPeer()?.setSupportEmptyBranchInLazyLoadingAttribute(value) | ||
| 310 | + this.markDirty() | ||
| 311 | + return this | ||
| 312 | + } | ||
| 308 | attributeModifier( | 313 | attributeModifier( |
| 309 | value: AttributeModifier<ListAttribute> | | 314 | value: AttributeModifier<ListAttribute> | |
| 310 | AttributeModifier<ScrollableCommonMethod> | | 315 | AttributeModifier<ScrollableCommonMethod> | |
Mframeworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/framework/native/src/generated/arkoala_api_generated.h+4-0
| @@ -23625,6 +23625,8 @@ typedef struct GENERATED_ArkUIGridModifier { | |||
| 23625 | const Opt_GridDirection* value); | 23625 | const Opt_GridDirection* value); |
| 23626 | void (*setSupportAnimation)(Ark_NativePointer node, | 23626 | void (*setSupportAnimation)(Ark_NativePointer node, |
| 23627 | const Opt_Boolean* value); | 23627 | const Opt_Boolean* value); |
| 23628 | + void (*setSupportEmptyBranchInLazyLoading)(Ark_NativePointer node, | ||
| 23629 | + const Opt_Boolean* value); | ||
| 23628 | void (*setOnItemDragStart)(Ark_NativePointer node, | 23630 | void (*setOnItemDragStart)(Ark_NativePointer node, |
| 23629 | const Opt_OnItemDragStartCallback* value); | 23631 | const Opt_OnItemDragStartCallback* value); |
| 23630 | void (*setOnItemDragEnter)(Ark_NativePointer node, | 23632 | void (*setOnItemDragEnter)(Ark_NativePointer node, |
| @@ -23923,6 +23925,8 @@ typedef struct GENERATED_ArkUIListModifier { | |||
| 23923 | const Opt_ChildrenMainSize* value); | 23925 | const Opt_ChildrenMainSize* value); |
| 23924 | void (*setMaintainVisibleContentPosition)(Ark_NativePointer node, | 23926 | void (*setMaintainVisibleContentPosition)(Ark_NativePointer node, |
| 23925 | const Opt_Boolean* value); | 23927 | const Opt_Boolean* value); |
| 23928 | + void (*setSupportEmptyBranchInLazyLoading)(Ark_NativePointer node, | ||
| 23929 | + const Opt_Boolean* value); | ||
| 23926 | void (*setStackFromEnd)(Ark_NativePointer node, | 23930 | void (*setStackFromEnd)(Ark_NativePointer node, |
| 23927 | const Opt_Boolean* value); | 23931 | const Opt_Boolean* value); |
| 23928 | void (*setOnScrollIndex)(Ark_NativePointer node, | 23932 | void (*setOnScrollIndex)(Ark_NativePointer node, |
Mframeworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/framework/native/src/generated/bridge_generated.cc+26-0
| @@ -7736,6 +7736,19 @@ void impl_GridAttribute_setSupportAnimation(Ark_NativePointer thisPtr, KSerializ | |||
| 7736 | GetNodeModifiers()->getGridModifier()->setSupportAnimation(self, static_cast<Opt_Boolean*>(&valueValueTemp)); | 7736 | GetNodeModifiers()->getGridModifier()->setSupportAnimation(self, static_cast<Opt_Boolean*>(&valueValueTemp)); |
| 7737 | } | 7737 | } |
| 7738 | KOALA_INTEROP_DIRECT_V3(GridAttribute_setSupportAnimation, Ark_NativePointer, KSerializerBuffer, int32_t) | 7738 | KOALA_INTEROP_DIRECT_V3(GridAttribute_setSupportAnimation, Ark_NativePointer, KSerializerBuffer, int32_t) |
| 7739 | +void impl_GridAttribute_setSupportEmptyBranchInLazyLoading(Ark_NativePointer thisPtr, KSerializerBuffer thisArray, int32_t thisLength) { | ||
idlize自动生成代码 ![]() ![]() | |||
| 7740 | + Ark_NodeHandle self = reinterpret_cast<Ark_NodeHandle>(thisPtr); | ||
| 7741 | + DeserializerBase thisDeserializer(thisArray, thisLength); | ||
| 7742 | + const auto valueValueTempTmpBuf_runtimeType = static_cast<Ark_RuntimeType>(thisDeserializer.readInt8()); | ||
| 7743 | + Opt_Boolean valueValueTempTmpBuf = {}; | ||
| 7744 | + valueValueTempTmpBuf.tag = valueValueTempTmpBuf_runtimeType == INTEROP_RUNTIME_UNDEFINED ? INTEROP_TAG_UNDEFINED : INTEROP_TAG_OBJECT; | ||
| 7745 | + if ((valueValueTempTmpBuf_runtimeType) != (INTEROP_RUNTIME_UNDEFINED)) { | ||
| 7746 | + valueValueTempTmpBuf.value = thisDeserializer.readBoolean(); | ||
| 7747 | + } | ||
| 7748 | + Opt_Boolean valueValueTemp = valueValueTempTmpBuf;; | ||
| 7749 | + GetNodeModifiers()->getGridModifier()->setSupportEmptyBranchInLazyLoading(self, static_cast<Opt_Boolean*>(&valueValueTemp)); | ||
| 7750 | +} | ||
| 7751 | +KOALA_INTEROP_DIRECT_V3(GridAttribute_setSupportEmptyBranchInLazyLoading, Ark_NativePointer, KSerializerBuffer, int32_t) | ||
| 7739 | void impl_GridAttribute_setOnItemDragStart(Ark_NativePointer thisPtr, KSerializerBuffer thisArray, int32_t thisLength) { | 7752 | void impl_GridAttribute_setOnItemDragStart(Ark_NativePointer thisPtr, KSerializerBuffer thisArray, int32_t thisLength) { |
| 7740 | Ark_NodeHandle self = reinterpret_cast<Ark_NodeHandle>(thisPtr); | 7753 | Ark_NodeHandle self = reinterpret_cast<Ark_NodeHandle>(thisPtr); |
| 7741 | DeserializerBase thisDeserializer(thisArray, thisLength); | 7754 | DeserializerBase thisDeserializer(thisArray, thisLength); |
| @@ -9606,6 +9619,19 @@ void impl_ListAttribute_setMaintainVisibleContentPosition(Ark_NativePointer this | |||
| 9606 | GetNodeModifiers()->getListModifier()->setMaintainVisibleContentPosition(self, static_cast<Opt_Boolean*>(&valueValueTemp)); | 9619 | GetNodeModifiers()->getListModifier()->setMaintainVisibleContentPosition(self, static_cast<Opt_Boolean*>(&valueValueTemp)); |
| 9607 | } | 9620 | } |
| 9608 | KOALA_INTEROP_DIRECT_V3(ListAttribute_setMaintainVisibleContentPosition, Ark_NativePointer, KSerializerBuffer, int32_t) | 9621 | KOALA_INTEROP_DIRECT_V3(ListAttribute_setMaintainVisibleContentPosition, Ark_NativePointer, KSerializerBuffer, int32_t) |
| 9622 | +void impl_ListAttribute_setSupportEmptyBranchInLazyLoading(Ark_NativePointer thisPtr, KSerializerBuffer thisArray, int32_t thisLength) { | ||
| 9623 | + Ark_NodeHandle self = reinterpret_cast<Ark_NodeHandle>(thisPtr); | ||
| 9624 | + DeserializerBase thisDeserializer(thisArray, thisLength); | ||
| 9625 | + const auto valueValueTempTmpBuf_runtimeType = static_cast<Ark_RuntimeType>(thisDeserializer.readInt8()); | ||
| 9626 | + Opt_Boolean valueValueTempTmpBuf = {}; | ||
| 9627 | + valueValueTempTmpBuf.tag = valueValueTempTmpBuf_runtimeType == INTEROP_RUNTIME_UNDEFINED ? INTEROP_TAG_UNDEFINED : INTEROP_TAG_OBJECT; | ||
| 9628 | + if ((valueValueTempTmpBuf_runtimeType) != (INTEROP_RUNTIME_UNDEFINED)) { | ||
| 9629 | + valueValueTempTmpBuf.value = thisDeserializer.readBoolean(); | ||
| 9630 | + } | ||
| 9631 | + Opt_Boolean valueValueTemp = valueValueTempTmpBuf;; | ||
| 9632 | + GetNodeModifiers()->getListModifier()->setSupportEmptyBranchInLazyLoading(self, static_cast<Opt_Boolean*>(&valueValueTemp)); | ||
| 9633 | +} | ||
| 9634 | +KOALA_INTEROP_DIRECT_V3(ListAttribute_setSupportEmptyBranchInLazyLoading, Ark_NativePointer, KSerializerBuffer, int32_t) | ||
| 9609 | void impl_ListAttribute_setStackFromEnd(Ark_NativePointer thisPtr, KSerializerBuffer thisArray, int32_t thisLength) { | 9635 | void impl_ListAttribute_setStackFromEnd(Ark_NativePointer thisPtr, KSerializerBuffer thisArray, int32_t thisLength) { |
| 9610 | Ark_NodeHandle self = reinterpret_cast<Ark_NodeHandle>(thisPtr); | 9636 | Ark_NodeHandle self = reinterpret_cast<Ark_NodeHandle>(thisPtr); |
| 9611 | DeserializerBase thisDeserializer(thisArray, thisLength); | 9637 | DeserializerBase thisDeserializer(thisArray, thisLength); |
| @@ -192,7 +192,7 @@ class ArkGridComponent extends ArkScrollable<GridAttribute> implements GridAttri | |||
| 192 | modifierWithKey(this._modifiersWithKeys, GridOnDidScrollModifier.identity, GridOnDidScrollModifier, callback); | 192 | modifierWithKey(this._modifiersWithKeys, GridOnDidScrollModifier.identity, GridOnDidScrollModifier, callback); |
| 193 | return this; | 193 | return this; |
| 194 | } | 194 | } |
| 195 | - supportLazyLoadingEmptyBranch(value): this { | 195 | + supportEmptyBranchInLazyLoading(value): this { |
| 196 | modifierWithKey(this._modifiersWithKeys, GridSupportLazyLoadingEmptyBranchModifier.identity, GridSupportLazyLoadingEmptyBranchModifier, value); | 196 | modifierWithKey(this._modifiersWithKeys, GridSupportLazyLoadingEmptyBranchModifier.identity, GridSupportLazyLoadingEmptyBranchModifier, value); |
| 197 | return this; | 197 | return this; |
| 198 | } | 198 | } |
| @@ -666,6 +666,21 @@ class ListFocusWrapModeModifier extends ModifierWithKey<FocusWrapMode> { | |||
| 666 | } | 666 | } |
| 667 | } | 667 | } |
| 668 | } | 668 | } |
| 669 | + | ||
| 670 | +class ListSupportEmptyBranchInLazyLoading extends ModifierWithKey<boolean> { | ||
| 671 | + constructor(value) { | ||
| 672 | + super(value); | ||
| 673 | + } | ||
| 674 | + static identity: Symbol = Symbol('listSupportEmptyBranchInLazyLoading '); | ||
| 675 | + applyPeer(node: KNode, reset: boolean): void { | ||
| 676 | + if (reset) { | ||
| 677 | + getUINativeModule().list.setSupportLazyLoadingEmptyBranch(node, false); | ||
| 678 | + } else { | ||
| 679 | + getUINativeModule().list.setSupportLazyLoadingEmptyBranch(node, this.value); | ||
| 680 | + } | ||
| 681 | + } | ||
| 682 | +} | ||
| 683 | + | ||
| 669 | interface ListParam { | 684 | interface ListParam { |
| 670 | initialIndex?: number; | 685 | initialIndex?: number; |
| 671 | space?: number | string; | 686 | space?: number | string; |
| @@ -882,6 +897,10 @@ class ArkListComponent extends ArkScrollable<ListAttribute> implements ListAttri | |||
| 882 | modifierWithKey(this._modifiersWithKeys, ListFocusWrapModeModifier.identity, ListFocusWrapModeModifier, value); | 897 | modifierWithKey(this._modifiersWithKeys, ListFocusWrapModeModifier.identity, ListFocusWrapModeModifier, value); |
| 883 | return this; | 898 | return this; |
| 884 | } | 899 | } |
| 900 | + supportEmptyBranchInLazyLoading(value: boolean): this { | ||
| 901 | + modifierWithKey(this._modifiersWithKeys, ListSupportEmptyBranchInLazyLoading.identity, ListSupportEmptyBranchInLazyLoading, value); | ||
| 902 | + return this; | ||
| 903 | + } | ||
| 885 | } | 904 | } |
| 886 | 905 | ||
| 887 | // @ts-ignore | 906 | // @ts-ignore |
| @@ -7645,7 +7645,7 @@ class ArkGridComponent extends ArkScrollable { | |||
| 7645 | modifierWithKey(this._modifiersWithKeys, GridOnDidScrollModifier.identity, GridOnDidScrollModifier, callback); | 7645 | modifierWithKey(this._modifiersWithKeys, GridOnDidScrollModifier.identity, GridOnDidScrollModifier, callback); |
| 7646 | return this; | 7646 | return this; |
| 7647 | } | 7647 | } |
| 7648 | - supportLazyLoadingEmptyBranch(value) { | 7648 | + supportEmptyBranchInLazyLoading(value) { |
| 7649 | modifierWithKey(this._modifiersWithKeys, GridSupportLazyLoadingEmptyBranchModifier.identity, GridSupportLazyLoadingEmptyBranchModifier, value); | 7649 | modifierWithKey(this._modifiersWithKeys, GridSupportLazyLoadingEmptyBranchModifier.identity, GridSupportLazyLoadingEmptyBranchModifier, value); |
| 7650 | return this; | 7650 | return this; |
| 7651 | } | 7651 | } |
| @@ -7960,7 +7960,7 @@ class GridSupportLazyLoadingEmptyBranchModifier extends ModifierWithKey { | |||
| 7960 | } | 7960 | } |
| 7961 | } | 7961 | } |
| 7962 | } | 7962 | } |
| 7963 | -GridSupportLazyLoadingEmptyBranchModifier.identity = Symbol('supportLazyLoadingEmptyBranch'); | 7963 | +GridSupportLazyLoadingEmptyBranchModifier.identity = Symbol('gridSupportEmptyBranchInLazyLoading'); |
| 7964 | class GridOnReachStartModifier extends ModifierWithKey { | 7964 | class GridOnReachStartModifier extends ModifierWithKey { |
| 7965 | constructor(value) { | 7965 | constructor(value) { |
| 7966 | super(value); | 7966 | super(value); |
| @@ -36753,6 +36753,21 @@ class ListInitialScrollerModifier extends ModifierWithKey { | |||
| 36753 | } | 36753 | } |
| 36754 | ListInitialScrollerModifier.identity = Symbol('listInitialScroller'); | 36754 | ListInitialScrollerModifier.identity = Symbol('listInitialScroller'); |
| 36755 | 36755 | ||
| 36756 | +class ListSupportEmptyBranchInLazyLoading extends ModifierWithKey { | ||
| 36757 | + constructor(value) { | ||
| 36758 | + super(value); | ||
| 36759 | + } | ||
| 36760 | + applyPeer(node, reset) { | ||
| 36761 | + if (reset) { | ||
| 36762 | + getUINativeModule().list.setSupportEmptyBranchInLazyLoading(node, false); | ||
| 36763 | + } | ||
| 36764 | + else { | ||
| 36765 | + getUINativeModule().list.setSupportEmptyBranchInLazyLoading(node, this.value); | ||
| 36766 | + } | ||
| 36767 | + } | ||
| 36768 | +} | ||
| 36769 | +ListSupportEmptyBranchInLazyLoading.identity = Symbol('listSupportEmptyBranchInLazyLoading'); | ||
| 36770 | + | ||
| 36756 | class ArkListComponent extends ArkScrollable { | 36771 | class ArkListComponent extends ArkScrollable { |
| 36757 | constructor(nativePtr, classType) { | 36772 | constructor(nativePtr, classType) { |
| 36758 | super(nativePtr, classType); | 36773 | super(nativePtr, classType); |
| @@ -36966,6 +36981,10 @@ class ArkListComponent extends ArkScrollable { | |||
| 36966 | modifierWithKey(this._modifiersWithKeys, ListChildrenMainSizeModifier.identity, ListChildrenMainSizeModifier, value); | 36981 | modifierWithKey(this._modifiersWithKeys, ListChildrenMainSizeModifier.identity, ListChildrenMainSizeModifier, value); |
| 36967 | return this; | 36982 | return this; |
| 36968 | } | 36983 | } |
| 36984 | + supportEmptyBranchInLazyLoading(value) { | ||
| 36985 | + modifierWithKey(this._modifiersWithKeys, ListSupportEmptyBranchInLazyLoading.identity, ListSupportEmptyBranchInLazyLoading, value); | ||
| 36986 | + return this; | ||
| 36987 | + } | ||
| 36969 | } | 36988 | } |
| 36970 | // @ts-ignore | 36989 | // @ts-ignore |
| 36971 | if (globalThis.List !== undefined) { | 36990 | if (globalThis.List !== undefined) { |
Mframeworks/bridge/declarative_frontend/engine/jsi/nativeModule/arkts_native_api_impl_bridge.cpp+2-0
| @@ -5158,6 +5158,8 @@ void ArkUINativeModule::RegisterListAttributes(Local<panda::ObjectRef> object, E | |||
| 5158 | panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), ListBridge::SetOnListReachEnd)); | 5158 | panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), ListBridge::SetOnListReachEnd)); |
| 5159 | list->Set(vm, panda::StringRef::NewFromUtf8(vm, "resetOnReachEnd"), | 5159 | list->Set(vm, panda::StringRef::NewFromUtf8(vm, "resetOnReachEnd"), |
| 5160 | panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), ListBridge::ResetOnListReachEnd)); | 5160 | panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), ListBridge::ResetOnListReachEnd)); |
| 5161 | + list->Set(vm, panda::StringRef::NewFromUtf8(vm, "setSupportEmptyBranchInLazyLoading"), | ||
绑定跨语言接口,供Modifier调用 ![]() ![]() | |||
| 5162 | + panda::FunctionRef::New(const_cast<panda::EcmaVM*>(vm), ListBridge::SetSupportEmptyBranchInLazyLoading)); | ||
| 5161 | object->Set(vm, panda::StringRef::NewFromUtf8(vm, "list"), list); | 5163 | object->Set(vm, panda::StringRef::NewFromUtf8(vm, "list"), list); |
| 5162 | } | 5164 | } |
| 5163 | 5165 | ||
| @@ -1238,7 +1238,7 @@ ArkUINativeModuleValue GridBridge::SetSupportLazyLoadingEmptyBranch(ArkUIRuntime | |||
| 1238 | auto nativeNode = nodePtr(node->ToNativePointer(vm)->Value()); | 1238 | auto nativeNode = nodePtr(node->ToNativePointer(vm)->Value()); |
| 1239 | 1239 | ||
| 1240 | GetArkUINodeModifiers()->getGridModifier()->setSupportLazyLoadingEmptyBranch( | 1240 | GetArkUINodeModifiers()->getGridModifier()->setSupportLazyLoadingEmptyBranch( |
| 1241 | - nativeNode, arg_support->IsBoolean() ? arg_support->ToBoolean(vm)->Value() : true); | 1241 | + nativeNode, arg_support->IsBoolean() ? arg_support->ToBoolean(vm)->Value() : false); |
| 1242 | 1242 | ||
| 1243 | return panda::JSValueRef::Undefined(vm); | 1243 | return panda::JSValueRef::Undefined(vm); |
| 1244 | } | 1244 | } |
| @@ -1716,4 +1716,20 @@ ArkUINativeModuleValue ListBridge::ResetOnListReachEnd(ArkUIRuntimeCallInfo* run | |||
| 1716 | GetArkUINodeModifiers()->getListModifier()->resetOnListReachEnd(nativeNode); | 1716 | GetArkUINodeModifiers()->getListModifier()->resetOnListReachEnd(nativeNode); |
| 1717 | return panda::JSValueRef::Undefined(vm); | 1717 | return panda::JSValueRef::Undefined(vm); |
| 1718 | } | 1718 | } |
| 1719 | + | ||
| 1720 | +ArkUINativeModuleValue ListBridge::SetSupportEmptyBranchInLazyLoading(ArkUIRuntimeCallInfo* runtimeCallInfo) | ||
| 1721 | +{ | ||
| 1722 | + EcmaVM* vm = runtimeCallInfo->GetVM(); | ||
| 1723 | + CHECK_NULL_RETURN(vm, panda::NativePointerRef::New(vm, nullptr)); | ||
| 1724 | + Local<JSValueRef> node = runtimeCallInfo->GetCallArgRef(LIST_ARG_INDEX_0); | ||
| 1725 | + Local<JSValueRef> arg_support = runtimeCallInfo->GetCallArgRef(LIST_ARG_INDEX_1); | ||
| 1726 | + | ||
| 1727 | + CHECK_NULL_RETURN(node->IsNativePointer(vm), panda::JSValueRef::Undefined(vm)); | ||
| 1728 | + auto nativeNode = nodePtr(node->ToNativePointer(vm)->Value()); | ||
| 1729 | + | ||
| 1730 | + GetArkUINodeModifiers()->getListModifier()->setSupportEmptyBranchInLazyLoading( | ||
| 1731 | + nativeNode, arg_support->IsBoolean() ? arg_support->ToBoolean(vm)->Value() : false); | ||
| 1732 | + | ||
| 1733 | + return panda::JSValueRef::Undefined(vm); | ||
| 1734 | +} | ||
| 1719 | } // namespace OHOS::Ace::NG | 1735 | } // namespace OHOS::Ace::NG |
| @@ -94,6 +94,7 @@ public: | |||
| 94 | static ArkUINativeModuleValue SetOnListDidScroll(ArkUIRuntimeCallInfo* runtimeCallInfo); | 94 | static ArkUINativeModuleValue SetOnListDidScroll(ArkUIRuntimeCallInfo* runtimeCallInfo); |
| 95 | static ArkUINativeModuleValue SetOnListReachStart(ArkUIRuntimeCallInfo* runtimeCallInfo); | 95 | static ArkUINativeModuleValue SetOnListReachStart(ArkUIRuntimeCallInfo* runtimeCallInfo); |
| 96 | static ArkUINativeModuleValue SetOnListReachEnd(ArkUIRuntimeCallInfo* runtimeCallInfo); | 96 | static ArkUINativeModuleValue SetOnListReachEnd(ArkUIRuntimeCallInfo* runtimeCallInfo); |
| 97 | + static ArkUINativeModuleValue SetSupportEmptyBranchInLazyLoading(ArkUIRuntimeCallInfo* runtimeCallInfo); | ||
| 97 | 98 | ||
| 98 | static ArkUINativeModuleValue ResetOnScrollIndex(ArkUIRuntimeCallInfo* runtimeCallInfo); | 99 | static ArkUINativeModuleValue ResetOnScrollIndex(ArkUIRuntimeCallInfo* runtimeCallInfo); |
| 99 | static ArkUINativeModuleValue ResetOnScrollVisibleContentChange(ArkUIRuntimeCallInfo* runtimeCallInfo); | 100 | static ArkUINativeModuleValue ResetOnScrollVisibleContentChange(ArkUIRuntimeCallInfo* runtimeCallInfo); |
| @@ -454,7 +454,7 @@ void JSGrid::JSBind(BindingTarget globalObj) | |||
| 454 | JSClass<JSGrid>::StaticMethod("focusWrapMode", &JSGrid::SetFocusWrapMode); | 454 | JSClass<JSGrid>::StaticMethod("focusWrapMode", &JSGrid::SetFocusWrapMode); |
| 455 | JSClass<JSGrid>::StaticMethod("alignItems", &JSGrid::SetAlignItems); | 455 | JSClass<JSGrid>::StaticMethod("alignItems", &JSGrid::SetAlignItems); |
| 456 | JSClass<JSGrid>::StaticMethod("syncLoad", &JSGrid::SetSyncLoad); | 456 | JSClass<JSGrid>::StaticMethod("syncLoad", &JSGrid::SetSyncLoad); |
| 457 | - JSClass<JSGrid>::StaticMethod("supportLazyLoadingEmptyBranch", &JSGrid::SetSupportLazyLoadingEmptyBranch); | 457 | + JSClass<JSGrid>::StaticMethod("supportEmptyBranchInLazyLoading", &JSGrid::SetSupportLazyLoadingEmptyBranch); |
修改接口名,适配最终版接口 ![]() ![]() | |||
| 458 | 458 | ||
| 459 | JSClass<JSGrid>::StaticMethod("onScroll", &JSGrid::JsOnScroll); | 459 | JSClass<JSGrid>::StaticMethod("onScroll", &JSGrid::JsOnScroll); |
| 460 | JSClass<JSGrid>::StaticMethod("onReachStart", &JSGrid::JsOnReachStart); | 460 | JSClass<JSGrid>::StaticMethod("onReachStart", &JSGrid::JsOnReachStart); |
| @@ -798,20 +798,20 @@ void JSGrid::SetSyncLoad(const JSCallbackInfo& info) | |||
| 798 | } | 798 | } |
| 799 | 799 | ||
| 800 | /** | 800 | /** |
| 801 | - * JS API definition: supportLazyLoadingEmptyBranch(supported: boolean | undefined): GridAttribute; | 801 | + * JS API definition: supportEmptyBranchInLazyLoading(supported: boolean | undefined): GridAttribute; |
| 802 | * supported: true - enable lazy loading for empty branch, false - disable lazy loading for empty branch | 802 | * supported: true - enable lazy loading for empty branch, false - disable lazy loading for empty branch |
| 803 | * if supported is undefined, disable lazy loading for empty branch | 803 | * if supported is undefined, disable lazy loading for empty branch |
| 804 | */ | 804 | */ |
| 805 | void JSGrid::SetSupportLazyLoadingEmptyBranch(const JSCallbackInfo& info) | 805 | void JSGrid::SetSupportLazyLoadingEmptyBranch(const JSCallbackInfo& info) |
| 806 | { | 806 | { |
| 807 | - bool supportLazyLoadingEmptyBranch = false; | 807 | + bool enable = false; |
如果开发者传入undefined,或者异常值,则恢复false的默认值 ![]() ![]() | |||
| 808 | if (info.Length() == 1) { | 808 | if (info.Length() == 1) { |
| 809 | auto value = info[0]; | 809 | auto value = info[0]; |
| 810 | if (value->IsBoolean()) { | 810 | if (value->IsBoolean()) { |
| 811 | - supportLazyLoadingEmptyBranch = value->ToBoolean(); | 811 | + enable = value->ToBoolean(); |
| 812 | } | 812 | } |
| 813 | } | 813 | } |
| 814 | - GridModel::GetInstance()->SetSupportLazyLoadingEmptyBranch(supportLazyLoadingEmptyBranch); | 814 | + GridModel::GetInstance()->SetSupportLazyLoadingEmptyBranch(enable); |
| 815 | } | 815 | } |
| 816 | 816 | ||
| 817 | void JSGrid::JsOnScroll(const JSCallbackInfo& args) | 817 | void JSGrid::JsOnScroll(const JSCallbackInfo& args) |
| @@ -998,6 +998,16 @@ void JSList::ScrollFrameBeginCallback(const JSCallbackInfo& args) | |||
| 998 | } | 998 | } |
| 999 | } | 999 | } |
| 1000 | 1000 | ||
| 1001 | +void JSList::SetSupportEmptyBranchInLazyLoading(const JSCallbackInfo& args) | ||
| 1002 | +{ | ||
| 1003 | + bool supportEmptyBranch = false; | ||
| 1004 | + JSRef<JSVal> arg0 = args[0]; | ||
| 1005 | + if (arg0->IsBoolean()) { | ||
| 1006 | + supportEmptyBranch = arg0->ToBoolean(); | ||
| 1007 | + } | ||
| 1008 | + ListModel::GetInstance()->SetSupportEmptyBranchInLazyLoading(supportEmptyBranch); | ||
| 1009 | +} | ||
| 1010 | + | ||
| 1001 | void JSList::JSBind(BindingTarget globalObj) | 1011 | void JSList::JSBind(BindingTarget globalObj) |
| 1002 | { | 1012 | { |
| 1003 | JSClass<JSList>::Declare("List"); | 1013 | JSClass<JSList>::Declare("List"); |
| @@ -1027,6 +1037,7 @@ void JSList::JSBind(BindingTarget globalObj) | |||
| 1027 | JSClass<JSList>::StaticMethod("friction", &JSList::SetFriction); | 1037 | JSClass<JSList>::StaticMethod("friction", &JSList::SetFriction); |
| 1028 | JSClass<JSList>::StaticMethod("focusWrapMode", &JSList::SetFocusWrapMode); | 1038 | JSClass<JSList>::StaticMethod("focusWrapMode", &JSList::SetFocusWrapMode); |
| 1029 | JSClass<JSList>::StaticMethod("maintainVisibleContentPosition", &JSList::MaintainVisibleContentPosition); | 1039 | JSClass<JSList>::StaticMethod("maintainVisibleContentPosition", &JSList::MaintainVisibleContentPosition); |
| 1040 | + JSClass<JSList>::StaticMethod("supportEmptyBranchInLazyLoading", &JSList::SetSupportEmptyBranchInLazyLoading); | ||
| 1030 | JSClass<JSList>::StaticMethod("stackFromEnd", &JSList::SetStackFromEnd); | 1041 | JSClass<JSList>::StaticMethod("stackFromEnd", &JSList::SetStackFromEnd); |
| 1031 | JSClass<JSList>::StaticMethod("syncLoad", &JSList::SetSyncLoad); | 1042 | JSClass<JSList>::StaticMethod("syncLoad", &JSList::SetSyncLoad); |
| 1032 | JSClass<JSList>::StaticMethod("editModeOptions", &JSList::SetEditModeOptions); | 1043 | JSClass<JSList>::StaticMethod("editModeOptions", &JSList::SetEditModeOptions); |
| @@ -80,6 +80,7 @@ public: | |||
| 80 | static void SetSyncLoad(const JSCallbackInfo& args); | 80 | static void SetSyncLoad(const JSCallbackInfo& args); |
| 81 | static void SetEditModeOptions(const JSCallbackInfo& info); | 81 | static void SetEditModeOptions(const JSCallbackInfo& info); |
| 82 | static void SetScrollSnapAnimationSpeed(const JSCallbackInfo& args); | 82 | static void SetScrollSnapAnimationSpeed(const JSCallbackInfo& args); |
| 83 | + static void SetSupportEmptyBranchInLazyLoading(const JSCallbackInfo& args); | ||
| 83 | 84 | ||
| 84 | static void ItemDragStartCallback(const JSCallbackInfo& info); | 85 | static void ItemDragStartCallback(const JSCallbackInfo& info); |
| 85 | static void ItemDragEnterCallback(const JSCallbackInfo& info); | 86 | static void ItemDragEnterCallback(const JSCallbackInfo& info); |
| @@ -94,7 +94,7 @@ public: | |||
| 94 | virtual void CreateWithResourceObjScrollBarColor(const RefPtr<ResourceObject>& resObj) {}; | 94 | virtual void CreateWithResourceObjScrollBarColor(const RefPtr<ResourceObject>& resObj) {}; |
| 95 | virtual void ParseResObjRowsGap(const RefPtr<ResourceObject>& resObj) {}; | 95 | virtual void ParseResObjRowsGap(const RefPtr<ResourceObject>& resObj) {}; |
| 96 | virtual void ParseResObjColumnsGap(const RefPtr<ResourceObject>& resObj) {}; | 96 | virtual void ParseResObjColumnsGap(const RefPtr<ResourceObject>& resObj) {}; |
| 97 | - virtual void SetSupportLazyLoadingEmptyBranch(bool supportLazyLoadingEmptyBranch) {}; | 97 | + virtual void SetSupportLazyLoadingEmptyBranch(bool enable) {}; |
| 98 | 98 | ||
| 99 | virtual DisplayMode GetDisplayMode() const = 0; | 99 | virtual DisplayMode GetDisplayMode() const = 0; |
| 100 | 100 | ||
| @@ -1143,23 +1143,23 @@ void GridModelNG::ParseResObjColumnsGap(FrameNode* frameNode, const RefPtr<Resou | |||
| 1143 | pattern->AddResObj("grid.columnsGap", resObj, std::move(updateFunc)); | 1143 | pattern->AddResObj("grid.columnsGap", resObj, std::move(updateFunc)); |
| 1144 | } | 1144 | } |
| 1145 | 1145 | ||
| 1146 | -void GridModelNG::SetSupportLazyLoadingEmptyBranch(bool supportLazyLoadingEmptyBranch) | 1146 | +void GridModelNG::SetSupportLazyLoadingEmptyBranch(bool enable) |
| 1147 | { | 1147 | { |
| 1148 | - ACE_UPDATE_LAYOUT_PROPERTY(GridLayoutProperty, SupportLazyLoadingEmptyBranch, supportLazyLoadingEmptyBranch); | 1148 | + ACE_UPDATE_LAYOUT_PROPERTY(GridLayoutProperty, SupportLazyLoadingEmptyBranch, enable); |
| 1149 | } | 1149 | } |
| 1150 | 1150 | ||
| 1151 | -void GridModelNG::SetSupportLazyLoadingEmptyBranch(FrameNode* frameNode, bool supportLazyLoadingEmptyBranch) | 1151 | +void GridModelNG::SetSupportLazyLoadingEmptyBranch(FrameNode* frameNode, bool enable) |
| 1152 | { | 1152 | { |
| 1153 | ACE_UPDATE_NODE_LAYOUT_PROPERTY( | 1153 | ACE_UPDATE_NODE_LAYOUT_PROPERTY( |
| 1154 | - GridLayoutProperty, SupportLazyLoadingEmptyBranch, supportLazyLoadingEmptyBranch, frameNode); | 1154 | + GridLayoutProperty, SupportLazyLoadingEmptyBranch, enable, frameNode); |
| 1155 | } | 1155 | } |
| 1156 | 1156 | ||
| 1157 | bool GridModelNG::GetSupportLazyLoadingEmptyBranch(FrameNode* frameNode) | 1157 | bool GridModelNG::GetSupportLazyLoadingEmptyBranch(FrameNode* frameNode) |
| 1158 | { | 1158 | { |
| 1159 | - bool supportLazyLoadingEmptyBranch = false; | 1159 | + bool enable = false; |
| 1160 | - CHECK_NULL_RETURN(frameNode, supportLazyLoadingEmptyBranch); | 1160 | + CHECK_NULL_RETURN(frameNode, enable); |
| 1161 | ACE_GET_NODE_LAYOUT_PROPERTY_WITH_DEFAULT_VALUE( | 1161 | ACE_GET_NODE_LAYOUT_PROPERTY_WITH_DEFAULT_VALUE( |
| 1162 | - GridLayoutProperty, SupportLazyLoadingEmptyBranch, supportLazyLoadingEmptyBranch, frameNode, false); | 1162 | + GridLayoutProperty, SupportLazyLoadingEmptyBranch, enable, frameNode, false); |
| 1163 | - return supportLazyLoadingEmptyBranch; | 1163 | + return enable; |
| 1164 | } | 1164 | } |
| 1165 | } // namespace OHOS::Ace::NG | 1165 | } // namespace OHOS::Ace::NG |
| @@ -82,7 +82,7 @@ public: | |||
| 82 | void ParseResObjColumnsGap(const RefPtr<ResourceObject>& resObj) override; | 82 | void ParseResObjColumnsGap(const RefPtr<ResourceObject>& resObj) override; |
| 83 | void CreateWithResourceObjFriction(const RefPtr<ResourceObject>& resObj) override; | 83 | void CreateWithResourceObjFriction(const RefPtr<ResourceObject>& resObj) override; |
| 84 | void CreateWithResourceObjScrollBarColor(const RefPtr<ResourceObject>& resObj) override; | 84 | void CreateWithResourceObjScrollBarColor(const RefPtr<ResourceObject>& resObj) override; |
| 85 | - void SetSupportLazyLoadingEmptyBranch(bool supportLazyLoadingEmptyBranch) override; | 85 | + void SetSupportLazyLoadingEmptyBranch(bool enable) override; |
| 86 | 86 | ||
| 87 | DisplayMode GetDisplayMode() const override; | 87 | DisplayMode GetDisplayMode() const override; |
| 88 | 88 | ||
| @@ -172,7 +172,7 @@ public: | |||
| 172 | static void ResetItemFillPolicy(FrameNode* frameNode); | 172 | static void ResetItemFillPolicy(FrameNode* frameNode); |
| 173 | static int32_t GetItemFillPolicy(FrameNode* frameNode); | 173 | static int32_t GetItemFillPolicy(FrameNode* frameNode); |
| 174 | static void SetOnGridItemDragStart(FrameNode* frameNode, ItemDragStartFunc&& value); | 174 | static void SetOnGridItemDragStart(FrameNode* frameNode, ItemDragStartFunc&& value); |
| 175 | - static void SetSupportLazyLoadingEmptyBranch(FrameNode* frameNode, bool supportLazyLoadingEmptyBranch); | 175 | + static void SetSupportLazyLoadingEmptyBranch(FrameNode* frameNode, bool enable); |
| 176 | static bool GetSupportLazyLoadingEmptyBranch(FrameNode* frameNode); | 176 | static bool GetSupportLazyLoadingEmptyBranch(FrameNode* frameNode); |
| 177 | private: | 177 | private: |
| 178 | static void AddDragFrameNodeToManager(FrameNode* frameNode); | 178 | static void AddDragFrameNodeToManager(FrameNode* frameNode); |
| @@ -27,6 +27,7 @@ | |||
| 27 | 27 | ||
| 28 | 28 | ||
| 29 | 29 | ||
| 30 | + | ||
| 30 | 31 | ||
| 31 | 32 | ||
| 32 | 33 | ||
| @@ -46,6 +47,32 @@ namespace OHOS::Ace::NG { | |||
| 46 | namespace { | 47 | namespace { |
| 47 | constexpr Dimension RESERVE_BOTTOM_HEIGHT = 24.0_vp; | 48 | constexpr Dimension RESERVE_BOTTOM_HEIGHT = 24.0_vp; |
| 48 | constexpr float SCROLL_SNAP_VELOCITY_TH = 780; | 49 | constexpr float SCROLL_SNAP_VELOCITY_TH = 780; |
| 50 | + | ||
| 51 | +RefPtr<LayoutWrapper> CreateDummyListItemChild() | ||
| 52 | +{ | ||
| 53 | + auto wrapper = ListItemModelNG::CreateFrameNode(ElementRegister::GetInstance()->MakeUniqueId()); | ||
| 54 | + wrapper->GetLayoutProperty()->UpdateUserDefinedIdealSize(CalcSize(CalcLength(0), CalcLength(0))); | ||
| 55 | + return wrapper; | ||
| 56 | +} | ||
| 57 | + | ||
| 58 | +/** | ||
| 59 | + * @brief If developer enables supportEmptyBranchInLazyLoading. And Index in the range of | ||
| 60 | + * LazyForEach/RepeatVirtualScroll, try to create empty branch LayoutWrapper for the index. | ||
| 61 | + */ | ||
| 62 | +static RefPtr<LayoutWrapper> GetListItemWidthEmptyBranch( | ||
| 63 | + LayoutWrapper* layoutWrapper, int32_t index, bool addToRenderTree, bool isCache) | ||
| 64 | +{ | ||
| 65 | + const auto& layoutProperty = AceType::DynamicCast<ListLayoutProperty>(layoutWrapper->GetLayoutProperty()); | ||
| 66 | + if (layoutProperty->GetSupportLazyLoadingEmptyBranch().value_or(false) && | ||
| 67 | + ScrollableUtils::IsChildLazy(layoutWrapper->GetHostNode(), index)) { | ||
调用公共的关键算法 ![]() ![]() | |||
| 68 | + auto wrapper = layoutWrapper->GetOrCreateChildByIndex(index, addToRenderTree, isCache); | ||
| 69 | + if (!wrapper) { | ||
| 70 | + wrapper = CreateDummyListItemChild(); | ||
| 71 | + } | ||
| 72 | + return wrapper; | ||
| 73 | + } | ||
| 74 | + return layoutWrapper->GetOrCreateChildByIndex(index, addToRenderTree, isCache); | ||
先取值,如果取到的节点为空再进行判断 ![]() ![]() | |||
| 75 | +} | ||
| 49 | } // namespace | 76 | } // namespace |
| 50 | 77 | ||
| 51 | void ListLayoutAlgorithm::UpdateListItemConstraint( | 78 | void ListLayoutAlgorithm::UpdateListItemConstraint( |
| @@ -2512,7 +2539,8 @@ void ListLayoutAlgorithm::PredictBuildV2( | |||
| 2512 | } | 2539 | } |
| 2513 | ACE_SCOPED_TRACE("predict Item:%d", (*it).index); | 2540 | ACE_SCOPED_TRACE("predict Item:%d", (*it).index); |
| 2514 | auto index = !pattern->IsStackFromEnd() ? (*it).index : frameNode->GetTotalChildCount() - (*it).index - 1; | 2541 | auto index = !pattern->IsStackFromEnd() ? (*it).index : frameNode->GetTotalChildCount() - (*it).index - 1; |
| 2515 | - auto wrapper = frameNode->GetOrCreateChildByIndex(index + pattern->GetItemStartIndex(), show, true); | 2542 | + auto wrapper = |
| 2543 | + GetListItemWidthEmptyBranch(AceType::RawPtr(frameNode), index + pattern->GetItemStartIndex(), show, true); | ||
| 2516 | if (!wrapper) { | 2544 | if (!wrapper) { |
| 2517 | it = param.items.erase(it); | 2545 | it = param.items.erase(it); |
| 2518 | continue; | 2546 | continue; |
| @@ -2885,4 +2913,12 @@ void ListLayoutAlgorithm::CalculateTotalCountByRepeat(LayoutWrapper* layoutWrapp | |||
| 2885 | pattern->SetRepeatDifference(repeatDifference); | 2913 | pattern->SetRepeatDifference(repeatDifference); |
| 2886 | totalItemCount_ = (repeatDifference > 0 ? firstRepeatCount_ : totalItemCount_) - itemStartIndex_; | 2914 | totalItemCount_ = (repeatDifference > 0 ? firstRepeatCount_ : totalItemCount_) - itemStartIndex_; |
| 2887 | } | 2915 | } |
| 2916 | + | ||
| 2917 | +RefPtr<LayoutWrapper> ListLayoutAlgorithm::GetListItem( | ||
| 2918 | + LayoutWrapper* layoutWrapper, int32_t index, bool addToRenderTree, bool isCache) const | ||
| 2919 | +{ | ||
| 2920 | + index = (!isStackFromEnd_ ? index : totalItemCount_ - index - 1) + itemStartIndex_; | ||
此处index算法没有变化,和修改前一致 ![]() ![]() | |||
| 2921 | + | ||
| 2922 | + return GetListItemWidthEmptyBranch(layoutWrapper, index, addToRenderTree, isCache); | ||
| 2923 | +} | ||
| 2888 | } // namespace OHOS::Ace::NG | 2924 | } // namespace OHOS::Ace::NG |
| @@ -600,11 +600,8 @@ protected: | |||
| 600 | void GetEndIndexInfo(int32_t& index, float& pos, bool& isGroup); | 600 | void GetEndIndexInfo(int32_t& index, float& pos, bool& isGroup); |
| 601 | int32_t GetListItemGroupItemCount(const RefPtr<LayoutWrapper>& wrapper) const; | 601 | int32_t GetListItemGroupItemCount(const RefPtr<LayoutWrapper>& wrapper) const; |
| 602 | 602 | ||
| 603 | - RefPtr<LayoutWrapper> GetListItem(LayoutWrapper* layoutWrapper, int32_t index, bool addToRenderTree = true) const | 603 | + RefPtr<LayoutWrapper> GetListItem( |
| 604 | - { | 604 | + LayoutWrapper* layoutWrapper, int32_t index, bool addToRenderTree = true, bool isCache = false) const; |
| 605 | - index = !isStackFromEnd_ ? index : totalItemCount_ - index - 1; | ||
| 606 | - return layoutWrapper->GetOrCreateChildByIndex(index + itemStartIndex_, addToRenderTree); | ||
| 607 | - } | ||
| 608 | RefPtr<LayoutWrapper> GetChildByIndex(LayoutWrapper* layoutWrapper, uint32_t index, bool isCache = false) const | 605 | RefPtr<LayoutWrapper> GetChildByIndex(LayoutWrapper* layoutWrapper, uint32_t index, bool isCache = false) const |
| 609 | { | 606 | { |
| 610 | index = !isStackFromEnd_ ? index : totalItemCount_ - index - 1; | 607 | index = !isStackFromEnd_ ? index : totalItemCount_ - index - 1; |
| @@ -114,6 +114,7 @@ public: | |||
| 114 | 114 | ||
| 115 | virtual void ResetListChildrenMainSize() {} | 115 | virtual void ResetListChildrenMainSize() {} |
| 116 | virtual void SetScrollSnapAnimationSpeed(ScrollSnapAnimationSpeed speed) {} | 116 | virtual void SetScrollSnapAnimationSpeed(ScrollSnapAnimationSpeed speed) {} |
| 117 | + virtual void SetSupportEmptyBranchInLazyLoading(bool supportEmptyBranch) {} | ||
| 117 | private: | 118 | private: |
| 118 | static std::unique_ptr<ListModel> instance_; | 119 | static std::unique_ptr<ListModel> instance_; |
| 119 | static std::mutex mutex_; | 120 | static std::mutex mutex_; |
| @@ -1644,4 +1644,23 @@ ScrollSnapAnimationSpeed ListModelNG::GetScrollSnapAnimationSpeed(FrameNode* fra | |||
| 1644 | CHECK_NULL_RETURN(pattern, ScrollSnapAnimationSpeed::NORMAL); | 1644 | CHECK_NULL_RETURN(pattern, ScrollSnapAnimationSpeed::NORMAL); |
| 1645 | return pattern->GetSnapSpeed(); | 1645 | return pattern->GetSnapSpeed(); |
| 1646 | } | 1646 | } |
| 1647 | + | ||
| 1648 | +void ListModelNG::SetSupportEmptyBranchInLazyLoading(bool supportEmptyBranch) | ||
| 1649 | +{ | ||
| 1650 | + ACE_UPDATE_LAYOUT_PROPERTY(ListLayoutProperty, SupportLazyLoadingEmptyBranch, supportEmptyBranch); | ||
| 1651 | +} | ||
| 1652 | + | ||
| 1653 | +void ListModelNG::SetSupportEmptyBranchInLazyLoading(FrameNode* frameNode, bool supportEmptyBranch) | ||
| 1654 | +{ | ||
| 1655 | + ACE_UPDATE_NODE_LAYOUT_PROPERTY(ListLayoutProperty, SupportLazyLoadingEmptyBranch, supportEmptyBranch, frameNode); | ||
| 1656 | +} | ||
| 1657 | + | ||
| 1658 | +bool ListModelNG::GetSupportEmptyBranchInLazyLoading(FrameNode* frameNode) | ||
| 1659 | +{ | ||
| 1660 | + bool enable = false; | ||
| 1661 | + CHECK_NULL_RETURN(frameNode, enable); | ||
| 1662 | + ACE_GET_NODE_LAYOUT_PROPERTY_WITH_DEFAULT_VALUE( | ||
| 1663 | + ListLayoutProperty, SupportLazyLoadingEmptyBranch, enable, frameNode, false); | ||
| 1664 | + return enable; | ||
| 1665 | +} | ||
| 1647 | } // namespace OHOS::Ace::NG | 1666 | } // namespace OHOS::Ace::NG |
| @@ -92,6 +92,7 @@ public: | |||
| 92 | const RefPtr<ResourceObject>& resObjMaxLengthValue) override; | 92 | const RefPtr<ResourceObject>& resObjMaxLengthValue) override; |
| 93 | void CreateWithResourceObjScrollBarColor(const RefPtr<ResourceObject>& resObj) override; | 93 | void CreateWithResourceObjScrollBarColor(const RefPtr<ResourceObject>& resObj) override; |
| 94 | void SetScrollSnapAnimationSpeed(ScrollSnapAnimationSpeed speed) override; | 94 | void SetScrollSnapAnimationSpeed(ScrollSnapAnimationSpeed speed) override; |
| 95 | + void SetSupportEmptyBranchInLazyLoading(bool supportEmptyBranch) override; | ||
| 95 | 96 | ||
| 96 | static RefPtr<ScrollControllerBase> GetOrCreateController(FrameNode* frameNode); | 97 | static RefPtr<ScrollControllerBase> GetOrCreateController(FrameNode* frameNode); |
| 97 | static void ScrollToEdge(FrameNode* frameNode, ScrollEdgeType scrollEdgeType, bool smooth); | 98 | static void ScrollToEdge(FrameNode* frameNode, ScrollEdgeType scrollEdgeType, bool smooth); |
| @@ -213,6 +214,8 @@ public: | |||
| 213 | static void SetScrollBarColor(FrameNode* frameNode, const std::optional<Color>& scrollBarColor); | 214 | static void SetScrollBarColor(FrameNode* frameNode, const std::optional<Color>& scrollBarColor); |
| 214 | static void SetScrollSnapAnimationSpeed(FrameNode* frameNode, ScrollSnapAnimationSpeed speed); | 215 | static void SetScrollSnapAnimationSpeed(FrameNode* frameNode, ScrollSnapAnimationSpeed speed); |
| 215 | static ScrollSnapAnimationSpeed GetScrollSnapAnimationSpeed(FrameNode* frameNode); | 216 | static ScrollSnapAnimationSpeed GetScrollSnapAnimationSpeed(FrameNode* frameNode); |
| 217 | + static void SetSupportEmptyBranchInLazyLoading(FrameNode* frameNode, bool supportEmptyBranch); | ||
| 218 | + static bool GetSupportEmptyBranchInLazyLoading(FrameNode* frameNode); | ||
| 216 | 219 | ||
| 217 | private: | 220 | private: |
| 218 | void AddDragFrameNodeToManager() const; | 221 | void AddDragFrameNodeToManager() const; |
| @@ -25,7 +25,7 @@ void ScrollableLayoutProperty::ToJsonValue(std::unique_ptr<JsonValue>& json, con | |||
| 25 | } | 25 | } |
| 26 | json->PutExtAttr("contentStartOffset", std::to_string(propContentStartOffset_.value_or(0)).c_str(), filter); | 26 | json->PutExtAttr("contentStartOffset", std::to_string(propContentStartOffset_.value_or(0)).c_str(), filter); |
| 27 | json->PutExtAttr("contentEndOffset", std::to_string(propContentEndOffset_.value_or(0)).c_str(), filter); | 27 | json->PutExtAttr("contentEndOffset", std::to_string(propContentEndOffset_.value_or(0)).c_str(), filter); |
| 28 | - json->PutExtAttr("supportLazyLoadingEmptyBranch", propSupportLazyLoadingEmptyBranch_.value_or(false), filter); | 28 | + json->PutExtAttr("supportEmptyBranchInLazyLoading", propSupportLazyLoadingEmptyBranch_.value_or(false), filter); |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | } // namespace OHOS::Ace::NG | 31 | } // namespace OHOS::Ace::NG |
| @@ -3915,6 +3915,9 @@ struct ArkUIListModifier { | |||
| 3915 | void (*createWithResourceObjLaneConstrain)( | 3915 | void (*createWithResourceObjLaneConstrain)( |
| 3916 | ArkUINodeHandle node, void* resObjMinLengthValue, void* resObjMaxLengthValue); | 3916 | ArkUINodeHandle node, void* resObjMinLengthValue, void* resObjMaxLengthValue); |
| 3917 | void (*createWithResourceObjScrollBarColor)(ArkUINodeHandle node, void* resObj); | 3917 | void (*createWithResourceObjScrollBarColor)(ArkUINodeHandle node, void* resObj); |
| 3918 | + | ||
| 3919 | + void (*setSupportEmptyBranchInLazyLoading)(ArkUINodeHandle node, ArkUI_Bool enable); | ||
适配List CAPI ![]() ![]() | |||
| 3920 | + ArkUI_Bool (*getSupportEmptyBranchInLazyLoading)(ArkUINodeHandle node); | ||
| 3918 | }; | 3921 | }; |
| 3919 | 3922 | ||
| 3920 | struct ArkUIListItemGroupModifier { | 3923 | struct ArkUIListItemGroupModifier { |
| @@ -23631,6 +23631,8 @@ typedef struct GENERATED_ArkUIGridModifier { | |||
| 23631 | const Opt_GridDirection* value); | 23631 | const Opt_GridDirection* value); |
| 23632 | void (*setSupportAnimation)(Ark_NativePointer node, | 23632 | void (*setSupportAnimation)(Ark_NativePointer node, |
| 23633 | const Opt_Boolean* value); | 23633 | const Opt_Boolean* value); |
| 23634 | + void (*setSupportEmptyBranchInLazyLoading)(Ark_NativePointer node, | ||
| 23635 | + const Opt_Boolean* value); | ||
| 23634 | void (*setOnItemDragStart)(Ark_NativePointer node, | 23636 | void (*setOnItemDragStart)(Ark_NativePointer node, |
| 23635 | const Opt_OnItemDragStartCallback* value); | 23637 | const Opt_OnItemDragStartCallback* value); |
| 23636 | void (*setOnItemDragEnter)(Ark_NativePointer node, | 23638 | void (*setOnItemDragEnter)(Ark_NativePointer node, |
| @@ -23929,6 +23931,8 @@ typedef struct GENERATED_ArkUIListModifier { | |||
| 23929 | const Opt_ChildrenMainSize* value); | 23931 | const Opt_ChildrenMainSize* value); |
| 23930 | void (*setMaintainVisibleContentPosition)(Ark_NativePointer node, | 23932 | void (*setMaintainVisibleContentPosition)(Ark_NativePointer node, |
| 23931 | const Opt_Boolean* value); | 23933 | const Opt_Boolean* value); |
| 23934 | + void (*setSupportEmptyBranchInLazyLoading)(Ark_NativePointer node, | ||
| 23935 | + const Opt_Boolean* value); | ||
| 23932 | void (*setStackFromEnd)(Ark_NativePointer node, | 23936 | void (*setStackFromEnd)(Ark_NativePointer node, |
| 23933 | const Opt_Boolean* value); | 23937 | const Opt_Boolean* value); |
| 23934 | void (*setOnScrollIndex)(Ark_NativePointer node, | 23938 | void (*setOnScrollIndex)(Ark_NativePointer node, |
| @@ -367,6 +367,14 @@ void SetSupportAnimationImpl(Ark_NativePointer node, | |||
| 367 | } | 367 | } |
| 368 | GridModelStatic::SetSupportAnimation(frameNode, *convValue); | 368 | GridModelStatic::SetSupportAnimation(frameNode, *convValue); |
| 369 | } | 369 | } |
| 370 | +void SetSupportEmptyBranchInLazyLoadingImpl(Ark_NativePointer node, | ||
| 371 | + const Opt_Boolean* value) | ||
| 372 | +{ | ||
| 373 | + auto frameNode = reinterpret_cast<FrameNode *>(node); | ||
| 374 | + CHECK_NULL_VOID(frameNode); | ||
| 375 | + auto enabled = Converter::OptConvertPtr<bool>(value).value_or(false); | ||
| 376 | + GridModelNG::SetSupportLazyLoadingEmptyBranch(frameNode, enabled); | ||
| 377 | +} | ||
| 370 | void SetOnItemDragStartImpl(Ark_NativePointer node, | 378 | void SetOnItemDragStartImpl(Ark_NativePointer node, |
| 371 | const Opt_OnItemDragStartCallback* value) | 379 | const Opt_OnItemDragStartCallback* value) |
| 372 | { | 380 | { |
| @@ -638,6 +646,7 @@ const GENERATED_ArkUIGridModifier* GetGridModifier() | |||
| 638 | GridAttributeModifier::SetCellLengthImpl, | 646 | GridAttributeModifier::SetCellLengthImpl, |
| 639 | GridAttributeModifier::SetLayoutDirectionImpl, | 647 | GridAttributeModifier::SetLayoutDirectionImpl, |
| 640 | GridAttributeModifier::SetSupportAnimationImpl, | 648 | GridAttributeModifier::SetSupportAnimationImpl, |
| 649 | + GridAttributeModifier::SetSupportEmptyBranchInLazyLoadingImpl, | ||
| 641 | GridAttributeModifier::SetOnItemDragStartImpl, | 650 | GridAttributeModifier::SetOnItemDragStartImpl, |
| 642 | GridAttributeModifier::SetOnItemDragEnterImpl, | 651 | GridAttributeModifier::SetOnItemDragEnterImpl, |
| 643 | GridAttributeModifier::SetOnItemDragMoveImpl, | 652 | GridAttributeModifier::SetOnItemDragMoveImpl, |
| @@ -345,6 +345,14 @@ void SetMaintainVisibleContentPositionImpl(Ark_NativePointer node, | |||
| 345 | auto convValue = Converter::OptConvert<bool>(*value); | 345 | auto convValue = Converter::OptConvert<bool>(*value); |
| 346 | ListModelStatic::SetListMaintainVisibleContentPosition(frameNode, convValue); | 346 | ListModelStatic::SetListMaintainVisibleContentPosition(frameNode, convValue); |
| 347 | } | 347 | } |
| 348 | +void SetSupportEmptyBranchInLazyLoadingImpl(Ark_NativePointer node, | ||
| 349 | + const Opt_Boolean* value) | ||
| 350 | +{ | ||
| 351 | + auto frameNode = reinterpret_cast<FrameNode *>(node); | ||
| 352 | + CHECK_NULL_VOID(frameNode); | ||
| 353 | + auto enable = Converter::OptConvert<bool>(*value).value_or(false); | ||
| 354 | + ListModelNG::SetSupportEmptyBranchInLazyLoading(frameNode, enable); | ||
| 355 | +} | ||
| 348 | void SetStackFromEndImpl(Ark_NativePointer node, | 356 | void SetStackFromEndImpl(Ark_NativePointer node, |
| 349 | const Opt_Boolean* value) | 357 | const Opt_Boolean* value) |
| 350 | { | 358 | { |
| @@ -628,6 +636,7 @@ const GENERATED_ArkUIListModifier* GetListModifier() | |||
| 628 | ListAttributeModifier::SetScrollSnapAlignImpl, | 636 | ListAttributeModifier::SetScrollSnapAlignImpl, |
| 629 | ListAttributeModifier::SetChildrenMainSizeImpl, | 637 | ListAttributeModifier::SetChildrenMainSizeImpl, |
| 630 | ListAttributeModifier::SetMaintainVisibleContentPositionImpl, | 638 | ListAttributeModifier::SetMaintainVisibleContentPositionImpl, |
| 639 | + ListAttributeModifier::SetSupportEmptyBranchInLazyLoadingImpl, | ||
| 631 | ListAttributeModifier::SetStackFromEndImpl, | 640 | ListAttributeModifier::SetStackFromEndImpl, |
| 632 | ListAttributeModifier::SetOnScrollIndexImpl, | 641 | ListAttributeModifier::SetOnScrollIndexImpl, |
| 633 | ListAttributeModifier::SetOnScrollVisibleContentChangeImpl, | 642 | ListAttributeModifier::SetOnScrollVisibleContentChangeImpl, |
| @@ -981,6 +981,20 @@ ArkUI_Int32 GetScrollSnapAnimationSpeed(ArkUINodeHandle node) | |||
| 981 | CHECK_NULL_RETURN(frameNode, 0); | 981 | CHECK_NULL_RETURN(frameNode, 0); |
| 982 | return static_cast<ArkUI_Int32>(ListModelNG::GetScrollSnapAnimationSpeed(frameNode)); | 982 | return static_cast<ArkUI_Int32>(ListModelNG::GetScrollSnapAnimationSpeed(frameNode)); |
| 983 | } | 983 | } |
| 984 | + | ||
| 985 | +void SetSupportEmptyBranchInLazyLoading(ArkUINodeHandle node, ArkUI_Bool support) | ||
| 986 | +{ | ||
| 987 | + auto* frameNode = reinterpret_cast<FrameNode*>(node); | ||
| 988 | + CHECK_NULL_VOID(frameNode); | ||
| 989 | + ListModelNG::SetSupportEmptyBranchInLazyLoading(frameNode, support); | ||
| 990 | +} | ||
| 991 | + | ||
| 992 | +ArkUI_Bool GetSupportEmptyBranchInLazyLoading(ArkUINodeHandle node) | ||
| 993 | +{ | ||
| 994 | + auto* frameNode = reinterpret_cast<FrameNode*>(node); | ||
| 995 | + CHECK_NULL_RETURN(frameNode, false); | ||
| 996 | + return ListModelNG::GetSupportEmptyBranchInLazyLoading(frameNode); | ||
| 997 | +} | ||
| 984 | } // namespace | 998 | } // namespace |
| 985 | 999 | ||
| 986 | namespace NodeModifier { | 1000 | namespace NodeModifier { |
| @@ -1128,6 +1142,8 @@ const ArkUIListModifier* GetListModifier() | |||
| 1128 | .parseResObjDividerEndMargin = ParseResObjDividerEndMargin, | 1142 | .parseResObjDividerEndMargin = ParseResObjDividerEndMargin, |
| 1129 | .createWithResourceObjLaneConstrain = CreateWithResourceObjLaneConstrain, | 1143 | .createWithResourceObjLaneConstrain = CreateWithResourceObjLaneConstrain, |
| 1130 | .createWithResourceObjScrollBarColor = CreateWithResourceObjScrollBarColor, | 1144 | .createWithResourceObjScrollBarColor = CreateWithResourceObjScrollBarColor, |
| 1145 | + .setSupportEmptyBranchInLazyLoading = SetSupportEmptyBranchInLazyLoading, | ||
| 1146 | + .getSupportEmptyBranchInLazyLoading = GetSupportEmptyBranchInLazyLoading, | ||
| 1131 | }; | 1147 | }; |
| 1132 | CHECK_INITIALIZED_FIELDS_END(modifier, 0, 0, 0); // don't move this line | 1148 | CHECK_INITIALIZED_FIELDS_END(modifier, 0, 0, 0); // don't move this line |
| 1133 | return &modifier; | 1149 | return &modifier; |
| @@ -6711,6 +6711,25 @@ typedef enum { | |||
| 6711 | */ | 6711 | */ |
| 6712 | NODE_LIST_LANES_ITEMFILLPOLICY = 1003018, | 6712 | NODE_LIST_LANES_ITEMFILLPOLICY = 1003018, |
| 6713 | 6713 | ||
| 6714 | + /** | ||
| 6715 | + * @brief Specifies whether to support empty branch rendering in lazy loading mode for the <b>List</b> container. | ||
| 6716 | + * This attribute can be set, reset, and obtained as required through APIs. When enabled in lazy loading mode, | ||
| 6717 | + * empty branches (items without content) in the <b>List</b> will be rendered and set to width 0 and height 0, | ||
| 6718 | + * which may affect the overall layout and scrolling behavior. This is typically used in scenarios where the | ||
| 6719 | + * data source may have gaps or when maintaining specific layout positions is required. | ||
| 6720 | + * | ||
| 6721 | + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n | ||
| 6722 | + * .value[0].i32: whether to support empty branch rendering in lazy loading mode. | ||
| 6723 | + * <b>0</b>: Disable empty branch support. Empty branches will not be rendered. <b>1</b>: Enable empty branch support. | ||
| 6724 | + * Empty branches will be rendered as placeholder items. Default value: <b>0</b>.\n | ||
| 6725 | + * \n | ||
| 6726 | + * Format of the return value {@link ArkUI_AttributeItem}:\n | ||
| 6727 | + * .value[0].i32: whether empty branch rendering is enabled. <b>0</b>: Disabled. <b>1</b>: Enabled.\n | ||
| 6728 | + * | ||
| 6729 | + * @since 23 | ||
| 6730 | + */ | ||
| 6731 | + NODE_LIST_SUPPORT_EMPTY_BRANCH_IN_LAZY_LOADING = 1003019, | ||
| 6732 | + | ||
| 6714 | /** | 6733 | /** |
| 6715 | * @brief Defines whether to enable loop playback for the swiper. This attribute can be set, reset, and obtained | 6734 | * @brief Defines whether to enable loop playback for the swiper. This attribute can be set, reset, and obtained |
| 6716 | * as required through APIs. | 6735 | * as required through APIs. |
| @@ -7810,7 +7829,24 @@ typedef enum { | |||
| 7810 | */ | 7829 | */ |
| 7811 | NODE_GRID_MULTI_SELECTABLE = 1013013, | 7830 | NODE_GRID_MULTI_SELECTABLE = 1013013, |
| 7812 | 7831 | ||
| 7813 | - NODE_GRID_SUPPORT_LAZY_LOADING_EMPTY_BRANCH = 1013014, | 7832 | + /** |
| 7833 | + * @brief Specifies whether to support empty branch rendering in lazy loading mode for the <b>Grid</b> container. | ||
| 7834 | + * This attribute can be set, reset, and obtained as required through APIs. When enabled in lazy loading mode, | ||
| 7835 | + * empty branches (items without content) in the <b>Grid</b> will be rendered and set to width 0 and height 0, | ||
| 7836 | + * which may affect the overall layout and scrolling behavior. This is typically used in scenarios where the | ||
| 7837 | + * data source may have gaps or when maintaining specific layout positions is required. | ||
| 7838 | + * | ||
| 7839 | + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n | ||
| 7840 | + * .value[0].i32: whether to support empty branch rendering in lazy loading mode. | ||
| 7841 | + * <b>0</b>: Disable empty branch support. Empty branches will not be rendered. <b>1</b>: Enable empty branch support. | ||
| 7842 | + * Empty branches will be rendered as placeholder items. Default value: <b>0</b>.\n | ||
| 7843 | + * \n | ||
| 7844 | + * Format of the return value {@link ArkUI_AttributeItem}:\n | ||
| 7845 | + * .value[0].i32: whether empty branch rendering is enabled. <b>0</b>: Disabled. <b>1</b>: Enabled.\n | ||
| 7846 | + * | ||
| 7847 | + * @since 23 | ||
| 7848 | + */ | ||
| 7849 | + NODE_GRID_SUPPORT_EMPTY_BRANCH_IN_LAZY_LOADING = 1013014, | ||
| 7814 | 7850 | ||
| 7815 | /** | 7851 | /** |
| 7816 | * @brief Sets the style of the <b>GridItem</b> component. | 7852 | * @brief Sets the style of the <b>GridItem</b> component. |
| @@ -7942,6 +7942,33 @@ const ArkUI_AttributeItem* GetListScrollAnimationSpeed(ArkUI_NodeHandle node) | |||
| 7942 | return &g_attributeItem; | 7942 | return &g_attributeItem; |
| 7943 | } | 7943 | } |
| 7944 | 7944 | ||
| 7945 | +int32_t SetListSupportEmptyBranchInLazyLoading(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item) | ||
| 7946 | +{ | ||
| 7947 | + bool enable = false; | ||
| 7948 | + if (item == nullptr || item->size < NUM_1 || !InRegion(NUM_0, NUM_1, item->value[NUM_0].i32)) { | ||
| 7949 | + return ERROR_CODE_PARAM_INVALID; | ||
| 7950 | + } else { | ||
| 7951 | + enable = item->value[0].i32; | ||
| 7952 | + } | ||
| 7953 | + GetFullImpl()->getNodeModifiers()->getListModifier()->setSupportEmptyBranchInLazyLoading( | ||
| 7954 | + node->uiNodeHandle, enable); | ||
| 7955 | + return ERROR_CODE_NO_ERROR; | ||
| 7956 | +} | ||
| 7957 | + | ||
| 7958 | +void ResetListSupportEmptyBranchInLazyLoading(ArkUI_NodeHandle node) | ||
| 7959 | +{ | ||
| 7960 | + GetFullImpl()->getNodeModifiers()->getListModifier()->setSupportEmptyBranchInLazyLoading( | ||
| 7961 | + node->uiNodeHandle, false); | ||
| 7962 | +} | ||
| 7963 | + | ||
| 7964 | +const ArkUI_AttributeItem* GetListSupportEmptyBranchInLazyLoading(ArkUI_NodeHandle node) | ||
| 7965 | +{ | ||
| 7966 | + ArkUI_Int32 value = GetFullImpl()->getNodeModifiers()->getListModifier()->getSupportEmptyBranchInLazyLoading( | ||
| 7967 | + node->uiNodeHandle); | ||
| 7968 | + g_numberValues[0].i32 = value; | ||
| 7969 | + return &g_attributeItem; | ||
| 7970 | +} | ||
| 7971 | + | ||
| 7945 | // TextArea | 7972 | // TextArea |
| 7946 | int32_t SetTextAreaPlaceholderFont(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item) | 7973 | int32_t SetTextAreaPlaceholderFont(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item) |
| 7947 | { | 7974 | { |
| @@ -18077,14 +18104,14 @@ const ArkUI_AttributeItem* GetGridSupportAnimation(ArkUI_NodeHandle node) | |||
| 18077 | 18104 | ||
| 18078 | int32_t SetGridSupportLazyLoadingEmptyBranch(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item) | 18105 | int32_t SetGridSupportLazyLoadingEmptyBranch(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item) |
| 18079 | { | 18106 | { |
| 18080 | - bool supportLazyLoadingEmptyBranch = false; | 18107 | + bool enable = false; |
| 18081 | if (item == nullptr || item->size < NUM_1 || !InRegion(NUM_0, NUM_1, item->value[NUM_0].i32)) { | 18108 | if (item == nullptr || item->size < NUM_1 || !InRegion(NUM_0, NUM_1, item->value[NUM_0].i32)) { |
| 18082 | return ERROR_CODE_PARAM_INVALID; | 18109 | return ERROR_CODE_PARAM_INVALID; |
| 18083 | } else { | 18110 | } else { |
| 18084 | - supportLazyLoadingEmptyBranch = item->value[0].i32; | 18111 | + enable = item->value[0].i32; |
| 18085 | } | 18112 | } |
| 18086 | GetFullImpl()->getNodeModifiers()->getGridModifier()->setSupportLazyLoadingEmptyBranch( | 18113 | GetFullImpl()->getNodeModifiers()->getGridModifier()->setSupportLazyLoadingEmptyBranch( |
| 18087 | - node->uiNodeHandle, supportLazyLoadingEmptyBranch); | 18114 | + node->uiNodeHandle, enable); |
| 18088 | return ERROR_CODE_NO_ERROR; | 18115 | return ERROR_CODE_NO_ERROR; |
| 18089 | } | 18116 | } |
| 18090 | 18117 | ||
| @@ -20318,7 +20345,7 @@ int32_t SetListAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_A | |||
| 20318 | SetListScrollToIndex, SetListAlignListItem, SetListChildrenMainSize, SetListInitialIndex, SetListDivider, | 20345 | SetListScrollToIndex, SetListAlignListItem, SetListChildrenMainSize, SetListInitialIndex, SetListDivider, |
| 20319 | SetListScrollToItemInGroup, SetListLanes, SetListScrollSnapAlign, SetListMaintainVisibleContentPosition, | 20346 | SetListScrollToItemInGroup, SetListLanes, SetListScrollSnapAlign, SetListMaintainVisibleContentPosition, |
| 20320 | SetListStackFromEnd, SetListFocusWrapMode, SetListSyncLoad, SetListScrollAnimationSpeed, | 20347 | SetListStackFromEnd, SetListFocusWrapMode, SetListSyncLoad, SetListScrollAnimationSpeed, |
| 20321 | - SetListItemFillPolicy }; | 20348 | + SetListItemFillPolicy, SetListSupportEmptyBranchInLazyLoading }; |
| 20322 | if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) { | 20349 | if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) { |
| 20323 | TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "list node attribute: %{public}d NOT IMPLEMENT", subTypeId); | 20350 | TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "list node attribute: %{public}d NOT IMPLEMENT", subTypeId); |
| 20324 | return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED; | 20351 | return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED; |
| @@ -20331,7 +20358,7 @@ const ArkUI_AttributeItem* GetListAttribute(ArkUI_NodeHandle node, int32_t subTy | |||
| 20331 | static Getter* getters[] = { GetListDirection, GetListSticky, GetListSpace, GetListNodeAdapter, GetListCachedCount, | 20358 | static Getter* getters[] = { GetListDirection, GetListSticky, GetListSpace, GetListNodeAdapter, GetListCachedCount, |
| 20332 | nullptr, GetListAlignListItem, nullptr, GetListInitialIndex, GetListDivider, nullptr, GetListLanes, | 20359 | nullptr, GetListAlignListItem, nullptr, GetListInitialIndex, GetListDivider, nullptr, GetListLanes, |
| 20333 | GetListScrollSnapAlign, GetListMaintainVisibleContentPosition, GetListStackFromEnd, GetListFocusWrapMode, | 20360 | GetListScrollSnapAlign, GetListMaintainVisibleContentPosition, GetListStackFromEnd, GetListFocusWrapMode, |
| 20334 | - GetListSyncLoad, GetListScrollAnimationSpeed, GetListItemFillPolicy }; | 20361 | + GetListSyncLoad, GetListScrollAnimationSpeed, GetListItemFillPolicy, GetListSupportEmptyBranchInLazyLoading }; |
| 20335 | if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) { | 20362 | if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) { |
| 20336 | TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "loadingprogress node attribute: %{public}d NOT IMPLEMENT", subTypeId); | 20363 | TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "loadingprogress node attribute: %{public}d NOT IMPLEMENT", subTypeId); |
| 20337 | return &g_attributeItem; | 20364 | return &g_attributeItem; |
| @@ -20345,7 +20372,7 @@ void ResetListAttribute(ArkUI_NodeHandle node, int32_t subTypeId) | |||
| 20345 | ResetListCachedCount, nullptr, ResetListAlignListItem, ResetListChildrenMainSize, ResetListInitialIndex, | 20372 | ResetListCachedCount, nullptr, ResetListAlignListItem, ResetListChildrenMainSize, ResetListInitialIndex, |
| 20346 | ResetListDivider, nullptr, ResetListLanes, ResetListScrollSnapAlign, ResetListMaintainVisibleContentPosition, | 20373 | ResetListDivider, nullptr, ResetListLanes, ResetListScrollSnapAlign, ResetListMaintainVisibleContentPosition, |
| 20347 | ResetListStackFromEnd, ResetListFocusWrapMode, ResetListSyncLoad, ResetListScrollAnimationSpeed, | 20374 | ResetListStackFromEnd, ResetListFocusWrapMode, ResetListSyncLoad, ResetListScrollAnimationSpeed, |
| 20348 | - ResetListItemFillPolicy }; | 20375 | + ResetListItemFillPolicy, ResetListSupportEmptyBranchInLazyLoading }; |
| 20349 | if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) { | 20376 | if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) { |
| 20350 | TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "list node attribute: %{public}d NOT IMPLEMENT", subTypeId); | 20377 | TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "list node attribute: %{public}d NOT IMPLEMENT", subTypeId); |
| 20351 | return; | 20378 | return; |
| @@ -14,6 +14,7 @@ | |||
| 14 | */ | 14 | */ |
| 15 | 15 | ||
| 16 | 16 | ||
| 17 | + | ||
| 17 | 18 | ||
| 18 | 19 | ||
| 19 | 20 | ||
| @@ -22,10 +23,8 @@ | |||
| 22 | 23 | ||
| 23 | 24 | ||
| 24 | 25 | ||
| 25 | - | ||
| 26 | 26 | ||
| 27 | 27 | ||
| 28 | - | ||
| 29 | namespace OHOS::Ace::NG { | 28 | namespace OHOS::Ace::NG { |
| 30 | 29 | ||
| 31 | namespace {} // namespace | 30 | namespace {} // namespace |
| @@ -38,7 +37,7 @@ public: | |||
| 38 | RefPtr<RepeatVirtualScroll2Node> GridLayoutTestNg::CreateRepeatNode(int32_t childCount) | 37 | RefPtr<RepeatVirtualScroll2Node> GridLayoutTestNg::CreateRepeatNode(int32_t childCount) |
| 39 | { | 38 | { |
| 40 | std::function<std::pair<RIDType, uint32_t>(IndexType)> onGetRid4Index = [](int32_t index) { | 39 | std::function<std::pair<RIDType, uint32_t>(IndexType)> onGetRid4Index = [](int32_t index) { |
| 41 | - return std::make_pair(2, 0); | 40 | + return std::make_pair(0, 0); |
| 42 | }; | 41 | }; |
| 43 | std::function<void(IndexType, IndexType)> onRecycleItems = [](int32_t start, int32_t end) {}; | 42 | std::function<void(IndexType, IndexType)> onRecycleItems = [](int32_t start, int32_t end) {}; |
| 44 | std::function<void(int32_t, int32_t, int32_t, int32_t, bool, bool)> onActiveRange = | 43 | std::function<void(int32_t, int32_t, int32_t, int32_t, bool, bool)> onActiveRange = |
| @@ -47,7 +46,7 @@ RefPtr<RepeatVirtualScroll2Node> GridLayoutTestNg::CreateRepeatNode(int32_t chil | |||
| 47 | std::function<void()> onPurge = []() {}; | 46 | std::function<void()> onPurge = []() {}; |
| 48 | std::function<void()> onUpdateDirty = []() {}; | 47 | std::function<void()> onUpdateDirty = []() {}; |
| 49 | RefPtr<RepeatVirtualScroll2Node> node = AceType::MakeRefPtr<RepeatVirtualScroll2Node>( | 48 | RefPtr<RepeatVirtualScroll2Node> node = AceType::MakeRefPtr<RepeatVirtualScroll2Node>( |
| 50 | - 2, 2, 5, onGetRid4Index, onRecycleItems, onActiveRange, onMoveFromTo, onPurge, onUpdateDirty); | 49 | + 0, 0, 0, onGetRid4Index, onRecycleItems, onActiveRange, onMoveFromTo, onPurge, onUpdateDirty); |
| 51 | node->arrLen_ = childCount; | 50 | node->arrLen_ = childCount; |
| 52 | node->totalCount_ = childCount; | 51 | node->totalCount_ = childCount; |
| 53 | return node; | 52 | return node; |
| @@ -21,6 +21,7 @@ | |||
| 21 | 21 | ||
| 22 | 22 | ||
| 23 | 23 | ||
| 24 | + | ||
| 24 | 25 | ||
| 25 | 26 | ||
| 26 | 27 | ||
| @@ -4220,4 +4221,34 @@ HWTEST_F(ListLayoutTestNg, UpdateChildrenMainSizeRoundingMode001, TestSize.Level | |||
| 4220 | listPattern->GetOrCreateListChildrenMainSize(); | 4221 | listPattern->GetOrCreateListChildrenMainSize(); |
| 4221 | EXPECT_EQ(listNode->afterAttachMainTreeTasks_.size(), taskSize + 1); | 4222 | EXPECT_EQ(listNode->afterAttachMainTreeTasks_.size(), taskSize + 1); |
| 4222 | } | 4223 | } |
| 4224 | + | ||
| 4225 | +/** | ||
| 4226 | + * @tc.name: SupportEmptyBranchInLazyLoading001 | ||
| 4227 | + * @tc.desc: Test SupportEmptyBranchInLazyLoading. | ||
| 4228 | + * @tc.type: FUNC | ||
| 4229 | + */ | ||
| 4230 | +HWTEST_F(ListLayoutTestNg, SupportEmptyBranchInLazyLoading001, TestSize.Level1) | ||
| 4231 | +{ | ||
| 4232 | + ListModelNG model = CreateList(); | ||
| 4233 | + | ||
| 4234 | + auto layoutAlgorithm = AceType::DynamicCast<ListLayoutAlgorithm>(pattern_->CreateLayoutAlgorithm()); | ||
| 4235 | + auto wrapper0 = layoutAlgorithm->GetListItem(AceType::RawPtr(frameNode_), 0); | ||
| 4236 | + EXPECT_EQ(wrapper0, nullptr); | ||
| 4237 | + | ||
| 4238 | + model.SetSupportEmptyBranchInLazyLoading(true); | ||
| 4239 | + auto layoutProperty = frameNode_->GetLayoutProperty<ListLayoutProperty>(); | ||
| 4240 | + EXPECT_NE(layoutProperty, nullptr); | ||
| 4241 | + EXPECT_EQ(layoutProperty->GetSupportLazyLoadingEmptyBranch().value_or(false), true); | ||
| 4242 | + | ||
| 4243 | + auto wrapper1 = layoutAlgorithm->GetListItem(AceType::RawPtr(frameNode_), 0); | ||
| 4244 | + EXPECT_EQ(wrapper1, nullptr); | ||
| 4245 | + | ||
| 4246 | + int32_t itemCount = 5; | ||
| 4247 | + float mainSize = 100.0f; | ||
| 4248 | + CreateItemsInLazyForEach(itemCount, mainSize); | ||
| 4249 | + CreateDone(); | ||
| 4250 | + | ||
| 4251 | + auto wrapper2 = layoutAlgorithm->GetListItem(AceType::RawPtr(frameNode_), 0); | ||
| 4252 | + EXPECT_NE(wrapper2, nullptr); | ||
| 4253 | +} | ||
| 4223 | } // namespace OHOS::Ace::NG | 4254 | } // namespace OHOS::Ace::NG |
| @@ -137,7 +137,7 @@ RefPtr<UINode> ScrollableUtilsTest::CreateScrollableChildUINode() | |||
| 137 | RefPtr<RepeatVirtualScroll2Node> ScrollableUtilsTest::CreateRepeatNode(int32_t childCount) | 137 | RefPtr<RepeatVirtualScroll2Node> ScrollableUtilsTest::CreateRepeatNode(int32_t childCount) |
| 138 | { | 138 | { |
| 139 | std::function<std::pair<RIDType, uint32_t>(IndexType)> onGetRid4Index = [](int32_t index) { | 139 | std::function<std::pair<RIDType, uint32_t>(IndexType)> onGetRid4Index = [](int32_t index) { |
| 140 | - return std::make_pair(2, 0); | 140 | + return std::make_pair(0, 0); |
| 141 | }; | 141 | }; |
| 142 | std::function<void(IndexType, IndexType)> onRecycleItems = [](int32_t start, int32_t end) {}; | 142 | std::function<void(IndexType, IndexType)> onRecycleItems = [](int32_t start, int32_t end) {}; |
| 143 | std::function<void(int32_t, int32_t, int32_t, int32_t, bool, bool)> onActiveRange = | 143 | std::function<void(int32_t, int32_t, int32_t, int32_t, bool, bool)> onActiveRange = |
| @@ -146,7 +146,7 @@ RefPtr<RepeatVirtualScroll2Node> ScrollableUtilsTest::CreateRepeatNode(int32_t c | |||
| 146 | std::function<void()> onPurge = []() {}; | 146 | std::function<void()> onPurge = []() {}; |
| 147 | std::function<void()> onUpdateDirty = []() {}; | 147 | std::function<void()> onUpdateDirty = []() {}; |
| 148 | RefPtr<RepeatVirtualScroll2Node> node = AceType::MakeRefPtr<RepeatVirtualScroll2Node>( | 148 | RefPtr<RepeatVirtualScroll2Node> node = AceType::MakeRefPtr<RepeatVirtualScroll2Node>( |
| 149 | - 2, 2, 5, onGetRid4Index, onRecycleItems, onActiveRange, onMoveFromTo, onPurge, onUpdateDirty); | 149 | + 0, 0, 0, onGetRid4Index, onRecycleItems, onActiveRange, onMoveFromTo, onPurge, onUpdateDirty); |
| 150 | node->arrLen_ = childCount; | 150 | node->arrLen_ = childCount; |
| 151 | node->totalCount_ = childCount; | 151 | node->totalCount_ = childCount; |
| 152 | return node; | 152 | return node; |


idlize 自动生成代码