46 Star 173 Fork 4.7K

OpenHarmony/interface_sdk-js

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
@ohos.inputMethod.d.ts 92.77 KB
一键复制 编辑 原始数据 按行查看 历史
guojin31 提交于 15天前 . 修改单词拼写错误
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374
/*
* Copyright (c) 2021 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
* @kit IMEKit
*/
import type { Callback, AsyncCallback } from './@ohos.base';
import type { ElementName } from './bundleManager/ElementName';
import InputMethodSubtype from './@ohos.InputMethodSubtype';
import type { PanelInfo } from './@ohos.inputMethod.Panel';
/**
* Input method
*
* @namespace inputMethod
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 6
*/
declare namespace inputMethod {
/**
* Keyboard max number
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
*/
const MAX_TYPE_NUM: number;
/**
* Input method setting
*
* @returns { InputMethodSetting } the object of InputMethodSetting
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
* @deprecated since 9
* @useinstead inputMethod#getSetting
*/
function getInputMethodSetting(): InputMethodSetting;
/**
* Input method controller
*
* @returns { InputMethodController } the object of InputMethodController.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 6
* @deprecated since 9
* @useinstead inputMethod#getController
*/
function getInputMethodController(): InputMethodController;
/**
* Input method setting
*
* @returns { InputMethodSetting } the object of InputMethodSetting.
* @throws { BusinessError } 12800007 - input method setter error. Possible cause:
* create InputMethodSetting object failed.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
function getSetting(): InputMethodSetting;
/**
* Input method controller
*
* @returns { InputMethodController } the object of InputMethodController.
* @throws { BusinessError } 12800006 - input method controller error. Possible cause:
* create InputMethodController object failed.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
function getController(): InputMethodController;
/**
* Get default input method
*
* @returns { InputMethodProperty } property of the default input method.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 11
*/
function getDefaultInputMethod(): InputMethodProperty;
/**
* Get system input method config ability
*
* @returns { ElementName } the information of system input method config ability.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 11
*/
function getSystemInputMethodConfigAbility(): ElementName;
/**
* Switch input method
*
* @permission ohos.permission.CONNECT_IME_ABILITY
* @param { InputMethodProperty } target - indicates the input method which will replace the current one.
* @param { AsyncCallback<boolean> } callback - the callback of switchInputMethod.
* @throws { BusinessError } 201 - permissions check fails.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
* @throws { BusinessError } 12800005 - configuration persistence error.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
/**
* Switch input method. The caller must be the current inputmethod.
*
* @param { InputMethodProperty } target - indicates the target input method.
* @param { AsyncCallback<boolean> } callback - the callback of switchInputMethod.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
* @throws { BusinessError } 12800005 - configuration persistence error.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 11
*/
function switchInputMethod(target: InputMethodProperty, callback: AsyncCallback<boolean>): void;
/**
* Switch input method
*
* @permission ohos.permission.CONNECT_IME_ABILITY
* @param { InputMethodProperty } target - Indicates the input method which will replace the current one.
* @returns { Promise<boolean> } the promise returned by the function.
* @throws { BusinessError } 201 - permissions check fails.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
* @throws { BusinessError } 12800005 - configuration persistence error.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
/**
* Switch input method. The caller must be the current inputmethod.
*
* @param { InputMethodProperty } target - indicates the target input method.
* @returns { Promise<boolean> } the promise returned by the function.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
* @throws { BusinessError } 12800005 - configuration persistence error.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 11
*/
function switchInputMethod(target: InputMethodProperty): Promise<boolean>;
/**
* Get current input method
*
* @returns { InputMethodProperty } the property of current inputmethod.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
function getCurrentInputMethod(): InputMethodProperty;
/**
* Switch current input method subtype
*
* @permission ohos.permission.CONNECT_IME_ABILITY
* @param { InputMethodSubtype } target - Indicates the input method subtype which will replace the current one.
* @param { AsyncCallback<boolean> } callback - the callback of switchCurrentInputMethodSubtype.
* @throws { BusinessError } 201 - permissions check fails.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
* @throws { BusinessError } 12800005 - configuration persistence error.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
/**
* Switch current input method subtype, if this interface is invoked by the current IME, this permission is ignored.
*
* @permission ohos.permission.CONNECT_IME_ABILITY
* @param { InputMethodSubtype } target - Indicates the input method subtype which will replace the current one.
* @param { AsyncCallback<boolean> } callback - the callback of switchCurrentInputMethodSubtype.
* @throws { BusinessError } 201 - permissions check fails.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
* @throws { BusinessError } 12800005 - configuration persistence error.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
/**
* Switch current input method subtype. The caller must be the current inputmethod.
*
* @param { InputMethodSubtype } target - indicates the target input method subtype.
* @param { AsyncCallback<boolean> } callback - the callback of switchCurrentInputMethodSubtype.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
* @throws { BusinessError } 12800005 - configuration persistence error.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 11
*/
function switchCurrentInputMethodSubtype(target: InputMethodSubtype, callback: AsyncCallback<boolean>): void;
/**
* Switch current input method subtype
*
* @permission ohos.permission.CONNECT_IME_ABILITY
* @param { InputMethodSubtype } target - Indicates the input method subtype which will replace the current one.
* @returns { Promise<boolean> } the promise returned by the function.
* @throws { BusinessError } 201 - permissions check fails.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
* @throws { BusinessError } 12800005 - configuration persistence error.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
/**
* Switch current input method subtype, if this interface is invoked by the current IME, this permission is ignored.
*
* @permission ohos.permission.CONNECT_IME_ABILITY
* @param { InputMethodSubtype } target - Indicates the input method subtype which will replace the current one.
* @returns { Promise<boolean> } the promise returned by the function.
* @throws { BusinessError } 201 - permissions check fails.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
* @throws { BusinessError } 12800005 - configuration persistence error.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
/**
* Switch current input method subtype. The caller must be the current inputmethod.
*
* @param { InputMethodSubtype } target - indicates the target input method subtype.
* @returns { Promise<boolean> } the promise returned by the function.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
* @throws { BusinessError } 12800005 - configuration persistence error.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 11
*/
function switchCurrentInputMethodSubtype(target: InputMethodSubtype): Promise<boolean>;
/**
* Get the current input method subtype
*
* @returns { InputMethodSubtype } the subtype of the current input method.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
function getCurrentInputMethodSubtype(): InputMethodSubtype;
/**
* Switch input method and subtype. If the caller is an input method, it must be the current inputmethod.
*
* @permission ohos.permission.CONNECT_IME_ABILITY
* @param { InputMethodProperty } inputMethodProperty - Indicates the target input method.
* @param { InputMethodSubtype } inputMethodSubtype - Indicates the target input method subtype.
* @param { AsyncCallback<boolean> } callback - the callback of switchCurrentInputMethodAndSubtype.
* @throws { BusinessError } 201 - permissions check fails.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
* @throws { BusinessError } 12800005 - configuration persistence error.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
/**
* Switch input method and subtype. The caller must be the current inputmethod.
*
* @param { InputMethodProperty } inputMethodProperty - indicates the target input method.
* @param { InputMethodSubtype } inputMethodSubtype - indicates the target input method subtype.
* @param { AsyncCallback<boolean> } callback - the callback of switchCurrentInputMethodAndSubtype.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
* @throws { BusinessError } 12800005 - configuration persistence error.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 11
*/
function switchCurrentInputMethodAndSubtype(
inputMethodProperty: InputMethodProperty,
inputMethodSubtype: InputMethodSubtype,
callback: AsyncCallback<boolean>
): void;
/**
* Switch input method and subtype. If the caller is an input method, it must be the current inputmethod.
*
* @permission ohos.permission.CONNECT_IME_ABILITY
* @param { InputMethodProperty } inputMethodProperty - Indicates the target input method.
* @param { InputMethodSubtype } inputMethodSubtype - Indicates the target input method subtype.
* @returns { Promise<boolean> } the promise returned by the function.
* @throws { BusinessError } 201 - permissions check fails.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
* @throws { BusinessError } 12800005 - configuration persistence error.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
/**
* Switch input method and subtype. The caller must be the current inputmethod.
*
* @param { InputMethodProperty } inputMethodProperty - indicates the target input method.
* @param { InputMethodSubtype } inputMethodSubtype - indicates the target input method subtype.
* @returns { Promise<boolean> } the promise returned by the function.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
* @throws { BusinessError } 12800005 - configuration persistence error.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 11
*/
function switchCurrentInputMethodAndSubtype(
inputMethodProperty: InputMethodProperty,
inputMethodSubtype: InputMethodSubtype
): Promise<boolean>;
/**
* Switch input method and subtype
*
* @permission ohos.permission.CONNECT_IME_ABILITY
* @param { string } bundleName - indicates the bundleName of target input method.
* @param { string } [subtypeId] - indicates the id of the input method subtype.
* If the param is not set, switch to the target input method with a default subtype.
* @returns { Promise<void> } the promise returned by the function.
* @throws { BusinessError } 201 - permissions check fails.
* @throws { BusinessError } 202 - not system application.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
* @throws { BusinessError } 12800005 - configuration persistence error.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @systemapi
* @since 11
*/
function switchInputMethod(bundleName: string, subtypeId?: string): Promise<void>;
/**
* Set simple keyboard mode.
*
* @param { boolean } enable - indicates enable simple keyboard or not.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 20
*/
function setSimpleKeyboardEnabled(enable: boolean): void;
/**
* @interface InputMethodSetting
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
*/
interface InputMethodSetting {
/**
* Subscribe input method or subtype change.
*
* @param { 'imeChange' } type - Indicates the event type.
* @param { function } callback - the callback of 'imeChange'
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
on(
type: 'imeChange',
callback: (inputMethodProperty: InputMethodProperty, inputMethodSubtype: InputMethodSubtype) => void
): void;
/**
* Unsubscribe input method or subtype change.
*
* @param { 'imeChange' } type - Indicates the event type.
* @param { function } [callback] - the callback of 'imeChange',
* when subscriber unsubscribes all callback functions of event 'imeChange', this parameter can be left blank.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
off(
type: 'imeChange',
callback?: (inputMethodProperty: InputMethodProperty, inputMethodSubtype: InputMethodSubtype) => void
): void;
/**
* Subscribes to input window show events.
*
* @param { 'imeShow' } type - Indicates the event type.
* @param { function } callback - the callback of 'imeShow'.
* @throws { BusinessError } 202 - not system application.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @systemapi
* @since 10
*/
on(type: 'imeShow', callback: (info: Array<InputWindowInfo>) => void): void;
/**
* Unsubscribe input window show event.
*
* @param { 'imeShow' } type - Indicates the event type.
* @param { function } [callback] - the callback of 'imeShow',
* when subscriber unsubscribes all callback functions of event 'imeShow', this parameter can be left blank.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @systemapi
* @since 10
*/
off(type: 'imeShow', callback?: (info: Array<InputWindowInfo>) => void): void;
/**
* Subscribes to input window hidden events.
*
* @param { 'imeHide' } type - Indicates the event type.
* @param { function } callback - the callback of 'imeHide'.
* @throws { BusinessError } 202 - not system application.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @systemapi
* @since 10
*/
on(type: 'imeHide', callback: (info: Array<InputWindowInfo>) => void): void;
/**
* Unsubscribe input window hide event.
*
* @param { 'imeHide' } type - Indicates the event type.
* @param { function } [callback] - the callback of 'imeHide',
* when subscriber unsubscribes all callback functions of event 'imeHide', this parameter can be left blank.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @systemapi
* @since 10
*/
off(type: 'imeHide', callback?: (info: Array<InputWindowInfo>) => void): void;
/**
* Query whether a panel with specified information is shown.
*
* @param { PanelInfo } panelInfo - the information of panel which is queried.
* @returns { boolean }
* If true, the panel being queried is shown.
* If false, the panel being queried is hidden.
* @throws { BusinessError } 202 - not system application.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @systemapi
* @since 11
*/
isPanelShown(panelInfo: PanelInfo): boolean;
/**
* List subtype of the specified input method.
*
* @param { InputMethodProperty } inputMethodProperty - the property of the specified inputmethod.
* @param { AsyncCallback<Array<InputMethodSubtype>> } callback - the callback of listInputMethodSubtype.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
* @throws { BusinessError } 12800001 - bundle manager error.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
listInputMethodSubtype(
inputMethodProperty: InputMethodProperty,
callback: AsyncCallback<Array<InputMethodSubtype>>
): void;
/**
* List subtype of the specified input method.
*
* @param { InputMethodProperty } inputMethodProperty - Indicates the specified input method.
* @returns { Promise<Array<InputMethodSubtype>> } the promise returned by the function.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
* @throws { BusinessError } 12800001 - bundle manager error.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
listInputMethodSubtype(inputMethodProperty: InputMethodProperty): Promise<Array<InputMethodSubtype>>;
/**
* List subtype of current input method
*
* @param { AsyncCallback<Array<InputMethodSubtype>> } callback - the callback of listCurrentInputMethodSubtype.
* @throws { BusinessError } 12800001 - bundle manager error.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
listCurrentInputMethodSubtype(callback: AsyncCallback<Array<InputMethodSubtype>>): void;
/**
* List subtype of current input method
*
* @returns { Promise<Array<InputMethodSubtype>> } the promise returned by the function.
* @throws { BusinessError } 12800001 - bundle manager error.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
listCurrentInputMethodSubtype(): Promise<Array<InputMethodSubtype>>;
/**
* List input methods
*
* @param { boolean } enable -
* If true, collect enabled input methods.
* If false, collect disabled input methods.
* @param { AsyncCallback<Array<InputMethodProperty>> } callback - the callback of getInputMethods.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
* @throws { BusinessError } 12800001 - bundle manager error.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
getInputMethods(enable: boolean, callback: AsyncCallback<Array<InputMethodProperty>>): void;
/**
* List input methods
*
* @param { boolean } enable -
* If true, collect enabled input methods.
* If false, collect disabled input methods.
* @returns { Promise<Array<InputMethodProperty>> } the promise returned by the function.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
* @throws { BusinessError } 12800001 - bundle manager error.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
getInputMethods(enable: boolean): Promise<Array<InputMethodProperty>>;
/**
* List enabled or disabled input methods sync
*
* @param { boolean } enable -
* If true, collect enabled input methods.
* If false, collect disabled input methods.
* @returns { Array<InputMethodProperty> } the list of inputmethod.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
* @throws { BusinessError } 12800001 - bundle manager error.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 11
*/
getInputMethodsSync(enable: boolean): Array<InputMethodProperty>;
/**
* List all input methods
*
* @param { AsyncCallback<Array<InputMethodProperty>> } callback - the callback of getInputMethods.
* @throws { BusinessError } 12800001 - bundle manager error.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 11
*/
getAllInputMethods(callback: AsyncCallback<Array<InputMethodProperty>>): void;
/**
* List all input methods
*
* @returns { Promise<Array<InputMethodProperty>> } the promise returned by the function.
* @throws { BusinessError } 12800001 - bundle manager error.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 11
*/
getAllInputMethods(): Promise<Array<InputMethodProperty>>;
/**
* List all input methods sync
*
* @returns { Array<InputMethodProperty> } the list of all inputmethod.
* @throws { BusinessError } 12800001 - bundle manager error.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 11
*/
getAllInputMethodsSync(): Array<InputMethodProperty>;
/**
* @param { AsyncCallback<Array<InputMethodProperty>> } callback - the callback of listInputMethod.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
* @deprecated since 9
* @useinstead inputMethod.InputMethodSetting#getInputMethods
*/
listInputMethod(callback: AsyncCallback<Array<InputMethodProperty>>): void;
/**
* @returns { Promise<Array<InputMethodProperty>> } the promise returned by the function.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
* @deprecated since 9
* @useinstead inputMethod.InputMethodSetting#getInputMethods
*/
listInputMethod(): Promise<Array<InputMethodProperty>>;
/**
* Show input method setting extension dialog
*
* @param { AsyncCallback<boolean> } callback - the callback of showOptionalInputMethods.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
* @deprecated since 18
*/
showOptionalInputMethods(callback: AsyncCallback<boolean>): void;
/**
* Show input method setting extension dialog
*
* @returns { Promise<boolean> } the promise returned by the function.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
* @deprecated since 18
*/
showOptionalInputMethods(): Promise<boolean>;
/**
* @param { AsyncCallback<void> } callback - the callback of displayOptionalInputMethod.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
* @deprecated since 9
* @useinstead inputMethod.InputMethodSetting#showOptionalInputMethods
*/
displayOptionalInputMethod(callback: AsyncCallback<void>): void;
/**
* @returns { Promise<void> } the promise returned by the function.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
* @deprecated since 9
* @useinstead inputMethod.InputMethodSetting#showOptionalInputMethods
*/
displayOptionalInputMethod(): Promise<void>;
/**
* The input method application calls this interface to obtain its own enabled state.
*
* @returns { Promise<EnabledState> } the promise returned by the function.
* @throws { BusinessError } 12800004 - not an input method application.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 15
*/
getInputMethodState(): Promise<EnabledState>;
/**
*
* Change inputmethod enabled status.
*
* @permission ohos.permission.CONNECT_IME_ABILITY
* @param { string } bundleName - Indicates the bundleName of the inputmethod.
* @param { string } extensionName - Indicates the extensionName of the inputmethod.
* @param { EnabledState } enabledState - Indicates the enabledState to be changed.
* @returns { Promise<void> } the promise returned by the function.
* @throws { BusinessError } 201 - permissions check fails.
* @throws { BusinessError } 202 - not system application.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @throws { BusinessError } 12800018 - the input method is not found.
* @throws { BusinessError } 12800019 - current operation cannot be applied to the preconfigured default input method.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @systemapi
* @since 20
*/
enableInputMethod(bundleName: string, extensionName: string, enabledState: EnabledState): Promise<void>;
}
/**
* @interface InputMethodController
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 6
*/
interface InputMethodController {
/**
* Attach application to the input method service.
*
* @param { boolean } showKeyboard - show the keyboard or not when attach the input method.
* @param { TextConfig } textConfig - indicates the config of the textInput.
* @param { AsyncCallback<void> } callback - the callback of attach.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
attach(showKeyboard: boolean, textConfig: TextConfig, callback: AsyncCallback<void>): void;
/**
* Attach application to the input method service.
*
* @param { boolean } showKeyboard - show the keyboard or not when attach the input method.
* @param { TextConfig } textConfig - indicates the config of the textInput.
* @returns { Promise<void> } the promise returned by the function.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
attach(showKeyboard: boolean, textConfig: TextConfig): Promise<void>;
/**
* Attach application to the input method service.
*
* @param { boolean } showKeyboard - show the keyboard or not when attach the input method.
* @param { TextConfig } textConfig - indicates the config of the textInput.
* @param { RequestKeyboardReason } requestKeyboardReason - requestKeyboardReason of show the keyboard .
* @returns { Promise<void> } the promise returned by the function.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 15
*/
attach(showKeyboard: boolean, textConfig: TextConfig, requestKeyboardReason: RequestKeyboardReason): Promise<void>;
/**
* Discard the typing text
*
* @returns { Promise<void> } the promise returned by the function.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @throws { BusinessError } 12800009 - input method client detached.
* @throws { BusinessError } 12800015 - the other side does not accept the request.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 20
*/
discardTypingText(): Promise<void>;
/**
* Show the text input and start typing.
*
* @param { AsyncCallback<void> } callback - the callback of showTextInput.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @throws { BusinessError } 12800009 - input method client detached.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
showTextInput(callback: AsyncCallback<void>): void;
/**
* Show the text input and start typing.
*
* @returns { Promise<void> } the promise returned by the function.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @throws { BusinessError } 12800009 - input method client detached.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
showTextInput(): Promise<void>;
/**
* Show the text input and start typing.
*
* @param { RequestKeyboardReason } requestKeyboardReason - requestKeyboardReason of show the keyboard .
* @returns { Promise<void> } the promise returned by the function.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @throws { BusinessError } 12800009 - input method client detached.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 15
*/
showTextInput(requestKeyboardReason: RequestKeyboardReason): Promise<void>;
/**
* Hide the text input and stop typing.
*
* @param { AsyncCallback<void> } callback - the callback of hideTextInput.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @throws { BusinessError } 12800009 - input method client detached.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
hideTextInput(callback: AsyncCallback<void>): void;
/**
* Hide the text input and stop typing.
*
* @returns { Promise<void> } the promise returned by the function.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @throws { BusinessError } 12800009 - input method client detached.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
hideTextInput(): Promise<void>;
/**
* Detach the applications from the input method manager service.
*
* @param { AsyncCallback<void> } callback - the callback of detach.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
detach(callback: AsyncCallback<void>): void;
/**
* Detach the applications from the input method manager service.
*
* @returns { Promise<void> } the promise returned by the function.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
detach(): Promise<void>;
/**
* Inform the system of the window ID of the application currently bound to the input method.
* After the correct setting, the window where the client is located can avoid the input method window.
*
* @param { number } windowId - the window ID of the application currently bound to the input method.
* @param { AsyncCallback<void> } callback - the callback of setCallingWindow.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @throws { BusinessError } 12800009 - input method client detached.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
setCallingWindow(windowId: number, callback: AsyncCallback<void>): void;
/**
* Inform the system of the window ID of the application currently bound to the input method.
* After the correct setting, the window where the client is located can avoid the input method window.
*
* @param { number } windowId - the window ID of the application currently bound to the input method.
* @returns { Promise<void> } the promise returned by the function.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @throws { BusinessError } 12800009 - input method client detached.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
setCallingWindow(windowId: number): Promise<void>;
/**
* Update Cursor and notify the input method that the current application cursor has changed.
*
* @param { CursorInfo } cursorInfo - the CursorInfo object.
* @param { AsyncCallback<void> } callback - the callback of updateCursor.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @throws { BusinessError } 12800009 - input method client detached.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
updateCursor(cursorInfo: CursorInfo, callback: AsyncCallback<void>): void;
/**
* Update Cursor and notify the input method that the current application cursor has changed.
*
* @param { CursorInfo } cursorInfo - the CursorInfo object.
* @returns { Promise<void> } the promise returned by the function.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @throws { BusinessError } 12800009 - input method client detached.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
updateCursor(cursorInfo: CursorInfo): Promise<void>;
/**
* Notify the input method the selected text and the selection range of the current application text has changed.
*
* @param { string } text - the whole input text.
* @param { number } start - start position of selected text.
* @param { number } end - end position of selected text.
* @param { AsyncCallback<void> } callback - the callback of changeSelection.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @throws { BusinessError } 12800009 - input method client detached.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
changeSelection(text: string, start: number, end: number, callback: AsyncCallback<void>): void;
/**
* Notify the input method the selected text and the selection range of the current application text has changed.
*
* @param { string } text - the selected text.
* @param { number } start - start position of selected text.
* @param { number } end - end position of selected text.
* @returns { Promise<void> } the promise returned by the function.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @throws { BusinessError } 12800009 - input method client detached.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
changeSelection(text: string, start: number, end: number): Promise<void>;
/**
* Update InputAttribute information of input text.
*
* @param { InputAttribute } attribute - the InputAttribute object.
* @param { AsyncCallback<void> } callback - the callback of updateAttribute.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @throws { BusinessError } 12800009 - input method client detached.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
updateAttribute(attribute: InputAttribute, callback: AsyncCallback<void>): void;
/**
* Update InputAttribute information of input text.
*
* @param { InputAttribute } attribute - the InputAttribute object.
* @returns { Promise<void> } the promise returned by the function.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @throws { BusinessError } 12800009 - input method client detached.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
updateAttribute(attribute: InputAttribute): Promise<void>;
/**
* Stop input session
*
* @param { AsyncCallback<boolean> } callback - the callback of stopInputSession.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
stopInputSession(callback: AsyncCallback<boolean>): void;
/**
* Stop input session
*
* @returns { Promise<boolean> } the promise returned by the function.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
stopInputSession(): Promise<boolean>;
/**
* Stop input
*
* @param { AsyncCallback<boolean> } callback - the callback of stopInput.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 6
* @deprecated since 9
* @useinstead inputMethod.InputMethodController#stopInputSession
*/
stopInput(callback: AsyncCallback<boolean>): void;
/**
* Stop input
*
* @returns { Promise<boolean> } the promise returned by the function.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 6
* @deprecated since 9
* @useinstead inputMethod.InputMethodController#stopInputSession
*/
stopInput(): Promise<boolean>;
/**
* Show soft keyboard.
* This API can be called only by system applications.
*
* @permission ohos.permission.CONNECT_IME_ABILITY
* @param { AsyncCallback<void> } callback - the callback of showSoftKeyboard.
* @throws { BusinessError } 201 - permissions check fails.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
showSoftKeyboard(callback: AsyncCallback<void>): void;
/**
* Show soft keyboard.
* This API can be called only by system applications.
*
* @permission ohos.permission.CONNECT_IME_ABILITY
* @returns { Promise<void> } the promise returned by the function.
* @throws { BusinessError } 201 - permissions check fails.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
showSoftKeyboard(): Promise<void>;
/**
* Hide soft keyboard.
* This API can be called only by system applications.
*
* @permission ohos.permission.CONNECT_IME_ABILITY
* @param { AsyncCallback<void> } callback - the callback of hideSoftKeyboard.
* @throws { BusinessError } 201 - permissions check fails.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
hideSoftKeyboard(callback: AsyncCallback<void>): void;
/**
* Hide soft keyboard.
* This API can be called only by system applications.
*
* @permission ohos.permission.CONNECT_IME_ABILITY
* @returns { Promise<void> } the promise returned by the function.
* @throws { BusinessError } 201 - permissions check fails.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @throws { BusinessError } 12800008 - input method manager service error. Possible cause:
* a system error, such as null pointer, IPC exception.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
hideSoftKeyboard(): Promise<void>;
/**
* Send message to input method.
*
* @param { string } msgId - the identifier of the message. Max size is 256B.
* @param { ?ArrayBuffer } [msgParam] - the param of the custom message. Max size is 128KB.
* @returns { Promise<void> } the promise returned by the function.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1. Incorrect parameter types. 2. Incorrect parameter length.
* @throws { BusinessError } 12800003 - input method client error. Possible causes:
* 1.the edit box is not focused. 2.no edit box is bound to current input method application.
* @throws { BusinessError } 12800009 - input method client detached.
* @throws { BusinessError } 12800014 - the input method is in basic mode.
* @throws { BusinessError } 12800015 - the other side does not accept the request.
* @throws { BusinessError } 12800016 - input method client is not editable.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 15
*/
sendMessage(msgId: string, msgParam?: ArrayBuffer): Promise<void>;
/**
* Start receiving message from input method.
*
* @param { ?MessageHandler } [msgHandler] - optional, the handler of the custom message.
* @throws { BusinessError } 401 - parameter error. Possible causes: 1. Incorrect parameter types.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 15
*/
recvMessage(msgHandler?: MessageHandler): void;
/**
* Register a callback and when IME sends select event with range of selection,
* the callback will be invoked.
*
* @param { 'selectByRange' } type - event type, fixed as 'selectByRange'.
* @param { Callback<Range> } callback - processes selectByRange command. The range of selection is provided for
* this callback, and subscribers are expected to select corresponding text in callback according to
* the range.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
on(type: 'selectByRange', callback: Callback<Range>): void;
/**
* Unregister the callback of selectedByRange.
*
* @param { 'selectByRange' } type - event type, fixed as 'selectByRange'.
* @param { Callback<Range> } [callback] - the callback of 'selectByRange',
* when subscriber unsubscribes all callback functions of event 'selectByRange', this parameter can be left blank.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
off(type: 'selectByRange', callback?: Callback<Range>): void;
/**
* Register a callback and when IME sends select event witch movement of cursor,
* the callback will be invoked.
*
* @param { 'selectByMovement' } type - event type, fixed as 'selectByMovement'.
* @param { Callback<Movement> } callback - processes selectByMovement command. The movement of cursor is provided
* for this callback, and subscribers are expected to select corresponding text in callback according to
* the movement.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
on(type: 'selectByMovement', callback: Callback<Movement>): void;
/**
* Unregister the callback of selectedByMovement.
*
* @param { 'selectByMovement' } type - event type, fixed as 'selectByMovement'.
* @param { Callback<Movement> } [callback] - the callback of 'selectByMovement',
* when subscriber unsubscribes all callback functions of event 'selectByMovement', this parameter can be left blank.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
off(type: 'selectByMovement', callback?: Callback<Movement>): void;
/**
* Register a callback and when IME sends insert text event, the callback will be invoked.
*
* @param { 'insertText' } type - event type, fixed as 'insertText'.
* @param { function } callback - processes insertText command. The text of insert is provided for this callback.
* Subscribers are expected to process the inserted text and update changes in editor by changeSelection and updateCursor as needed.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
* @throws { BusinessError } 12800009 - input method client detached.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
on(type: 'insertText', callback: (text: string) => void): void;
/**
* Unregister the callback of insertText.
*
* @param { 'insertText' } type - event type, fixed as 'insertText'.
* @param { function } [callback] - the callback of 'insertText',
* when subscriber unsubscribes all callback functions of event 'insertText', this parameter can be left blank.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
off(type: 'insertText', callback?: (text: string) => void): void;
/**
* Register a callback and when IME sends delete left event with length,
* the callback will be invoked.
*
* @param { 'deleteLeft' } type - event type, fixed as 'deleteLeft'.
* @param { function } callback - processes deleteLeft command. The length of
* delete is provided for this callback. Subscribers are expected to delete specified length of text
* to the left of the cursor and update changes in editor by changeSelection and updateCursor as needed.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
* @throws { BusinessError } 12800009 - input method client detached.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
on(type: 'deleteLeft', callback: (length: number) => void): void;
/**
* Unregister the callback of deleteLeft.
*
* @param { 'deleteLeft' } type - event type, fixed as 'deleteLeft'.
* @param { function } [callback] - the callback of 'deleteLeft',
* when subscriber unsubscribes all callback functions of event 'deleteLeft', this parameter can be left blank.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
off(type: 'deleteLeft', callback?: (length: number) => void): void;
/**
* Register a callback and when IME sends delete right event with length,
* the callback will be invoked.
*
* @param { 'deleteRight' } type - event type, fixed as 'deleteRight'.
* @param { function } callback - processes deleteRight command. The length of
* delete is provided for this callback. Subscribers are expected to delete specified length of text
* to the right of the cursor and update changes in editor by changeSelection and updateCursor as needed.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
* @throws { BusinessError } 12800009 - input method client detached.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
on(type: 'deleteRight', callback: (length: number) => void): void;
/**
* Unregister the callback of deleteRight.
*
* @param { 'deleteRight' } type - event type, fixed as 'deleteRight'.
* @param { function } [callback] - the callback of 'deleteRight',
* when subscriber unsubscribes all callback functions of event 'deleteRight', this parameter can be left blank.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
off(type: 'deleteRight', callback?: (length: number) => void): void;
/**
* Register a callback and when IME sends keyboard status, the callback will be invoked.
*
* @param { 'sendKeyboardStatus' } type - event type, fixed as 'sendKeyboardStatus'.
* @param { function } callback - processes sendKeyboardStatus command.
* The keyboardStatus is provided for this callback.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
* @throws { BusinessError } 12800009 - input method client detached.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
on(type: 'sendKeyboardStatus', callback: (keyboardStatus: KeyboardStatus) => void): void;
/**
* Unregister the callback of sendKeyboardStatus.
*
* @param { 'sendKeyboardStatus' } type - event type, fixed as 'sendKeyboardStatus'.
* @param { function } [callback] - the callback of 'sendKeyboardStatus',
* when subscriber unsubscribes all callback functions of event 'sendKeyboardStatus', this parameter can be left blank.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
off(type: 'sendKeyboardStatus', callback?: (keyboardStatus: KeyboardStatus) => void): void;
/**
* Register a callback and when IME sends functionKey, the callback will be invoked.
*
* @param { 'sendFunctionKey' } type - event type, fixed as 'sendFunctionKey'.
* @param { function } callback - processes sendFunctionKey command.
* The functionKey is provided for this callback.Subscribers are expected to complete the
* corresponding task based on the value of functionKey.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
* @throws { BusinessError } 12800009 - input method client detached.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
on(type: 'sendFunctionKey', callback: (functionKey: FunctionKey) => void): void;
/**
* Unregister the callback of sendFunctionKey.
*
* @param { 'sendFunctionKey' } type - event type, fixed as 'sendFunctionKey'.
* @param { function } [callback] - the callback of 'sendFunctionKey',
* when subscriber unsubscribes all callback functions of event 'sendFunctionKey', this parameter can be left blank.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
off(type: 'sendFunctionKey', callback?: (functionKey: FunctionKey) => void): void;
/**
* Register a callback and when IME sends move cursor, the callback will be invoked.
*
* @param { 'moveCursor' } type - event type, fixed as 'moveCursor'.
* @param { function } callback - processes moveCursor command. The direction of
* cursor is provided for this callback. Subscribers are expected to move the cursor and update changes
* in editor by changeSelection and updateCursor.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
* @throws { BusinessError } 12800009 - input method client detached.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
on(type: 'moveCursor', callback: (direction: Direction) => void): void;
/**
* Unregister the callback of moveCursor.
*
* @param { 'moveCursor' } type - event type, fixed as 'moveCursor'.
* @param { function } [callback] - the callback of 'moveCursor',
* when subscriber unsubscribes all callback functions of event 'moveCursor', this parameter can be left blank.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
off(type: 'moveCursor', callback?: (direction: Direction) => void): void;
/**
* Register a callback and when IME sends extend action code, the callback will be invoked.
*
* @param { 'handleExtendAction' } type - event type, fixed as 'handleExtendAction'.
* @param { function } callback - processes handleExtendAction command. The action code
* is provided for this callback.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
* @throws { BusinessError } 12800009 - input method client detached.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
on(type: 'handleExtendAction', callback: (action: ExtendAction) => void): void;
/**
* Unregister the callback of handleExtendAction.
*
* @param { 'handleExtendAction' } type - event type, fixed as 'handleExtendAction'.
* @param { function } [callback] - the callback of 'handleExtendAction',
* when subscriber unsubscribes all callback functions of event 'handleExtendAction', this parameter can be left blank.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
off(type: 'handleExtendAction', callback?: (action: ExtendAction) => void): void;
/**
* Register a callback and when input method ability gets left text of cursor, the callback will be invoked.
*
* @param { 'getLeftTextOfCursor' } type - event type, fixed as 'getLeftTextOfCursor'.
* @param { function } callback - processes getLeftTextOfCursor command. The callback
* must be a synchronization method and will block the input method application.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
* @throws { BusinessError } 12800009 - input method client detached.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
on(type: 'getLeftTextOfCursor', callback: (length: number) => string): void;
/**
* Unregister the callback of getLeftTextOfCursor event.
*
* @param { 'getLeftTextOfCursor' } type - event type, fixed as 'getLeftTextOfCursor'.
* @param { function } [callback] - the callback of 'getLeftTextOfCursor',
* when subscriber unsubscribes all callback functions of event 'getLeftTextOfCursor', this parameter can be left blank.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
off(type: 'getLeftTextOfCursor', callback?: (length: number) => string): void;
/**
* Register a callback and when input method ability gets right text of cursor, the callback will be invoked.
*
* @param { 'getRightTextOfCursor' } type - event type, fixed as 'getRightTextOfCursor'.
* @param { function } callback - processes getRightTextOfCursor command. The callback
* must be a synchronization method and will block the input method application.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
* @throws { BusinessError } 12800009 - input method client detached.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
on(type: 'getRightTextOfCursor', callback: (length: number) => string): void;
/**
* Unregister the callback of getRightTextOfCursor event.
*
* @param { 'getRightTextOfCursor' } type - event type, fixed as 'getRightTextOfCursor'.
* @param { function } [callback] - the callback of 'getRightTextOfCursor',
* when subscriber unsubscribes all callback functions of event 'getRightTextOfCursor', this parameter can be left blank.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
off(type: 'getRightTextOfCursor', callback?: (length: number) => string): void;
/**
* Register a callback and when input method ability gets the text index at cursor, the callback will be invoked.
*
* @param { 'getTextIndexAtCursor' } type - event type, fixed as 'getTextIndexAtCursor'.
* @param { function } callback - processes getTextIndexAtCursor command. The callback
* must be a synchronization method, and should return the text index at the cursor.
* @throws { BusinessError } 401 - parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
* @throws { BusinessError } 12800009 - input method client detached.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
on(type: 'getTextIndexAtCursor', callback: () => number): void;
/**
* Unregister the callback of getTextIndexAtCursor.
*
* @param { 'getTextIndexAtCursor' } type - event type, fixed as 'getTextIndexAtCursor'.
* @param { function } [callback] - the callback of 'getTextIndexAtCursor',
* when subscriber unsubscribes all callback functions of event 'getTextIndexAtCursor', this parameter can be left blank.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
off(type: 'getTextIndexAtCursor', callback?: () => number): void;
/**
* <p>Subscribe 'setPreviewText' event.</p>
* <p>To support the preview text feature, developers should subscribe to this event before calling attach.</p>
*
* @param { 'setPreviewText' } type - the type of subscribe event.
* @param { SetPreviewTextCallback } callback - the callback of on('setPreviewText').
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 17
*/
on(type: 'setPreviewText', callback: SetPreviewTextCallback): void;
/**
* Unsubscribe 'setPreviewText' event.
*
* @param { 'setPreviewText' } type - the type of unsubscribe event.
* @param { SetPreviewTextCallback } [callback] - optional, the callback of off('setPreviewText').
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 17
*/
off(type: 'setPreviewText', callback?: SetPreviewTextCallback): void;
/**
* <p>Subscribe 'finishTextPreview' event.</p>
* <p>To support the preview text feature, developers should subscribe to this event before calling attach.</p>
*
* @param { 'finishTextPreview' } type - the type of subscribe event.
* @param { Callback<void> } callback - the callback of on('finishTextPreview').
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 17
*/
on(type: 'finishTextPreview', callback: Callback<void>): void;
/**
* Unsubscribe 'finishTextPreview' event.
*
* @param { 'finishTextPreview' } type - the type of unsubscribe event.
* @param { Callback<void> } [callback] - optional, the callback of off('finishTextPreview').
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 17
*/
off(type: 'finishTextPreview', callback?: Callback<void>): void;
}
/**
* input method property
*
* @interface InputMethodProperty
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
*/
interface InputMethodProperty {
/**
* The name of input method
*
* @type { string }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
* @deprecated since 9
* @useinstead inputMethod.InputMethodProperty#name
*/
readonly packageName: string;
/**
* The id of input method
*
* @type { string }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 8
* @deprecated since 9
* @useinstead inputMethod.InputMethodProperty#id
*/
readonly methodId: string;
/**
* The name of input method
*
* @type { string }
* @readonly
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
readonly name: string;
/**
* The id of input method
*
* @type { string }
* @readonly
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
readonly id: string;
/**
* The label of input method
*
* @type { ?string }
* @readonly
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
readonly label?: string;
/**
* The label id of input method
*
* @type { ?number }
* @readonly
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
readonly labelId?: number;
/**
* The icon of input method
*
* @type { ?string }
* @readonly
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
readonly icon?: string;
/**
* The icon id of input method
*
* @type { ?number }
* @readonly
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
readonly iconId?: number;
/**
* The enabledState of input method
*
* @type { ?EnabledState }
* @readonly
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 20
*/
readonly enabledState?: EnabledState;
/**
* The extra info of input method
*
* @type { object }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 9
*/
/**
* The extra info of input method
*
* @type { ?object }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
extra?: object;
}
/**
* Enumerates the moving direction of cursor
*
* @enum { number }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
export enum Direction {
/**
* Cursor moves up
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
CURSOR_UP = 1,
/**
* Cursor moves down
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
CURSOR_DOWN,
/**
* Cursor moves left
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
CURSOR_LEFT,
/**
* Cursor moves right
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
CURSOR_RIGHT
}
/**
* Range of selected text.
*
* @typedef Range
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
export interface Range {
/**
* Indicates the index of the first character of the selected text.
*
* @type { number }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
start: number;
/**
* Indicates the index of the last character of the selected text.
*
* @type { number }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
end: number;
}
/**
* Movement of cursor.
*
* @typedef Movement
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
export interface Movement {
/**
* Indicates the direction of cursor movement
*
* @type { Direction }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
direction: Direction;
}
/**
* Enumerates the text input type.
*
* @enum { number }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
export enum TextInputType {
/**
* The text input type is NONE.
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
NONE = -1,
/**
* The text input type is TEXT.
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
TEXT = 0,
/**
* The text input type is MULTILINE.
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
MULTILINE,
/**
* The text input type is NUMBER.
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
NUMBER,
/**
* The text input type is PHONE.
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
PHONE,
/**
* The text input type is DATETIME.
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
DATETIME,
/**
* The text input type is EMAIL_ADDRESS.
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
EMAIL_ADDRESS,
/**
* The text input type is URL.
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
URL,
/**
* The text input type is VISIBLE_PASSWORD.
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
VISIBLE_PASSWORD,
/**
* The text input type is NUMBER_PASSWORD.
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 11
*/
NUMBER_PASSWORD,
/**
* The text input type is SCREEN_LOCK_PASSWORD.
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 20
*/
SCREEN_LOCK_PASSWORD,
/**
* The text input type is USER_NAME.
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 20
*/
USER_NAME,
/**
* The text input type is NEW_PASSWORD.
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 20
*/
NEW_PASSWORD,
/**
* The text input type is NUMBER_DECIMAL.
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 20
*/
NUMBER_DECIMAL,
/**
* The text input type is ONE_TIME_CODE.
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 20
*/
ONE_TIME_CODE
}
/**
* Enumerates the enter key type.
*
* @enum { number }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
export enum EnterKeyType {
/**
* The enter key type is UNSPECIFIED.
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
UNSPECIFIED = 0,
/**
* The enter key type is NONE.
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
NONE,
/**
* The enter key type is GO.
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
GO,
/**
* The enter key type is SEARCH.
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
SEARCH,
/**
* The enter key type is SEND.
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
SEND,
/**
* The enter key type is NEXT.
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
NEXT,
/**
* The enter key type is DONE.
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
DONE,
/**
* The enter key type is PREVIOUS.
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
PREVIOUS,
/**
* The enter key type is NEWLINE.
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 12
*/
NEWLINE
}
/**
* Enumerates the keyboard status.
*
* @enum { number }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
export enum KeyboardStatus {
/**
* The keyboard status is none.
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
NONE = 0,
/**
* The keyboard status is hide.
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
HIDE = 1,
/**
* The keyboard status is show.
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
SHOW = 2
}
/**
* Attribute of Input.
*
* @typedef InputAttribute
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
export interface InputAttribute {
/**
* Indicates the text input type of the input method.
*
* @type { TextInputType }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
textInputType: TextInputType;
/**
* Indicates the enter key type of the input method.
*
* @type { EnterKeyType }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
enterKeyType: EnterKeyType;
/**
* Placeholder text in the edit box.
*
* @type { ?string }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 20
*/
placeholder?: string;
/**
* The name of the ability where the edit box is located.
*
* @type { ?string }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 20
*/
abilityName?: string;
}
/**
* FunctionKey of Input.
*
* @typedef FunctionKey
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
export interface FunctionKey {
/**
* Indicates the enter key type of the input method.
*
* @type { EnterKeyType }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
enterKeyType: EnterKeyType;
}
/**
* Information of Cursor.
*
* @typedef CursorInfo
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
export interface CursorInfo {
/**
* Indicates the left point of the cursor info and must be absolute coordinate of the physical screen.
*
* @type { number }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
left: number;
/**
* Indicates the top point of the cursor info and must be absolute coordinate of the physical screen.
*
* @type { number }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
top: number;
/**
* Indicates the width point of the cursor info.
*
* @type { number }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
width: number;
/**
* Indicates the height point of the cursor info.
*
* @type { number }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
height: number;
}
/**
* Config of editor.
*
* @typedef TextConfig
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
export interface TextConfig {
/**
* Attribute of Input.
*
* @type { InputAttribute }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
inputAttribute: InputAttribute;
/**
* Cursor information.
*
* @type { ?CursorInfo }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
cursorInfo?: CursorInfo;
/**
* Selection information.
*
* @type { ?Range }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
selection?: Range;
/**
* The window ID of the application currently bound to the input method.
*
* @type { ?number }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
windowId?: number;
/**
*Indicates that this is a new edit box.
*
* @type { ?boolean }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 20
*/
newEditBox?: boolean;
/**
* Indicates the capitalize mode of the edit box.
*
* @type { ?CapitalizeMode }
* @default CapitalizeMode.NONE
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 20
*/
capitalizeMode?: CapitalizeMode;
}
/**
* Enumerates the extend action.
*
* @enum { number }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
export enum ExtendAction {
/**
* Select all text.
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
SELECT_ALL = 0,
/**
* Cut selecting text.
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
CUT = 3,
/**
* Copy selecting text.
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
COPY = 4,
/**
* Paste from paste board.
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
PASTE = 5
}
/**
* Information of input window.
*
* @typedef InputWindowInfo
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
export interface InputWindowInfo {
/**
* Indicates name of the input window.
*
* @type { string }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
name: string;
/**
* Indicates the abscissa of the upper-left vertex of input window.
*
* @type { number }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
left: number;
/**
* Indicates the ordinate of the upper-left vertex of input window.
*
* @type { number }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
top: number;
/**
* Indicates the width of the input window.
*
* @type { number }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
width: number;
/**
* Indicates the height of the input window.
*
* @type { number }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 10
*/
height: number;
}
/**
* <p>Custom message handler.</p>
* <p>Implement this interface to respond to custem messages.</p>
*
* @interface MessageHandler
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 15
*/
interface MessageHandler {
/**
* This method is called when a custom message is received.
*
* @param { string } msgId - the identifier of the message.
* @param { ?ArrayBuffer } [msgParam] - the parameter of the custom message.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 15
*/
onMessage(msgId: string, msgParam?: ArrayBuffer): void;
/**
* This method is called when a new message handler is set.
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 15
*/
onTerminated(): void;
}
/**
* Enumerates the enabled state.
*
* @enum { number }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 15
*/
export enum EnabledState {
/**
* Disabled state.
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 15
*/
DISABLED = 0,
/**
* Enabled state with basic mode.
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 15
*/
BASIC_MODE,
/**
* Enabled state with full experience mode.
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 15
*/
FULL_EXPERIENCE_MODE
}
/**
* requestKeyboardReason of input click
*
* @enum { number }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 15
*/
export enum RequestKeyboardReason {
/**
* The request keyboard reason is NONE.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 15
*/
NONE = 0,
/**
* The request keyboard reason is MOUSE.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 15
*/
MOUSE = 1,
/**
* The request keyboard reason is TOUCH.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 15
*/
TOUCH = 2,
/**
* The request keyboard reason is OTHER.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 15
*/
OTHER = 20
}
/**
* The callback of 'setPreviewText' event.
*
* @typedef { function } SetPreviewTextCallback.
* @param { text } string - text to be previewed.
* @param { range } Range - the range of the text to be replaced by the preview text.
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 17
*/
export type SetPreviewTextCallback = (text: string, range: Range) => void;
/**
* Enumerates the capitalization mode.
*
* @enum { number }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 20
*/
export enum CapitalizeMode {
/**
* Capitalize nothing.
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 20
*/
NONE = 0,
/**
* Capitalize the first letter of each sentence.
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 20
*/
SENTENCES,
/**
* Capitalize the first letter of each word.
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 20
*/
WORDS,
/**
* Capitalize each letter.
*
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 20
*/
CHARACTERS
}
}
export default inputMethod;
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

搜索帮助