Signed-off-by: houhaoyu <houhaoyu@huawei.com>
Change-Id: I824dc0ecfb5acd814f995f6105dc88f7da0ef014
This commit is contained in:
houhaoyu 2022-01-29 15:07:03 +08:00
parent 7cbfdbcc9c
commit 2760349963
7 changed files with 588 additions and 23 deletions

View File

@ -87,6 +87,7 @@ ohos_copy("ets_component") {
"api/@internal/component/ets/search.d.ts",
"api/@internal/component/ets/shape.d.ts",
"api/@internal/component/ets/sheet.d.ts",
"api/@internal/component/ets/sidebar.d.ts",
"api/@internal/component/ets/slider.d.ts",
"api/@internal/component/ets/span.d.ts",
"api/@internal/component/ets/stack.d.ts",

View File

@ -174,7 +174,7 @@ declare class CanvasPath {
rotation: number,
startAngle: number,
endAngle: number,
counterclockwise?: number,
counterclockwise?: boolean,
): void;
/**

View File

@ -97,3 +97,4 @@
/// <reference path="./web.d.ts" />
/// <reference path="./xcomponent.d.ts" />
/// <reference path="./inspector.d.ts" />
/// <reference path="./sidebar.d.ts" />

117
api/@internal/component/ets/sidebar.d.ts vendored Normal file
View File

@ -0,0 +1,117 @@
/*
* 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.
*/
/**
* Sets the sidebar style of showing
* @since 8
*/
declare enum SideBarContainerStyle {
/**
* The sidebar invisible
* @since 8
*/
Embed,
/**
* The sidebar visible
* @since 8
*/
Overlay
}
/**
* Sets the control button style
* @since 8
*/
declare interface ButtonStyle {
/**
* Set the left of control button
* @since 8
*/
left?: number;
/**
* Set the top of control button
* @since 8
*/
top?: number;
/**
* Set the width of control button
* @since 8
*/
width?: number;
/**
* Set the heigth of control button
* @since 8
*/
height?: number;
/**
* Set the button icon when sidebar status has changed
* @since 8
*/
icons?: {shown:string, hidden: string, switching?: string}
}
/**
* The construct function of sidebar
* @since 8
*/
interface SideBarContainerInterface {
/**
* Called when showing the sidebar of a block entry.
* @since 8
*/
(options?: { showSideBarContainer?: boolean,
style?: SideBarContainerStyle,
buttonAtt?: ButtonStyle}): SideBarContainerAttribute;
}
/**
* The attribute function of sidebar
* @since 8
*/
declare class SideBarContainerAttribute extends CommonMethod<SideBarContainerAttribute> {
/**
* Callback showControlButton function when setting the status of button
* @since 8
*/
showControlButton(value: boolean): SideBarContainerAttribute;
/**
* Callback onChange function when sidebar style of showing has changed
* @since 8
*/
onChange(callback: (value: boolean) => void): SideBarContainerAttribute;
/**
* Sets the length of sidebar.
* @since 8
*/
sideBarWidth(value: number): SideBarContainerAttribute;
/**
* Sets the min length of sidebar.
* default value is 200vp.
* @since 8
*/
minSideBarWidth(value: number): SideBarContainerAttribute;
/**
* Sets the max length of sidebar.
* default value is 280vp.
* @since 8
*/
maxSideBarWidth(value: number): SideBarContainerAttribute;
}
declare const SideBarContainer: SideBarContainerInterface;
declare const SideBarContainerInstance: SideBarContainerAttribute;

View File

@ -43,6 +43,101 @@ declare enum SeekMode {
Closest,
}
/**
* playback speed.
* @since 8
*/
declare enum PlaybackSpeed {
/**
* 0.75x speed playback.
* @since 8
*/
Speed_Forward_0_75_X,
/**
* 1.00x speed playback.
* @since 8
*/
Speed_Forward_1_00_X,
/**
* 1.25x speed playback.
* @since 8
*/
Speed_Forward_1_25_X,
/**
* 1.75x speed playback.
* @since 8
*/
Speed_Forward_1_75_X,
/**
* 2.00x speed playback.
* @since 8
*/
Speed_Forward_2_00_X,
}
/**
* @since 7
* @deprecated since 8
*/
interface VideoOptionPre {
/**
* src of video.
* @since 7
*/
src?: string | Resource;
/**
* playback rate of video.
* @since 7
*/
currentProgressRate?: number | string;
/**
* preview uri of video.
* @since 7
*/
previewUri?: string;
/**
* controller of video.
* @since 7
*/
controller?: VideoController;
}
/**
* @since 8
*/
interface VideoOption {
/**
* src of video.
* @since 8
*/
src?: string | Resource;
/**
* playback rate of video.
* @since 8
*/
currentProgressRate?: PlaybackSpeed;
/**
* preview uri of video.
* @since 8
*/
previewUri?: string | PixelMap | Resource;
/**
* controller of video.
* @since 8
*/
controller?: VideoController;
}
/**
* @since 7
*/
@ -65,6 +160,12 @@ declare class VideoController {
*/
pause();
/**
* Provides an event to stop playback.
* @since 6
*/
stop();
/**
* Provide the progress method of video playback.
* @since 7
@ -86,11 +187,7 @@ interface VideoInterface {
* Set the value.
* @since 7
*/
(value: {
src?: string | Resource;
previewUri?: string | PixelMap | Resource;
controller?: VideoController;
}): VideoAttribute;
(value: VideoOptionPre | VideoOption): VideoAttribute;
}
/**

View File

@ -9,19 +9,19 @@ declare class WebController {
* Means to load a piece of code and execute JS code in the context of the currently displayed page
* @since 8
*/
evaluateJavaScript(jscode: string);
runJavaScript(jscode: string);
/**
* Indicates that a piece of code is loaded
* @since 8
*/
loadDataWithBaseURL(value : {baseUrl: string, data: string, mimeType:string, encoding:string, historyUrl: string});
loadData(value: { baseUrl: string, data: string, mimeType: string, encoding: string, historyUrl: string });
/**
* Load the given URL
* @since 8
*/
loadUrl(url : string);
loadUrl(url: string);
}
declare interface WebOptions {
@ -58,25 +58,25 @@ declare class WebAttribute extends CommonMethod<WebAttribute> {
* Set whether WebView allows JavaScript scripts to execute
* @since 8
*/
onPageFinish(callback: (event?:{ url: string }) => void): WebAttribute;
/**
* Get WebView focus callback event
* @since 8
*/
onRequestFocus(event: () => void): WebAttribute;
/**
* Set whether WebView allows JavaScript scripts to execute
* @since 8
*/
javaScriptEnabled(value: boolean): WebAttribute;
javaScriptAccess(javaScriptAccess: boolean): WebAttribute;
/**
* Enable or disable local file system access in WebView
* @since 8
*/
fileAccessEnabled(value: boolean): WebAttribute;
fileAccess(fileAccess: boolean): WebAttribute;
/**
* Triggered at the end of web page loading
* @since 8
*/
onPageEnd(callback: (event?: { url: string }) => void): WebAttribute;
/**
* Get WebView focus callback event
* @since 8
*/
onRequestSelected(event: () => void): WebAttribute;
}
declare const Web: WebInterface;

349
api/@ohos.userIAM.d.ts vendored Normal file
View File

@ -0,0 +1,349 @@
/*
* Copyright (c) 2022 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.
*/
import{AsyncCallback} from './basic';
/**
* User Identity and Access Management.
* @since 8
* @sysCap SystemCapability.UserIAM.UserAuth.BiometricAuth
* @devices phone, tablet
* @permission ohos.permission.ACCESS_BIOMETRIC
*/
declare namespace userIAM {
/**
* User authentication.
*/
class UserAuth {
/**
* Constructor to get the userauth class instance.
* @since 8
* @SysCap SystemCapability.UserIAM.UserAuth.BiometricAuth
* @return Returns the userauth class instance.
*/
constructor();
/**
* Get version information.
* @since 8
* @SysCap SystemCapability.UserIAM.UserAuth.BiometricAuth
* @return Returns version information.
*/
getVersion() : number;
/**
* Check whether the authentication capability is available.
* @since 8
* @SysCap SystemCapability.UserIAM.UserAuth.BiometricAuth
* @permission ohos.permission.ACCESS_BIOMETRIC
* @param authType Credential type for authentication.
* @param authTrustLevel Trust level of authentication result.
* @return Returns a check result, which is specified by getAvailabeStatus.
*/
getAvailabeStatus(authType : AuthType, authTrustLevel : AuthTrustLevel) : number;
/**
* Executes authentication.
* @since 8
* @SysCap SystemCapability.UserIAM.UserAuth.BiometricAuth
* @permission ohos.permission.ACCESS_BIOMETRIC
* @param challenge pass in challenge value.
* @param authType type of authentication.
* @param authTrustLevel Trust level of authentication result.
* @param callback Return result and acquireinfo through callback.
* @return Returns ContextId for cancel.
*/
auth(challenge: Uint8Array, authType: AuthType, authTrustLevel: AuthTrustLevel, callback: IUserAuthCallback): Uint8Array;
/**
* Cancels authentication with ContextID.
* @since 8
* @SysCap SystemCapability.UserIAM.UserAuth.BiometricAuth
* @permission ohos.permission.ACCESS_BIOMETRIC
* @param contextID Cancel authentication and pass in ContextID.
* @return Returns a number value indicating whether Cancel authentication was successful.
*/
cancelAuth(contextID : Uint8Array) : number;
}
interface IUserAuthCallback {
/**
* The authentication result code is returned through the callback.
* @since 8
* @param result authentication result code.
* @param extraInfo pass the specific information for different situation.
* If the authentication is passed, the authentication token is returned in extrainfo,
* If the authentication fails, the remaining authentication times are returned in extrainfo,
* If the authentication executor is locked, the freezing time is returned in extrainfo.
*/
onResult: (result : number, extraInfo : AuthResult) => void;
/**
* During an authentication, the TipsCode is returned through the callback.
* @since 8
* @param module the executor type for authentication.
* @param acquire the tip code for different authentication executor.
* @param extraInfo reserved parameter.
*/
onAcquireInfo ?: (module : number, acquire : number, extraInfo : any) => void;
}
/**
* Authentication result: authentication token, remaining authentication times, freezing time.
* @since 8
* @param token pass the authentication result if the authentication is passed.
* @param remainTimes return the remaining authentication times if the authentication fails.
* @param freezingTime return the freezing time if the authectication executor is locked.
*/
interface AuthResult {
token ?: Uint8Array;
remainTimes ?: number;
freezingTime ?: number;
}
/**
* Result code.
* @since 8
*/
enum ResultCode {
/**
* Indicates that the result is success or ability is supported.
* @since 8
*/
SUCCESS = 0,
/**
* Indicates the the result is failure or ability is not supported.
* @since 8
*/
FAIL = 1,
/**
* Indicates other errors.
* @since 8
*/
GENERAL_ERROR = 2,
/**
* Indicates that this operation has been canceled.
* @since 8
*/
CANCELED = 3,
/**
* Indicates that this operation has timed out.
* @since 8
*/
TIMEOUT = 4,
/**
* Indicates that this authentication type is not supported.
* @since 8
*/
TYPE_NOT_SUPPORT = 5,
/**
* Indicates that the authentication trust level is not supported.
* @since 8
*/
TRUST_LEVEL_NOT_SUPPORT = 6,
/**
* Indicates that the authentication task is busy. Wait for a few seconds and try again.
* @since 8
*/
BUSY = 7,
/**
* Indicates incorrect parameters.
* @since 8
*/
INVALID_PARAMETERS = 8,
/**
* Indicates that the authenticator is locked.
* @since 8
*/
LOCKED = 9,
/**
* Indicates that the user has not enrolled the authenticator.
* @since 8
*/
NOT_ENROLLED = 10
}
/**
* Indicates the enumeration of prompt codes in the process of face authentication.
* @since 8
*/
enum FaceTips {
/**
* Indicates that the obtained facial image is too bright due to high illumination.
* @since 8
*/
FACE_AUTH_TIP_TOO_BRIGHT = 1,
/**
* Indicates that the obtained facial image is too dark due to low illumination.
* @since 8
*/
FACE_AUTH_TIP_TOO_DARK = 2,
/**
* Indicates that the face is too close to the device.
* @since 8
*/
FACE_AUTH_TIP_TOO_CLOSE = 3,
/**
* Indicates that the face is too far away from the device.
* @since 8
*/
FACE_AUTH_TIP_TOO_FAR = 4,
/**
* Indicates that the device is too high, and that only the upper part of the face is captured.
* @since 8
*/
FACE_AUTH_TIP_TOO_HIGH = 5,
/**
* Indicates that the device is too low, and that only the lower part of the face is captured.
* @since 8
*/
FACE_AUTH_TIP_TOO_LOW = 6,
/**
* Indicates that the device is deviated to the right, and that only the right part of the face is captured.
* @since 8
*/
FACE_AUTH_TIP_TOO_RIGHT = 7,
/**
* Indicates that the device is deviated to the left, and that only the left part of the face is captured.
* @since 8
*/
FACE_AUTH_TIP_TOO_LEFT = 8,
/**
* Indicates that the face moves too fast during facial information collection.
* @since 8
*/
FACE_AUTH_TIP_TOO_MUCH_MOTION = 9,
/**
* Indicates that the face is not facing the device.
* @since 8
*/
FACE_AUTH_TIP_POOR_GAZE = 10,
/**
* Indicates that no face is detected.
* @since 8
*/
FACE_AUTH_TIP_NOT_DETECTED = 11,
}
/**
* Indicates the enumeration of prompt codes in the process of fingerprint authentication.
* @since 8
*/
enum FingerprintTips {
/**
* Indicates that the image acquired is good.
* @since 8
*/
FINGERPRINT_AUTH_TIP_GOOD = 0,
/**
* Indicates that the fingerprint image is too noisy due to suspected or detected dirt on sensor.
* @since 8
*/
FINGERPRINT_AUTH_TIP_DIRTY = 1,
/**
* Indicates that the fingerprint image is too noisy to process due to a detected condition.
* @since 8
*/
FINGERPRINT_AUTH_TIP_INSUFFICIENT = 2,
/**
* Indicates that only a partial fingerprint image is detected.
* @since 8
*/
FINGERPRINT_AUTH_TIP_PARTIAL = 3,
/**
* Indicates that the fingerprint image is incomplete due to quick motion.
* @since 8
*/
FINGERPRINT_AUTH_TIP_TOO_FAST = 4,
/**
* Indicates that the fingerprint image is unreadable due to lack of motion.
* @since 8
*/
FINGERPRINT_AUTH_TIP_TOO_SLOW = 5
}
/**
* Credential type for authentication.
*/
enum AuthType {
/**
* Authentication type face.
* @since 8
*/
FACE = 2,
/**
* Authentication type fingerprint.
* @since 8
*/
FINGERPRINT = 4
}
/**
* Trust level of authentication results.
*/
enum AuthTrustLevel {
/**
* Authentication result trusted level 1.
* @since 8
*/
ATL1 = 10000,
/**
* Authentication result trusted level 2.
* @since 8
*/
ATL2 = 20000,
/**
* Authentication result trusted level 3.
* @since 8
*/
ATL3 = 30000,
/**
* Authentication result trusted level 4.
* @since 8
*/
ATL4 = 40000
}
}
export default userIAM;