diff --git a/en/application-dev/reference/arkui-js-lite/figures/#000000.png b/en/application-dev/reference/arkui-js-lite/figures/000000.png similarity index 100% rename from en/application-dev/reference/arkui-js-lite/figures/#000000.png rename to en/application-dev/reference/arkui-js-lite/figures/000000.png diff --git a/en/application-dev/reference/arkui-js-lite/js-common-styles.md b/en/application-dev/reference/arkui-js-lite/js-common-styles.md index 15d76dc7b93a04aa82644b52f3a69f834d9aa1c8..52b7e4c81ed17f40e65b8dcfcc0a359729453429 100644 --- a/en/application-dev/reference/arkui-js-lite/js-common-styles.md +++ b/en/application-dev/reference/arkui-js-lite/js-common-styles.md @@ -4,21 +4,21 @@ You can set universal styles for components in the **style** attribute or **.css** files. -| Name| Type| Default Value| Mandatory| Description| -| -------- | -------- | -------- | -------- | -------- | -| width | <length> \| <percentage>5+ | - | No| Component width.

If this attribute is not set, the default value **0** is used.| -| height | <length> \| <percentage>5+ | - | No| Component height.

If this attribute is not set, the default value **0** is used.| -| padding | <length> | 0 | No| Shorthand attribute to set the padding for all sides in a declaration.
The attribute can have one to four values:
- If you set only one value, it specifies the padding for all the four sides.
- If you set two values, the first value specifies the top and bottom padding, and the second value specifies the left and right padding.
- If you set three values, the first value specifies the top padding, the second value specifies the left and right padding, and the third value specifies the bottom padding.
- If you set four values, they respectively specify the padding for top, right, bottom, and left sides (in clockwise order).| -| padding-[left\|top\|right\|bottom] | <length> | 0 | No| Left, top, right, and bottom padding.| -| margin | <length> \| <percentage>5+ | 0 | No| Shorthand attribute to set the margin for all sides in a declaration. The attribute can have one to four values:
- If you set only one value, it specifies the margin for all the four sides.
- If you set two values, the first value specifies the top and bottom margins, and the second value specifies the left and right margins.
- If you set three values, the first value specifies the top margin, the second value specifies the left and right margins, and the third value specifies the bottom margin.
- If you set four values, they respectively specify the margin for top, right, bottom, and left sides (in clockwise order).| -| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | No| Left, top, right, and bottom margins.| -| border-width | <length> | 0 | No| Shorthand attribute to set the margin for all sides.| -| border-color | <color> | black | No| Shorthand attribute to set the color for all borders.| -| border-radius | <length> | - | No| Radius of round-corner borders. | -| background-color | <color> | - | No| Background color.| -| opacity5+ | number | 1 | No| Opacity of an element. The value ranges from **0** to **1**. The value **1** means opaque, and **0** means completely transparent.| -| display | string | flex | No| Type of the box containing an element. Available values are as follows:
- **flex**: flexible layout
- **none**: not rendered| -| [left\|top] | <length> \| <percentage>6+ | - | No| Edge of the element.
- **left**: left edge position of the element. This attribute defines the offset between the left edge of the margin area of a positioned element and left edge of its containing block.
- **top**: top edge position of the element. This attribute defines the offset between the top edge of a positioned element and that of a block included in the element. | +| Name | Type | Default Value | Mandatory | Description | +| ---------------------------------- | ---------------------------------------- | ----- | ---- | ---------------------------------------- | +| width | <length> \| <percentage>5+ | - | No | Component width.

If this attribute is not set, the default value **0** is used. | +| height | <length> \| <percentage>5+ | - | No | Component height.

If this attribute is not set, the default value **0** is used. | +| padding | <length> | 0 | No | Shorthand attribute to set the padding for all sides in a declaration.
The attribute can have one to four values:
- If you set only one value, it specifies the padding for all the four sides.
- If you set two values, the first value specifies the top and bottom padding, and the second value specifies the left and right padding.
- If you set three values, the first value specifies the top padding, the second value specifies the left and right padding, and the third value specifies the bottom padding.
- If you set four values, they respectively specify the padding for top, right, bottom, and left sides (in clockwise order).| +| padding-[left\|top\|right\|bottom] | <length> | 0 | No | Left, top, right, and bottom padding. | +| margin | <length> \| <percentage>5+ | 0 | No | Shorthand attribute to set the margin for all sides in a declaration. The attribute can have one to four values:
- If you set only one value, it specifies the margin for all the four sides.
- If you set two values, the first value specifies the top and bottom margins, and the second value specifies the left and right margins.
- If you set three values, the first value specifies the top margin, the second value specifies the left and right margins, and the third value specifies the bottom margin.
- If you set four values, they respectively specify the margin for top, right, bottom, and left sides (in clockwise order).| +| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | No | Left, top, right, and bottom margins. | +| border-width | <length> | 0 | No | Shorthand attribute to set the margin for all sides. | +| border-color | <color> | black | No | Shorthand attribute to set the color for all borders. | +| border-radius | <length> | - | No | Radius of round-corner borders. | +| background-color | <color> | - | No | Background color. | +| opacity5+ | number | 1 | No | Opacity of an element. The value ranges from **0** to **1**. The value **1** means opaque, and **0** means completely transparent. | +| display | string | flex | No | Type of the box containing an element. Available values are as follows:
- **flex**: flexible layout
- **none**: not rendered| +| [left\|top] | <length> \| <percentage>6+ | - | No | Edge of the element.
- **left**: left edge position of the element. This attribute defines the offset between the left edge of the margin area of a positioned element and left edge of its containing block.
- **top**: top edge position of the element. This attribute defines the offset between the top edge of a positioned element and that of a block included in the element.| > **NOTE** @@ -37,152 +37,152 @@ You can set universal styles for components in the **style** attribute or **.css **Table 1** Color enums -| Name| Hexadecimal Code| Color| -| -------- | -------- | -------- | -| aliceblue | \#f0f8ff | ![aliceblue](figures/aliceblue.png) | -| antiquewhite | \#faebd7 | ![antiquewhite](figures/antiquewhite.png) | -| aqua | \#00ffff | ![aqua](figures/aqua.png) | -| aquamarine | \#7fffd4 | ![aquamarine](figures/aquamarine.png) | -| azure | \#f0ffff | ![azure](figures/azure.png) | -| beige | \#f5f5dc | ![beige](figures/beige.png) | -| bisque | \#ffe4c4 | ![bisque](figures/bisque.png) | -| black | \#000000 | ![#000000](figures/#000000.png) | -| blanchedalmond | \#ffebcd | ![blanchedalmond](figures/blanchedalmond.png) | -| blue | \#0000ff | ![blue](figures/blue.png) | -| blueviolet | \#8a2be2 | ![blueviolet](figures/blueviolet.png) | -| brown | \#a52a2a | ![brown](figures/brown.png) | -| burlywood | \#deB887 | ![burlywood](figures/burlywood.png) | -| cadetblue | \#5f9ea0 | ![cadetblue](figures/cadetblue.png) | -| chartreuse | \#7fff00 | ![chartreuse](figures/chartreuse.png) | -| chocolate | \#d2691e | ![chocolate](figures/chocolate.png) | -| coral | \#ff7f50 | ![coral](figures/coral.png) | -| cornflowerblue | \#6495ed | ![cornflowerblue](figures/cornflowerblue.png) | -| cornsilk | \#fff8dc | ![cornsilk](figures/cornsilk.png) | -| crimson | \#dc143c | ![crimson](figures/crimson.png) | -| cyan | \#00ffff | ![cyan](figures/cyan.png) | -| darkblue | \#00008b | ![darkblue](figures/darkblue.png) | -| darkcyan | \#008b8b | ![darkcyan](figures/darkcyan.png) | -| darkgoldenrod | \#b8860b | ![darkgoldenrod](figures/darkgoldenrod.png) | -| darkgray | \#a9a9a9 | ![darkgray](figures/darkgray.png) | -| darkgreen | \#006400 | ![darkgreen](figures/darkgreen.png) | -| darkgrey | \#a9a9a9 | ![darkgrey](figures/darkgrey.png) | -| darkkhaki | \#bdb76b | ![darkkhaki](figures/darkkhaki.png) | -| darkmagenta | \#8b008b | ![darkmagenta](figures/darkmagenta.png) | -| darkolivegreen | \#556b2f | ![darkolivegreen](figures/darkolivegreen.png) | -| darkorange | \#ff8c00 | ![darkorange](figures/darkorange.png) | -| darkorchid | \#9932cc | ![darkorchid](figures/darkorchid.png) | -| darkred | \#8b0000 | ![darkred](figures/darkred.png) | -| darksalmon | \#e9967a | ![darksalmon](figures/darksalmon.png) | -| darkseagreen | \#8fbc8f | ![darkseagreen](figures/darkseagreen.png) | -| darkslateblue | \#483d8b | ![darkslateblue](figures/darkslateblue.png) | -| darkslategray | \#2f4f4f | ![darkslategray](figures/darkslategray.png) | -| darkslategrey | \#2f4f4f | ![darkslategrey](figures/darkslategrey.png) | -| darkturquoise | \#00ced1 | ![darkturquoise](figures/darkturquoise.png) | -| darkviolet | \#9400d3 | ![darkviolet](figures/darkviolet.png) | -| deeppink | \#ff1493 | ![deeppink](figures/deeppink.png) | -| deepskyblue | \#00bfff | ![deepskyblue](figures/deepskyblue.png) | -| dimgray | \#696969 | ![dimgray](figures/dimgray.png) | -| dimgrey | \#696969 | ![dimgrey](figures/dimgrey.png) | -| dodgerblue | \#1e90ff | ![dodgerblue](figures/dodgerblue.png) | -| firebrick | \#b22222 | ![firebrick](figures/firebrick.png) | -| floralwhite | \#fffaf0 | ![floralwhite](figures/floralwhite.png) | -| forestgreen | \#228b22 | ![forestgreen](figures/forestgreen.png) | -| fuchsia | \#ff00ff | ![fuchsia](figures/fuchsia.png) | -| gainsboro | \#dcdcdc | ![gainsboro](figures/gainsboro.png) | -| ghostwhite | \#f8f8ff | ![ghostwhite](figures/ghostwhite.png) | -| gold | \#ffd700 | ![gold](figures/gold.png) | -| goldenrod | \#daa520 | ![goldenrod](figures/goldenrod.png) | -| gray | \#808080 | ![gray](figures/gray.png) | -| green | \#008000 | ![green](figures/green.png) | -| greenyellow | \#adff2f | ![greenyellow](figures/greenyellow.png) | -| grey | \#808080 | ![grey](figures/grey.png) | -| honeydew | \#f0fff0 | ![honeydew](figures/honeydew.png) | -| hotpink | \#ff69b4 | ![hotpink](figures/hotpink.png) | -| indianred | \#cd5c5c | ![indianred](figures/indianred.png) | -| indigo | \#4b0082 | ![indigo](figures/indigo.png) | -| ivory | \#fffff0 | ![ivory](figures/ivory.png) | -| khaki | \#f0e68c | ![khaki](figures/khaki.png) | -| lavender | \#e6e6fa | ![lavender](figures/lavender.png) | -| lavenderblush | \#fff0f5 | ![lavenderblush](figures/lavenderblush.png) | -| lawngreen | \#7cfc00 | ![lawngreen](figures/lawngreen.png) | -| lemonchiffon | \#fffacd | ![lemonchiffon](figures/lemonchiffon.png) | -| lightblue | \#add8e6 | ![lightblue](figures/lightblue.png) | -| lightcoral | \#f08080 | ![lightcoral](figures/lightcoral.png) | -| lightcyan | \#e0ffff | ![lightcyan](figures/lightcyan.png) | +| Name | Hexadecimal Code | Color | +| -------------------- | -------- | ---------------------------------------- | +| aliceblue | \#f0f8ff | ![aliceblue](figures/aliceblue.png) | +| antiquewhite | \#faebd7 | ![antiquewhite](figures/antiquewhite.png) | +| aqua | \#00ffff | ![aqua](figures/aqua.png) | +| aquamarine | \#7fffd4 | ![aquamarine](figures/aquamarine.png) | +| azure | \#f0ffff | ![azure](figures/azure.png) | +| beige | \#f5f5dc | ![beige](figures/beige.png) | +| bisque | \#ffe4c4 | ![bisque](figures/bisque.png) | +| black | \#000000 | ![000000](figures/000000.png) | +| blanchedalmond | \#ffebcd | ![blanchedalmond](figures/blanchedalmond.png) | +| blue | \#0000ff | ![blue](figures/blue.png) | +| blueviolet | \#8a2be2 | ![blueviolet](figures/blueviolet.png) | +| brown | \#a52a2a | ![brown](figures/brown.png) | +| burlywood | \#deB887 | ![burlywood](figures/burlywood.png) | +| cadetblue | \#5f9ea0 | ![cadetblue](figures/cadetblue.png) | +| chartreuse | \#7fff00 | ![chartreuse](figures/chartreuse.png) | +| chocolate | \#d2691e | ![chocolate](figures/chocolate.png) | +| coral | \#ff7f50 | ![coral](figures/coral.png) | +| cornflowerblue | \#6495ed | ![cornflowerblue](figures/cornflowerblue.png) | +| cornsilk | \#fff8dc | ![cornsilk](figures/cornsilk.png) | +| crimson | \#dc143c | ![crimson](figures/crimson.png) | +| cyan | \#00ffff | ![cyan](figures/cyan.png) | +| darkblue | \#00008b | ![darkblue](figures/darkblue.png) | +| darkcyan | \#008b8b | ![darkcyan](figures/darkcyan.png) | +| darkgoldenrod | \#b8860b | ![darkgoldenrod](figures/darkgoldenrod.png) | +| darkgray | \#a9a9a9 | ![darkgray](figures/darkgray.png) | +| darkgreen | \#006400 | ![darkgreen](figures/darkgreen.png) | +| darkgrey | \#a9a9a9 | ![darkgrey](figures/darkgrey.png) | +| darkkhaki | \#bdb76b | ![darkkhaki](figures/darkkhaki.png) | +| darkmagenta | \#8b008b | ![darkmagenta](figures/darkmagenta.png) | +| darkolivegreen | \#556b2f | ![darkolivegreen](figures/darkolivegreen.png) | +| darkorange | \#ff8c00 | ![darkorange](figures/darkorange.png) | +| darkorchid | \#9932cc | ![darkorchid](figures/darkorchid.png) | +| darkred | \#8b0000 | ![darkred](figures/darkred.png) | +| darksalmon | \#e9967a | ![darksalmon](figures/darksalmon.png) | +| darkseagreen | \#8fbc8f | ![darkseagreen](figures/darkseagreen.png) | +| darkslateblue | \#483d8b | ![darkslateblue](figures/darkslateblue.png) | +| darkslategray | \#2f4f4f | ![darkslategray](figures/darkslategray.png) | +| darkslategrey | \#2f4f4f | ![darkslategrey](figures/darkslategrey.png) | +| darkturquoise | \#00ced1 | ![darkturquoise](figures/darkturquoise.png) | +| darkviolet | \#9400d3 | ![darkviolet](figures/darkviolet.png) | +| deeppink | \#ff1493 | ![deeppink](figures/deeppink.png) | +| deepskyblue | \#00bfff | ![deepskyblue](figures/deepskyblue.png) | +| dimgray | \#696969 | ![dimgray](figures/dimgray.png) | +| dimgrey | \#696969 | ![dimgrey](figures/dimgrey.png) | +| dodgerblue | \#1e90ff | ![dodgerblue](figures/dodgerblue.png) | +| firebrick | \#b22222 | ![firebrick](figures/firebrick.png) | +| floralwhite | \#fffaf0 | ![floralwhite](figures/floralwhite.png) | +| forestgreen | \#228b22 | ![forestgreen](figures/forestgreen.png) | +| fuchsia | \#ff00ff | ![fuchsia](figures/fuchsia.png) | +| gainsboro | \#dcdcdc | ![gainsboro](figures/gainsboro.png) | +| ghostwhite | \#f8f8ff | ![ghostwhite](figures/ghostwhite.png) | +| gold | \#ffd700 | ![gold](figures/gold.png) | +| goldenrod | \#daa520 | ![goldenrod](figures/goldenrod.png) | +| gray | \#808080 | ![gray](figures/gray.png) | +| green | \#008000 | ![green](figures/green.png) | +| greenyellow | \#adff2f | ![greenyellow](figures/greenyellow.png) | +| grey | \#808080 | ![grey](figures/grey.png) | +| honeydew | \#f0fff0 | ![honeydew](figures/honeydew.png) | +| hotpink | \#ff69b4 | ![hotpink](figures/hotpink.png) | +| indianred | \#cd5c5c | ![indianred](figures/indianred.png) | +| indigo | \#4b0082 | ![indigo](figures/indigo.png) | +| ivory | \#fffff0 | ![ivory](figures/ivory.png) | +| khaki | \#f0e68c | ![khaki](figures/khaki.png) | +| lavender | \#e6e6fa | ![lavender](figures/lavender.png) | +| lavenderblush | \#fff0f5 | ![lavenderblush](figures/lavenderblush.png) | +| lawngreen | \#7cfc00 | ![lawngreen](figures/lawngreen.png) | +| lemonchiffon | \#fffacd | ![lemonchiffon](figures/lemonchiffon.png) | +| lightblue | \#add8e6 | ![lightblue](figures/lightblue.png) | +| lightcoral | \#f08080 | ![lightcoral](figures/lightcoral.png) | +| lightcyan | \#e0ffff | ![lightcyan](figures/lightcyan.png) | | lightgoldenrodyellow | \#fafad2 | ![lightgoldenrodyellow](figures/lightgoldenrodyellow.png) | -| lightgray | \#d3d3d3 | ![lightgray](figures/lightgray.png) | -| lightgreen | \#90ee90 | ![lightgreen](figures/lightgreen.png) | -| lightpink | \#ffb6c1 | ![lightpink](figures/lightpink.png) | -| lightsalmon | \#ffa07a | ![lightsalmon](figures/lightsalmon.png) | -| lightseagreen | \#20b2aa | ![lightseagreen](figures/lightseagreen.png) | -| lightskyblue | \#87cefa | ![lightskyblue](figures/lightskyblue.png) | -| lightslategray | \#778899 | ![lightslategray](figures/lightslategray.png) | -| lightslategrey | \#778899 | ![lightslategrey](figures/lightslategrey.png) | -| lightsteelblue | \#b0c4de | ![lightsteelblue](figures/lightsteelblue.png) | -| lightyellow | \#ffffe0 | ![lightyellow](figures/lightyellow.png) | -| lime | \#00ff00 | ![lime](figures/lime.png) | -| limegreen | \#32cd32 | ![limegreen](figures/limegreen.png) | -| linen | \#faf0e6 | ![linen](figures/linen.png) | -| magenta | \#ff00ff | ![magenta](figures/magenta.png) | -| maroon | \#800000 | ![maroon](figures/maroon.png) | -| mediumaquamarine | \#66cdaa | ![mediumaquamarine](figures/mediumaquamarine.png) | -| mediumblue | \#0000cd | ![mediumblue](figures/mediumblue.png) | -| mediumorchid | \#ba55d3 | ![mediumorchid](figures/mediumorchid.png) | -| mediumpurple | \#9370db | ![mediumpurple](figures/mediumpurple.png) | -| mediumseagreen | \#3cb371 | ![mediumseagreen](figures/mediumseagreen.png) | -| mediumslateblue | \#7b68ee | ![mediumslateblue](figures/mediumslateblue.png) | -| mediumspringgreen | \#00fa9a | ![mediumspringgreen](figures/mediumspringgreen.png) | -| mediumturquoise | \#48d1cc | ![mediumturquoise](figures/mediumturquoise.png) | -| mediumvioletred | \#c71585 | ![mediumvioletred](figures/mediumvioletred.png) | -| midnightblue | \#191970 | ![midnightblue](figures/midnightblue.png) | -| mintcream | \#f5fffa | ![mintcream](figures/mintcream.png) | -| mistyrose | \#ffe4e1 | ![mistyrose](figures/mistyrose.png) | -| moccasin | \#ffe4b5 | ![moccasin](figures/moccasin.png) | -| navajowhite | \#ffdead | ![navajowhite](figures/navajowhite.png) | -| navy | \#000080 | ![navy](figures/navy.png) | -| oldlace | \#fdf5e6 | ![oldlace](figures/oldlace.png) | -| olive | \#808000 | ![olive](figures/olive.png) | -| olivedrab | \#6b8e23 | ![olivedrab](figures/olivedrab.png) | -| orange | \#ffa500 | ![orange](figures/orange.png) | -| orangered | \#ff4500 | ![orangered](figures/orangered.png) | -| orchid | \#da70d6 | ![orchid](figures/orchid.png) | -| palegoldenrod | \#eee8aa | ![palegoldenrod](figures/palegoldenrod.png) | -| palegreen | \#98fb98 | ![palegreen](figures/palegreen.png) | -| paleturquoise | \#afeeee | ![paleturquoise](figures/paleturquoise.png) | -| palevioletred | \#db7093 | ![palevioletred](figures/palevioletred.png) | -| papayawhip | \#ffefd5 | ![papayawhip](figures/papayawhip.png) | -| peachpuff | \#ffdab9 | ![peachpuff](figures/peachpuff.png) | -| peru | \#cd853f | ![peru](figures/peru.png) | -| pink | \#ffc0cb | ![pink](figures/pink.png) | -| plum | \#dda0dd | ![plum](figures/plum.png) | -| powderblue | \#b0e0e6 | ![powderblue](figures/powderblue.png) | -| purple | \#800080 | ![purple](figures/purple.png) | -| rebeccapurple | \#663399 | ![rebeccapurple](figures/rebeccapurple.png) | -| red | \#ff0000 | ![red](figures/red.png) | -| rosybrown | \#bc8f8f | ![rosybrown](figures/rosybrown.png) | -| royalblue | \#4169e1 | ![royalblue](figures/royalblue.png) | -| saddlebrown | \#8b4513 | ![saddlebrown](figures/saddlebrown.png) | -| salmon | \#fa8072 | ![salmon](figures/salmon.png) | -| sandybrown | \#f4a460 | ![sandybrown](figures/sandybrown.png) | -| seagreen | \#2e8b57 | ![seagreen](figures/seagreen.png) | -| seashell | \#fff5ee | ![seashell](figures/seashell.png) | -| sienna | \#a0522d | ![sienna](figures/sienna.png) | -| silver | \#c0c0c0 | ![silver](figures/silver.png) | -| skyblue | \#87ceeb | ![skyblue](figures/skyblue.png) | -| slateblue | \#6a5acd | ![slateblue](figures/slateblue.png) | -| slategray | \#708090 | ![slategray](figures/slategray.png) | -| slategrey | \#708090 | ![slategray](figures/slategray.png) | -| snow | \#fffafa | ![snow](figures/snow.png) | -| springgreen | \#00ff7f | ![springgreen](figures/springgreen.png) | -| steelblue | \#4682b4 | ![steelblue](figures/steelblue.png) | -| tan | \#d2b48c | ![tan](figures/tan.png) | -| teal | \#008080 | ![teal](figures/teal.png) | -| thistle | \#d8Bfd8 | ![thistle](figures/thistle.png) | -| tomato | \#ff6347 | ![tomato](figures/tomato.png) | -| turquoise | \#40e0d0 | ![turquoise](figures/turquoise.png) | -| violet | \#ee82ee | ![violet](figures/violet.png) | -| wheat | \#f5deb3 | ![wheat](figures/wheat.png) | -| white | \#ffffff | ![white](figures/white.png) | -| whitesmoke | \#f5f5f5 | ![whitesmoke](figures/whitesmoke.png) | -| yellow | \#ffff00 | ![yellow](figures/yellow.png) | -| yellowgreen | \#9acd32 | ![yellowgreen](figures/yellowgreen.png) | +| lightgray | \#d3d3d3 | ![lightgray](figures/lightgray.png) | +| lightgreen | \#90ee90 | ![lightgreen](figures/lightgreen.png) | +| lightpink | \#ffb6c1 | ![lightpink](figures/lightpink.png) | +| lightsalmon | \#ffa07a | ![lightsalmon](figures/lightsalmon.png) | +| lightseagreen | \#20b2aa | ![lightseagreen](figures/lightseagreen.png) | +| lightskyblue | \#87cefa | ![lightskyblue](figures/lightskyblue.png) | +| lightslategray | \#778899 | ![lightslategray](figures/lightslategray.png) | +| lightslategrey | \#778899 | ![lightslategrey](figures/lightslategrey.png) | +| lightsteelblue | \#b0c4de | ![lightsteelblue](figures/lightsteelblue.png) | +| lightyellow | \#ffffe0 | ![lightyellow](figures/lightyellow.png) | +| lime | \#00ff00 | ![lime](figures/lime.png) | +| limegreen | \#32cd32 | ![limegreen](figures/limegreen.png) | +| linen | \#faf0e6 | ![linen](figures/linen.png) | +| magenta | \#ff00ff | ![magenta](figures/magenta.png) | +| maroon | \#800000 | ![maroon](figures/maroon.png) | +| mediumaquamarine | \#66cdaa | ![mediumaquamarine](figures/mediumaquamarine.png) | +| mediumblue | \#0000cd | ![mediumblue](figures/mediumblue.png) | +| mediumorchid | \#ba55d3 | ![mediumorchid](figures/mediumorchid.png) | +| mediumpurple | \#9370db | ![mediumpurple](figures/mediumpurple.png) | +| mediumseagreen | \#3cb371 | ![mediumseagreen](figures/mediumseagreen.png) | +| mediumslateblue | \#7b68ee | ![mediumslateblue](figures/mediumslateblue.png) | +| mediumspringgreen | \#00fa9a | ![mediumspringgreen](figures/mediumspringgreen.png) | +| mediumturquoise | \#48d1cc | ![mediumturquoise](figures/mediumturquoise.png) | +| mediumvioletred | \#c71585 | ![mediumvioletred](figures/mediumvioletred.png) | +| midnightblue | \#191970 | ![midnightblue](figures/midnightblue.png) | +| mintcream | \#f5fffa | ![mintcream](figures/mintcream.png) | +| mistyrose | \#ffe4e1 | ![mistyrose](figures/mistyrose.png) | +| moccasin | \#ffe4b5 | ![moccasin](figures/moccasin.png) | +| navajowhite | \#ffdead | ![navajowhite](figures/navajowhite.png) | +| navy | \#000080 | ![navy](figures/navy.png) | +| oldlace | \#fdf5e6 | ![oldlace](figures/oldlace.png) | +| olive | \#808000 | ![olive](figures/olive.png) | +| olivedrab | \#6b8e23 | ![olivedrab](figures/olivedrab.png) | +| orange | \#ffa500 | ![orange](figures/orange.png) | +| orangered | \#ff4500 | ![orangered](figures/orangered.png) | +| orchid | \#da70d6 | ![orchid](figures/orchid.png) | +| palegoldenrod | \#eee8aa | ![palegoldenrod](figures/palegoldenrod.png) | +| palegreen | \#98fb98 | ![palegreen](figures/palegreen.png) | +| paleturquoise | \#afeeee | ![paleturquoise](figures/paleturquoise.png) | +| palevioletred | \#db7093 | ![palevioletred](figures/palevioletred.png) | +| papayawhip | \#ffefd5 | ![papayawhip](figures/papayawhip.png) | +| peachpuff | \#ffdab9 | ![peachpuff](figures/peachpuff.png) | +| peru | \#cd853f | ![peru](figures/peru.png) | +| pink | \#ffc0cb | ![pink](figures/pink.png) | +| plum | \#dda0dd | ![plum](figures/plum.png) | +| powderblue | \#b0e0e6 | ![powderblue](figures/powderblue.png) | +| purple | \#800080 | ![purple](figures/purple.png) | +| rebeccapurple | \#663399 | ![rebeccapurple](figures/rebeccapurple.png) | +| red | \#ff0000 | ![red](figures/red.png) | +| rosybrown | \#bc8f8f | ![rosybrown](figures/rosybrown.png) | +| royalblue | \#4169e1 | ![royalblue](figures/royalblue.png) | +| saddlebrown | \#8b4513 | ![saddlebrown](figures/saddlebrown.png) | +| salmon | \#fa8072 | ![salmon](figures/salmon.png) | +| sandybrown | \#f4a460 | ![sandybrown](figures/sandybrown.png) | +| seagreen | \#2e8b57 | ![seagreen](figures/seagreen.png) | +| seashell | \#fff5ee | ![seashell](figures/seashell.png) | +| sienna | \#a0522d | ![sienna](figures/sienna.png) | +| silver | \#c0c0c0 | ![silver](figures/silver.png) | +| skyblue | \#87ceeb | ![skyblue](figures/skyblue.png) | +| slateblue | \#6a5acd | ![slateblue](figures/slateblue.png) | +| slategray | \#708090 | ![slategray](figures/slategray.png) | +| slategrey | \#708090 | ![slategray](figures/slategray.png) | +| snow | \#fffafa | ![snow](figures/snow.png) | +| springgreen | \#00ff7f | ![springgreen](figures/springgreen.png) | +| steelblue | \#4682b4 | ![steelblue](figures/steelblue.png) | +| tan | \#d2b48c | ![tan](figures/tan.png) | +| teal | \#008080 | ![teal](figures/teal.png) | +| thistle | \#d8Bfd8 | ![thistle](figures/thistle.png) | +| tomato | \#ff6347 | ![tomato](figures/tomato.png) | +| turquoise | \#40e0d0 | ![turquoise](figures/turquoise.png) | +| violet | \#ee82ee | ![violet](figures/violet.png) | +| wheat | \#f5deb3 | ![wheat](figures/wheat.png) | +| white | \#ffffff | ![white](figures/white.png) | +| whitesmoke | \#f5f5f5 | ![whitesmoke](figures/whitesmoke.png) | +| yellow | \#ffff00 | ![yellow](figures/yellow.png) | +| yellowgreen | \#9acd32 | ![yellowgreen](figures/yellowgreen.png) | diff --git a/en/application-dev/reference/arkui-js-lite/js-components-basic-chart.md b/en/application-dev/reference/arkui-js-lite/js-components-basic-chart.md index 7a0a07fe1bee64329c6fe292f881856b941e6ee1..2c8f4c0550f7794d975eb7014e30506c034e9a1d 100644 --- a/en/application-dev/reference/arkui-js-lite/js-components-basic-chart.md +++ b/en/application-dev/reference/arkui-js-lite/js-components-basic-chart.md @@ -14,118 +14,118 @@ Not supported ## Attributes -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| type | string | No| Chart type. Dynamic modification is not supported. Available values include:
- **bar**: bar chart
- **line**: line chart
Default value: **line**| -| options | ChartOptions | Yes| Chart parameters. You can set the minimum value, maximum value, scale, and line width of the x-axis or y-axis, whether to display the x-axis and y-axis, and whether the line is smooth. Dynamic modification is not supported.| -| datasets | Array<ChartDataset> | Yes| Data sets. You can set multiple datasets and their background colors.| -| id | string | No| Unique ID of the component.| -| style | string | No| Style declaration of the component.| -| class | string | No| Style class of the component, which is used to refer to a style table.| -| ref | string | No| Reference information of child elements, which is registered with the parent component on **$refs**.| +| Name | Type | Mandatory | Description | +| -------- | ------------------------- | ---- | ---------------------------------------- | +| type | string | No | Chart type. Dynamic modification is not supported. Available values include:
- **bar**: bar chart
- **line**: line chart
Default value: **line**| +| options | ChartOptions | Yes | Chart parameters. You can set the minimum value, maximum value, scale, and line width of the x-axis or y-axis, whether to display the x-axis and y-axis, and whether the line is smooth. Dynamic modification is not supported.| +| datasets | Array<ChartDataset> | Yes | Data sets. You can set multiple datasets and their background colors. | +| id | string | No | Unique ID of the component. | +| style | string | No | Style declaration of the component. | +| class | string | No | Style class of the component, which is used to refer to a style table. | +| ref | string | No | Reference information of child elements, which is registered with the parent component on **$refs**.| **Table 1** ChartOptions -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| xAxis | ChartAxis | Yes| X-axis parameters. You can set the minimum value, maximum value, and scale of the x-axis, and whether to display the x-axis.| -| yAxis | ChartAxis | Yes| Y-axis parameters. You can set the minimum value, maximum value, and scale of the y-axis, and whether to display the y-axis.| -| series | ChartSeries | No| Data series parameters which cover the following:
- Line style, such as the line width and whether the line is smooth.
- Style and size of the white point at the start of the line.
**NOTE**
Only line charts support this attribute. | +| Name | Type | Mandatory | Description | +| ------ | ----------- | ---- | ---------------------------------------- | +| xAxis | ChartAxis | Yes | X-axis parameters. You can set the minimum value, maximum value, and scale of the x-axis, and whether to display the x-axis. | +| yAxis | ChartAxis | Yes | Y-axis parameters. You can set the minimum value, maximum value, and scale of the y-axis, and whether to display the y-axis. | +| series | ChartSeries | No | Data series parameters which cover the following:
- Line style, such as the line width and whether the line is smooth.
- Style and size of the white point at the start of the line.
**NOTE**
Only line charts support this attribute.| **Table 2** ChartDataset -| Name| Type| Default Value| Mandatory| Description| -| -------- | -------- | -------- | -------- | -------- | -| backgroundColor(deprecated) | <color> | \#ff6384 | No| Color of a line or bar. This attribute is not recommended.| -| strokeColor | <color> | \#ff6384 | No| Line color. Only line charts support this attribute.| -| fillColor | <color> | \#ff6384 | No| Fill color. For line charts, the value indicates the gradient color to fill.| -| data | Array<number> | - | Yes| Data of the drawn line or bar.| -| gradient | boolean | false | No| Whether to display the gradient color. Only line charts support this attribute.| +| Name | Type | Default Value | Mandatory | Description | +| --------------------------- | ------------------- | -------- | ---- | -------------------- | +| backgroundColor(deprecated) | <color> | \#ff6384 | No | Color of a line or bar. This attribute is not recommended. | +| strokeColor | <color> | \#ff6384 | No | Line color. Only line charts support this attribute. | +| fillColor | <color> | \#ff6384 | No | Fill color. For line charts, the value indicates the gradient color to fill. | +| data | Array<number> | - | Yes | Data of the drawn line or bar. | +| gradient | boolean | false | No | Whether to display the gradient color. Only line charts support this attribute.| **Table 3** ChartAxis -| Name| Type| Default Value| Mandatory| Description| -| -------- | -------- | -------- | -------- | -------- | -| min | number | 0 | No| Minimum value of the axis.
Negative numbers are not supported. Only line charts support this attribute.| -| max | number | 100 | No| Maximum value of the axis.
Negative numbers are not supported. Only line charts support this attribute.| -| axisTick | number | 10 | No| Number of scales displayed on the axis.
**NOTE**
The value ranges from 1 to 20. The display effect depends on the calculation result of Number of pixels occupied by the image width/(**max**-**min**).
Lite wearables support integer calculation, and an error may occur in the case of inexhaustible division. Specifically, a segment of space may be left at the end of the x-axis.
In the bar chart, the number of bars in each group of data is the same as the number of scales, and the bars are displayed at the scales.| -| display | boolean | false | No| Whether to display the axis.| -| color | <color> | \#c0c0c0 | No| Axis color.| +| Name | Type | Default Value | Mandatory | Description | +| -------- | ------------- | -------- | ---- | ---------------------------------------- | +| min | number | 0 | No | Minimum value of the axis.
Negative numbers are not supported. Only line charts support this attribute. | +| max | number | 100 | No | Maximum value of the axis.
Negative numbers are not supported. Only line charts support this attribute. | +| axisTick | number | 10 | No | Number of scales displayed on the axis.
**NOTE**
The value ranges from 1 to 20. The display effect depends on the calculation result of Number of pixels occupied by the image width/(**max**-**min**).
Lite wearables support integer calculation, and an error may occur in the case of inexhaustible division. Specifically, a segment of space may be left at the end of the x-axis.
In the bar chart, the number of bars in each group of data is the same as the number of scales, and the bars are displayed at the scales.| +| display | boolean | false | No | Whether to display the axis. | +| color | <color> | \#c0c0c0 | No | Axis color. | **Table 4** ChartSeries -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| lineStyle | ChartLineStyle | No| Line style, such as the line width and whether the line is smooth.| -| headPoint | PointStyle | No| Style and size of the white point at the start of the line.| -| topPoint | PointStyle | No| Style and size of the top point.| -| bottomPoint | PointStyle | No| Style and size of the bottom point.| -| loop | ChartLoop | No| Whether to start drawing again when the screen is looped.| +| Name | Type | Mandatory | Description | +| ----------- | -------------- | ---- | -------------------- | +| lineStyle | ChartLineStyle | No | Line style, such as the line width and whether the line is smooth. | +| headPoint | PointStyle | No | Style and size of the white point at the start of the line. | +| topPoint | PointStyle | No | Style and size of the top point. | +| bottomPoint | PointStyle | No | Style and size of the bottom point. | +| loop | ChartLoop | No | Whether to start drawing again when the screen is looped.| **Table 5** ChartLineStyle -| Name| Type| Default Value| Mandatory| Description| -| -------- | -------- | -------- | -------- | -------- | -| width | <length> | 1px | No| Line width.| -| smooth | boolean | false | No| Whether the line is smooth.| +| Name | Type | Default Value | Mandatory | Description | +| ------ | -------------- | ----- | ---- | ----- | +| width | <length> | 1px | No | Line width.| +| smooth | boolean | false | No | Whether the line is smooth.| **Table 6** PointStyle -| Name| Type| Default Value| Mandatory| Description| -| -------- | -------- | -------- | -------- | -------- | -| shape | string | circle | No| Shape of the highlight point. Available values are as follows:
- circle| -| size | <length> | 5px | No| Size of the highlight point.| -| strokeWidth | <length> | 1px | No| Stroke width.| -| strokeColor | <color> | \#ff0000 | No| Stroke color.| -| fillColor | <color> | \#ff0000 | No| Fill color.| -| display | boolean | true | No| Whether to display the highlight spot.| +| Name | Type | Default Value | Mandatory | Description | +| ----------- | -------------- | -------- | ---- | ---------------------------------- | +| shape | string | circle | No | Shape of the highlight point. Available values are as follows:
- circle| +| size | <length> | 5px | No | Size of the highlight point. | +| strokeWidth | <length> | 1px | No | Stroke width. | +| strokeColor | <color> | \#ff0000 | No | Stroke color. | +| fillColor | <color> | \#ff0000 | No | Fill color. | +| display | boolean | true | No | Whether to display the highlight spot. | **Table 7** ChartLoop -| Name| Type| Default Value| Mandatory| Description| -| -------- | -------- | -------- | -------- | -------- | -| margin | <length> | 1 | No| Number of erased points (horizontal distance between the latest drawn point and the earliest point). You are not advised to use **margin** together with **topPoint**, **bottomPoint**, or **headPoint** for mini-, small- and standard-system devices. If you do so, there is a possibility that the point is in the erase area and invisible.| +| Name | Type | Default Value | Mandatory | Description | +| ------ | -------------- | ---- | ---- | ---------------------------------------- | +| margin | <length> | 1 | No | Number of erased points (horizontal distance between the latest drawn point and the earliest point). You are not advised to use **margin** together with **topPoint**, **bottomPoint**, or **headPoint** for mini-, small- and standard-system devices. If you do so, there is a possibility that the point is in the erase area and invisible.| ## Methods -| Methods| Parameter| Description| -| -------- | -------- | -------- | +| Methods | Parameter | Description | +| ------ | ---------------------------------------- | ---------------------------------------- | | append | {
serial: number, // Set the data subscript of the line chart to be updated.
data: Array<number>, // Set the new data.
} | Dynamically add data to an existing data series. The target series is specified based on **serial**, which is the subscript of the datasets array and starts from 0. **datasets[index].data** is not updated. Only line charts support this attribute. The value is incremented by 1 based on the horizontal coordinate and is related to the **xAxis min/max** setting.| ## Events -| Name| Parameter| Description| -| -------- | -------- | -------- | -| click | - | Triggered when the component is clicked. | -| longpress | - | Triggered when the component is long pressed. | -| swipe5+ | [SwipeEvent](js-common-events.md) | Triggered when a user quickly swipes on the component. | +| Name | Parameter | Description | +| ------------------ | --------------------------------- | ----------- | +| click | - | Triggered when the component is clicked. | +| longpress | - | Triggered when the component is long pressed. | +| swipe5+ | [SwipeEvent](js-common-events.md) | Triggered when a user quickly swipes on the component.| ## Styles -| Name| Type| Default Value| Mandatory| Description| -| -------- | -------- | -------- | -------- | -------- | -| width | <length> \| <percentage>5+ | - | No| Component width.
If this attribute is not set, the default value **0** is used. | -| height | <length> \| <percentage>5+ | - | No| Component height.
If this attribute is not set, the default value **0** is used. | -| padding | <length> | 0 | No| Shorthand attribute to set the padding for all sides.
The attribute can have one to four values:
- If you set only one value, it specifies the padding for all the four sides.
- If you set two values, the first value specifies the top and bottom padding, and the second value specifies the left and right padding.
- If you set three values, the first value specifies the top padding, the second value specifies the left and right padding, and the third value specifies the bottom padding.
- If you set four values, they respectively specify the padding for top, right, bottom, and left sides (in clockwise order).| -| padding-[left\|top\|right\|bottom] | <length> | 0 | No| Left, top, right, and bottom padding.| -| margin | <length> \| <percentage>5+ | 0 | No| Shorthand attribute to set the margin for all sides. The attribute can have one to four values:
- If you set only one value, it specifies the margin for all the four sides.
- If you set two values, the first value specifies the top and bottom margins, and the second value specifies the left and right margins.
- If you set three values, the first value specifies the top margin, the second value specifies the left and right margins, and the third value specifies the bottom margin.
- If you set four values, they respectively specify the margin for top, right, bottom, and left sides (in clockwise order).| -| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | No| Left, top, right, and bottom margins.| -| border-width | <length> | 0 | No| Shorthand attribute to set the margin for all sides.| -| border-color | <color> | black | No| Shorthand attribute to set the color for all borders.| -| border-radius | <length> | - | No| Radius of round-corner borders. | -| background-color | <color> | - | No| Background color.| -| display | string | flex | No| How and whether to display the box containing an element. Available values are as follows:
- **flex**: flexible layout
- **none**: not rendered| -| [left\|top] | <length> \| <percentage>6+ | - | No| Edge of the element.
- **left**: left edge position of the element. This attribute defines the offset between the left edge of the margin area of a positioned element and left edge of its containing block.
- **top**: top edge position of the element. This attribute defines the offset between the top edge of a positioned element and that of a block included in the element. | +| Name | Type | Default Value | Mandatory | Description | +| ---------------------------------- | ---------------------------------------- | ----- | ---- | ---------------------------------------- | +| width | <length> \| <percentage>5+ | - | No | Component width.

If this attribute is not set, the default value **0** is used. | +| height | <length> \| <percentage>5+ | - | No | Component height.

If this attribute is not set, the default value **0** is used. | +| padding | <length> | 0 | No | Shorthand attribute to set the padding for all sides.
The attribute can have one to four values:
- If you set only one value, it specifies the padding for all the four sides.
- If you set two values, the first value specifies the top and bottom padding, and the second value specifies the left and right padding.
- If you set three values, the first value specifies the top padding, the second value specifies the left and right padding, and the third value specifies the bottom padding.
- If you set four values, they respectively specify the padding for top, right, bottom, and left sides (in clockwise order).| +| padding-[left\|top\|right\|bottom] | <length> | 0 | No | Left, top, right, and bottom padding. | +| margin | <length> \| <percentage>5+ | 0 | No | Shorthand attribute to set the margin for all sides. The attribute can have one to four values:
- If you set only one value, it specifies the margin for all the four sides.
- If you set two values, the first value specifies the top and bottom margins, and the second value specifies the left and right margins.
- If you set three values, the first value specifies the top margin, the second value specifies the left and right margins, and the third value specifies the bottom margin.
- If you set four values, they respectively specify the margin for top, right, bottom, and left sides (in clockwise order).| +| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | No | Left, top, right, and bottom margins. | +| border-width | <length> | 0 | No | Shorthand attribute to set the margin for all sides. | +| border-color | <color> | black | No | Shorthand attribute to set the color for all borders. | +| border-radius | <length> | - | No | Radius of round-corner borders. | +| background-color | <color> | - | No | Background color. | +| display | string | flex | No | How and whether to display the box containing an element. Available values are as follows:
- **flex**: flexible layout
- **none**: not rendered| +| [left\|top] | <length> \| <percentage>6+ | - | No | Edge of the element.
- **left**: left edge position of the element. This attribute defines the offset between the left edge of the margin area of a positioned element and left edge of its containing block.
- **top**: top edge position of the element. This attribute defines the offset between the top edge of a positioned element and that of a block included in the element.| ## Example 1. Line chart - + ```html
@@ -134,7 +134,7 @@ Not supported
``` - + ```css /* xxx.css */ .container { @@ -155,7 +155,7 @@ Not supported } ``` - + ```js // xxx.js export default { @@ -211,7 +211,7 @@ Not supported ![lite_line](figures/lite_line.PNG) 2. Bar chart - + ```html
@@ -219,7 +219,7 @@ Not supported
``` - + ```css /* xxx.css */ .container { @@ -236,7 +236,7 @@ Not supported } ``` - + ```js // xxx.js export default { diff --git a/en/application-dev/reference/arkui-js-lite/js-components-basic-image-animator.md b/en/application-dev/reference/arkui-js-lite/js-components-basic-image-animator.md index 97383611f9b1228304aa47ebe97a5d0610f18ee8..226eff9f6c284140b5c671d2135dbe212b609590 100644 --- a/en/application-dev/reference/arkui-js-lite/js-components-basic-image-animator.md +++ b/en/application-dev/reference/arkui-js-lite/js-components-basic-image-animator.md @@ -14,68 +14,68 @@ Not supported ## Attributes -| Name| Type| Default Value| Mandatory| Description| -| -------- | -------- | -------- | -------- | -------- | -| images | Array<ImageFrame> | - | Yes| Image frame information. The frame information includes the image path, size, and location. The supported image formats include PNG, JPG, and BMP. For details about **ImageFrame**, see Table 1.
**NOTE**
Use data binding, for example, **images = {{images}}**, to specify the image. Declare the corresponding variable in the JavaScript: **images: [{src: "/common/heart-rate01.png"}, {src: "/common/heart-rate02.png"}]**. | -| iteration | number \| string | infinite | No| Number of times that the frame animation is played. **number** indicates a fixed number of playback operations, and **infinite** indicates an unlimited number of playback operations.| -| reverse | boolean | false | No| Playback sequence.
- **true**: Images are played from the last one to the first one.
- **false**: Images are played from the first one to the last one. | -| fixedsize | boolean | true | No| Whether the image size is the same as the component size.
- **true**: The image size is the same as the component size. In this case, the width, height, top, and left attributes of the image are invalid.
- **false**: The image size is different from the component size. In this case, the width, height, top, and left attributes of each image must be set separately. | -| duration | string | - | Yes| Single video playback duration, in seconds (s) or milliseconds (ms). The default unit is ms. If the value is **0**, no image is played. The value change takes effect only at the start of the next cycle. | -| fillmode5+ | string | forwards | No| Status of the frame animation after its playback is complete. Available values are as follows:
- **none**: restores to the initial status.
- **forwards**: retains the ending status defined for the last key frame.| -| id | string | - | No| Unique ID of the component.| -| style | string | - | No| Style declaration of the component.| -| class | string | - | No| Style class of the component, which is used to refer to a style table.| -| ref | string | - | No| Reference information of child elements, which is registered with the parent component on **$refs**.| +| Name | Type | Default Value | Mandatory | Description | +| --------------------- | -------------------------- | -------- | ---- | ---------------------------------------- | +| images | Array<ImageFrame> | - | Yes | Image frame information. The frame information includes the image path, size, and location. The supported image formats include PNG, JPG, and BMP. For details about **ImageFrame**, see Table 1.
**NOTE**
Use data binding, for example, **images = {{images}}**, to specify the image. Declare the corresponding variable in the JavaScript: **images: [{src: "/common/heart-rate01.png"}, {src: "/common/heart-rate02.png"}]**.| +| iteration | number \| string | infinite | No | Number of times that the frame animation is played. **number** indicates a fixed number of playback operations, and **infinite** indicates an unlimited number of playback operations.| +| reverse | boolean | false | No | Playback sequence.
- **true**: Images are played from the last one to the first one.
- **false**: Images are played from the first one to the last one.| +| fixedsize | boolean | true | No | Whether the image size is the same as the component size.
- **true**: The image size is the same as the component size. In this case, the width, height, top, and left attributes of the image are invalid.
- **false**: The image size is different from the component size. In this case, the width, height, top, and left attributes of each image must be set separately.| +| duration | string | - | Yes | Single video playback duration, in seconds (s) or milliseconds (ms). The default unit is ms. If the value is **0**, no image is played. The value change takes effect only at the start of the next cycle.| +| fillmode5+ | string | forwards | No | Status of the frame animation after its playback is complete. Available values are as follows:
- **none**: restores to the initial status.
- **forwards**: retains the ending status defined for the last key frame.| +| id | string | - | No | Unique ID of the component. | +| style | string | - | No | Style declaration of the component. | +| class | string | - | No | Style class of the component, which is used to refer to a style table. | +| ref | string | - | No | Reference information of child elements, which is registered with the parent component on **$refs**.| **Table 1** ImageFrame -| Name| Type| Default Value| Mandatory| Description| -| -------- | -------- | -------- | -------- | -------- | -| src | <uri> | - | Yes| Image path.| -| width | <length> | 0 | No| Image width.| -| height | <length> | 0 | No| Image height.| -| top | <length> | 0 | No| Vertical coordinate of the image relative to the upper left corner of the component.| -| left | <length> | 0 | No| Horizontal coordinate of the image relative to the upper left corner of the component.| +| Name | Type | Default Value | Mandatory | Description | +| ------ | -------------- | ---- | ---- | ---------------- | +| src | <uri> | - | Yes | Image path. | +| width | <length> | 0 | No | Image width. | +| height | <length> | 0 | No | Image height. | +| top | <length> | 0 | No | Vertical coordinate of the image relative to the upper left corner of the component.| +| left | <length> | 0 | No | Horizontal coordinate of the image relative to the upper left corner of the component.| ## Events -| Name| Parameter| Description| -| -------- | -------- | -------- | -| stop | - | Triggered when the frame animation stops| -| click | - | Triggered when the component is clicked. | -| longpress | - | Triggered when the component is long pressed. | -| swipe5+ | [SwipeEvent](js-common-events.md) | Triggered when a user quickly swipes on the component. | +| Name | Parameter | Description | +| ------------------ | --------------------------------- | ----------- | +| stop | - | Triggered when the frame animation stops | +| click | - | Triggered when the component is clicked. | +| longpress | - | Triggered when the component is long pressed. | +| swipe5+ | [SwipeEvent](js-common-events.md) | Triggered when a user quickly swipes on the component.| ## Styles -| Name| Type| Default Value| Mandatory| Description| -| -------- | -------- | -------- | -------- | -------- | -| width | <length> \| <percentage>5+ | - | No| Component width.

If this attribute is not set, the default value **0** is used.| -| height | <length> \| <percentage>5+ | - | No| Component height.

If this attribute is not set, the default value **0** is used.| -| padding | <length> | 0 | No| Shorthand attribute to set the padding for all sides.
The attribute can have one to four values:
- If you set only one value, it specifies the padding for all the four sides.
- If you set two values, the first value specifies the top and bottom padding, and the second value specifies the left and right padding.
- If you set three values, the first value specifies the top padding, the second value specifies the left and right padding, and the third value specifies the bottom padding.
- If you set four values, they respectively specify the padding for top, right, bottom, and left sides (in clockwise order).| -| padding-[left\|top\|right\|bottom] | <length> | 0 | No| Left, top, right, and bottom padding.| -| margin | <length> \| <percentage>5+ | 0 | No| Shorthand attribute to set the margin for all sides. The attribute can have one to four values:
- If you set only one value, it specifies the margin for all the four sides.
- If you set two values, the first value specifies the top and bottom margins, and the second value specifies the left and right margins.
- If you set three values, the first value specifies the top margin, the second value specifies the left and right margins, and the third value specifies the bottom margin.
- If you set four values, they respectively specify the margin for top, right, bottom, and left sides (in clockwise order).| -| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | No| Left, top, right, and bottom margins.| -| border-width | <length> | 0 | No| Shorthand attribute to set the margin for all sides.| -| border-color | <color> | black | No| Shorthand attribute to set the color for all borders.| -| border-radius | <length> | - | No| Radius of round-corner borders.| -| background-color | <color> | - | No| Background color.| -| opacity5+ | number | 1 | No| Opacity of an element. The value ranges from **0** to **1**. The value **1** means opaque, and **0** means completely transparent.| -| display | string | flex | No| How and whether to display the box containing an element. Available values are as follows:
- **flex**: flexible layout
- **none**: not rendered| -| [left\|top] | <length> \| <percentage>6+ | - | No| left\|Edge of the element.
- **left**: left edge position of the element. This attribute defines the offset between the left edge of the margin area of a positioned element and left edge of its containing block.
- **top**: top edge position of the element. This attribute defines the offset between the top edge of a positioned element and that of a block included in the element.| +| Name | Type | Default Value | Mandatory | Description | +| ---------------------------------- | ---------------------------------------- | ----- | ---- | ---------------------------------------- | +| width | <length> \| <percentage>5+ | - | No | Component width.

If this attribute is not set, the default value **0** is used. | +| height | <length> \| <percentage>5+ | - | No | Component height.

If this attribute is not set, the default value **0** is used. | +| padding | <length> | 0 | No | Shorthand attribute to set the padding for all sides.
The attribute can have one to four values:
- If you set only one value, it specifies the padding for all the four sides.
- If you set two values, the first value specifies the top and bottom padding, and the second value specifies the left and right padding.
- If you set three values, the first value specifies the top padding, the second value specifies the left and right padding, and the third value specifies the bottom padding.
- If you set four values, they respectively specify the padding for top, right, bottom, and left sides (in clockwise order).| +| padding-[left\|top\|right\|bottom] | <length> | 0 | No | Left, top, right, and bottom padding. | +| margin | <length> \| <percentage>5+ | 0 | No | Shorthand attribute to set the margin for all sides. The attribute can have one to four values:
- If you set only one value, it specifies the margin for all the four sides.
- If you set two values, the first value specifies the top and bottom margins, and the second value specifies the left and right margins.
- If you set three values, the first value specifies the top margin, the second value specifies the left and right margins, and the third value specifies the bottom margin.
- If you set four values, they respectively specify the margin for top, right, bottom, and left sides (in clockwise order).| +| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | No | Left, top, right, and bottom margins. | +| border-width | <length> | 0 | No | Shorthand attribute to set the margin for all sides. | +| border-color | <color> | black | No | Shorthand attribute to set the color for all borders. | +| border-radius | <length> | - | No | Radius of round-corner borders. | +| background-color | <color> | - | No | Background color. | +| opacity5+ | number | 1 | No | Opacity of an element. The value ranges from **0** to **1**. The value **1** means opaque, and **0** means completely transparent. | +| display | string | flex | No | How and whether to display the box containing an element. Available values are as follows:
- **flex**: flexible layout
- **none**: not rendered| +| [left\|top] | <length> \| <percentage>6+ | - | No | left\|Edge of the element.
- **left**: left edge position of the element. This attribute defines the offset between the left edge of the margin area of a positioned element and left edge of its containing block.
- **top**: top edge position of the element. This attribute defines the offset between the top edge of a positioned element and that of a block included in the element.| ## Methods -| Name| Parameter| Description| -| -------- | -------- | -------- | -| start | - | Starts to play the frame animation of an image. If this method is called again, the playback starts from the first frame.| -| pause | - | Pauses the frame animation playback of an image.| -| stop | - | Stops the frame animation playback of an image.| -| resume | - | Resumes the frame animation playback of an image.| -| getState | - | Obtains the playback state. Available values are as follows:
- playing
- paused
- stopped| +| Name | Parameter | Description | +| -------- | ---- | ---------------------------------------- | +| start | - | Starts to play the frame animation of an image. If this method is called again, the playback starts from the first frame. | +| pause | - | Pauses the frame animation playback of an image. | +| stop | - | Stops the frame animation playback of an image. | +| resume | - | Resumes the frame animation playback of an image. | +| getState | - | Obtains the playback state. Available values are as follows:
- playing
- paused
- stopped| ## Example diff --git a/en/application-dev/reference/arkui-js-lite/js-components-basic-slider.md b/en/application-dev/reference/arkui-js-lite/js-components-basic-slider.md index 8e69b18afe816c1691743976bf7ab72c2b124a36..14a1804c4b47d769b5020fb820ac768a3f434316 100644 --- a/en/application-dev/reference/arkui-js-lite/js-components-basic-slider.md +++ b/en/application-dev/reference/arkui-js-lite/js-components-basic-slider.md @@ -14,52 +14,52 @@ Not supported ## Attributes -| Name| Type| Default Value| Mandatory| Description| -| -------- | -------- | -------- | -------- | -------- | -| min | number | 0 | No| Minimum value of the slider.| -| max | number | 100 | No| Maximum value of the slider.| -| value | number | 0 | No| Initial value of the slider.| -| id | string | - | No| Unique ID of the component.| -| style | string | - | No| Style declaration of the component.| -| class | string | - | No| Style class of the component, which is used to refer to a style table.| -| ref | string | - | No| Reference information of child elements, which is registered with the parent component on **$refs**.| +| Name | Type | Default Value | Mandatory | Description | +| ----- | ------ | ---- | ---- | ---------------------------------------- | +| min | number | 0 | No | Minimum value of the slider. | +| max | number | 100 | No | Maximum value of the slider. | +| value | number | 0 | No | Initial value of the slider. | +| id | string | - | No | Unique ID of the component. | +| style | string | - | No | Style declaration of the component. | +| class | string | - | No | Style class of the component, which is used to refer to a style table. | +| ref | string | - | No | Reference information of child elements, which is registered with the parent component on **$refs**.| ## Events -| Name| Parameter| Description| -| -------- | -------- | -------- | -| change | ChangeEvent | Triggered when the value changes.| -| click | - | Triggered when the component is clicked. | -| longpress | - | Triggered when the component is long pressed. | -| swipe5+ | [SwipeEvent](js-common-events.md) | Triggered when a user quickly swipes on the component. | +| Name | Parameter | Description | +| ------------------ | --------------------------------- | -------------- | +| change | ChangeEvent | Triggered when the value changes.| +| click | - | Triggered when the component is clicked. | +| longpress | - | Triggered when the component is long pressed. | +| swipe5+ | [SwipeEvent](js-common-events.md) | Triggered when a user quickly swipes on the component. | - **Table 2** ChangeEvent + **Table 1** ChangeEvent -| Attribute| Type| Description| -| -------- | -------- | -------- | +| Attribute | Type | Description | +| ---------------------------------------- | ------ | ------------- | | progress(deprecated5+) | string | Current value of the slider.| -| value5+ | number | Current value of the slider.| +| value5+ | number | Current value of the slider.| ## Styles -| Name| Type| Default Value| Mandatory| Description| -| -------- | -------- | -------- | -------- | -------- | -| color | <color> | \#000000 | No| Background color of the slider.| -| selected-color | <color> | \#ffffff | No| Selected color of the slider.| -| width | <length> \| <percentage>5+ | - | No| Component width.
If this attribute is not set, the default value **0** is used. | -| height | <length> \| <percentage>5+ | - | No| Component height.
If this attribute is not set, the default value **0** is used. | -| padding | <length> | 0 | No| Shorthand attribute to set the padding for all sides.
The attribute can have one to four values:
- If you set only one value, it specifies the padding for all the four sides.
- If you set two values, the first value specifies the top and bottom padding, and the second value specifies the left and right padding.
- If you set three values, the first value specifies the top padding, the second value specifies the left and right padding, and the third value specifies the bottom padding.
- If you set four values, they respectively specify the padding for top, right, bottom, and left sides (in clockwise order).| -| padding-[left\|top\|right\|bottom] | <length> | 0 | No| Left, top, right, and bottom padding.| -| margin | <length> \| <percentage>5+ | 0 | No| Shorthand attribute to set the margin for all sides. The attribute can have one to four values:
- If you set only one value, it specifies the margin for all the four sides.
- If you set two values, the first value specifies the top and bottom margins, and the second value specifies the left and right margins.
- If you set three values, the first value specifies the top margin, the second value specifies the left and right margins, and the third value specifies the bottom margin.
- If you set four values, they respectively specify the margin for top, right, bottom, and left sides (in clockwise order).| -| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | No| Left, top, right, and bottom margins.| -| border-width | <length> | 0 | No| Shorthand attribute to set the margin for all sides.| -| border-color | <color> | black | No| Shorthand attribute to set the color for all borders.| -| border-radius | <length> | - | No| Radius of round-corner borders.| -| background-color | <color> | - | No| Background color.| -| display | string | flex | No| How and whether to display the box containing an element. Available values are as follows:
- **flex**: flexible layout
- **none**: not rendered| -| [left\|top] | <length> \| <percentage>6+ | - | No| Edge of the element.
- **left**: left edge position of the element. This attribute defines the offset between the left edge of the margin area of a positioned element and left edge of its containing block.
- **top**: top edge position of the element. This attribute defines the offset between the top edge of a positioned element and that of a block included in the element. | +| Name | Type | Default Value | Mandatory | Description | +| ---------------------------------- | ---------------------------------------- | -------- | ---- | ---------------------------------------- | +| color | <color> | \#000000 | No | Background color of the slider. | +| selected-color | <color> | \#ffffff | No | Selected color of the slider. | +| width | <length> \| <percentage>5+ | - | No | Component width.
If this attribute is not set, the default value **0** is used. | +| height | <length> \| <percentage>5+ | - | No | Component height.
If this attribute is not set, the default value **0** is used. | +| padding | <length> | 0 | No | Shorthand attribute to set the padding for all sides.
The attribute can have one to four values:
- If you set only one value, it specifies the padding for all the four sides.
- If you set two values, the first value specifies the top and bottom padding, and the second value specifies the left and right padding.
- If you set three values, the first value specifies the top padding, the second value specifies the left and right padding, and the third value specifies the bottom padding.
- If you set four values, they respectively specify the padding for top, right, bottom, and left sides (in clockwise order).| +| padding-[left\|top\|right\|bottom] | <length> | 0 | No | Left, top, right, and bottom padding. | +| margin | <length> \| <percentage>5+ | 0 | No | Shorthand attribute to set the margin for all sides. The attribute can have one to four values:
- If you set only one value, it specifies the margin for all the four sides.
- If you set two values, the first value specifies the top and bottom margins, and the second value specifies the left and right margins.
- If you set three values, the first value specifies the top margin, the second value specifies the left and right margins, and the third value specifies the bottom margin.
- If you set four values, they respectively specify the margin for top, right, bottom, and left sides (in clockwise order).| +| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | No | Left, top, right, and bottom margins. | +| border-width | <length> | 0 | No | Shorthand attribute to set the margin for all sides. | +| border-color | <color> | black | No | Shorthand attribute to set the color for all borders. | +| border-radius | <length> | - | No | Radius of round-corner borders. | +| background-color | <color> | - | No | Background color. | +| display | string | flex | No | How and whether to display the box containing an element. Available values are as follows:
- **flex**: flexible layout
- **none**: not rendered| +| [left\|top] | <length> \| <percentage>6+ | - | No | Edge of the element.
- **left**: left edge position of the element. This attribute defines the offset between the left edge of the margin area of a positioned element and left edge of its containing block.
- **top**: top edge position of the element. This attribute defines the offset between the top edge of a positioned element and that of a block included in the element.| ## Example diff --git a/en/application-dev/reference/arkui-js-lite/js-components-common-animation.md b/en/application-dev/reference/arkui-js-lite/js-components-common-animation.md index 8533e8dd7830abc31d5bd362ed115b083161fb69..ef2c39dc69ef2779e3e70c8ca61ff713f726e3d9 100644 --- a/en/application-dev/reference/arkui-js-lite/js-components-common-animation.md +++ b/en/application-dev/reference/arkui-js-lite/js-components-common-animation.md @@ -4,44 +4,44 @@ Components support dynamic rotation, translation, and scaling effects. These effects can be set in the **style** attribute or **.css** files. -| Name| Type| Default Value| Description| -| -------- | -------- | -------- | -------- | -| transform | string | - | Translation, rotation, and scaling attributes. For details, see Table 1. | -| animation-name | string | - | @keyframes rule. For details, see Table 2. | -| animation-delay | <time> | 0 | Delay for playing the animation, in ms or s, for example, **1000 ms** or **1s**. The default unit is ms. | -| animation-duration | <time> | 0 | Animation duration, in ms or s, for example, **1000 ms** or **1s**. The default unit is ms.
**NOTE**
**animation-duration** must be specified. Otherwise, the duration is **0**, which means the animation will not be played. | -| animation-iteration-count | number \| infinite | 1 | Number of times that an animation is played. The animation is played once by default. You can set the value to **infinite** to play the animation infinitely.| -| animation-timing-function | string |
linear | Speed curve of an animation, which makes the animation more fluent.
- **linear**: The animation speed keeps unchanged.
- **ease-in**: The animation starts at a low speed. The cubic-bezier curve (0.42, 0.0, 1.0, 1.0) is used
- **ease-out**: The animation ends at a low speed. The cubic-bezier curve (0.0, 0.0, 0.58, 1.0) is used.
- **ease-in-out**: The animation starts and ends at a low speed. The cubic-bezier curve (0.42, 0.0, 0.58, 1.0) is used. | -| animation-fill-mode | string | none | Start and end styles of the animation.
- **none**: No style is applied to the target before or after the animation is executed.
- **forwards**: The target keeps the state at the end of the animation (defined in the last key frame) after the animation is executed.| +| Name | Type | Default Value | Description | +| ------------------------- | ---------------------------------- | ----------- | ---------------------------------------- | +| transform | string | - | Translation, rotation, and scaling attributes. For details, see Table 1. | +| animation-name | string | - | \@keyframes rule. For details, see Table 2. | +| animation-delay | <time> | 0 | Delay for playing the animation, in ms or s, for example, **1000 ms** or **1s**. \|The default unit is ms.| +| animation-duration | <time> | 0 | Animation duration, in ms or s, for example, **1000 ms** or **1s**. \|The default unit is ms.
**NOTE**
**animation-duration** must be specified. Otherwise, the duration is **0**, which means the animation will not be played.| +| animation-iteration-count | number \| infinite | 1 | Number of times that an animation is played. The animation is played once by default. You can set the value to **infinite** to play the animation infinitely. | +| animation-timing-function | string |
linear | Speed curve of an animation, which makes the animation more fluent.
Available values are as follows:
- **linear**: The animation speed keeps unchanged.
- **ease-in**: The animation starts at a low speed. The cubic-bezier curve (0.42, 0.0, 1.0, 1.0) is used
- **ease-out**: The animation ends at a low speed. The cubic-bezier curve (0.0, 0.0, 0.58, 1.0) is used.
- **ease-in-out**: The animation starts and ends at a low speed. The cubic-bezier curve (0.42, 0.0, 0.58, 1.0) is used.| +| animation-fill-mode | string | none | Start and end styles of the animation.
- **none**: No style is applied to the target before or after the animation is executed.
- **forwards**: The target keeps the state at the end of the animation (defined in the last key frame) after the animation is executed.| **Table 1** transform -| Name| Type| Description| -| -------- | -------- | -------- | -| translateX | <length> | Moves an element along the x-axis.| -| translateY | <length> | Moves an element along the y-axis.| -| rotate | <deg> \| <rad> | Rotates an element.| +| Name | Type | Description | +| ---------- | ------------------------------------ | ---------- | +| translateX | <length> | Moves an element along the x-axis.| +| translateY | <length> | Moves an element along the y-axis.| +| rotate | <deg> \| <rad> | Rotates an element. | > **NOTE** > > Only images of the original size can be rotated on lite wearables. - **Table 2** @keyframes + **Table 2** \@keyframes -| Name| Type| Default Value| Description| -| -------- | -------- | -------- | -------- | -| background-color | <color> | - | Background color applied to the component after the animation is played.| -| width | <length> | - | Width value applied to the component after the animation is played.| -| height | <length> | - | Height value applied to the component after the animation is played.| -| transform | string | - | Transformation type applied to a component. For details, see Table 1.| +| Name | Type | Default Value | Description | +| ---------------- | -------------- | ---- | ------------------ | +| background-color | <color> | - | Background color applied to the component after the animation is played. | +| width | <length> | - | Width value applied to the component after the animation is played. | +| height | <length> | - | Height value applied to the component after the animation is played. | +| transform | string | - | Transformation type applied to a component. For details, see Table 1.| If there is no default value for when an animation will start or end, use **from** and **to** to specify the start and end of the display. The following is an example: -``` +```css @keyframes Go { from { diff --git a/en/application-dev/reference/arkui-js-lite/js-components-common-mediaquery.md b/en/application-dev/reference/arkui-js-lite/js-components-common-mediaquery.md index c01a9c145991b2cf4eabc971d718cb8132c9ee97..43a11aa1f7a691186eb436a19383913f0471ffa5 100644 --- a/en/application-dev/reference/arkui-js-lite/js-components-common-mediaquery.md +++ b/en/application-dev/reference/arkui-js-lite/js-components-common-mediaquery.md @@ -45,8 +45,8 @@ You can use media logical operators to implement complex media query. The follow **Table 1** Media logical operators -| Type | Description | -| --------------- | ------------------------------------------------------------ | +| Type | Description | +| --------------- | ---------------------------------------- | | and | The **and** operator is used to combine multiple media features into one media query, in a logical AND operation. The query is valid only when all media features are true. It can also combine media types and media functions.
For example, **screen and (device-type: liteWearable) and (max-height: 454)** evaluates to **true** when the device type is wearable and the maximum height of the application is 454 pixel units.| | or9+ | The **or** operator is used to combine multiple media features into one media query, in a logical OR operation. The query is valid if a media feature is true.
For example, **screen and (max-height: 454) or (round-screen: true)** evaluates to **true** when the maximum height of the application is 454 pixel units or the device screen is round.| @@ -55,18 +55,18 @@ You can use media logical operators to implement complex media query. The follow ## Media Features -| Type | Description | -| ---------------- | ------------------------------------------------------------ | -| height | Height of the display area on the application page. | -| min-height | Minimum height of the display area on the application page. | -| max-height | Maximum height of the display area on the application page. | -| width | Width of the display area on the application page. | -| min-width | Minimum width of the display area on the application page. | -| max-width | Maximum width of the display area on the application page. | +| Type | Description | +| ---------------- | ---------------------------------------- | +| height | Height of the display area on the application page. | +| min-height | Minimum height of the display area on the application page. | +| max-height | Maximum height of the display area on the application page. | +| width | Width of the display area on the application page. | +| min-width | Minimum width of the display area on the application page. | +| max-width | Maximum width of the display area on the application page. | | aspect-ratio | Ratio of the width to the height of the display area on the application page.
Example: **aspect-ratio: 1/2**| | min-aspect-ratio | Minimum ratio of the width to the height of the display area on the application page. | | max-aspect-ratio | Maximum ratio of the width to the height of the display area on the application page. | -| round-screen | Screen type. The value **true** means that the screen is round, and **false** means the opposite. | +| round-screen | Screen type. The value **true** means that the screen is round, and **false** means the opposite.| ## Sample Code for the Common Media Feature diff --git a/en/application-dev/reference/arkui-js-lite/js-components-container-stack.md b/en/application-dev/reference/arkui-js-lite/js-components-container-stack.md index 2ce76b90cf9ad62ad1b95c0e08af46ee79d7d096..c099a46be788de55f5832bc94614c569ba2b0bad 100644 --- a/en/application-dev/reference/arkui-js-lite/js-components-container-stack.md +++ b/en/application-dev/reference/arkui-js-lite/js-components-container-stack.md @@ -9,47 +9,47 @@ The **\** component provides a stack container where child components are ## Child Components -Supported +Supported. ## Attributes -| Name| Type| Default Value| Mandatory| Description| -| -------- | -------- | -------- | -------- | -------- | -| id | string | - | No| Unique ID of the component.| -| style | string | - | No| Style declaration of the component.| -| class | string | - | No| Style class of the component, which is used to refer to a style table.| -| ref | string | - | No| Reference information of child elements, which is registered with the parent component on **$refs**.| +| Name | Type | Default Value | Mandatory | Description | +| ----- | ------ | ---- | ---- | ---------------------------------------- | +| id | string | - | No | Unique ID of the component. | +| style | string | - | No | Style declaration of the component. | +| class | string | - | No | Style class of the component, which is used to refer to a style table. | +| ref | string | - | No | Reference information of child elements, which is registered with the parent component on **$refs**.| ## Events -| Name| Parameter| Description| -| -------- | -------- | -------- | -| click | - | Triggered when the component is clicked.| -| longpress | - | Triggered when the component is long pressed.| +| Name | Parameter | Description | +| ------------------ | --------------------------------- | ----------- | +| click | - | Triggered when the component is clicked. | +| longpress | - | Triggered when the component is long pressed. | | swipe5+ | [SwipeEvent](js-common-events.md) | Triggered when a user quickly swipes on the component.| ## Styles -| Name| Type| Default Value| Mandatory| Description| -| -------- | -------- | -------- | -------- | -------- | -| width | <length> \| <percentage>5+ | - | No| Component width.
If this attribute is not set, the default value **0** is used. | -| height | <length> \| <percentage>5+ | - | No| Component height.
If this attribute is not set, the default value **0** is used. | -| padding | <length> | 0 | No| Shorthand attribute to set the padding for all sides.
The attribute can have one to four values:
- If you set only one value, it specifies the padding for all the four sides.
- If you set two values, the first value specifies the top and bottom padding, and the second value specifies the left and right padding.
- If you set three values, the first value specifies the top padding, the second value specifies the left and right padding, and the third value specifies the bottom padding.
- If you set four values, they respectively specify the padding for top, right, bottom, and left sides (in clockwise order).| -| padding-[left\|top\|right\|bottom] | <length> | 0 | No| Left, top, right, and bottom padding.| -| margin | <length> \| <percentage>5+ | 0 | No| Shorthand attribute to set the margin for all sides. The attribute can have one to four values:
- If you set only one value, it specifies the margin for all the four sides.
- If you set two values, the first value specifies the top and bottom margins, and the second value specifies the left and right margins.
- If you set three values, the first value specifies the top margin, the second value specifies the left and right margins, and the third value specifies the bottom margin.
- If you set four values, they respectively specify the margin for top, right, bottom, and left sides (in clockwise order).| -| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | No| Left, top, right, and bottom margins.| -| border-width | <length> | 0 | No| Shorthand attribute to set the margin for all sides.| -| border-color | <color> | black | No| Shorthand attribute to set the color for all borders.| -| border-radius | <length> | - | No| Radius of round-corner borders.| -| background-color | <color> | - | No| Background color.| -| opacity5+ | number | 1 | No| Opacity of an element. The value ranges from **0** to **1**. The value **1** means opaque, and **0** means completely transparent.| -| display | string | flex | No| How and whether to display the box containing an element. Available values are as follows:
- **flex**: flexible layout
- **none**: not rendered| -| [left\|top] | <length> \| <percentage>6+ | - | No| Edge of the element.
- **left**: left edge position of the element. This attribute defines the offset between the left edge of the margin area of a positioned element and left edge of its containing block.
- **top**: top edge position of the element. This attribute defines the offset between the top edge of a positioned element and that of a block included in the element. | - -> **NOTE** +| Name | Type | Default Value | Mandatory | Description | +| ---------------------------------- | ---------------------------------------- | ----- | ---- | ---------------------------------------- | +| width | <length> \| <percentage>5+ | - | No | Component width.

If this attribute is not set, the default value **0** is used. | +| height | <length> \| <percentage>5+ | - | No | Component height.

If this attribute is not set, the default value **0** is used. | +| padding | <length> | 0 | No | Shorthand attribute to set the padding for all sides.
The attribute can have one to four values:
- If you set only one value, it specifies the padding for all the four sides.
- If you set two values, the first value specifies the top and bottom padding, and the second value specifies the left and right padding.
- If you set three values, the first value specifies the top padding, the second value specifies the left and right padding, and the third value specifies the bottom padding.
- If you set four values, they respectively specify the padding for top, right, bottom, and left sides (in clockwise order).| +| padding-[left\|top\|right\|bottom] | <length> | 0 | No | Left, top, right, and bottom padding. | +| margin | <length> \| <percentage>5+ | 0 | No | Shorthand attribute to set the margin for all sides. The attribute can have one to four values:
- If you set only one value, it specifies the margin for all the four sides.
- If you set two values, the first value specifies the top and bottom margins, and the second value specifies the left and right margins.
- If you set three values, the first value specifies the top margin, the second value specifies the left and right margins, and the third value specifies the bottom margin.
- If you set four values, they respectively specify the margin for top, right, bottom, and left sides (in clockwise order).| +| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | No | Left, top, right, and bottom margins. | +| border-width | <length> | 0 | No | Shorthand attribute to set the margin for all sides. | +| border-color | <color> | black | No | Shorthand attribute to set the color for all borders. | +| border-radius | <length> | - | No | Radius of round-corner borders. | +| background-color | <color> | - | No | Background color. | +| opacity5+ | number | 1 | No | Opacity of an element. The value ranges from **0** to **1**. The value **1** means opaque, and **0** means completely transparent. | +| display | string | flex | No | How and whether to display the box containing an element. Available values are as follows:
- **flex**: flexible layout
- **none**: not rendered| +| [left\|top] | <length> \| <percentage>6+ | - | No | Edge of the element.
- **left**: left edge position of the element. This attribute defines the offset between the left edge of the margin area of a positioned element and left edge of its containing block.
- **top**: top edge position of the element. This attribute defines the offset between the top edge of a positioned element and that of a block included in the element.| + +> **NOTE** > > The absolute positioning does not support a percentage. Therefore, **margin** cannot be set for the child components of the **\** component. diff --git a/en/application-dev/reference/arkui-js-lite/js-framework-file.md b/en/application-dev/reference/arkui-js-lite/js-framework-file.md index ade304c4d50a1aacac56a140c1bf3a3669165580..e03caae24cb2ddfd8c20c7517baef2420160bedc 100644 --- a/en/application-dev/reference/arkui-js-lite/js-framework-file.md +++ b/en/application-dev/reference/arkui-js-lite/js-framework-file.md @@ -50,7 +50,7 @@ Application resources can be accessed via an absolute or relative path. In this > > - If code files A and B are in the same directory, you can use either a relative or absolute path in code file B to reference resource files. > -> - If code files A and B are in different directories, you must use an absolute path in code file B to reference resource files. The reason is that the directory of code file B changes during Webpack packaging. +> - If code files A and B are in different directories, you must use an absolute path in code file B to reference resource files, because the directory of code file B changes during Webpack packaging. > diff --git a/en/application-dev/reference/arkui-js-lite/js-framework-js-tag.md b/en/application-dev/reference/arkui-js-lite/js-framework-js-tag.md index 37d08081341fb43d1228d2cd9b211b14cf39f35a..fd346adaff3621ca076b10d9a55263eb8dd73755 100644 --- a/en/application-dev/reference/arkui-js-lite/js-framework-js-tag.md +++ b/en/application-dev/reference/arkui-js-lite/js-framework-js-tag.md @@ -4,10 +4,10 @@ The "js" tag contains the instance name and page route information. -| Tag| Type| Default Value| Mandatory| Description| -| -------- | -------- | -------- | -------- | -------- | -| name | string | default | Yes| Name of the JavaScript instance.| -| pages | Array | - | Yes| Route information. For details, see ["pages"](#pages).| +| Tag | Type | Default Value | Mandatory | Description | +| ----- | ------ | ------- | ---- | ----------------------------- | +| name | string | default | Yes | Name of the JavaScript instance. | +| pages | Array | - | Yes | Route information. For details, see ["pages"](#pages).| > **NOTE** @@ -34,10 +34,10 @@ The **"pages"** defines the route information of each page. Each page consists o > **NOTE** > -> -> - The application home page is fixed to **pages/index/index**. -> -> - The page name should not be a component name, for example, **text.hml** or **button.hml**. +> +> - The application home page is fixed to **pages/index/index**. +> +> - The page name should not be a component name, for example, **text.hml** or **button.hml**. ## Example diff --git a/en/application-dev/reference/arkui-js-lite/js-framework-syntax-css.md b/en/application-dev/reference/arkui-js-lite/js-framework-syntax-css.md index 79b1d9938cac9f7f804a85407a74d6bd08931628..7e3bf96dde9606c86a70d75f1c89fe62a47d155d 100644 --- a/en/application-dev/reference/arkui-js-lite/js-framework-syntax-css.md +++ b/en/application-dev/reference/arkui-js-lite/js-framework-syntax-css.md @@ -14,16 +14,16 @@ CSS files can be imported using the **\@import** statement. This facilitates mod The **.css** file with the same name as the **.hml** file in each page directory describes the styles of components on the HML page, determining how the components will be displayed. 1. Internal style: The **style** and **class** attributes can be used to specify the component style. Sample code: - - ``` + + ```html
Hello World
``` - - ``` + + ```css /* index.css */ .container { justify-content: center; @@ -31,16 +31,16 @@ The **.css** file with the same name as the **.hml** file in each page directory ``` 2. External style files: You need to import the files. For example, create a **style.css** file in the **common** directory and import the file at the beginning of **index.css**. - - ``` + + ```css /* style.css */ .title { font-size: 50px; } ``` - - ``` + + ```css /* index.css */ @import '../../common/style.css'; .container { @@ -53,16 +53,16 @@ The **.css** file with the same name as the **.hml** file in each page directory A CSS selector is used to select elements for which styles need to be added to. The following table lists the supported selectors. -| Selector| Example| Description| -| -------- | -------- | -------- | -| .class | .container | Selects all components whose **class** is **container**.| -| \#id | \#titleId | Selects all components whose **id** is **titleId**.| -| , | .title, .content | Selects all components whose **class** is **title** or **content**.| +| Selector | Example | Description | +| ------ | --------------------- | ------------------------------------- | +| .class | .container | Selects all components whose **class** is **container**. | +| \#id | \#titleId | Selects all components whose **id** is **titleId**. | +| , | .title, .content | Selects all components whose **class** is **title** or **content**.| Example: -``` +```html
Title @@ -73,7 +73,7 @@ Example: ``` -``` +```css /* Page style xxx.css */ /* Set the style for the components whose class is title. */ .title { @@ -95,15 +95,17 @@ Example: A CSS pseudo-class is a keyword added to a selector that specifies a special state of the selected elements. -| Name| Available Components| Description| -| -------- | -------- | -------- | -| :active |
input[type="button"] | Selects the element activated by a user, for example, a pressed button. Only the **background-color** and **background-image** attributes can be set for the pseudo-class selector on lite wearables.| + + +| Name | Available Components | Description | +| -------- | ----------------------------------- | ---------------------------------------- | +| :active |
input[type="button"] | Selects the element activated by a user, for example, a pressed button. Only the **background-color** and **background-image** attributes can be set for the pseudo-class selector on lite wearables.| | :checked | input[type="checkbox", type="radio"]| Selects the element whose **checked** attribute is **true**. Only the **background-color** and **background-image** attributes can be set for the pseudo-class selector on lite wearables.| The following is an example for you to use the **:active** pseudo-class to control the style when a user presses the button. -``` +```html
@@ -111,7 +113,7 @@ The following is an example for you to use the **:active** pseudo-class to contr ``` -``` +```css /* index.css */ .button:active { background-color: #888888;/* After the button is activated, the background color is changed to #888888. */ @@ -124,8 +126,8 @@ The following is an example for you to use the **:active** pseudo-class to contr Precompilation is a program that uses specific syntax to generate CSS files. It provides variables and calculation, helping you define component styles more conveniently. Currently, Less, Sass, and Scss are supported. To use precompiled styles, change the suffix of the original **.css** file. For example, change **index.css** to **index.less**, **index.sass**, or **index.scss**. - The following **index.less** file is changed from **index.css**. - - ``` + + ```css /* index.less */ /* Define a variable. */ @colorBackground: #000000; @@ -135,8 +137,8 @@ Precompilation is a program that uses specific syntax to generate CSS files. It ``` - Reference a precompiled style file. For example, if the **style.scss** file is located in the **common** directory, change the original **index.css** file to **index.scss** and import **style.scss**. - - ``` + + ```css /* style.scss */ /* Define a variable. */ $colorBackground: #000000; @@ -144,8 +146,8 @@ Precompilation is a program that uses specific syntax to generate CSS files. It Reference the precompiled style file in **index.scss**: - - ``` + + ```css /* index.scss */ /* Import style.scss. */ @import '../../common/style.scss'; @@ -154,7 +156,7 @@ Precompilation is a program that uses specific syntax to generate CSS files. It } ``` - + > **NOTE** > > Place precompiled style files in the **common** directory. diff --git a/en/application-dev/reference/arkui-js-lite/js-framework-syntax-hml.md b/en/application-dev/reference/arkui-js-lite/js-framework-syntax-hml.md index b9f5bec1e13aaf9bc2112fdee9e43cdcc322641d..b111895cb5421d3b5d4310c56f85929c216615ec 100644 --- a/en/application-dev/reference/arkui-js-lite/js-framework-syntax-hml.md +++ b/en/application-dev/reference/arkui-js-lite/js-framework-syntax-hml.md @@ -7,7 +7,7 @@ The OpenHarmony Markup Language (HML) is an HTML-like language that allows you t ## HML Page Structure -``` +```html
Image Show @@ -21,7 +21,7 @@ The OpenHarmony Markup Language (HML) is an HTML-like language that allows you t ## Data Binding -``` +```html
{{content[1]}} @@ -29,7 +29,7 @@ The OpenHarmony Markup Language (HML) is an HTML-like language that allows you t ``` -``` +```js // xxx.js export default { data: { @@ -42,9 +42,9 @@ export default { ``` > **NOTE** -> - To make the array data modification take effect, use the **splice** method to change array items. -> -> - ECMAScript 6.0 syntax is not supported in HML. +> - To make the array data modification take effect, use the **splice** method to change array items. +> +> - ECMAScript 6.0 syntax is not supported in HML. ## Event Binding @@ -52,7 +52,7 @@ export default { The callback bound to an event receives an event object parameter, which can be used to obtain the event information. -``` +```html
@@ -73,7 +73,7 @@ The callback bound to an event receives an event object parameter, which can be ``` -``` +```js // xxx.js export default { data: { @@ -88,11 +88,11 @@ export default { > **NOTE** > -> Event bubbling is supported since API version 5. After you upgrade the SDK and run an existing JavaScript application, events bound using a traditional statement (such as **onclick**) will not bubble. However, if you use the new SDK to repack the JavaScript application, such events will bubble. To avoid service logic errors, replace the traditional statement with one supported by the new SDK. For example, replace **onclick** with **grab:click**. +> Event bubbling is supported since API version 5. After you upgrade the SDK and run an existing JavaScript application, events bound using a traditional statement (such as **onclick**) will not bubble. However, if you use the new SDK to repack the JavaScript application, such events will bubble. To avoid service logic errors, replace the traditional statement with one supported by the new SDK. For example, replace **onclick** with **grab:click**. **Example:** -``` +```html
{{count}} @@ -108,8 +108,8 @@ export default { ``` -``` -/* xxx.js */ +```js +// xxx.js export default { data: { count: 0 @@ -127,7 +127,7 @@ export default { ``` -``` +```css /* xxx.css */ .container { display: flex; @@ -164,7 +164,7 @@ export default { ## Loop Rendering -``` +```html
@@ -184,7 +184,7 @@ export default { ``` -``` +```js // xxx.js export default { data: { @@ -211,11 +211,12 @@ The **tid** attribute accelerates the **for** loop and improves the re-rendering - for="(i, v) in array": **i** indicates the element index, and **v** indicates the element variable. All elements of the array object will be looped through. -> **NOTE** +> **NOTE** +> > - Each element in the array must have the data attribute specified by **tid**. Otherwise, an exception may occur. -> +> > - The attribute specified by **tid** in the array must be unique. Otherwise, performance loss occurs. In the above example, only **id** and **name** can be used as **tid** because they are unique fields. -> +> > - The **tid** field does not support expressions. @@ -224,7 +225,7 @@ The **tid** attribute accelerates the **for** loop and improves the re-rendering There are two ways to implement conditional rendering: **if-elif-else** or **show**. In **if-elif-else**, when the **if** statement evaluates to **false**, the component is not built in the VDOM and is not rendered. For **show**, when show is **false**, the component is not rendered but is built in the VDOM. In addition, the **if-elif-else** statements must be used in sibling nodes. Otherwise, the compilation fails. The following example uses both ways to implement conditional rendering: -``` +```html
@@ -236,8 +237,8 @@ There are two ways to implement conditional rendering: **if-elif-else** or **sho ``` -``` -// xxx.css +```css +/* xxx.css */ .container{ flex-direction: column; align-items: center; @@ -250,7 +251,7 @@ There are two ways to implement conditional rendering: **if-elif-else** or **sho ``` -``` +```js // xxx.js export default { data: { @@ -269,7 +270,7 @@ export default { In the optimized rendering (**show**), if **show** is **true**, the node is rendered properly; if it is **false**, the display style will be **none**. -``` +```html
@@ -278,8 +279,8 @@ In the optimized rendering (**show**), if **show** is **true**, the node is rend ``` -``` -// xxx.css +```css +/* xxx.css */ .container{ flex-direction: column; align-items: center; @@ -292,7 +293,7 @@ In the optimized rendering (**show**), if **show** is **true**, the node is rend ``` -``` +```js // xxx.js export default { data: { @@ -305,4 +306,5 @@ export default { ``` > **NOTE** -> Do not use **for** and **if** attributes at the same time in an element. +> +> Do not use **for** and **if** attributes at the same time in an element. diff --git a/en/application-dev/reference/arkui-js-lite/js-framework-syntax-js.md b/en/application-dev/reference/arkui-js-lite/js-framework-syntax-js.md index 3ce76d4463643c979cf619749b2a8a5c80dae1c1..e9d71fc2ff680dfba5b95e7bae676854a1e68a28 100644 --- a/en/application-dev/reference/arkui-js-lite/js-framework-syntax-js.md +++ b/en/application-dev/reference/arkui-js-lite/js-framework-syntax-js.md @@ -31,7 +31,7 @@ The ECMAScript 6.0 syntax is supported. Lite wearables only support the followin - Module declaration Import functionality modules. - + ``` import router from '@system.router'; ``` @@ -39,7 +39,7 @@ The ECMAScript 6.0 syntax is supported. Lite wearables only support the followin - Code reference Import JavaScript code. - + ``` import utils from '../../common/utils.js'; ``` @@ -48,17 +48,17 @@ The ECMAScript 6.0 syntax is supported. Lite wearables only support the followin ## Objects - Page objects - | Attribute| Type| Description| - | -------- | -------- | -------- | - | data | Object/Function | Data model of the page. If the attribute is of the function type, the return value must be of the object type. The name cannot start with a dollar sign ($) or underscore (_). Do not use reserved words (**for**, **if**, **show**, and **tid**). | - | $refs | Object | DOM elements or child component instances that have registered the **ref** attribute. For an example, see [Obtaining a DOM Element](#obtaining-a-dom-element).| + | Attribute | Type | Description | + | ----- | --------------- | ---------------------------------------- | + | data | Object/Function | Data model of the page. If the attribute is of the function type, the return value must be of the object type. The name cannot start with a dollar sign ($) or underscore (_). Do not use reserved words (**for**, **if**, **show**, and **tid**).
| + | $refs | Object | DOM elements or child component instances that have registered the **ref** attribute. For an example, see [Obtaining a DOM Element](#obtaining-a-dom-element). | ## Obtaining a DOM Element Use **$refs** to obtain a DOM element. -``` +```html
@@ -66,57 +66,57 @@ Use **$refs** to obtain a DOM element. ``` -``` -// index.js -export default { - data: { - images: [ - { src: '/common/frame1.png' }, - { src: '/common/frame2.png' }, - { src: '/common/frame3.png' }, - ], - }, - handleClick() { - const animator = this.$refs.animator; // Obtain the DOM element whose $refs attribute is animator. - const state = animator.getState(); - if (state === 'paused') { - animator.resume(); - } else if (state === 'stopped') { - animator.start(); - } else { - animator.pause(); - } - }, -}; -``` + ```js + // index.js + export default { + data: { + images: [ + { src: '/common/frame1.png' }, + { src: '/common/frame2.png' }, + { src: '/common/frame3.png' }, + ], + }, + handleClick() { + const animator = this.$refs.animator; // Obtain the DOM element whose $refs attribute is animator. + const state = animator.getState(); + if (state === 'paused') { + animator.resume(); + } else if (state === 'stopped') { + animator.start(); + } else { + animator.pause(); + } + }, + }; + ``` ## Lifecycle APIs - Page lifecycle APIs - | Name | Type| Parameter| Return Value| Description| Triggered When| - | -------- | -------- | -------- | -------- | -------- | -------- | - | onInit | Function | N/A| N/A| Listens for page initialization.| Page initialization is complete. This API is called only once in the page lifecycle.| - | onReady | Function | N/A| N/A| Listens for page creation.| A page is created. This API is called only once in the page lifecycle.| - | onShow | Function | N/A| N/A| Listens for page display. | The page is displayed.| - | onHide | Function | N/A| N/A| Listens for page disappearance.| The page disappears.| - | onDestroy | Function | N/A| N/A| Listens for page destruction.| The page is destroyed.| - + | Name | Type | Parameter | Return Value | Description | Triggered When | + | --------- | -------- | ---- | ---- | ------ | ------------------- | + | onInit | Function | N/A | N/A | Listens for page initialization. | Page initialization is complete. This API is called only once in the page lifecycle.| + | onReady | Function | N/A | N/A | Listens for page creation.| A page is created. This API is called only once in the page lifecycle. | + | onShow | Function | N/A | N/A | Listens for page display. | The page is displayed. | + | onHide | Function | N/A | N/A | Listens for page disappearance. | The page disappears. | + | onDestroy | Function | N/A | N/A | Listens for page destruction. | The page is destroyed. | + The lifecycle APIs of page A are called in the following sequence: - Open page A: onInit() -> onReady() -> onShow() - + - Open page B on page A: onHide() -> onDestroy() - + - Go back to page A from page B: onInit() -> onReady() -> onShow() - + - Exit page A: onHide() -> onDestroy() - + - Hide page A: onHide() - + - Show background page A on the foreground: onShow() - Application lifecycle APIs - | Name | Type| Parameter| Return Value| Description| Triggered When| - | -------- | -------- | -------- | -------- | -------- | -------- | - | onCreate | Function | N/A| N/A| Listens for application creation.| The application is created.| - | onDestroy | Function | N/A| N/A| Listens for application exit.| The application exits.| + | Name | Type | Parameter | Return Value | Description | Triggered When | + | --------- | -------- | ---- | ---- | ---- | --------- | + | onCreate | Function | N/A | N/A | Listens for application creation.| The application is created.| + | onDestroy | Function | N/A | N/A | Listens for application exit.| The application exits.| diff --git a/en/application-dev/reference/arkui-ts/ts-components-canvas-canvasgradient.md b/en/application-dev/reference/arkui-ts/ts-components-canvas-canvasgradient.md index 35211ab1665ca4dbee56199a3c449ae9ff2a8a0b..8801033ff3864cef03d0271db00a8d1dfb92d3da 100644 --- a/en/application-dev/reference/arkui-ts/ts-components-canvas-canvasgradient.md +++ b/en/application-dev/reference/arkui-ts/ts-components-canvas-canvasgradient.md @@ -22,7 +22,7 @@ Since API version 9, this API is supported in ArkTS widgets. | Name | Type | Mandatory | Default Value | Description | | ------ | ------ | ---- | --------- | ---------------------------- | | offset | number | Yes | 0 | Relative position of the gradient stop along the gradient vector. The value ranges from 0 to 1.| -| color | string | Yes | '#ffffff' | Gradient color to set. | +| color | string | Yes | '#ffffff' | Gradient color to set. For details about the color notation, see the description of the string type in [ResourceColor](ts-types.md#resourcecolor). | **Example** diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-gradient-color.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-gradient-color.md index 11394a20c84757bfff4fc3d95fc72a7f2c3ee428..8032455b78bf4a4e5654dfc939f23cfbdeafc2e3 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-gradient-color.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-gradient-color.md @@ -12,9 +12,9 @@ Create a more gorgeous look for a component by applying a gradient color effect | Name | Type | Description | | -------------- | -------------------------------------------- | ----------------------------------- | -| linearGradient | {
angle?: number \| string,
direction?: [GradientDirection](ts-appendix-enums.md#gradientdirection),
colors: Array<[ColorStop](ts-basic-components-gauge.md#colorstop)>,
repeating?: boolean
} | Linear gradient.
- **angle**: start angle of the linear gradient. A positive value indicates a clockwise rotation from the origin, (0, 0).
Default value: **180**
- **direction**: direction of the linear gradient. It does not take effect when **angle** is set.
Default value: **GradientDirection.Bottom**
- **colors**: colors of the linear gradient.
- **repeating**: whether the colors are repeated.
Default value: **false**
Since API version 9, this API is supported in ArkTS widgets.| -| sweepGradient | {
center: Point,
start?: number \| string,
end?: number \| string,
rotation?: number\|string,
colors: Array<[ColorStop](ts-basic-components-gauge.md#colorstop)>,
repeating?: boolean
} | Sweep gradient, which can sweep around the specified center point in the 0–360 degree range. If the rotation angle exceeds the range, a monochrome color instead of a gradient will be drawn.
- **center**: center point of the sweep gradient, that is, the coordinates relative to the upper left corner of the current component.
- **start**: start point of the sweep gradient.
Default value: **0**
- **end**: end point of the sweep gradient.
Default value: **0**
- **rotation**: rotation angle of the sweep gradient.
Default value: **0**
- **colors**: colors of the sweep gradient.
- **repeating**: whether the colors are repeated.
Default value: **false**
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
A value less than 0 evaluates to the value **0**. A value greater than 360 evaluates to the value **1**.
When the data type of **start**, **end**, and **rotation** is string, the value **"90"** or **"90%"** is equivalent to **90**. | -| radialGradient | {
center: Point,
radius: number \| string,
colors: Array<[ColorStop](ts-basic-components-gauge.md#colorstop)>,
repeating?: boolean
} | Radial gradient.
- **center**: center point of the radial gradient, that is, the coordinates relative to the upper left corner of the current component.
- **radius**: radius of the radial gradient.
Value range: [0, +∞)
**NOTE**
A value less than 0 evaluates to the value **0**.
- **colors**: colors of the radial gradient.
- **repeating**: whether the colors are repeated.
Default value: **false**
Since API version 9, this API is supported in ArkTS widgets. | +| linearGradient | {
angle?: number \| string,
direction?: [GradientDirection](ts-appendix-enums.md#gradientdirection),
colors: Array<[ColorStop](ts-basic-components-gauge.md#colorstop)>,
repeating?: boolean
} | Linear gradient.
- **angle**: start angle of the linear gradient. A positive value indicates a clockwise rotation from the origin, (0, 0).
Default value: **180**
- **direction**: direction of the linear gradient. It does not take effect when **angle** is set.
Default value: **GradientDirection.Bottom**
- **colors**: colors of the linear gradient.
- **repeating**: whether the colors are repeated.
Default value: **false**
Since API version 9, this API is supported in ArkTS widgets.| +| sweepGradient | {
center: [Point](./ts-drawing-components-polygon.md#point),
start?: number \| string,
end?: number \| string,
rotation?: number\|string,
colors: Array<[ColorStop](ts-basic-components-gauge.md#colorstop)>,
repeating?: boolean
} | Sweep gradient, which can sweep around the specified center point in the 0–360 degree range. If the rotation angle exceeds the range, a monochrome color instead of a gradient will be drawn.
- **center**: center point of the sweep gradient, that is, the coordinates relative to the upper left corner of the current component.
- **start**: start point of the sweep gradient.
Default value: **0**
- **end**: end point of the sweep gradient.
Default value: **0**
- **rotation**: rotation angle of the sweep gradient.
Default value: **0**
- **colors**: colors of the sweep gradient.
- **repeating**: whether the colors are repeated.
Default value: **false**
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
A value less than 0 evaluates to the value **0**. A value greater than 360 evaluates to the value **1**.
When the data type of **start**, **end**, and **rotation** is string, the value **"90"** or **"90%"** is equivalent to **90**.| +| radialGradient | {
center: [Point](./ts-drawing-components-polygon.md#point),
radius: number \| string,
colors: Array<[ColorStop](ts-basic-components-gauge.md#colorstop)>,
repeating?: boolean
} | Radial gradient.
- **center**: center point of the radial gradient, that is, the coordinates relative to the upper left corner of the current component.
- **radius**: radius of the radial gradient.
Value range: [0, +∞)
**NOTE**
A value less than 0 evaluates to the value **0**.
- **colors**: colors of the radial gradient.
- **repeating**: whether the colors are repeated.
Default value: **false**
Since API version 9, this API is supported in ArkTS widgets.| ## Example diff --git a/en/application-dev/reference/js-service-widget-ui/js-service-widget-common-gradient.md b/en/application-dev/reference/js-service-widget-ui/js-service-widget-common-gradient.md index fbfe2c4db91511503d37bba3ad2100a912aee020..2c338d915e21c6a66ba684824739914c86966ff8 100644 --- a/en/application-dev/reference/js-service-widget-ui/js-service-widget-common-gradient.md +++ b/en/application-dev/reference/js-service-widget-ui/js-service-widget-common-gradient.md @@ -33,54 +33,52 @@ background: repeating-linear-gradient(direction/angle, color, color, ...); The color can be specified in any of the following formats: \#ff0000, \#ffff0000, rgb(255, 0, 0), and rgba(255, 0, 0, 1). At least two colors must be specified. -- Parameters +**Parameters** - | Name | Type | Default Value | Mandatory | Description | - | --------- | ---------------------------------------- | ---------------------------- | ---- | ---------------------------------------- | - | direction | to <side-or-corner> <side-or-corner> = [left \| right] \|\| [top \| bottom] | to bottom (gradient from top to bottom)| No | Transition direction. For example, **to left** (gradient from right to left) or **to bottom right** (gradient from upper left corner to lower right corner).| - | angle | <deg> | 180deg | No | Transition direction, which is the angle between the gradient line and the y-axis (in the clockwise direction), with the geometric center of the element being the origin of coordinates and the horizontal axis being the x-axis.| - | color | <color> [<length>\|<percentage>] | - | Yes | Colors among which smooth transitions are rendered. | +| Name | Type | Default Value | Mandatory | Description | +| --------- | ---------------------------------------- | ---------------------------- | ---- | ---------------------------------------- | +| direction | to <side-or-corner> <side-or-corner> = [left \| right] \|\| [top \| bottom] | to bottom (gradient from top to bottom)| No | Transition direction. For example, **to left** (gradient from right to left) or **to bottom right** (gradient from upper left corner to lower right corner).| +| angle | <deg> | 180deg | No | Transition direction, which is the angle between the gradient line and the y-axis (in the clockwise direction), with the geometric center of the element being the origin of coordinates and the horizontal axis being the x-axis.| +| color | <color> [<length>\|<percentage>] | - | Yes | Colors among which smooth transitions are rendered. | -- Example +**Example** - 1. Gradient from top to bottom (default) +1. Gradient from top to bottom (default) - ```css - #gradient { - height: 300px; - width: 600px; - /* Gradient starts from red at the top to green at the bottom. */ - background: linear-gradient(red, #00ff00); - } - ``` + ```css + #gradient { + height: 300px; + width: 600px; + /* Gradient starts from red at the top to green at the bottom. */ + background: linear-gradient(red, #00ff00); + } + ``` - ![111](figures/111.PNG) + ![111](figures/111.PNG) - 2. Gradient at an angle of 45° +2. Gradient at an angle of 45° + ```css + /* Gradient at an angle of 45°, changing from red to green */ + background: linear-gradient(45deg, rgb(255, 0, 0),rgb(0, 255, 0)); + ``` - ```css - /* Gradient at an angle of 45°, changing from red to green */ - background: linear-gradient(45deg, rgb(255, 0, 0),rgb(0, 255, 0)); - ``` + ![222](figures/222.PNG) - ![222](figures/222.PNG) +3. Gradient from left to right - 3. Gradient from left to right + ```css + /* Gradient from left to right, which is available in the 270 px width between the left 90 px and the left 360 px (600*0.6) */ + background: linear-gradient(to right, rgb(255, 0, 0) 90px, rgb(0, 255, 0) 60%); + ``` - ```css - /* Gradient from left to right, which is available in the 270 px width between the left 90 px and the left 360 px (600*0.6) */ - background: linear-gradient(to right, rgb(255, 0, 0) 90px, rgb(0, 255, 0) 60%); - ``` + ![333](figures/333.PNG) +4. Repeating gradient - ![333](figures/333.PNG) + ```css + /* Repeating gradient from left to right, the area of which is 30 px (60 – 30) and the opacity is 0.5 */ + background: repeating-linear-gradient(to right, rgba(255, 255, 0, 1) 30vp,rgba(0, 0, 255, .5) 60vp); + ``` - 4. Repeating gradient - - ```css - /* Repeating gradient from left to right, the area of which is 30 px (60 – 30) and the opacity is 0.5 */ - background: repeating-linear-gradient(to right, rgba(255, 255, 0, 1) 30vp,rgba(0, 0, 255, .5) 60vp); - ``` - - ![444](figures/444.PNG) + ![444](figures/444.PNG) diff --git a/en/application-dev/ui/arkts-common-components-xcomponent.md b/en/application-dev/ui/arkts-common-components-xcomponent.md new file mode 100644 index 0000000000000000000000000000000000000000..b6bdb5633f2275fda550f7ae2c6c7f75ed420d0f --- /dev/null +++ b/en/application-dev/ui/arkts-common-components-xcomponent.md @@ -0,0 +1,302 @@ +# XComponent + + +As a drawing component, the \<[XComponent](../reference/arkui-ts/ts-basic-components-xcomponent.md)> is usually used to meet relatively complex drawing customization requirements, for example, display of a camera preview stream and drawing of a game image. + + +You can specify the **type** parameter to implement different features. Two options are mainly available for this parameter: **surface** and **component**. + + +With the **\** of the **surface** type, you can pass data to the surface independently owned by it to render the image. + + +With the **\** of the **component** type, you can dynamically load the displayed content. + + +## surface Type + +When the **\** is set to the **surface** type, you can write EGL/OpenGL ES and media data and display it on the **\**. + +You can also have the **\** laid out and rendered together with other components. + +The **\** has an independent surface, which provides a native window for you to create the EGL/OpenGL ES environment on the native (C/C++) side and use the standard OpenGL ES for development. + +In addition, media-related applications (such as videos and cameras) can write data to the surface provided by the **\** to present the corresponding image. + + +## Using EGL/OpenGL ES for Rendering + + +### Key Points of Native Code Development + +OpenHarmony applications use native APIs to implement interactions between JS and C/C++ code. This is also the case with the **\**. For details, see [Using N-APIs in Application Projects](../napi/napi-guidelines.md). + +The type of the file for processing the JS logic on the native side is .so. + +- Each module has a .so file. + +- The .so file is named in the format of lib{moduleName}.so. + + +In the scenario where the **\** is used for standard OpenGL ES development, the content of the **CMAKELists.txt** file is as follows: + + + +``` +cmake_minimum_required(VERSION 3.4.1) +project(XComponent) # Project name + +set(NATIVERENDER_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}) +# Path for searching for header files +include_directories(${NATIVERENDER_ROOT_PATH} + ${NATIVERENDER_ROOT_PATH}/include + ) + +# Compile the target .so file. SHARED indicates the dynamic library. +add_library(nativerender SHARED + xxx.cpp + ) + +# Search for related libraries (including OpenGL ES libraries and NDK APIs provided by the ). +find_library( EGL-lib + EGL ) + +find_library( GLES-lib + GLESv3 ) + +find_library( libace-lib + ace_ndk.z ) + +# Dependencies required for compiling .so files +target_link_libraries(nativerender PUBLIC ${EGL-lib} ${GLES-lib} ${libace-lib} libace_napi.z.so libc++.a) +``` + + +### Registering the N-API Module + + +```c++ +static napi_value Init(napi_env env, napi_value exports) +{ + // Define the API exposed on the module. + napi_property_descriptor desc[] ={ + DECLARE_NAPI_FUNCTION("changeColor", PluginRender::NapiChangeColor), + }; + // You can mount the native method (PluginRender::NapiChangeColor) to exports through this API. exports is bound to a JS object at the JS layer through the JS engine. + NAPI_CALL(env, napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc)); + return exports; +} + +static napi_module nativerenderModule = { + .nm_version = 1, + .nm_flags = 0, + .nm_filename = nullptr, + .nm_register_func = Init, // Specify the callback for when the corresponding module is loaded. + .nm_modname = "nativerender", // Specify the module name. For -related development, the name must be the same as the value of libraryname in the on ArkTS. + .nm_priv = ((void*)0), + .reserved = { 0 }, +}; + +extern "C" __attribute__((constructor)) void RegisterModule(void) +{ + // Register the SO module. + napi_module_register(&nativerenderModule);c +} +``` + + +### Parsing the NativeXComponent Instance + +**NativeXComponent** provides an instance at the native layer for the **\**, which can be used as a bridge for binding with the **\** at the JS layer. The NDK APIs provided by the **\** depend on this instance. For details about the NDK APIs, see [Native XComponent](../reference/native-apis/_o_h___native_x_component.md). + + +The **NativeXComponent** instance can be obtained by parsing the callback (that is, the **Init** function in [NAPI module registration](#registering-the-n-api-module)) when the module is loaded. + + + +```c++ +{ + // ... + napi_status status; + napi_value exportInstance = nullptr; + OH_NativeXComponent *nativeXComponent = nullptr; + // Parse the attribute of the wrapped NativeXComponent pointer. + status = napi_get_named_property(env, exports, OH_NATIVE_XCOMPONENT_OBJ, &exportInstance); + if (status != napi_ok) { + return false; + } + // Use the napi_unwrap API to parse the NativeXComponent instance pointer. + status = napi_unwrap(env, exportInstance, reinterpret_cast(&nativeXComponent)); + // ... +} +``` + + +### Registering XComponent Callback + +Based on the NativeXComponent pointer obtained by [parsing the NativeXComponent instance](#parsing-the-nativexcomponent-instance), perform callback registration through the **OH_NativeXComponent_RegisterCallback** API. + + + +```c++ +{ + ... + OH_NativeXComponent *nativeXComponent = nullptr; + // Parse the NativeXComponent instance. + + OH_NativeXComponent_Callback callback; + callback->OnSurfaceCreated = OnSurfaceCreatedCB; // Invoked when a surface is successfully created. You can obtain the handle to the native window from this event. + callback->OnSurfaceChanged = OnSurfaceChangedCB; // Invoked when the surface changes. You can obtain the native window handle and XComponent change information from this event. + callback->OnSurfaceDestroyed = OnSurfaceDestroyedCB; // Invoked when the surface is destroyed. You can release resources in this event. + callback->DispatchTouchEvent = DispatchTouchEventCB; // Invoked when a touch event occurs. You can obtain the touch event information from this event. + + OH_NativeXComponent_RegisterCallback(nativeXComponent, callback); + ... +} +``` + + +### Creating the EGL/OpenGL ES Environment + +In the registered **OnSurfaceCreated** callback, you can obtain the handle to the native window (which is essentially the surface independently owned by the **\**). Therefore, you can create the EGL/OpenGL ES environment for your application to start the development of the rendering logic. + + +```c++ +EGLCore* eglCore_; // EGLCore is a class that encapsulates OpenGL-related APIs. +uint64_t width_; +uint64_t height_; +void OnSurfaceCreatedCB(OH_NativeXComponent* component, void* window) +{ + int32_t ret = OH_NativeXComponent_GetXComponentSize(component, window, &width_, &height_); + if (ret === OH_NATIVEXCOMPONENT_RESULT_SUCCESS) { + eglCore_->GLContextInit(window, width_, height_); // Initialize the OpenGL environment. + } +} +``` + + +### ArkTS Syntax + +You can use the **\** to develop EGL/OpenGL ES rendering by using the following code on the ArkTS side: + + +```ts +XComponent({ id: 'xcomponentId1', type: 'surface', libraryname: 'nativerender' }) + .onLoad((context) => {}) + .onDestroy(() => {}) +``` + +- **id**: corresponds to an **\** and must be unique. Generally, you can use the **OH_NativeXComponent_GetXComponentId** API on the native side to obtain the corresponding ID and bind the corresponding **\**. + +- **libraryname**: name of the loaded module, which must be the same as the value of **nm_modname** used when the Napi module is registered on the native side. + + > **NOTE** + > + > An application loads modules to implement cross-language invoking in either of the following modes: + > + > 1. Use the **import** mode of the NAPI. + > + > ```ts + > import nativerender from "libnativerender.so" + > ``` + > + > 2. Use the **\**. + > + > While this mode also uses the NAPI mechanism as the **import** mode, it enables you to use the NDK APIs of the **\**, by having the **NativeXComponent** instance of the **\** exposed to the native layer of the application when the dynamic library is loaded. + +- **onLoad** event + - Trigger time: when the surface of the **\** is prepared. + - **context** parameter: where the native API exposed on the module is mounted. Its usage is similar to the usage of the **context2** instance obtained after the module is directly loaded using **import context2 from "libnativerender.so"**. + - Time sequence: When the **onLoad** event is subject to the surface. The following figure shows the time sequence of the **onLoad** event and the **OnSurfaceCreated** event on the native side. + + ![onLoad](figures/onLoad.png) + +- **onDestroy** event + + Trigger time: when the **\** is destroyed, in the same manner as that when an ArkUI component is destroyed. The following figure shows the time sequence of the **onDestroy** event and the **OnSurfaceDestroyed** event on the native side. + + ![onDestroy](figures/onDestroy.png) + + +### Writing Media Data + +The surface held by the **\** complies with the producer-consumer model. + +In OpenHarmony, components that comply with the producer design, such as the camera and video player, can write data to the surface held by the **\** and display the data through the **\**. + +![picture-1](figures/picture-1.png) + +You can bind the **\** to the **XComponentController** to obtain the surface ID (**surfaceId**, which uniquely identifies a surface) and send it to the corresponding component API. + + +```ts +@State surfaceId:string = ""; +mXComponentController: XComponentController = new XComponentController(); +XComponent({ id: '', type: 'surface', controller: this.mXComponentController }) + .onLoad(() => { + this.surfaceId = this.mXComponentController.getXComponentSurfaceId() + }) +``` + +For details about component APIs, see [AVPlayer](../reference/apis/js-apis-media.md#avplayer9) and [Camera](../reference/apis/js-apis-camera.md). + + +### component Type + +When the **\** is set to the **component** type, you can execute non-UI logic to dynamically load the displayed content. + + +>**NOTE** +> +> When **type** is set to **component**, the **\** functions as a container, where child components are laid out vertically. +> +> - Vertical alignment: [FlexAlign](../reference/arkui-ts/ts-appendix-enums.md#flexalign).Start +> +> - Horizontal alignment: [FlexAlign](../reference/arkui-ts/ts-appendix-enums.md#flexalign).Center +> +> The component does not respond to any events. +> +> Layout changes and event responses can be set by mounting child components. +> +> The non-UI logic written internally needs to be encapsulated in one or more functions. + + +### Example Scenario + + +```ts +@Builder +function addText(label: string): void { + Text(label) + .fontSize(40) +} + +@Entry +@Component +struct Index { + @State message: string = 'Hello XComponent' + @State messageCommon: string = 'Hello World' + build() { + Row() { + Column() { + XComponent({ id: 'xcomponentId-container', type: 'component' }) { + addText(this.message) + Divider() + .margin(4) + .strokeWidth(2) + .color('#F1F3F5') + .width("80%") + Column() { + Text(this.messageCommon) + .fontSize(30) + } + } + } + .width('100%') + } + .height('100%') + } +} +``` + +![en-us_image_0000001511900428](figures/en-us_image_0000001511900428.png) diff --git a/en/application-dev/ui/figures/en-us_image_0000001511900428.png b/en/application-dev/ui/figures/en-us_image_0000001511900428.png new file mode 100644 index 0000000000000000000000000000000000000000..53fb84e3c75c85055eb4e7a0797dc4600f9dd304 Binary files /dev/null and b/en/application-dev/ui/figures/en-us_image_0000001511900428.png differ diff --git a/en/application-dev/ui/figures/onDestroy.png b/en/application-dev/ui/figures/onDestroy.png new file mode 100644 index 0000000000000000000000000000000000000000..8615ef3b721eab8e90b7602ed20ac9ddd3cb2e07 Binary files /dev/null and b/en/application-dev/ui/figures/onDestroy.png differ diff --git a/en/application-dev/ui/figures/onLoad.png b/en/application-dev/ui/figures/onLoad.png new file mode 100644 index 0000000000000000000000000000000000000000..69c39d25de8323e5b20d5324da322796d051b102 Binary files /dev/null and b/en/application-dev/ui/figures/onLoad.png differ diff --git a/en/application-dev/ui/figures/picture-1.png b/en/application-dev/ui/figures/picture-1.png new file mode 100644 index 0000000000000000000000000000000000000000..85e91bba345c1b0012d0c6f031baa7ee43ef867a Binary files /dev/null and b/en/application-dev/ui/figures/picture-1.png differ