mirror of
https://gitee.com/openharmony/interface_sdk-js
synced 2024-11-23 15:20:17 +00:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
8ee8dd5cba
200
api/@internal/component/ets/calendar.d.ts
vendored
200
api/@internal/component/ets/calendar.d.ts
vendored
@ -1273,6 +1273,196 @@ interface WorkStateStyle {
|
||||
workStateVerticalMovingDistance?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the struct of CalendarSelectedDate.
|
||||
*
|
||||
* @interface CalendarSelectedDate
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @systemapi
|
||||
* @since 7
|
||||
*/
|
||||
/**
|
||||
* Defines the struct of CalendarSelectedDate.
|
||||
*
|
||||
* @interface CalendarSelectedDate
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @systemapi
|
||||
* @since 10
|
||||
* @form
|
||||
*/
|
||||
declare interface CalendarSelectedDate {
|
||||
/**
|
||||
* Application year
|
||||
*
|
||||
* @type { number }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @systemapi
|
||||
* @since 7
|
||||
*/
|
||||
/**
|
||||
* Application year
|
||||
*
|
||||
* @type { number }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @systemapi
|
||||
* @since 10
|
||||
* @form
|
||||
*/
|
||||
year: number;
|
||||
|
||||
/**
|
||||
* Application month
|
||||
*
|
||||
* @type { number }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @systemapi
|
||||
* @since 7
|
||||
*/
|
||||
/**
|
||||
* Application month
|
||||
*
|
||||
* @type { number }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @systemapi
|
||||
* @since 10
|
||||
* @form
|
||||
*/
|
||||
month: number;
|
||||
|
||||
/**
|
||||
* Application day
|
||||
*
|
||||
* @type { number }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @systemapi
|
||||
* @since 7
|
||||
*/
|
||||
/**
|
||||
* Application day
|
||||
*
|
||||
* @type { number }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @systemapi
|
||||
* @since 10
|
||||
* @form
|
||||
*/
|
||||
day: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the struct of CalendarRequestedData.
|
||||
*
|
||||
* @interface CalendarRequestedData
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @systemapi
|
||||
* @since 7
|
||||
*/
|
||||
/**
|
||||
* Defines the struct of CalendarRequestedData.
|
||||
*
|
||||
* @interface CalendarRequestedData
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @systemapi
|
||||
* @since 10
|
||||
* @form
|
||||
*/
|
||||
declare interface CalendarRequestedData {
|
||||
/**
|
||||
* Previous year
|
||||
*
|
||||
* @type { number }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @systemapi
|
||||
* @since 7
|
||||
*/
|
||||
/**
|
||||
* Previous year
|
||||
*
|
||||
* @type { number }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @systemapi
|
||||
* @since 10
|
||||
* @form
|
||||
*/
|
||||
year: number;
|
||||
|
||||
/**
|
||||
* Previous month
|
||||
*
|
||||
* @type { number }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @systemapi
|
||||
* @since 7
|
||||
*/
|
||||
/**
|
||||
* Previous month
|
||||
*
|
||||
* @type { number }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @systemapi
|
||||
* @since 10
|
||||
* @form
|
||||
*/
|
||||
month: number;
|
||||
|
||||
/**
|
||||
* Current Year
|
||||
*
|
||||
* @type { number }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @systemapi
|
||||
* @since 7
|
||||
*/
|
||||
/**
|
||||
* Current Year
|
||||
*
|
||||
* @type { number }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @systemapi
|
||||
* @since 10
|
||||
* @form
|
||||
*/
|
||||
currentYear: number;
|
||||
|
||||
/**
|
||||
* Current Month
|
||||
*
|
||||
* @type { number }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @systemapi
|
||||
* @since 7
|
||||
*/
|
||||
/**
|
||||
* Current Month
|
||||
*
|
||||
* @type { number }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @systemapi
|
||||
* @since 10
|
||||
* @form
|
||||
*/
|
||||
currentMonth: number;
|
||||
|
||||
/**
|
||||
* State of month
|
||||
*
|
||||
* @type { number }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @systemapi
|
||||
* @since 7
|
||||
*/
|
||||
/**
|
||||
* State of month
|
||||
*
|
||||
* @type { number }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @systemapi
|
||||
* @since 10
|
||||
* @form
|
||||
*/
|
||||
monthState: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calendar controller.
|
||||
*
|
||||
@ -1651,7 +1841,7 @@ declare class CalendarAttribute {
|
||||
* @since 10
|
||||
* @form
|
||||
*/
|
||||
onSelectChange(event: (event: { year: number; month: number; day: number }) => void): CalendarAttribute;
|
||||
onSelectChange(event: (event: CalendarSelectedDate) => void): CalendarAttribute;
|
||||
|
||||
/**
|
||||
* When you swipe to switch months, the information about the previous month and the next month is requested.
|
||||
@ -1673,13 +1863,7 @@ declare class CalendarAttribute {
|
||||
* @form
|
||||
*/
|
||||
onRequestData(
|
||||
event: (event: {
|
||||
year: number;
|
||||
month: number;
|
||||
currentYear: number;
|
||||
currentMonth: number;
|
||||
monthState: number;
|
||||
}) => void,
|
||||
event: (event: CalendarRequestedData) => void,
|
||||
): CalendarAttribute;
|
||||
}
|
||||
|
||||
|
23
api/@internal/component/ets/common.d.ts
vendored
23
api/@internal/component/ets/common.d.ts
vendored
@ -1851,6 +1851,7 @@ declare interface RotateOptions {
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 10
|
||||
* @form
|
||||
*/
|
||||
centerY?: number | string;
|
||||
|
||||
@ -1968,6 +1969,7 @@ declare interface TransitionOptions {
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 10
|
||||
* @form
|
||||
*/
|
||||
declare enum TransitionEdge {
|
||||
/**
|
||||
@ -1976,6 +1978,7 @@ declare enum TransitionEdge {
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 10
|
||||
* @form
|
||||
*/
|
||||
TOP,
|
||||
|
||||
@ -1985,6 +1988,7 @@ declare enum TransitionEdge {
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 10
|
||||
* @form
|
||||
*/
|
||||
BOTTOM,
|
||||
|
||||
@ -1994,6 +1998,7 @@ declare enum TransitionEdge {
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 10
|
||||
* @form
|
||||
*/
|
||||
START,
|
||||
|
||||
@ -2003,6 +2008,7 @@ declare enum TransitionEdge {
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 10
|
||||
* @form
|
||||
*/
|
||||
END
|
||||
}
|
||||
@ -2013,6 +2019,7 @@ declare enum TransitionEdge {
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 10
|
||||
* @form
|
||||
*/
|
||||
declare type TransitionEffects = {
|
||||
identity: undefined;
|
||||
@ -2034,6 +2041,7 @@ declare type TransitionEffects = {
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 10
|
||||
* @form
|
||||
*/
|
||||
declare class TransitionEffect<
|
||||
Type extends keyof TransitionEffects = keyof TransitionEffects,
|
||||
@ -2047,6 +2055,7 @@ declare class TransitionEffect<
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 10
|
||||
* @form
|
||||
*/
|
||||
static readonly IDENTITY: TransitionEffect<"identity">;
|
||||
|
||||
@ -2058,6 +2067,7 @@ declare class TransitionEffect<
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 10
|
||||
* @form
|
||||
*/
|
||||
static readonly OPACITY: TransitionEffect<"opacity">;
|
||||
|
||||
@ -2073,6 +2083,7 @@ declare class TransitionEffect<
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 10
|
||||
* @form
|
||||
*/
|
||||
static readonly SLIDE: TransitionEffect<
|
||||
"asymmetric",
|
||||
@ -2090,6 +2101,7 @@ declare class TransitionEffect<
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 10
|
||||
* @form
|
||||
*/
|
||||
static readonly SLIDE_SWITCH: TransitionEffect<"slideSwitch">;
|
||||
|
||||
@ -2101,6 +2113,7 @@ declare class TransitionEffect<
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 10
|
||||
* @form
|
||||
*/
|
||||
static translate(options: TranslateOptions): TransitionEffect<"translate">;
|
||||
|
||||
@ -2112,6 +2125,7 @@ declare class TransitionEffect<
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 10
|
||||
* @form
|
||||
*/
|
||||
static rotate(options: RotateOptions): TransitionEffect<"rotate">;
|
||||
|
||||
@ -2123,6 +2137,7 @@ declare class TransitionEffect<
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 10
|
||||
* @form
|
||||
*/
|
||||
static scale(options: ScaleOptions): TransitionEffect<"scale">;
|
||||
|
||||
@ -2134,6 +2149,7 @@ declare class TransitionEffect<
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 10
|
||||
* @form
|
||||
*/
|
||||
static opacity(alpha: number): TransitionEffect<"opacity">;
|
||||
|
||||
@ -2145,6 +2161,7 @@ declare class TransitionEffect<
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 10
|
||||
* @form
|
||||
*/
|
||||
static move(edge: TransitionEdge): TransitionEffect<"move">;
|
||||
|
||||
@ -2157,6 +2174,7 @@ declare class TransitionEffect<
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 10
|
||||
* @form
|
||||
*/
|
||||
static asymmetric(
|
||||
appear: TransitionEffect,
|
||||
@ -2171,6 +2189,7 @@ declare class TransitionEffect<
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 10
|
||||
* @form
|
||||
*/
|
||||
constructor(type: Type, effect: Effect);
|
||||
|
||||
@ -2182,6 +2201,7 @@ declare class TransitionEffect<
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 10
|
||||
* @form
|
||||
*/
|
||||
animation(value: AnimateParam): TransitionEffect;
|
||||
|
||||
@ -2193,6 +2213,7 @@ declare class TransitionEffect<
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 10
|
||||
* @form
|
||||
*/
|
||||
combine(transitionEffect: TransitionEffect): TransitionEffect;
|
||||
}
|
||||
@ -5770,7 +5791,7 @@ declare interface ContextMenuOptions {
|
||||
* The preview content of context menu.
|
||||
*
|
||||
* @type { ?(MenuPreviewMode | CustomBuilder) }
|
||||
* @default MenuPreviewMode.NONE
|
||||
* @default MenuPreviewMode.IMAGE
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
|
11
api/@internal/component/ets/navigation.d.ts
vendored
11
api/@internal/component/ets/navigation.d.ts
vendored
@ -993,6 +993,17 @@ declare class NavigationAttribute extends CommonMethod<NavigationAttribute> {
|
||||
*/
|
||||
onNavBarStateChange(callback: (isVisible: boolean) => void): NavigationAttribute;
|
||||
|
||||
/**
|
||||
* Trigger callback when navigation mode changes.
|
||||
*
|
||||
* @param { function } callback
|
||||
* @returns { NavigationAttribute }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
onNavigationModeChange(callback: (mode: NavigationMode) => void): NavigationAttribute;
|
||||
|
||||
/**
|
||||
* Set builder for user-defined NavDestination component.
|
||||
*
|
||||
|
43
api/@internal/component/ets/pattern_lock.d.ts
vendored
43
api/@internal/component/ets/pattern_lock.d.ts
vendored
@ -13,6 +13,30 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* The challenge result based on input pattern for control pattern lock component.
|
||||
* @enum { number }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
declare enum PatternLockChallengeResult {
|
||||
/**
|
||||
* The challenge result is correct.
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
CORRECT = 1,
|
||||
/**
|
||||
* The challenge result is wrong.
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
WRONG = 2
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides methods for control pattern lock component.
|
||||
*
|
||||
@ -54,6 +78,15 @@ declare class PatternLockController {
|
||||
* @since 10
|
||||
*/
|
||||
reset();
|
||||
|
||||
/**
|
||||
* Set challenge result.
|
||||
* @param { PatternLockChallengeResult } result - The challenge result based on input pattern.
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
setChallengeResult(result: PatternLockChallengeResult): void;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -280,6 +313,16 @@ declare class PatternLockAttribute extends CommonMethod<PatternLockAttribute> {
|
||||
* @since 10
|
||||
*/
|
||||
autoReset(value: boolean): PatternLockAttribute;
|
||||
|
||||
/**
|
||||
* Called when connecting to a grid dot.
|
||||
* @param { import('../api/@ohos.base').Callback<number> } callback - A callback instance used when connection to a grid dot.
|
||||
* @returns { PatternLockAttribute }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
onDotConnect(callback: import('../api/@ohos.base').Callback<number>): PatternLockAttribute;
|
||||
}
|
||||
|
||||
/**
|
||||
|
44
api/@internal/component/ets/swiper.d.ts
vendored
44
api/@internal/component/ets/swiper.d.ts
vendored
@ -180,7 +180,7 @@ declare class Indicator<T> {
|
||||
/**
|
||||
* Define DotIndicator, the indicator type is dot.
|
||||
*
|
||||
* @extends Indicator
|
||||
* @extends Indicator<DotIndicator>
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 10
|
||||
@ -303,7 +303,7 @@ declare type SwiperAutoFill = {
|
||||
/**
|
||||
* Define DigitIndicator, the indicator type is digit.
|
||||
*
|
||||
* @extends Indicator
|
||||
* @extends Indicator<DigitIndicator>
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 10
|
||||
@ -670,17 +670,42 @@ declare interface SwiperAnimationEvent {
|
||||
velocity: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Swiper nested scroll nested mode
|
||||
|
||||
* @enum { number } SwiperNestedScrollMode
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @since 11
|
||||
*/
|
||||
declare enum SwiperNestedScrollMode {
|
||||
/**
|
||||
* Only Self response scrolling.
|
||||
*
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @since 11
|
||||
*/
|
||||
SELF_ONLY = 0,
|
||||
|
||||
/**
|
||||
* Self priority response scrolling.
|
||||
*
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @since 11
|
||||
*/
|
||||
SELF_FIRST = 1,
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the swiper attribute functions.
|
||||
*
|
||||
* @extends CommonMethod
|
||||
* @extends CommonMethod<SwiperAttribute>
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @since 7
|
||||
*/
|
||||
/**
|
||||
* Defines the swiper attribute functions.
|
||||
*
|
||||
* @extends CommonMethod
|
||||
* @extends CommonMethod<SwiperAttribute>
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 10
|
||||
@ -1087,6 +1112,17 @@ declare class SwiperAttribute extends CommonMethod<SwiperAttribute> {
|
||||
* @since 10
|
||||
*/
|
||||
onGestureSwipe(event: (index: number, extraInfo: SwiperAnimationEvent) => void): SwiperAttribute;
|
||||
|
||||
/**
|
||||
* Called to setting the nested scroll mode.
|
||||
*
|
||||
* @param { SwiperNestedScrollMode } value - mode for nested scrolling.
|
||||
* @returns { SwiperAttribute } the attribute of the swiper.
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
nestedScroll(value: SwiperNestedScrollMode): SwiperAttribute;
|
||||
}
|
||||
|
||||
/**
|
||||
|
2
api/@internal/component/ets/units.d.ts
vendored
2
api/@internal/component/ets/units.d.ts
vendored
@ -1623,6 +1623,6 @@ declare class ColorFilter {
|
||||
declare module "GlobalResource" {
|
||||
module "GlobalResource" {
|
||||
// @ts-ignore
|
||||
export { Resource };
|
||||
export type { Resource, ResourceStr };
|
||||
}
|
||||
}
|
||||
|
93
api/@ohos.UiTest.d.ts
vendored
93
api/@ohos.UiTest.d.ts
vendored
@ -2448,6 +2448,23 @@ declare class Driver {
|
||||
* @test
|
||||
*/
|
||||
mouseScroll(p: Point, down: boolean, d: number, key1?: number, key2?: number): Promise<void>;
|
||||
/**
|
||||
* The mouse wheel scrolls the specified cell at the specified position, and press the specified key simultaneously if necessary.
|
||||
*
|
||||
* @param { Point } p - the coordinate of the specified location.
|
||||
* @param { boolean } down - whether the mouse wheel rolls down.
|
||||
* @param { number } d - the number of cells that the mouse wheel scrolls, each cell will make the target point shift 120 pixels.
|
||||
* @param { number } key1 - the first keyCode.
|
||||
* @param { number } key2 - the second keyCode.
|
||||
* @param { number } speed - the speed at which mouse wheel rolls(cells per second),default is 20,the value ranges from 1 to 500,set it 20 if out of range.
|
||||
* @returns { Promise<void> }
|
||||
* @throws { BusinessError } 401 - if the input parameters are invalid.
|
||||
* @throws { BusinessError } 17000002 - if the async function was not called with await.
|
||||
* @syscap SystemCapability.Test.UiTest
|
||||
* @since 11
|
||||
* @test
|
||||
*/
|
||||
mouseScroll(p: Point, down: boolean, d: number, key1?: number, key2?: number, speed?: number): Promise<void>;
|
||||
|
||||
/**
|
||||
* Capture the specified area of current screen and save as picture which PNG format.
|
||||
@ -2473,6 +2490,82 @@ declare class Driver {
|
||||
* @test
|
||||
*/
|
||||
createUIEventObserver(): UIEventObserver;
|
||||
|
||||
/**
|
||||
* Double click on the specified location on the screen with the specified mouse button, and press the specified key simultaneously if necessary.
|
||||
*
|
||||
* @param { Point } p - the coordinate of the specified location.
|
||||
* @param { MouseButton } btnId - the button of Mouse.
|
||||
* @param { number } key1 - the first keyCode.
|
||||
* @param { number } key2 - the second keyCode.
|
||||
* @returns { Promise<void> }
|
||||
* @throws { BusinessError } 401 - if the input parameters are invalid.
|
||||
* @throws { BusinessError } 17000002 - if the async function was not called with await.
|
||||
* @syscap SystemCapability.Test.UiTest
|
||||
* @since 11
|
||||
* @test
|
||||
*/
|
||||
mouseDoubleClick(p: Point, btnId: MouseButton, key1?: number, key2?: number): Promise<void>;
|
||||
|
||||
/**
|
||||
* Long click on the specified location on the screen with the specified mouse button, and press the specified key simultaneously if necessary.
|
||||
*
|
||||
* @param { Point } p - the coordinate of the specified location.
|
||||
* @param { MouseButton } btnId - the button of Mouse.
|
||||
* @param { number } key1 - the first keyCode.
|
||||
* @param { number } key2 - the second keyCode.
|
||||
* @returns { Promise<void> }
|
||||
* @throws { BusinessError } 401 - if the input parameters are invalid.
|
||||
* @throws { BusinessError } 17000002 - if the async function was not called with await.
|
||||
* @syscap SystemCapability.Test.UiTest
|
||||
* @since 11
|
||||
* @test
|
||||
*/
|
||||
mouseLongClick(p: Point, btnId: MouseButton, key1?: number, key2?: number): Promise<void>;
|
||||
|
||||
/**
|
||||
* Swipe on the screen between the specified points with mouse.
|
||||
*
|
||||
* @param { Point } from - the starting point.
|
||||
* @param { Point } to - the ending point.
|
||||
* @param { number } speed - the speed of swipe (pixels per second),default is 600,the value ranges from 200 to 40000,set it 600 if out of range.
|
||||
* @returns { Promise<void> }
|
||||
* @throws { BusinessError } 401 - if the input parameters are invalid.
|
||||
* @throws { BusinessError } 17000002 - if the async function was not called with await.
|
||||
* @syscap SystemCapability.Test.UiTest
|
||||
* @since 11
|
||||
* @test
|
||||
*/
|
||||
mouseMoveWithTrack(from: Point, to: Point, speed?: number): Promise<void>;
|
||||
|
||||
/**
|
||||
* Hold down the left mouse button and drag on the screen between the specified points.
|
||||
*
|
||||
* @param { Point } from - the starting point.
|
||||
* @param { Point } to - the ending point.
|
||||
* @param { number } speed - the speed of drag (pixels per second),default is 600,the value ranges from 200 to 40000,set it 600 if out of range.
|
||||
* @returns { Promise<void> }
|
||||
* @throws { BusinessError } 401 - if the input parameters are invalid.
|
||||
* @throws { BusinessError } 17000002 - if the async function was not called with await.
|
||||
* @syscap SystemCapability.Test.UiTest
|
||||
* @since 11
|
||||
* @test
|
||||
*/
|
||||
mouseDrag(from: Point, to: Point, speed?: number): Promise<void>;
|
||||
|
||||
/**
|
||||
* Inject text on the specified location.
|
||||
*
|
||||
* @param { Point } p - the coordinate of the specified location.
|
||||
* @param { string } text - the text to inject.
|
||||
* @returns { Promise<void> }
|
||||
* @throws { BusinessError } 401 - if the input parameters are invalid.
|
||||
* @throws { BusinessError } 17000002 - if the async function was not called with await.
|
||||
* @syscap SystemCapability.Test.UiTest
|
||||
* @since 11
|
||||
* @test
|
||||
*/
|
||||
inputText(p: Point, text: string): Promise<void>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
9
api/@ohos.accessibility.config.d.ts
vendored
9
api/@ohos.accessibility.config.d.ts
vendored
@ -25,6 +25,15 @@ import type { AsyncCallback, Callback } from './@ohos.base';
|
||||
* @since 9
|
||||
*/
|
||||
declare namespace config {
|
||||
/**
|
||||
* @constant
|
||||
* Indicates the configuration of daltonization state.
|
||||
*
|
||||
* @syscap SystemCapability.BarrierFree.Accessibility.Core
|
||||
* @systemapi
|
||||
* @since 11
|
||||
*/
|
||||
const daltonizationState: Config<boolean>;
|
||||
/**
|
||||
* @constant
|
||||
* Indicates the configuration of audio mono.
|
||||
|
@ -14,6 +14,7 @@
|
||||
*/
|
||||
|
||||
import type { AbilityResult } from './ability/abilityResult';
|
||||
import type { AbilityStartCallback } from './application/AbilityStartCallback';
|
||||
import type { AsyncCallback } from './@ohos.base';
|
||||
import type { LocalStorage } from 'StateManagement';
|
||||
import type Want from './@ohos.app.ability.Want';
|
||||
@ -366,4 +367,50 @@ export default class UIExtensionContentSession {
|
||||
* @since 10
|
||||
*/
|
||||
setWindowPrivacyMode(isPrivacyMode: boolean, callback: AsyncCallback<void>): void;
|
||||
|
||||
/**
|
||||
* Starts the UIAbility or UIExtensionAbility by type.
|
||||
* If the target ability is visible, you can start the target ability; If the target ability is invisible,
|
||||
* you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability.
|
||||
*
|
||||
* @param { string } type - The type of target ability.
|
||||
* @param { Record<string, Object> } wantParam - Indicates the want parameter.
|
||||
* @param { AbilityStartCallback } abilityStartCallback - Indicates the abilityStartCallback.
|
||||
* @param { AsyncCallback<void> } callback - The callback of startAbility.
|
||||
* @throws { BusinessError } 201 - The application does not have permission to call the interface.
|
||||
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
|
||||
* @throws { BusinessError } 16000001 - The specified ability does not exist.
|
||||
* @throws { BusinessError } 16000002 - Incorrect ability type.
|
||||
* @throws { BusinessError } 16000004 - Can not start invisible component.
|
||||
* @throws { BusinessError } 16000050 - Internal error.
|
||||
* @throws { BusinessError } 16200001 - The caller has been released.
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @StageModelOnly
|
||||
* @since 11
|
||||
*/
|
||||
startAbilityByType(type: string, wantParam: Record<string, Object>,
|
||||
abilityStartCallback: AbilityStartCallback, callback: AsyncCallback<void>): void;
|
||||
|
||||
/**
|
||||
* Starts the UIAbility or UIExtensionAbility by type.
|
||||
* If the target ability is visible, you can start the target ability; If the target ability is invisible,
|
||||
* you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability.
|
||||
*
|
||||
* @param { string } type - The type of target ability.
|
||||
* @param { Record<string, Object> } wantParam - Indicates the want parameter.
|
||||
* @param { AbilityStartCallback } abilityStartCallback - Indicates the abilityStartCallback.
|
||||
* @returns { Promise<void> } The promise returned by the function.
|
||||
* @throws { BusinessError } 201 - The application does not have permission to call the interface.
|
||||
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
|
||||
* @throws { BusinessError } 16000001 - The specified ability does not exist.
|
||||
* @throws { BusinessError } 16000002 - Incorrect ability type.
|
||||
* @throws { BusinessError } 16000004 - Can not start invisible component.
|
||||
* @throws { BusinessError } 16000050 - Internal error.
|
||||
* @throws { BusinessError } 16200001 - The caller has been released.
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @StageModelOnly
|
||||
* @since 11
|
||||
*/
|
||||
startAbilityByType(type: string, wantParam: Record<string, Object>,
|
||||
abilityStartCallback: AbilityStartCallback): Promise<void>;
|
||||
}
|
||||
|
59
api/@ohos.app.ability.appManager.d.ts
vendored
59
api/@ohos.app.ability.appManager.d.ts
vendored
@ -146,8 +146,6 @@ declare namespace appManager {
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @systemapi
|
||||
* @since 9
|
||||
* @deprecated since 10
|
||||
* @useinstead appManager#on(type: 'applicationStateEvent', observer: ApplicationStateObserver)
|
||||
*/
|
||||
function on(type: 'applicationState', observer: ApplicationStateObserver): number;
|
||||
|
||||
@ -166,8 +164,6 @@ declare namespace appManager {
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @systemapi
|
||||
* @since 9
|
||||
* @deprecated since 10
|
||||
* @useinstead appManager#on(type: 'applicationStateEvent', observer: ApplicationStateObserver, bundleNameList: Array<string>)
|
||||
*/
|
||||
function on(type: 'applicationState', observer: ApplicationStateObserver, bundleNameList: Array<string>): number;
|
||||
|
||||
@ -185,8 +181,6 @@ declare namespace appManager {
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @systemapi
|
||||
* @since 9
|
||||
* @deprecated since 10
|
||||
* @useinstead appManager#off(type: 'applicationStateEvent', observerId: number)
|
||||
*/
|
||||
function off(type: 'applicationState', observerId: number, callback: AsyncCallback<void>): void;
|
||||
|
||||
@ -204,62 +198,9 @@ declare namespace appManager {
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @systemapi
|
||||
* @since 9
|
||||
* @deprecated since 10
|
||||
* @useinstead appManager#off(type: 'applicationStateEvent', observerId: number)
|
||||
*/
|
||||
function off(type: 'applicationState', observerId: number): Promise<void>;
|
||||
|
||||
/**
|
||||
* Register application state observer.
|
||||
*
|
||||
* @permission ohos.permission.RUNNING_STATE_OBSERVER
|
||||
* @param { 'applicationStateEvent' } type - applicationStateEvent.
|
||||
* @param { ApplicationStateObserver } observer - The application state observer.
|
||||
* @returns { number } Returns the number code of the observer.
|
||||
* @throws { BusinessError } 201 - Permission denied.
|
||||
* @throws { BusinessError } 202 - Not system application.
|
||||
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
|
||||
* @throws { BusinessError } 16000050 - Internal error.
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @systemapi
|
||||
* @since 10
|
||||
*/
|
||||
function on(type: 'applicationStateEvent', observer: ApplicationStateObserver): number;
|
||||
|
||||
/**
|
||||
* Register application state observer.
|
||||
*
|
||||
* @permission ohos.permission.RUNNING_STATE_OBSERVER
|
||||
* @param { 'applicationStateEvent' } type - applicationStateEvent.
|
||||
* @param { ApplicationStateObserver } observer - The application state observer.
|
||||
* @param { Array<string> } bundleNameList - The list of bundleName. The max length is 128.
|
||||
* @returns { number } Returns the number code of the observer.
|
||||
* @throws { BusinessError } 201 - Permission denied.
|
||||
* @throws { BusinessError } 202 - Not system application.
|
||||
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
|
||||
* @throws { BusinessError } 16000050 - Internal error.
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @systemapi
|
||||
* @since 10
|
||||
*/
|
||||
function on(type: 'applicationStateEvent', observer: ApplicationStateObserver, bundleNameList: Array<string>): number;
|
||||
|
||||
/**
|
||||
* Unregister application state observer.
|
||||
*
|
||||
* @permission ohos.permission.RUNNING_STATE_OBSERVER
|
||||
* @param { 'applicationStateEvent' } type - applicationStateEvent.
|
||||
* @param { number } observerId - Indicates the number code of the observer.
|
||||
* @throws { BusinessError } 201 - Permission denied.
|
||||
* @throws { BusinessError } 202 - Not system application.
|
||||
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
|
||||
* @throws { BusinessError } 16000050 - Internal error.
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @systemapi
|
||||
* @since 10
|
||||
*/
|
||||
function off(type: 'applicationStateEvent', observerId: number): void;
|
||||
|
||||
/**
|
||||
* getForegroundApplications.
|
||||
*
|
||||
|
10
api/@ohos.app.ability.common.d.ts
vendored
10
api/@ohos.app.ability.common.d.ts
vendored
@ -25,6 +25,7 @@ import * as _ServiceExtensionContext from './application/ServiceExtensionContext
|
||||
import * as _EventHub from './application/EventHub';
|
||||
import { PacMap as _PacMap } from './ability/dataAbilityHelper';
|
||||
import { AbilityResult as _AbilityResult } from './ability/abilityResult';
|
||||
import type { AbilityStartCallback as _AbilityStartCallback } from './application/AbilityStartCallback';
|
||||
import { ConnectOptions as _ConnectOptions } from './ability/connectOptions';
|
||||
|
||||
/**
|
||||
@ -207,6 +208,15 @@ declare namespace common {
|
||||
* @since 10
|
||||
*/
|
||||
export type UIExtensionContext = _UIExtensionContext.default;
|
||||
|
||||
/**
|
||||
* The function Called when some error occurred except disconnected from UIAbility or UIExtensionAbility
|
||||
*
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @StageModelOnly
|
||||
* @since 11
|
||||
*/
|
||||
export type AbilityStartCallback = _AbilityStartCallback;
|
||||
}
|
||||
|
||||
export default common;
|
||||
|
31
api/@ohos.app.ability.errorManager.d.ts
vendored
31
api/@ohos.app.ability.errorManager.d.ts
vendored
@ -34,8 +34,6 @@ declare namespace errorManager {
|
||||
* @throws { BusinessError } 16000003 - Id does not exist.
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @since 9
|
||||
* @deprecated since 10
|
||||
* @useinstead errorManager#on(type: 'errorEvent', observer: ErrorObserver)
|
||||
*/
|
||||
function on(type: 'error', observer: ErrorObserver): number;
|
||||
|
||||
@ -49,8 +47,6 @@ declare namespace errorManager {
|
||||
* @throws { BusinessError } 16000003 - Id does not exist.
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @since 9
|
||||
* @deprecated since 10
|
||||
* @useinstead errorManager#off(type: 'errorEvent', observerId: number)
|
||||
*/
|
||||
function off(type: 'error', observerId: number, callback: AsyncCallback<void>): void;
|
||||
|
||||
@ -64,36 +60,9 @@ declare namespace errorManager {
|
||||
* @throws { BusinessError } 16000003 - Id does not exist.
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @since 9
|
||||
* @deprecated since 10
|
||||
* @useinstead errorManager#off(type: 'errorEvent', observerId: number)
|
||||
*/
|
||||
function off(type: 'error', observerId: number): Promise<void>;
|
||||
|
||||
/**
|
||||
* Register error observer.
|
||||
*
|
||||
* @param { 'errorEvent' } type - errorEvent.
|
||||
* @param { ErrorObserver } observer - The error observer.
|
||||
* @returns { number } Returns the number code of the observer.
|
||||
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
|
||||
* @throws { BusinessError } 16000003 - Id does not exist.
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @since 10
|
||||
*/
|
||||
function on(type: 'errorEvent', observer: ErrorObserver): number;
|
||||
|
||||
/**
|
||||
* Unregister error observer.
|
||||
*
|
||||
* @param { 'errorEvent' } type - errorEvent.
|
||||
* @param { number } observerId - Indicates the number code of the observer.
|
||||
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
|
||||
* @throws { BusinessError } 16000003 - Id does not exist.
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @since 10
|
||||
*/
|
||||
function off(type: 'errorEvent', observerId: number): void;
|
||||
|
||||
/**
|
||||
* The observer will be called by system when an error occurs.
|
||||
*
|
||||
|
38
api/@ohos.app.ability.missionManager.d.ts
vendored
38
api/@ohos.app.ability.missionManager.d.ts
vendored
@ -42,8 +42,6 @@ declare namespace missionManager {
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.Mission
|
||||
* @systemapi
|
||||
* @since 9
|
||||
* @deprecated since 10
|
||||
* @useinstead missionManager#on(type: 'missionEvent', listener: MissionListener)
|
||||
*/
|
||||
function on(type: 'mission', listener: MissionListener): number;
|
||||
|
||||
@ -61,8 +59,6 @@ declare namespace missionManager {
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.Mission
|
||||
* @systemapi
|
||||
* @since 9
|
||||
* @deprecated since 10
|
||||
* @useinstead missionManager#off(type: 'missionEvent', listenerId: number)
|
||||
*/
|
||||
function off(type: 'mission', listenerId: number, callback: AsyncCallback<void>): void;
|
||||
|
||||
@ -80,43 +76,9 @@ declare namespace missionManager {
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.Mission
|
||||
* @systemapi
|
||||
* @since 9
|
||||
* @deprecated since 10
|
||||
* @useinstead missionManager#off(type: 'missionEvent', listenerId: number)
|
||||
*/
|
||||
function off(type: 'mission', listenerId: number): Promise<void>;
|
||||
|
||||
/**
|
||||
* Register the missionListener to ams.
|
||||
*
|
||||
* @permission ohos.permission.MANAGE_MISSIONS
|
||||
* @param { 'missionEvent' } type - missionEvent.
|
||||
* @param { MissionListener } listener - Indicates the MissionListener to be registered.
|
||||
* @returns { number } Returns the index number of the MissionListener.
|
||||
* @throws { BusinessError } 201 - Permission denied.
|
||||
* @throws { BusinessError } 202 - Not system application.
|
||||
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.Mission
|
||||
* @systemapi
|
||||
* @since 10
|
||||
*/
|
||||
function on(type: 'missionEvent', listener: MissionListener): number;
|
||||
|
||||
/**
|
||||
* Unregister the missionListener to ams.
|
||||
*
|
||||
* @permission ohos.permission.MANAGE_MISSIONS
|
||||
* @param { 'missionEvent' } type - missionEvent.
|
||||
* @param { number } listenerId - Indicates the listener id to be unregistered.
|
||||
* @throws { BusinessError } 201 - Permission denied.
|
||||
* @throws { BusinessError } 202 - Not system application.
|
||||
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
|
||||
* @throws { BusinessError } 16300002 - Input error. The specified mission listener does not exist.
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.Mission
|
||||
* @systemapi
|
||||
* @since 10
|
||||
*/
|
||||
function off(type: 'missionEvent', listenerId: number): void;
|
||||
|
||||
/**
|
||||
* Get the missionInfo with the given missionId.
|
||||
*
|
||||
|
10
api/@ohos.app.form.formInfo.d.ts
vendored
10
api/@ohos.app.form.formInfo.d.ts
vendored
@ -201,6 +201,16 @@ declare namespace formInfo {
|
||||
* @since 10
|
||||
*/
|
||||
isDynamic: boolean;
|
||||
|
||||
/**
|
||||
* Indicates whether the form can be set as a transparent background
|
||||
*
|
||||
* @type { boolean }
|
||||
* @default false
|
||||
* @syscap SystemCapability.Ability.Form
|
||||
* @since 11
|
||||
*/
|
||||
transparencyEnabled: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
|
411
api/@ohos.arkui.advanced.Counter.d.ets
Normal file
411
api/@ohos.arkui.advanced.Counter.d.ets
Normal file
@ -0,0 +1,411 @@
|
||||
/*
|
||||
* Copyright (c) 2023 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Enum for the counter type.
|
||||
*
|
||||
* @enum { number }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
declare enum CounterType {
|
||||
/**
|
||||
* List counter.
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
LIST = 0,
|
||||
|
||||
/**
|
||||
* Compact counter.
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
COMPACT = 1,
|
||||
|
||||
/**
|
||||
* Inline counter.
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
INLINE = 2,
|
||||
|
||||
/**
|
||||
* Date inline counter.
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
INLINE_DATE = 3
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the common options.
|
||||
*
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
declare class CommonOptions {
|
||||
/**
|
||||
* Set the focusable of the counter component.
|
||||
* @type { ?boolean }
|
||||
* @default true
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
focusable?: boolean;
|
||||
|
||||
/**
|
||||
* Set the step of the couter component, ranges greater than or equal to 1
|
||||
*
|
||||
* @type { ?number }
|
||||
* @default 1
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
step?: number;
|
||||
|
||||
/**
|
||||
* Trigger a mouse hover event at the increased button.
|
||||
*
|
||||
* @type { ?function }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
onHoverIncrease?: (isHover: boolean) => void;
|
||||
|
||||
/**
|
||||
* Trigger a mouse hover event at the decreased button.
|
||||
*
|
||||
* @type { ?function }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
onHoverDecrease?: (isHover: boolean) => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the inline style options.
|
||||
*
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
declare class InlineStyleOptions extends CommonOptions {
|
||||
/**
|
||||
* Set initial value of the counter component, ranges from min to max.
|
||||
*
|
||||
* @type { ?number }
|
||||
* @default 0
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
value?: number;
|
||||
|
||||
/**
|
||||
* Set minimum value of the counter component
|
||||
*
|
||||
* @type { ?number }
|
||||
* @default 0
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
min?: number;
|
||||
|
||||
/**
|
||||
* Set maximum value of the counter component
|
||||
*
|
||||
* @type { ?number }
|
||||
* @default 999
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
max?: number;
|
||||
|
||||
/**
|
||||
* Set text width of the counter component, ranges greater than or equal to 0
|
||||
*
|
||||
* @type { ?number }
|
||||
* @default 0
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
textWidth?: number;
|
||||
|
||||
/**
|
||||
* Trigger a event when the value of the counter has been changed.
|
||||
*
|
||||
* @type { ?function }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
onChange?: (value: number) => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the number style options.
|
||||
*
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
declare class NumberStyleOptions extends InlineStyleOptions {
|
||||
/**
|
||||
* Set the label of the counter component.
|
||||
*
|
||||
* @type { ?ResourceStr }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
label?: ResourceStr;
|
||||
|
||||
/**
|
||||
* Trigger a event when the increased button got focus.
|
||||
*
|
||||
* @type { ?function }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
onFocusIncrease?: () => void;
|
||||
|
||||
/**
|
||||
* Trigger a event when the decreased button got focus.
|
||||
*
|
||||
* @type { ?function }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
onFocusDecrease?: () => void;
|
||||
|
||||
/**
|
||||
* Trigger a event when the increased button lose focus.
|
||||
*
|
||||
* @type { ?function }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
onBlurIncrease?: () => void;
|
||||
|
||||
/**
|
||||
* Trigger a event when the decreased button lose focus.
|
||||
*
|
||||
* @type { ?function }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
onBlurDecrease?: () => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the date data.
|
||||
*
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
declare class DateData {
|
||||
/**
|
||||
* The year of the DateData, ranges from 1 to 5000.
|
||||
*
|
||||
* @type { number }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
year: number;
|
||||
|
||||
/**
|
||||
* The month of the DateData.
|
||||
*
|
||||
* @type { number }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
month: number;
|
||||
|
||||
/**
|
||||
* The day of the DateData.
|
||||
*
|
||||
* @type { number }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
day: number;
|
||||
|
||||
/**
|
||||
* Constructor of the DateData.
|
||||
*
|
||||
* @param { number } year - set the year of the DateData.
|
||||
* @param { number } month - set the month of the DateData.
|
||||
* @param { number } day - set the day of the DateData.
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
constructor(year: number, month: number, day: number);
|
||||
|
||||
/**
|
||||
* Convert the date data to string.
|
||||
*
|
||||
* @returns { string } date data in string form.
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the date style options.
|
||||
*
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
declare class DateStyleOptions extends CommonOptions {
|
||||
/**
|
||||
* Set the year of the counter component, ranges from 1 to 5000.
|
||||
*
|
||||
* @type { ?number }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
year?: number;
|
||||
|
||||
/**
|
||||
* Set the month of the counter component.
|
||||
*
|
||||
* @type { ?number }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
month?: number;
|
||||
|
||||
/**
|
||||
* Set the day of the counter component.
|
||||
*
|
||||
* @type { ?number }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
day?: number;
|
||||
|
||||
/**
|
||||
* Trigger a event when the date of the counter has been changed.
|
||||
*
|
||||
* @type { ?function }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
onDateChange?: (date: DateData) => void;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Defines the counter options.
|
||||
*
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
declare class CounterOptions {
|
||||
/**
|
||||
* Set the type of the counter component.
|
||||
*
|
||||
* @type { CounterType }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
type: CounterType;
|
||||
|
||||
/**
|
||||
* Set the counter attribute of the LIST or COMPACT counter component.
|
||||
*
|
||||
* @type { ?NumberStyleOptions }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
numberOptions?: NumberStyleOptions;
|
||||
|
||||
/**
|
||||
* Set the counter attribute of the INLINE counter component.
|
||||
*
|
||||
* @type { ?InlineStyleOptions }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
inlineOptions?: InlineStyleOptions;
|
||||
|
||||
/**
|
||||
* Set the counter attribute of the INLINE_DATE counter component.
|
||||
*
|
||||
* @type { ?DateStyleOptions }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
dateOptions?: DateStyleOptions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines Counter Component.
|
||||
*
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
@Component
|
||||
declare struct CounterComponent {
|
||||
/**
|
||||
* The options of a counter component.
|
||||
*
|
||||
* @type { CounterOptions }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
@Prop
|
||||
options: CounterOptions;
|
||||
}
|
||||
|
||||
export {CounterComponent, CounterOptions, DateData, CounterType}
|
749
api/@ohos.arkui.advanced.SegmentButton.d.ets
Normal file
749
api/@ohos.arkui.advanced.SegmentButton.d.ets
Normal file
@ -0,0 +1,749 @@
|
||||
/*
|
||||
* Copyright (c) 2023 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.
|
||||
*/
|
||||
|
||||
/// <reference path="../component/units.d.ts" />
|
||||
|
||||
import { ResourceStr } from 'GlobalResource';
|
||||
|
||||
/**
|
||||
* Defines text only item of SegmentButton.
|
||||
*
|
||||
* @interface SegmentButtonTextItem
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
interface SegmentButtonTextItem {
|
||||
/**
|
||||
* The text of text only item.
|
||||
*
|
||||
* @type { ResourceStr }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
text: ResourceStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines icon only item of SegmentButton.
|
||||
*
|
||||
* @interface SegmentButtonIconItem
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
interface SegmentButtonIconItem {
|
||||
/**
|
||||
* The icon of icon only item.
|
||||
*
|
||||
* @type { ResourceStr }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
icon: ResourceStr;
|
||||
|
||||
/**
|
||||
* The icon of icon only item in the selected state.
|
||||
*
|
||||
* @type { ResourceStr }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
selectedIcon: ResourceStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines icon and text item of SegmentButton.
|
||||
*
|
||||
* @interface SegmentButtonIconTextItem
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
interface SegmentButtonIconTextItem {
|
||||
/**
|
||||
* The icon of icon and text item.
|
||||
*
|
||||
* @type { ResourceStr }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
icon: ResourceStr;
|
||||
|
||||
/**
|
||||
* The icon of icon and text item in the selected state.
|
||||
*
|
||||
* @type { ResourceStr }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
selectedIcon: ResourceStr;
|
||||
|
||||
/**
|
||||
* The text of icon and text item.
|
||||
*
|
||||
* @type { ResourceStr }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
text: ResourceStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines SegmentButton common options.
|
||||
*
|
||||
* @interface CommonSegmentButtonOptions
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
interface CommonSegmentButtonOptions {
|
||||
/**
|
||||
* The font color of buttons.
|
||||
*
|
||||
* @type { ?ResourceColor }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
fontColor?: ResourceColor;
|
||||
|
||||
/**
|
||||
* The font color of selected button.
|
||||
*
|
||||
* @type { ?ResourceColor }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
selectedFontColor?: ResourceColor;
|
||||
|
||||
/**
|
||||
* The font size of buttons.
|
||||
*
|
||||
* @type { ?Dimension }
|
||||
* @default $r('sys.float.ohos_id_text_size_body2')
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
fontSize?: Dimension;
|
||||
|
||||
/**
|
||||
* The font size of selected button.
|
||||
*
|
||||
* @type { ?Dimension }
|
||||
* @default $r('sys.float.ohos_id_text_size_body2')
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
selectedFontSize?: Dimension;
|
||||
|
||||
/**
|
||||
* The font weight of buttons.
|
||||
*
|
||||
* @type { ?FontWeight }
|
||||
* @default FontWeight.Regular
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
fontWeight?: FontWeight;
|
||||
|
||||
/**
|
||||
* The font weight of selected button.
|
||||
*
|
||||
* @type { ?FontWeight }
|
||||
* @default FontWeight.Medium
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
selectedFontWeight?: FontWeight;
|
||||
|
||||
/**
|
||||
* The background color of SegmentButton.
|
||||
*
|
||||
* @type { ?ResourceColor }
|
||||
* @default $r('sys.color.ohos_id_color_button_normal')
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
backgroundColor?: ResourceColor;
|
||||
|
||||
/**
|
||||
* The background color of selected button.
|
||||
*
|
||||
* @type { ?ResourceColor }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
selectedBackgroundColor?: ResourceColor;
|
||||
|
||||
/**
|
||||
* The image size of buttons.
|
||||
*
|
||||
* @type { ?SizeOptions }
|
||||
* @default SizeOptions { width: 24, height: 24 }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
imageSize?: SizeOptions;
|
||||
|
||||
/**
|
||||
* The margin of buttons.
|
||||
*
|
||||
* @type { ?Margin | Dimension }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
buttonMargin?: Margin | Dimension;
|
||||
|
||||
/**
|
||||
* The margin of text in button.
|
||||
*
|
||||
* @type { ?Margin | Dimension }
|
||||
* @default Margin { top: 4, right: 8, bottom: 4, left: 8 }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
textMargin?: Margin | Dimension;
|
||||
}
|
||||
|
||||
declare type SegmentButtonItemArray = Array<SegmentButtonTextItem> | Array<SegmentButtonIconItem> | Array<SegmentButtonIconTextItem>;
|
||||
|
||||
/**
|
||||
* Defines SegmentButton tab options.
|
||||
*
|
||||
* @interface TabSegmentButtonConstructionOptions
|
||||
* @extends CommonSegmentButtonOptions
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
interface TabSegmentButtonConstructionOptions extends CommonSegmentButtonOptions {
|
||||
/**
|
||||
* The items of tab type of SegmentButton.
|
||||
*
|
||||
* @type { Array<SegmentButtonTextItem> }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
buttons: Array<SegmentButtonTextItem>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines SegmentButton capsule options.
|
||||
*
|
||||
* @interface CapsuleSegmentButtonConstructionOptions
|
||||
* @extends CommonSegmentButtonOptions
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
interface CapsuleSegmentButtonConstructionOptions extends CommonSegmentButtonOptions {
|
||||
/**
|
||||
* The items of capsule type of SegmentButton.
|
||||
*
|
||||
* @type { SegmentButtonItemArray }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
buttons: SegmentButtonItemArray;
|
||||
|
||||
/**
|
||||
* Support multiple selections flag.
|
||||
*
|
||||
* @type { ?boolean }
|
||||
* @default false
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
multiply?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the type of SegmentButton options of tab type.
|
||||
*
|
||||
* @interface TabSegmentButtonOptions
|
||||
* @extends TabSegmentButtonConstructionOptions
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
interface TabSegmentButtonOptions extends TabSegmentButtonConstructionOptions {
|
||||
/**
|
||||
* The type of SegmentButton.
|
||||
*
|
||||
* @type { "tab" }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
type: "tab";
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the type of SegmentButton options of capsule type.
|
||||
*
|
||||
* @interface CapsuleSegmentButtonOptions
|
||||
* @extends CapsuleSegmentButtonConstructionOptions
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
interface CapsuleSegmentButtonOptions extends CapsuleSegmentButtonConstructionOptions {
|
||||
/**
|
||||
* The type of SegmentButton.
|
||||
*
|
||||
* @type { "capsule" }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
type: "capsule";
|
||||
|
||||
/**
|
||||
* The items of SegmentButton.
|
||||
*
|
||||
* @type { SegmentButtonItemArray }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
buttons: SegmentButtonItemArray;
|
||||
|
||||
/**
|
||||
* Support multiple selections flag.
|
||||
*
|
||||
* @type { ?boolean }
|
||||
* @default false
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
multiply?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct parameter types for SegmentButtonItemOptions.
|
||||
*
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
interface SegmentButtonItemOptionsConstructorOptions {
|
||||
/**
|
||||
* The icon of icon and text item.
|
||||
*
|
||||
* @type { ?ResourceStr }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
icon?: ResourceStr;
|
||||
|
||||
/**
|
||||
* The icon of icon and text item in the selected state.
|
||||
*
|
||||
* @type { ?ResourceStr }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
selectedIcon?: ResourceStr;
|
||||
|
||||
/**
|
||||
* The text of icon and text item.
|
||||
*
|
||||
* @type { ?ResourceStr }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
text?: ResourceStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* The options for SegmentButton items.
|
||||
*
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
@Observed
|
||||
declare class SegmentButtonItemOptions {
|
||||
/**
|
||||
* The icon of item.
|
||||
*
|
||||
* @type { ?ResourceStr }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
icon?: ResourceStr;
|
||||
|
||||
/**
|
||||
* The icon of selected item.
|
||||
*
|
||||
* @type { ?ResourceStr }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
selectedIcon?: ResourceStr;
|
||||
|
||||
/**
|
||||
* The text of item.
|
||||
*
|
||||
* @type { ?ResourceStr }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
text?: ResourceStr;
|
||||
|
||||
/**
|
||||
* The constructor used to create a SegmentButtonOptionsArray object.
|
||||
*
|
||||
* @param { SegmentButtonItemOptionsConstructorOptions } options - item info.
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
constructor(options: SegmentButtonItemOptionsConstructorOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* The class for SegmentButton item options array.
|
||||
*
|
||||
* @extends Array<SegmentButtonItemOptions>
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
@Observed
|
||||
declare class SegmentButtonItemOptionsArray extends Array<SegmentButtonItemOptions> {
|
||||
/**
|
||||
* The constructor used to create a SegmentButtonItemOptionsArray object.
|
||||
*
|
||||
* @param { SegmentButtonItemArray } elements - The SegmentButton items.
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
constructor(elements: SegmentButtonItemArray);
|
||||
|
||||
/**
|
||||
* Appends new elements to the end of SegmentButtonItemOptionsArray.
|
||||
*
|
||||
* @param { SegmentButtonItemArray } items - New elements to add to SegmentButtonItemOptionsArray.
|
||||
* @returns { number } Returns the new length of SegmentButtonItemOptionsArray.
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
push(...items: SegmentButtonItemArray): number;
|
||||
|
||||
/**
|
||||
* Removes the last element from SegmentButtonItemOptionsArray.
|
||||
*
|
||||
* @returns { SegmentButtonItemOptions | undefined } Returns the new SegmentButtonItemOptionsArray.
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
pop(): SegmentButtonItemOptions | undefined;
|
||||
|
||||
/**
|
||||
* Removes the first element from SegmentButtonItemOptionsArray.
|
||||
*
|
||||
* @returns { SegmentButtonItemOptions | undefined } Returns the new SegmentButtonItemOptionsArray.
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
shift(): SegmentButtonItemOptions | undefined;
|
||||
|
||||
/**
|
||||
* Appends new elements to the start of SegmentButtonItemOptionsArray.
|
||||
*
|
||||
* @param { SegmentButtonItemArray } items - New elements to add to SegmentButtonItemOptionsArray.
|
||||
* @returns { number } Returns the new length of SegmentButtonItemOptionsArray.
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
unshift(...items: SegmentButtonItemArray): number;
|
||||
|
||||
/**
|
||||
* Changes the elements of SegmentButtonItemOptionsArray by removing or replacing existing elements and/or adding new elements in place.
|
||||
*
|
||||
* @param { number } start - The zero-based location in the array from which to start removing elements.
|
||||
* @param { number } deleteCount - The number of elements to remove.
|
||||
* @param { SegmentButtonItemOptions[] } items - Elements to insert into the array in place of the deleted elements.
|
||||
* @returns { SegmentButtonItemOptions[] } Returns the new SegmentButtonItemOptions array.
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
splice(start: number, deleteCount: number, ...items: SegmentButtonItemOptions[]): SegmentButtonItemOptions[];
|
||||
|
||||
/**
|
||||
* The function used to create a SegmentButtonItemOptionsArray object.
|
||||
*
|
||||
* @param { SegmentButtonItemArray } elements - The SegmentButton items.
|
||||
* @returns { SegmentButtonItemOptionsArray } Returns the a new SegmentButtonItemOptionsArray object.
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
static create(elements: SegmentButtonItemArray): SegmentButtonItemOptionsArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* The class for SegmentButton options.
|
||||
*
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
@Observed
|
||||
declare class SegmentButtonOptions {
|
||||
/**
|
||||
* The type of SegmentButton.
|
||||
*
|
||||
* @type { "tab" | "capsule" }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
type: "tab" | "capsule";
|
||||
|
||||
/**
|
||||
* The support multiple selections flag of SegmentButton.
|
||||
*
|
||||
* @type { boolean }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
multiply: boolean;
|
||||
|
||||
/**
|
||||
* The buttons information of SegmentButton.
|
||||
*
|
||||
* @type { SegmentButtonOptionsArray }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
buttons: SegmentButtonItemOptionsArray;
|
||||
|
||||
/**
|
||||
* The font color of buttons.
|
||||
*
|
||||
* @type { ResourceColor }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
fontColor: ResourceColor;
|
||||
|
||||
/**
|
||||
* The font color of selected button.
|
||||
*
|
||||
* @type { ResourceColor }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
selectedFontColor: ResourceColor;
|
||||
|
||||
/**
|
||||
* The font size of buttons.
|
||||
*
|
||||
* @type { Dimension }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
fontSize: Dimension;
|
||||
|
||||
/**
|
||||
* The font size of selected button.
|
||||
*
|
||||
* @type { Dimension }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
selectedFontSize: Dimension;
|
||||
|
||||
/**
|
||||
* The font weight of buttons.
|
||||
*
|
||||
* @type { FontWeight }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
fontWeight: FontWeight;
|
||||
|
||||
/**
|
||||
* The font weight of selected button.
|
||||
*
|
||||
* @type { FontWeight }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
selectedFontWeight: FontWeight;
|
||||
|
||||
/**
|
||||
* The background color of SegmentButton.
|
||||
*
|
||||
* @type { ResourceColor }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
backgroundColor: ResourceColor;
|
||||
|
||||
/**
|
||||
* The background color of selected button.
|
||||
*
|
||||
* @type { ResourceColor }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
selectedBackgroundColor: ResourceColor;
|
||||
|
||||
/**
|
||||
* The image size of buttons.
|
||||
*
|
||||
* @type { SizeOptions }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
imageSize: SizeOptions;
|
||||
|
||||
/**
|
||||
* The margin of buttons.
|
||||
*
|
||||
* @type { Margin | Dimension }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
buttonMargin: Margin | Dimension;
|
||||
|
||||
/**
|
||||
* The margin of text in button.
|
||||
*
|
||||
* @type { Margin | Dimension }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
textMargin: Margin | Dimension;
|
||||
|
||||
/**
|
||||
* The constructor used to create a SegmentButtonOptions object.
|
||||
*
|
||||
* @param { TabSegmentButtonOptions | CapsuleSegmentButtonOptions } options - The options of SegmentButton.
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
constructor(options: TabSegmentButtonOptions | CapsuleSegmentButtonOptions);
|
||||
|
||||
/**
|
||||
* The function used to create a SegmentButtonOptions of tab type.
|
||||
*
|
||||
* @param { TabSegmentButtonConstructionOptions } options - The options of SegmentButton.
|
||||
* @returns { SegmentButtonOptions } Returns the a new SegmentButtonOptions object of tab type.
|
||||
* @static
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
static tab(options: TabSegmentButtonConstructionOptions): SegmentButtonOptions;
|
||||
|
||||
/**
|
||||
* The function used to create a SegmentButtonOptions of capsule type.
|
||||
*
|
||||
* @param { CapsuleSegmentButtonConstructionOptions } options - The options of SegmentButton.
|
||||
* @returns { SegmentButtonOptions } Returns the a new SegmentButtonOptions object of capsule type.
|
||||
* @static
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
static capsule(options: CapsuleSegmentButtonConstructionOptions): SegmentButtonOptions;
|
||||
}
|
||||
|
||||
|
||||
@Component
|
||||
declare struct SegmentButton {
|
||||
/**
|
||||
* The options of SegmentButton.
|
||||
*
|
||||
* @type { SegmentButtonOptions }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
@ObjectLink
|
||||
options: SegmentButtonOptions;
|
||||
|
||||
/**
|
||||
* The selectedIndex.
|
||||
*
|
||||
* @type { number[] }
|
||||
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
||||
* @crossplatform
|
||||
* @since 11
|
||||
*/
|
||||
@Link
|
||||
selectedIndexes: number[];
|
||||
}
|
||||
|
||||
export {
|
||||
SegmentButton,
|
||||
SegmentButtonOptions,
|
||||
SegmentButtonItemOptionsArray,
|
||||
TabSegmentButtonOptions,
|
||||
TabSegmentButtonConstructionOptions,
|
||||
CapsuleSegmentButtonOptions,
|
||||
CapsuleSegmentButtonConstructionOptions
|
||||
};
|
16
api/@ohos.brightness.d.ts
vendored
16
api/@ohos.brightness.d.ts
vendored
@ -36,5 +36,21 @@ declare namespace brightness {
|
||||
* @since 7
|
||||
*/
|
||||
function setValue(value: number): void;
|
||||
|
||||
/**
|
||||
* Sets the screen brightness.
|
||||
*
|
||||
* @param { number } value - Brightness value, ranging from 0 to 255.
|
||||
* @param { boolean } continuous - This parameter is used in the scenario of continuous adjustment to the brightness.
|
||||
* You are advised to set this parameter to true during the continuous adjustment and
|
||||
* to false at the end of the continuous adjustment for better performance.
|
||||
* @throws { BusinessError } 202 - If the system permission is denied.
|
||||
* @throws { BusinessError } 401 - If the value is not valid.
|
||||
* @throws { BusinessError } 4700101 - If connecting to the service failed.
|
||||
* @syscap SystemCapability.PowerManager.DisplayPowerManager
|
||||
* @systemapi
|
||||
* @since 11
|
||||
*/
|
||||
function setValue(value: number, continuous: boolean): void;
|
||||
}
|
||||
export default brightness;
|
||||
|
64
api/@ohos.bundle.bundleManager.d.ts
vendored
64
api/@ohos.bundle.bundleManager.d.ts
vendored
@ -769,6 +769,25 @@ declare namespace bundleManager {
|
||||
BACKWARD_COMPATIBILITY = 1
|
||||
}
|
||||
|
||||
/**
|
||||
* This enumeration value is used to identify various types of JSON profile.
|
||||
*
|
||||
* @enum { number }
|
||||
* @syscap SystemCapability.BundleManager.BundleFramework.Core
|
||||
* @systemapi
|
||||
* @since 11
|
||||
*/
|
||||
export enum ProfileType {
|
||||
/**
|
||||
* Indicates JSON profile about intent framework.
|
||||
*
|
||||
* @syscap SystemCapability.BundleManager.BundleFramework.Core
|
||||
* @systemapi
|
||||
* @since 11
|
||||
*/
|
||||
INTENT_PROFILE = 1
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains own bundleInfo.
|
||||
*
|
||||
@ -1200,6 +1219,30 @@ declare namespace bundleManager {
|
||||
function queryExtensionAbilityInfoSync(want: Want, extensionAbilityType: ExtensionAbilityType,
|
||||
extensionAbilityFlags: number, userId?: number): Array<ExtensionAbilityInfo>;
|
||||
|
||||
/**
|
||||
* Query the ExtensionAbilityInfo by the given Want. ohos.permission.GET_BUNDLE_INFO_PRIVILEGED is required for cross user access.
|
||||
*
|
||||
* @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO
|
||||
* @param { Want } want - Indicates the Want containing the application bundle name to be queried.
|
||||
* @param { string } extensionAbilityType - Indicates extensionAbilityType.
|
||||
* @param { number } extensionAbilityFlags - Indicates the flag used to specify information contained in the
|
||||
* ExtensionAbilityInfo objects that will be returned.
|
||||
* @param { number } userId - Indicates the user ID.
|
||||
* @returns { Array<ExtensionAbilityInfo> } Returns a list of ExtensionAbilityInfo objects.
|
||||
* @throws { BusinessError } 201 - Permission denied.
|
||||
* @throws { BusinessError } 202 - Permission denied, non-system app called system api.
|
||||
* @throws { BusinessError } 401 - The parameter check failed.
|
||||
* @throws { BusinessError } 17700001 - The specified bundleName is not found.
|
||||
* @throws { BusinessError } 17700003 - The specified extensionAbility is not found.
|
||||
* @throws { BusinessError } 17700004 - The specified userId is invalid.
|
||||
* @throws { BusinessError } 17700026 - The specified bundle is disabled.
|
||||
* @syscap SystemCapability.BundleManager.BundleFramework.Core
|
||||
* @systemapi
|
||||
* @since 11
|
||||
*/
|
||||
function queryExtensionAbilityInfoSync(want: Want, extensionAbilityType: string,
|
||||
extensionAbilityFlags: number, userId?: number): Array<ExtensionAbilityInfo>;
|
||||
|
||||
/**
|
||||
* Obtains bundle name by the given uid.
|
||||
*
|
||||
@ -2070,6 +2113,27 @@ declare namespace bundleManager {
|
||||
*/
|
||||
function getAdditionalInfo(bundleName: string): string;
|
||||
|
||||
/**
|
||||
* Obtains the JSON profile designated by profileType, bundleName and moduleName.
|
||||
*
|
||||
* @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO
|
||||
* @param { ProfileType } profileType - Indicates the type of profile to be obtained.
|
||||
* @param { string } bundleName - Indicates the name of the bundle to which the profile belongs.
|
||||
* @param { string } moduleName - Indicates the name of the module to which the profile belongs.
|
||||
* @returns { string } Returns string in json-format of the designated profile.
|
||||
* @throws { BusinessError } 201 - Permission denied.
|
||||
* @throws { BusinessError } 202 - Permission denied, non-system app called system api.
|
||||
* @throws { BusinessError } 401 - The parameter check failed.
|
||||
* @throws { BusinessError } 17700001 - The specified bundleName is not found.
|
||||
* @throws { BusinessError } 17700002 - The specified moduleName is not found.
|
||||
* @throws { BusinessError } 17700024 - Failed to get the profile because the specified profile is not found in the HAP.
|
||||
* @throws { BusinessError } 17700026 - The specified bundle is disabled.
|
||||
* @syscap SystemCapability.BundleManager.BundleFramework.Core
|
||||
* @systemapi
|
||||
* @since 11
|
||||
*/
|
||||
function getJsonProfile(profileType: ProfileType, bundleName: string, moduleName?: string): string;
|
||||
|
||||
/**
|
||||
* Obtains configuration information about an application.
|
||||
*
|
||||
|
41
api/@ohos.calendarManager.d.ts
vendored
41
api/@ohos.calendarManager.d.ts
vendored
@ -13,6 +13,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { AsyncCallback } from './@ohos.base';
|
||||
import type Context from './application/Context';
|
||||
|
||||
/**
|
||||
* This provides calendar data access abilities.
|
||||
* @namespace calendarManager
|
||||
@ -20,6 +23,25 @@
|
||||
* @since 10
|
||||
*/
|
||||
declare namespace calendarManager {
|
||||
/**
|
||||
* Returns an instance of CalendarManager
|
||||
*
|
||||
* @param { Context } context - Hap context information
|
||||
* @returns { CalendarManager } Instance of CalendarManager
|
||||
* @syscap SystemCapability.Applications.CalendarData
|
||||
* @StageModelOnly
|
||||
* @since 10
|
||||
*/
|
||||
function getCalendarManager(context: Context) : CalendarManager;
|
||||
|
||||
/**
|
||||
* Defines the CalendarManager class and provides functions to access the calendar data.
|
||||
*
|
||||
* @interface CalendarManager
|
||||
* @syscap SystemCapability.Applications.CalendarData
|
||||
* @since 10
|
||||
*/
|
||||
export interface CalendarManager {
|
||||
/**
|
||||
* Create calendar instance.
|
||||
* @permission ohos.permission.WRITE_CALENDAR or ohos.permission.WRITE_WHOLE_CALENDAR
|
||||
@ -31,7 +53,7 @@ declare namespace calendarManager {
|
||||
* @syscap SystemCapability.Applications.CalendarData
|
||||
* @since 10
|
||||
*/
|
||||
function createCalendar(calendarAccount: CalendarAccount): Promise<Calendar>;
|
||||
createCalendar(calendarAccount: CalendarAccount): Promise<Calendar>;
|
||||
|
||||
/**
|
||||
* Create calendar instance.
|
||||
@ -45,7 +67,7 @@ declare namespace calendarManager {
|
||||
* @syscap SystemCapability.Applications.CalendarData
|
||||
* @since 10
|
||||
*/
|
||||
function createCalendar(calendarAccount: CalendarAccount, callback: AsyncCallback<Calendar>): void;
|
||||
createCalendar(calendarAccount: CalendarAccount, callback: AsyncCallback<Calendar>): void;
|
||||
|
||||
/**
|
||||
* Delete calendar instance.
|
||||
@ -59,7 +81,7 @@ declare namespace calendarManager {
|
||||
* @syscap SystemCapability.Applications.CalendarData
|
||||
* @since 10
|
||||
*/
|
||||
function deleteCalendar(calendar: Calendar): Promise<void>;
|
||||
deleteCalendar(calendar: Calendar): Promise<void>;
|
||||
|
||||
/**
|
||||
* Delete calendar instance.
|
||||
@ -73,7 +95,7 @@ declare namespace calendarManager {
|
||||
* @syscap SystemCapability.Applications.CalendarData
|
||||
* @since 10
|
||||
*/
|
||||
function deleteCalendar(calendar: Calendar, callback: AsyncCallback<void>): void;
|
||||
deleteCalendar(calendar: Calendar, callback: AsyncCallback<void>): void;
|
||||
|
||||
/**
|
||||
* Get calendar instance from database.
|
||||
@ -87,7 +109,7 @@ declare namespace calendarManager {
|
||||
* @syscap SystemCapability.Applications.CalendarData
|
||||
* @since 10
|
||||
*/
|
||||
function getCalendar(calendarAccount?: CalendarAccount): Promise<Calendar>;
|
||||
getCalendar(calendarAccount?: CalendarAccount): Promise<Calendar>;
|
||||
|
||||
/**
|
||||
* Get calendar instance from database by specified account.
|
||||
@ -101,7 +123,7 @@ declare namespace calendarManager {
|
||||
* @syscap SystemCapability.Applications.CalendarData
|
||||
* @since 10
|
||||
*/
|
||||
function getCalendar(calendarAccount: CalendarAccount, callback: AsyncCallback<Calendar>): void;
|
||||
getCalendar(calendarAccount: CalendarAccount, callback: AsyncCallback<Calendar>): void;
|
||||
|
||||
/**
|
||||
* Get default calendar instance from database.
|
||||
@ -114,7 +136,7 @@ declare namespace calendarManager {
|
||||
* @syscap SystemCapability.Applications.CalendarData
|
||||
* @since 10
|
||||
*/
|
||||
function getCalendar(callback: AsyncCallback<Calendar>): void;
|
||||
getCalendar(callback: AsyncCallback<Calendar>): void;
|
||||
|
||||
/**
|
||||
* Get all calendar instance.
|
||||
@ -127,7 +149,7 @@ declare namespace calendarManager {
|
||||
* @syscap SystemCapability.Applications.CalendarData
|
||||
* @since 10
|
||||
*/
|
||||
function getAllCalendars(): Promise<Calendar[]>;
|
||||
getAllCalendars(): Promise<Calendar[]>;
|
||||
|
||||
/**
|
||||
* Get all calendar instance.
|
||||
@ -140,7 +162,8 @@ declare namespace calendarManager {
|
||||
* @syscap SystemCapability.Applications.CalendarData
|
||||
* @since 10
|
||||
*/
|
||||
function getAllCalendars(callback: AsyncCallback<Calendar[]>): void;
|
||||
getAllCalendars(callback: AsyncCallback<Calendar[]>): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Describes a calendar instance.
|
||||
|
31
api/@ohos.commonEventManager.d.ts
vendored
31
api/@ohos.commonEventManager.d.ts
vendored
@ -1810,7 +1810,36 @@ declare namespace commonEventManager {
|
||||
* @syscap SystemCapability.Notification.CommonEvent
|
||||
* @since 10
|
||||
*/
|
||||
COMMON_EVENT_SCREEN_LOCKED = 'usual.event.SCREEN_LOCKED'
|
||||
COMMON_EVENT_SCREEN_LOCKED = 'usual.event.SCREEN_LOCKED',
|
||||
|
||||
/**
|
||||
* Indicates the action of a common event that the network connectivity changed.
|
||||
* This is a protected common event that can only be sent by system.
|
||||
*
|
||||
* @syscap SystemCapability.Notification.CommonEvent
|
||||
* @since 10
|
||||
*/
|
||||
COMMON_EVENT_CONNECTIVITY_CHANGE = 'usual.event.CONNECTIVITY_CHANGE',
|
||||
|
||||
/**
|
||||
* Indicates the action of a common event that special number has been entered by dialer
|
||||
* This is a protected common event that can only be sent by system.
|
||||
*
|
||||
* @syscap SystemCapability.Notification.CommonEvent
|
||||
* @systemapi
|
||||
* @since 10
|
||||
*/
|
||||
COMMON_EVENT_SPECIAL_CODE = 'common.event.SPECIAL_CODE',
|
||||
|
||||
/**
|
||||
* Indicates the action of a common event that audio quality change.
|
||||
* This is a protected common event that can only be sent by system.
|
||||
*
|
||||
* @syscap SystemCapability.Notification.CommonEvent
|
||||
* @systemapi
|
||||
* @since 10
|
||||
*/
|
||||
COMMON_EVENT_AUDIO_QUALITY_CHANGE = 'usual.event.AUDIO_QUALITY_CHANGE'
|
||||
}
|
||||
|
||||
/**
|
||||
|
660
api/@ohos.file.photoAccessHelper.d.ts
vendored
660
api/@ohos.file.photoAccessHelper.d.ts
vendored
File diff suppressed because it is too large
Load Diff
9
api/@ohos.hichecker.d.ts
vendored
9
api/@ohos.hichecker.d.ts
vendored
@ -57,6 +57,15 @@ declare namespace hichecker {
|
||||
*/
|
||||
const RULE_CHECK_ABILITY_CONNECTION_LEAK: 8589934592n; // 1 << 33
|
||||
|
||||
/**
|
||||
* The process rule check ability Arkui performance
|
||||
*
|
||||
* @constant
|
||||
* @syscap SystemCapability.HiviewDFX.HiChecker
|
||||
* @since 11
|
||||
*/
|
||||
const RULE_CHECK_ARKUI_PERFORMANCE: 17179869184n; // 1 << 34
|
||||
|
||||
/**
|
||||
* add one or more rule.
|
||||
*
|
||||
|
58
api/@ohos.identifier.oaid.d.ts
vendored
Normal file
58
api/@ohos.identifier.oaid.d.ts
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (c) 2023 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 type { AsyncCallback } from './@ohos.base';
|
||||
|
||||
/**
|
||||
* Provides the capability to manage OAID.
|
||||
* @namespace identifier
|
||||
* @syscap SystemCapability.Advertising.OAID
|
||||
* @since 10
|
||||
*/
|
||||
declare namespace identifier {
|
||||
/**
|
||||
* Obtain the OAID with callback.
|
||||
* Obtaining OAID requires the permission:ohos.permission.APP_TRACKING_CONSENT, or the obtained OAID is empty.
|
||||
* @permission ohos.permission.APP_TRACKING_CONSENT
|
||||
* @param { AsyncCallback<string> } callback - The callback to get the OAID.
|
||||
* @throws { BusinessError } 17300001 - System internal error.
|
||||
* @syscap SystemCapability.Advertising.OAID
|
||||
* @since 10
|
||||
*/
|
||||
function getOAID(callback: AsyncCallback<string>): void;
|
||||
|
||||
/**
|
||||
* Obtain the OAID asynchronously.
|
||||
* Obtaining OAID requires the permission:ohos.permission.APP_TRACKING_CONSENT, or the obtained OAID is empty.
|
||||
* @permission ohos.permission.APP_TRACKING_CONSENT
|
||||
* @returns { Promise<string> } Returns the OAID.
|
||||
* @throws { BusinessError } 17300001 - System internal error.
|
||||
* @syscap SystemCapability.Advertising.OAID
|
||||
* @since 10
|
||||
*/
|
||||
function getOAID(): Promise<string>;
|
||||
|
||||
/**
|
||||
* Reset the OAID.
|
||||
* A new OAID will be generated after reset.
|
||||
* @throws { BusinessError } 17300001 - System internal error.
|
||||
* @syscap SystemCapability.Advertising.OAID
|
||||
* @systemapi
|
||||
* @since 10
|
||||
*/
|
||||
function resetOAID(): void;
|
||||
}
|
||||
export default identifier;
|
||||
|
86
api/@ohos.multimedia.avsession.d.ts
vendored
86
api/@ohos.multimedia.avsession.d.ts
vendored
@ -865,6 +865,16 @@ declare namespace avSession {
|
||||
*/
|
||||
getOutputDevice(): Promise<OutputDeviceInfo>;
|
||||
|
||||
/**
|
||||
* Get output device information
|
||||
* @returns { OutputDeviceInfo } the OutputDeviceInfo
|
||||
* @throws { BusinessError } 6600101 - Session service exception.
|
||||
* @throws { BusinessError } 6600102 - The session does not exist.
|
||||
* @syscap SystemCapability.Multimedia.AVSession.Core
|
||||
* @since 10
|
||||
*/
|
||||
getOutputDeviceSync(): OutputDeviceInfo;
|
||||
|
||||
/**
|
||||
* Register play command callback.
|
||||
* As long as it is registered, it means that the ability supports this command.
|
||||
@ -2489,6 +2499,17 @@ declare namespace avSession {
|
||||
*/
|
||||
getAVPlaybackState(): Promise<AVPlaybackState>;
|
||||
|
||||
/**
|
||||
* Get the playback status of the current session
|
||||
* @returns { AVPlaybackState } (AVPlaybackState) returned
|
||||
* @throws { BusinessError } 6600101 - Session service exception.
|
||||
* @throws { BusinessError } 6600102 - The session does not exist.
|
||||
* @throws { BusinessError } 6600103 - The session controller does not exist.
|
||||
* @syscap SystemCapability.Multimedia.AVSession.Core
|
||||
* @since 10
|
||||
*/
|
||||
getAVPlaybackStateSync(): AVPlaybackState;
|
||||
|
||||
/**
|
||||
* Get the metadata of the current session
|
||||
* @param { AsyncCallback<AVMetadata> } callback - The triggered asyncCallback when (getAVMetadata).
|
||||
@ -2511,6 +2532,17 @@ declare namespace avSession {
|
||||
*/
|
||||
getAVMetadata(): Promise<AVMetadata>;
|
||||
|
||||
/**
|
||||
* Get the metadata of the current session
|
||||
* @returns { AVMetadata } (AVMetadata) returned
|
||||
* @throws { BusinessError } 6600101 - Session service exception.
|
||||
* @throws { BusinessError } 6600102 - The session does not exist.
|
||||
* @throws { BusinessError } 6600103 - The session controller does not exist.
|
||||
* @syscap SystemCapability.Multimedia.AVSession.Core
|
||||
* @since 10
|
||||
*/
|
||||
getAVMetadataSync(): AVMetadata;
|
||||
|
||||
/**
|
||||
* Get the name of the playlist of the current session
|
||||
* @param { AsyncCallback<string> } callback - The triggered asyncCallback when (getAVQueueTitle).
|
||||
@ -2533,6 +2565,17 @@ declare namespace avSession {
|
||||
*/
|
||||
getAVQueueTitle(): Promise<string>;
|
||||
|
||||
/**
|
||||
* Get the name of the playlist of the current session
|
||||
* @returns { string } (string) returned
|
||||
* @throws { BusinessError } 6600101 - Session service exception.
|
||||
* @throws { BusinessError } 6600102 - The session does not exist.
|
||||
* @throws { BusinessError } 6600103 - The session controller does not exist.
|
||||
* @syscap SystemCapability.Multimedia.AVSession.Core
|
||||
* @since 10
|
||||
*/
|
||||
getAVQueueTitleSync(): string;
|
||||
|
||||
/**
|
||||
* Get the playlist of the current session
|
||||
* @param { AsyncCallback<Array<AVQueueItem>> } callback - The triggered asyncCallback when (getAVQueueItems).
|
||||
@ -2555,6 +2598,17 @@ declare namespace avSession {
|
||||
*/
|
||||
getAVQueueItems(): Promise<Array<AVQueueItem>>;
|
||||
|
||||
/**
|
||||
* Get the playlist of the current session
|
||||
* @returns { Array<AVQueueItem> } (Array<AVQueueItem>) returned
|
||||
* @throws { BusinessError } 6600101 - Session service exception.
|
||||
* @throws { BusinessError } 6600102 - The session does not exist.
|
||||
* @throws { BusinessError } 6600103 - The session controller does not exist.
|
||||
* @syscap SystemCapability.Multimedia.AVSession.Core
|
||||
* @since 10
|
||||
*/
|
||||
getAVQueueItemsSync(): Array<AVQueueItem>;
|
||||
|
||||
/**
|
||||
* Set the item in the playlist to be played
|
||||
* @param { number } itemId - The serial number of the item to be played
|
||||
@ -2601,6 +2655,16 @@ declare namespace avSession {
|
||||
*/
|
||||
getOutputDevice(): Promise<OutputDeviceInfo>;
|
||||
|
||||
/**
|
||||
* Get output device information
|
||||
* @returns { OutputDeviceInfo } (OutputDeviceInfo) returned
|
||||
* @throws { BusinessError } 6600101 - Session service exception.
|
||||
* @throws { BusinessError } 6600103 - The session controller does not exist.
|
||||
* @syscap SystemCapability.Multimedia.AVSession.Core
|
||||
* @since 10
|
||||
*/
|
||||
getOutputDeviceSync(): OutputDeviceInfo;
|
||||
|
||||
/**
|
||||
* Send media key event to this session
|
||||
* @param { KeyEvent } event - The KeyEvent
|
||||
@ -2686,6 +2750,17 @@ declare namespace avSession {
|
||||
*/
|
||||
isActive(): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Check if the current session is active
|
||||
* @returns { boolean } boolean
|
||||
* @throws { BusinessError } 6600101 - Session service exception.
|
||||
* @throws { BusinessError } 6600102 - The session does not exist.
|
||||
* @throws { BusinessError } 6600103 - The session controller does not exist.
|
||||
* @syscap SystemCapability.Multimedia.AVSession.Core
|
||||
* @since 10
|
||||
*/
|
||||
isActiveSync(): boolean;
|
||||
|
||||
/**
|
||||
* Destroy the server controller
|
||||
* @param { AsyncCallback<void> } callback - The asyncCallback triggered when the command is executed successfully.
|
||||
@ -2728,6 +2803,17 @@ declare namespace avSession {
|
||||
*/
|
||||
getValidCommands(): Promise<Array<AVControlCommandType>>;
|
||||
|
||||
/**
|
||||
* Get commands supported by the current session
|
||||
* @returns {Array<AVControlCommandType> } array of AVControlCommandType
|
||||
* @throws { BusinessError } 6600101 - Session service exception.
|
||||
* @throws { BusinessError } 6600102 - The session does not exist.
|
||||
* @throws { BusinessError } 6600103 - The session controller does not exist.
|
||||
* @syscap SystemCapability.Multimedia.AVSession.Core
|
||||
* @since 10
|
||||
*/
|
||||
getValidCommandsSync(): Array<AVControlCommandType>;
|
||||
|
||||
/**
|
||||
* Send control commands to this session
|
||||
* @param { AVControlCommand } command - The command to be sent. See {@link AVControlCommand}
|
||||
|
2
api/@ohos.net.vpn.d.ts
vendored
2
api/@ohos.net.vpn.d.ts
vendored
@ -32,8 +32,10 @@ declare namespace vpn {
|
||||
* Create a VPN connection using the AbilityContext.
|
||||
* @param { AbilityContext } context - Indicates the context of application or capability.
|
||||
* @returns { VpnConnection } the VpnConnection of the construct VpnConnection instance.
|
||||
* @throws { BusinessError } 202 - Non-system applications use system APIs.
|
||||
* @throws { BusinessError } 401 - Parameter error.
|
||||
* @syscap SystemCapability.Communication.NetManager.Vpn
|
||||
* @systemapi Hide this for inner system use.
|
||||
* @since 10
|
||||
*/
|
||||
function createVpnConnection(context: AbilityContext): VpnConnection;
|
||||
|
4
api/@ohos.notification.d.ts
vendored
4
api/@ohos.notification.d.ts
vendored
@ -312,7 +312,7 @@ declare namespace notification {
|
||||
function removeSlot(slotType: SlotType, callback: AsyncCallback<void>): void;
|
||||
|
||||
/**
|
||||
* Obtains all NotificationSlot objects created by the current application.
|
||||
* Removes a NotificationSlot of the specified SlotType created by the current application.
|
||||
*
|
||||
* @param { SlotType } slotType - The types of notification channels are currently divided into social communication,
|
||||
* service reminders, content consulting, and other types
|
||||
@ -387,7 +387,7 @@ declare namespace notification {
|
||||
SERVICE_INFORMATION = 2,
|
||||
|
||||
/**
|
||||
* NotificationSlot for service information.
|
||||
* NotificationSlot for content information.
|
||||
*
|
||||
* @syscap SystemCapability.Notification.Notification
|
||||
* @since 7
|
||||
|
10
api/@ohos.privacyManager.d.ts
vendored
10
api/@ohos.privacyManager.d.ts
vendored
@ -688,6 +688,16 @@ declare namespace privacyManager {
|
||||
*/
|
||||
timestamp: number;
|
||||
|
||||
/**
|
||||
* The value of successCount or failCount passed in to addPermissionUsedRecord.
|
||||
*
|
||||
* @type { ?number }
|
||||
* @syscap SystemCapability.Security.AccessToken
|
||||
* @systemapi
|
||||
* @since 11
|
||||
*/
|
||||
count?: number;
|
||||
|
||||
/**
|
||||
* Access duration, in milliseconds
|
||||
*
|
||||
|
32
api/@ohos.request.d.ts
vendored
32
api/@ohos.request.d.ts
vendored
@ -1897,6 +1897,38 @@ declare namespace request {
|
||||
* @since 10
|
||||
*/
|
||||
method: string;
|
||||
/**
|
||||
* The index of paths for a task.
|
||||
* Usually used for a continuous job.
|
||||
* The default is 0.
|
||||
*
|
||||
* @type { ?number }
|
||||
* @syscap SystemCapability.Request.FileTransferAgent
|
||||
* @since 11
|
||||
*/
|
||||
index?: number;
|
||||
/**
|
||||
* The start point of a file.
|
||||
* Usually used for a continuous job.
|
||||
* It will start read at the point in upload.
|
||||
* The default is 0.
|
||||
*
|
||||
* @type { ?number }
|
||||
* @syscap SystemCapability.Request.FileTransferAgent
|
||||
* @since 11
|
||||
*/
|
||||
begins?: number;
|
||||
/**
|
||||
* The end point of a file.
|
||||
* Usually used for a continuous job.
|
||||
* It will end read at the point in upload.
|
||||
* The default is -1 indicating the end of the data for upload.
|
||||
*
|
||||
* @type { ?number }
|
||||
* @syscap SystemCapability.Request.FileTransferAgent
|
||||
* @since 11
|
||||
*/
|
||||
ends?: number;
|
||||
/**
|
||||
* A list of files to be uploaded. Please use multipart/form-data to submit.
|
||||
*
|
||||
|
32
api/@ohos.resourceschedule.workScheduler.d.ts
vendored
32
api/@ohos.resourceschedule.workScheduler.d.ts
vendored
@ -223,9 +223,24 @@ declare namespace workScheduler {
|
||||
* @syscap SystemCapability.ResourceSchedule.WorkScheduler
|
||||
* @StageModelOnly
|
||||
* @since 9
|
||||
* @deprecated since 10
|
||||
*/
|
||||
function obtainAllWorks(callback: AsyncCallback<void>): Array<WorkInfo>;
|
||||
|
||||
/**
|
||||
* Get all works of the calling application.
|
||||
*
|
||||
* @param { AsyncCallback<void> } callback - The callback of the function.
|
||||
* @throws { BusinessError } 401 - Parameter error.
|
||||
* @throws { BusinessError } 9700001 - Memory operation failed.
|
||||
* @throws { BusinessError } 9700002 - Parcel operation failed.
|
||||
* @throws { BusinessError } 9700003 - System service operation failed.
|
||||
* @syscap SystemCapability.ResourceSchedule.WorkScheduler
|
||||
* @StageModelOnly
|
||||
* @since 10
|
||||
*/
|
||||
function obtainAllWorks(callback: AsyncCallback<Array<WorkInfo>>): void;
|
||||
|
||||
/**
|
||||
* Get all works of the calling application.
|
||||
*
|
||||
@ -267,9 +282,26 @@ declare namespace workScheduler {
|
||||
* @syscap SystemCapability.ResourceSchedule.WorkScheduler
|
||||
* @StageModelOnly
|
||||
* @since 9
|
||||
* @deprecated since 10
|
||||
*/
|
||||
function isLastWorkTimeOut(workId: number, callback: AsyncCallback<void>): boolean;
|
||||
|
||||
/**
|
||||
* Check whether last work running is timeout. The interface is for repeating work.
|
||||
*
|
||||
* @param { number } workId - The id of work.
|
||||
* @param { AsyncCallback<void> } callback - The callback of the function.
|
||||
* @throws { BusinessError } 401 - Parameter error.
|
||||
* @throws { BusinessError } 9700001 - Memory operation failed.
|
||||
* @throws { BusinessError } 9700002 - Parcel operation failed.
|
||||
* @throws { BusinessError } 9700003 - System service operation failed.
|
||||
* @throws { BusinessError } 9700004 - Check workInfo failed.
|
||||
* @syscap SystemCapability.ResourceSchedule.WorkScheduler
|
||||
* @StageModelOnly
|
||||
* @since 10
|
||||
*/
|
||||
function isLastWorkTimeOut(workId: number, callback: AsyncCallback<boolean>): void;
|
||||
|
||||
/**
|
||||
* Check whether last work running is timeout. The interface is for repeating work.
|
||||
*
|
||||
|
24
api/@ohos.telephony.sim.d.ts
vendored
24
api/@ohos.telephony.sim.d.ts
vendored
@ -2065,8 +2065,7 @@ declare namespace sim {
|
||||
*
|
||||
* @interface IccAccountInfo
|
||||
* @syscap SystemCapability.Telephony.CoreService
|
||||
* @systemapi Hide this for inner system use.
|
||||
* @since 7
|
||||
* @since 10
|
||||
*/
|
||||
export interface IccAccountInfo {
|
||||
/**
|
||||
@ -2074,8 +2073,7 @@ declare namespace sim {
|
||||
*
|
||||
* @type { number }
|
||||
* @syscap SystemCapability.Telephony.CoreService
|
||||
* @systemapi Hide this for inner system use.
|
||||
* @since 7
|
||||
* @since 10
|
||||
*/
|
||||
simId: number;
|
||||
|
||||
@ -2085,8 +2083,7 @@ declare namespace sim {
|
||||
*
|
||||
* @type { number }
|
||||
* @syscap SystemCapability.Telephony.CoreService
|
||||
* @systemapi Hide this for inner system use.
|
||||
* @since 7
|
||||
* @since 10
|
||||
*/
|
||||
slotIndex: number;
|
||||
|
||||
@ -2095,8 +2092,7 @@ declare namespace sim {
|
||||
*
|
||||
* @type { boolean }
|
||||
* @syscap SystemCapability.Telephony.CoreService
|
||||
* @systemapi Hide this for inner system use.
|
||||
* @since 7
|
||||
* @since 10
|
||||
*/
|
||||
isEsim: boolean;
|
||||
|
||||
@ -2105,8 +2101,7 @@ declare namespace sim {
|
||||
*
|
||||
* @type { boolean }
|
||||
* @syscap SystemCapability.Telephony.CoreService
|
||||
* @systemapi Hide this for inner system use.
|
||||
* @since 7
|
||||
* @since 10
|
||||
*/
|
||||
isActive: boolean;
|
||||
|
||||
@ -2115,8 +2110,7 @@ declare namespace sim {
|
||||
*
|
||||
* @type { string }
|
||||
* @syscap SystemCapability.Telephony.CoreService
|
||||
* @systemapi Hide this for inner system use.
|
||||
* @since 7
|
||||
* @since 10
|
||||
*/
|
||||
iccId: string;
|
||||
|
||||
@ -2125,8 +2119,7 @@ declare namespace sim {
|
||||
*
|
||||
* @type { string }
|
||||
* @syscap SystemCapability.Telephony.CoreService
|
||||
* @systemapi Hide this for inner system use.
|
||||
* @since 7
|
||||
* @since 10
|
||||
*/
|
||||
showName: string;
|
||||
|
||||
@ -2135,8 +2128,7 @@ declare namespace sim {
|
||||
*
|
||||
* @type { string }
|
||||
* @syscap SystemCapability.Telephony.CoreService
|
||||
* @systemapi Hide this for inner system use.
|
||||
* @since 7
|
||||
* @since 10
|
||||
*/
|
||||
showNumber: string;
|
||||
}
|
||||
|
17
api/@ohos.window.d.ts
vendored
17
api/@ohos.window.d.ts
vendored
@ -203,7 +203,16 @@ declare namespace window {
|
||||
* @StageModelOnly
|
||||
* @since 9
|
||||
*/
|
||||
TYPE_SCREENSHOT
|
||||
TYPE_SCREENSHOT,
|
||||
/**
|
||||
* System Toast.
|
||||
*
|
||||
* @syscap SystemCapability.WindowManager.WindowManager.Core
|
||||
* @systemapi Hide this for inner system use.
|
||||
* @StageModelOnly
|
||||
* @since 11
|
||||
*/
|
||||
TYPE_SYSTEM_TOAST
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2786,8 +2795,7 @@ declare namespace window {
|
||||
* @param { Callback<void> } callback - Callback used to return the click event outside this window.
|
||||
* @throws { BusinessError } 401 - Parameter error.
|
||||
* @syscap SystemCapability.WindowManager.WindowManager.Core
|
||||
* @systemapi Hide this for inner system use.
|
||||
* @since 9
|
||||
* @since 11
|
||||
*/
|
||||
on(type: 'touchOutside', callback: Callback<void>): void;
|
||||
|
||||
@ -2798,8 +2806,7 @@ declare namespace window {
|
||||
* @param { Callback<void> } callback - Callback used to return the click event outside this window.
|
||||
* @throws { BusinessError } 401 - Parameter error.
|
||||
* @syscap SystemCapability.WindowManager.WindowManager.Core
|
||||
* @systemapi Hide this for inner system use.
|
||||
* @since 9
|
||||
* @since 11
|
||||
*/
|
||||
off(type: 'touchOutside', callback?: Callback<void>): void;
|
||||
|
||||
|
35
api/application/AbilityStartCallback.d.ts
vendored
Normal file
35
api/application/AbilityStartCallback.d.ts
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (c) 2023 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* The callback of UIAbility or UIExtensionAbility.
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @StageModelOnly
|
||||
* @since 11
|
||||
*/
|
||||
export default class AbilityStartCallback {
|
||||
|
||||
/**
|
||||
* Called when some error occurred except disconnected from UIAbility or UIExtensionAbility.
|
||||
*
|
||||
* @param { number } code - The code returned if the UIAbility or UIExtensionAbility failed to start.
|
||||
* @param { string } name - The name returned if the UIAbility or UIExtensionAbility failed to start.
|
||||
* @param { string } message - The message returned if the UIAbility or UIExtensionAbility failed to start.
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @StageModelOnly
|
||||
* @since 11
|
||||
*/
|
||||
onError(code: number, name: string, message: string): void;
|
||||
}
|
70
api/application/ApplicationContext.d.ts
vendored
70
api/application/ApplicationContext.d.ts
vendored
@ -49,15 +49,11 @@ export default class ApplicationContext extends Context {
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @StageModelOnly
|
||||
* @since 9
|
||||
* @deprecated since 10
|
||||
* @useinstead ApplicationContext#on(type: 'abilityLifecycleEvent', callback: AbilityLifecycleCallback)
|
||||
*/
|
||||
on(type: 'abilityLifecycle', callback: AbilityLifecycleCallback): number;
|
||||
|
||||
/**
|
||||
* Register ability lifecycle callback.
|
||||
*
|
||||
* @param { 'abilityLifecycleEvent' } type - abilityLifecycleEvent.
|
||||
* @param { 'abilityLifecycle' } type - abilityLifecycle.
|
||||
* @param { AbilityLifecycleCallback } callback - The ability lifecycle callback.
|
||||
* @returns { number } Returns the number code of the callback.
|
||||
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
|
||||
@ -66,7 +62,7 @@ export default class ApplicationContext extends Context {
|
||||
* @crossplatform
|
||||
* @since 10
|
||||
*/
|
||||
on(type: 'abilityLifecycleEvent', callback: AbilityLifecycleCallback): number;
|
||||
on(type: 'abilityLifecycle', callback: AbilityLifecycleCallback): number;
|
||||
|
||||
/**
|
||||
* Unregister ability lifecycle callback.
|
||||
@ -78,8 +74,18 @@ export default class ApplicationContext extends Context {
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @StageModelOnly
|
||||
* @since 9
|
||||
* @deprecated since 10
|
||||
* @useinstead ApplicationContext#off(type: 'abilityLifecycleEvent', callbackId: number)
|
||||
*/
|
||||
/**
|
||||
* Unregister ability lifecycle callback.
|
||||
*
|
||||
* @param { 'abilityLifecycle' } type - abilityLifecycle.
|
||||
* @param { number } callbackId - Indicates the number code of the callback.
|
||||
* @param { AsyncCallback<void> } callback - The callback of off.
|
||||
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @StageModelOnly
|
||||
* @crossplatform
|
||||
* @since 10
|
||||
*/
|
||||
off(type: 'abilityLifecycle', callbackId: number, callback: AsyncCallback<void>): void;
|
||||
|
||||
@ -93,25 +99,9 @@ export default class ApplicationContext extends Context {
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @StageModelOnly
|
||||
* @since 9
|
||||
* @deprecated since 10
|
||||
* @useinstead ApplicationContext#off(type: 'abilityLifecycleEvent', callbackId: number)
|
||||
*/
|
||||
off(type: 'abilityLifecycle', callbackId: number): Promise<void>;
|
||||
|
||||
/**
|
||||
* Unregister ability lifecycle callback.
|
||||
*
|
||||
* @param { 'abilityLifecycleEvent' } type - abilityLifecycleEvent.
|
||||
* @param { number } callbackId - Indicates the number code of the callback.
|
||||
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
|
||||
* @throws { BusinessError } 16000050 - Internal error.
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @StageModelOnly
|
||||
* @crossplatform
|
||||
* @since 10
|
||||
*/
|
||||
off(type: 'abilityLifecycleEvent', callbackId: number): void;
|
||||
|
||||
/**
|
||||
* Register environment callback.
|
||||
*
|
||||
@ -122,24 +112,9 @@ export default class ApplicationContext extends Context {
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @StageModelOnly
|
||||
* @since 9
|
||||
* @deprecated since 10
|
||||
* @useinstead ApplicationContext#off(type: 'environmentEvent', callback: EnvironmentCallback)
|
||||
*/
|
||||
on(type: 'environment', callback: EnvironmentCallback): number;
|
||||
|
||||
/**
|
||||
* Register environment callback.
|
||||
*
|
||||
* @param { 'environmentEvent' } type - environmentEvent.
|
||||
* @param { EnvironmentCallback } callback - The environment callback.
|
||||
* @returns { number } Returns the number code of the callback.
|
||||
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @StageModelOnly
|
||||
* @since 10
|
||||
*/
|
||||
on(type: 'environmentEvent', callback: EnvironmentCallback): number;
|
||||
|
||||
/**
|
||||
* Unregister environment callback.
|
||||
*
|
||||
@ -150,8 +125,6 @@ export default class ApplicationContext extends Context {
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @StageModelOnly
|
||||
* @since 9
|
||||
* @deprecated since 10
|
||||
* @useinstead ApplicationContext#off(type: 'environmentEvent', callbackId: number)
|
||||
*/
|
||||
off(type: 'environment', callbackId: number, callback: AsyncCallback<void>): void;
|
||||
|
||||
@ -165,24 +138,9 @@ export default class ApplicationContext extends Context {
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @StageModelOnly
|
||||
* @since 9
|
||||
* @deprecated since 10
|
||||
* @useinstead ApplicationContext#off(type: 'environmentEvent', callbackId: number)
|
||||
*/
|
||||
off(type: 'environment', callbackId: number): Promise<void>;
|
||||
|
||||
/**
|
||||
* Unregister environment callback.
|
||||
*
|
||||
* @param { 'environmentEvent' } type - environmentEvent.
|
||||
* @param { number } callbackId - Indicates the number code of the callback.
|
||||
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
|
||||
* @throws { BusinessError } 16000050 - Internal error.
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @StageModelOnly
|
||||
* @since 10
|
||||
*/
|
||||
off(type: 'environmentEvent', callbackId: number): void;
|
||||
|
||||
/**
|
||||
* Register applicationStateChange callback.
|
||||
*
|
||||
|
47
api/application/UIAbilityContext.d.ts
vendored
47
api/application/UIAbilityContext.d.ts
vendored
@ -29,6 +29,7 @@ import { LocalStorage } from 'StateManagement';
|
||||
import image from '../@ohos.multimedia.image';
|
||||
import dialogRequest from '../@ohos.app.ability.dialogRequest';
|
||||
import AbilityConstant from '../@ohos.app.ability.AbilityConstant';
|
||||
import type { AbilityStartCallback } from './AbilityStartCallback';
|
||||
|
||||
/**
|
||||
* The context of an ability. It allows access to ability-specific resources.
|
||||
@ -2068,4 +2069,50 @@ export default class UIAbilityContext extends Context {
|
||||
* @since 10
|
||||
*/
|
||||
reportDrawnCompleted(callback: AsyncCallback<void>): void;
|
||||
|
||||
/**
|
||||
* Starts the UIAbility or UIExtensionAbility by type.
|
||||
* If the target ability is visible, you can start the target ability; If the target ability is invisible,
|
||||
* you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability.
|
||||
*
|
||||
* @param { string } type - The type of target ability.
|
||||
* @param { Record<string, Object> } wantParam - Indicates the want parameter.
|
||||
* @param { AbilityStartCallback } abilityStartCallback - Indicates the abilityStartCallback.
|
||||
* @param { AsyncCallback<void> } callback - The callback of startAbility.
|
||||
* @throws { BusinessError } 201 - The application does not have permission to call the interface.
|
||||
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
|
||||
* @throws { BusinessError } 16000001 - The specified ability does not exist.
|
||||
* @throws { BusinessError } 16000002 - Incorrect ability type.
|
||||
* @throws { BusinessError } 16000004 - Can not start invisible component.
|
||||
* @throws { BusinessError } 16000050 - Internal error.
|
||||
* @throws { BusinessError } 16200001 - The caller has been released.
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @StageModelOnly
|
||||
* @since 11
|
||||
*/
|
||||
startAbilityByType(type: string, wantParam: Record<string, Object>,
|
||||
abilityStartCallback: AbilityStartCallback, callback: AsyncCallback<void>): void;
|
||||
|
||||
/**
|
||||
* Starts the UIAbility or UIExtensionAbility by type.
|
||||
* If the target ability is visible, you can start the target ability; If the target ability is invisible,
|
||||
* you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability.
|
||||
*
|
||||
* @param { string } type - The type of target ability.
|
||||
* @param { Record<string, Object> } wantParam - Indicates the want parameter.
|
||||
* @param { AbilityStartCallback } abilityStartCallback - Indicates the abilityStartCallback.
|
||||
* @returns { Promise<void> } The promise returned by the function.
|
||||
* @throws { BusinessError } 201 - The application does not have permission to call the interface.
|
||||
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
|
||||
* @throws { BusinessError } 16000001 - The specified ability does not exist.
|
||||
* @throws { BusinessError } 16000002 - Incorrect ability type.
|
||||
* @throws { BusinessError } 16000004 - Can not start invisible component.
|
||||
* @throws { BusinessError } 16000050 - Internal error.
|
||||
* @throws { BusinessError } 16200001 - The caller has been released.
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @StageModelOnly
|
||||
* @since 11
|
||||
*/
|
||||
startAbilityByType(type: string, wantParam: Record<string, Object>,
|
||||
abilityStartCallback: AbilityStartCallback): Promise<void>;
|
||||
}
|
||||
|
13
api/bundleManager/AppProvisionInfo.d.ts
vendored
13
api/bundleManager/AppProvisionInfo.d.ts
vendored
@ -121,6 +121,19 @@ export interface AppProvisionInfo {
|
||||
* @since 10
|
||||
*/
|
||||
readonly issuer: string;
|
||||
|
||||
/**
|
||||
* Globally unique identifier of an application, which is allocated by the cloud.
|
||||
* AppIdentifier does not change along the application lifecycle, including version updates, certificate changes,
|
||||
* public and private key changes, and application transfer.
|
||||
*
|
||||
* @type { string }
|
||||
* @readonly
|
||||
* @syscap SystemCapability.BundleManager.BundleFramework.Core
|
||||
* @systemapi
|
||||
* @since 11
|
||||
*/
|
||||
readonly appIdentifier: string;
|
||||
}
|
||||
|
||||
/**
|
||||
|
14
api/bundleManager/BundleInfo.d.ts
vendored
14
api/bundleManager/BundleInfo.d.ts
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2022-2023 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
|
||||
@ -250,4 +250,16 @@ export interface SignatureInfo {
|
||||
* @since 9
|
||||
*/
|
||||
readonly fingerprint: string;
|
||||
|
||||
/**
|
||||
* Globally unique identifier of an application, which is allocated by the cloud.
|
||||
* AppIdentifier does not change along the application lifecycle, including version updates, certificate changes,
|
||||
* public and private key changes, and application transfer.
|
||||
*
|
||||
* @type { string }
|
||||
* @readonly
|
||||
* @syscap SystemCapability.BundleManager.BundleFramework.Core
|
||||
* @since 11
|
||||
*/
|
||||
readonly appIdentifier: string;
|
||||
}
|
||||
|
10
api/bundleManager/ExtensionAbilityInfo.d.ts
vendored
10
api/bundleManager/ExtensionAbilityInfo.d.ts
vendored
@ -97,6 +97,16 @@ export interface ExtensionAbilityInfo {
|
||||
*/
|
||||
readonly extensionAbilityType: bundleManager.ExtensionAbilityType;
|
||||
|
||||
/**
|
||||
* Indicates type name of the extension ability.
|
||||
*
|
||||
* @type { string }
|
||||
* @readonly
|
||||
* @syscap SystemCapability.BundleManager.BundleFramework.Core
|
||||
* @since 11
|
||||
*/
|
||||
readonly extensionAbilityTypeName: string;
|
||||
|
||||
/**
|
||||
* The permissions that others need to use this extension ability info
|
||||
*
|
||||
|
@ -67,4 +67,13 @@ export interface CommonEventSubscribeInfo {
|
||||
* @since 7
|
||||
*/
|
||||
priority?: number;
|
||||
|
||||
/**
|
||||
* Specify the publisher's bundleName to subscribe.
|
||||
*
|
||||
* @type { ?string }
|
||||
* @syscap SystemCapability.Notification.CommonEvent
|
||||
* @since 11
|
||||
*/
|
||||
publisherBundleName?: string;
|
||||
}
|
||||
|
@ -148,7 +148,6 @@
|
||||
"SystemCapability.Test.UiTest",
|
||||
"SystemCapability.Web.Webview.Core",
|
||||
"SystemCapability.Cloud.AAID",
|
||||
"SystemCapability.Cloud.OAID",
|
||||
"SystemCapability.Cloud.VAID",
|
||||
"SystemCapability.Security.CertificateManager",
|
||||
"SystemCapability.Security.CryptoFramework",
|
||||
|
@ -190,7 +190,7 @@
|
||||
"SystemCapability.Test.UiTest",
|
||||
"SystemCapability.Web.Webview.Core",
|
||||
"SystemCapability.Cloud.AAID",
|
||||
"SystemCapability.Cloud.OAID",
|
||||
"SystemCapability.Advertising.OAID",
|
||||
"SystemCapability.Cloud.VAID",
|
||||
"SystemCapability.Security.CertificateManager",
|
||||
"SystemCapability.Security.CryptoFramework",
|
||||
|
@ -16,7 +16,6 @@
|
||||
"SystemCapability.Startup.SystemInfo",
|
||||
"SystemCapability.Startup.SystemInfo.Lite",
|
||||
"SystemCapability.Cloud.AAID",
|
||||
"SystemCapability.Cloud.OAID",
|
||||
"SystemCapability.Cloud.VAID"
|
||||
]
|
||||
}
|
@ -17,7 +17,6 @@
|
||||
"SystemCapability.Startup.SystemInfo",
|
||||
"SystemCapability.Startup.SystemInfo.Lite",
|
||||
"SystemCapability.Cloud.AAID",
|
||||
"SystemCapability.Cloud.OAID",
|
||||
"SystemCapability.Cloud.VAID"
|
||||
]
|
||||
}
|
@ -184,7 +184,7 @@
|
||||
"SystemCapability.Test.UiTest",
|
||||
"SystemCapability.Web.Webview.Core",
|
||||
"SystemCapability.Cloud.AAID",
|
||||
"SystemCapability.Cloud.OAID",
|
||||
"SystemCapability.Advertising.OAID",
|
||||
"SystemCapability.Cloud.VAID",
|
||||
"SystemCapability.Security.CertificateManager",
|
||||
"SystemCapability.Security.CryptoFramework",
|
||||
@ -205,6 +205,7 @@
|
||||
"SystemCapability.ResourceSchedule.DeviceStandby",
|
||||
"SystemCapability.Print.PrintFramework",
|
||||
"SystemCapability.Multimedia.Media.AVScreenCapture",
|
||||
"SystemCapability.Multimedia.Media.SoundPool"
|
||||
"SystemCapability.Multimedia.Media.SoundPool",
|
||||
"SystemCapability.Driver.ExternalDevice"
|
||||
]
|
||||
}
|
||||
|
@ -156,7 +156,7 @@
|
||||
"SystemCapability.Applications.CalendarData",
|
||||
"SystemCapability.Applications.settings.Core",
|
||||
"SystemCapability.Cloud.AAID",
|
||||
"SystemCapability.Cloud.OAID",
|
||||
"SystemCapability.Advertising.OAID",
|
||||
"SystemCapability.Cloud.VAID",
|
||||
"SystemCapability.Security.CertificateManager",
|
||||
"SystemCapability.Security.CryptoFramework",
|
||||
|
@ -152,7 +152,6 @@
|
||||
"SystemCapability.Applications.Contacts",
|
||||
"SystemCapability.Applications.settings.Core",
|
||||
"SystemCapability.Cloud.AAID",
|
||||
"SystemCapability.Cloud.OAID",
|
||||
"SystemCapability.Cloud.VAID",
|
||||
"SystemCapability.BundleManager.BundleFramework.Core",
|
||||
"SystemCapability.BundleManager.BundleFramework.FreeInstall",
|
||||
|
21
api/global/resource.d.ts
vendored
21
api/global/resource.d.ts
vendored
@ -24,6 +24,7 @@ export interface Resource {
|
||||
/**
|
||||
* bundle name in hap
|
||||
*
|
||||
* @type { string }
|
||||
* @syscap SystemCapability.Global.ResourceManager
|
||||
* @since 9
|
||||
*/
|
||||
@ -32,6 +33,7 @@ export interface Resource {
|
||||
/**
|
||||
* module name in hap
|
||||
*
|
||||
* @type { string }
|
||||
* @syscap SystemCapability.Global.ResourceManager
|
||||
* @since 9
|
||||
*/
|
||||
@ -40,8 +42,27 @@ export interface Resource {
|
||||
/**
|
||||
* resource id in hap
|
||||
*
|
||||
* @type { number }
|
||||
* @syscap SystemCapability.Global.ResourceManager
|
||||
* @since 9
|
||||
*/
|
||||
id: number;
|
||||
|
||||
/**
|
||||
* Set params.
|
||||
*
|
||||
* @type { ?any[] }
|
||||
* @syscap SystemCapability.Global.ResourceManager
|
||||
* @since 7
|
||||
*/
|
||||
params?: any[];
|
||||
|
||||
/**
|
||||
* Set type.
|
||||
*
|
||||
* @type { ?number }
|
||||
* @syscap SystemCapability.Global.ResourceManager
|
||||
* @since 7
|
||||
*/
|
||||
type?: number;
|
||||
}
|
||||
|
@ -317,7 +317,7 @@
|
||||
"SystemCapability.Test.UiTest",
|
||||
"SystemCapability.Web.Webview.Core",
|
||||
"SystemCapability.Cloud.AAID",
|
||||
"SystemCapability.Cloud.OAID",
|
||||
"SystemCapability.Advertising.OAID",
|
||||
"SystemCapability.Cloud.VAID",
|
||||
"SystemCapability.Cloud.Push",
|
||||
"SystemCapability.XTS.DeviceAttest",
|
||||
|
@ -355,6 +355,7 @@ kaihong
|
||||
kbdillum
|
||||
kbdinputassist
|
||||
kbps
|
||||
kdf
|
||||
keyof
|
||||
keyframe
|
||||
keyguard
|
||||
|
@ -237,9 +237,24 @@ function collectApiDiffFromApiNameMap(oldSignatureMap, apiName, newClassMap, ext
|
||||
} else {
|
||||
const newSignatureMap = newClassMap.get(apiName);
|
||||
const sameApiNameNumber = oldSignatureMap.size;
|
||||
const sameSignatureSet = new Set();
|
||||
oldSignatureMap.forEach((oldApis, apiSignautre) => {
|
||||
collectApiDiffFromApiSignatureMap(oldApis, apiSignautre, newSignatureMap, ext, sameApiNameNumber);
|
||||
collectApiDiffFromApiSignatureMap(oldApis, apiSignautre, newSignatureMap, ext, sameApiNameNumber, sameSignatureSet);
|
||||
});
|
||||
|
||||
sameSignatureSet.forEach(sameSignature => {
|
||||
oldSignatureMap.delete(sameSignature);
|
||||
})
|
||||
|
||||
oldSignatureMap.forEach((oldApis, _) => {
|
||||
if (newSignatureMap.size === 0) {
|
||||
// 同名函数,方法被删除
|
||||
ext.diffReporter.addDeletedApi(oldApis[0], getSycap(oldApis[0]));
|
||||
} else {
|
||||
getFunctionDiff(oldApis, newSignatureMap, ext, sameApiNameNumber);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -270,13 +285,12 @@ function collectClassApiDiffs(oldClassApi, newClassApi, ext) {
|
||||
* @param {Object} ext 扩展参数
|
||||
* @param {number} sameApiNameNumber 名字相同的API个数
|
||||
*/
|
||||
function collectApiDiffFromApiSignatureMap(oldApis, apiSignautre, newClassMap, ext, sameApiNameNumber) {
|
||||
function collectApiDiffFromApiSignatureMap(oldApis, apiSignautre, newClassMap, ext, sameApiNameNumber, sameSignatureSet) {
|
||||
if (newClassMap.has(apiSignautre)) {
|
||||
const newApis = newClassMap.get(apiSignautre);
|
||||
collectJSDocDiffs(oldApis[0], newApis[0], ext.diffReporter);
|
||||
newClassMap.delete(apiSignautre);
|
||||
} else {
|
||||
getFunctionDiff(oldApis, newClassMap, ext, sameApiNameNumber);
|
||||
sameSignatureSet.add(apiSignautre);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,24 +21,10 @@
|
||||
"dtsPath": "api/api_change_001.d.ts",
|
||||
"hint": "",
|
||||
"changelogs": [],
|
||||
"statusCode": 0,
|
||||
"status": "删除",
|
||||
"oldMessage": "",
|
||||
"newMessage": "",
|
||||
"syscap": "Customization"
|
||||
},
|
||||
{
|
||||
"packageName": "api\\api_change_001.d.ts",
|
||||
"className": "networkManager",
|
||||
"rawText": "function getIpAddress(admin: Wan, networkInterface: string, callback: AsyncCallback<string>): void;",
|
||||
"dtsName": "api_change_001.d.ts",
|
||||
"dtsPath": "api/api_change_001.d.ts",
|
||||
"hint": "",
|
||||
"changelogs": [],
|
||||
"statusCode": 3,
|
||||
"status": "新增",
|
||||
"oldMessage": "",
|
||||
"newMessage": "",
|
||||
"statusCode": 16,
|
||||
"status": "函数有变化",
|
||||
"oldMessage": "function getIpAddress(admin: Want, networkInterface: string, callback: AsyncCallback<string>): void;",
|
||||
"newMessage": "function getIpAddress(admin: Wan, networkInterface: string, callback: AsyncCallback<string>): void;",
|
||||
"syscap": "Customization"
|
||||
}
|
||||
]
|
@ -27,20 +27,6 @@
|
||||
"newMessage": "401,201,202,12100001,12100002,12100003,12100006",
|
||||
"syscap": "Security"
|
||||
},
|
||||
{
|
||||
"packageName": "api\\api_change_005.d.ts",
|
||||
"className": "AtManager",
|
||||
"rawText": "revokeUserGrantedPermission(tokenID: string, permissionName: Permissions, permissionFlags: number): Promise<void>;",
|
||||
"dtsName": "api_change_005.d.ts",
|
||||
"dtsPath": "api/api_change_005.d.ts",
|
||||
"hint": "",
|
||||
"changelogs": [],
|
||||
"statusCode": 4,
|
||||
"status": "起始版本有变化",
|
||||
"oldMessage": "8",
|
||||
"newMessage": "9",
|
||||
"syscap": "Security"
|
||||
},
|
||||
{
|
||||
"packageName": "api\\api_change_005.d.ts",
|
||||
"className": "AtManager",
|
||||
@ -83,20 +69,6 @@
|
||||
"newMessage": "ohos.permission.GET_SENSITIVE_PERMISSIONS,ohos.permission.GRANT_SENSITIVE_PERMISSIONS",
|
||||
"syscap": "Security"
|
||||
},
|
||||
{
|
||||
"packageName": "api\\api_change_005.d.ts",
|
||||
"className": "AtManager",
|
||||
"rawText": "getPermissionFlags(tokenID: string, permissionName: Permissions): Promise<number>;",
|
||||
"dtsName": "api_change_005.d.ts",
|
||||
"dtsPath": "api/api_change_005.d.ts",
|
||||
"hint": "",
|
||||
"changelogs": [],
|
||||
"statusCode": 4,
|
||||
"status": "起始版本有变化",
|
||||
"oldMessage": "8",
|
||||
"newMessage": "9",
|
||||
"syscap": "Security"
|
||||
},
|
||||
{
|
||||
"packageName": "api\\api_change_005.d.ts",
|
||||
"className": "AtManager",
|
||||
|
@ -25,7 +25,7 @@
|
||||
"status": "删除",
|
||||
"oldMessage": "",
|
||||
"newMessage": "",
|
||||
"syscap": ""
|
||||
"syscap": "Ability"
|
||||
},
|
||||
{
|
||||
"packageName": "api\\delete_class_001.d.ts",
|
||||
@ -39,7 +39,7 @@
|
||||
"status": "新增",
|
||||
"oldMessage": "",
|
||||
"newMessage": "",
|
||||
"syscap": ""
|
||||
"syscap": "Ability"
|
||||
},
|
||||
{
|
||||
"packageName": "api\\delete_class_001.d.ts",
|
||||
@ -53,7 +53,7 @@
|
||||
"status": "删除",
|
||||
"oldMessage": "",
|
||||
"newMessage": "",
|
||||
"syscap": ""
|
||||
"syscap": "Ability"
|
||||
},
|
||||
{
|
||||
"packageName": "api\\delete_class_001.d.ts",
|
||||
@ -67,7 +67,7 @@
|
||||
"status": "新增",
|
||||
"oldMessage": "",
|
||||
"newMessage": "",
|
||||
"syscap": ""
|
||||
"syscap": "Ability"
|
||||
},
|
||||
{
|
||||
"packageName": "api\\delete_class_001.d.ts",
|
||||
@ -81,7 +81,7 @@
|
||||
"status": "删除",
|
||||
"oldMessage": "",
|
||||
"newMessage": "",
|
||||
"syscap": ""
|
||||
"syscap": "Ability"
|
||||
},
|
||||
{
|
||||
"packageName": "api\\delete_class_001.d.ts",
|
||||
@ -95,7 +95,7 @@
|
||||
"status": "新增",
|
||||
"oldMessage": "",
|
||||
"newMessage": "",
|
||||
"syscap": ""
|
||||
"syscap": "Ability"
|
||||
},
|
||||
{
|
||||
"packageName": "api\\delete_class_001.d.ts",
|
||||
@ -109,7 +109,7 @@
|
||||
"status": "类型删除(接口)",
|
||||
"oldMessage": "",
|
||||
"newMessage": "",
|
||||
"syscap": ""
|
||||
"syscap": "Ability"
|
||||
},
|
||||
{
|
||||
"packageName": "api\\delete_class_001.d.ts",
|
||||
@ -123,7 +123,7 @@
|
||||
"status": "删除",
|
||||
"oldMessage": "",
|
||||
"newMessage": "",
|
||||
"syscap": ""
|
||||
"syscap": "Ability"
|
||||
},
|
||||
{
|
||||
"packageName": "api\\delete_class_001.d.ts",
|
||||
@ -137,7 +137,7 @@
|
||||
"status": "新增",
|
||||
"oldMessage": "",
|
||||
"newMessage": "",
|
||||
"syscap": ""
|
||||
"syscap": "Ability"
|
||||
},
|
||||
{
|
||||
"packageName": "api\\delete_class_001.d.ts",
|
||||
@ -151,7 +151,7 @@
|
||||
"status": "删除",
|
||||
"oldMessage": "",
|
||||
"newMessage": "",
|
||||
"syscap": ""
|
||||
"syscap": "Ability"
|
||||
},
|
||||
{
|
||||
"packageName": "api\\delete_class_001.d.ts",
|
||||
@ -165,7 +165,7 @@
|
||||
"status": "新增",
|
||||
"oldMessage": "",
|
||||
"newMessage": "",
|
||||
"syscap": ""
|
||||
"syscap": "Ability"
|
||||
},
|
||||
{
|
||||
"packageName": "api\\delete_class_001.d.ts",
|
||||
|
@ -95,7 +95,7 @@
|
||||
"status": "删除",
|
||||
"oldMessage": "",
|
||||
"newMessage": "",
|
||||
"syscap": ""
|
||||
"syscap": "Ability"
|
||||
},
|
||||
{
|
||||
"packageName": "api\\delete_dts_002.d.ts",
|
||||
@ -109,7 +109,7 @@
|
||||
"status": "删除",
|
||||
"oldMessage": "",
|
||||
"newMessage": "",
|
||||
"syscap": ""
|
||||
"syscap": "Ability"
|
||||
},
|
||||
{
|
||||
"packageName": "api\\delete_dts_002.d.ts",
|
||||
@ -123,7 +123,7 @@
|
||||
"status": "删除",
|
||||
"oldMessage": "",
|
||||
"newMessage": "",
|
||||
"syscap": ""
|
||||
"syscap": "Ability"
|
||||
},
|
||||
{
|
||||
"packageName": "api\\delete_dts_002.d.ts",
|
||||
@ -137,7 +137,7 @@
|
||||
"status": "删除",
|
||||
"oldMessage": "",
|
||||
"newMessage": "",
|
||||
"syscap": ""
|
||||
"syscap": "Ability"
|
||||
},
|
||||
{
|
||||
"packageName": "api\\delete_dts_002.d.ts",
|
||||
@ -151,7 +151,7 @@
|
||||
"status": "删除",
|
||||
"oldMessage": "",
|
||||
"newMessage": "",
|
||||
"syscap": ""
|
||||
"syscap": "Ability"
|
||||
},
|
||||
{
|
||||
"packageName": "api\\delete_dts_002.d.ts",
|
||||
@ -165,7 +165,7 @@
|
||||
"status": "删除",
|
||||
"oldMessage": "",
|
||||
"newMessage": "",
|
||||
"syscap": ""
|
||||
"syscap": "Ability"
|
||||
},
|
||||
{
|
||||
"packageName": "api\\delete_dts_002.d.ts",
|
||||
@ -276,7 +276,7 @@
|
||||
"status": "新增",
|
||||
"oldMessage": "",
|
||||
"newMessage": "",
|
||||
"syscap": ""
|
||||
"syscap": "Ability"
|
||||
},
|
||||
{
|
||||
"packageName": "api\\delete_dts_003.d.ts",
|
||||
@ -290,7 +290,7 @@
|
||||
"status": "新增",
|
||||
"oldMessage": "",
|
||||
"newMessage": "",
|
||||
"syscap": ""
|
||||
"syscap": "Ability"
|
||||
},
|
||||
{
|
||||
"packageName": "api\\delete_dts_003.d.ts",
|
||||
@ -304,7 +304,7 @@
|
||||
"status": "新增",
|
||||
"oldMessage": "",
|
||||
"newMessage": "",
|
||||
"syscap": ""
|
||||
"syscap": "Ability"
|
||||
},
|
||||
{
|
||||
"packageName": "api\\delete_dts_003.d.ts",
|
||||
@ -318,7 +318,7 @@
|
||||
"status": "新增",
|
||||
"oldMessage": "",
|
||||
"newMessage": "",
|
||||
"syscap": ""
|
||||
"syscap": "Ability"
|
||||
},
|
||||
{
|
||||
"packageName": "api\\delete_dts_003.d.ts",
|
||||
@ -332,7 +332,7 @@
|
||||
"status": "新增",
|
||||
"oldMessage": "",
|
||||
"newMessage": "",
|
||||
"syscap": ""
|
||||
"syscap": "Ability"
|
||||
},
|
||||
{
|
||||
"packageName": "api\\delete_dts_003.d.ts",
|
||||
@ -346,6 +346,6 @@
|
||||
"status": "新增",
|
||||
"oldMessage": "",
|
||||
"newMessage": "",
|
||||
"syscap": ""
|
||||
"syscap": "Ability"
|
||||
}
|
||||
]
|
@ -11,7 +11,7 @@
|
||||
"status": "新增",
|
||||
"oldMessage": "",
|
||||
"newMessage": "",
|
||||
"syscap": ""
|
||||
"syscap": "Ability"
|
||||
},
|
||||
{
|
||||
"packageName": "api\\new_api_002.d.ts",
|
||||
@ -25,6 +25,6 @@
|
||||
"status": "新增",
|
||||
"oldMessage": "",
|
||||
"newMessage": "",
|
||||
"syscap": ""
|
||||
"syscap": "Ability"
|
||||
}
|
||||
]
|
@ -1,30 +1 @@
|
||||
[
|
||||
{
|
||||
"packageName": "api\\since_change_001.d.ts",
|
||||
"className": "LaunchParam",
|
||||
"rawText": "export interface LaunchParam",
|
||||
"dtsName": "since_change_001.d.ts",
|
||||
"dtsPath": "api/since_change_001.d.ts",
|
||||
"hint": "",
|
||||
"changelogs": [],
|
||||
"statusCode": 4,
|
||||
"status": "起始版本有变化",
|
||||
"oldMessage": "9",
|
||||
"newMessage": "10",
|
||||
"syscap": "Ability"
|
||||
},
|
||||
{
|
||||
"packageName": "api\\since_change_001.d.ts",
|
||||
"className": "DeviceManager",
|
||||
"rawText": "release(): void;",
|
||||
"dtsName": "since_change_001.d.ts",
|
||||
"dtsPath": "api/since_change_001.d.ts",
|
||||
"hint": "",
|
||||
"changelogs": [],
|
||||
"statusCode": 4,
|
||||
"status": "起始版本有变化",
|
||||
"oldMessage": "",
|
||||
"newMessage": "9",
|
||||
"syscap": "Ability"
|
||||
}
|
||||
]
|
||||
[]
|
@ -1,44 +1 @@
|
||||
[
|
||||
{
|
||||
"packageName": "api\\syscap_change_001.d.ts",
|
||||
"className": "deviceControl",
|
||||
"rawText": "declare deviceControl",
|
||||
"dtsName": "syscap_change_001.d.ts",
|
||||
"dtsPath": "api/syscap_change_001.d.ts",
|
||||
"hint": "",
|
||||
"changelogs": [],
|
||||
"statusCode": 8,
|
||||
"status": "SysCap有变化",
|
||||
"oldMessage": "",
|
||||
"newMessage": "SystemCapability.Customization.EnterpriseDeviceManager",
|
||||
"syscap": "Customization"
|
||||
},
|
||||
{
|
||||
"packageName": "api\\syscap_change_001.d.ts",
|
||||
"className": "deviceControl",
|
||||
"rawText": "function resetFactory(admin: Want, callback: AsyncCallback<void>): void;",
|
||||
"dtsName": "syscap_change_001.d.ts",
|
||||
"dtsPath": "api/syscap_change_001.d.ts",
|
||||
"hint": "",
|
||||
"changelogs": [],
|
||||
"statusCode": 8,
|
||||
"status": "SysCap有变化",
|
||||
"oldMessage": "",
|
||||
"newMessage": "SystemCapability.Customization.EnterpriseDeviceManager",
|
||||
"syscap": "Customization"
|
||||
},
|
||||
{
|
||||
"packageName": "api\\syscap_change_001.d.ts",
|
||||
"className": "deviceControl",
|
||||
"rawText": "function resetFactory(admin: Want): Promise<void>;",
|
||||
"dtsName": "syscap_change_001.d.ts",
|
||||
"dtsPath": "api/syscap_change_001.d.ts",
|
||||
"hint": "",
|
||||
"changelogs": [],
|
||||
"statusCode": 8,
|
||||
"status": "SysCap有变化",
|
||||
"oldMessage": "SystemCapability.Customization.EnterpriseDeviceManager",
|
||||
"newMessage": "SystemCapability.Customization",
|
||||
"syscap": "Customization"
|
||||
}
|
||||
]
|
||||
[]
|
@ -26,22 +26,6 @@ import Want from "./@ohos.app.ability.Want";
|
||||
*/
|
||||
declare namespace networkManager {
|
||||
|
||||
/**
|
||||
* Gets all of the network interfaces of the device.
|
||||
* This function can be called by a super administrator.
|
||||
* @permission ohos.permission.ENTERPRISE_GET_NETWORK_INFO
|
||||
* @param { Want } admin - admin indicates the administrator ability information.
|
||||
* @param { AsyncCallback<Array<string>> } callback - the callback of getAllNetworkInterfaces.
|
||||
* @throws { BusinessError } 9200001 - the application is not an administrator of the device.
|
||||
* @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device.
|
||||
* @throws { BusinessError } 201 - the application does not have permission to call this function.
|
||||
* @throws { BusinessError } 202 - not system application.
|
||||
* @throws { BusinessError } 401 - invalid input parameter.
|
||||
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
|
||||
* @systemapi
|
||||
* @stagemodelonly
|
||||
* @since 10
|
||||
*/
|
||||
function getAllNetworkInterfaces(admin: Want, networkInterface: string, callback: AsyncCallback<Array<string>>): void;
|
||||
/**
|
||||
* Gets all of the network interfaces of the device.
|
||||
|
@ -25,23 +25,6 @@ import Want from "./@ohos.app.ability.Want";
|
||||
* @since 10
|
||||
*/
|
||||
declare namespace networkManager {
|
||||
|
||||
/**
|
||||
* Gets all of the network interfaces of the device.
|
||||
* This function can be called by a super administrator.
|
||||
* @permission ohos.permission.ENTERPRISE_GET_NETWORK_INFO
|
||||
* @param { Want } admin - admin indicates the administrator ability information.
|
||||
* @param { AsyncCallback<Array<string>> } callback - the callback of getAllNetworkInterfaces.
|
||||
* @throws { BusinessError } 9200001 - the application is not an administrator of the device.
|
||||
* @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device.
|
||||
* @throws { BusinessError } 201 - the application does not have permission to call this function.
|
||||
* @throws { BusinessError } 202 - not system application.
|
||||
* @throws { BusinessError } 401 - invalid input parameter.
|
||||
* @syscap SystemCapability.Customization.EnterpriseDeviceManager
|
||||
* @systemapi
|
||||
* @stagemodelonly
|
||||
* @since 10
|
||||
*/
|
||||
function getAllNetworkInterfaces(admin: Want, callback: AsyncCallback<Array<string>>): void;
|
||||
/**
|
||||
* Gets all of the network interfaces of the device.
|
||||
|
@ -129,38 +129,12 @@ node ./package/JS_API_OPTIMIZE_PLUGIN.js '-N' 'diff' '-C' '.\test\ut\parser\ut_
|
||||
|
||||
### 本地运行
|
||||
|
||||
由于工具中使用了私仓版本typescript,需要下载对应离线依赖包
|
||||
|
||||
1、下载typescript仓的代码
|
||||
|
||||
[third_party_typescript](https://gitee.com/openharmony/third_party_typescript/tree/master)
|
||||
|
||||
2、在typescript仓执行
|
||||
1、运行以下脚本安装相关依赖
|
||||
|
||||
```
|
||||
npm install
|
||||
```
|
||||
|
||||
3、在typescript仓执行
|
||||
|
||||
```
|
||||
npm release
|
||||
```
|
||||
|
||||
4、在typescript仓执行
|
||||
|
||||
```
|
||||
npm pack
|
||||
```
|
||||
|
||||
5、将生成的ohos-typescript-4.2.3-r2.tgz包放到当前项目下的deps目录下
|
||||
|
||||
6、之后运行以下脚本安装相关依赖
|
||||
|
||||
```
|
||||
npm run installDev
|
||||
```
|
||||
|
||||
安装完成之后根据目录和注意事项完成工具开发或测试
|
||||
|
||||
### 线上运行
|
||||
@ -170,7 +144,7 @@ npm run installDev
|
||||
1、安装依赖,在全量仓下执行安装依赖命令
|
||||
|
||||
```
|
||||
npm run installProd
|
||||
npm install
|
||||
```
|
||||
|
||||
2、执行打包命令,将ts打包为js
|
||||
@ -185,4 +159,6 @@ npm run build
|
||||
|
||||
例如
|
||||
|
||||
`node ./package/JS_API_OPTIMIZE_PLUGIN.js '-N' 'diff' '-C' '.\test\ut\parser\ut_jsdoc_constant_001.d.ts' '--old' '.\test\ut\apiDiff\old\ut_api_name_change.d.ts' '--new' '.\test\ut\apiDiff\new\ut_api_name_change.d.ts' '--old-version' '1' '--new-version' '2' '--output' '.\'`
|
||||
```
|
||||
node ./package/JS_API_OPTIMIZE_PLUGIN.js '-N' 'diff' '-C' '.\test\ut\parser\ut_jsdoc_constant_001.d.ts' '--old' '.\test\ut\apiDiff\old\ut_api_name_change.d.ts' '--new' '.\test\ut\apiDiff\new\ut_api_name_change.d.ts' '--old-version' '1' '--new-version' '2' '--output' '.\'
|
||||
```
|
||||
|
@ -8,9 +8,7 @@
|
||||
"testAll": "mocha --config test/mocha/.mocharc.jsonc",
|
||||
"pack": "cross-env NODE_ENV='production' webpack --mode=production",
|
||||
"build": "npm run pack --bundle",
|
||||
"product": "ts-node src/main.ts -i test/debug/ut_nest_007.d.ts -o test/debug/output.json",
|
||||
"installDev": "npm install && npm install typescript@./deps/ohos-typescript-4.2.3-r2.tgz",
|
||||
"installProd": "npm install && npm install typescript@../../../../third_party/typescript/build_package/ohos-typescript-4.2.3-r2.tgz"
|
||||
"product": "ts-node src/main.ts -i test/debug/ut_nest_007.d.ts -o test/debug/output.json"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
@ -21,7 +19,8 @@
|
||||
"exceljs": "^4.3.0",
|
||||
"fs": "^0.0.1-security",
|
||||
"lodash": "^4.17.21",
|
||||
"path": "^0.12.7"
|
||||
"path": "^0.12.7",
|
||||
"typescript": "npm:ohos-typescript@^4.2.3-r5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/chai": "^4.3.5",
|
||||
|
@ -20,6 +20,11 @@ import { FileUtils } from '../utils/FileUtils';
|
||||
import { LogUtil } from '../utils/logUtil';
|
||||
import { FilesMap, Parser } from '../coreImpl/parser/parser';
|
||||
import { WriterHelper } from './writer';
|
||||
import { LocalEntry } from '../coreImpl/checker/local_entry';
|
||||
import { ApiResultSimpleInfo } from '../typedef/checker/result_type';
|
||||
import { NumberConstant } from '../utils/Constant';
|
||||
import { ApiStatisticsHelper } from '../coreImpl/statistics/Statistics';
|
||||
import { ApiStatisticsInfo } from '../typedef/statistics/ApiStatistics';
|
||||
|
||||
/**
|
||||
* 工具名称的枚举值,用于判断执行哪个工具
|
||||
@ -31,6 +36,10 @@ export enum toolNameType {
|
||||
* 统计工具
|
||||
*/
|
||||
COOLECT = 'collect',
|
||||
/**
|
||||
* 检查工具
|
||||
*/
|
||||
CHECK = 'check',
|
||||
}
|
||||
|
||||
/**
|
||||
@ -178,11 +187,92 @@ function collectApi(options: optionObjType): toolNameValueType {
|
||||
}
|
||||
const fileContent: string = Parser.getParseResults(allApis);
|
||||
return {
|
||||
data: [fileContent],
|
||||
data: options.format === 'excel' ? ApiStatisticsHelper.getApiStatisticsInfos(allApis) : [fileContent],
|
||||
callback: collectApiCallback,
|
||||
};
|
||||
} catch (exception) {
|
||||
const error = exception as Error;
|
||||
LogUtil.e(`error collect`, error.stack ? error.stack : error.message);
|
||||
return {
|
||||
data: [],
|
||||
callback: collectApiCallback,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function collectApiCallback(apiData: ApiStatisticsInfo[], sheet: ExcelJS.Worksheet): void {
|
||||
const apiRelationsSet: Set<string> = new Set();
|
||||
sheet.name = 'JsApi';
|
||||
sheet.views = [{ xSplit: 1 }];
|
||||
sheet.getRow(1).values = [
|
||||
'模块名',
|
||||
'类名',
|
||||
'方法名',
|
||||
'函数',
|
||||
'类型',
|
||||
'起始版本',
|
||||
'废弃版本',
|
||||
'syscap',
|
||||
'是否为系统API',
|
||||
'模型限制',
|
||||
'权限',
|
||||
'是否支持跨平台',
|
||||
'装饰器',
|
||||
'文件路径',
|
||||
];
|
||||
let lineNumber = 2;
|
||||
apiData.forEach((apiInfo: ApiStatisticsInfo) => {
|
||||
const apiRelations: string = `${apiInfo.getHierarchicalRelations()},${apiInfo.getDefinedText()}`;
|
||||
if (apiRelationsSet.has(apiRelations)) {
|
||||
return;
|
||||
}
|
||||
|
||||
sheet.getRow(lineNumber).values = [
|
||||
apiInfo.getPackageName(),
|
||||
apiInfo.getParentModuleName(),
|
||||
apiInfo.getApiName(),
|
||||
apiInfo.getDefinedText(),
|
||||
apiInfo.getApiType(),
|
||||
apiInfo.getSince(),
|
||||
apiInfo.getDeprecatedVersion(),
|
||||
apiInfo.getSyscap(),
|
||||
apiInfo.getApiLevel(),
|
||||
apiInfo.getModelLimitation(),
|
||||
apiInfo.getPermission(),
|
||||
apiInfo.getIsCrossPlatForm(),
|
||||
apiInfo.getDecorators()?.join(),
|
||||
apiInfo.getFilePath(),
|
||||
];
|
||||
lineNumber++;
|
||||
apiRelationsSet.add(apiRelations);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 收集api工具调用方法
|
||||
*
|
||||
* @param { optionObjType } options
|
||||
* @return { toolNameValueType }
|
||||
*/
|
||||
function checkApi(options: optionObjType): toolNameValueType {
|
||||
let allApis: FilesMap;
|
||||
try {
|
||||
let fileContent: ApiResultSimpleInfo[] = [];
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
fileContent = LocalEntry.checkEntryLocal();
|
||||
} else if (process.env.NODE_ENV === 'production') {
|
||||
}
|
||||
let finalData: (string | ApiResultSimpleInfo)[] = [];
|
||||
if (options.format === formatType.JSON) {
|
||||
finalData = [JSON.stringify(fileContent, null, NumberConstant.INDENT_SPACE)];
|
||||
} else {
|
||||
finalData = fileContent;
|
||||
}
|
||||
return {
|
||||
data: finalData,
|
||||
};
|
||||
} catch (exception) {
|
||||
const error = exception as Error;
|
||||
LogUtil.e('error collect', error.stack ? error.stack : error.message);
|
||||
return {
|
||||
data: [],
|
||||
};
|
||||
@ -194,6 +284,7 @@ function collectApi(options: optionObjType): toolNameValueType {
|
||||
*/
|
||||
export const toolNameMethod: Map<string, toolNameMethodType> = new Map([
|
||||
[toolNameType.COOLECT, collectApi],
|
||||
[toolNameType.CHECK, checkApi],
|
||||
]);
|
||||
|
||||
/**
|
||||
|
34
build-tools/dts_parser/src/coreImpl/checker/entry.ts
Normal file
34
build-tools/dts_parser/src/coreImpl/checker/entry.ts
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2023 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 { ApiResultSimpleInfo } from '../../typedef/checker/result_type';
|
||||
import { Check } from './src/api_check_plugin';
|
||||
import { LogUtil } from '../../utils/logUtil';
|
||||
|
||||
/**
|
||||
* online entrance
|
||||
*/
|
||||
export class Entry {
|
||||
static checkEntry(): ApiResultSimpleInfo[] {
|
||||
const mdFilesPath = '';
|
||||
let result: ApiResultSimpleInfo[] = [];
|
||||
try {
|
||||
result = Check.scanEntry(mdFilesPath);
|
||||
} catch (error) {
|
||||
LogUtil.e('API_CHECK_ERROR', error);
|
||||
} finally {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
36
build-tools/dts_parser/src/coreImpl/checker/local_entry.ts
Normal file
36
build-tools/dts_parser/src/coreImpl/checker/local_entry.ts
Normal file
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (c) 2023 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 path from 'path';
|
||||
import { ApiResultSimpleInfo } from '../../typedef/checker/result_type';
|
||||
import { Check } from './src/api_check_plugin';
|
||||
import { FileUtils } from '../../utils/FileUtils';
|
||||
import { LogUtil } from '../../utils/logUtil';
|
||||
|
||||
/**
|
||||
* local entrance
|
||||
*/
|
||||
export class LocalEntry {
|
||||
static checkEntryLocal(): ApiResultSimpleInfo[] {
|
||||
const mdFilesPath = path.resolve(FileUtils.getBaseDirName(), '../mdFiles.txt');
|
||||
let result: ApiResultSimpleInfo[] = [];
|
||||
try {
|
||||
result = Check.scanEntry(mdFilesPath);
|
||||
} catch (error) {
|
||||
LogUtil.e('API_CHECK_ERROR', error);
|
||||
} finally {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (c) 2023 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 fs from 'fs';
|
||||
import { Parser, FilesMap } from '../../parser/parser';
|
||||
import { ApiResultSimpleInfo } from '../../../typedef/checker/result_type';
|
||||
|
||||
export class Check {
|
||||
|
||||
/**
|
||||
* checker tool main entrance
|
||||
* @param { string } url -File path for storing file information.
|
||||
* @returns { ApiResultSimpleInfo[] } error message array
|
||||
*/
|
||||
static scanEntry(url: string): ApiResultSimpleInfo[] {
|
||||
const checkErrorArr: ApiResultSimpleInfo[] = [];
|
||||
if (fs.existsSync(url)) {
|
||||
const files: Array<string> = Check.getMdFiles(url);
|
||||
files.forEach((filePath: string) => {
|
||||
Check.parseAPICodeStyle(filePath);
|
||||
});
|
||||
}
|
||||
return checkErrorArr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain the path of the file to be checked.
|
||||
* @param { string } url -File path for storing file information.
|
||||
* @returns { Array<string> } -file path array
|
||||
*/
|
||||
static getMdFiles(url: string): Array<string> {
|
||||
const content: string = fs.readFileSync(url, 'utf-8');
|
||||
const mdFiles: Array<string> = content.split(/[(\r\n)\r\n]+/);
|
||||
return mdFiles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Based on a single file path,parse it using the Parser method.
|
||||
* @param { string } filePath -single file path to be checked
|
||||
*/
|
||||
static parseAPICodeStyle(filePath: string): FilesMap {
|
||||
const fileDir: string = filePath.substring(0, filePath.lastIndexOf('\\'));
|
||||
const parseResult: FilesMap = Parser.parseFile(fileDir, filePath);
|
||||
return parseResult;
|
||||
}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (c) 2023 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, softwarecheck{ }
|
||||
* 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 { ApiResultSimpleInfo, ApiResultInfo } from '../../../typedef/checker/result_type';
|
||||
|
||||
export class AddErrorLogs {
|
||||
/**
|
||||
* 按照格式生成错误信息
|
||||
* @param { number } id -error message id
|
||||
* @param { number } level -error level
|
||||
* @param { string } filePath -error message file path
|
||||
* @param { string } location -error message location
|
||||
* @param { string } errorType -error message wrong type
|
||||
* @param { string } apiType -error message log type
|
||||
* @param { number } version -error message version
|
||||
* @param { string } apiName -error message api name
|
||||
* @param { string } apiFullText -error message api text
|
||||
* @param { string } message -error infomation
|
||||
* @param { ApiResultSimpleInfo[] } checkErrorArr -array for storing error information
|
||||
*/
|
||||
static addAPICheckErrorLogs(id: number, level: number, filePath: string, location: string, errorType: string,
|
||||
apiType: string, version: number, apiName: string, apiFullText: string,
|
||||
message: string, checkErrorArr: ApiResultSimpleInfo[]): void {
|
||||
const apiChecktSimpleErrorLog: ApiResultSimpleInfo = new ApiResultSimpleInfo();
|
||||
apiChecktSimpleErrorLog
|
||||
.setID(id)
|
||||
.setLevel(level)
|
||||
.setLocation(location)
|
||||
.setFilePath(filePath)
|
||||
.setMessage(message);
|
||||
|
||||
const apiCheckErrorLog: ApiResultInfo = new ApiResultInfo();
|
||||
apiCheckErrorLog
|
||||
.setErrorType(errorType)
|
||||
.setLocation(location)
|
||||
.setApiType(apiType)
|
||||
.setMessage(message)
|
||||
.setVersion(version)
|
||||
.setLevel(level)
|
||||
.setApiName(apiName)
|
||||
.setApiFullText(apiFullText);
|
||||
|
||||
checkErrorArr.push(apiChecktSimpleErrorLog);
|
||||
}
|
||||
}
|
236
build-tools/dts_parser/src/coreImpl/statistics/Statistics.ts
Normal file
236
build-tools/dts_parser/src/coreImpl/statistics/Statistics.ts
Normal file
@ -0,0 +1,236 @@
|
||||
/*
|
||||
* Copyright (c) 2023 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 {
|
||||
ApiInfo,
|
||||
ApiType,
|
||||
BasicApiInfo,
|
||||
ContainerApiInfo,
|
||||
containerApiTypes,
|
||||
} from '../../typedef/parser/ApiInfoDefination';
|
||||
import {
|
||||
ApiStatisticsInfo,
|
||||
apiStatisticsType,
|
||||
mergeDefinedTextType,
|
||||
notMergeDefinedText,
|
||||
} from '../../typedef/statistics/ApiStatistics';
|
||||
import { Comment } from '../../typedef/parser/Comment';
|
||||
import { StringConstant, NumberConstant } from '../../utils/Constant';
|
||||
import { ApiInfosMap, FileInfoMap, FilesMap, BasicApiInfoMap } from '../parser/parser';
|
||||
import ts from 'typescript';
|
||||
|
||||
export class ApiStatisticsHelper {
|
||||
/**
|
||||
* 获取需要收集的api信息
|
||||
*
|
||||
* @param { FilesMap } apiMap 根据接口定义文件处理得到的map结果
|
||||
* @returns { ApiStatisticsInfo[] } 返回需要统计的api列表
|
||||
*/
|
||||
static getApiStatisticsInfos(apiMap: FilesMap): ApiStatisticsInfo[] {
|
||||
const apiStatisticsInfos: ApiStatisticsInfo[] = [];
|
||||
// map的第一层key均为文件路径名
|
||||
for (const filePath of apiMap.keys()) {
|
||||
const fileMap: FileInfoMap | undefined = apiMap.get(filePath);
|
||||
if (!fileMap) {
|
||||
continue;
|
||||
}
|
||||
ApiStatisticsHelper.processFileApiMap(fileMap, apiStatisticsInfos);
|
||||
}
|
||||
return apiStatisticsInfos;
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到SourceFile节点下的第一层节点解析后的对象,方便后续以此为基础,得到整个文件所有的节点信息
|
||||
*
|
||||
* @param { FileInfoMap } fileMap 获取到的一个文件解析到的map对象
|
||||
* @param { ApiStatisticsInfo[] } apiStatisticsInfos SourceFile节点下的第一层节点解析后的对象
|
||||
*/
|
||||
static processFileApiMap(fileMap: FileInfoMap, apiStatisticsInfos: ApiStatisticsInfo[]): void {
|
||||
for (const apiKey of fileMap.keys()) {
|
||||
if (apiKey === StringConstant.SELF) {
|
||||
continue;
|
||||
}
|
||||
const apiInfoMap: ApiInfosMap | BasicApiInfo[] | undefined = fileMap.get(apiKey);
|
||||
if (!apiInfoMap || Array.isArray(apiInfoMap)) {
|
||||
continue;
|
||||
}
|
||||
const apiInfos: BasicApiInfo[] | BasicApiInfoMap | undefined = apiInfoMap.get(StringConstant.SELF);
|
||||
const sameNameRawTextMap: Map<string, string> = new Map();
|
||||
if (!apiInfos || !Array.isArray(apiInfos)) {
|
||||
continue;
|
||||
}
|
||||
ApiStatisticsHelper.connectDefinedText(apiInfos, sameNameRawTextMap);
|
||||
apiInfos.forEach((apiInfo: BasicApiInfo) => {
|
||||
ApiStatisticsHelper.processApiInfo(apiInfo, apiStatisticsInfos, sameNameRawTextMap);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 遍历一个文件内的所有API,将同名函数的API声明合并
|
||||
*
|
||||
* @param { BasicApiInfo[] } apiInfos 存放API信息的数组
|
||||
* @param { Map<string, string> } sameNameRawTextMap 存放处理后的同名函数声明
|
||||
*/
|
||||
static connectDefinedText(apiInfos: BasicApiInfo[], sameNameRawTextMap: Map<string, string>): void {
|
||||
apiInfos.forEach((apiInfo: BasicApiInfo) => {
|
||||
if (apiInfo.getApiType() === ApiType.METHOD) {
|
||||
const node: ts.Node | undefined = apiInfo.getNode();
|
||||
if (!node) {
|
||||
return;
|
||||
}
|
||||
if (!mergeDefinedTextType.has(node.kind)) {
|
||||
return;
|
||||
}
|
||||
if (notMergeDefinedText.has(apiInfo.getApiName())) {
|
||||
return;
|
||||
}
|
||||
const currentApiText: string | undefined = sameNameRawTextMap.get(ApiStatisticsHelper.joinRelations(apiInfo));
|
||||
if (currentApiText) {
|
||||
const definedText: string = `${currentApiText}\n${apiInfo.getDefinedText()}`;
|
||||
sameNameRawTextMap.set(ApiStatisticsHelper.joinRelations(apiInfo), definedText);
|
||||
return;
|
||||
} else {
|
||||
sameNameRawTextMap.set(ApiStatisticsHelper.joinRelations(apiInfo), apiInfo.getDefinedText());
|
||||
}
|
||||
}
|
||||
|
||||
if (containerApiTypes.has(apiInfo.getApiType())) {
|
||||
const containerApiInfo: ContainerApiInfo = apiInfo as ContainerApiInfo;
|
||||
ApiStatisticsHelper.connectDefinedText(containerApiInfo.getChildApis(), sameNameRawTextMap);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理API层级关系
|
||||
*
|
||||
* @param { BasicApiInfo } childApiInfo API信息
|
||||
* @returns
|
||||
*/
|
||||
static joinRelations(childApiInfo: BasicApiInfo): string {
|
||||
const relations = childApiInfo.getHierarchicalRelations().join();
|
||||
return relations;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据传入的api信息,转化为需要统计的api信息对象并统计
|
||||
*
|
||||
* @param { BasicApiInfo } basicApiInfo 解析后的api对象
|
||||
* @param apiStatisticsInfos api统计列表对象
|
||||
*/
|
||||
static processApiInfo(
|
||||
basicApiInfo: BasicApiInfo,
|
||||
apiStatisticsInfos: ApiStatisticsInfo[],
|
||||
sameNameRawTextMap: Map<string, string>
|
||||
): void {
|
||||
if (!apiStatisticsType.has(basicApiInfo.getApiType())) {
|
||||
return;
|
||||
}
|
||||
const apiInfo: ApiInfo = basicApiInfo as ApiInfo;
|
||||
|
||||
const apiStatisticsInfo: ApiStatisticsInfo = ApiStatisticsHelper.initApiStatisticsInfo(apiInfo, sameNameRawTextMap);
|
||||
if (apiStatisticsInfo.getApiType() !== ApiType.ENUM) {
|
||||
apiStatisticsInfos.push(apiStatisticsInfo);
|
||||
}
|
||||
|
||||
if (!containerApiTypes.has(apiInfo.getApiType())) {
|
||||
return;
|
||||
}
|
||||
const containerApiInfo: ContainerApiInfo = apiInfo as ContainerApiInfo;
|
||||
containerApiInfo.getChildApis().forEach((childApiInfo: BasicApiInfo) => {
|
||||
ApiStatisticsHelper.processApiInfo(childApiInfo, apiStatisticsInfos, sameNameRawTextMap);
|
||||
});
|
||||
}
|
||||
|
||||
static initApiStatisticsInfo(apiInfo: ApiInfo, sameNameRawTextMap: Map<string, string>): ApiStatisticsInfo {
|
||||
const apiStatisticsInfo: ApiStatisticsInfo = new ApiStatisticsInfo();
|
||||
const relations = apiInfo.getHierarchicalRelations();
|
||||
if (relations.length > NumberConstant.RELATION_LENGTH) {
|
||||
apiStatisticsInfo.setParentModuleName(relations[relations.length - NumberConstant.RELATION_LENGTH]);
|
||||
}
|
||||
const apiRelations: string = ApiStatisticsHelper.joinRelations(apiInfo);
|
||||
const sameNameDefinedText: string | undefined = sameNameRawTextMap.get(apiRelations);
|
||||
|
||||
apiStatisticsInfo
|
||||
.setFilePath(apiInfo.getFilePath())
|
||||
.setApiType(apiInfo.getApiType())
|
||||
.setDefinedText(sameNameDefinedText ? sameNameDefinedText : apiInfo.getDefinedText())
|
||||
.setApiName(apiInfo.getApiName())
|
||||
.setPos(apiInfo.getPos())
|
||||
.setHierarchicalRelations(relations.join('/'))
|
||||
.setDecorators(apiInfo.getDecorators());
|
||||
const firstJsDocInfo: Comment.JsDocInfo | undefined = apiInfo.getJsDocInfos()[0];
|
||||
if (firstJsDocInfo) {
|
||||
apiStatisticsInfo.setSince(firstJsDocInfo.getSince());
|
||||
}
|
||||
const jsDocInfo: Comment.JsDocInfo | undefined = apiInfo.getLatestJsDocInfo();
|
||||
if (jsDocInfo) {
|
||||
apiStatisticsInfo
|
||||
.setSyscap(jsDocInfo.getSyscap() ? jsDocInfo.getSyscap() : ApiStatisticsHelper.extendSyscap(apiInfo))
|
||||
.setPermission(jsDocInfo.getPermission())
|
||||
.setIsForm(jsDocInfo.getIsForm())
|
||||
.setIsCrossPlatForm(jsDocInfo.getIsCrossPlatForm())
|
||||
.setDeprecatedVersion(
|
||||
jsDocInfo.getDeprecatedVersion() === NumberConstant.DEFAULT_DEPRECATED_VERSION ?
|
||||
'' :
|
||||
jsDocInfo.getDeprecatedVersion()
|
||||
)
|
||||
.setUseInstead(jsDocInfo.getUseinstead())
|
||||
.setApiLevel(jsDocInfo.getIsSystemApi())
|
||||
.setModelLimitation(jsDocInfo.getModelLimitation());
|
||||
} else {
|
||||
apiStatisticsInfo.setSyscap(ApiStatisticsHelper.extendSyscap(apiInfo));
|
||||
}
|
||||
return apiStatisticsInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 未标注@syscap的API,从父级API寻找syscap
|
||||
*
|
||||
* @param {ApiInfo} apiInfo API信息
|
||||
* @returns syscap
|
||||
*/
|
||||
static extendSyscap(apiInfo: ApiInfo): string {
|
||||
let curApiInfo: ApiInfo = apiInfo;
|
||||
let syscap: string = '';
|
||||
const node: ts.Node | undefined = curApiInfo.getNode();
|
||||
while (node && curApiInfo && !ts.isSourceFile(node)) {
|
||||
const jsdoc: Comment.JsDocInfo | undefined = curApiInfo.getLatestJsDocInfo();
|
||||
if (jsdoc) {
|
||||
syscap = jsdoc.getSyscap();
|
||||
}
|
||||
if (syscap) {
|
||||
return syscap;
|
||||
}
|
||||
curApiInfo = curApiInfo.getParentApi() as ApiInfo;
|
||||
}
|
||||
return syscap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取api的总数
|
||||
*
|
||||
* @param { ApiStatisticsInfo[] } apiStatisticsInfos api统计列表对象
|
||||
* @returns { number } api的数量
|
||||
*/
|
||||
static getApiNumber(apiStatisticsInfos: ApiStatisticsInfo[]): number {
|
||||
const apis: Set<string> = new Set();
|
||||
apiStatisticsInfos.forEach((apiStatisticsInfo: ApiStatisticsInfo) => {
|
||||
apis.add(apiStatisticsInfo.getHierarchicalRelations());
|
||||
});
|
||||
return apis.size;
|
||||
}
|
||||
}
|
285
build-tools/dts_parser/src/typedef/checker/result_type.ts
Normal file
285
build-tools/dts_parser/src/typedef/checker/result_type.ts
Normal file
@ -0,0 +1,285 @@
|
||||
/*
|
||||
* Copyright (c) 2023 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* custom decorator array
|
||||
*/
|
||||
export const customDoc = ['constant', 'crossplatform', 'default', 'deprecated', 'enum', 'example', 'extends',
|
||||
'famodelonly', 'fires', 'form', 'interface', 'namespace', 'param', 'permission', 'readonly', 'returns', 'since',
|
||||
'stagemodelonly', 'static', 'syscap', 'systemapi', 'type', 'typedef', 'throws', 'test', 'useinstead',
|
||||
'FAModelOnly', 'StageModelOnly'] as const;
|
||||
|
||||
/**
|
||||
* javascript decorator array
|
||||
*/
|
||||
export const jsDoc = ['abstract', 'access', 'alias', 'async', 'augments', 'author', 'borrows', 'class', 'classdesc', 'constructs',
|
||||
'copyright', 'event', 'exports', 'external', 'file', 'function', 'generator', 'global', 'hideconstructor', 'ignore', 'implements',
|
||||
'inheritdoc', 'inner', 'instance', 'lends', 'license', 'listens', 'member', 'memberof', 'mixes', 'mixin', 'modifies', 'module',
|
||||
'package', 'private', 'property', 'protected', 'public', 'requires', 'see', 'summary', 'this', 'todo', 'tutorial', 'variation',
|
||||
'version', 'yields', 'also', 'description', 'kind', 'name', 'undocumented'] as const;
|
||||
|
||||
/**
|
||||
* error message type
|
||||
* @enum { string }
|
||||
*/
|
||||
export enum ErrorType {
|
||||
UNKNOW_DECORATOR = 'unknow decorator',
|
||||
MISSPELL_WORDS = 'misspell words',
|
||||
NAMING_ERRORS = 'naming errors',
|
||||
UNKNOW_PERMISSION = 'unknow permission',
|
||||
UNKNOW_SYSCAP = 'unknow syscap',
|
||||
UNKNOW_DEPRECATED = 'unknow deprecated',
|
||||
WRONG_ORDER = 'wrong order',
|
||||
WRONG_VALUE = 'wrong value',
|
||||
WRONG_SCENE = 'wrong scene',
|
||||
PARAMETER_ERRORS = 'wrong parameter',
|
||||
API_PAIR_ERRORS = 'limited api pair errors',
|
||||
ILLEGAL_ANY = 'illegal any',
|
||||
API_CHANGE_ERRORS = 'api change errors'
|
||||
}
|
||||
|
||||
/**
|
||||
* error message id
|
||||
* @enum { number }
|
||||
*/
|
||||
export enum ErrorID {
|
||||
UNKNOW_DECORATOR_ID = 0,
|
||||
MISSPELL_WORDS_ID = 1,
|
||||
NAMING_ERRORS_ID = 2,
|
||||
UNKNOW_PERMISSION_ID = 3,
|
||||
UNKNOW_SYSCAP_ID = 4,
|
||||
UNKNOW_DEPRECATED_ID = 5,
|
||||
WRONG_ORDER_ID = 6,
|
||||
WRONG_VALUE_ID = 7,
|
||||
WRONG_SCENE_ID = 8,
|
||||
PARAMETER_ERRORS_ID = 9,
|
||||
API_PAIR_ERRORS_ID = 10,
|
||||
ILLEGAL_ANY_ID = 11,
|
||||
API_CHANGE_ERRORS_ID = 12
|
||||
}
|
||||
|
||||
/**
|
||||
* error type
|
||||
* @enum { string }
|
||||
*/
|
||||
export enum LogType {
|
||||
LOG_API = 'Api',
|
||||
LOG_JSDOC = 'JsDoc',
|
||||
LOG_FILE = 'File',
|
||||
};
|
||||
|
||||
/**
|
||||
* error message level
|
||||
* @enum { number }
|
||||
*/
|
||||
export enum ErrorLevel {
|
||||
HIGH = 3,
|
||||
MIDDLE = 2,
|
||||
LOW = 1,
|
||||
};
|
||||
|
||||
/**
|
||||
* error message infomation
|
||||
* @enum { string }
|
||||
*/
|
||||
export enum ErrorMessage {
|
||||
ERROR_INFO_VALUE_EXTENDS = 'the [extends] tag value is incorrect. Please check if the tag value matches the inherited class name.',
|
||||
ERROR_INFO_VALUE_ENUM = 'the [enum] tag type is incorrect. Please check if the tag type is { string } or { number }',
|
||||
ERROR_INFO_VALUE_SINCE = 'the [since] tag value is incorrect. Please check if the tag value is a numerical value',
|
||||
ERROR_INFO_RETURNS = 'the [returns] tag was used incorrectly. The returns tag should not be used when the return type is void',
|
||||
ERROR_INFO_VALUE_RETURNS = 'the [returns] tag type is incorrect. Please check if the tag type is consistent with the return type',
|
||||
ERROR_INFO_VALUE_USEINSTEAD = 'the [useinstead] tag value is incorrect. Please check the usage method',
|
||||
ERROR_INFO_VALUE_TYPE = 'the [type] tag type is incorrect. Please check if the type matches the attribute type',
|
||||
ERROR_INFO_VALUE_DEFAULT = 'the [default] tag value is incorrect. Please supplement the default value',
|
||||
ERROR_INFO_VALUE_PERMISSION = 'the [permission] tag value is incorrect. Please check if the permission field has been configured or update the configuration file',
|
||||
ERROR_INFO_VALUE_DEPRECATED = 'the [deprecated] tag value is incorrect. Please check the usage method',
|
||||
ERROR_INFO_VALUE_SYSCAP = 'the [syscap] tag value is incorrect. Please check if the syscap field is configured',
|
||||
ERROR_INFO_VALUE_NAMESPACE = 'the [namespace] tag value is incorrect. Please check if it matches the namespace name',
|
||||
ERROR_INFO_VALUE_INTERFACE = 'the [interface] label value is incorrect. Please check if it matches the interface name',
|
||||
ERROR_INFO_VALUE_TYPEDEF = 'the [typedef] tag value is incorrect. Please check if it matches the interface name',
|
||||
ERROR_INFO_TYPE_PARAM = 'the type of the [$$] [param] tag is incorrect. Please check if it matches the type of the [$$] parameter',
|
||||
ERROR_INFO_VALUE_PARAM = 'the value of the [$$] [param] tag is incorrect. Please check if it matches the [$$] parameter name',
|
||||
ERROR_INFO_VALUE1_THROWS = 'the type of the [$$] [throws] tag is incorrect. Please fill in [BusinessError]',
|
||||
ERROR_INFO_VALUE2_THROWS = 'the type of the [$$] [throws] tag is incorrect. Please check if the tag value is a numerical value',
|
||||
ERROR_INFO_INHERIT = 'it was detected that there is an inheritable label [$$] in the current file, but there are child nodes without this label',
|
||||
ERROR_ORDER = 'JSDoc label order error, please make adjustments',
|
||||
ERROR_LABELNAME = 'the [$$] tag does not exist. Please use a valid JSDoc tag',
|
||||
ERROR_LOST_LABEL = 'JSDoc tag validity verification failed. Please confirm if the [$$] tag is missing',
|
||||
ERROR_USE = 'JSDoc label validity verification failed. The [$$] label is not allowed. Please check the label usage method.',
|
||||
ERROR_MORELABEL = 'JSDoc tag validity verification failed. The [$$] [$$] tag is redundant. Please check if the tag should be deleted.',
|
||||
ERROR_REPEATLABEL = 'the validity verification of the JSDoc tag failed. The [$$] tag is not allowed to be reused, please delete the extra tags',
|
||||
ERROR_USE_INTERFACE = 'the validity verification of the JSDoc tag failed. The [interface] tag and [typedef] tag are not allowed to be used simultaneously. Please confirm the interface class.',
|
||||
ERROR_EVENT_NAME_STRING = 'The event name should be string.',
|
||||
ERROR_EVENT_NAME_NULL = 'The event name cannot be Null value.',
|
||||
ERROR_EVENT_NAME_SMALL_HUMP = 'The event name should be named by small hump. (Received [\'$$\'])',
|
||||
ERROR_EVENT_CALLBACK_OPTIONAL = 'The callback parameter of off function should be optional.',
|
||||
ERROR_EVENT_CALLBACK_MISSING = 'The off functions of one single event should have at least one callback parameter, and the callback parameter should be the last parameter.',
|
||||
ERROR_EVENT_ON_AND_OFF_PAIR = 'The on and off event subscription methods do not appear in pair.',
|
||||
ILLEGAL_USE_ANY = 'Illegal [any] keyword used in the API',
|
||||
ERROR_CHANGES_VERSION = 'Please check if the changed API version number is 10.',
|
||||
ERROR_CHANGES_API_HISTORY_PARAM_REQUIRED_CHANGE = 'Forbid changes: Optional parameters cannot be changed to required parameters.',
|
||||
ERROR_CHANGES_API_HISTORY_PARAM_RANGE_CHANGE = 'Forbid changes: Parameters type range cannot be reduced.',
|
||||
ERROR_CHANGES_API_HISTORY_PARAM_WITHOUT_TYPE_CHANGE = 'Forbid changes: Parameters Parameter must be defined by type.',
|
||||
ERROR_CHANGES_API_HISTORY_PARAM_TYPE_CHANGE = 'Forbid changes: Parameters type cannot be modified.',
|
||||
ERROR_CHANGES_API_HISTORY_PARAM_POSITION_CHANGE = 'Forbid changes: Parameters position not be allowed to be modified.',
|
||||
ERROR_CHANGES_API_NEW_REQUIRED_PARAM = 'Forbid changes: Required parameters cannot be created.',
|
||||
ERROR_CHANGES_API_DELETE_PARAM = 'Forbid changes: Parameters cannot be deleted.',
|
||||
ERROR_CHANGES_DEPRECATED = 'Forbid changes: The api has deprecated tag.',
|
||||
ERROR_CHANGES_JSDOC_NUMBER = 'Forbid changes: API changes must add a new section of JSDoc.',
|
||||
ERROR_CHANGES_JSDOC_CHANGE = 'Forbid changes: Previous JSDoc cannot be changed.',
|
||||
ERROR_CHANGES_JSDOC_TRROWS = 'Forbid changes: Throws tag cannot be created.',
|
||||
ERROR_CHANGES_JSDOC_PERMISSION = 'Forbid changes: Permission tag cannot be created or modified.',
|
||||
}
|
||||
|
||||
/**
|
||||
* online error message format
|
||||
*/
|
||||
export class ApiResultSimpleInfo {
|
||||
id: number = -1;
|
||||
level: number = -1;
|
||||
filePath: string = '';
|
||||
location: string = '';
|
||||
message: string = '';
|
||||
|
||||
setID(id: number): ApiResultSimpleInfo {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
getID(): number {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
setLevel(level: number): ApiResultSimpleInfo {
|
||||
this.level = level;
|
||||
return this;
|
||||
}
|
||||
|
||||
getLevel(): number {
|
||||
return this.level;
|
||||
}
|
||||
|
||||
setLocation(location: string): ApiResultSimpleInfo {
|
||||
this.location = location;
|
||||
return this;
|
||||
}
|
||||
|
||||
getLocation(): string {
|
||||
return this.location;
|
||||
}
|
||||
|
||||
setFilePath(fileFilePath: string): ApiResultSimpleInfo {
|
||||
this.filePath = fileFilePath;
|
||||
return this;
|
||||
}
|
||||
|
||||
getFilePath(): string {
|
||||
return this.filePath;
|
||||
}
|
||||
|
||||
setMessage(message: string): ApiResultSimpleInfo {
|
||||
this.message = message;
|
||||
return this;
|
||||
}
|
||||
|
||||
getMessage(): string {
|
||||
return this.message;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* local excel table error message format
|
||||
*/
|
||||
export class ApiResultInfo {
|
||||
errorType: string = '';
|
||||
location: string = '';
|
||||
apiType: string = '';
|
||||
message: string = '';
|
||||
version: number = -1;
|
||||
level: number = -1;
|
||||
apiName: string = '';
|
||||
apiFullText: string = '';
|
||||
|
||||
setErrorType(errorType: string): ApiResultInfo {
|
||||
this.errorType = errorType;
|
||||
return this;
|
||||
}
|
||||
|
||||
getErrorType(): string {
|
||||
return this.errorType;
|
||||
}
|
||||
|
||||
setLocation(location: string): ApiResultInfo {
|
||||
this.location = location;
|
||||
return this;
|
||||
}
|
||||
|
||||
getLocation(): string {
|
||||
return this.location;
|
||||
}
|
||||
setApiType(apiType: string): ApiResultInfo {
|
||||
this.apiType = apiType;
|
||||
return this;
|
||||
}
|
||||
|
||||
getApiType(): string {
|
||||
return this.apiType;
|
||||
}
|
||||
|
||||
setMessage(message: string): ApiResultInfo {
|
||||
this.message = message;
|
||||
return this;
|
||||
}
|
||||
|
||||
getMessage(): string {
|
||||
return this.message;
|
||||
}
|
||||
|
||||
setVersion(version: number): ApiResultInfo {
|
||||
this.version = version;
|
||||
return this;
|
||||
}
|
||||
|
||||
getVersion(): number {
|
||||
return this.version;
|
||||
}
|
||||
|
||||
setLevel(level: number): ApiResultInfo {
|
||||
this.level = level;
|
||||
return this;
|
||||
}
|
||||
|
||||
getLevel(): number {
|
||||
return this.level;
|
||||
}
|
||||
|
||||
setApiName(apiName: string): ApiResultInfo {
|
||||
this.apiName = apiName;
|
||||
return this;
|
||||
}
|
||||
|
||||
getApiName(): string {
|
||||
return this.apiName;
|
||||
}
|
||||
|
||||
setApiFullText(apiFullText: string): ApiResultInfo {
|
||||
this.apiFullText = apiFullText;
|
||||
return this;
|
||||
}
|
||||
|
||||
getApiFullText(): string {
|
||||
return this.apiFullText;
|
||||
}
|
||||
}
|
246
build-tools/dts_parser/src/typedef/statistics/ApiStatistics.ts
Normal file
246
build-tools/dts_parser/src/typedef/statistics/ApiStatistics.ts
Normal file
@ -0,0 +1,246 @@
|
||||
/*
|
||||
* Copyright (c) 2023 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 ts from 'typescript';
|
||||
import path from 'path';
|
||||
|
||||
import { ApiType } from '../parser/ApiInfoDefination';
|
||||
import { DecoratorInfo } from '../../typedef/parser/Decorator';
|
||||
import { FunctionUtils } from '../../utils/FunctionUtils';
|
||||
|
||||
/**
|
||||
* 统计工具类,用于存取API相关信息
|
||||
*/
|
||||
export class ApiStatisticsInfo {
|
||||
filePath: string = '';
|
||||
packageName: string = '';
|
||||
parentModuleName: string = 'global';
|
||||
// @syscap标签--api的系统能力
|
||||
syscap: string = '';
|
||||
// @permission标签--api的权限
|
||||
permissions: string = '';
|
||||
// @since标签--api的起始版本
|
||||
since: string = '';
|
||||
// @form标签--api是否支持卡片应用
|
||||
isForm: boolean = false;
|
||||
// @crossplatform标签--api是否支持跨平台
|
||||
isCrossPlatForm: boolean = false;
|
||||
hierarchicalRelations: string = '';
|
||||
apiName: string = '';
|
||||
deprecatedVersion: string = '';
|
||||
useInstead: string = '';
|
||||
apiType: string = '';
|
||||
definedText: string = '';
|
||||
pos: ts.LineAndCharacter = { line: -1, character: -1 };
|
||||
isSystemapi: boolean = false;
|
||||
modelLimitation: string = '';
|
||||
decorators: Array<string> | undefined = [];
|
||||
|
||||
setFilePath(fileFilePath: string): ApiStatisticsInfo {
|
||||
this.filePath = fileFilePath;
|
||||
this.packageName = FunctionUtils.getPackageName(fileFilePath);
|
||||
return this;
|
||||
}
|
||||
|
||||
getPackageName(): string {
|
||||
return this.packageName;
|
||||
}
|
||||
|
||||
getFilePath(): string {
|
||||
return this.filePath;
|
||||
}
|
||||
|
||||
setApiType(apiType: string): ApiStatisticsInfo {
|
||||
this.apiType = apiType === ApiType.DECLARE_CONST ? ApiType.PROPERTY : apiType;
|
||||
return this;
|
||||
}
|
||||
|
||||
getParentModuleName(): string {
|
||||
return this.parentModuleName;
|
||||
}
|
||||
|
||||
setParentModuleName(parentModuleName: string): ApiStatisticsInfo {
|
||||
this.parentModuleName = parentModuleName;
|
||||
return this;
|
||||
}
|
||||
|
||||
setSyscap(syscap?: string): ApiStatisticsInfo {
|
||||
if (syscap) {
|
||||
this.syscap = syscap;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
getSyscap(): string {
|
||||
return this.syscap;
|
||||
}
|
||||
|
||||
setPermission(permissions: string): ApiStatisticsInfo {
|
||||
this.permissions = permissions;
|
||||
return this;
|
||||
}
|
||||
|
||||
getPermission(): string {
|
||||
return this.permissions;
|
||||
}
|
||||
|
||||
setSince(since: string): ApiStatisticsInfo {
|
||||
this.since = since;
|
||||
return this;
|
||||
}
|
||||
|
||||
getSince(): string {
|
||||
return this.since;
|
||||
}
|
||||
|
||||
setIsForm(isForm: boolean): ApiStatisticsInfo {
|
||||
this.isForm = isForm;
|
||||
return this;
|
||||
}
|
||||
|
||||
getIsForm(): boolean {
|
||||
return this.isForm;
|
||||
}
|
||||
|
||||
setIsCrossPlatForm(isCrossPlatForm: boolean): ApiStatisticsInfo {
|
||||
this.isCrossPlatForm = isCrossPlatForm;
|
||||
return this;
|
||||
}
|
||||
|
||||
getIsCrossPlatForm(): boolean {
|
||||
return this.isCrossPlatForm;
|
||||
}
|
||||
|
||||
getApiType(): string {
|
||||
return this.apiType;
|
||||
}
|
||||
|
||||
setDefinedText(definedText: string): ApiStatisticsInfo {
|
||||
this.definedText = definedText;
|
||||
return this;
|
||||
}
|
||||
|
||||
getDefinedText(): string {
|
||||
return this.definedText;
|
||||
}
|
||||
|
||||
setPos(pos: ts.LineAndCharacter): ApiStatisticsInfo {
|
||||
this.pos = pos;
|
||||
return this;
|
||||
}
|
||||
|
||||
getPos(): ts.LineAndCharacter {
|
||||
return this.pos;
|
||||
}
|
||||
|
||||
setApiName(apiName: string): ApiStatisticsInfo {
|
||||
this.apiName = apiName;
|
||||
return this;
|
||||
}
|
||||
|
||||
getApiName(): string {
|
||||
return this.apiName;
|
||||
}
|
||||
|
||||
setHierarchicalRelations(hierarchicalRelations: string): ApiStatisticsInfo {
|
||||
this.hierarchicalRelations = hierarchicalRelations;
|
||||
return this;
|
||||
}
|
||||
|
||||
getHierarchicalRelations(): string {
|
||||
return this.hierarchicalRelations;
|
||||
}
|
||||
|
||||
setDeprecatedVersion(deprecatedVersion: string): ApiStatisticsInfo {
|
||||
this.deprecatedVersion = deprecatedVersion;
|
||||
return this;
|
||||
}
|
||||
|
||||
getDeprecatedVersion(): string {
|
||||
return this.deprecatedVersion;
|
||||
}
|
||||
|
||||
setUseInstead(useInstead: string): ApiStatisticsInfo {
|
||||
this.useInstead = useInstead;
|
||||
return this;
|
||||
}
|
||||
|
||||
getUseInstead(): string {
|
||||
return this.useInstead;
|
||||
}
|
||||
|
||||
setApiLevel(isSystemApi: boolean): ApiStatisticsInfo {
|
||||
this.isSystemapi = isSystemApi;
|
||||
return this;
|
||||
}
|
||||
|
||||
getApiLevel(): boolean {
|
||||
return this.isSystemapi;
|
||||
}
|
||||
|
||||
setModelLimitation(modelLimitation: string): ApiStatisticsInfo {
|
||||
this.modelLimitation = modelLimitation;
|
||||
return this;
|
||||
}
|
||||
|
||||
getModelLimitation(): string {
|
||||
return this.modelLimitation;
|
||||
}
|
||||
|
||||
setDecorators(decorators: DecoratorInfo[] | undefined): ApiStatisticsInfo {
|
||||
decorators?.forEach((decoratorInfo: DecoratorInfo) => {
|
||||
this.decorators?.push(decoratorInfo.expression);
|
||||
});
|
||||
return this;
|
||||
}
|
||||
|
||||
getDecorators(): Array<string> | undefined {
|
||||
return this.decorators;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 需要统计为API的类型
|
||||
*/
|
||||
export const apiStatisticsType: Set<string> = new Set([
|
||||
ApiType.PROPERTY,
|
||||
ApiType.CLASS,
|
||||
ApiType.INTERFACE,
|
||||
ApiType.NAMESPACE,
|
||||
ApiType.METHOD,
|
||||
ApiType.CONSTANT,
|
||||
ApiType.ENUM_VALUE,
|
||||
ApiType.ENUM,
|
||||
ApiType.TYPE_ALIAS,
|
||||
ApiType.DECLARE_CONST,
|
||||
ApiType.STRUCT
|
||||
]);
|
||||
|
||||
/**
|
||||
* 名字为on/off的函数,不合并API声明
|
||||
*/
|
||||
export const notMergeDefinedText: Set<string> = new Set([
|
||||
'on',
|
||||
'off'
|
||||
]);
|
||||
|
||||
/**
|
||||
* 需要进行同名函数合并的API类型
|
||||
*/
|
||||
export const mergeDefinedTextType: Set<number> = new Set([
|
||||
ts.SyntaxKind.MethodDeclaration,
|
||||
ts.SyntaxKind.MethodSignature,
|
||||
ts.SyntaxKind.FunctionDeclaration
|
||||
]);
|
@ -71,3 +71,22 @@ export enum StringConstant {
|
||||
*/
|
||||
UTF8 = 'utf-8',
|
||||
}
|
||||
|
||||
export enum NumberConstant {
|
||||
/**
|
||||
* 缩进2个空格
|
||||
*/
|
||||
INDENT_SPACE = 2,
|
||||
/**
|
||||
* API层级关系
|
||||
*/
|
||||
RELATION_LENGTH = 2,
|
||||
/**
|
||||
* 默认废弃版本为-1
|
||||
*/
|
||||
DEFAULT_DEPRECATED_VERSION = '-1',
|
||||
/**
|
||||
* 判断字段是否存在
|
||||
*/
|
||||
IS_FIELD_EXIST = 0,
|
||||
}
|
34
build-tools/dts_parser/src/utils/FunctionUtils.ts
Normal file
34
build-tools/dts_parser/src/utils/FunctionUtils.ts
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2023 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 path from 'path';
|
||||
import { NumberConstant } from './Constant';
|
||||
|
||||
export class FunctionUtils {
|
||||
/**
|
||||
* 判断文件路径是否为ArkUI,返回ArkUI或文件名
|
||||
*
|
||||
* @param fileFilePath 文件路径
|
||||
* @returns { string } 返回ArkUI或文件名
|
||||
*/
|
||||
static getPackageName(fileFilePath: string): string {
|
||||
const packageName =
|
||||
fileFilePath.indexOf('component\\ets\\') >= NumberConstant.IS_FIELD_EXIST ||
|
||||
fileFilePath.indexOf('component/ets/') >= NumberConstant.IS_FIELD_EXIST ?
|
||||
'ArkUI' :
|
||||
path.basename(fileFilePath).replace(/@|.d.ts$/g, '');
|
||||
return packageName;
|
||||
}
|
||||
}
|
2
build-tools/mdFiles.txt
Normal file
2
build-tools/mdFiles.txt
Normal file
@ -0,0 +1,2 @@
|
||||
# api absolute path
|
||||
Z:\root\interface\sdk-js\api\xxx.d.ts
|
Loading…
Reference in New Issue
Block a user