• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2  * Copyright (c) 2021-2023 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/**
17 * @file
18 * @kit ArkUI
19 */
20
21/*** if arkts 1.2 */
22import { ResourceColor, Length } from './units'
23import { LengthMetrics } from '../Graphics'
24import { CommonMethod, Callback, Optional } from './common'
25/*** endif */
26
27/**
28 * The challenge result based on input pattern for control pattern lock component.
29 * @enum { number }
30 * @syscap SystemCapability.ArkUI.ArkUI.Full
31 * @crossplatform
32 * @since 11
33 */
34/**
35 * The challenge result based on input pattern for control pattern lock component.
36 * @enum { number }
37 * @syscap SystemCapability.ArkUI.ArkUI.Full
38 * @crossplatform
39 * @atomicservice
40 * @since arkts {'1.1':'12','1.2':'20'}
41 * @arkts 1.1&1.2
42 */
43declare enum PatternLockChallengeResult {
44  /**
45   * The challenge result is correct.
46   * @syscap SystemCapability.ArkUI.ArkUI.Full
47   * @crossplatform
48   * @since 11
49   */
50  /**
51   * The challenge result is correct.
52   * @syscap SystemCapability.ArkUI.ArkUI.Full
53   * @crossplatform
54   * @atomicservice
55   * @since arkts {'1.1':'12','1.2':'20'}
56   * @arkts 1.1&1.2
57   */
58  CORRECT = 1,
59  /**
60   * The challenge result is wrong.
61   * @syscap SystemCapability.ArkUI.ArkUI.Full
62   * @crossplatform
63   * @since 11
64   */
65  /**
66   * The challenge result is wrong.
67   * @syscap SystemCapability.ArkUI.ArkUI.Full
68   * @crossplatform
69   * @atomicservice
70   * @since arkts {'1.1':'12','1.2':'20'}
71   * @arkts 1.1&1.2
72   */
73  WRONG = 2
74}
75
76/**
77 * Defines the options of active circle style.
78 *
79 * @interface CircleStyleOptions
80 * @syscap SystemCapability.ArkUI.ArkUI.Full
81 * @crossplatform
82 * @atomicservice
83 * @since arkts {'1.1':'12','1.2':'20'}
84 * @arkts 1.1&1.2
85 */
86declare interface CircleStyleOptions {
87  /**
88   * The circle color when cell is active state.
89   *
90   * @type { ?ResourceColor }
91   * @syscap SystemCapability.ArkUI.ArkUI.Full
92   * @crossplatform
93   * @atomicservice
94   * @since arkts {'1.1':'12','1.2':'20'}
95   * @arkts 1.1&1.2
96   */
97  color?: ResourceColor;
98
99  /**
100   * The circle radius when cell is active state.
101   *
102   * @type { ?LengthMetrics }
103   * @syscap SystemCapability.ArkUI.ArkUI.Full
104   * @crossplatform
105   * @atomicservice
106   * @since arkts {'1.1':'12','1.2':'20'}
107   * @arkts 1.1&1.2
108   */
109  radius?: LengthMetrics;
110
111  /**
112   * Enable the wave effect when cell is active.
113   *
114   * @type { ?boolean }
115   * @syscap SystemCapability.ArkUI.ArkUI.Full
116   * @crossplatform
117   * @atomicservice
118   * @since arkts {'1.1':'12','1.2':'20'}
119   * @arkts 1.1&1.2
120   */
121  enableWaveEffect?: boolean;
122
123  /**
124   * Enable the activity circle style displayed in the foreground.
125   *
126   * @type { ?boolean }
127   * @syscap SystemCapability.ArkUI.ArkUI.Full
128   * @crossplatform
129   * @atomicservice
130   * @since arkts {'1.1':'15','1.2':'20'}
131   * @arkts 1.1&1.2
132   */
133  enableForeground?: boolean;
134}
135
136/**
137 * Provides methods for control pattern lock component.
138 *
139 * @syscap SystemCapability.ArkUI.ArkUI.Full
140 * @since 9
141 */
142/**
143 * Provides methods for control pattern lock component.
144 *
145 * @syscap SystemCapability.ArkUI.ArkUI.Full
146 * @crossplatform
147 * @since 10
148 */
149/**
150 * Provides methods for control pattern lock component.
151 *
152 * @syscap SystemCapability.ArkUI.ArkUI.Full
153 * @crossplatform
154 * @atomicservice
155 * @since arkts {'1.1':'12','1.2':'20'}
156 * @arkts 1.1&1.2
157 */
158declare class PatternLockController {
159  /**
160   * constructor.
161   *
162   * @syscap SystemCapability.ArkUI.ArkUI.Full
163   * @since 9
164   */
165  /**
166   * constructor.
167   *
168   * @syscap SystemCapability.ArkUI.ArkUI.Full
169   * @crossplatform
170   * @since 10
171   */
172  /**
173   * A constructor used to create a PatternLockController instance.
174   *
175   * @syscap SystemCapability.ArkUI.ArkUI.Full
176   * @crossplatform
177   * @atomicservice
178   * @since arkts {'1.1':'12','1.2':'20'}
179   * @arkts 1.1&1.2
180   */
181  constructor();
182
183  /**
184   * Reset pattern lock.
185   *
186   * @syscap SystemCapability.ArkUI.ArkUI.Full
187   * @since 9
188   */
189  /**
190   * Reset pattern lock.
191   *
192   * @syscap SystemCapability.ArkUI.ArkUI.Full
193   * @crossplatform
194   * @since 10
195   */
196  /**
197   * Resets the component status.
198   *
199   * @syscap SystemCapability.ArkUI.ArkUI.Full
200   * @crossplatform
201   * @atomicservice
202   * @since 12
203   */
204  reset();
205  /**
206   * Reset pattern lock.
207   *
208   * @syscap SystemCapability.ArkUI.ArkUI.Full
209   * @crossplatform
210   * @atomicservice
211   * @since 20
212   * @arkts 1.2
213   */
214  reset(): void;
215
216  /**
217   * Set challenge result.
218   * @param { PatternLockChallengeResult } result - The challenge result based on input pattern.
219   * @syscap SystemCapability.ArkUI.ArkUI.Full
220   * @crossplatform
221   * @since 11
222   */
223  /**
224   * Sets the authentication challenge result for the pattern password.
225   * @param { PatternLockChallengeResult } result - Authentication challenge result of the pattern password.
226   * @syscap SystemCapability.ArkUI.ArkUI.Full
227   * @crossplatform
228   * @atomicservice
229   * @since arkts {'1.1':'12','1.2':'20'}
230   * @arkts 1.1&1.2
231   */
232  setChallengeResult(result: PatternLockChallengeResult): void;
233}
234
235/**
236 * Provides an interface for generating PatternLock.
237 *
238 * @interface PatternLockInterface
239 * @syscap SystemCapability.ArkUI.ArkUI.Full
240 * @since 9
241 */
242/**
243 * Provides an interface for generating PatternLock.
244 *
245 * @interface PatternLockInterface
246 * @syscap SystemCapability.ArkUI.ArkUI.Full
247 * @crossplatform
248 * @since 10
249 */
250/**
251 * Provides an interface for generating PatternLock.
252 *
253 * @interface PatternLockInterface
254 * @syscap SystemCapability.ArkUI.ArkUI.Full
255 * @crossplatform
256 * @atomicservice
257 * @since arkts {'1.1':'12','1.2':'20'}
258 * @arkts 1.1&1.2
259 */
260interface PatternLockInterface {
261  /**
262   * Constructor.
263   *
264   * @param { PatternLockController } [controller] - controller
265   * @returns { PatternLockAttribute }
266   * @syscap SystemCapability.ArkUI.ArkUI.Full
267   * @since 9
268   */
269  /**
270   * Constructor.
271   *
272   * @param { PatternLockController } [controller]  controller
273   * @returns { PatternLockAttribute }
274   * @syscap SystemCapability.ArkUI.ArkUI.Full
275   * @crossplatform
276   * @since 10
277   */
278  /**
279   * Constructor.
280   *
281   * @param { PatternLockController } [controller]  controller
282   * @returns { PatternLockAttribute }
283   * @syscap SystemCapability.ArkUI.ArkUI.Full
284   * @crossplatform
285   * @atomicservice
286   * @since arkts {'1.1':'12','1.2':'20'}
287   * @arkts 1.1&1.2
288   */
289  (controller?: PatternLockController): PatternLockAttribute;
290}
291
292/**
293 * Provides methods for attribute pattern lock component.
294 *
295 * @extends CommonMethod<PatternLockAttribute>
296 * @syscap SystemCapability.ArkUI.ArkUI.Full
297 * @since 9
298 */
299/**
300 * Provides methods for attribute pattern lock component.
301 *
302 * @extends CommonMethod<PatternLockAttribute>
303 * @syscap SystemCapability.ArkUI.ArkUI.Full
304 * @crossplatform
305 * @since 10
306 */
307/**
308 * Provides methods for attribute pattern lock component.
309 *
310 * @extends CommonMethod<PatternLockAttribute>
311 * @syscap SystemCapability.ArkUI.ArkUI.Full
312 * @crossplatform
313 * @atomicservice
314 * @since arkts {'1.1':'12','1.2':'20'}
315 * @arkts 1.1&1.2
316 */
317declare class PatternLockAttribute extends CommonMethod<PatternLockAttribute> {
318  /**
319   * The square side length of pattern lock component.
320   *
321   * @param { Length } value
322   * @returns { PatternLockAttribute }
323   * @syscap SystemCapability.ArkUI.ArkUI.Full
324   * @since 9
325   */
326  /**
327   * The square side length of pattern lock component.
328   *
329   * @param { Length } value
330   * @returns { PatternLockAttribute }
331   * @syscap SystemCapability.ArkUI.ArkUI.Full
332   * @crossplatform
333   * @since 10
334   */
335  /**
336   * Sets the width and height (same value) of the component.
337   *
338   * <p><strong>NOTE</strong>:
339   * <br>If this attribute is set to 0 or a negative number, the component is not displayed.
340   * </p>
341   *
342   * @param { Length } value - Width and height of the component, Default value is 288vp.
343   * @returns { PatternLockAttribute }
344   * @syscap SystemCapability.ArkUI.ArkUI.Full
345   * @crossplatform
346   * @atomicservice
347   * @since arkts {'1.1':'12','1.2':'20'}
348   * @arkts 1.1&1.2
349   */
350  sideLength(value: Length): PatternLockAttribute;
351
352  /**
353   * Circle radius.
354   *
355   * @param { Length } value
356   * @returns { PatternLockAttribute }
357   * @syscap SystemCapability.ArkUI.ArkUI.Full
358   * @since 9
359   */
360  /**
361   * Circle radius.
362   *
363   * @param { Length } value
364   * @returns { PatternLockAttribute }
365   * @syscap SystemCapability.ArkUI.ArkUI.Full
366   * @crossplatform
367   * @since 10
368   */
369  /**
370   * Sets the radius of the dots in a grid.
371   *
372   * <p><strong>NOTE</strong>:
373   * <br>If this attribute is set to 0 or a negative value, the default value is used.
374   * </p>
375   *
376   * @param { Length } value - Radius of the dots in a grid, Default value is 6vp.
377   * @returns { PatternLockAttribute }
378   * @syscap SystemCapability.ArkUI.ArkUI.Full
379   * @crossplatform
380   * @atomicservice
381   * @since arkts {'1.1':'12','1.2':'20'}
382   * @arkts 1.1&1.2
383   */
384  circleRadius(value: Length): PatternLockAttribute;
385
386  /**
387   * The background color.
388   *
389   * @param { ResourceColor } value
390   * @returns { PatternLockAttribute }
391   * @syscap SystemCapability.ArkUI.ArkUI.Full
392   * @since 9
393   */
394  /**
395   * The background color.
396   *
397   * @param { ResourceColor } value
398   * @returns { PatternLockAttribute }
399   * @syscap SystemCapability.ArkUI.ArkUI.Full
400   * @crossplatform
401   * @since 10
402   */
403  /**
404   * Sets the background color.
405   *
406   * @param { ResourceColor } value - Background color.
407   * @returns { PatternLockAttribute }
408   * @syscap SystemCapability.ArkUI.ArkUI.Full
409   * @crossplatform
410   * @atomicservice
411   * @since arkts {'1.1':'12','1.2':'20'}
412   * @arkts 1.1&1.2
413   */
414  backgroundColor(value: ResourceColor): PatternLockAttribute;
415
416  /**
417   * Regular color.
418   *
419   * @param { ResourceColor } value
420   * @returns { PatternLockAttribute }
421   * @syscap SystemCapability.ArkUI.ArkUI.Full
422   * @since 9
423   */
424  /**
425   * Regular color.
426   *
427   * @param { ResourceColor } value
428   * @returns { PatternLockAttribute }
429   * @syscap SystemCapability.ArkUI.ArkUI.Full
430   * @crossplatform
431   * @since 10
432   */
433  /**
434   * Sets the fill color of the grid dot in the unselected state.
435   *
436   * @param { ResourceColor } value - Fill color of the grid dot in the unselected state, Default value is '#ff182431'.
437   * @returns { PatternLockAttribute }
438   * @syscap SystemCapability.ArkUI.ArkUI.Full
439   * @crossplatform
440   * @atomicservice
441   * @since arkts {'1.1':'12','1.2':'20'}
442   * @arkts 1.1&1.2
443   */
444  regularColor(value: ResourceColor): PatternLockAttribute;
445
446  /**
447   * The color when cell is selected.
448   *
449   * @param { ResourceColor } value
450   * @returns { PatternLockAttribute }
451   * @syscap SystemCapability.ArkUI.ArkUI.Full
452   * @since 9
453   */
454  /**
455   * The color when cell is selected.
456   *
457   * @param { ResourceColor } value
458   * @returns { PatternLockAttribute }
459   * @syscap SystemCapability.ArkUI.ArkUI.Full
460   * @crossplatform
461   * @since 10
462   */
463  /**
464   * Sets the fill color of the grid dot in the selected state.
465   *
466   * @param { ResourceColor } value - Fill color of the grid dot in the selected state, Default value is '#ff182431'.
467   * @returns { PatternLockAttribute }
468   * @syscap SystemCapability.ArkUI.ArkUI.Full
469   * @crossplatform
470   * @atomicservice
471   * @since arkts {'1.1':'12','1.2':'20'}
472   * @arkts 1.1&1.2
473   */
474  selectedColor(value: ResourceColor): PatternLockAttribute;
475
476  /**
477   * The color when cell is active state.
478   *
479   * @param { ResourceColor } value
480   * @returns { PatternLockAttribute }
481   * @syscap SystemCapability.ArkUI.ArkUI.Full
482   * @since 9
483   */
484  /**
485   * The color when cell is active state.
486   *
487   * @param { ResourceColor } value
488   * @returns { PatternLockAttribute }
489   * @syscap SystemCapability.ArkUI.ArkUI.Full
490   * @crossplatform
491   * @since 10
492   */
493  /**
494   * Sets the fill color of the grid dot in the activated state, which is when the dot is highlighted but not selected.
495   *
496   * @param { ResourceColor } value - Fill color of the grid dot in the activated state, Default value is '#ff182431'.
497   * @returns { PatternLockAttribute }
498   * @syscap SystemCapability.ArkUI.ArkUI.Full
499   * @crossplatform
500   * @atomicservice
501   * @since arkts {'1.1':'12','1.2':'20'}
502   * @arkts 1.1&1.2
503   */
504  activeColor(value: ResourceColor): PatternLockAttribute;
505
506  /**
507   * The path line color.
508   *
509   * @param { ResourceColor } value
510   * @returns { PatternLockAttribute }
511   * @syscap SystemCapability.ArkUI.ArkUI.Full
512   * @since 9
513   */
514  /**
515   * The path line color.
516   *
517   * @param { ResourceColor } value
518   * @returns { PatternLockAttribute }
519   * @syscap SystemCapability.ArkUI.ArkUI.Full
520   * @crossplatform
521   * @since 10
522   */
523  /**
524   * Sets the path color.
525   *
526   * @param { ResourceColor } value - Path color, Default value is '#33182431'.
527   * @returns { PatternLockAttribute }
528   * @syscap SystemCapability.ArkUI.ArkUI.Full
529   * @crossplatform
530   * @atomicservice
531   * @since arkts {'1.1':'12','1.2':'20'}
532   * @arkts 1.1&1.2
533   */
534  pathColor(value: ResourceColor): PatternLockAttribute;
535
536  /**
537   * The path line stroke width.
538   *
539   * @param { number | string } value
540   * @returns { PatternLockAttribute }
541   * @syscap SystemCapability.ArkUI.ArkUI.Full
542   * @since 9
543   */
544  /**
545   * The path line stroke width.
546   *
547   * @param { number | string } value
548   * @returns { PatternLockAttribute }
549   * @syscap SystemCapability.ArkUI.ArkUI.Full
550   * @crossplatform
551   * @since 10
552   */
553  /**
554   * Sets the width of the path stroke.
555   *
556   * <p><strong>NOTE</strong>:
557   * <br>If this attribute is set to **0** or a negative value, the path stroke is not displayed.
558   * </p>
559   *
560   * @param { number | string } value - Width of the path stroke, Default value is 12vp.
561   * @returns { PatternLockAttribute }
562   * @syscap SystemCapability.ArkUI.ArkUI.Full
563   * @crossplatform
564   * @atomicservice
565   * @since arkts {'1.1':'12','1.2':'20'}
566   * @arkts 1.1&1.2
567   */
568  pathStrokeWidth(value: number | string): PatternLockAttribute;
569
570  /**
571   * Called when the pattern input completed.
572   *
573   * @param { function } callback
574   * @returns { PatternLockAttribute }
575   * @syscap SystemCapability.ArkUI.ArkUI.Full
576   * @since 9
577   */
578  /**
579   * Called when the pattern input completed.
580   *
581   * @param { function } callback
582   * @returns { PatternLockAttribute }
583   * @syscap SystemCapability.ArkUI.ArkUI.Full
584   * @crossplatform
585   * @since 10
586   */
587  /**
588   * Invoked when the pattern password input is complete.
589   *
590   * @param { function } callback
591   * @returns { PatternLockAttribute }
592   * @syscap SystemCapability.ArkUI.ArkUI.Full
593   * @crossplatform
594   * @atomicservice
595   * @since arkts {'1.1':'12','1.2':'20'}
596   * @arkts 1.1&1.2
597   */
598  onPatternComplete(callback: (input: Array<number>) => void): PatternLockAttribute;
599
600  /**
601   * Called when judging whether the input state can be reset by touch pattern lock.
602   *
603   * @param { boolean } value
604   * @returns { PatternLockAttribute }
605   * @syscap SystemCapability.ArkUI.ArkUI.Full
606   * @since 9
607   */
608  /**
609   * Called when judging whether the input state can be reset by touch pattern lock.
610   *
611   * @param { boolean } value
612   * @returns { PatternLockAttribute }
613   * @syscap SystemCapability.ArkUI.ArkUI.Full
614   * @crossplatform
615   * @since 10
616   */
617  /**
618   * Sets whether to allow the user to reset the component status (that is, clear the input) by touching the component
619   * again after the input is complete.
620   *
621   * @param { boolean } value - Whether to allow the user to reset the component status (that is, clear the input) by
622   * touching the component again after the input is complete, Default value is true.
623   * @returns { PatternLockAttribute }
624   * @syscap SystemCapability.ArkUI.ArkUI.Full
625   * @crossplatform
626   * @atomicservice
627   * @since arkts {'1.1':'12','1.2':'20'}
628   * @arkts 1.1&1.2
629   */
630  autoReset(value: boolean): PatternLockAttribute;
631
632  /**
633   * Called when connecting to a grid dot.
634   * @param { import('../api/@ohos.base').Callback<number> } callback - A callback instance used when connection to a grid dot.
635   * @returns { PatternLockAttribute }
636   * @syscap SystemCapability.ArkUI.ArkUI.Full
637   * @crossplatform
638   * @since 11
639   */
640  /**
641   * Invoked when a grid dot is connected during pattern password input.
642   *
643   * @param { import('../api/@ohos.base').Callback<number> } callback - A callback instance used when connection to a grid dot.
644   * @returns { PatternLockAttribute }
645   * @syscap SystemCapability.ArkUI.ArkUI.Full
646   * @crossplatform
647   * @atomicservice
648   * @since 12
649   */
650  onDotConnect(callback: import('../api/@ohos.base').Callback<number>): PatternLockAttribute;
651
652  /**
653   * Called when connecting to a grid dot.
654   * @param { Callback<number> } callback - A callback instance used when connection to a grid dot.
655   * @returns { PatternLockAttribute }
656   * @syscap SystemCapability.ArkUI.ArkUI.Full
657   * @crossplatform
658   * @atomicservice
659   * @since 20
660   * @arkts 1.2
661   */
662  onDotConnect(callback: Callback<number>): PatternLockAttribute;
663
664  /**
665   * Sets the background circle style for the dots in a grid when they are in the activated state.
666   *
667   * @param { Optional<CircleStyleOptions> } options - Background circle style of the dots in the activated state.
668   * @returns { PatternLockAttribute } PatternLockAttribute
669   * @syscap SystemCapability.ArkUI.ArkUI.Full
670   * @crossplatform
671   * @atomicservice
672   * @since arkts {'1.1':'12','1.2':'20'}
673   * @arkts 1.1&1.2
674   */
675  activateCircleStyle(options: Optional<CircleStyleOptions>): PatternLockAttribute;
676
677  /**
678   * Sets whether unselected dots in the grid are automatically selected when the password path passes over them.
679   *
680   * @param { boolean } skipped - Whether unselected dots in the grid are automatically selected when the password
681   * path passes over them, Default value is false.
682   * @returns { PatternLockAttribute }
683   * @syscap SystemCapability.ArkUI.ArkUI.Full
684   * @crossplatform
685   * @atomicservice
686   * @since arkts {'1.1':'15','1.2':'20'}
687   * @arkts 1.1&1.2
688   */
689  skipUnselectedPoint(skipped: boolean): PatternLockAttribute;
690}
691
692/**
693 * Defines PatternLock Component.
694 *
695 * @syscap SystemCapability.ArkUI.ArkUI.Full
696 * @since 9
697 */
698/**
699 * Defines PatternLock Component.
700 *
701 * @syscap SystemCapability.ArkUI.ArkUI.Full
702 * @crossplatform
703 * @since 10
704 */
705/**
706 * Defines PatternLock Component.
707 *
708 * @syscap SystemCapability.ArkUI.ArkUI.Full
709 * @crossplatform
710 * @atomicservice
711 * @since 12
712 */
713declare const PatternLock: PatternLockInterface;
714
715/**
716 * Defines PatternLock Component instance.
717 *
718 * @syscap SystemCapability.ArkUI.ArkUI.Full
719 * @since 9
720 */
721/**
722 * Defines PatternLock Component instance.
723 *
724 * @syscap SystemCapability.ArkUI.ArkUI.Full
725 * @crossplatform
726 * @since 10
727 */
728/**
729 * Defines PatternLock Component instance.
730 *
731 * @syscap SystemCapability.ArkUI.ArkUI.Full
732 * @crossplatform
733 * @atomicservice
734 * @since 12
735 */
736declare const PatternLockInstance: PatternLockAttribute;
737