增加build接口支持Builder嵌套参数不一致的场景

Signed-off-by: wangchensu <wangchensu@huawei.com>
Change-Id: I2ec396f79dcbae70c89743c439ff10b97b33b1ca
This commit is contained in:
wangchensu 2024-07-27 11:39:54 +08:00
parent e81a272ce2
commit 2080778e8e
4 changed files with 66 additions and 2 deletions

View File

@ -33,6 +33,15 @@
*/
export { NodeRenderType, RenderOptions, BuilderNode } from './arkui/BuilderNode';
/**
* Export BuildOptions which is used to create a node trees by builder function and manage the update of the tree.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
export { BuildOptions } from './arkui/BuilderNode';
/**
* Export NodeController, which defines the controller of node container. Provides lifecycle callbacks for the associated NodeContainer
* and methods to control the child node of the NodeContainer.

View File

@ -141,6 +141,32 @@ export interface RenderOptions {
surfaceId?: string;
}
/**
* BuildOptions info.
*
* @interface BuildOptions
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
export interface BuildOptions {
/**
* Build type of the Builder.
* @type { ?boolean } nestingBuilderSupported - Build type of the Builder.
* Indicates whether support the type that WrappedBuilder contains builder used different params.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
nestingBuilderSupported?: boolean;
}
/**
* Defines BuilderNode.
*
@ -199,6 +225,19 @@ export class BuilderNode<Args extends Object[]> {
*/
build(builder: WrappedBuilder<Args>, arg?: Object): void;
/**
* Build the BuilderNode with the builder.Support the type that WrappedBuilder contains builder used different params.
*
* @param { WrappedBuilder<Args> } builder - Defined the builder will be called to build the node.
* @param { Object } arg - Defined the args will be used in the builder.
* @param { BuildOptions } options - Defined the options will be used when build.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
build(builder: WrappedBuilder<Args>, arg: Object, options: BuildOptions): void;
/**
* Update the BuilderNode based on the provided parameters.
*

View File

@ -18,6 +18,7 @@
* @kit ArkUI
*/
import { BuildOptions } from './BuilderNode';
import { Content } from './Content';
import { UIContext } from '../@ohos.arkui.UIContext';
import { WrappedBuilder } from 'wrappedBuilderObject';
@ -57,6 +58,21 @@ export class ComponentContent<T extends Object> extends Content{
*/
constructor(uiContext: UIContext, builder: WrappedBuilder<[T]>, args: T);
/**
* Constructor.
*
* @param { UIContext } uiContext - uiContext used to create the ComponentContent
* @param { WrappedBuilder<[T]> } builder - Defined the builder will be called to build ComponentContent.
* @param { T } args - Parameters used to update the ComponentContent.
* @param { BuildOptions } options - Defined the options will be used when build.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
constructor(uiContext: UIContext, builder: WrappedBuilder<[T]>, args: T, options: BuildOptions);
/**
* Update the ComponentContent based on the provided parameters.
*

View File

@ -73,7 +73,7 @@ import dragController from '@ohos.arkui.dragController';
import { DrawableDescriptor, LayeredDrawableDescriptor, PixelMapDrawableDescriptor, AnimationOptions, AnimatedDrawableDescriptor } from '@ohos.arkui.drawableDescriptor';
import inspector from '@ohos.arkui.inspector';
import {
NodeRenderType, RenderOptions, BuilderNode, NodeController, FrameNode, DrawContext, Size, Offset, Position, Pivot, Scale, Translation, Matrix4, Rotation,
NodeRenderType, RenderOptions, BuilderNode, BuildOptions, NodeController, FrameNode, DrawContext, Size, Offset, Position, Pivot, Scale, Translation, Matrix4, Rotation,
Frame, RenderNode, XComponentNode, LengthMetrics, LengthMetricsUnit, LengthUnit, ColorMetrics, LayoutConstraint, ComponentContent, NodeContent, Content, typeNode, ShapeMask, ShapeClip,
NodeAdapter, Rect, RoundRect, edgeColors, borderStyles, borderRadiuses
} from '@ohos.arkui.node';
@ -171,7 +171,7 @@ export {
LabelOptions, LayeredDrawableDescriptor, LoadingDialog, LocaleResponse, MarginType, Matrix4, MeasureOptions, MeasureText,
MediaQuery, MediaQueryEvent, MediaQueryList, NodeController, NodeParam, NodeRenderType, Offset, OperateButton, OperateCheck, OperateIcon,
OperateItem, OperationOption, OperationType, OverlayManager, PathShape, PiPWindow, Pivot, Popup, PopupButtonOptions, PopupIconOptions, PopupOptions,
PopupTextOptions, Position, PrefixIconOptions, ProgressButton, Prompt, PromptAction, PromptOptions, RectShape, RenderNode, RenderOptions,
PopupTextOptions, Position, PrefixIconOptions, ProgressButton, Prompt, PromptAction, PromptOptions, RectShape, RenderNode, RenderOptions, BuildOptions,
RequestFullWindowOptions, Rotation, Router, RouterOptions, RouterState, Scale, ScreenOnVisibleOptions, SegmentButton, SegmentButtonItemOptionsArray,
SegmentButtonOptions, SelectDialog, SelectOptions, SelectTitleBar, SelectTitleBarMenuItem, SelectionMenu,
SelectionMenuOptions, ShapeMask, ShapeClip, ShowActionMenuOptions, ShowDialogOptions, ShowDialogSuccessResponse,