2023-08-24 13:38:03 +00:00
|
|
|
/*
|
2024-03-04 07:12:03 +00:00
|
|
|
* Copyright (c) 2023-2024 Huawei Device Co., Ltd.
|
2023-08-24 13:38:03 +00:00
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2023-12-11 09:08:03 +00:00
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* @kit ArkUI
|
|
|
|
*/
|
|
|
|
|
2024-05-31 02:09:33 +00:00
|
|
|
import { TextModifier } from './@ohos.arkui.modifier';
|
2024-05-23 02:45:37 +00:00
|
|
|
|
2023-08-24 13:38:03 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Control style of operation element
|
|
|
|
* @enum { OperationStyle }
|
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-11-22 07:19:57 +00:00
|
|
|
/**
|
|
|
|
* Control style of operation element
|
|
|
|
* @enum { OperationStyle }
|
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2023-08-24 13:38:03 +00:00
|
|
|
export declare enum OperationType {
|
|
|
|
/**
|
|
|
|
* The TextArrow style.
|
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-11-22 07:19:57 +00:00
|
|
|
/**
|
|
|
|
* The TextArrow style.
|
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2023-08-24 13:38:03 +00:00
|
|
|
TEXT_ARROW = 0,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The Button style.
|
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-11-22 07:19:57 +00:00
|
|
|
/**
|
|
|
|
* The Button style.
|
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2023-08-24 13:38:03 +00:00
|
|
|
BUTTON = 1,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The IconGroup style.
|
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-11-22 07:19:57 +00:00
|
|
|
/**
|
|
|
|
* The IconGroup style.
|
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2023-08-24 13:38:03 +00:00
|
|
|
ICON_GROUP = 2,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The LoadingProgress style.
|
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-11-22 07:19:57 +00:00
|
|
|
/**
|
|
|
|
* The LoadingProgress style.
|
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2023-08-24 13:38:03 +00:00
|
|
|
LOADING = 3
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Declare type OperationOption
|
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-11-22 07:19:57 +00:00
|
|
|
/**
|
|
|
|
* Declare type OperationOption
|
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2023-08-30 02:06:37 +00:00
|
|
|
export declare class OperationOption {
|
2023-08-24 13:38:03 +00:00
|
|
|
/**
|
|
|
|
* The content of text or the address of icon.
|
|
|
|
* @type { ResourceStr }.
|
2024-01-29 07:53:29 +00:00
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
2023-08-24 13:38:03 +00:00
|
|
|
* @since 10
|
|
|
|
*/
|
2023-11-22 07:19:57 +00:00
|
|
|
/**
|
|
|
|
* The content of text or the address of icon.
|
|
|
|
* @type { ResourceStr }.
|
2024-01-29 07:53:29 +00:00
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
2023-11-22 07:19:57 +00:00
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2023-08-24 13:38:03 +00:00
|
|
|
value: ResourceStr;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* callback function when operate the text or icon.
|
|
|
|
* @type { () => void }.
|
2024-01-29 07:53:29 +00:00
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
2023-08-24 13:38:03 +00:00
|
|
|
* @since 10
|
|
|
|
*/
|
2023-11-22 07:19:57 +00:00
|
|
|
/**
|
|
|
|
* callback function when operate the text or icon.
|
|
|
|
* @type { () => void }.
|
2024-01-29 07:53:29 +00:00
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
2023-11-22 07:19:57 +00:00
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2023-08-24 13:38:03 +00:00
|
|
|
action?: () => void;
|
2023-10-24 01:46:28 +00:00
|
|
|
}
|
2023-08-24 13:38:03 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Declare type SelectOption
|
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-11-22 07:19:57 +00:00
|
|
|
/**
|
|
|
|
* Declare type SelectOption
|
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2023-08-30 02:06:37 +00:00
|
|
|
export declare class SelectOptions {
|
2023-08-24 13:38:03 +00:00
|
|
|
/**
|
|
|
|
* SubOption array of the select.
|
|
|
|
* @type { Array<SelectSubOption> }.
|
2024-01-29 07:53:29 +00:00
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
2023-08-24 13:38:03 +00:00
|
|
|
* @since 10
|
|
|
|
*/
|
2023-11-22 07:19:57 +00:00
|
|
|
/**
|
|
|
|
* SubOption array of the select.
|
|
|
|
* @type { Array<SelectSubOption> }.
|
2024-01-29 07:53:29 +00:00
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
2023-11-22 07:19:57 +00:00
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2023-08-24 13:38:03 +00:00
|
|
|
options: Array<SelectOption>;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The default selected index.
|
|
|
|
* @type { number }.
|
2024-01-29 07:53:29 +00:00
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
2023-08-24 13:38:03 +00:00
|
|
|
* @since 10
|
|
|
|
*/
|
2023-11-22 07:19:57 +00:00
|
|
|
/**
|
|
|
|
* The default selected index.
|
|
|
|
* @type { number }.
|
2024-01-29 07:53:29 +00:00
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
2023-11-22 07:19:57 +00:00
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2023-08-24 13:38:03 +00:00
|
|
|
selected?: number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The default text value.
|
|
|
|
* @type { string }.
|
2024-01-29 07:53:29 +00:00
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
2023-08-24 13:38:03 +00:00
|
|
|
* @since 10
|
|
|
|
*/
|
2023-11-22 07:19:57 +00:00
|
|
|
/**
|
|
|
|
* The default text value.
|
|
|
|
* @type { string }.
|
2024-01-29 07:53:29 +00:00
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
2023-11-22 07:19:57 +00:00
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2023-08-24 13:38:03 +00:00
|
|
|
value?: string;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Callback when the select is selected.
|
|
|
|
* @type { (index: number, value?: string) => void }.
|
2024-01-29 07:53:29 +00:00
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
2023-08-24 13:38:03 +00:00
|
|
|
* @since 10
|
|
|
|
*/
|
2023-11-22 07:19:57 +00:00
|
|
|
/**
|
|
|
|
* Callback when the select is selected.
|
|
|
|
* @type { (index: number, value?: string) => void }.
|
2024-01-29 07:53:29 +00:00
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
2023-11-22 07:19:57 +00:00
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2023-08-24 13:38:03 +00:00
|
|
|
onSelect?: (index: number, value?: string) => void;
|
2023-10-24 01:46:28 +00:00
|
|
|
}
|
2023-08-24 13:38:03 +00:00
|
|
|
|
2024-03-01 01:51:59 +00:00
|
|
|
/**
|
|
|
|
* Declare type SymbolOptions
|
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @atomicservice
|
|
|
|
* @since 12
|
|
|
|
*/
|
|
|
|
export declare class SymbolOptions {
|
|
|
|
/**
|
|
|
|
* The size of symbol icon.
|
2024-03-08 01:49:07 +00:00
|
|
|
* @type { ?(number | string | Resource) }.
|
2024-03-01 01:51:59 +00:00
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @atomicservice
|
|
|
|
* @since 12
|
|
|
|
*/
|
2024-03-07 14:00:56 +00:00
|
|
|
fontSize?: number | string | Resource;
|
2024-03-01 01:51:59 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The color of symbol icon.
|
2024-03-08 01:49:07 +00:00
|
|
|
* @type { ?(Array<ResourceColor>) }.
|
2024-03-01 01:51:59 +00:00
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @atomicservice
|
|
|
|
* @since 12
|
|
|
|
*/
|
2024-03-07 14:00:56 +00:00
|
|
|
fontColor?: Array<ResourceColor>;
|
2024-03-01 01:51:59 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The fontWeight of symbol icon.
|
2024-03-08 01:49:07 +00:00
|
|
|
* @type { ?(number | FontWeight | string) }.
|
2024-03-01 01:51:59 +00:00
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @atomicservice
|
|
|
|
* @since 12
|
|
|
|
*/
|
2024-03-07 14:00:56 +00:00
|
|
|
fontWeight?: number | FontWeight | string;
|
2024-03-01 01:51:59 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The effect strategy of symbol icon.
|
2024-03-08 01:49:07 +00:00
|
|
|
* @type { ?(SymbolEffectStrategy) }.
|
2024-03-01 01:51:59 +00:00
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @atomicservice
|
|
|
|
* @since 12
|
|
|
|
*/
|
2024-03-07 14:00:56 +00:00
|
|
|
effectStrategy?: SymbolEffectStrategy;
|
2024-03-01 01:51:59 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The rendering strategy of symbol icon.
|
2024-03-08 01:49:07 +00:00
|
|
|
* @type { ?(SymbolRenderingStrategy) }.
|
2024-03-01 01:51:59 +00:00
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @atomicservice
|
|
|
|
* @since 12
|
|
|
|
*/
|
2024-03-07 14:00:56 +00:00
|
|
|
renderingStrategy?: SymbolRenderingStrategy;
|
2024-03-01 01:51:59 +00:00
|
|
|
}
|
|
|
|
|
2023-08-24 13:38:03 +00:00
|
|
|
/**
|
|
|
|
* Declare struct SubHeader
|
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-11-22 07:19:57 +00:00
|
|
|
/**
|
|
|
|
* Declare struct SubHeader
|
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2023-08-24 13:38:03 +00:00
|
|
|
@Component
|
|
|
|
export declare struct SubHeader {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Icon resource of content area.
|
|
|
|
* @type { ResourceStr }.
|
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-11-22 07:19:57 +00:00
|
|
|
/**
|
|
|
|
* Icon resource of content area.
|
|
|
|
* @type { ResourceStr }.
|
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2023-08-24 13:38:03 +00:00
|
|
|
@Prop icon?: ResourceStr;
|
|
|
|
|
2024-03-01 01:51:59 +00:00
|
|
|
/**
|
|
|
|
* Attributes of Symbol icon.
|
2024-03-08 01:49:07 +00:00
|
|
|
* @type { SymbolOptions}.
|
2024-03-01 01:51:59 +00:00
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @since 12
|
|
|
|
*/
|
|
|
|
iconSymbolOptions?: SymbolOptions;
|
|
|
|
|
2023-08-24 13:38:03 +00:00
|
|
|
/**
|
|
|
|
* The first line text of content area.
|
|
|
|
* @type { ResourceStr }.
|
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-11-22 07:19:57 +00:00
|
|
|
/**
|
|
|
|
* The first line text of content area.
|
|
|
|
* @type { ResourceStr }.
|
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2023-08-24 13:38:03 +00:00
|
|
|
@Prop primaryTitle?: ResourceStr;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The secondary line text of content area.
|
|
|
|
* @type { ResourceStr }.
|
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-11-22 07:19:57 +00:00
|
|
|
/**
|
|
|
|
* The secondary line text of content area.
|
|
|
|
* @type { ResourceStr }.
|
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2023-08-24 13:38:03 +00:00
|
|
|
@Prop secondaryTitle?: ResourceStr;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Select option of content area.
|
|
|
|
* @type { SelectOptions }.
|
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-11-22 07:19:57 +00:00
|
|
|
/**
|
|
|
|
* Select option of content area.
|
|
|
|
* @type { SelectOptions }.
|
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2023-08-24 13:38:03 +00:00
|
|
|
select?: SelectOptions;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Operation style of SubHeader.
|
|
|
|
* @type { OperationStyle }.
|
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-11-22 07:19:57 +00:00
|
|
|
/**
|
|
|
|
* Operation style of SubHeader.
|
|
|
|
* @type { OperationStyle }.
|
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2023-08-24 13:38:03 +00:00
|
|
|
@Prop operationType?: OperationType;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* operation item.
|
|
|
|
* @type { Array<OperationOption> }.
|
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @since 10
|
|
|
|
*/
|
2023-11-22 07:19:57 +00:00
|
|
|
/**
|
|
|
|
* operation item.
|
|
|
|
* @type { Array<OperationOption> }.
|
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @atomicservice
|
|
|
|
* @since 11
|
|
|
|
*/
|
2023-08-24 13:38:03 +00:00
|
|
|
operationItem?: Array<OperationOption>;
|
2024-03-01 01:51:59 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Attributes of Symbol icons in operation area.
|
2024-03-08 01:49:07 +00:00
|
|
|
* @type { Array<SymbolOptions> }.
|
2024-03-01 01:51:59 +00:00
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @since 12
|
|
|
|
*/
|
|
|
|
operationSymbolOptions?: Array<SymbolOptions>;
|
2024-05-20 11:19:49 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Text modifier for primary title.
|
|
|
|
* @type { TextModifier }.
|
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @since 12
|
|
|
|
*/
|
|
|
|
primaryTitleModifier?: TextModifier;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Text modifier for secondary title.
|
|
|
|
* @type { TextModifier }.
|
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @since 12
|
|
|
|
*/
|
|
|
|
secondaryTitleModifier?: TextModifier;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the title content.
|
|
|
|
* @type { () => void }
|
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @since 12
|
|
|
|
*/
|
|
|
|
@BuilderParam titleBuilder?: () => void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the content margin.
|
|
|
|
* @type { ?LocalizedMargin }
|
2024-06-18 07:20:05 +00:00
|
|
|
* @default {start: LengthMetrics.resource($r('sys.float.margin_left')),
|
|
|
|
* <br> end: LengthMetrics.resource($r('sys.float.margin_right'))}
|
2024-05-20 11:19:49 +00:00
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @since 12
|
|
|
|
*/
|
|
|
|
@Prop contentMargin?: LocalizedMargin;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the content padding.
|
|
|
|
* @type { ?LocalizedPadding }
|
|
|
|
* @default set different default values according to the width of the subHeader:
|
|
|
|
* <br> When the left area is secondaryTitle or the group of secondaryTitle and icon,
|
|
|
|
* <br> the default value is {start: LengthMetrics.vp(12), end: LengthMetrics.vp(12)};
|
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @since 12
|
|
|
|
*/
|
|
|
|
@Prop contentPadding?: LocalizedPadding;
|
2023-08-30 02:06:37 +00:00
|
|
|
}
|