idlize

Форк
0
/
common.d.ts 
188 строк · 3.9 Кб
1
/*
2
 * Copyright (c) 2024 Huawei Device Co., Ltd.
3
 * Licensed under the Apache License, Version 2.0 (the "License");
4
 * you may not use this file except in compliance with the License.
5
 * You may obtain a copy of the License at
6
 *
7
 *     http://www.apache.org/licenses/LICENSE-2.0
8
 *
9
 * Unless required by applicable law or agreed to in writing, software
10
 * distributed under the License is distributed on an "AS IS" BASIS,
11
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
 * See the License for the specific language governing permissions and
13
 * limitations under the License.
14
 */
15

16
declare type PixelMap = import('../resource/image').default.PixelMap;
17

18
declare type AnimationRange<T> = [from: T, to: T];
19

20
declare interface Callback<T> {}
21

22
declare interface ClickEvent extends BaseEvent {
23

24
    displayX: number;
25

26
    displayY: number;
27
}
28

29
declare interface StateStyles {
30

31
    normal?: any;
32
}
33

34
declare interface AttributeModifier<T>{}
35
declare interface ContentModifier<T>{}
36

37
declare interface SheetTitleOptions {
38
    title: ResourceStr;
39
    subtitle?: ResourceStr;
40
}
41

42
declare interface UICommonEvent {
43
    setOnClick(callback: Callback<ClickEvent> | undefined): void;
44
}
45

46
declare enum SheetSize {
47
    MEDIUM,
48
    LARGE,
49
    FIT_CONTENT = 2,
50
}
51

52
declare interface BindOptions {
53
    backgroundColor?: ResourceColor;
54
}
55

56
declare interface SheetOptions extends BindOptions {
57
    title?: SheetTitleOptions;
58
    detents?: [(SheetSize | Length), (SheetSize | Length)?, (SheetSize | Length)?];
59
}
60

61
declare enum BlurStyle {
62
    Thin = 0,
63
}
64

65
declare enum ThemeColorMode {
66
    SYSTEM = 0,
67
    LIGHT = 1,
68
    DARK = 2
69
}
70

71
declare enum AdaptiveColor {
72
    DEFAULT = 0,
73
}
74

75
declare interface BlurOptions {
76
    grayscale: [number, number];
77
}
78

79
declare interface BlurStyleOptions {
80
    colorMode?: ThemeColorMode;
81
    adaptiveColor?: AdaptiveColor;
82
    scale?: number;
83
    blurOptions?: BlurOptions;
84
}
85

86
declare interface BackgroundBlurStyleOptions extends BlurStyleOptions {}
87

88
declare interface SizeResult {
89
    width: number,
90
    height: number,
91
}
92

93
declare type EdgeWidths = {
94
    top?: Length;
95
    right?: Length;
96
    bottom?: Length;
97
    left?: Length;
98
};
99

100
declare type EdgeWidth = EdgeWidths;
101

102
declare type Padding = {
103
    top?: Length;
104
    right?: Length;
105
    bottom?: Length;
106
    left?: Length;
107
};
108

109
declare interface DragPreviewOptions {
110
    numberBadge?: boolean | number;
111
}
112

113
declare interface DragInteractionOptions {
114

115
    isMultiSelectionEnabled?: boolean;
116

117
    defaultAnimationBeforeLifting?: boolean;
118
}
119

120

121
declare class CommonMethod<T> {
122

123
    constructor();
124

125
    stateStyles(value: StateStyles): T;
126

127
    backdropBlur(value: number, options?: BlurOptions): T;
128

129
    width(value: Length): T;
130

131
    height(value: Length): T;
132

133
    bindSheet(isShow: boolean, builder: () => void, options?: SheetOptions): T;
134

135
    backgroundBlurStyle(value: BlurStyle, options?: BackgroundBlurStyleOptions): T;
136

137
    dragPreviewOptions(value: DragPreviewOptions, options?: DragInteractionOptions): T;
138
}
139

140
declare interface Rectangle {
141

142
    x?: Length;
143

144
    y?: Length;
145

146
    width?: Length;
147

148
    height?: Length;
149
}
150
declare interface CommonInterface { 
151
    (): CommonAttribute
152
}
153
declare class CommonAttribute extends CommonMethod<CommonAttribute> {
154
}
155

156
declare const Common: CommonInterface
157

158
declare class CustomComponent extends CommonAttribute {
159
    build(): void;
160
    aboutToAppear(): void;
161
    aboutToDisappear(): void;
162
    aboutToReuse(params: object): void;
163
    aboutToRecycle(): void;
164
}
165

166
declare class CommonShapeMethod<T> extends CommonMethod<T> {
167
    constructor();
168

169
    stroke(value: ResourceColor): T;
170
}
171

172
declare class ScrollableCommonMethod<T> extends CommonMethod<T> {
173
    scrollBarWidth(value: number | string): T;
174
}
175

176
declare module 'commonEvent' {
177
    module 'commonEvent' {
178
        // @ts-ignore
179
        export { UICommonEvent };
180
    }
181
}
182

183
declare module 'commonAttribute'{
184
    module 'commonAttribute' {
185
        // @ts-ignore
186
        export { CommonAttribute };
187
    }
188
}
189

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.