新增Chip/ChipGroup支持无障碍屏幕朗读接口

Signed-off-by: Zhang Jinyu <zhangjinyu101@huawei.com>
This commit is contained in:
Zhang Jinyu 2024-09-26 18:06:44 +08:00
parent a4faf90636
commit 3a79f9eef6
3 changed files with 464 additions and 5 deletions

231
api/@ohos.arkui.advanced.Chip.d.ets Executable file → Normal file
View File

@ -78,6 +78,47 @@ export declare enum ChipSize {
SMALL = "SMALL"
}
/**
* Enum for AccessibilitySelectedType
*
* @enum { number }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 14
*/
export declare enum AccessibilitySelectedType {
/**
* Default type.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 14
*/
CLICKED = 0,
/**
* Checked type.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 14
*/
CHECKED = 1,
/**
* Selected type.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 14
*/
SELECTED = 2
}
/**
* Defines the icon common option.
*
@ -205,6 +246,40 @@ export interface SuffixIconOptions extends IconCommonOptions {
* @since 12
*/
action?: () => void;
/**
* Set accessibility text for icon.
*
* @type { ?ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 14
*/
accessibilityText?: ResourceStr;
/**
* Set accessibility description for icon.
*
* @type { ?ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 14
*/
accessibilityDescription?: ResourceStr;
/**
* Set accessibility level for icon.
*
* @type { ?string }
* @default "auto"
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 14
*/
accessibilityLevel?: string;
}
/**
@ -228,6 +303,62 @@ export interface SuffixIconOptions extends IconCommonOptions {
*/
export interface PrefixIconOptions extends IconCommonOptions {}
/**
* Defines accessibility icon options.
*
* @interface AccessibilityOptions
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 14
*/
export interface AccessibilityOptions {
/**
* Set accessibility level for accessibility icon.
*
* @type { ?string }
* @default "auto"
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 14
*/
accessibilityLevel?: string;
/**
* Set accessibility text for accessibility icon.
*
* @type { ?ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 14
*/
accessibilityText?: ResourceStr;
/**
* Set accessibility description for accessibility icon.
*
* @type { ?ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 14
*/
accessibilityDescription?: ResourceStr;
}
/**
* Defines accessibility options of default close icon.
*
* @interface CloseOptions
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 14
*/
export interface CloseOptions extends AccessibilityOptions {}
/**
* Defines chip symbolglyph options.
*
@ -262,6 +393,50 @@ export interface ChipSymbolGlyphOptions {
activated?: SymbolGlyphModifier;
}
/**
* Defines accessibility options of suffix symbol.
*
* @interface ChipSuffixSymbolGlyphOptions
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 14
*/
export interface ChipSuffixSymbolGlyphOptions {
/**
* Set normal accessibility options for suffix symbol.
*
* @type { ?AccessibilityOptions }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 14
*/
normalAccessibility?: AccessibilityOptions;
/**
* Set activated accessibility options for suffix symbol.
*
* @type { ?AccessibilityOptions }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 14
*/
activatedAccessibility?: AccessibilityOptions;
/**
* Called when the suffix symbol is clicked.
*
* @type { ?VoidCallback }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 14
*/
action?: VoidCallback;
}
/**
* Defines label margin.
*
@ -588,6 +763,17 @@ export interface ChipOptions {
*/
suffixSymbol?: ChipSymbolGlyphOptions;
/**
* Set options for suffix symbol.
*
* @type { ?ChipSuffixSymbolGlyphOptions }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 14
*/
suffixSymbolOptions?: ChipSuffixSymbolGlyphOptions;
/**
* Show close icon.
*
@ -607,6 +793,17 @@ export interface ChipOptions {
*/
allowClose?: boolean;
/**
* Set options for default close icon when 'allowaClose' is true.
*
* @type { ?CloseOptions }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 14
*/
closeOptions?: CloseOptions;
/**
* Enable chip.
*
@ -745,6 +942,40 @@ export interface ChipOptions {
* @since 12
*/
direction?: Direction;
/**
* Set accessibility description for Chip.
*
* @type { ?ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 14
*/
accessibilityDescription?: ResourceStr;
/**
* Set accessibility level for Chip.
*
* @type { ?string }
* @default "auto"
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 14
*/
accessibilityLevel?: string;
/**
* Set accessibility selected type for Chip.
*
* @type { ?AccessibilitySelectedType }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 14
*/
accessibilitySelectedType?: AccessibilitySelectedType;
}
/**

View File

@ -19,7 +19,7 @@
*/
import { ChipSize, ChipSymbolGlyphOptions } from '@ohos.arkui.advanced.Chip';
import { ChipSize, ChipSymbolGlyphOptions, CloseOptions, ChipSuffixSymbolGlyphOptions } from '@ohos.arkui.advanced.Chip';
import { SymbolGlyphModifier } from './@ohos.arkui.modifier';
/**
@ -56,6 +56,62 @@ export interface IconOptions {
size?: SizeOptions;
}
/**
* Defines suffix icon options.
*
* @interface SuffixImageIconOptions
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 14
*/
export interface SuffixImageIconOptions extends IconOptions {
/**
* Called when the suffix image icon is clicked.
*
* @type { ?VoidCallback }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 14
*/
action?: VoidCallback;
/**
* Set accessibility text for icon.
*
* @type { ?ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 14
*/
accessibilityText?: ResourceStr;
/**
* Set accessibility description for icon.
*
* @type { ?ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 14
*/
accessibilityDescription?: ResourceStr;
/**
* Set accessibility level for icon.
*
* @type { ?string }
* @default "auto"
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 14
*/
accessibilityLevel?: string;
}
/**
* Defines label options.
*
@ -132,9 +188,22 @@ export interface ChipGroupItemOptions {
* @crossplatform
* @atomicservice
* @since 12
* @deprecated since 14
* @useinstead ChipGroupItemOptions#suffixImageIcon
*/
suffixIcon?: IconOptions;
/**
* Suffix icon.
*
* @type { ?SuffixImageIconOptions }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 14
*/
suffixImageIcon?: SuffixImageIconOptions;
/**
* suffix symbol.
*
@ -146,6 +215,17 @@ export interface ChipGroupItemOptions {
*/
suffixSymbol?: ChipSymbolGlyphOptions;
/**
* Set options for suffix symbol.
*
* @type { ?ChipSuffixSymbolGlyphOptions }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 14
*/
suffixSymbolOptions?: ChipSuffixSymbolGlyphOptions;
/**
* Allow close.
*
@ -156,6 +236,40 @@ export interface ChipGroupItemOptions {
* @since 12
*/
allowClose?: boolean;
/**
* Set options for default close icon when 'allowaClose' is true.
*
* @type { ?CloseOptions }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 14
*/
closeOptions?: CloseOptions;
/**
* Set accessibility description for ChipGroup item.
*
* @type { ?ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 14
*/
accessibilityDescription?: ResourceStr;
/**
* Set accessibility level for ChipGroup item.
*
* @type { ?string }
* @default "auto"
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 14
*/
accessibilityLevel?: string;
}
@ -303,6 +417,107 @@ export interface IconItemOptions {
* @since 12
*/
action: Callback<void>;
/**
* Set accessibility text for icon.
*
* @type { ?ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 14
*/
accessibilityText?: ResourceStr;
/**
* Set accessibility description for icon.
*
* @type { ?ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 14
*/
accessibilityDescription?: ResourceStr;
/**
* Set accessibility level for icon.
*
* @type { ?string }
* @default "auto"
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 14
*/
accessibilityLevel?: string;
}
/**
* Defines symbol item options.
*
* @interface SymbolItemOptions
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 14
*/
export interface SymbolItemOptions {
/**
* Set symbol.
*
* @type { ?SymbolGlyphModifier }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 14
*/
symbol: SymbolGlyphModifier;
/**
* Called when the symbol item is clicked.
*
* @type { ?VoidCallback }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 14
*/
action: VoidCallback;
/**
* Set accessibility text for symbol.
*
* @type { ?ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 14
*/
accessibilityText?: ResourceStr;
/**
* Set accessibility description for symbol.
*
* @type { ?ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 14
*/
accessibilityDescription?: ResourceStr;
/**
* Set accessibility level for symbol.
*
* @type { ?string }
* @default "auto"
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 14
*/
accessibilityLevel?: string;
}
/**
@ -358,8 +573,17 @@ export declare struct IconGroupSuffix {
* @atomicservice
* @since 12
*/
/**
* Suffix item.
*
* @type { Array<IconItemOptions | SymbolGlyphModifier | SymbolItemOptions> }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 14
*/
@Require @Prop
items: Array<IconItemOptions | SymbolGlyphModifier>;
items: Array<IconItemOptions | SymbolGlyphModifier | SymbolItemOptions>;
}

10
kits/@kit.ArkUI.d.ts vendored
View File

@ -24,11 +24,14 @@ import WindowExtensionAbility, { WindowExtensionContext } from '@ohos.applicatio
import { AtomicServiceNavigation, NavDestinationBuilder } from '@ohos.atomicservice.AtomicServiceNavigation';
import {
Chip, ChipOptions, ChipSize, IconCommonOptions, LabelMarginOptions, LabelOptions, PrefixIconOptions,
SuffixIconOptions, ChipSymbolGlyphOptions
SuffixIconOptions, ChipSymbolGlyphOptions, AccessibilitySelectedType, AccessibilityOptions, CloseOptions,
ChipSuffixSymbolGlyphOptions
} from '@ohos.arkui.advanced.Chip';
import { NavPushPathHelper } from '@ohos.atomicservice.NavPushPathHelper';
import {
IconOptions, LabelOptions as ChipItemLabelOptions, ChipGroupItemOptions, ChipItemStyle, ChipGroupSpaceOptions, IconItemOptions, IconGroupSuffix, ChipGroup
IconOptions, LabelOptions as ChipItemLabelOptions, ChipGroupItemOptions, ChipItemStyle,
ChipGroupSpaceOptions, IconItemOptions, IconGroupSuffix, ChipGroup, SuffixImageIconOptions,
SymbolItemOptions
} from '@ohos.arkui.advanced.ChipGroup';
import {
ComposeListItem, ContentItem, IconType, OperateButton, OperateCheck, OperateIcon, OperateItem
@ -214,5 +217,6 @@ export {
PixelMapDrawableDescriptor, AnimationOptions, AnimatedDrawableDescriptor, NodeAdapter, DownloadFileButton,
DownloadLayoutDirection, DownloadIconStyle, DownloadDescription, DownloadContentOptions, DownloadStyleOptions,
Rect, RoundRect, edgeColors, edgeWidths, borderStyles, borderRadiuses, ParticleModifier,
InnerFullScreenLaunchComponent, LaunchController,
InnerFullScreenLaunchComponent, LaunchController, AccessibilitySelectedType, AccessibilityOptions, CloseOptions, ChipSuffixSymbolGlyphOptions,
SuffixImageIconOptions, SymbolItemOptions,
};