【高级组件ToolBar】基础能力优化,支持配置工具栏分割线、背景色、高度、按压效果、文本色和图标色、宽度调节能力

Signed-off-by: shashaH <huangshasha6@h-partners.com>
This commit is contained in:
shashaH 2024-08-02 10:34:34 +08:00
parent 881f180568
commit 306dc491e9
2 changed files with 141 additions and 3 deletions

View File

@ -21,7 +21,8 @@
import { SymbolGlyphModifier, DividerModifier } from './@ohos.arkui.modifier';
import { LengthMetrics } from './@ohos.arkui.node';
/**
* Declare enum ItemState
* @enum { ItemState }
@ -74,6 +75,37 @@ export declare enum ItemState {
ACTIVATE = 3
}
/**
* Defines toolBar symbolGlyph options.
*
* @interface ToolBarSymbolGlyphOptions
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 13
*/
export interface ToolBarSymbolGlyphOptions {
/**
* Modifier of toolbar's normal symbol.
*
* @type { ?SymbolGlyphModifier }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 13
*/
normal?: SymbolGlyphModifier;
/**
* Modifier of toolbar's activated symbol.
*
* @type { ?SymbolGlyphModifier }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 13
*/
activated?: SymbolGlyphModifier;
}
/**
* Declare type ToolBarOption
* @syscap SystemCapability.ArkUI.ArkUI.Full
@ -143,6 +175,47 @@ export declare class ToolBarOption {
* @since 11
*/
state?: ItemState;
/**
* Define text fontColor.
* @type { ?ResourceColor }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 13
*/
textColor?: ResourceColor;
/**
* Text fontColor when the item is activated.
* @type { ?ResourceColor }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 13
*/
activatedTextColor?: ResourceColor;
/**
* Define icon fillColor.
* @type { ?ResourceColor }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 13
*/
iconColor?: ResourceColor;
/**
* Icon fillColor when the item is activated.
* @type { ?ResourceColor }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 13
*/
activatedIconColor?: ResourceColor;
/**
* Item symbol icon.
*
* @type { ?ToolBarSymbolGlyphOptions }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 13
*/
toolBarSymbolOptions?: ToolBarSymbolGlyphOptions;
}
/**
@ -160,6 +233,55 @@ export declare class ToolBarOption {
export declare class ToolBarOptions extends Array<ToolBarOption> {
}
/**
* Declare ToolBarModifier use in ToolBar
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 13
*/
export declare class ToolBarModifier {
/**
* Sets the height of the toolBar.
*
* @param { LengthMetrics } height - toolBar's height.
* @returns { ToolBarModifier } returns the instance of the ToolBarModifier.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 13
*/
height(height: LengthMetrics): ToolBarModifier;
/**
* Sets the backgroundColor of the toolBar.
*
* @param { ResourceColor } backgroundColor - toolBar's backgroundColor.
* @returns { ToolBarModifier } returns the instance of the ToolBarModifier.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 13
*/
backgroundColor(backgroundColor: ResourceColor): ToolBarModifier;
/**
* Sets the left and right padding of the toolbar.
*
* @param { LengthMetrics } padding - left and right padding.
* @returns { ToolBarModifier } returns the instance of the ToolBarModifier.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 13
*/
padding(padding: LengthMetrics): ToolBarModifier;
/**
* Sets whether or not to display the press status effect.
*
* @param { boolean } stateEffect - press status effect.
* @returns { ToolBarModifier } returns the instance of the ToolBarModifier.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 13
*/
stateEffect(stateEffect: boolean): ToolBarModifier;
}
/**
* Declare Component ToolBar
* @syscap SystemCapability.ArkUI.ArkUI.Full
@ -215,4 +337,20 @@ export declare struct ToolBar {
* @since 11
*/
controller: TabsController;
/**
* Define divider Modifier.
* @type { ?DividerModifier }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 13
*/
@Prop dividerModifier?: DividerModifier;
/**
* Define toolbar modifier.
* @type { ?ToolBarModifier }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 13
*/
@Prop toolBarModifier?: ToolBarModifier;
}

View File

@ -62,7 +62,7 @@ import { SplitLayout } from '@ohos.arkui.advanced.SplitLayout';
import { OperationOption, OperationType, SelectOptions, SubHeader, SymbolOptions } from '@ohos.arkui.advanced.SubHeader';
import { SwipeRefresher } from '@ohos.arkui.advanced.SwipeRefresher';
import { TabTitleBar, TabTitleBarMenuItem, TabTitleBarTabItem } from '@ohos.arkui.advanced.TabTitleBar';
import { ItemState, ToolBar, ToolBarOption, ToolBarOptions } from '@ohos.arkui.advanced.ToolBar';
import { ItemState, ToolBar, ToolBarOption, ToolBarOptions, ToolBarModifier, ToolBarSymbolGlyphOptions } from '@ohos.arkui.advanced.ToolBar';
import {
CallbackParam, NodeParam, TreeController, TreeListenType, TreeListener, TreeListenerManager, TreeView
} from '@ohos.arkui.advanced.TreeView';
@ -177,7 +177,7 @@ export {
SelectionMenuOptions, ShapeMask, ShapeClip, ShowActionMenuOptions, ShowDialogOptions, ShowDialogSuccessResponse,
ShowToastOptions, Size, SplitLayout, SubHeader, SuffixIconOptions, SwipeRefresher, SymbolOptions, SystemMediaQuery, SystemRouter,
TabSegmentButtonConstructionOptions, TabSegmentButtonOptions, TabTitleBar, TabTitleBarMenuItem, TabTitleBarTabItem,
TipsDialog, ToolBar, ToolBarOption, ToolBarOptions, Translation, TreeController, TreeListenType, TreeListener,
TipsDialog, ToolBar, ToolBarOption, ToolBarOptions, ToolBarModifier, ToolBarSymbolGlyphOptions, Translation, TreeController, TreeListenType, TreeListener,
TreeListenerManager, TreeView, UIContext, UIInspector, UIObserver, PageInfo, WindowExtensionAbility, WindowExtensionContext, XComponentNode,
LengthMetrics, LengthMetricsUnit, LengthUnit, ColorMetrics, LayoutConstraint, ComponentContent, NodeContent, Content, componentSnapshot, componentUtils, curves, display, dragController, dragInteraction,
font, inspector, matrix4, mediaquery, performanceMonitor, pluginComponentManager, PluginComponentTemplate, prompt, promptAction, router,