提交 26ab5354 编写于 作者: E ester.zhou

Add and update docs (11099)

Signed-off-by: Nester.zhou <ester.zhou@huawei.com>
上级 9f97bc11
......@@ -13,8 +13,7 @@ None
## Child Components
A **\<tabs>** component can wrap at most one **[\<tab-bar>](../arkui-js/js-components-container-tab-bar.md)** and at most one **[\<tab-content>](../arkui-js/js-components-container-tab-content.md)**.
Only [\<tab-bar>](../arkui-js/js-components-container-tab-bar.md) and [\<tab-content>](../arkui-js/js-components-container-tab-content.md) are supported.
## Attributes
......@@ -23,7 +22,7 @@ In addition to the [universal attributes](../arkui-js/js-components-common-attri
| Name | Type | Default Value | Mandatory | Description |
| -------- | ------- | ----- | ---- | ---------------------------------------- |
| index | number | 0 | No | Index of the active tab. |
| vertical | boolean | false | No | Whether the tab is vertical. Available values are as follows:<br>- **false**: The **\<tab-bar>** and **\<tab-content>** are arranged vertically.<br>- **true**: The **\<tab-bar>** and **\<tab-content>** are arranged horizontally.|
| vertical | boolean | false | No | Whether the tab is vertical. Available values are as follows:<br>- **false**: The **\<tab-bar>** and **\<tab-content>** are arranged vertically.<br>- **true**: The **\<tab-bar>** and **\<tab-content>** are arranged horizontally. |
## Styles
......
# ArkTS-based Declarative Development Paradigm
- [Component Overview](ts-components-summary.md)
- Universal Component Information
- Universal Events
- [Click Event](ts-universal-events-click.md)
- [Touch Event](ts-universal-events-touch.md)
- [Show/Hide Event](ts-universal-events-show-hide.md)
- [Drag/Drop Event](ts-universal-events-drag-drop.md)
- [Key Event](ts-universal-events-key.md)
- [Focus Event](ts-universal-focus-event.md)
- [Mouse Event](ts-universal-mouse-key.md)
- [Component Area Change Event](ts-universal-component-area-change-event.md)
- [Visible Area Change Event](ts-universal-component-visible-area-change-event.md)
- Universal Attributes
- [Size](ts-universal-attributes-size.md)
- [Location](ts-universal-attributes-location.md)
- [Layout Constraints](ts-universal-attributes-layout-constraints.md)
- [Flex Layout](ts-universal-attributes-flex-layout.md)
- [Border](ts-universal-attributes-border.md)
- [Border Image](ts-universal-attributes-border-image.md)
- [Background](ts-universal-attributes-background.md)
- [Opacity](ts-universal-attributes-opacity.md)
- [Visibility](ts-universal-attributes-visibility.md)
- [Enable/Disable](ts-universal-attributes-enable.md)
- [Overlay](ts-universal-attributes-overlay.md)
- [Z-order Control](ts-universal-attributes-z-order.md)
- [Transformation](ts-universal-attributes-transformation.md)
- [Image Effect Configuration](ts-universal-attributes-image-effect.md)
- [Shape Clipping](ts-universal-attributes-sharp-clipping.md)
- [Text Style](ts-universal-attributes-text-style.md)
- [Grid](ts-universal-attributes-grid.md)
- [Gradient Color](ts-universal-attributes-gradient-color.md)
- [Popup Control](ts-universal-attributes-popup.md)
- [Menu Control](ts-universal-attributes-menu.md)
- [Click Control](ts-universal-attributes-click.md)
- [Focus Control](ts-universal-attributes-focus.md)
- [Hover Effect](ts-universal-attributes-hover-effect.md)
- [Component ID](ts-universal-attributes-component-id.md)
- [Touch Target](ts-universal-attributes-touch-target.md)
- [Polymorphic Style](ts-universal-attributes-polymorphic-style.md)
- [Hit Test Control](ts-universal-attributes-hit-test-behavior.md)
- [Background Blur](ts-universal-attributes-backgroundBlurStyle.md)
- [restoreId](ts-universal-attributes-restoreId.md)
- Gesture Processing
- [Gesture Binding Methods](ts-gesture-settings.md)
- Basic Gestures
- [TapGesture](ts-basic-gestures-tapgesture.md)
- [LongPressGesture](ts-basic-gestures-longpressgesture.md)
- [PanGesture](ts-basic-gestures-pangesture.md)
- [PinchGesture](ts-basic-gestures-pinchgesture.md)
- [RotationGesture](ts-basic-gestures-rotationgesture.md)
- [SwipeGesture](ts-basic-gestures-swipegesture.md)
- [Combined Gestures](ts-combined-gestures.md)
- Universal Events
- [Click Event](ts-universal-events-click.md)
- [Touch Event](ts-universal-events-touch.md)
- [Show/Hide Event](ts-universal-events-show-hide.md)
- [Drag/Drop Event](ts-universal-events-drag-drop.md)
- [Key Event](ts-universal-events-key.md)
- [Focus Event](ts-universal-focus-event.md)
- [Mouse Event](ts-universal-mouse-key.md)
- [Component Area Change Event](ts-universal-component-area-change-event.md)
- [Visible Area Change Event](ts-universal-component-visible-area-change-event.md)
- Universal Attributes
- [Size](ts-universal-attributes-size.md)
- [Location](ts-universal-attributes-location.md)
- [Layout Constraints](ts-universal-attributes-layout-constraints.md)
- [Flex Layout](ts-universal-attributes-flex-layout.md)
- [Border](ts-universal-attributes-border.md)
- [Border Image](ts-universal-attributes-border-image.md)
- [Background](ts-universal-attributes-background.md)
- [Opacity](ts-universal-attributes-opacity.md)
- [Visibility](ts-universal-attributes-visibility.md)
- [Enable/Disable](ts-universal-attributes-enable.md)
- [Overlay](ts-universal-attributes-overlay.md)
- [Z-order Control](ts-universal-attributes-z-order.md)
- [Transformation](ts-universal-attributes-transformation.md)
- [Image Effect Configuration](ts-universal-attributes-image-effect.md)
- [Shape Clipping](ts-universal-attributes-sharp-clipping.md)
- [Text Style](ts-universal-attributes-text-style.md)
- [Grid](ts-universal-attributes-grid.md)
- [Gradient Color](ts-universal-attributes-gradient-color.md)
- [Popup Control](ts-universal-attributes-popup.md)
- [Menu Control](ts-universal-attributes-menu.md)
- [Click Control](ts-universal-attributes-click.md)
- [Focus Control](ts-universal-attributes-focus.md)
- [Hover Effect](ts-universal-attributes-hover-effect.md)
- [Component ID](ts-universal-attributes-component-id.md)
- [Touch Target](ts-universal-attributes-touch-target.md)
- [Polymorphic Style](ts-universal-attributes-polymorphic-style.md)
- [Hit Test Control](ts-universal-attributes-hit-test-behavior.md)
- [Background Blur](ts-universal-attributes-backgroundBlurStyle.md)
- [restoreId](ts-universal-attributes-restoreId.md)
- Gesture Processing
- [Gesture Binding Methods](ts-gesture-settings.md)
- Basic Gestures
- [TapGesture](ts-basic-gestures-tapgesture.md)
- [LongPressGesture](ts-basic-gestures-longpressgesture.md)
- [PanGesture](ts-basic-gestures-pangesture.md)
- [PinchGesture](ts-basic-gestures-pinchgesture.md)
- [RotationGesture](ts-basic-gestures-rotationgesture.md)
- [SwipeGesture](ts-basic-gestures-swipegesture.md)
- [Combined Gestures](ts-combined-gestures.md)
- Basic Components
- [Blank](ts-basic-components-blank.md)
- [Button](ts-basic-components-button.md)
- [Checkbox](ts-basic-components-checkbox.md)
- [CheckboxGroup](ts-basic-components-checkboxgroup.md)
- [DataPanel](ts-basic-components-datapanel.md)
- [DatePicker](ts-basic-components-datepicker.md)
- [Divider](ts-basic-components-divider.md)
- [Gauge](ts-basic-components-gauge.md)
- [Image](ts-basic-components-image.md)
- [ImageAnimator](ts-basic-components-imageanimator.md)
- [LoadingProgress](ts-basic-components-loadingprogress.md)
- [Marquee](ts-basic-components-marquee.md)
- [Navigation](ts-basic-components-navigation.md)
- [PatternLock](ts-basic-components-patternlock.md)
- [PluginComponent](ts-basic-components-plugincomponent.md)
- [Progress](ts-basic-components-progress.md)
- [QRCode](ts-basic-components-qrcode.md)
- [Radio](ts-basic-components-radio.md)
- [Rating](ts-basic-components-rating.md)
- [RemoteWindow](ts-basic-components-remotewindow.md)
- [RichText](ts-basic-components-richtext.md)
- [ScrollBar](ts-basic-components-scrollbar.md)
- [Search](ts-basic-components-search.md)
- [Select](ts-basic-components-select.md)
- [Slider](ts-basic-components-slider.md)
- [Span](ts-basic-components-span.md)
- [Stepper](ts-basic-components-stepper.md)
- [StepperItem](ts-basic-components-stepperitem.md)
- [Text](ts-basic-components-text.md)
- [TextArea](ts-basic-components-textarea.md)
- [TextClock](ts-basic-components-textclock.md)
- [TextInput](ts-basic-components-textinput.md)
- [TextPicker](ts-basic-components-textpicker.md)
- [TextTimer](ts-basic-components-texttimer.md)
- [TimePicker](ts-basic-components-timepicker.md)
- [Toggle](ts-basic-components-toggle.md)
- [Web](ts-basic-components-web.md)
- [XComponent](ts-basic-components-xcomponent.md)
- [Blank](ts-basic-components-blank.md)
- [Button](ts-basic-components-button.md)
- [Checkbox](ts-basic-components-checkbox.md)
- [CheckboxGroup](ts-basic-components-checkboxgroup.md)
- [DataPanel](ts-basic-components-datapanel.md)
- [DatePicker](ts-basic-components-datepicker.md)
- [Divider](ts-basic-components-divider.md)
- [Gauge](ts-basic-components-gauge.md)
- [Image](ts-basic-components-image.md)
- [ImageAnimator](ts-basic-components-imageanimator.md)
- [LoadingProgress](ts-basic-components-loadingprogress.md)
- [Marquee](ts-basic-components-marquee.md)
- [Navigation](ts-basic-components-navigation.md)
- [NavRouter](ts-basic-components-navrouter.md)
- [NavDestination](ts-basic-components-navdestination.md)
- [PatternLock](ts-basic-components-patternlock.md)
- [PluginComponent](ts-basic-components-plugincomponent.md)
- [Progress](ts-basic-components-progress.md)
- [QRCode](ts-basic-components-qrcode.md)
- [Radio](ts-basic-components-radio.md)
- [Rating](ts-basic-components-rating.md)
- [RemoteWindow](ts-basic-components-remotewindow.md)
- [RichText](ts-basic-components-richtext.md)
- [ScrollBar](ts-basic-components-scrollbar.md)
- [Search](ts-basic-components-search.md)
- [Select](ts-basic-components-select.md)
- [Slider](ts-basic-components-slider.md)
- [Span](ts-basic-components-span.md)
- [Stepper](ts-basic-components-stepper.md)
- [StepperItem](ts-basic-components-stepperitem.md)
- [Text](ts-basic-components-text.md)
- [TextArea](ts-basic-components-textarea.md)
- [TextClock](ts-basic-components-textclock.md)
- [TextInput](ts-basic-components-textinput.md)
- [TextPicker](ts-basic-components-textpicker.md)
- [TextTimer](ts-basic-components-texttimer.md)
- [TimePicker](ts-basic-components-timepicker.md)
- [Toggle](ts-basic-components-toggle.md)
- [Web](ts-basic-components-web.md)
- [XComponent](ts-basic-components-xcomponent.md)
- Container Components
- [AbilityComponent](ts-container-ability-component.md)
- [AlphabetIndexer](ts-container-alphabet-indexer.md)
- [Badge](ts-container-badge.md)
- [Column](ts-container-column.md)
- [ColumnSplit](ts-container-columnsplit.md)
- [Counter](ts-container-counter.md)
- [Flex](ts-container-flex.md)
- [GridContainer](ts-container-gridcontainer.md)
- [GridCol](ts-container-gridcol.md)
- [GridRow](ts-container-gridrow.md)
- [Grid](ts-container-grid.md)
- [GridItem](ts-container-griditem.md)
- [List](ts-container-list.md)
- [ListItem](ts-container-listitem.md)
- [ListItemGroup](ts-container-listitemgroup.md)
- [Navigator](ts-container-navigator.md)
- [Panel](ts-container-panel.md)
- [Refresh](ts-container-refresh.md)
- [RelativeContainer](ts-container-relativecontainer.md)
- [Row](ts-container-row.md)
- [RowSplit](ts-container-rowsplit.md)
- [Scroll](ts-container-scroll.md)
- [SideBarContainer](ts-container-sidebarcontainer.md)
- [Stack](ts-container-stack.md)
- [Swiper](ts-container-swiper.md)
- [Tabs](ts-container-tabs.md)
- [TabContent](ts-container-tabcontent.md)
- [AbilityComponent](ts-container-ability-component.md)
- [AlphabetIndexer](ts-container-alphabet-indexer.md)
- [Badge](ts-container-badge.md)
- [Column](ts-container-column.md)
- [ColumnSplit](ts-container-columnsplit.md)
- [Counter](ts-container-counter.md)
- [Flex](ts-container-flex.md)
- [FlowItem](ts-container-flowitem.md)
- [GridContainer](ts-container-gridcontainer.md)
- [GridCol](ts-container-gridcol.md)
- [GridRow](ts-container-gridrow.md)
- [Grid](ts-container-grid.md)
- [GridItem](ts-container-griditem.md)
- [List](ts-container-list.md)
- [ListItem](ts-container-listitem.md)
- [ListItemGroup](ts-container-listitemgroup.md)
- [Navigator](ts-container-navigator.md)
- [Panel](ts-container-panel.md)
- [Refresh](ts-container-refresh.md)
- [RelativeContainer](ts-container-relativecontainer.md)
- [Row](ts-container-row.md)
- [RowSplit](ts-container-rowsplit.md)
- [Scroll](ts-container-scroll.md)
- [SideBarContainer](ts-container-sidebarcontainer.md)
- [Stack](ts-container-stack.md)
- [Swiper](ts-container-swiper.md)
- [Tabs](ts-container-tabs.md)
- [TabContent](ts-container-tabcontent.md)
- [WaterFlow](ts-container-waterflow.md)
- Media Components
- [Video](ts-media-components-video.md)
- Drawing Components
- [Circle](ts-drawing-components-circle.md)
......@@ -139,26 +143,26 @@
- [OffscreenCanvasRenderingContext2D](ts-offscreencanvasrenderingcontext2d.md)
- [Path2D](ts-components-canvas-path2d.md)
- [Lottie](ts-components-canvas-lottie.md)
- Animation
- [AnimatorProperty](ts-animatorproperty.md)
- [Explicit Animation](ts-explicit-animation.md)
- Transition Animation
- [Page Transition](ts-page-transition-animation.md)
- [Component Transition](ts-transition-animation-component.md)
- [Transition of Shared Elements](ts-transition-animation-shared-elements.md)
- [Motion Path Animation](ts-motion-path-animation.md)
- [AnimatorProperty](ts-animatorproperty.md)
- [Explicit Animatio](ts-explicit-animation.md)
- Transition Animation
- [Page Transition](ts-page-transition-animation.md)
- [Component Transition](ts-transition-animation-component.md)
- [Transition of Shared Elements](ts-transition-animation-shared-elements.md)
- [Motion Path Animation](ts-motion-path-animation.md)
- Global UI Methods
- Pop-up Window
- [Alert Dialog Box](ts-methods-alert-dialog-box.md)
- [Action Sheet](ts-methods-action-sheet.md)
- [Custom Dialog Box](ts-methods-custom-dialog-box.md)
- [Date Picker Dialog Box](ts-methods-datepicker-dialog.md)
- [Time Picker Dialog Box](ts-methods-timepicker-dialog.md)
- [Text Picker Dialog Box](ts-methods-textpicker-dialog.md)
- [Menu](ts-methods-menu.md)
- [Built-in Enums](ts-appendix-enums.md)
- Pop-up Window
- [Alert Dialog Box](ts-methods-alert-dialog-box.md)
- [Action Sheet](ts-methods-action-sheet.md)
- [Custom Dialog Box](ts-methods-custom-dialog-box.md)
- [Date Picker Dialog Box](ts-methods-datepicker-dialog.md)
- [Time Picker Dialog Box](ts-methods-timepicker-dialog.md)
- [Text Picker Dialog Box](ts-methods-textpicker-dialog.md)
- [Menu](ts-methods-menu.md)
- [State Management with Application-level Variables](ts-state-management.md)
- [Pixel Units](ts-pixel-units.md)
- [Enums](ts-appendix-enums.md)
- [Types](ts-types.md)
- Components No Longer Maintained
- [GridContainer](ts-container-gridcontainer.md)
......@@ -19,7 +19,7 @@ PanGesture(value?: { fingers?: number; direction?: PanDirection; distance?: numb
| -------- | -------- | -------- | -------- |
| fingers | number | No| Minimum number of fingers to trigger a pan gesture. The value ranges from 1 to 10.<br>Default value: **1**|
| direction | PanDirection | No| Pan direction. The enumerated value supports the AND (&amp;) and OR (\|) operations.<br>Default value: **PanDirection.All**|
| distance | number | No| Minimum pan distance to trigger the gesture, in vp.<br>Default value: **5**<br>**NOTE**<br>If a pan gesture and tab swipe occur at the same time, set **distance** to **1** so that the gesture can be more easily recognized.|
| distance | number | No| Minimum pan distance to trigger the gesture, in vp.<br>Default value: **5**<br>**NOTE**<br>If a pan gesture and [tab](ts-container-tabs.md) swipe occur at the same time, set **distance** to **1** so that the gesture can be more easily recognized.|
## PanDirection
......@@ -47,7 +47,7 @@ PanGestureOptions(value?: { fingers?: number; direction?: PanDirection; distance
| --------- | ------------ | ---- | ------------------------------------------------------------ |
| fingers | number | No | Minimum number of fingers to trigger a pan gesture. The value ranges from 1 to 10.<br>Default value: **1**|
| direction | PanDirection | No | Pan direction. The enumerated value supports the AND (&amp;) and OR (\|) operations.<br>Default value: **All**|
| distance | number | No | Minimum pan distance to trigger the gesture, in vp.<br>Default value: **5.0**<br>**NOTE**<br>If a pan gesture and tab swipe occur at the same time, set **distance** to **1** so that the gesture can be more easily recognized.|
| distance | number | No | Minimum pan distance to trigger the gesture, in vp.<br>Default value: **5.0**<br>**NOTE**<br>If a pan gesture and [tab](ts-container-tabs.md) swipe occur at the same time, set **distance** to **1** so that the gesture can be more easily recognized.|
**APIs**
......
# Component Overview
## Rows and Columns
- [Column](ts-container-column.md)
A container that lays out child components vertically.
- [ColumnSplit](ts-container-columnsplit.md)
A container that lays out child components vertically and inserts a horizontal divider between every two child components.
- [Row](ts-container-row.md)
A container that lays out child components horizontally.
- [RowSplit](ts-container-rowsplit.md)
A container that lays out child components horizontally and inserts a vertical divider between every two child components.
- [SideBarContainer](ts-container-sidebarcontainer.md)
A container that contains a sidebar and content area as its child components. The sidebar is the first child component and can be shown or hidden as needed. The content area is the second child component.
## Stack, Flex, and Grid
- [Stack](ts-container-stack.md)
A container where child components are successively stacked and the latter one overwrites the previous one.
- [Flex](ts-container-flex.md)
A container that allows for flexible layout of child components.
- [GridContainer](ts-container-gridcontainer.md)
A container that lays out components vertically and is used only in the grid layout.
- [GridRow](ts-container-gridrow.md)
A container that is used in a grid layout, together with its child component **\<GridCol>**.
- [GridCol](ts-container-gridcol.md)
A container that must be used as a child component of the **\<GridRow>** container.
- [RelativeContainer](ts-container-relativecontainer.md)
A container that is used for element alignment in complex scenarios.
## List and Grid
- [List](ts-container-list.md)
A container that presents a series of list items arranged in a column with the same width. It supports presentations of the same type of data in a multiple and coherent row style, for example, images or text.
- [ListItem](ts-container-listitem.md)
A component that displays a specific item in the list and that must be used together with **\<List>**.
- [ListItemGroup](ts-container-listitemgroup.md)
A component that displays list item groups and that must be used together with **\<List>**.
- [Grid](ts-container-grid.md)
A container that consists of cells formed by rows and columns. You can specify the cells where items are located to form various layouts.
- [GridItem](ts-container-griditem.md)
A container that provides a single item in a grid.
## Scroll and Swipe
- [Scroll](ts-container-scroll.md)
A container that scrolls the content when the layout size of a component exceeds the size of its parent component.
- [Swiper](ts-container-swiper.md)
A container that is able to display child components in looping mode.
- [WaterFlow](ts-container-waterflow.md)
A container that consists of cells formed by rows and columns and arranges items of different sizes from top to bottom according to the preset rules.
- [FlowItem](ts-container-flowitem.md)
A child component of the **\<WaterFlow>** container that is used to display specific items in the container layout.
## Navigation
- [Navigator](ts-container-navigator.md)
A container that provides redirection.
- [Navigation](ts-basic-components-navigation.md)
A container that typically functions as the root container of a page and displays the title bar, toolbar, and navigation bar based on the attribute settings.
- [NavRouter](ts-basic-components-navrouter.md)
A container that provides default logic for click response processing, eliminating the need for manual logic definition.
- [NavDestination](ts-basic-components-navdestination.md)
A child component of the **\<NavRouter>** component that represents a destination in the navigation area.
- [Stepper](ts-basic-components-stepper.md)
A component that provides a step navigator.
- [StepperItem](ts-basic-components-stepperitem.md)
A child component of the **\<Stepper>** component.
- [Tabs](ts-container-tabs.md)
A container that allows users to switch between content views through tabs.
- [TabContent](ts-container-tabcontent.md)
A component that corresponds to the content view on a tab page and is used only in the **\<Tabs>** component.
## Button and Selection
- [Button](ts-basic-components-button.md)
A component that can be used to create different types of buttons.
- [Toggle](ts-basic-components-toggle.md)
A component that provides a clickable element in the check box, button, or switch type.
- [Checkbox](ts-basic-components-checkbox.md)
A component that is used to enable or disable an option.
- [CheckboxGroup](ts-basic-components-checkboxgroup.md)
A component that is used to select or deselect all check boxes in a group.
- [DatePicker](ts-basic-components-datepicker.md)
A component that allows users to select a date from the given range.
- [TextPicker](ts-basic-components-textpicker.md)
A component that allows users to scroll to select text.
- [TimePicker](ts-basic-components-timepicker.md)
A component that allows users to select a time from the given range through scrolling.
- [Radio](ts-basic-components-radio.md)
A component that allows users to select from a set of mutually exclusive options.
- [Rating](ts-basic-components-rating.md)
A component that provides a rating bar.
- [Select](ts-basic-components-select.md)
A component that provides a drop-down list box to allow user to select among multiple options.
- [Slider](ts-basic-components-slider.md)
A component that is used to quickly adjust settings, such as the volume and brightness.
- [Counter](ts-container-counter.md)
A component that provides an operation to increase or decrease the number.
## Text and Input
- [Text](ts-basic-components-text.md)
A component that is used to display a piece of textual information.
- [Span](ts-basic-components-span.md)
A component that is used to display inline text in the **\<Text>** component.
- [Search](ts-basic-components-search.md)
A component that provides an area for users to enter search queries.
- [TextArea](ts-basic-components-textarea.md)
A component that provides multi-line text input and automatically wraps text so that each line does not have more than the width of the component.
- [TextInput](ts-basic-components-textinput.md)
A component that provides single-line text input.
- [PatternLock](ts-basic-components-patternlock.md)
A component that allows users to use a pattern password for authentication. It enters the input state once a finger is pressed against it, and exits the input state and completes the input once the finger leaves the screen.
- [RichText](ts-basic-components-richtext.md)
A component that parses and displays HTML text.
## Image, Video, and Media
- [Image](ts-basic-components-image.md)
A component that is used to render and display local and online images.
- [ImageAnimator](ts-basic-components-imageanimator.md)
A component that enables images to be played frame by frame. The list of images to be played as well as the duration of each image can be configured.
- [Video](ts-media-components-video.md)
A component that is used to play a video and control its playback.
- [PluginComponent](ts-basic-components-plugincomponent.md)
A component that allows the UI provided by an external application to be displayed in the application.
- [XComponent](ts-basic-components-xcomponent.md)
A component that can accept and display the EGL/OpenGL ES and media data input.
## Information Display
- [DataPanel](ts-basic-components-datapanel.md)
A component that displays proportions in a chart.
- [Gauge](ts-basic-components-gauge.md)
A component that is used to display data in a ring chart.
- [LoadingProgress](ts-basic-components-loadingprogress.md)
A component that is used to create a loading animation.
- [Marquee](ts-basic-components-marquee.md)
A component that is used to display a scrolling piece of text. The text is scrolled only when its width exceeds the width of the **\<Marquee>** component.
- [Progress](ts-basic-components-progress.md)
A component that is used to provide a progress indicator that displays the progress of content loading or an operation.
- [QRCode](ts-basic-components-qrcode.md)
A component that is used to display a QR code.
- [TextClock](ts-basic-components-textclock.md)
A component that displays the current system time in text format for different time zones. The time is accurate to seconds.
- [TextTimer](ts-basic-components-texttimer.md)
A component that displays timing information and is controlled in text format.
## Blank and Divider
- [Blank](ts-basic-components-blank.md)
A component that is able to automatically fill the empty spaces in the container along the main axis. It is valid only when the parent component is **\<Row>** or **\<Column>**.
- [Divider](ts-basic-components-divider.md)
A component that is used to separate content blocks and elements.
## Canvas and Graphics Drawing
- [Canvas](ts-components-canvas-canvas.md)
A component that can be used to customize drawings.
- [Circle](ts-drawing-components-circle.md)
A component that is used to draw a circle.
- [Ellipse](ts-drawing-components-ellipse.md)
A component that is used to draw an ellipse.
- [Line](ts-drawing-components-line.md)
A component that is used to draw a straight line.
- [Polyline](ts-drawing-components-polyline.md)
A component that is used to draw a polyline.
- [Polygon](ts-drawing-components-polygon.md)
A component that is used to draw a polygon.
- [Path](ts-drawing-components-path.md)
A component that is used to define a closed shape.
- [Rect](ts-drawing-components-rect.md)
A component that is used to draw a rectangle.
- [Shape](ts-drawing-components-shape.md)
A parent component of the drawing components. The attributes provided by this component are universal attributes supported by all the drawing components.
## Web
- [Web](ts-basic-components-web.md)
A component that can be used to display web pages.
## Miscellaneous
- [ScrollBar](ts-basic-components-scrollbar.md)
A component that is used together with scrollable components, such as **\<List>**, **\<Grid>**, and **\<Scroll>**.
- [Badge](ts-container-badge.md)
A container that can be attached to another component for tagging.
- [AlphabetIndexer](ts-container-alphabet-indexer.md)
A component that can create a logically indexed array of items in a container for instant location.
- [Panel](ts-container-panel.md)
A container that presents lightweight content with flexible sizes.
- [Refresh](ts-container-refresh.md)
A container that provides the pull-to-refresh feature.
- [AbilityComponent](ts-container-ability-component.md)
A container that is used for independently displaying an ability.
- [RemoteWindow](ts-basic-components-remotewindow.md)
A component that is used to control the application window, providing the component animator and application window linkage animator during application startup and exit.
# FlowItem
**\<FlowItem>** is a child component of the [\<WaterFlow>](ts-container-waterflow.md) container and is used to display specific items in the container layout.
> **NOTE**
>
> This component is supported since API version 9. Updates will be marked with a superscript to indicate their earliest API version.
## Child Components
This component supports only one child component.
## APIs
FlowItem()
Ceates a child component in the **\<WaterFlow>** layout.
## Attributes
None
## Example
See [WaterFlow](ts-container-waterflow.md#example).
# WaterFlow
The **\<WaterFlow>** component is a container that consists of cells formed by rows and columns and arranges items of different sizes from top to bottom according to the preset rules.
> **NOTE**
>
> This component is supported since API version 9. Updates will be marked with a superscript to indicate their earliest API version.
## Child Components
The [\<FlowItem>](ts-container-flowitem.md) child component is supported.
## APIs
WaterFlow(options?: {footer?: CustomBuilder, scroller?: Scroller})
**Parameters**
| Name | Type | Mandatory| Description |
| ---------- | ----------------------------------------------- | ------ | -------------------------------------------- |
| footer | [CustomBuilder](ts-types.md#custombuilder8) | No | Footer of the **\<WaterFlow>** component. |
| scroller | [Scroller](ts-container-scroll.md#scroller) | No | Controller, which can be bound to scrollable components.<br>The **\<WaterFlow>** component supports only the **scrollToIndex** API of the **\<Scroller>** component.|
## Attributes
In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported.
| Name| Type| Description|
| -------- | -------- | -------- |
| columnsTemplate | string | Number of columns in the layout. If this attribute is not set, one column is used by default.<br>For example, **'1fr 1fr 2fr'** indicates three columns, with the first column taking up 1/4 of the parent component's full width, the second column 1/4, and the third column 2/4. This attribute supports [auto-fill](#auto-fill).<br>Default value: **'1fr'**|
| rowsTemplate | string | Number of rows in the layout. If this attribute is not set, one row is used by default.<br>For example, **'1fr 1fr 2fr'** indicates three rows, with the first row taking up 1/4 of the parent component's full height, the second row 1/4, and the third row 2/4. This attribute supports [auto-fill](#auto-fill).<br>Default value: **'1fr'**|
| itemConstraintSize | [ConstraintSizeOptions](ts-types.md#constraintsizeoptions) | Size constraints of the child components during layout. |
| columnsGap | Length |Gap between columns.<br>Default value: **0**|
| rowsGap | Length |Gap between rows.<br> Default value: **0**|
| layoutDirection | [FlexDirection](ts-appendix-enums.md#flexdirection) |Main axis direction of the layout.<br>Default value: **FlexDirection.Column**|
The priority of **layoutDirection** is higher than that of **rowsTemplate** and **columnsTemplate**. Depending on the **layoutDirection** settings, there are three layout modes:
- **layoutDirection** is set to **FlexDirection.Column** or **FlexDirection.ColumnReverse**
In this case, **columnsTemplate** is valid. If it is not set, the default value is used. For example, if **columnsTemplate** is set to **"1fr 1fr"** and **rowsTemplate** **"1fr 1fr 1fr"**, child components are arranged in vertical layout, with the cross axis equally divided into two columns.
- **layoutDirection** set to **FlexDirection.Row** or **FlexDirection.RowReverse**
In this case, **rowsTemplate** is valid. If it is not set, the default value is used. For example, if **columnsTemplate** is set to **"1fr 1fr"** and **rowsTemplate** **"1fr 1fr 1fr"**, child components are arranged in horizontal layout, with the cross axis equally divided into three columns.
- **layoutDirection** is not set
In this case, the default value of **layoutDirection** is used, which is **FlexDirection.Column**, and **columnsTemplate** is valid. For example, if **columnsTemplate** is set to **"1fr 1fr"** and **rowsTemplate** **"1fr 1fr 1fr"**, child components are arranged in vertical layout, with the cross axis equally divided into two columns.
## Events
In addition to the [universal events](ts-universal-events-click.md), the following events are supported.
| Name| Description|
| -------- | -------- |
| onReachStart(event: () => void) | Triggered when the component reaches the start.|
| onReachEnd(event: () => void) | Triggered when the component reaches the end.|
## auto-fill
The **columnsTemplate** and **rowsTemplate** attributes supports **auto-fill** in the following format:
```css
repeat(auto-fill, track-size)
```
Where, **repeat** and **auto-fill** are keywords, and **track-size** indicates the row height or column width. The supported units include px, vp, %, and digits. The value of **track-size** must contain at least one valid row height or column width.
## Example
```ts
// WaterFlowDataSource.ets
// Object that implements the IDataSource API, which is used by the <WaterFlow> component to load data.
export class WaterFlowDataSource implements IDataSource {
private dataArray: number[] = []
private listeners: DataChangeListener[] = []
constructor() {
for (let i = 0; i < 100; i++) {
this.dataArray.push(i)
}
}
// Obtain the data corresponding to the specified index.
public getData(index: number): any {
return this.dataArray[index]
}
// Notify the controller of data reloading.
notifyDataReload(): void {
this.listeners.forEach(listener => {
listener.onDataReloaded()
})
}
// Notify the controller of data addition.
notifyDataAdd(index: number): void {
this.listeners.forEach(listener => {
listener.onDataAdded(index)
})
}
// Notify the controller of data changes.
notifyDataChange(index: number): void {
this.listeners.forEach(listener => {
listener.onDataChanged(index)
})
}
// Notify the controller of data deletion.
notifyDataDelete(index: number): void {
this.listeners.forEach(listener => {
listener.onDataDeleted(index)
})
}
// Notify the controller of the data location change.
notifyDataMove(from: number, to: number): void {
this.listeners.forEach(listener => {
listener.onDataMoved(from, to)
})
}
// Obtain the total number of data records.
public totalCount(): number {
return this.dataArray.length
}
// Register the data change listener.
registerDataChangeListener(listener: DataChangeListener): void {
if (this.listeners.indexOf(listener) < 0) {
this.listeners.push(listener)
}
}
// Unregister the data change listener.
unregisterDataChangeListener(listener: DataChangeListener): void {
const pos = this.listeners.indexOf(listener)
if (pos >= 0) {
this.listeners.splice(pos, 1)
}
}
// Add data.
public Add1stItem(): void {
this.dataArray.splice(0, 0, this.dataArray.length)
this.notifyDataAdd(0)
}
// Add an item to the end of the data.
public AddLastItem(): void {
this.dataArray.splice(this.dataArray.length, 0, this.dataArray.length)
this.notifyDataAdd(this.dataArray.length-1)
}
// Add an item to the position corresponding to the specified index.
public AddItem(index: number): void {
this.dataArray.splice(index, 0, this.dataArray.length)
this.notifyDataAdd(index)
}
// Delete the first item.
public Delete1stItem(): void {
this.dataArray.splice(0, 1)
this.notifyDataDelete(0)
}
// Delete the second item.
public Delete2ndItem(): void {
this.dataArray.splice(1, 1)
this.notifyDataDelete(1)
}
// Delete the last item.
public DeleteLastItem(): void {
this.dataArray.splice(-1, 1)
this.notifyDataDelete(this.dataArray.length)
}
// Reload data.
public Reload(): void {
this.dataArray.splice(1, 1)
this.dataArray.splice(3, 2)
this.notifyDataReload()
}
}
```
```ts
// WaterflowDemo.ets
import { WaterFlowDataSource } from './WaterFlowDataSource'
@Entry
@Component
struct WaterflowDemo {
@State minSize: number = 50
@State maxSize: number = 100
@State fontSize: number = 24
@State colors: number[] = [0xFFC0CB, 0xDA70D6, 0x6B8E23, 0x6A5ACD, 0x00FFFF, 0x00FF7F]
scroller: Scroller = new Scroller()
datasource: WaterFlowDataSource = new WaterFlowDataSource()
private itemWidthArray: number[] = []
private itemHeightArray: number[] = []
// Calculate the width and height of a flow item.
getSize() {
let ret = Math.floor(Math.random() * this.maxSize)
return (ret > this.minSize ? ret : this.minSize)
}
// Save the width and height of the flow item.
getItemSizeArray() {
for (let i = 0; i < 100; i++) {
this.itemWidthArray.push(this.getSize())
this.itemHeightArray.push(this.getSize())
}
}
aboutToAppear() {
this.getItemSizeArray()
}
@Builder itemFoot() {
Column() {
Text(`Footer`)
.fontSize(10)
.backgroundColor(Color.Red)
.width(50)
.height(50)
.align(Alignment.Center)
.margin({ top: 2 })
}
}
build() {
Column({ space: 2 }) {
WaterFlow({ footer: this.itemFoot, scroller: this.scroller }) {
LazyForEach(this.datasource, (item: number) => {
FlowItem() {
Column() {
Text("N" + item).fontSize(12).height('16')
Image('res/waterFlowTest(' + item % 5 + ').jpg')
.objectFit(ImageFit.Fill)
}
}
.width(this.itemWidthArray[item])
.height(this.itemHeightArray[item])
.backgroundColor(this.colors[item % 5])
}, item => item)
}
.columnsTemplate("1fr 1fr 1fr 1fr")
.itemConstraintSize({
minWidth: 0,
maxWidth: '100%',
minHeight: 0,
maxHeight: '100%'
})
.columnsGap(10)
.rowsGap(5)
.onReachStart(() => {
console.info("onReachStart")
})
.onReachEnd(() => {
console.info("onReachEnd")
})
.backgroundColor(0xFAEEE0)
.width('100%')
.height('80%')
.layoutDirection(FlexDirection.Column)
}
}
}
```
![en-us_image_WaterFlow.gif](figures/waterflow.gif)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册