• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021 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 * Provides a monthly view component to display information such as date, shift break, and schedule.
18 * @since 7
19 * @systemapi
20 */
21interface CalendarDay {
22  /**
23   * Indicates the sequence number of the 7 x 7 (7 x 6) grid layout on a calendar page by row.
24   * The week sequence is one, two, three, four, five, six.
25   * @since 7
26   * @systemapi
27   */
28  index: number;
29
30  /**
31   * Lunar moon.
32   * The week sequence is one, two, three, four, five, six.
33   * @since 7
34   * @systemapi
35   */
36  lunarMonth: string;
37
38  /**
39   * Lunar day.
40   * @since 7
41   * @systemapi
42   */
43  lunarDay: string;
44
45  /**
46   * Day.
47   * @since 7
48   * @systemapi
49   */
50  dayMark: string;
51
52  /**
53   * Indicates the off-duty flag information. The options are work and off.By default, the off-duty flag information is not required.
54   * @since 7
55   * @systemapi
56   */
57  dayMarkValue: string;
58
59  /**
60   * Gregorian calendar year.
61   * @since 7
62   * @systemapi
63   */
64  year: number;
65
66  /**
67   * Gregorian calendar month.
68   * @since 7
69   * @systemapi
70   */
71  month: number;
72
73  /**
74   * Gregorian calendar day.
75   * @since 7
76   * @systemapi
77   */
78  day: number;
79
80  /**
81   *
82   * Indicates whether the default value is Lunar calendar.
83   * @since 7
84   * @systemapi
85   */
86  isFirstOfLunar: boolean;
87
88  /**
89   * Indicates whether to display has Schedule.
90   * The week sequence is one, two, three, four, five, six.
91   * @since 7
92   * @systemapi
93   */
94  hasSchedule: boolean;
95
96  /**
97   * Display Lunar Date.The week sequence is one, two, three, four, five, six.
98   * @since 7
99   * @systemapi
100   */
101  markLunarDay: boolean;
102}
103
104/**
105 * Date object.
106 * @since 7
107 * @systemapi
108 */
109interface MonthData {
110  /**
111   * Gregorian calendar year.
112   * @since 7
113   * @systemapi
114   */
115  year: number;
116
117  /**
118   * Gregorian calendar month.
119   * @since 7
120   * @systemapi
121   */
122  month: number;
123
124  /**
125   * CalendarDay.
126   * @since 7
127   * @systemapi
128   */
129  data: CalendarDay[];
130}
131
132/**
133 * CurrentDayStyle object.
134 * @since 7
135 * @systemapi
136 */
137interface CurrentDayStyle {
138  /**
139   * Text color.
140   * @since 7
141   * @systemapi
142   */
143  dayColor?: ResourceColor;
144
145  /**
146   * lunar Text color.
147   * @since 7
148   * @systemapi
149   */
150  lunarColor?: ResourceColor;
151
152  /**
153   * lunar  Work and rest  text color.
154   * @since 7
155   * @systemapi
156   */
157  markLunarColor?: ResourceColor;
158
159  /**
160   * Text fontSize.
161   * @since 7
162   * @systemapi
163   */
164  dayFontSize?: number;
165
166  /**
167   * lunar text fontSize.
168   * @since 7
169   * @systemapi
170   */
171  lunarDayFontSize?: number;
172
173  /**
174   * Single date height.
175   * @since 7
176   * @systemapi
177   */
178  dayHeight?: number;
179
180  /**
181   * Single date width.
182   * @since 7
183   * @systemapi
184   */
185  dayWidth?: number;
186
187  /**
188   * Gregorian calendar height.
189   * @since 7
190   * @systemapi
191   */
192  gregorianCalendarHeight?: number;
193
194  /**
195   * Data y axis Off set.
196   * @since 7
197   * @systemapi
198   */
199  dayYAxisOffset?: number;
200
201  /**
202   * Lunar data y axis Off set.
203   * @since 7
204   * @systemapi
205   */
206  lunarDayYAxisOffset?: number;
207
208  /**
209   * Under score X Axis Off set.
210   * @since 7
211   * @systemapi
212   */
213  underscoreXAxisOffset?: number;
214
215  /**
216   * Under score Y Axis Off set
217   * @since 7
218   * @systemapi
219   */
220  underscoreYAxisOffset?: number;
221
222  /**
223   * Schedule marker X axis Off set
224   * @since 7
225   * @systemapi
226   */
227  scheduleMarkerXAxisOffset?: number;
228
229  /**
230   * schedule Marker Y Axis Off set
231   * @since 7
232   * @systemapi
233   */
234  scheduleMarkerYAxisOffset?: number;
235
236  /**
237   * Number of columns.
238   * @since 7
239   * @systemapi
240   */
241  colSpace?: number;
242
243  /**
244   * Daily five row space.
245   * @since 7
246   * @systemapi
247   */
248  dailyFiveRowSpace?: number;
249
250  /**
251   * Daily six row space.
252   * @since 7
253   * @systemapi
254   */
255  dailySixRowSpace?: number;
256
257  /**
258   * Single lunar height.
259   * @since 7
260   * @systemapi
261   */
262  lunarHeight?: number;
263
264  /**
265   * Under score width.
266   * @since 7
267   * @systemapi
268   */
269  underscoreWidth?: number;
270
271  /**
272   * Under score length.
273   * @since 7
274   * @systemapi
275   */
276  underscoreLength?: number;
277
278  /**
279   * Schedule marker radius.
280   * @since 7
281   * @systemapi
282   */
283  scheduleMarkerRadius?: number;
284
285  /**
286   * Boundary row offset.
287   * @since 7
288   * @systemapi
289   */
290  boundaryRowOffset?: number;
291
292  /**
293   * Boundary col offset.
294   * @since 7
295   * @systemapi
296   */
297  boundaryColOffset?: number;
298}
299
300/**
301 * Non current day style.
302 * @since 7
303 * @systemapi
304 */
305interface NonCurrentDayStyle {
306  /**
307   * Non-current month day color.
308   * @since 7
309   * @systemapi
310   */
311  nonCurrentMonthDayColor?: ResourceColor;
312
313  /**
314   * Lunar style of non-current month.
315   * @since 7
316   * @systemapi
317   */
318  nonCurrentMonthLunarColor?: ResourceColor;
319
320  /**
321   * Non-Current Month Workday Marker Color.
322   * @since 7
323   * @systemapi
324   */
325  nonCurrentMonthWorkDayMarkColor?: ResourceColor;
326
327  /**
328   * Non-Current Month Off Day Marker Color.
329   * @since 7
330   * @systemapi
331   */
332  nonCurrentMonthOffDayMarkColor?: ResourceColor;
333}
334
335/**
336 * Non current day style.
337 * @since 7
338 * @systemapi
339 */
340interface TodayStyle {
341  /**
342   * Style of focus color.
343   * @since 7
344   * @systemapi
345   */
346  focusedDayColor?: ResourceColor;
347
348  /**
349   * Focus on Lunar Colors.
350   * @since 7
351   * @systemapi
352   */
353  focusedLunarColor?: ResourceColor;
354
355  /**
356   * Background color of the focus area.
357   * @since 7
358   * @systemapi
359   */
360  focusedAreaBackgroundColor?: ResourceColor;
361
362  /**
363   * Focus area radius.
364   * @since 7
365   * @systemapi
366   */
367  focusedAreaRadius?: number;
368}
369
370/**
371 * Week Style.
372 * @since 7
373 * @systemapi
374 */
375interface WeekStyle {
376  /**
377   * Style of week color.
378   * @since 7
379   * @systemapi
380   */
381  weekColor?: ResourceColor;
382
383  /**
384   * Style of week day color.
385   * @since 7
386   * @systemapi
387   */
388  weekendDayColor?: ResourceColor;
389
390  /**
391   * Style of lunar color.
392   * @since 7
393   * @systemapi
394   */
395  weekendLunarColor?: ResourceColor;
396
397  /**
398   * Style of week font size.
399   * @since 7
400   * @systemapi
401   */
402  weekFontSize?: number;
403
404  /**
405   * Style of week height.
406   * @since 7
407   * @systemapi
408   */
409  weekHeight?: number;
410
411  /**
412   * Style of week width.
413   * @since 7
414   * @systemapi
415   */
416  weekWidth?: number;
417
418  /**
419   * Style of week space.
420   * @since 7
421   * @systemapi
422   */
423  weekAndDayRowSpace?: number;
424}
425
426/**
427 * Work state style.
428 * @since 7
429 * @systemapi
430 */
431interface WorkStateStyle {
432  /**
433   * Style of day color.
434   * @since 7
435   * @systemapi
436   */
437  workDayMarkColor?: ResourceColor;
438
439  /**
440   * Style of day color.
441   * @since 7
442   * @systemapi
443   */
444  offDayMarkColor?: ResourceColor;
445
446  /**
447   * Style of day size.
448   * @since 7
449   * @systemapi
450   */
451  workDayMarkSize?: number;
452
453  /**
454   * Style of day size.
455   * @since 7
456   * @systemapi
457   */
458  offDayMarkSize?: number;
459
460  /**
461   * Style of width.
462   * @since 7
463   * @systemapi
464   */
465  workStateWidth?: number;
466
467  /**
468   * Style of distance.
469   * @since 7
470   * @systemapi
471   */
472  workStateHorizontalMovingDistance?: number;
473
474  /**
475   * Style of distance.
476   * @since 7
477   * @systemapi
478   */
479  workStateVerticalMovingDistance?: number;
480}
481
482/**
483 * Calendar controller.
484 * @since 7
485 * @systemapi
486 */
487declare class CalendarController {
488  /**
489   * Constructor.
490   * @since 7
491   * @systemapi
492   */
493  constructor();
494
495  /**
496   * Back to day.
497   * @since 7
498   * @systemapi
499   */
500  backToToday();
501
502  /**
503   * To the specified element.
504   * @since 7
505   * @systemapi
506   */
507  goTo(value: { year: number; month: number; day: number });
508}
509
510/**
511 * @since 7
512 * @systemapi
513 */
514interface CalendarInterface {
515  /**
516   * Set value.
517   * @since 7
518   * @systemapi
519   */
520  (value: {
521    date: { year: number; month: number; day: number };
522    currentData: MonthData;
523    preData: MonthData;
524    nextData: MonthData;
525    controller?: CalendarController;
526  }): CalendarAttribute;
527}
528
529/**
530 * @since 7
531 * @systemapi
532 */
533declare class CalendarAttribute {
534  /**
535   * Specifies whether the component displays the lunar calendar information.
536   * @since 7
537   * @systemapi
538   */
539  showLunar(value: boolean): CalendarAttribute;
540
541  /**
542   * Setting whether to display holiday information
543   * @since 7
544   * @systemapi
545   */
546  showHoliday(value: boolean): CalendarAttribute;
547
548  /**
549   * Indicates whether the page can be scrolled.
550   * @since 7
551   * @systemapi
552   */
553  needSlide(value: boolean): CalendarAttribute;
554
555  /**
556   * Set the start day of the week for the calendar.
557   * @since 7
558   * @systemapi
559   */
560  startOfWeek(value: number): CalendarAttribute;
561
562  /**
563   * Set weekend. The default value is Sunday and Saturday.
564   * @since 7
565   * @systemapi
566   */
567  offDays(value: number): CalendarAttribute;
568
569  /**
570   * Sets the sliding direction.
571   * @since 7
572   * @systemapi
573   */
574  direction(value: Axis): CalendarAttribute;
575
576  /**
577   * Sets the date style in the current month.
578   * @since 7
579   * @systemapi
580   */
581  currentDayStyle(value: CurrentDayStyle): CalendarAttribute;
582
583  /**
584   * Sets the non-monthly date style.
585   * @since 7
586   * @systemapi
587   */
588  nonCurrentDayStyle(value: NonCurrentDayStyle): CalendarAttribute;
589
590  /**
591   * Set the date style for today.
592   * @since 7
593   * @systemapi
594   */
595  todayStyle(value: TodayStyle): CalendarAttribute;
596
597  /**
598   * Sets the date style for the weekend.
599   * @since 7
600   * @systemapi
601   */
602  weekStyle(value: WeekStyle): CalendarAttribute;
603
604  /**
605   * Sets the style of the working state.
606   * @since 7
607   * @systemapi
608   */
609  workStateStyle(value: WorkStateStyle): CalendarAttribute;
610
611  /**
612   * Click a date to return the information about the date you clicked.
613   * @since 7
614   * @systemapi
615   */
616  onSelectChange(event: (event: { year: number; month: number; day: number }) => void): CalendarAttribute;
617
618  /**
619   * When you swipe to switch months, the information about the previous month and the next month is requested.
620   * @since 7
621   * @systemapi
622   */
623  onRequestData(
624    event: (event: {
625      year: number;
626      month: number;
627      currentYear: number;
628      currentMonth: number;
629      monthState: number;
630    }) => void,
631  ): CalendarAttribute;
632}
633
634/**
635 * Defines Calendar Component.
636 * @since 7
637 * @systemapi
638 */
639declare const Calendar: CalendarInterface;
640
641/**
642 * Defines Calendar Component instance.
643 * @since 7
644 * @systemapi
645 */
646declare const CalendarInstance: CalendarAttribute;
647