@lynx-js/types 3.3.1 → 3.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -0
- package/package.json +5 -1
- package/types/background-thread/lynx-performance-entry.d.ts +53 -0
- package/types/background-thread/lynx.d.ts +10 -0
- package/types/common/csstype.d.ts +250 -225
- package/types/common/element/element.d.ts +8 -0
- package/types/common/element/image.d.ts +9 -0
- package/types/common/element/index.d.ts +2 -0
- package/types/common/element/input.d.ts +378 -0
- package/types/common/element/list.d.ts +36 -3
- package/types/common/element/text.d.ts +158 -8
- package/types/common/element/textarea.d.ts +401 -0
- package/types/common/events.d.ts +78 -2
- package/types/common/lynx.d.ts +60 -0
|
@@ -12,11 +12,15 @@ import { PageProps } from './page';
|
|
|
12
12
|
import { ScrollViewProps, ScrollViewUIMethods } from './scroll-view';
|
|
13
13
|
import { TextProps } from './text';
|
|
14
14
|
import { ViewProps } from './view';
|
|
15
|
+
import { InputProps, InputUIMethods } from './input';
|
|
16
|
+
import { TextAreaProps, TextAreaUIMethods } from './textarea';
|
|
15
17
|
|
|
16
18
|
export interface UIMethods {
|
|
17
19
|
'list': ListUIMethods;
|
|
18
20
|
'scroll-view': ScrollViewUIMethods;
|
|
19
21
|
'image': ImageUIMethods;
|
|
22
|
+
'input': InputUIMethods;
|
|
23
|
+
'textarea': TextAreaUIMethods;
|
|
20
24
|
}
|
|
21
25
|
|
|
22
26
|
type LynxComponentProps = ComponentProps;
|
|
@@ -37,6 +41,8 @@ export interface IntrinsicElements {
|
|
|
37
41
|
'text': TextProps;
|
|
38
42
|
'view': ViewProps;
|
|
39
43
|
'raw-text': StandardProps & { text: number | string };
|
|
44
|
+
'input': InputProps;
|
|
45
|
+
'textarea': TextAreaProps;
|
|
40
46
|
}
|
|
41
47
|
|
|
42
48
|
declare module 'react' {
|
|
@@ -57,6 +63,8 @@ declare module 'react' {
|
|
|
57
63
|
'text': TextProps;
|
|
58
64
|
'view': ViewProps;
|
|
59
65
|
'raw-text': StandardProps & { text: number | string };
|
|
66
|
+
'input': InputProps;
|
|
67
|
+
'textarea': TextAreaProps;
|
|
60
68
|
}
|
|
61
69
|
}
|
|
62
70
|
}
|
|
@@ -117,6 +117,15 @@ export interface ImageProps extends StandardProps {
|
|
|
117
117
|
*/
|
|
118
118
|
'autoplay'?: boolean;
|
|
119
119
|
|
|
120
|
+
/**
|
|
121
|
+
* Image animation property. If set to false, images will not be cached. Each image will be discarded by default after use,
|
|
122
|
+
* which is suitable for scenarios where the animation needs to play only once.
|
|
123
|
+
* @defaultValue true
|
|
124
|
+
* @iOS
|
|
125
|
+
* @since 3.4
|
|
126
|
+
*/
|
|
127
|
+
'ios-frame-cache-automatically'?: boolean;
|
|
128
|
+
|
|
120
129
|
/**
|
|
121
130
|
* Changes the color of all non-transparent pixels to the tint-color specified. The value is a <color>.
|
|
122
131
|
* @defaultValue ""
|
|
@@ -10,6 +10,8 @@ export * from './page';
|
|
|
10
10
|
export * from './scroll-view';
|
|
11
11
|
export * from './text';
|
|
12
12
|
export * from './view';
|
|
13
|
+
export * from './input';
|
|
14
|
+
export * from './textarea';
|
|
13
15
|
export * from './element';
|
|
14
16
|
export * from './methods';
|
|
15
17
|
export * from './attributes';
|
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
import { BaseEvent, BaseMethod, Callback } from '../events';
|
|
2
|
+
import { StandardProps } from '../props';
|
|
3
|
+
|
|
4
|
+
export interface InputFocusEvent {
|
|
5
|
+
/**
|
|
6
|
+
* Input content
|
|
7
|
+
* @Android
|
|
8
|
+
* @iOS
|
|
9
|
+
* @Harmony
|
|
10
|
+
* @Web
|
|
11
|
+
* @since 3.4
|
|
12
|
+
*/
|
|
13
|
+
value: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface InputBlurEvent {
|
|
17
|
+
/**
|
|
18
|
+
* Input content
|
|
19
|
+
* @Android
|
|
20
|
+
* @iOS
|
|
21
|
+
* @Harmony
|
|
22
|
+
* @Web
|
|
23
|
+
* @since 3.4
|
|
24
|
+
*/
|
|
25
|
+
value: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface InputConfirmEvent {
|
|
29
|
+
/**
|
|
30
|
+
* Input content
|
|
31
|
+
* @Android
|
|
32
|
+
* @iOS
|
|
33
|
+
* @Harmony
|
|
34
|
+
* @Web
|
|
35
|
+
* @since 3.4
|
|
36
|
+
*/
|
|
37
|
+
value: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface InputInputEvent {
|
|
41
|
+
/**
|
|
42
|
+
* Input content
|
|
43
|
+
* @Android
|
|
44
|
+
* @iOS
|
|
45
|
+
* @Harmony
|
|
46
|
+
* @Web
|
|
47
|
+
* @since 3.4
|
|
48
|
+
*/
|
|
49
|
+
value: string;
|
|
50
|
+
/**
|
|
51
|
+
* The start position of the selection
|
|
52
|
+
* @Android
|
|
53
|
+
* @iOS
|
|
54
|
+
* @Harmony
|
|
55
|
+
* @Web
|
|
56
|
+
* @since 3.4
|
|
57
|
+
*/
|
|
58
|
+
selectionStart: number;
|
|
59
|
+
/**
|
|
60
|
+
* The end position of the selection
|
|
61
|
+
* @Android
|
|
62
|
+
* @iOS
|
|
63
|
+
* @Harmony
|
|
64
|
+
* @Web
|
|
65
|
+
* @since 3.4
|
|
66
|
+
*/
|
|
67
|
+
selectionEnd: number;
|
|
68
|
+
/**
|
|
69
|
+
* Is composing or not
|
|
70
|
+
* @iOS
|
|
71
|
+
* @Android
|
|
72
|
+
* @Harmony
|
|
73
|
+
* @Web
|
|
74
|
+
* @since 3.4
|
|
75
|
+
*/
|
|
76
|
+
isComposing?: boolean;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface InputSelectionEvent {
|
|
80
|
+
/**
|
|
81
|
+
* The start position of the selection
|
|
82
|
+
* @Android
|
|
83
|
+
* @iOS
|
|
84
|
+
* @Harmony
|
|
85
|
+
* @Web
|
|
86
|
+
* @since 3.4
|
|
87
|
+
*/
|
|
88
|
+
selectionStart: number;
|
|
89
|
+
/**
|
|
90
|
+
* The end position of the selection
|
|
91
|
+
* @Android
|
|
92
|
+
* @iOS
|
|
93
|
+
* @Harmony
|
|
94
|
+
* @Web
|
|
95
|
+
* @since 3.4
|
|
96
|
+
*/
|
|
97
|
+
selectionEnd: number;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export interface InputProps extends Omit<StandardProps, 'bindfocus' | 'bindblur'> {
|
|
101
|
+
/**
|
|
102
|
+
* Placeholder
|
|
103
|
+
* @Android
|
|
104
|
+
* @iOS
|
|
105
|
+
* @Harmony
|
|
106
|
+
* @Web
|
|
107
|
+
* @since 3.4
|
|
108
|
+
*/
|
|
109
|
+
placeholder?: string
|
|
110
|
+
/**
|
|
111
|
+
* The type of confirm button
|
|
112
|
+
* @defaultValue 'send'
|
|
113
|
+
* @Android
|
|
114
|
+
* @iOS
|
|
115
|
+
* @Harmony
|
|
116
|
+
* @Web
|
|
117
|
+
* @since 3.4
|
|
118
|
+
*/
|
|
119
|
+
'confirm-type'?: 'send' | 'search' | 'go' | 'done' | 'next';
|
|
120
|
+
/**
|
|
121
|
+
* Max input length
|
|
122
|
+
* @defaultValue 140
|
|
123
|
+
* @Android
|
|
124
|
+
* @iOS
|
|
125
|
+
* @Harmony
|
|
126
|
+
* @Web
|
|
127
|
+
* @since 3.4
|
|
128
|
+
*/
|
|
129
|
+
maxlength?: number;
|
|
130
|
+
/**
|
|
131
|
+
* Interaction enabled
|
|
132
|
+
* @defaultValue false
|
|
133
|
+
* @Android
|
|
134
|
+
* @iOS
|
|
135
|
+
* @Harmony
|
|
136
|
+
* @Web
|
|
137
|
+
* @since 3.4
|
|
138
|
+
*/
|
|
139
|
+
readonly?: boolean;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Show soft input keyboard while focused
|
|
143
|
+
* @defaultValue true
|
|
144
|
+
* @Android
|
|
145
|
+
* @iOS
|
|
146
|
+
* @Harmony
|
|
147
|
+
* @since 3.4
|
|
148
|
+
*/
|
|
149
|
+
'show-soft-input-on-focus'?: boolean;
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Filter the input content and process it in the form of regular expressions
|
|
153
|
+
* @defaultValue undefined
|
|
154
|
+
* @Android
|
|
155
|
+
* @iOS
|
|
156
|
+
* @Harmony
|
|
157
|
+
* @Web
|
|
158
|
+
* @since 3.4
|
|
159
|
+
*/
|
|
160
|
+
'input-filter'?: string;
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Input content type
|
|
164
|
+
* @defaultValue "text"
|
|
165
|
+
* @Android
|
|
166
|
+
* @iOS
|
|
167
|
+
* @Harmony
|
|
168
|
+
* @Web
|
|
169
|
+
* @since 3.4
|
|
170
|
+
*/
|
|
171
|
+
type?: 'text' | 'number' | 'digit' | 'password' | 'tel' | 'email';
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Auto correct input content on iOS
|
|
175
|
+
* @defaultValue true
|
|
176
|
+
* @iOS
|
|
177
|
+
* @since 3.4
|
|
178
|
+
*/
|
|
179
|
+
'ios-auto-correct'?: boolean;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Check spelling issue on iOS
|
|
183
|
+
* @defaultValue true
|
|
184
|
+
* @iOS
|
|
185
|
+
* @Web
|
|
186
|
+
* @since 3.4
|
|
187
|
+
*/
|
|
188
|
+
'ios-spell-check'?: boolean;
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Whether to enter the full-screen input mode when in landscape screen, in which the keyboard and input box will take up the entire screen
|
|
192
|
+
* @defaultValue true
|
|
193
|
+
* @Android
|
|
194
|
+
* @since 3.4
|
|
195
|
+
*/
|
|
196
|
+
'android-fullscreen-mode'?: boolean;
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Focused
|
|
200
|
+
* @Android
|
|
201
|
+
* @iOS
|
|
202
|
+
* @Harmony
|
|
203
|
+
* @Web
|
|
204
|
+
* @since 3.4
|
|
205
|
+
*/
|
|
206
|
+
bindfocus?: (e: BaseEvent<'bindfocus', InputFocusEvent>) => void;
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Blurred
|
|
210
|
+
* @Android
|
|
211
|
+
* @iOS
|
|
212
|
+
* @Harmony
|
|
213
|
+
* @Web
|
|
214
|
+
* @since 3.4
|
|
215
|
+
*/
|
|
216
|
+
bindblur?: (e: BaseEvent<'bindblur', InputBlurEvent>) => void;
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Confirm button clicked
|
|
220
|
+
* @Android
|
|
221
|
+
* @iOS
|
|
222
|
+
* @Harmony
|
|
223
|
+
* @Web
|
|
224
|
+
* @since 3.4
|
|
225
|
+
*/
|
|
226
|
+
bindconfirm?: (e: BaseEvent<'bindconfirm', InputConfirmEvent>) => void;
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Input content changed
|
|
230
|
+
* @Android
|
|
231
|
+
* @iOS
|
|
232
|
+
* @Harmony
|
|
233
|
+
* @Web
|
|
234
|
+
* @since 3.4
|
|
235
|
+
*/
|
|
236
|
+
bindinput?: (e: BaseEvent<'bindinput', InputInputEvent>) => void;
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Input selection changed
|
|
240
|
+
* @Android
|
|
241
|
+
* @iOS
|
|
242
|
+
* @Harmony
|
|
243
|
+
* @Web
|
|
244
|
+
* @since 3.4
|
|
245
|
+
*/
|
|
246
|
+
bindselection?: (e: BaseEvent<'bindselection', InputSelectionEvent>) => void;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Require focus
|
|
251
|
+
* @Android
|
|
252
|
+
* @iOS
|
|
253
|
+
* @Harmony
|
|
254
|
+
* @Web
|
|
255
|
+
* @since 3.4
|
|
256
|
+
*/
|
|
257
|
+
export interface InputFocusMethod extends BaseMethod {
|
|
258
|
+
method: 'focus';
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Release focus
|
|
263
|
+
* @Android
|
|
264
|
+
* @iOS
|
|
265
|
+
* @Harmony
|
|
266
|
+
* @Web
|
|
267
|
+
* @since 3.4
|
|
268
|
+
*/
|
|
269
|
+
export interface InputBlurMethod extends BaseMethod {
|
|
270
|
+
method: 'blur';
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Get input content
|
|
275
|
+
* @Android
|
|
276
|
+
* @iOS
|
|
277
|
+
* @Harmony
|
|
278
|
+
* @Web
|
|
279
|
+
* @since 3.4
|
|
280
|
+
*/
|
|
281
|
+
export interface InputGetValueMethod extends BaseMethod {
|
|
282
|
+
method: 'getValue';
|
|
283
|
+
success?: Callback<{
|
|
284
|
+
/**
|
|
285
|
+
* Input content
|
|
286
|
+
* @Android
|
|
287
|
+
* @iOS
|
|
288
|
+
* @Harmony
|
|
289
|
+
* @Web
|
|
290
|
+
* @since 3.4
|
|
291
|
+
*/
|
|
292
|
+
value: string;
|
|
293
|
+
/**
|
|
294
|
+
* Begin position of the selection
|
|
295
|
+
* @Android
|
|
296
|
+
* @iOS
|
|
297
|
+
* @Harmony
|
|
298
|
+
* @Web
|
|
299
|
+
* @since 3.4
|
|
300
|
+
*/
|
|
301
|
+
selectionStart: number;
|
|
302
|
+
/**
|
|
303
|
+
* End position of the selection
|
|
304
|
+
* @Android
|
|
305
|
+
* @iOS
|
|
306
|
+
* @Harmony
|
|
307
|
+
* @Web
|
|
308
|
+
* @since 3.4
|
|
309
|
+
*/
|
|
310
|
+
selectionEnd: number;
|
|
311
|
+
/**
|
|
312
|
+
* Is composing or not, iOS only
|
|
313
|
+
* @Android
|
|
314
|
+
* @iOS
|
|
315
|
+
* @Harmony
|
|
316
|
+
* @Web
|
|
317
|
+
* @since 3.4
|
|
318
|
+
*/
|
|
319
|
+
isComposing: boolean;
|
|
320
|
+
}>;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Set input content
|
|
325
|
+
* @Android
|
|
326
|
+
* @iOS
|
|
327
|
+
* @Harmony
|
|
328
|
+
* @Web
|
|
329
|
+
* @since 3.4
|
|
330
|
+
*/
|
|
331
|
+
export interface InputSetValueMethod extends BaseMethod {
|
|
332
|
+
method: 'setValue';
|
|
333
|
+
params: {
|
|
334
|
+
/**
|
|
335
|
+
* Input content
|
|
336
|
+
* @Android
|
|
337
|
+
* @iOS
|
|
338
|
+
* @Harmony
|
|
339
|
+
* @Web
|
|
340
|
+
* @since 3.4
|
|
341
|
+
*/
|
|
342
|
+
value: string;
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Set selection range
|
|
348
|
+
* @Android
|
|
349
|
+
* @iOS
|
|
350
|
+
* @Harmony
|
|
351
|
+
* @Web
|
|
352
|
+
* @since 3.4
|
|
353
|
+
*/
|
|
354
|
+
export interface InputSetSelectionRangeMethod extends BaseMethod {
|
|
355
|
+
method: 'setSelectionRange';
|
|
356
|
+
params: {
|
|
357
|
+
/**
|
|
358
|
+
* Start position of the selection
|
|
359
|
+
* @Android
|
|
360
|
+
* @iOS
|
|
361
|
+
* @Harmony
|
|
362
|
+
* @Web
|
|
363
|
+
* @since 3.4
|
|
364
|
+
*/
|
|
365
|
+
selectionStart: number;
|
|
366
|
+
/**
|
|
367
|
+
* End position of the selection
|
|
368
|
+
* @Android
|
|
369
|
+
* @iOS
|
|
370
|
+
* @Harmony
|
|
371
|
+
* @Web
|
|
372
|
+
* @since 3.4
|
|
373
|
+
*/
|
|
374
|
+
selectionEnd: number;
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
export type InputUIMethods = InputFocusMethod | InputBlurMethod | InputGetValueMethod | InputSetValueMethod | InputSetSelectionRangeMethod;
|
|
@@ -338,14 +338,14 @@ export interface LayoutCompleteEvent extends BaseEvent<'layoutcomplete', {}> {
|
|
|
338
338
|
* @Android
|
|
339
339
|
* @H
|
|
340
340
|
*/
|
|
341
|
-
|
|
341
|
+
visibleItemAfterUpdate?: ListItemInfo[];
|
|
342
342
|
/**
|
|
343
343
|
* Cell info of the list before layout.
|
|
344
344
|
* @iOS
|
|
345
345
|
* @Android
|
|
346
346
|
* @H
|
|
347
347
|
*/
|
|
348
|
-
|
|
348
|
+
visibleItemBeforeUpdate?: ListItemInfo[];
|
|
349
349
|
/**
|
|
350
350
|
* The scroll info after layout.
|
|
351
351
|
* @iOS
|
|
@@ -516,6 +516,22 @@ export interface ListProps extends StandardProps {
|
|
|
516
516
|
*/
|
|
517
517
|
'sticky-offset'?: number;
|
|
518
518
|
|
|
519
|
+
/**
|
|
520
|
+
* The property to control whether recycle sticky item. The default value is true if sdk version >= 3.4 and false if sdk version < 3.4.
|
|
521
|
+
* @defaultValue false
|
|
522
|
+
* @Android
|
|
523
|
+
* @iOS
|
|
524
|
+
*/
|
|
525
|
+
'experimental-recycle-sticky-item'?: boolean;
|
|
526
|
+
|
|
527
|
+
/**
|
|
528
|
+
* The property to set the capacity of sticky item cache. The default value is 1 if thread mode is ALL_ON_UI and 2 if thread mode is MOST_ON_TASM / PART_ON_LAYOUT / MULTI_THREADS.
|
|
529
|
+
* @defaultValue 1
|
|
530
|
+
* @Android
|
|
531
|
+
* @iOS
|
|
532
|
+
*/
|
|
533
|
+
'sticky-buffer-count'?: number;
|
|
534
|
+
|
|
519
535
|
/**
|
|
520
536
|
* When enabled, the upper or lower element will also be shifted together with the bounces effect.
|
|
521
537
|
* @defaultValue false
|
|
@@ -691,6 +707,14 @@ export interface ListProps extends StandardProps {
|
|
|
691
707
|
*/
|
|
692
708
|
'upper-threshold-item-count'?: number;
|
|
693
709
|
|
|
710
|
+
/**
|
|
711
|
+
* The property to control whether to update sticky item for diff. The default value is true if sdk version >= 3.4 and false if sdk version < 3.4.
|
|
712
|
+
* @defaultValue false
|
|
713
|
+
* @Android
|
|
714
|
+
* @iOS
|
|
715
|
+
*/
|
|
716
|
+
'experimental-update-sticky-for-diff'?: boolean;
|
|
717
|
+
|
|
694
718
|
/**
|
|
695
719
|
* During a single sliding process, when the upper_distance is first smaller than the value specified by upper-threshold, a scrolltoupper event is triggered. When upper_distance is already smaller than the value specified by upper-threshold, the scrolltoupper event will no longer be triggered.
|
|
696
720
|
* @defaultValue 50
|
|
@@ -715,6 +739,15 @@ export interface ListProps extends StandardProps {
|
|
|
715
739
|
*/
|
|
716
740
|
'needs-visible-cells'?: boolean;
|
|
717
741
|
|
|
742
|
+
/**
|
|
743
|
+
* Control whether the list recycle available items before layout, so list can reuse these items in this layout pass. By default, the list will recycle all items after layout.
|
|
744
|
+
* @defaultValue false
|
|
745
|
+
* @Android
|
|
746
|
+
* @iOS
|
|
747
|
+
* @Harmony
|
|
748
|
+
*/
|
|
749
|
+
'experimental-recycle-available-item-before-layout'?: boolean;
|
|
750
|
+
|
|
718
751
|
/**
|
|
719
752
|
* Control whether the 'attachedCells' is included in the scroll event callback parameters on native list.
|
|
720
753
|
* @defaultValue false
|
|
@@ -785,7 +818,7 @@ export interface ListProps extends StandardProps {
|
|
|
785
818
|
*/
|
|
786
819
|
'enable-nested-scroll'?: boolean;
|
|
787
820
|
|
|
788
|
-
|
|
821
|
+
|
|
789
822
|
/**
|
|
790
823
|
* NestedScrollOptions for scrollForward
|
|
791
824
|
* @since 3.0
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
3
|
// LICENSE file in the root directory of this source tree.
|
|
4
4
|
|
|
5
|
-
import { BaseEvent, TextLayoutEventDetail } from '../events';
|
|
5
|
+
import { BaseEvent, Callback, BaseMethod, TextLayoutEventDetail, TextSelectionChangeEventDetail } from '../events';
|
|
6
6
|
import { StandardProps } from '../props';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -46,13 +46,6 @@ export interface TextProps extends StandardProps {
|
|
|
46
46
|
*/
|
|
47
47
|
'tail-color-convert'?: boolean;
|
|
48
48
|
|
|
49
|
-
/**
|
|
50
|
-
* Enable long press to select text
|
|
51
|
-
* @defaultValue false
|
|
52
|
-
* @since 2.5
|
|
53
|
-
*/
|
|
54
|
-
'text-selection'?: boolean;
|
|
55
|
-
|
|
56
49
|
/**
|
|
57
50
|
* Set single-line plain text to be centered and aligned within the line. Inline text settings are not supported. Recommended only when the default font doesn't meet center alignment needs, as it increases text measurement time.
|
|
58
51
|
* @defaultValue normal
|
|
@@ -87,11 +80,168 @@ export interface TextProps extends StandardProps {
|
|
|
87
80
|
*/
|
|
88
81
|
'text-fake-bold'?: boolean;
|
|
89
82
|
|
|
83
|
+
/**
|
|
84
|
+
* Sets whether to enable text selection.
|
|
85
|
+
* @defaultValue false
|
|
86
|
+
* @Android
|
|
87
|
+
* @iOS
|
|
88
|
+
* @since 2.18
|
|
89
|
+
*/
|
|
90
|
+
'text-selection'?: boolean;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Used to set whether to turn on the custom pop-up context menu after selection and copying. It takes effect after enabling text-selection.
|
|
94
|
+
* @defaultValue false
|
|
95
|
+
* @Android
|
|
96
|
+
* @iOS
|
|
97
|
+
* @since 2.18
|
|
98
|
+
*/
|
|
99
|
+
'custom-context-menu'?: boolean;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Used to set whether to enable the custom text selection function. When it is enabled, the element will no longer handle the gesture logic related to selection and copying. It takes effect after enabling text-selection.
|
|
103
|
+
* @defaultValue false
|
|
104
|
+
* @Android
|
|
105
|
+
* @iOS
|
|
106
|
+
* @since 2.18
|
|
107
|
+
*/
|
|
108
|
+
'custom-text-selection'?: boolean;
|
|
109
|
+
|
|
90
110
|
/**
|
|
91
111
|
* Text layout event
|
|
92
112
|
* @since 2.7
|
|
93
113
|
*/
|
|
94
114
|
bindlayout?: (e: LayoutEvent) => void;
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Text selection change event
|
|
118
|
+
* @since 2.18
|
|
119
|
+
*/
|
|
120
|
+
bindselectionchange?: (e: SelectionChangeEvent) => void;
|
|
95
121
|
}
|
|
96
122
|
|
|
97
123
|
export type LayoutEvent = BaseEvent<'layout', TextLayoutEventDetail>;
|
|
124
|
+
|
|
125
|
+
export type SelectionChangeEvent = BaseEvent<
|
|
126
|
+
'selectionchange',
|
|
127
|
+
TextSelectionChangeEventDetail
|
|
128
|
+
>;
|
|
129
|
+
|
|
130
|
+
interface Rect {
|
|
131
|
+
left: number;
|
|
132
|
+
right: number;
|
|
133
|
+
top: number;
|
|
134
|
+
bottom: number;
|
|
135
|
+
width: number;
|
|
136
|
+
height: number;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
interface Handle {
|
|
140
|
+
/**
|
|
141
|
+
* Center X of handle
|
|
142
|
+
*/
|
|
143
|
+
x: number;
|
|
144
|
+
/**
|
|
145
|
+
* Center Y of handle
|
|
146
|
+
*/
|
|
147
|
+
y: number;
|
|
148
|
+
/**
|
|
149
|
+
* Touch radius of the handle
|
|
150
|
+
*/
|
|
151
|
+
radius: number;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Sets the text selection.
|
|
156
|
+
* @Android
|
|
157
|
+
* @iOS
|
|
158
|
+
* @since 2.18
|
|
159
|
+
*/
|
|
160
|
+
interface SetTextSelectionMethod extends BaseMethod {
|
|
161
|
+
method: 'setTextSelection';
|
|
162
|
+
params: {
|
|
163
|
+
/**
|
|
164
|
+
* X-coordinate of the selection start relative to the element
|
|
165
|
+
*/
|
|
166
|
+
startX: number;
|
|
167
|
+
/**
|
|
168
|
+
* Y-coordinate of the selection start relative to the element
|
|
169
|
+
*/
|
|
170
|
+
startY: number;
|
|
171
|
+
/**
|
|
172
|
+
* X-coordinate of the selection end relative to the element
|
|
173
|
+
*/
|
|
174
|
+
endX: number;
|
|
175
|
+
/**
|
|
176
|
+
* Y-coordinate of the selection end relative to the element
|
|
177
|
+
*/
|
|
178
|
+
endY: number;
|
|
179
|
+
/**
|
|
180
|
+
* Whether to show the start handle, default is true
|
|
181
|
+
*/
|
|
182
|
+
showStartHandle?: boolean;
|
|
183
|
+
/**
|
|
184
|
+
* Whether to show the end handle, default is true
|
|
185
|
+
*/
|
|
186
|
+
showEndHandle?: boolean;
|
|
187
|
+
};
|
|
188
|
+
success?: Callback<{
|
|
189
|
+
/**
|
|
190
|
+
* Bounding rectangle of the selected text
|
|
191
|
+
*/
|
|
192
|
+
boundingRect: Rect;
|
|
193
|
+
/**
|
|
194
|
+
* Rectangles of the selected text
|
|
195
|
+
*/
|
|
196
|
+
boxes: Rect[];
|
|
197
|
+
/**
|
|
198
|
+
* Handles of the selected text
|
|
199
|
+
*/
|
|
200
|
+
handles: Handle[]
|
|
201
|
+
}>;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Gets the bounding rectangle of the text.
|
|
206
|
+
* @Android
|
|
207
|
+
* @iOS
|
|
208
|
+
* @since 2.18
|
|
209
|
+
*/
|
|
210
|
+
interface GetTextBoundingRectMethod extends BaseMethod {
|
|
211
|
+
method: 'getTextBoundingRect';
|
|
212
|
+
params: {
|
|
213
|
+
/**
|
|
214
|
+
* Start index of the text
|
|
215
|
+
*/
|
|
216
|
+
start: number;
|
|
217
|
+
/**
|
|
218
|
+
* End index of the text
|
|
219
|
+
*/
|
|
220
|
+
end: number;
|
|
221
|
+
};
|
|
222
|
+
success?: Callback<{
|
|
223
|
+
/**
|
|
224
|
+
* Bounding rectangle of the text
|
|
225
|
+
*/
|
|
226
|
+
boundingRect: Rect;
|
|
227
|
+
/**
|
|
228
|
+
* Rectangles of the text
|
|
229
|
+
*/
|
|
230
|
+
boxes: Rect[];
|
|
231
|
+
}>;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Gets the selected text.
|
|
236
|
+
* @Android
|
|
237
|
+
* @iOS
|
|
238
|
+
* @since 2.18
|
|
239
|
+
*/
|
|
240
|
+
interface GetSelectedTextMethod extends BaseMethod {
|
|
241
|
+
method: 'getSelectedText';
|
|
242
|
+
success?: Callback<{
|
|
243
|
+
selectedText: string;
|
|
244
|
+
}>;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
export type TextUIMethods = SetTextSelectionMethod | GetTextBoundingRectMethod | GetSelectedTextMethod;
|