1/* 2 * Copyright (c) 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/** 22 * The type of alignment between entry and calendar. 23 * @enum {number} 24 * @syscap SystemCapability.ArkUI.ArkUI.Full 25 * @crossplatform 26 * @since 10 27 */ 28/** 29 * The type of alignment between entry and calendar. 30 * @enum {number} 31 * @syscap SystemCapability.ArkUI.ArkUI.Full 32 * @crossplatform 33 * @atomicservice 34 * @since 11 35 */ 36declare enum CalendarAlign { 37 /** 38 * The value of calendar align type start. 39 * @syscap SystemCapability.ArkUI.ArkUI.Full 40 * @crossplatform 41 * @since 10 42 */ 43 /** 44 * The value of calendar align type start. 45 * @syscap SystemCapability.ArkUI.ArkUI.Full 46 * @crossplatform 47 * @atomicservice 48 * @since 11 49 */ 50 START = 0, 51 /** 52 * The value of calendar align type center. 53 * @syscap SystemCapability.ArkUI.ArkUI.Full 54 * @crossplatform 55 * @since 10 56 */ 57 /** 58 * The value of calendar align type center. 59 * @syscap SystemCapability.ArkUI.ArkUI.Full 60 * @crossplatform 61 * @atomicservice 62 * @since 11 63 */ 64 CENTER = 1, 65 /** 66 * The value of calendar align type end. 67 * @syscap SystemCapability.ArkUI.ArkUI.Full 68 * @crossplatform 69 * @since 10 70 */ 71 /** 72 * The value of calendar align type end. 73 * @syscap SystemCapability.ArkUI.ArkUI.Full 74 * @crossplatform 75 * @atomicservice 76 * @since 11 77 */ 78 END = 2 79} 80 81/** 82 * Defines the options of CalendarPicker. 83 * @interface CalendarOptions 84 * @syscap SystemCapability.ArkUI.ArkUI.Full 85 * @crossplatform 86 * @since 10 87 */ 88/** 89 * Defines the options of CalendarPicker. 90 * @interface CalendarOptions 91 * @syscap SystemCapability.ArkUI.ArkUI.Full 92 * @crossplatform 93 * @atomicservice 94 * @since 11 95 */ 96declare interface CalendarOptions { 97 /** 98 * Specifies the radius of the background of the day in calendar. 99 * @type { ?(number | Resource) } 100 * @syscap SystemCapability.ArkUI.ArkUI.Full 101 * @crossplatform 102 * @since 10 103 */ 104 /** 105 * Specifies the radius of the background of the day in calendar. 106 * @type { ?(number | Resource) } 107 * @syscap SystemCapability.ArkUI.ArkUI.Full 108 * @crossplatform 109 * @atomicservice 110 * @since 11 111 */ 112 hintRadius?: number | Resource; 113 114 /** 115 * Specifies the date selector check date. 116 * @type { ?Date } 117 * @syscap SystemCapability.ArkUI.ArkUI.Full 118 * @crossplatform 119 * @since 10 120 */ 121 /** 122 * Specifies the date selector check date. 123 * @type { ?Date } 124 * @syscap SystemCapability.ArkUI.ArkUI.Full 125 * @crossplatform 126 * @atomicservice 127 * @since 11 128 */ 129 selected?: Date; 130} 131 132/** 133 * Defines the CalendarPicker Component. 134 * @interface CalendarPickerInterface 135 * @syscap SystemCapability.ArkUI.ArkUI.Full 136 * @crossplatform 137 * @since 10 138 */ 139/** 140 * Defines the CalendarPicker Component. 141 * @interface CalendarPickerInterface 142 * @syscap SystemCapability.ArkUI.ArkUI.Full 143 * @crossplatform 144 * @atomicservice 145 * @since 11 146 */ 147interface CalendarPickerInterface { 148 /** 149 * Defines the CalendarPicker constructor. 150 * @param { CalendarOptions } options - the option of th calendarPicker. 151 * @returns { CalendarPickerAttribute } the attribute of the CalendarPicker. 152 * @syscap SystemCapability.ArkUI.ArkUI.Full 153 * @crossplatform 154 * @since 10 155 */ 156 /** 157 * Defines the CalendarPicker constructor. 158 * @param { CalendarOptions } options - the option of th calendarPicker. 159 * @returns { CalendarPickerAttribute } the attribute of the CalendarPicker. 160 * @syscap SystemCapability.ArkUI.ArkUI.Full 161 * @crossplatform 162 * @atomicservice 163 * @since 11 164 */ 165 (options?: CalendarOptions): CalendarPickerAttribute; 166} 167 168/** 169 * Defines the CalendarPicker attribute functions. 170 * @extends CommonMethod<CalendarPickerAttribute> 171 * @syscap SystemCapability.ArkUI.ArkUI.Full 172 * @crossplatform 173 * @since 10 174 */ 175/** 176 * Defines the CalendarPicker attribute functions. 177 * @extends CommonMethod<CalendarPickerAttribute> 178 * @syscap SystemCapability.ArkUI.ArkUI.Full 179 * @crossplatform 180 * @atomicservice 181 * @since 11 182 */ 183declare class CalendarPickerAttribute extends CommonMethod<CalendarPickerAttribute> { 184 /** 185 * Set the alignment between entry and calendar dialog. 186 * @param { CalendarAlign } alignType - The type of alignment between entry and calendar dialog. 187 * @param { Offset } offset - The offset between entry and calendar dialog. 188 * @returns { CalendarPickerAttribute } the attribute of the CalendarPicker. 189 * @syscap SystemCapability.ArkUI.ArkUI.Full 190 * @crossplatform 191 * @since 10 192 */ 193 /** 194 * Set the alignment between entry and calendar dialog. 195 * @param { CalendarAlign } alignType - The type of alignment between entry and calendar dialog. 196 * @param { Offset } offset - The offset between entry and calendar dialog. 197 * @returns { CalendarPickerAttribute } the attribute of the CalendarPicker. 198 * @syscap SystemCapability.ArkUI.ArkUI.Full 199 * @crossplatform 200 * @atomicservice 201 * @since 11 202 */ 203 edgeAlign(alignType: CalendarAlign, offset?: Offset): CalendarPickerAttribute; 204 205 /** 206 * Sets the text style of entry 207 * @param { PickerTextStyle } value - indicates the text style of entry. 208 * @returns { CalendarPickerAttribute } the attribute of the CalendarPicker. 209 * @syscap SystemCapability.ArkUI.ArkUI.Full 210 * @crossplatform 211 * @since 10 212 */ 213 /** 214 * Sets the text style of entry 215 * @param { PickerTextStyle } value - indicates the text style of entry. 216 * @returns { CalendarPickerAttribute } the attribute of the CalendarPicker. 217 * @syscap SystemCapability.ArkUI.ArkUI.Full 218 * @crossplatform 219 * @atomicservice 220 * @since 11 221 */ 222 textStyle(value: PickerTextStyle): CalendarPickerAttribute; 223 224 /** 225 * Callback for selected date changed. 226 * @param { function } callback - Callback for selected date changed. 227 * @returns { CalendarPickerAttribute } the attribute of the CalendarPicker. 228 * @syscap SystemCapability.ArkUI.ArkUI.Full 229 * @crossplatform 230 * @since 10 231 */ 232 /** 233 * Callback for selected date changed. 234 * @param { function } callback - Callback for selected date changed. 235 * @returns { CalendarPickerAttribute } the attribute of the CalendarPicker. 236 * @syscap SystemCapability.ArkUI.ArkUI.Full 237 * @crossplatform 238 * @atomicservice 239 * @since 11 240 */ 241 onChange(callback: (value: Date) => void): CalendarPickerAttribute; 242} 243 244/** 245 * Defines the DatePickerDialogOptions for Calendar Picker Dialog. 246 * @interface CalendarDialogOptions 247 * @syscap SystemCapability.ArkUI.ArkUI.Full 248 * @crossplatform 249 * @since 10 250 */ 251/** 252 * Defines the DatePickerDialogOptions for Calendar Picker Dialog. 253 * @interface CalendarDialogOptions 254 * @syscap SystemCapability.ArkUI.ArkUI.Full 255 * @crossplatform 256 * @atomicservice 257 * @since 11 258 */ 259declare interface CalendarDialogOptions extends CalendarOptions { 260 /** 261 * Called when the OK button in the dialog is clicked. 262 * @type { ?function } 263 * @syscap SystemCapability.ArkUI.ArkUI.Full 264 * @crossplatform 265 * @since 10 266 */ 267 /** 268 * Called when the OK button in the dialog is clicked. 269 * @type { ?function } 270 * @syscap SystemCapability.ArkUI.ArkUI.Full 271 * @crossplatform 272 * @atomicservice 273 * @since 11 274 */ 275 onAccept?: (value: Date) => void; 276 277 /** 278 * Called when the Cancel button in the dialog is clicked. 279 * @type { ?function } 280 * @syscap SystemCapability.ArkUI.ArkUI.Full 281 * @crossplatform 282 * @since 10 283 */ 284 /** 285 * Called when the Cancel button in the dialog is clicked. 286 * @type { ?function } 287 * @syscap SystemCapability.ArkUI.ArkUI.Full 288 * @crossplatform 289 * @atomicservice 290 * @since 11 291 */ 292 onCancel?: () => void; 293 294 /** 295 * This event is triggered when a date is selected in dialog. 296 * @type { ?function } 297 * @syscap SystemCapability.ArkUI.ArkUI.Full 298 * @crossplatform 299 * @since 10 300 */ 301 /** 302 * This event is triggered when a date is selected in dialog. 303 * @type { ?function } 304 * @syscap SystemCapability.ArkUI.ArkUI.Full 305 * @crossplatform 306 * @atomicservice 307 * @since 11 308 */ 309 onChange?: (value: Date) => void; 310 311 /** 312 * Defines the calendarPickerDialog's background color 313 * 314 * @type { ?ResourceColor } 315 * @default Color.Transparent 316 * @syscap SystemCapability.ArkUI.ArkUI.Full 317 * @crossplatform 318 * @since 11 319 */ 320 /** 321 * Defines the calendarPickerDialog's background color 322 * 323 * @type { ?ResourceColor } 324 * @default Color.Transparent 325 * @syscap SystemCapability.ArkUI.ArkUI.Full 326 * @crossplatform 327 * @atomicservice 328 * @since 12 329 */ 330 backgroundColor?: ResourceColor; 331 332 /** 333 * Defines the calendarPickerDialog's background blur Style 334 * 335 * @type { ?BlurStyle } 336 * @default BlurStyle.COMPONENT_ULTRA_THICK 337 * @syscap SystemCapability.ArkUI.ArkUI.Full 338 * @crossplatform 339 * @since 11 340 */ 341 /** 342 * Defines the calendarPickerDialog's background blur Style 343 * 344 * @type { ?BlurStyle } 345 * @default BlurStyle.COMPONENT_ULTRA_THICK 346 * @syscap SystemCapability.ArkUI.ArkUI.Full 347 * @crossplatform 348 * @atomicservice 349 * @since 12 350 */ 351 backgroundBlurStyle?: BlurStyle; 352 353 /** 354 * Style of accept button. 355 * 356 * @type { ?PickerDialogButtonStyle } 357 * @syscap SystemCapability.ArkUI.ArkUI.Full 358 * @crossplatform 359 * @atomicservice 360 * @since 12 361 */ 362 acceptButtonStyle?: PickerDialogButtonStyle; 363 364 /** 365 * Style of cancel button. 366 * 367 * @type { ?PickerDialogButtonStyle } 368 * @syscap SystemCapability.ArkUI.ArkUI.Full 369 * @crossplatform 370 * @atomicservice 371 * @since 12 372 */ 373 cancelButtonStyle?: PickerDialogButtonStyle; 374 375 /** 376 * Callback function when the dialog appears. 377 * 378 * @type { ?function } 379 * @syscap SystemCapability.ArkUI.ArkUI.Full 380 * @crossplatform 381 * @atomicservice 382 * @since 12 383 */ 384 onDidAppear?: () => void; 385 386 /** 387 * Callback function when the dialog disappears. 388 * 389 * @type { ?function } 390 * @syscap SystemCapability.ArkUI.ArkUI.Full 391 * @crossplatform 392 * @atomicservice 393 * @since 12 394 */ 395 onDidDisappear?: () => void; 396 397 /** 398 * Callback function before the dialog openAnimation starts. 399 * 400 * @type { ?function } 401 * @syscap SystemCapability.ArkUI.ArkUI.Full 402 * @crossplatform 403 * @atomicservice 404 * @since 12 405 */ 406 onWillAppear?: () => void; 407 408 /** 409 * Callback function before the dialog closeAnimation starts. 410 * 411 * @type { ?function } 412 * @syscap SystemCapability.ArkUI.ArkUI.Full 413 * @crossplatform 414 * @atomicservice 415 * @since 12 416 */ 417 onWillDisappear?: () => void; 418 419 /** 420 * Defines the dialog's shadow. 421 * 422 * @type { ?(ShadowOptions | ShadowStyle) } 423 * @syscap SystemCapability.ArkUI.ArkUI.Full 424 * @crossplatform 425 * @atomicservice 426 * @since 12 427 */ 428 shadow?: ShadowOptions | ShadowStyle; 429} 430 431/** 432 * Defines CalendarPickerDialog which uses show method to show CalendarPicker dialog. 433 * @syscap SystemCapability.ArkUI.ArkUI.Full 434 * @crossplatform 435 * @since 10 436 */ 437/** 438 * Defines CalendarPickerDialog which uses show method to show CalendarPicker dialog. 439 * @syscap SystemCapability.ArkUI.ArkUI.Full 440 * @crossplatform 441 * @atomicservice 442 * @since 11 443 */ 444declare class CalendarPickerDialog { 445 /** 446 * Invoking method display. 447 * @param { CalendarDialogOptions } options - the option of th calendarPicker. 448 * @syscap SystemCapability.ArkUI.ArkUI.Full 449 * @crossplatform 450 * @since 10 451 */ 452 /** 453 * Invoking method display. 454 * @param { CalendarDialogOptions } options - the option of th calendarPicker. 455 * @syscap SystemCapability.ArkUI.ArkUI.Full 456 * @crossplatform 457 * @atomicservice 458 * @since 11 459 */ 460 static show(options?: CalendarDialogOptions): void; 461} 462 463/** 464 * Defines CalendarPicker Component. 465 * @syscap SystemCapability.ArkUI.ArkUI.Full 466 * @crossplatform 467 * @since 10 468 */ 469/** 470 * Defines CalendarPicker Component. 471 * @syscap SystemCapability.ArkUI.ArkUI.Full 472 * @crossplatform 473 * @atomicservice 474 * @since 11 475 */ 476declare const CalendarPicker: CalendarPickerInterface; 477 478/** 479 * Defines CalendarPicker Component instance. 480 * @syscap SystemCapability.ArkUI.ArkUI.Full 481 * @crossplatform 482 * @since 10 483 */ 484/** 485 * Defines CalendarPicker Component instance. 486 * @syscap SystemCapability.ArkUI.ArkUI.Full 487 * @crossplatform 488 * @atomicservice 489 * @since 11 490 */ 491declare const CalendarPickerInstance: CalendarPickerAttribute; 492