@cloudbase/weda-ui 0.2.16 → 1.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -169
- package/package.json +23 -11
- package/src/configs/components/calendar.json +4 -1
- package/src/configs/components/chart/bar.json +724 -0
- package/src/configs/components/chart/line.json +679 -0
- package/src/configs/components/chart/pie.json +497 -0
- package/src/configs/components/chart/statisticsCard.json +61 -13
- package/src/configs/components/container.json +7 -2
- package/src/configs/components/dataView.json +21 -6
- package/src/configs/components/form/checkbox.json +97 -5
- package/src/configs/components/form/radio.json +96 -4
- package/src/configs/components/form/select.json +245 -11
- package/src/configs/components/graphicCard.json +84 -73
- package/src/configs/components/image.json +7 -2
- package/src/configs/components/link.json +19 -3
- package/src/configs/components/listView.json +65 -18
- package/src/configs/components/lottery.json +151 -0
- package/src/configs/components/modal.json +37 -5
- package/src/configs/components/navLayout.json +87 -75
- package/src/configs/components/navigationBar.json +59 -0
- package/src/configs/components/richtextview.json +4 -1
- package/src/configs/components/scrollVeiw.json +74 -22
- package/src/configs/components/swiper.json +4 -1
- package/src/configs/components/tabs.json +51 -8
- package/src/configs/components/text.json +33 -25
- package/src/configs/components/wxOpenApi/phone.json +141 -0
- package/src/configs/components/wxOpenApi/phoneCode.json +121 -0
- package/src/configs/components/wxOpenApi/share.json +167 -0
- package/src/configs/components/wxOpenApi/userInfo.json +174 -0
- package/src/configs/index.js +20 -0
- package/src/index.js +2 -0
- package/src/mp/components/button/index.wxml +1 -2
- package/src/mp/components/chart/bar/index.js +258 -0
- package/src/mp/components/chart/bar/index.json +6 -0
- package/src/mp/components/chart/bar/index.wxml +3 -0
- package/src/mp/components/chart/bar/index.wxss +9 -0
- package/src/mp/components/chart/common/config/bar.js +50 -0
- package/src/mp/components/chart/common/config/global.js +16 -0
- package/src/mp/components/chart/common/config/line.js +48 -0
- package/src/mp/components/chart/common/config/pie.js +36 -0
- package/src/mp/components/chart/common/core/eChartBar.js +263 -0
- package/src/mp/components/chart/common/core/eChartBase.js +375 -0
- package/src/mp/components/chart/common/core/eChartLine.js +229 -0
- package/src/mp/components/chart/common/core/eChartPie.js +166 -0
- package/src/mp/components/chart/common/lib/echarts.min.js +18 -0
- package/src/mp/components/chart/ec-canvas/ec-canvas.js +277 -0
- package/src/mp/components/chart/ec-canvas/ec-canvas.json +4 -0
- package/src/mp/components/chart/ec-canvas/ec-canvas.wxml +4 -0
- package/src/mp/components/chart/ec-canvas/ec-canvas.wxss +4 -0
- package/src/mp/components/chart/ec-canvas/wx-canvas.js +107 -0
- package/src/mp/components/chart/line/index.js +247 -0
- package/src/mp/components/chart/line/index.json +6 -0
- package/src/mp/components/chart/line/index.wxml +3 -0
- package/src/mp/components/chart/line/index.wxss +9 -0
- package/src/mp/components/chart/pie/index.js +182 -0
- package/src/mp/components/chart/pie/index.json +6 -0
- package/src/mp/components/chart/pie/index.wxml +4 -0
- package/src/mp/components/chart/pie/index.wxss +9 -0
- package/src/mp/components/chart/statisticsCard/index.js +33 -6
- package/src/mp/components/form/checkbox/index.js +41 -2
- package/src/mp/components/form/checkbox/index.wxml +1 -1
- package/src/mp/components/form/form/index.wxml +1 -2
- package/src/mp/components/form/input/index.js +1 -1
- package/src/mp/components/form/location/index.js +43 -2
- package/src/mp/components/form/radio/index.js +38 -0
- package/src/mp/components/form/select/index.js +348 -40
- package/src/mp/components/form/select/index.wxml +21 -6
- package/src/mp/components/form/select/region/index.js +101 -0
- package/src/mp/components/form/textarea/index.wxml +6 -5
- package/src/mp/components/form/uploader/index.js +76 -44
- package/src/mp/components/form/uploader/index.wxml +15 -3
- package/src/mp/components/form/uploaderFile/index.js +61 -29
- package/src/mp/components/graphicCard/index.js +26 -28
- package/src/mp/components/listView/index.js +52 -64
- package/src/mp/components/listView/index.wxml +2 -2
- package/src/mp/components/listView/index.wxss +5 -0
- package/src/mp/components/lottery/index.js +270 -0
- package/src/mp/components/lottery/index.json +4 -0
- package/src/mp/components/lottery/index.wxml +43 -0
- package/src/mp/components/lottery/index.wxss +317 -0
- package/src/mp/components/navLayout/index.js +3 -3
- package/src/mp/components/navigationBar/index.js +193 -0
- package/src/mp/components/navigationBar/index.json +6 -0
- package/src/mp/components/navigationBar/index.wxml +88 -0
- package/src/mp/components/navigationBar/index.wxss +1257 -0
- package/src/mp/components/tabs/index.js +7 -2
- package/src/mp/components/tabs/index.wxml +2 -1
- package/src/mp/components/text/index.js +0 -25
- package/src/mp/components/text/index.wxml +3 -3
- package/src/mp/components/wxOpenApi/phone/index.js +117 -0
- package/src/mp/components/wxOpenApi/phone/index.json +4 -0
- package/src/mp/components/wxOpenApi/phone/index.wxml +15 -0
- package/src/mp/components/wxOpenApi/phone/index.wxss +22 -0
- package/src/mp/components/wxOpenApi/phoneCode/index.js +89 -0
- package/src/mp/components/wxOpenApi/phoneCode/index.json +4 -0
- package/src/mp/components/wxOpenApi/phoneCode/index.wxml +15 -0
- package/src/mp/components/wxOpenApi/phoneCode/index.wxss +22 -0
- package/src/mp/components/wxOpenApi/share/index.js +117 -0
- package/src/mp/components/wxOpenApi/share/index.json +4 -0
- package/src/mp/components/wxOpenApi/share/index.wxml +15 -0
- package/src/mp/components/wxOpenApi/share/index.wxss +22 -0
- package/src/mp/components/wxOpenApi/userInfo/index.js +88 -0
- package/src/mp/components/wxOpenApi/userInfo/index.json +4 -0
- package/src/mp/components/wxOpenApi/userInfo/index.wxml +14 -0
- package/src/mp/components/wxOpenApi/userInfo/index.wxss +22 -0
- package/src/mp/index.json +10 -1
- package/src/mp/style/weda-ui.wxss +2 -0
- package/src/mp/utils/constant.js +15 -0
- package/src/mp/utils/destr.js +48 -0
- package/src/mp/utils/lodash.js +2 -0
- package/src/mp/utils/platform.js +25 -0
- package/src/mp/utils/tcb.js +44 -0
- package/src/setupTests.js +2 -1
- package/src/web/components/button/index.css +8 -1
- package/src/web/components/button/index.tsx +3 -2
- package/src/web/components/chart/bar/index.tsx +140 -0
- package/src/web/components/chart/common/config/bar.js +49 -0
- package/src/web/components/chart/common/config/global.js +16 -0
- package/src/web/components/chart/common/config/line.js +50 -0
- package/src/web/components/chart/common/config/pie.js +37 -0
- package/src/web/components/chart/common/core/eChartBar.js +265 -0
- package/src/web/components/chart/common/core/eChartBase.ts +383 -0
- package/src/web/components/chart/common/core/eChartLine.js +231 -0
- package/src/web/components/chart/common/core/eChartPie.js +170 -0
- package/src/web/components/chart/common/core/type.ts +34 -0
- package/src/web/components/chart/common/echart.css +106 -0
- package/src/web/components/chart/common/echarts.ts +33 -0
- package/src/web/components/chart/common/useChart.tsx +69 -0
- package/src/web/components/chart/line/index.tsx +136 -0
- package/src/web/components/chart/pie/index.tsx +99 -0
- package/src/web/components/chart/statisticsCard/index.tsx +29 -8
- package/src/web/components/form/checkbox/index.tsx +61 -23
- package/src/web/components/form/formcell/index.tsx +10 -5
- package/src/web/components/form/location/components/LocationH5/location.h5.jsx +3 -3
- package/src/web/components/form/location/components/LocationPC/location.PC.jsx +2 -2
- package/src/web/components/form/radio/index.tsx +90 -53
- package/src/web/components/form/select/h5.tsx +371 -72
- package/src/web/components/form/select/index.css +10 -0
- package/src/web/components/form/select/index.tsx +392 -145
- package/src/web/components/form/select/region/index.ts +122 -31
- package/src/web/components/form/select/time.jsx +90 -0
- package/src/web/components/form/select/year.tsx +170 -0
- package/src/web/components/form/tips/index.css +4 -0
- package/src/web/components/form/tips/index.tsx +4 -3
- package/src/web/components/form/uploader/uploader.h5.tsx +28 -19
- package/src/web/components/form/uploader/uploader.pc.tsx +17 -20
- package/src/web/components/form/uploaderFile/uploadFile.h5.tsx +48 -44
- package/src/web/components/form/uploaderFile/uploadFile.pc.tsx +28 -26
- package/src/web/components/graphicCard/index.css +1 -5
- package/src/web/components/graphicCard/index.tsx +4 -3
- package/src/web/components/image/image.tsx +1 -1
- package/src/web/components/image/index.tsx +1 -1
- package/src/web/components/index.js +13 -2
- package/src/web/components/link/index.tsx +6 -3
- package/src/web/components/listView/index.css +4 -0
- package/src/web/components/listView/index.tsx +10 -18
- package/src/web/components/lottery/index.css +327 -0
- package/src/web/components/lottery/index.tsx +567 -0
- package/src/web/components/lottery/lotteryUtil.ts +130 -0
- package/src/web/components/modal/index.tsx +3 -1
- package/src/web/components/navigationBar/chevron-right--double.svg +3 -0
- package/src/web/components/navigationBar/common.tsx +198 -0
- package/src/web/components/navigationBar/h5Menu.tsx +179 -0
- package/src/web/components/navigationBar/horizontalMenu.tsx +200 -0
- package/src/web/components/navigationBar/index.css +762 -0
- package/src/web/components/navigationBar/index.tsx +231 -0
- package/src/web/components/navigationBar/type.d.ts +111 -0
- package/src/web/components/navigationBar/verticalMenu.tsx +81 -0
- package/src/web/components/phone/index.css +0 -0
- package/src/web/components/phone/index.tsx +22 -0
- package/src/web/components/phoneCode/index.css +0 -0
- package/src/web/components/phoneCode/index.tsx +22 -0
- package/src/web/components/richTextView/index.tsx +3 -5
- package/src/web/components/share/index.css +0 -0
- package/src/web/components/share/index.tsx +38 -0
- package/src/web/components/tabs/index.tsx +2 -0
- package/src/web/components/tabs/tabs.h5.tsx +43 -33
- package/src/web/components/tabs/tabs.pc.tsx +23 -10
- package/src/web/components/text/index.tsx +6 -14
- package/src/web/components/userInfo/index.css +0 -0
- package/src/web/components/userInfo/index.tsx +30 -0
- package/src/web/utils/{constant.js → constant.ts} +17 -2
- package/src/web/utils/lodash.ts +2 -0
- package/src/web/utils/platform.js +10 -1
- package/src/web/utils/tcb.js +20 -6
- package/src/web/weda-ui.css +2 -0
- package/CHANGELOG.md +0 -240
- package/src/.DS_Store +0 -0
- package/src/configs/.DS_Store +0 -0
- package/src/mp/.gitignore +0 -10
- package/src/web/.DS_Store +0 -0
- package/src/web/components/form/select/region/cities.ts +0 -2410
- package/src/web/components/form/select/region/provinces.ts +0 -240
- package/src/web/components/form/select/region/regions.ts +0 -20645
package/README.md
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 腾讯云微搭低代码-官方组件库
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
包含微搭低代码平台基础的源码组件和基于源码组件开发的低码组件。
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
## 组件库
|
|
8
|
-
|
|
9
|
-
微搭组件库使用各平台/框架标准的组件格式,通过类型文件描述好组件的行为、出参、入参及元数据等信息和微搭平台做对接。
|
|
5
|
+
微搭组件库使用各平台/框架标准的组件格式,通过类型文件描述好组件的行为、出参、入参及元数据等信息和微搭平台做对接。当前支持在小程序和 web 平台上使用。
|
|
10
6
|
|
|
11
7
|
**多平台原生实现**
|
|
12
8
|
|
|
13
|
-
为了保证良好的性能,当前微搭平台没有对小程序和 web
|
|
9
|
+
为了保证良好的性能,当前微搭平台没有对小程序和 web 做跨端的自动适配。目前采用多平台原生实现。
|
|
14
10
|
|
|
15
11
|
## 项目目录
|
|
16
12
|
|
|
@@ -21,41 +17,38 @@
|
|
|
21
17
|
├── lowcode-comps # 低码组件内容
|
|
22
18
|
└── src
|
|
23
19
|
├── test # 测试目录
|
|
24
|
-
├── configs #
|
|
25
|
-
│ ├── actions #
|
|
26
|
-
│ ├── components #
|
|
27
|
-
│ └── index.js #
|
|
20
|
+
├── configs # 组件类型声明目录
|
|
21
|
+
│ ├── actions # 组件库方法类型声明
|
|
22
|
+
│ ├── components # 组件类型声明
|
|
23
|
+
│ └── index.js # 组件类型声明入口
|
|
28
24
|
├── mp # 小程序组件
|
|
29
25
|
│ ├── actions # 小程序组件方法实现
|
|
30
26
|
│ ├── components # 小程序组件实现
|
|
31
27
|
│ └── index.json # 小程序组件入口
|
|
32
28
|
├── stories # 组件 story / 测试
|
|
33
|
-
└── web # web
|
|
29
|
+
└── web # web 组件
|
|
34
30
|
├── actions # web 组件方法实现
|
|
35
31
|
├── components # web 组件实现
|
|
36
32
|
└── index.js # web 组件入口
|
|
33
|
+
├── cloudbaserc.json # 组件库配置文件
|
|
37
34
|
```
|
|
38
35
|
|
|
39
|
-
## 组件库配置
|
|
40
|
-
|
|
41
|
-
当前使用 `cloudbaserc.json` 文件来申明组件库配置。
|
|
42
|
-
|
|
43
36
|
## 开发
|
|
44
37
|
|
|
45
38
|
组件库开发前置依赖:
|
|
46
39
|
|
|
47
|
-
1. 进入组件库根目录,安装依赖: `npx npm@6 i` 使用 `npm@6` 安装依赖可能会有依赖冲突问题,可以使用 `npm i --legacy-peer-deps` 来解决。用npm@6 是为了跟构建保持一致
|
|
40
|
+
1. 进入组件库根目录,安装依赖: `npx npm@6 i` 使用 `npm@6` 安装依赖可能会有依赖冲突问题,可以使用 `npm i --legacy-peer-deps` 来解决。用 npm@6 是为了跟构建保持一致
|
|
48
41
|
2. 安装云开发命令行工具:`npm i -g @cloudbase/cli` or `yarn global add @cloudbase/cli`
|
|
49
42
|
3. 登录云开发命令行:`tcb login` 并输入密码
|
|
50
|
-
4.
|
|
43
|
+
4. 在腾讯云微搭低码控制台创建组件库,库名应该和 cloudbaserc.json 配置的 `name` 中一致(默认是`weda`)
|
|
51
44
|
|
|
52
|
-
> 下面的内容是源码组件库的开发文档,低码组件库开发请查看[lowcode-comps下的文档](lowcode-comps/README.md)
|
|
45
|
+
> 下面的内容是源码组件库的开发文档,低码组件库开发请查看[lowcode-comps 下的文档](lowcode-comps/README.md)
|
|
53
46
|
|
|
54
47
|
### 编写组件
|
|
55
48
|
|
|
56
|
-
|
|
49
|
+
编写能在低码平台运行的组件需要各自平台的**标准组件源码**和**组件描述**。具体可参考 [实现自定义 button 组件 | 云开发 CloudBase - 一站式后端云服务](https://docs.cloudbase.net/lowcode/custom-components/quick-start/comp)
|
|
57
50
|
|
|
58
|
-
####
|
|
51
|
+
#### 处理组件通用属性
|
|
59
52
|
|
|
60
53
|
对于每个组件,除了自己定义的属性生效外,在微搭平台运行时有可能会有些公共属性从平台传入。对于小程序平台组件默认情况下不需要处理这些通用属性,对于 react 组件可以额外的将通用的属性透传到具体实现的节点中。
|
|
61
54
|
如:
|
|
@@ -118,54 +111,20 @@ export default function Container({ children, events, ...args }) {
|
|
|
118
111
|
}
|
|
119
112
|
```
|
|
120
113
|
|
|
121
|
-
####
|
|
114
|
+
#### 调用运行时框架接口
|
|
122
115
|
|
|
123
|
-
|
|
124
|
-
//TODO
|
|
116
|
+
如果在组件中使用低码应用运行时框架提供的工具方法或者数据源相关能力的时候,可以参考 [应用客户端 SDK](https://docs.cloudbase.net/lowcode/framework/app/app) 以及 [在应用中使用数据源及其他后端服务](https://docs.cloudbase.net/lowcode/datasource/usage)
|
|
125
117
|
|
|
126
|
-
####
|
|
118
|
+
#### 编写组件描述文件
|
|
127
119
|
|
|
128
120
|
当前编写的组件都是各个平台的标准组件,他们和微搭低码平台需要一个配置来互相连接起来。
|
|
129
121
|
|
|
130
122
|
组件配置默认存放在 `src/configs` 目录下。
|
|
131
123
|
|
|
132
|
-
|
|
124
|
+
#### 组件代码模版生成
|
|
125
|
+
可以通过 `npm run new` 生成上述文件
|
|
133
126
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
```json
|
|
137
|
-
{
|
|
138
|
-
"$schema": "https://comp-public-1303824488.cos.ap-shanghai.myqcloud.com/schema/lcds_component.json",
|
|
139
|
-
"data": {
|
|
140
|
-
"properties": {
|
|
141
|
-
"text": {
|
|
142
|
-
"title": "文本内容",
|
|
143
|
-
"type": "string",
|
|
144
|
-
"default": "请在此输入内容..",
|
|
145
|
-
"description": "文本内容"
|
|
146
|
-
},
|
|
147
|
-
"maxLines": {
|
|
148
|
-
"title": "最大显示行数",
|
|
149
|
-
"type": "number",
|
|
150
|
-
"description": "显示最大行数",
|
|
151
|
-
"default": 2
|
|
152
|
-
},
|
|
153
|
-
"space": {
|
|
154
|
-
"title": "连续空格",
|
|
155
|
-
"type": "boolean",
|
|
156
|
-
"description": "是否显示连续空格",
|
|
157
|
-
"default": false
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
},
|
|
161
|
-
"events": [{ "title": "点击", "name": "tap" }],
|
|
162
|
-
"meta": {
|
|
163
|
-
"title": "文本",
|
|
164
|
-
"description": "文本内容",
|
|
165
|
-
"category": "基础"
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
```
|
|
127
|
+
### 调试组件库
|
|
169
128
|
|
|
170
129
|
组件编写完成后,在腾讯云微搭低代码编辑器调试组件库,在当前目录执行:
|
|
171
130
|
|
|
@@ -173,115 +132,38 @@ export default function Container({ children, events, ...args }) {
|
|
|
173
132
|
tcb lowcode debug
|
|
174
133
|
```
|
|
175
134
|
|
|
176
|
-
|
|
135
|
+
### 组件自动化测试
|
|
177
136
|
|
|
178
|
-
|
|
179
|
-
tcb lowcode publish
|
|
180
|
-
```
|
|
137
|
+
微搭官方组件库需要单元测试覆盖率达到 80% 以上才能发布,我们集成进了 jest 和 小程序模拟器来协助组件的多端测试。
|
|
181
138
|
|
|
182
|
-
|
|
139
|
+
编写完测试用例后运行 `npm test` 执行测试命令。
|
|
183
140
|
|
|
184
|
-
|
|
141
|
+
组件测试请参考:
|
|
185
142
|
|
|
186
|
-
|
|
143
|
+
- <https://github.com/wechat-miniprogram/miniprogram-simulate>
|
|
144
|
+
- <https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/unit-test.html>
|
|
145
|
+
- <https://jestjs.io/docs/snapshot-testing>
|
|
146
|
+
- <https://storybook.js.org/tutorials/intro-to-storybook/react/en/test/>
|
|
187
147
|
|
|
188
|
-
|
|
148
|
+
### 发布组件库
|
|
189
149
|
|
|
190
|
-
|
|
191
|
-
export default function Container({ children, events, ...args }) {
|
|
192
|
-
function onClick(e) {
|
|
193
|
-
/**
|
|
194
|
-
* 事件数据, 开发者自定义
|
|
195
|
-
* 监听者可以在回调函数的 event.detail 获取到
|
|
196
|
-
*/
|
|
197
|
-
const detail = {
|
|
198
|
-
value: e.target.value,
|
|
199
|
-
};
|
|
200
|
-
/**
|
|
201
|
-
* 事件配置, 目前只有 originEvent
|
|
202
|
-
* 监听者可以在回调函数的 event.originEvent 获取到
|
|
203
|
-
*/
|
|
204
|
-
const option = {
|
|
205
|
-
originEvent: e,
|
|
206
|
-
};
|
|
207
|
-
events.tap(detail, option);
|
|
208
|
-
}
|
|
150
|
+
组件开发完成后,提交组件到微搭低代码平台,该操作会将组件发布在自己的个人账号下,可以在应用中预览
|
|
209
151
|
|
|
210
|
-
return (
|
|
211
|
-
<div onClick={onClick} {...args}>
|
|
212
|
-
{children}
|
|
213
|
-
</div>
|
|
214
|
-
);
|
|
215
|
-
}
|
|
216
152
|
```
|
|
217
|
-
|
|
218
|
-
- 在小程序组件内部触发事件
|
|
219
|
-
|
|
220
|
-
//TODO
|
|
221
|
-
|
|
222
|
-
- 在低码编辑器里绑定事件
|
|
223
|
-
|
|
224
|
-
```js
|
|
225
|
-
export function handleEvent({ event, data }) {
|
|
226
|
-
// 组件内部抛出的 detail
|
|
227
|
-
console.log(event.detail);
|
|
228
|
-
// 组件内部抛出的 option.originEvent
|
|
229
|
-
console.log(event.originEvent);
|
|
230
|
-
}
|
|
153
|
+
tcb lowcode publish
|
|
231
154
|
```
|
|
232
155
|
|
|
233
|
-
|
|
156
|
+
如果需要发布官方组件库,需要在提交 MR 通过后,通过流水线发布 <http://tencent.coding.woa.com/p/CloudBase/ci/job/292970/build/current>
|
|
234
157
|
|
|
235
|
-
|
|
158
|
+
### 更多参考信息
|
|
236
159
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
#### 指定组件的 web 实现入口
|
|
240
|
-
|
|
241
|
-
使用通用的 `import` 和 `export`,在 **web/index.js** 里指定入口。
|
|
242
|
-
|
|
243
|
-
#### 指定组件的小程序实现入口
|
|
244
|
-
|
|
245
|
-
使用组件名和组件路径的方式,在 **mp/index.json** 里指定入口。
|
|
246
|
-
|
|
247
|
-
- 以小程序自定义组件的方式,实现组件
|
|
248
|
-
|
|
249
|
-
```json
|
|
250
|
-
// 复杂写法, 不推荐
|
|
251
|
-
{
|
|
252
|
-
"components": {
|
|
253
|
-
"Button": {
|
|
254
|
-
"type": "custom",
|
|
255
|
-
"path": "components/button/index"
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
// 简单写法, 推荐
|
|
260
|
-
{
|
|
261
|
-
"components": {
|
|
262
|
-
"Button": "components/button/index"
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
```
|
|
266
|
-
|
|
267
|
-
- 以小程序原生组件的方式,关联组件
|
|
268
|
-
|
|
269
|
-
```json
|
|
270
|
-
{
|
|
271
|
-
"components": {
|
|
272
|
-
"Slot": {
|
|
273
|
-
"type": "native",
|
|
274
|
-
"path": "slot"
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
```
|
|
160
|
+
组件开发更多信息请[参考文档](https://docs.cloudbase.net/lowcode/custom-components/quick-start/comps.html)。
|
|
279
161
|
|
|
280
162
|
## 其他
|
|
281
163
|
|
|
282
164
|
为了让你的组件开发工作更加便捷和稳定,我们集成了 [storybook] 及组件测试工具来辅助组件的开发。虽然 storybook 和组件测试不是必须的,我们仍然建议你使用他们来保证组件始终工作正常。
|
|
283
165
|
|
|
284
|
-
### 使用 storybook
|
|
166
|
+
### 使用 storybook 本地预览组件
|
|
285
167
|
|
|
286
168
|
对于 web 组件,我们在模板中集成了 [storybook] 的使用环境。编写 [story] 即可简单的在本地预览组件效果。具体步骤:
|
|
287
169
|
|
|
@@ -292,21 +174,7 @@ export function handleEvent({ event, data }) {
|
|
|
292
174
|
|
|
293
175
|
对于小程序组件,我们不能直接在浏览器中去预览调试。组件编写完成后需要运行 `tcb lowcode debug` 打开组件编辑器,通过组件编辑器中 IDE 预览功能来进行微信开发者工具和手机的真实预览。
|
|
294
176
|
|
|
295
|
-
- 小程序调试需要从编辑器请求中拷包本地构建生成小程序代码,可以参考 http://tapd.oa.com/TCB_new/markdown_wikis/show/#1220422223002075389
|
|
296
|
-
|
|
297
|
-
### 组件测试
|
|
298
|
-
|
|
299
|
-
我们建议你为你的定义组件编写必要的测试。我们集成进了 jest 和 小程序模拟器来协助组件的多端测试。
|
|
300
|
-
对于 web 组件我们建议利用编写的 [story 来进行组件测试](https://storybook.js.org/docs/react/workflows/testing-with-storybook)。
|
|
301
|
-
|
|
302
|
-
编写完测试用例后运行 `npm test` 执行测试命令。
|
|
303
|
-
|
|
304
|
-
组件测试请参考:
|
|
305
|
-
|
|
306
|
-
- https://github.com/wechat-miniprogram/miniprogram-simulate
|
|
307
|
-
- https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/unit-test.html
|
|
308
|
-
- https://jestjs.io/docs/snapshot-testing
|
|
309
|
-
- https://storybook.js.org/tutorials/intro-to-storybook/react/en/test/
|
|
177
|
+
- 小程序调试需要从编辑器请求中拷包本地构建生成小程序代码,可以参考 <http://tapd.oa.com/TCB_new/markdown_wikis/show/#1220422223002075389>
|
|
310
178
|
|
|
311
179
|
[腾讯云微搭低代码]: (https://cloud.tencent.com/product/weda)
|
|
312
180
|
[小程序组件]: (https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/)
|
|
@@ -314,3 +182,7 @@ export function handleEvent({ event, data }) {
|
|
|
314
182
|
[storybook]: (https://storybook.js.org/)
|
|
315
183
|
[http 调用]: (https://developers.weixin.qq.com/miniprogram/dev/devtools/http.html)
|
|
316
184
|
[story]: (https://storybook.js.org/docs/react/get-started/whats-a-story)
|
|
185
|
+
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
```
|
package/package.json
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/weda-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.24",
|
|
4
4
|
"main": "./src/index.js",
|
|
5
5
|
"module": "./src/index",
|
|
6
6
|
"miniprogram": "mpdist",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": "^14.13.1 || >=16.0.0"
|
|
9
|
+
},
|
|
7
10
|
"files": [
|
|
8
11
|
"src",
|
|
9
12
|
"!src/test",
|
|
@@ -19,8 +22,8 @@
|
|
|
19
22
|
"dev": "tcb lowcode debug",
|
|
20
23
|
"build:cli": "tcb lowcode build",
|
|
21
24
|
"build:analyze": "cross-env ANALYZER=1 tcb lowcode build",
|
|
22
|
-
"test": "jest test --env=jsdom",
|
|
23
|
-
"test:jest": "jest test --env=jsdom",
|
|
25
|
+
"test": "jest test --env=jsdom --detectOpenHandles",
|
|
26
|
+
"test:jest": "jest test --env=jsdom --detectOpenHandles",
|
|
24
27
|
"test:watch": "jest test --env=jsdom --watch",
|
|
25
28
|
"test:e2e": "npx cypress run-ct",
|
|
26
29
|
"test:all": "npm run test && npm run test:e2e",
|
|
@@ -41,7 +44,8 @@
|
|
|
41
44
|
"build-npm": "rimraf dist && mkdir dist && cp -r src/web dist/ && cp -r src/configs dist/ && cp src/index.js dist/",
|
|
42
45
|
"build-mp": "rimraf mpdist && cp -r src/mp mpdist",
|
|
43
46
|
"clear:snap": "rimraf ./src/test/__snapshots__",
|
|
44
|
-
"size": "npm run build:cli && size-limit"
|
|
47
|
+
"size": "npm run build:cli && size-limit",
|
|
48
|
+
"new": "npx hygen comp new"
|
|
45
49
|
},
|
|
46
50
|
"keywords": [
|
|
47
51
|
"weda",
|
|
@@ -54,12 +58,14 @@
|
|
|
54
58
|
"dependencies": {
|
|
55
59
|
"@cloudbase/ui-react": "^1.0.4",
|
|
56
60
|
"@loadable/component": "^5.15.2",
|
|
57
|
-
"@react-hookz/web": "^12.
|
|
61
|
+
"@react-hookz/web": "^12.3.0",
|
|
58
62
|
"@tcwd/style-wedatheme": "^1.0.0",
|
|
59
63
|
"@use-gesture/react": "^10.2.4",
|
|
60
64
|
"braft-editor": "^2.3.9",
|
|
61
65
|
"braft-utils": "^3.0.12",
|
|
62
66
|
"dayjs": "^1.10.7",
|
|
67
|
+
"destr": "^1.1.1",
|
|
68
|
+
"echarts": "^5.3.0",
|
|
63
69
|
"lodash.isequal": "^4.5.0",
|
|
64
70
|
"object.fromentries": "^2.0.5",
|
|
65
71
|
"prop-types": "^15.7.2",
|
|
@@ -78,12 +84,13 @@
|
|
|
78
84
|
"@babel/preset-env": "^7.16.5",
|
|
79
85
|
"@babel/preset-react": "^7.16.5",
|
|
80
86
|
"@babel/preset-typescript": "^7.16.5",
|
|
87
|
+
"@cloudbase/cli": "^1.12.4",
|
|
81
88
|
"@cloudbase/lowcode-build-dependence": "^0.9.0",
|
|
82
89
|
"@commitlint/cli": "^16.0.2",
|
|
83
90
|
"@commitlint/config-conventional": "^13.2.0",
|
|
84
91
|
"@cypress/code-coverage": "^3.9.12",
|
|
85
92
|
"@cypress/react": "^5.12.1",
|
|
86
|
-
"@cypress/webpack-dev-server": "
|
|
93
|
+
"@cypress/webpack-dev-server": "~1.8.0",
|
|
87
94
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
|
88
95
|
"@size-limit/preset-big-lib": "^7.0.5",
|
|
89
96
|
"@storybook/addon-actions": "^6.4.9",
|
|
@@ -97,16 +104,19 @@
|
|
|
97
104
|
"@types/jest": "^27.0.3",
|
|
98
105
|
"@types/resize-observer-browser": "^0.1.6",
|
|
99
106
|
"@typescript-eslint/eslint-plugin": "^5.9.0",
|
|
100
|
-
"@typescript-eslint/parser": "^5.
|
|
107
|
+
"@typescript-eslint/parser": "^5.21.0",
|
|
101
108
|
"babel-jest": "^27.4.5",
|
|
102
109
|
"babel-loader": "^8.2.3",
|
|
103
110
|
"babel-plugin-istanbul": "^6.1.1",
|
|
111
|
+
"canvas": "^2.9.0",
|
|
104
112
|
"cross-env": "^7.0.3",
|
|
105
|
-
"cypress": "
|
|
113
|
+
"cypress": "~9.5.1",
|
|
106
114
|
"eslint": "^8.9.0",
|
|
107
115
|
"eslint-config-tencent": "^1.0.3",
|
|
116
|
+
"eslint-import-resolver-typescript": "^2.7.1",
|
|
108
117
|
"eslint-plugin-cypress": "^2.12.1",
|
|
109
|
-
"eslint-plugin-
|
|
118
|
+
"eslint-plugin-import": "^2.26.0",
|
|
119
|
+
"eslint-plugin-jest": "^26.1.2",
|
|
110
120
|
"eslint-plugin-react": "^7.28.0",
|
|
111
121
|
"eslint-plugin-rulesdir": "^0.2.1",
|
|
112
122
|
"husky": "^7.0.4",
|
|
@@ -119,6 +129,7 @@
|
|
|
119
129
|
"react-dom": "^17.0.2",
|
|
120
130
|
"react-scripts": "^4.0.3",
|
|
121
131
|
"react-test-renderer": "^17.0.2",
|
|
132
|
+
"regenerator-runtime": "^0.13.9",
|
|
122
133
|
"rimraf": "^3.0.2",
|
|
123
134
|
"size-limit": "^7.0.5",
|
|
124
135
|
"ts-jest": "^27.1.1",
|
|
@@ -126,7 +137,8 @@
|
|
|
126
137
|
"typescript": "^4.5.4",
|
|
127
138
|
"webpack": "4.44.2",
|
|
128
139
|
"webpack-cli": "^4.9.1",
|
|
129
|
-
"webpack-dev-server": "^4.7.3"
|
|
140
|
+
"webpack-dev-server": "^4.7.3",
|
|
141
|
+
"zx": "^5.2.0"
|
|
130
142
|
},
|
|
131
143
|
"nano-staged": {
|
|
132
144
|
"*.{js,jsx,ts,tsx}": [
|
|
@@ -137,7 +149,7 @@
|
|
|
137
149
|
{
|
|
138
150
|
"path": ".temp/dist/*.main.*",
|
|
139
151
|
"webpack": false,
|
|
140
|
-
"limit": "
|
|
152
|
+
"limit": "1000 KB"
|
|
141
153
|
}
|
|
142
154
|
],
|
|
143
155
|
"nyc": {
|
|
@@ -68,8 +68,11 @@
|
|
|
68
68
|
"meta": {
|
|
69
69
|
"name": "Calendar",
|
|
70
70
|
"title": "日历",
|
|
71
|
-
"description": "
|
|
71
|
+
"description": "用于日历展示,例如考勤数据展示、日程展示。",
|
|
72
72
|
"category": "展示",
|
|
73
73
|
"icon": "https://imgcache.qq.com/qcloud/lowcode/static/ide/left-material-icon/Calendar.svg"
|
|
74
|
+
},
|
|
75
|
+
"configMeta": {
|
|
76
|
+
"docsUrl": "https://docs.cloudbase.net/lowcode/components/wedaUI/src/docs/compsdocs/show/Calendar"
|
|
74
77
|
}
|
|
75
78
|
}
|