• Home
Name Date Size #Lines LOC

..--

adapter/12-May-2024-32,85826,381

build/12-May-2024-5,0234,505

figures/12-May-2024-

frameworks/12-May-2024-693,403520,592

interfaces/12-May-2024-7,2155,533

test/resource/12-May-2024-189161

.clang-formatD12-May-20243 KiB107106

.gitattributesD12-May-2024631 1615

.gitignoreD12-May-2024193 1816

BUILD.gnD12-May-20242.7 KiB11092

LICENSED12-May-20249.9 KiB177150

OAT.xmlD12-May-202412.6 KiB12975

README.mdD12-May-20245.3 KiB10371

README_zh.mdD12-May-20245.1 KiB10371

ace_config.gniD12-May-20244.3 KiB142117

如何新增一个组件.mdD12-May-202418.3 KiB606442

README.md

1# JS UI Framework<a name="EN-US_TOPIC_0000001076213364"></a>
2
3-   [Introduction](#section15701932113019)
4-   [Directory Structure](#section1791423143211)
5-   [When to Use](#section171384529150)
6-   [Available Components](#section271831717166)
7-   [Repositories Involved](#section1447164910172)
8
9## Introduction<a name="section15701932113019"></a>
10
11The OpenHarmony JS UI framework provides basic, container, and canvas UI components and standard CSS animation capabilities. It supports the web-development-like programming paradigm.
12
13-   **Web-development-like paradigm**
14
15    The JS UI framework supports languages that are similar to those for web development, such as HTML and CSS. You can use them to describe the page layout and style, and use JavaScript \(conforming to the ECMAScript specification\) for page behavior. This paradigm allows you to avoid code for UI state switching. The view configuration information is intuitive.
16
17
18**Figure  1**  Framework architecture<a name="fig2606133765017"></a>
19![](figures/framework-architecture.png "framework-architecture")
20
21The JS UI framework consists of the application, framework, engine, and porting layers.
22
23-   **Application**
24
25    Contains apps with Feature Abilities \(FAs\) developed with the JS UI framework. The FA app in this document refers to the app with FAs developed using JavaScript.
26
27-   **Framework**
28
29    Parses UI pages and provides the Model-View-ViewModel \(MVVM\), page routing, custom components and more for front end development.
30
31-   **Engine**
32
33    Accomplishes animation parsing, Document Object Model \(DOM\) building, layout computing, rendering command building and drawing, and event management.
34
35-   **Porting Layer**
36
37    Abstracts the platform layer to provide abstract interfaces to connect to the platform. For example, event interconnection, rendering pipeline interconnection, and lifecycle interconnection.
38
39
40## Directory Structure<a name="section1791423143211"></a>
41
42The source code of the framework is stored in  **/foundation/ace/ace\_engine**. The following shows the directory structure.
43
44```
45/foundation/ace/ace_engine
46├── adapter                       # Platform adaptation code
47│   ├── common
48│   └── ohos
49├── frameworks                    # Framework code
50│   ├── base                      # Basic libraries
51│   ├── bridge                    # Bridging layer for frontend and backend components
52│   └── core                      # Core components
53```
54
55## When to Use<a name="section171384529150"></a>
56
57JS UI framework provides various UI components with rich functionalities and style definitions. You can use and reuse any component anywhere as needed. You can customize new components by combining existing ones to simplify development.
58
59## Available Components<a name="section271831717166"></a>
60
61**Table  1**  Components provided by the framework
62
63<a name="table2347172925617"></a>
64<table><thead align="left"><tr id="row5347429155610"><th class="cellrowborder" valign="top" width="28.64%" id="mcps1.2.3.1.1"><p id="p1347102910567"><a name="p1347102910567"></a><a name="p1347102910567"></a>Type</p>
65</th>
66<th class="cellrowborder" valign="top" width="71.36%" id="mcps1.2.3.1.2"><p id="p83475294565"><a name="p83475294565"></a><a name="p83475294565"></a>Components</p>
67</th>
68</tr>
69</thead>
70<tbody><tr id="row15347122918562"><td class="cellrowborder" valign="top" width="28.64%" headers="mcps1.2.3.1.1 "><p id="p679795614335"><a name="p679795614335"></a><a name="p679795614335"></a>Basic</p>
71</td>
72<td class="cellrowborder" valign="top" width="71.36%" headers="mcps1.2.3.1.2 "><p id="p88813982011"><a name="p88813982011"></a><a name="p88813982011"></a>button, text, input, label, image, progress, rating, span, marquee, image-animator, divider, menu, chart, option, picker, picker-view, piece, qrcode, select, slider, switch, toolbar, toolbar-item, toggle</p>
73</td>
74</tr>
75<tr id="row1973535793115"><td class="cellrowborder" valign="top" width="28.64%" headers="mcps1.2.3.1.1 "><p id="p8735195713313"><a name="p8735195713313"></a><a name="p8735195713313"></a>Container</p>
76</td>
77<td class="cellrowborder" valign="top" width="71.36%" headers="mcps1.2.3.1.2 "><p id="p1268024618208"><a name="p1268024618208"></a><a name="p1268024618208"></a>div, list, list-item, list-item-group, stack, swiper, tabs, tab-bar, tab-content, refresh, dialog, badge, panel, popup, stepper, stepper-item</p>
78</td>
79</tr>
80<tr id="row1792218915320"><td class="cellrowborder" valign="top" width="28.64%" headers="mcps1.2.3.1.1 "><p id="p692289163220"><a name="p692289163220"></a><a name="p692289163220"></a>Canvas</p>
81</td>
82<td class="cellrowborder" valign="top" width="71.36%" headers="mcps1.2.3.1.2 "><p id="p199228910327"><a name="p199228910327"></a><a name="p199228910327"></a>canvas</p>
83</td>
84</tr>
85<tr id="row837615526208"><td class="cellrowborder" valign="top" width="28.64%" headers="mcps1.2.3.1.1 "><p id="p4377752152016"><a name="p4377752152016"></a><a name="p4377752152016"></a>Grid</p>
86</td>
87<td class="cellrowborder" valign="top" width="71.36%" headers="mcps1.2.3.1.2 "><p id="p17377185222019"><a name="p17377185222019"></a><a name="p17377185222019"></a>grid-container, grid-row, grid-col</p>
88</td>
89</tr>
90</tbody>
91</table>
92
93## Repositories Involved<a name="section1447164910172"></a>
94
95JS UI framework
96
97**ace\_ace\_engine**
98
99ace\_engine\_lite
100
101ace\_napi
102
103

README_zh.md

1# JS UI框架组件<a name="ZH-CN_TOPIC_0000001076213364"></a>
2
3-   [简介](#section15701932113019)
4-   [目录](#section1791423143211)
5-   [使用场景](#section171384529150)
6-   [接口说明](#section271831717166)
7-   [涉及仓](#section1447164910172)
8
9## 简介<a name="section15701932113019"></a>
10
11JS UI框架是OpenHarmony UI开发框架,提供基础类、容器类、画布类等UI组件和标准CSS动画能力,支持类Web范式编程。
12
13-   **类Web范式编程**
14
15    JS UI框架采用类HTML和CSS Web编程语言作为页面布局和页面样式的开发语言,页面业务逻辑则支持ECMAScript规范的JavaScript语言。JS UI框架提供的类Web编程范式,可以让开发者避免编写UI状态切换的代码,视图配置信息更加直观。
16
17
18**图 1**  JS UI框架架构<a name="fig2606133765017"></a>
19![](figures/JS-UI框架架构.png "JS-UI框架架构")
20
21JS UI框架包括应用层(Application)、前端框架层(Framework)、引擎层(Engine)和平台适配层(Porting Layer)。
22
23-   **Application**
24
25    应用层表示开发者使用JS UI框架开发的FA应用,这里的FA应用特指JS FA应用。
26
27-   **Framework**
28
29    前端框架层主要完成前端页面解析,以及提供MVVM(Model-View-ViewModel)开发模式、页面路由机制和自定义组件等能力。
30
31-   **Engine**
32
33    引擎层主要提供动画解析、DOM(Document Object Model)树构建、布局计算、渲染命令构建与绘制、事件管理等能力。
34
35-   **Porting Layer**
36
37    适配层主要完成对平台层进行抽象,提供抽象接口,可以对接到系统平台。比如:事件对接、渲染管线对接和系统生命周期对接等。
38
39
40## 目录<a name="section1791423143211"></a>
41
42JS UI开发框架源代码在/foundation/ace/ace\_engine下,目录结构如下图所示:
43
44```
45/foundation/ace/ace_engine
46├── adapter                       # 平台适配目录
47│   ├── common
48│   └── ohos
49├── frameworks                    # 框架代码
50│   ├── base                      # 基础库
51│   ├── bridge                    # 前后端组件对接层
52│   └── core                      # 核心组件目录
53```
54
55## 使用场景<a name="section171384529150"></a>
56
57JS UI框架提供了丰富的、功能强大的UI组件、样式定义,组件之间相互独立,随取随用,也可以在需求相同的地方重复使用。开发者还可以通过组件间合理的搭配定义满足业务需求的新组件,减少开发量。
58
59## 接口说明<a name="section271831717166"></a>
60
61**表 1**  组件介绍
62
63<a name="table2347172925617"></a>
64<table><thead align="left"><tr id="row5347429155610"><th class="cellrowborder" valign="top" width="28.64%" id="mcps1.2.3.1.1"><p id="p1347102910567"><a name="p1347102910567"></a><a name="p1347102910567"></a>组件类型</p>
65</th>
66<th class="cellrowborder" valign="top" width="71.36%" id="mcps1.2.3.1.2"><p id="p83475294565"><a name="p83475294565"></a><a name="p83475294565"></a>主要组件</p>
67</th>
68</tr>
69</thead>
70<tbody><tr id="row15347122918562"><td class="cellrowborder" valign="top" width="28.64%" headers="mcps1.2.3.1.1 "><p id="p679795614335"><a name="p679795614335"></a><a name="p679795614335"></a>基础组件</p>
71</td>
72<td class="cellrowborder" valign="top" width="71.36%" headers="mcps1.2.3.1.2 "><p id="p88813982011"><a name="p88813982011"></a><a name="p88813982011"></a>button、text、input、label、image、progress、rating、span、marquee、image-animator、divider、menu、chart、option、picker、picker-view、piece、qrcode、select、slider、switch、toolbar、toolbar-item、toggle</p>
73</td>
74</tr>
75<tr id="row1973535793115"><td class="cellrowborder" valign="top" width="28.64%" headers="mcps1.2.3.1.1 "><p id="p8735195713313"><a name="p8735195713313"></a><a name="p8735195713313"></a>容器组件</p>
76</td>
77<td class="cellrowborder" valign="top" width="71.36%" headers="mcps1.2.3.1.2 "><p id="p1268024618208"><a name="p1268024618208"></a><a name="p1268024618208"></a>div、list、list-item、list-item-group、stack、swiper、tabs、tab-bar、tab-content、refresh、dialog、badge、panel、popup、stepper、stepper-item</p>
78</td>
79</tr>
80<tr id="row1792218915320"><td class="cellrowborder" valign="top" width="28.64%" headers="mcps1.2.3.1.1 "><p id="p692289163220"><a name="p692289163220"></a><a name="p692289163220"></a>画布组件</p>
81</td>
82<td class="cellrowborder" valign="top" width="71.36%" headers="mcps1.2.3.1.2 "><p id="p199228910327"><a name="p199228910327"></a><a name="p199228910327"></a>canvas</p>
83</td>
84</tr>
85<tr id="row837615526208"><td class="cellrowborder" valign="top" width="28.64%" headers="mcps1.2.3.1.1 "><p id="p4377752152016"><a name="p4377752152016"></a><a name="p4377752152016"></a>栅格组件</p>
86</td>
87<td class="cellrowborder" valign="top" width="71.36%" headers="mcps1.2.3.1.2 "><p id="p17377185222019"><a name="p17377185222019"></a><a name="p17377185222019"></a>grid-container、grid-row、grid-col</p>
88</td>
89</tr>
90</tbody>
91</table>
92
93## 涉及仓<a name="section1447164910172"></a>
94
95JS UI框架子系统
96
97**ace\_ace\_engine**
98
99ace\_engine\_lite
100
101ace\_napi
102
103