Ai
46 Star 180 Fork 4.8K

OpenHarmony/interface_sdk-js
关闭

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
@ohos.atomicservice.AtomicServiceSearch.d.ets 21.07 KB
一键复制 编辑 原始数据 按行查看 历史
liangliang6768 提交于 2025-03-02 09:37 +08:00 . change api16 to 18
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828
/*
* Copyright (C) 2025 Huawei Device Co., Ltd.
* 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.
*/
/**
* @file This section describes the interfaces used by AtomicServiceSearch
* @kit ArkUI
*/
import { OperationOption } from '@ohos.arkui.advanced.SubHeader';
/**
* Callback when the Select option is clicked.
*
* @typedef { function } OnSelectCallback
* @param { number } index - Indicates the index of the selected item.
* @param { string } [selectValue] - Indicates the value of the selected item.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
declare type OnSelectCallback = (index: number, selectValue: string) => void;
/**
* Callback when text is pasted into the search box.
*
* @typedef { function } OnPasteCallback
* @param { string } pasteValue - Indicates the text content to be pasted.
* @param { PasteEvent } event - Indicates a user-defined paste event.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
declare type OnPasteCallback = (pasteValue: string, event: PasteEvent) => void;
/**
* Callback when the position of the cursor entered in the search box changes.
*
* @typedef { function } OnTextSelectionChangeCallback
* @param { number } selectionStart - Indicates the start position of the text selection area.
* @param { number } selectionEnd - Indicates end position of the text selection area.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
declare type OnTextSelectionChangeCallback = (selectionStart: number, selectionEnd: number) => void;
/**
* Callback when the content in the search box scrolls.
*
* @typedef { function } OnContentScrollCallback
* @param { number } totalOffsetX - Indicates horizontal coordinate offset of the text in the content area, in px.
* @param { number } totalOffsetY - Indicates the vertical coordinate offset of the text in the content area, in px.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
declare type OnContentScrollCallback = (totalOffsetX: number, totalOffsetY: number) => void;
/**
* Defines the InputFilter parameters.
*
* @typedef InputFilterParams
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
export interface InputFilterParams {
/**
* Regular expression.
*
* @type { ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
inputFilterValue: ResourceStr;
/**
* If the regular expression matching fails, the filtered content is returned.
*
* @type { ?Callback<string> }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
error?: Callback<string>;
}
/**
* Defines the SearchButton parameters.
*
* @typedef SearchButtonParams
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
export interface SearchButtonParams {
/**
* Indicates the text of the search button.
*
* @type { ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
searchButtonValue: ResourceStr;
/**
* Indicates the fontSize and fontColor of the search button.
*
* @type { ?SearchButtonOptions }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
options?: SearchButtonOptions;
}
/**
* Defines the MenuAlign parameters.
*
* @typedef MenuAlignParams
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
export interface MenuAlignParams {
/**
* Indicates the fontSize and fontColor of the search button.
*
* @type { MenuAlignType }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
alignType: MenuAlignType;
/**
* Offset of the drop-down menu relative to the drop-down button.
* after alignment based on the alignment type.
*
* @type { ?Offset }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
offset?: Offset;
}
/**
* Events and styles supported by the search area.
*
* @typedef SearchParams
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
export interface SearchParams {
/**
* Used to identify a unique search component.
*
* @type { ?ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
searchKey?: ResourceStr;
/**
* Indicates the background color of a component.
*
* @type { ?ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
componentBackgroundColor?: ResourceColor;
/**
* Background color when pressed.
*
* @type { ?ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
pressedBackgroundColor?: ResourceColor;
/**
* Set the search button text, fontSize and fontColor.
*
* @type { ?SearchButtonParams }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
searchButton?: SearchButtonParams;
/**
* Set the place hold text color.
*
* @type { ?ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
placeholderColor?: ResourceColor;
/**
* Set the font used for place holder text.
*
* @type { ?Font }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
placeholderFont?: Font;
/**
* Set enter key type of soft keyboard.
*
* @type { ?Font }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
textFont?: Font;
/**
* Called when the text align is set.
*
* @type { ?TextAlign }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
textAlign?: TextAlign;
/**
* Called when the copy option is set.
*
* @type { ?CopyOptions }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
copyOptions?: CopyOptions;
/**
* Set the search icon style.
*
* @type { ?(IconOptions | SymbolGlyphModifier) }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
searchIcon?: IconOptions | SymbolGlyphModifier;
/**
* Set the cancel button style.
*
* @type { ?IconOptions }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
cancelIcon?: IconOptions;
/**
* Set the SearchButton fontColor.
*
* @type { ?ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
fontColor?: ResourceColor;
/**
* Set the cursor style.
*
* @type { ?CaretStyle }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
caretStyle?: CaretStyle;
/**
* Sets whether request keyboard or not when on focus.
*
* @type { ?boolean }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
enableKeyboardOnFocus?: boolean;
/**
* Controls whether the selection menu pops up.
*
* @type { ?boolean }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
hideSelectionMenu?: boolean;
/**
* Called when the search type is set.
*
* @type { ?SearchType }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
type?: SearchType;
/**
* Called when the input of maximum text length is set.
*
* @type { ?number }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
maxLength?: number;
/**
* Set enter key type of soft keyboard.
*
* @type { ?EnterKeyType }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
enterKeyType?: EnterKeyType;
/**
* Called when the text decoration of the text is set.
*
* @type { ?TextDecorationOptions }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
decoration?: TextDecorationOptions;
/**
* Called when the distance between text fonts is set.
*
* @type { ?(number | string | Resource) }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
letterSpacing?: number | string | Resource;
/**
* Set font feature.
* normal | <feature-tag-value>,
* where <feature-tag-value> = <string> [ <integer> | on | off ], like: "ss01" 0
* the values of <feature-tag-value> reference to doc of search component
* number of <feature-tag-value> can be single or multiple, and separated by comma ','.
*
* @type { ?ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
fontFeature?: ResourceStr;
/**
* Define the text selected background color of the text input.
*
* @type { ?ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
selectedBackgroundColor?: ResourceColor;
/**
* Called when the inputFilter of text is set.
*
* @type { ?InputFilterParams }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
inputFilter?: InputFilterParams;
/**
* Specify the indentation of the first line in a text-block.
*
* @type { ?Dimension }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
textIndent?: Dimension;
/**
* Called when the minimum font size of the font is set.
*
* @type { ?(number | string | Resource) }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
minFontSize?: number | string | Resource;
/**
* Called when the maximum font size of the font is set.
*
* @type { ?(number | string | Resource) }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
maxFontSize?: number | string | Resource;
/**
* Set the custom text menu.
*
* @type { ?EditMenuOptions }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
editMenuOptions?: EditMenuOptions;
/**
* Define the preview text mode of the text input.
*
* @type { ?boolean }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
enablePreviewText?: boolean;
/**
* Enable or disable haptic feedback.
*
* @type { ?boolean }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
enableHapticFeedback?: boolean;
/**
* Call the function when clicked the search button.
*
* @type { ?(Callback<string> | SearchSubmitCallback) }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
onSubmit?: Callback<string> | SearchSubmitCallback;
/**
* Call the function when editing the input text.
*
* @type { ?EditableTextOnChangeCallback }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
onChange?: EditableTextOnChangeCallback;
/**
* Called when using the Clipboard menu.
*
* @type { ?Callback<string> }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
onCopy?: Callback<string>;
/**
* Called when using the Clipboard menu.
*
* @type { ?Callback<string> }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
onCut?: Callback<string>;
/**
* Called when using the Clipboard menu.
*
* @type { ?OnPasteCallback }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
onPaste?: OnPasteCallback;
/**
* Called when the text selection changes.
*
* @type { ?OnTextSelectionChangeCallback }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
onTextSelectionChange?: OnTextSelectionChangeCallback;
/**
* Called when the content scrolls.
*
* @type { ?OnContentScrollCallback }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
onContentScroll?: OnContentScrollCallback;
/**
* Called when judging whether the text editing change finished.
*
* @type { ?Callback<boolean> }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
onEditChange?: Callback<boolean>;
/**
* Get text value information when about to input.
*
* @type { ?Callback<InsertValue, boolean> }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
onWillInsert?: Callback<InsertValue, boolean>;
/**
* Get text value information when completed input.
*
* @type { ?Callback<InsertValue> }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
onDidInsert?: Callback<InsertValue>;
/**
* Get text value information when about to delete.
*
* @type { ?Callback<DeleteValue, boolean> }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
onWillDelete?: Callback<DeleteValue, boolean>;
/**
* Get text value information when the deletion has been completed.
*
* @type { ?Callback<DeleteValue> }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
onDidDelete?: Callback<DeleteValue>;
}
/**
* Contents, events, and styles of the select area.
*
* @typedef SelectParams
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
export interface SelectParams {
/**
* SubOption array of the select.
*
* @type { ?Array<SelectOption> }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
options?: Array<SelectOption>;
/**
* The default selected index.
*
* @type { ?number }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
selected?: number;
/**
* The default text value.
*
* @type { ?ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
selectValue?: ResourceStr;
/**
* Callback when the select is selected.
*
* @type { ?OnSelectCallback }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
onSelect?: OnSelectCallback;
/**
* Register a ContentModifier for each menu item.
*
* @type { ?ContentModifier<MenuItemConfiguration> }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
menuItemContentModifier?: ContentModifier<MenuItemConfiguration>;
/**
* Sets the divider of select.
*
* @type { ?(Optional<DividerOptions> | null) }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
divider?: Optional<DividerOptions> | null;
/**
* Sets the text properties of the select button itself.
*
* @type { ?Font }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
font?: Font;
/**
* Sets the text color of the select button itself.
*
* @type { ?ResourceColor }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
fontColor?: ResourceColor;
/**
* Sets the background color of the selected items in the select.
*
* @type { ?ResourceColor }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
selectedOptionBgColor?: ResourceColor;
/**
* Sets the text style of the selected items in the select.
*
* @type { ?Font }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
selectedOptionFont?: Font;
/**
* Sets the text color of the selected item in the select.
*
* @type { ?ResourceColor }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
selectedOptionFontColor?: ResourceColor;
/**
* Sets the background color of the select item.
*
* @type { ?ResourceColor }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
optionBgColor?: ResourceColor;
/**
* Sets the text style for select items.
*
* @type { ?Font }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
optionFont?: Font;
/**
* Sets the text color for select items.
*
* @type { ?ResourceColor }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
optionFontColor?: ResourceColor;
/**
* Set the width of each option and set whether the option width fit the trigger.
*
* @type { ?(Dimension | OptionWidthMode) }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
optionWidth?: Dimension | OptionWidthMode;
/**
* Set the height of each option.
*
* @type { ?Dimension }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
optionHeight?: Dimension;
/**
* Set the space for text and icon in select.
*
* @type { ?Length }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
space?: Length;
/**
* Set the layout direction for text and arrow in select.
*
* @type { ?ArrowPosition }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
arrowPosition?: ArrowPosition;
/**
* Set the alignment between select and menu.
*
* @type { ?MenuAlignParams }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
menuAlign?: MenuAlignParams;
/**
* Set the menu's background color.
*
* @type { ?ResourceColor }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
menuBackgroundColor?: ResourceColor;
/**
* Set menu background blur Style.
*
* @type { ?BlurStyle }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
menuBackgroundBlurStyle?: BlurStyle;
}
/**
* Function settings in the selection area (right).
*
* @typedef OperationParams
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
export interface OperationParams {
/**
* Function bits attached to the search area (right).
*
* @type { ?OperationOption }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
auxiliaryItem?: OperationOption;
/**
* Function bits independent of search area (right).
*
* @type { ?OperationOption }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
independentItem?: OperationOption;
}
/**
* Defines AtomicServiceSearch.
*
* @struct {AtomicServiceSearch}
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
@Component
export declare struct AtomicServiceSearch {
/**
* Sets the search text content that is currently displayed.
*
* @type { ?ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
@Prop
value?: ResourceStr;
/**
* Indicates default prompt text displayed in the search box.
* The default value is Search, which supports globalization.
*
* @type { ?ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
@Prop
placeholder?: ResourceStr;
/**
* Events and styles supported by the search area.
*
* @type { ?SearchParams }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
@Prop
search?: SearchParams;
/**
* Contents, events, and styles of the select area.
*
* @type { ?SelectParams }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
@Prop
select?: SelectParams;
/**
* Function settings in the selection area (right).
*
* @type { ?OperationParams }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
operation?: OperationParams;
/**
* Set the Search component controller.
*
* @type { ?SearchController }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
controller?: SearchController;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/openharmony/interface_sdk-js.git
git@gitee.com:openharmony/interface_sdk-js.git
openharmony
interface_sdk-js
interface_sdk-js
master

搜索帮助