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 * The declare of selectOption. 18 * 19 * @interface SelectOption 20 * @syscap SystemCapability.ArkUI.ArkUI.Full 21 * @since 8 22 */ 23/** 24 * The declare of selectOption. 25 * 26 * @interface SelectOption 27 * @syscap SystemCapability.ArkUI.ArkUI.Full 28 * @crossplatform 29 * @since 10 30 */ 31declare interface SelectOption { 32 /** 33 * Option string. 34 * 35 * @type { ResourceStr } 36 * @syscap SystemCapability.ArkUI.ArkUI.Full 37 * @since 8 38 */ 39 /** 40 * Option string. 41 * 42 * @type { ResourceStr } 43 * @syscap SystemCapability.ArkUI.ArkUI.Full 44 * @crossplatform 45 * @since 10 46 */ 47 value: ResourceStr; 48 49 /** 50 * Option icon. 51 * 52 * @type { ?ResourceStr } 53 * @syscap SystemCapability.ArkUI.ArkUI.Full 54 * @since 8 55 */ 56 /** 57 * Option icon. 58 * 59 * @type { ?ResourceStr } 60 * @syscap SystemCapability.ArkUI.ArkUI.Full 61 * @crossplatform 62 * @since 10 63 */ 64 icon?: ResourceStr; 65} 66 67/** 68 * Provides the select interface. 69 * 70 * @interface SelectInterface 71 * @syscap SystemCapability.ArkUI.ArkUI.Full 72 * @since 8 73 */ 74/** 75 * Provides the select interface. 76 * 77 * @interface SelectInterface 78 * @syscap SystemCapability.ArkUI.ArkUI.Full 79 * @crossplatform 80 * @since 10 81 */ 82interface SelectInterface { 83 /** 84 * Called when the select is set. 85 * 86 * @param { Array<SelectOption> } options 87 * @returns { SelectAttribute } 88 * @syscap SystemCapability.ArkUI.ArkUI.Full 89 * @since 8 90 */ 91 /** 92 * Called when the select is set. 93 * 94 * @param { Array<SelectOption> } options 95 * @returns { SelectAttribute } 96 * @syscap SystemCapability.ArkUI.ArkUI.Full 97 * @crossplatform 98 * @since 10 99 */ 100 (options: Array<SelectOption>): SelectAttribute; 101} 102 103/** 104 * The enum for arrow position in the select 105 * 106 * @enum { number } 107 * @syscap SystemCapability.ArkUI.ArkUI.Full 108 * @crossplatform 109 * @since 10 110 */ 111declare enum ArrowPosition { 112 /** 113 * The value of arrow position end 114 * 115 * @syscap SystemCapability.ArkUI.ArkUI.Full 116 * @crossplatform 117 * @since 10 118 */ 119 END = 0, 120 121 /** 122 * The value of arrow position start 123 * 124 * @syscap SystemCapability.ArkUI.ArkUI.Full 125 * @crossplatform 126 * @since 10 127 */ 128 START = 1 129} 130 131/** 132 * The type of alignment between select and menu. 133 * 134 * @enum { number } 135 * @syscap SystemCapability.ArkUI.ArkUI.Full 136 * @since 10 137 */ 138declare enum MenuAlignType { 139 /** 140 * The value of menu align type start. 141 * 142 * @syscap SystemCapability.ArkUI.ArkUI.Full 143 * @since 10 144 */ 145 START, 146 /** 147 * The value of menu align type center. 148 * 149 * @syscap SystemCapability.ArkUI.ArkUI.Full 150 * @since 10 151 */ 152 CENTER, 153 /** 154 * The value of menu align type end. 155 * 156 * @syscap SystemCapability.ArkUI.ArkUI.Full 157 * @since 10 158 */ 159 END 160} 161 162/** 163 * The commonMethod of select. 164 * 165 * @extends CommonMethod 166 * @syscap SystemCapability.ArkUI.ArkUI.Full 167 * @since 8 168 */ 169/** 170 * The commonMethod of select. 171 * 172 * @extends CommonMethod 173 * @syscap SystemCapability.ArkUI.ArkUI.Full 174 * @crossplatform 175 * @since 10 176 */ 177declare class SelectAttribute extends CommonMethod<SelectAttribute> { 178 /** 179 * Sets the serial number of the select item, starting from 0. 180 * 181 * @param { number } value 182 * @returns { SelectAttribute } 183 * @syscap SystemCapability.ArkUI.ArkUI.Full 184 * @since 8 185 */ 186 /** 187 * Sets the serial number of the select item, starting from 0. 188 * 189 * @param { number } value 190 * @returns { SelectAttribute } 191 * @syscap SystemCapability.ArkUI.ArkUI.Full 192 * @crossplatform 193 * @since 10 194 */ 195 selected(value: number): SelectAttribute; 196 197 /** 198 * Sets the text display of the select button itself. 199 * 200 * @param { string } value 201 * @returns { SelectAttribute } 202 * @syscap SystemCapability.ArkUI.ArkUI.Full 203 * @since 8 204 */ 205 /** 206 * Sets the text display of the select button itself. 207 * 208 * @param { string } value 209 * @returns { SelectAttribute } 210 * @syscap SystemCapability.ArkUI.ArkUI.Full 211 * @crossplatform 212 * @since 10 213 */ 214 value(value: string): SelectAttribute; 215 216 /** 217 * Sets the text properties of the select button itself. 218 * 219 * @param { Font } value 220 * @returns { SelectAttribute } 221 * @syscap SystemCapability.ArkUI.ArkUI.Full 222 * @since 8 223 */ 224 /** 225 * Sets the text properties of the select button itself. 226 * 227 * @param { Font } value 228 * @returns { SelectAttribute } 229 * @syscap SystemCapability.ArkUI.ArkUI.Full 230 * @crossplatform 231 * @since 10 232 */ 233 font(value: Font): SelectAttribute; 234 235 /** 236 * Sets the text color of the select button itself. 237 * 238 * @param { ResourceColor } value 239 * @returns { SelectAttribute } 240 * @syscap SystemCapability.ArkUI.ArkUI.Full 241 * @since 8 242 */ 243 /** 244 * Sets the text color of the select button itself. 245 * 246 * @param { ResourceColor } value 247 * @returns { SelectAttribute } 248 * @syscap SystemCapability.ArkUI.ArkUI.Full 249 * @crossplatform 250 * @since 10 251 */ 252 fontColor(value: ResourceColor): SelectAttribute; 253 254 /** 255 * Sets the background color of the selected items in the select. 256 * 257 * @param { ResourceColor } value 258 * @returns { SelectAttribute } 259 * @syscap SystemCapability.ArkUI.ArkUI.Full 260 * @since 8 261 */ 262 /** 263 * Sets the background color of the selected items in the select. 264 * 265 * @param { ResourceColor } value 266 * @returns { SelectAttribute } 267 * @syscap SystemCapability.ArkUI.ArkUI.Full 268 * @crossplatform 269 * @since 10 270 */ 271 selectedOptionBgColor(value: ResourceColor): SelectAttribute; 272 273 /** 274 * Sets the text style of the selected items in the select. 275 * 276 * @param { Font } value 277 * @returns { SelectAttribute } 278 * @syscap SystemCapability.ArkUI.ArkUI.Full 279 * @since 8 280 */ 281 /** 282 * Sets the text style of the selected items in the select. 283 * 284 * @param { Font } value 285 * @returns { SelectAttribute } 286 * @syscap SystemCapability.ArkUI.ArkUI.Full 287 * @crossplatform 288 * @since 10 289 */ 290 selectedOptionFont(value: Font): SelectAttribute; 291 292 /** 293 * Sets the text color of the selected item in the select. 294 * 295 * @param { ResourceColor } value 296 * @returns { SelectAttribute } 297 * @syscap SystemCapability.ArkUI.ArkUI.Full 298 * @since 8 299 */ 300 /** 301 * Sets the text color of the selected item in the select. 302 * 303 * @param { ResourceColor } value 304 * @returns { SelectAttribute } 305 * @syscap SystemCapability.ArkUI.ArkUI.Full 306 * @crossplatform 307 * @since 10 308 */ 309 selectedOptionFontColor(value: ResourceColor): SelectAttribute; 310 311 /** 312 * Sets the background color of the select item. 313 * 314 * @param { ResourceColor } value 315 * @returns { SelectAttribute } 316 * @syscap SystemCapability.ArkUI.ArkUI.Full 317 * @since 8 318 */ 319 /** 320 * Sets the background color of the select item. 321 * 322 * @param { ResourceColor } value 323 * @returns { SelectAttribute } 324 * @syscap SystemCapability.ArkUI.ArkUI.Full 325 * @crossplatform 326 * @since 10 327 */ 328 optionBgColor(value: ResourceColor): SelectAttribute; 329 330 /** 331 * Sets the text style for select items. 332 * 333 * @param { Font } value 334 * @returns { SelectAttribute } 335 * @syscap SystemCapability.ArkUI.ArkUI.Full 336 * @since 8 337 */ 338 /** 339 * Sets the text style for select items. 340 * 341 * @param { Font } value 342 * @returns { SelectAttribute } 343 * @syscap SystemCapability.ArkUI.ArkUI.Full 344 * @crossplatform 345 * @since 10 346 */ 347 optionFont(value: Font): SelectAttribute; 348 349 /** 350 * Sets the text color for select items. 351 * 352 * @param { ResourceColor } value 353 * @returns { SelectAttribute } 354 * @syscap SystemCapability.ArkUI.ArkUI.Full 355 * @since 8 356 */ 357 /** 358 * Sets the text color for select items. 359 * 360 * @param { ResourceColor } value 361 * @returns { SelectAttribute } 362 * @syscap SystemCapability.ArkUI.ArkUI.Full 363 * @crossplatform 364 * @since 10 365 */ 366 optionFontColor(value: ResourceColor): SelectAttribute; 367 368 /** 369 * Callback for selecting an item from the select. 370 * 371 * @param { function } callback 372 * @returns { SelectAttribute } 373 * @syscap SystemCapability.ArkUI.ArkUI.Full 374 * @since 8 375 */ 376 /** 377 * Callback for selecting an item from the select. 378 * 379 * @param { function } callback 380 * @returns { SelectAttribute } 381 * @syscap SystemCapability.ArkUI.ArkUI.Full 382 * @crossplatform 383 * @since 10 384 */ 385 onSelect(callback: (index: number, value: string) => void): SelectAttribute; 386 387 /** 388 * Set the space for text and icon in select 389 * 390 * @param { Length } value - indicates the length of the space 391 * @returns { SelectAttribute } 392 * @syscap SystemCapability.ArkUI.ArkUI.Full 393 * @crossplatform 394 * @since 10 395 */ 396 space(value: Length): SelectAttribute; 397 398 /** 399 * Set the layout direction for text and arrow in select 400 * 401 * @param { ArrowPosition } value - indicates the arrow position in the select 402 * @returns { SelectAttribute } 403 * @syscap SystemCapability.ArkUI.ArkUI.Full 404 * @crossplatform 405 * @since 10 406 */ 407 arrowPosition(value: ArrowPosition): SelectAttribute; 408 409 /** 410 * Set the alignment between select and menu. 411 * 412 * @param { MenuAlignType } alignType - The type of alignment between select and menu. 413 * @param { Offset } offset - The offset between select and menu. 414 * @returns { SelectAttribute } the attribute of the select. 415 * @syscap SystemCapability.ArkUI.ArkUI.Full 416 * @since 10 417 */ 418 menuAlign(alignType: MenuAlignType, offset?: Offset): SelectAttribute; 419} 420 421/** 422 * Defines Select Component. 423 * 424 * @syscap SystemCapability.ArkUI.ArkUI.Full 425 * @since 8 426 */ 427/** 428 * Defines Select Component. 429 * 430 * @syscap SystemCapability.ArkUI.ArkUI.Full 431 * @crossplatform 432 * @since 10 433 */ 434declare const Select: SelectInterface; 435 436/** 437 * Defines Select Component instance. 438 * 439 * @syscap SystemCapability.ArkUI.ArkUI.Full 440 * @since 8 441 */ 442/** 443 * Defines Select Component instance. 444 * 445 * @syscap SystemCapability.ArkUI.ArkUI.Full 446 * @crossplatform 447 * @since 10 448 */ 449declare const SelectInstance: SelectAttribute; 450