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/** 17 * @file A component which supports applications to select album 18 * @kit MediaLibraryKit 19 */ 20 21import { PickerColorMode } from '@ohos.file.PhotoPickerComponent'; 22import photoAccessHelper from '@ohos.file.photoAccessHelper'; 23 24/** 25 * AlbumPickerComponent: can select a certain album and display the images in that album through PhotoPickerComponent 26 * 27 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 28 * @atomicservice 29 * @since 12 30 */ 31@Component 32export declare struct AlbumPickerComponent { 33 /** 34 * AlbumPickerOptions 35 * 36 * @type { ?AlbumPickerOptions } 37 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 38 * @atomicservice 39 * @since 12 40 */ 41 albumPickerOptions?: AlbumPickerOptions; 42 43 /** 44 * Callback when select an album, will return album uri 45 * 46 * @type { ?function } 47 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 48 * @atomicservice 49 * @since 12 50 */ 51 onAlbumClick?: (albumInfo: AlbumInfo) => boolean; 52 53 /** 54 * Callback when click the empty area of the album component 55 * 56 * @type { ?function } 57 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 58 * @atomicservice 59 * @since 13 60 */ 61 onEmptyAreaClick?: EmptyAreaClickCallback; 62 63 /** 64 * AlbumPickerController 65 * 66 * @type { ?AlbumPickerController } 67 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 68 * @atomicservice 69 * @since 20 70 */ 71 albumPickerController?: AlbumPickerController; 72} 73 74/** 75 * The callback of onEmptyAreaClick event 76 * 77 * @typedef { function } EmptyAreaClickCallback 78 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 79 * @atomicservice 80 * @since 13 81 */ 82export type EmptyAreaClickCallback = () => void 83 84/** 85 * AlbumPickerOptions Object 86 * 87 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 88 * @atomicservice 89 * @since 12 90 */ 91export declare class AlbumPickerOptions { 92 /** 93 * AlbumPickerComponent theme color 94 * 95 * @type { ?PickerColorMode } 96 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 97 * @atomicservice 98 * @since 12 99 */ 100 themeColorMode?: PickerColorMode; 101 102 /** 103 * The type of the content displayed in the album 104 * 105 * @type { ?photoAccessHelper.PhotoViewMIMETypes } 106 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 107 * @atomicservice 108 * @since 13 109 */ 110 filterType?: photoAccessHelper.PhotoViewMIMETypes; 111 112 /** 113 * The size of the font displayed in the album. When `fontSize` is a number type, must use 'fp' unit 114 * 115 * @type { ?(number | string) } 116 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 117 * @atomicservice 118 * @since 20 119 */ 120 fontSize?: number | string; 121} 122 123 124/** 125 * AlbumInfo: include album uri 126 * 127 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 128 * @atomicservice 129 * @since 12 130 */ 131export declare class AlbumInfo { 132 /** 133 * Album uri 134 * 135 * @type { ?string } 136 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 137 * @atomicservice 138 * @since 12 139 */ 140 uri?: string; 141 142 /** 143 * Album name 144 * 145 * @type { ?string } 146 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 147 * @atomicservice 148 * @since 12 149 */ 150 albumName?: string; 151} 152 153 154/** 155 * The class for AlbumPickerController 156 * 157 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 158 * @atomicservice 159 * @since 20 160 */ 161@Observed 162export declare class AlbumPickerController { 163 /** 164 * Set font size to album picker component 165 * 166 * @param { number | string } fontSize - font size of album picker component 167 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 168 * @atomicservice 169 * @since 20 170 */ 171 setFontSize(fontSize: number | string): void; 172} 173