├── .babelrc
├── .editorconfig
├── .eslintrc
├── .github
├── ISSUE_TEMPLATE
│ ├── bug_report.md
│ ├── feature_request.md
│ └── new_component_request.md
└── PULL_REQUEST_TEMPLATE.md
├── .gitignore
├── .vscode
└── settings.json
├── CHANGELOG.md
├── LICENSE
├── QQGroup.png
├── README.md
├── README_EN.md
├── demoImg
├── construction-data.jpg
├── electronic-file.jpg
└── manage-desk.jpg
├── icon.png
├── package.json
├── rollup.config.js
├── src
├── .eslintrc
├── components
│ ├── activeRingChart
│ │ ├── index.js
│ │ └── style.less
│ ├── borderBox1
│ │ ├── index.js
│ │ └── style.less
│ ├── borderBox10
│ │ ├── index.js
│ │ └── style.less
│ ├── borderBox11
│ │ ├── index.js
│ │ └── style.less
│ ├── borderBox12
│ │ ├── index.js
│ │ └── style.less
│ ├── borderBox13
│ │ ├── index.js
│ │ └── style.less
│ ├── borderBox2
│ │ ├── index.js
│ │ └── style.less
│ ├── borderBox3
│ │ ├── index.js
│ │ └── style.less
│ ├── borderBox4
│ │ ├── index.js
│ │ └── style.less
│ ├── borderBox5
│ │ ├── index.js
│ │ └── style.less
│ ├── borderBox6
│ │ ├── index.js
│ │ └── style.less
│ ├── borderBox7
│ │ ├── index.js
│ │ └── style.less
│ ├── borderBox8
│ │ ├── index.js
│ │ └── style.less
│ ├── borderBox9
│ │ ├── index.js
│ │ └── style.less
│ ├── capsuleChart
│ │ ├── index.js
│ │ └── style.less
│ ├── charts
│ │ ├── index.js
│ │ └── style.less
│ ├── conicalColumnChart
│ │ ├── index.js
│ │ └── style.less
│ ├── decoration1
│ │ ├── index.js
│ │ └── style.less
│ ├── decoration10
│ │ ├── index.js
│ │ └── style.less
│ ├── decoration11
│ │ ├── index.js
│ │ └── style.less
│ ├── decoration12
│ │ ├── index.js
│ │ └── style.less
│ ├── decoration2
│ │ ├── index.js
│ │ └── style.less
│ ├── decoration3
│ │ ├── index.js
│ │ └── style.less
│ ├── decoration4
│ │ ├── index.js
│ │ └── style.less
│ ├── decoration5
│ │ ├── index.js
│ │ └── style.less
│ ├── decoration6
│ │ ├── index.js
│ │ └── style.less
│ ├── decoration7
│ │ ├── index.js
│ │ └── style.less
│ ├── decoration8
│ │ ├── index.js
│ │ └── style.less
│ ├── decoration9
│ │ ├── index.js
│ │ └── style.less
│ ├── digitalFlop
│ │ ├── index.js
│ │ └── style.less
│ ├── flylineChart
│ │ ├── index.js
│ │ └── style.less
│ ├── flylineChartEnhanced
│ │ ├── index.js
│ │ └── style.less
│ ├── fullScreenContainer
│ │ ├── index.js
│ │ └── style.less
│ ├── loading
│ │ ├── index.js
│ │ └── style.less
│ ├── percentPond
│ │ ├── index.js
│ │ └── style.less
│ ├── scrollBoard
│ │ ├── index.js
│ │ └── style.less
│ ├── scrollRankingBoard
│ │ ├── index.js
│ │ └── style.less
│ └── waterLevelPond
│ │ ├── index.js
│ │ └── style.less
├── index.js
├── test.js
├── use
│ └── autoResize.js
└── util
│ └── index.js
└── umdExample.html
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [
3 | ["env", {
4 | "modules": false
5 | }],
6 | "stage-0",
7 | "react"
8 | ]
9 | }
10 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | charset = utf-8
5 | indent_style = space
6 | indent_size = 2
7 | end_of_line = lf
8 | insert_final_newline = true
9 | trim_trailing_whitespace = true
10 |
--------------------------------------------------------------------------------
/.eslintrc:
--------------------------------------------------------------------------------
1 | {
2 | "parser": "babel-eslint",
3 | "extends": ["standard", "standard-react"],
4 | "env": {
5 | "es6": true
6 | },
7 | "plugins": ["react"],
8 | "parserOptions": {
9 | "sourceType": "module"
10 | },
11 | "rules": {
12 | // don't force es6 functions to include space before paren
13 | "space-before-function-paren": 0,
14 |
15 | // allow specifying true explicitly for boolean props
16 | "react/jsx-boolean-value": 0
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: 提交Bug反馈
4 | ---
5 |
6 |
7 |
8 |
9 |
10 | ## Bug report
11 |
12 | #### 出现Bug的组件?
13 |
14 | #### 组件配置数据?
15 |
16 |
17 | #### 控制台错误输出?
18 |
19 |
20 | #### 期望情况?
21 |
22 | #### 实际情况?
23 |
24 | #### 其他相关信息
25 |
26 | - DataV版本
27 | - 浏览器版本
28 | - 其他
29 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: 新特性建议
4 | ---
5 |
6 |
7 |
8 | ## Feature request
9 |
10 | #### 这个特性解决了什么问题?
11 |
12 | #### 这个特性的实现形式?
13 |
14 | #### 是否愿意为此特性提交PR?
15 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/new_component_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Component request
3 | about: 新组件建议
4 | ---
5 |
6 |
7 |
8 |
9 | ## Component request
10 |
11 | #### 新组件的类型?
12 |
13 | * [ ] 边框
14 | * [ ] 装饰
15 | * [ ] 图表
16 | * [ ] 其他
17 |
18 | #### 这个组件的功能描述 (边框及装饰类,请提供样图)?
19 |
20 | #### 是否愿意为此组件提交PR?
21 |
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | **该PR的类型是?** (至少选择一个)
4 |
5 | - [ ] Bug修复
6 | - [ ] 新特性
7 | - [ ] 新组件
8 |
9 | **该PR是否向下兼容?** (选择任一)
10 |
11 | - [ ] 是
12 | - [ ] 否
13 |
14 | 如果为否,请描述冲突情况:
15 |
16 | **涉及到的ISSUE:**
17 |
18 | - [ ] 该PR如果涉及到某个ISSUE, 请在PR标题中描述出来 (例如. `fix #xxx[,#xxx]`, "xxx"为ISSUE序号)
19 |
20 | **是否在Chrome浏览器下进行过测试?**
21 |
22 | - [ ] 是
23 | - [ ] 否
24 |
25 | 如果这是一个**新特性**或**新组件**相关的PR,请提供如下信息
26 |
27 | - [ ] 添加该特性或组件的原因
28 | - [ ] 文档应该修改哪些信息
29 | - [ ] 测试相关
30 |
31 | 提交**新特性**或**新组件**前请先发起一个相关的ISSUE请求
32 |
33 | **其他信息:**
34 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | # See https://help.github.com/ignore-files/ for more about ignoring files.
3 |
4 | # dependencies
5 | node_modules
6 |
7 | # builds
8 | build
9 | .rpt2_cache
10 | deploy/config.js
11 | lib
12 | es
13 | umd
14 |
15 | # misc
16 | .DS_Store
17 | .env
18 | .env.local
19 | .env.development.local
20 | .env.test.local
21 | .env.production.local
22 |
23 | npm-debug.log*
24 | yarn-debug.log*
25 | yarn-error.log*
26 | yarn.lock
27 |
28 |
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "eslint.run": "onSave",
3 | "editor.codeActionsOnSave": {
4 | "source.fixAll.eslint": true
5 | }
6 | }
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # 1.2.5-alpha (2020-11-15)
2 |
3 | ### New
4 |
5 | - **decoration12:** New decoration(Radar scan).
6 |
7 | ### Optmization
8 |
9 | - **ScrollBoard:** Reduce redundant node rendering.
10 | - **ScrollRankingBoard:** Reduce redundant node rendering.
11 | - **ScrollRankingBoard:** Add value formatter.
12 | - **BorderBox:** Canonical class name.
13 | - **useAutoResize(hooks):** Add exception prompt.
14 | - **Decoration** add `dur` configuration.
15 | - **ActiveRingChart** add `digitalFlopUnit` configuration.
16 |
17 | # 1.2.4-alpha (2020-7-25)
18 |
19 | ### Bug 修复
20 |
21 | - **scrollBoard:** hover Error [(#9)](https://github.com/DataV-Team/DataV-React/issues/9).
22 |
23 | # 1.2.2-alpha (2020-7-04)
24 |
25 | ### Bug 修复
26 |
27 | - **ScrollRankingBoard:** 计算规则调整 [(#101)](https://github.com/DataV-Team/DataV/pull/101).
28 | - **scrollBoard:** key 生成策略调整 [(#8)](https://github.com/DataV-Team/DataV-React/issues/8).
29 | - **uuid:** uuid 生成策略调整 [(#108)](https://github.com/DataV-Team/DataV/issues/108).
30 |
31 | ### Perfect
32 |
33 | - **DigitalFlop:** 添加 `formatter` 配置.
34 |
35 | # 1.2.0-alpha (2020-6-14)
36 |
37 | ### Perfect
38 |
39 | - **BorderBox:** 添加 `backgroundColor` prop.
40 | - **BorderBox8:** 添加 `reverse` prop.
41 | - **DigitalFlop:** 添加 `rowGap` 配置.
42 | - **ScrollBoard:** 添加 `hoverPause` 配置.
43 | - **CapsuleChart:** 添加 `showValue` 配置.
44 | - **ActiveRightChart:** 添加 `showOriginValue` 配置.
45 |
46 | - **uuid:** 使用 `uuid` 生成唯一 id.
47 |
48 | # 1.1.7-alpha (2020-04-10)
49 |
50 | ### BUG 修复
51 |
52 | - **WaterLevelPond:** 组件切换到后台陷入死循环.
53 | - **CapsuleChart:** 胶囊图数值错误.
54 |
55 | ### Perfect
56 |
57 | - **Component:** 内部使用 useImperativeHandle 的组件默认经过 forwardRef 返回.
58 |
59 | # 1.1.3-alpha (2020-01-17)
60 |
61 | ### BUG 修复
62 |
63 | - **ActiveRingChart:** `parseInt` 精度损失.
64 |
65 | # 1.1.2-alpha (2020-01-10)
66 |
67 | ### Perfect
68 |
69 | - **AtiveRingChart:** 添加 digitalFlopToFixed 配置项.
70 |
71 | # 1.1.1-alpha (2020-01-08)
72 |
73 | ### New
74 |
75 | - **FlylineChartEnhanced:** Enhanced flylineChart .
76 |
77 | # 1.0.10-alpha (2019-12-27)
78 |
79 | ### Perfect
80 |
81 | - **ScrollRankingBoard:** 配置项 sort 控制是否自动排序.
82 | - **ScrollRankingBoard:** 通过 dangerouslySetInnerHTML 渲染 name 数据.
83 |
84 | # 1.0.8-alpha (2019-12-17)
85 |
86 | ### Feature
87 |
88 | - **BorderBox & Decoration:** **Configurable** color.
89 |
90 | ```html
91 |
92 |
93 |
94 | ```
95 |
96 | - **ScrollBoard:** 配置 header index.
97 |
98 | ### New
99 |
100 | - **borderBox11**
101 | - **borderBox12**
102 | - **borderBox13**
103 | - **decoration11**
104 |
105 | # 1.0.7-alpha (2019-10-25)
106 |
107 | ### Perfect
108 |
109 | - **co:** 优化 Generator 异常.
110 | - **export:** 导出 co, useAutoResize.
111 |
112 | # 1.0.5-alpha (2019-10-24)
113 |
114 | ### Perfect
115 |
116 | - **Charts:** 优化内存泄漏.
117 | - **DigitalFlop:** 优化内存泄漏.
118 |
119 | # 1.0.4-alpha (2019-10-24)
120 |
121 | ### Bug 修复
122 |
123 | - **ActiveRingChart:** 优化内存泄漏.
124 |
125 | # 1.0.2-alpha (2019-09-27)
126 |
127 | ### Bug 修复
128 |
129 | - **co:** Generator 自动执行异常.
130 |
131 | ### 优化组件
132 |
133 | - **ActiveRingChart**
134 | - **DigitalFlop**
135 | - **FullScreenContainer**
136 | - **PercentPond**
137 | - **ScrollBoard**
138 | - **ScrollBankingBoard**
139 | - **WaterLevelPond**
140 |
141 | # 1.0.1-alpha (2019-09-24)
142 |
143 | ### Bug 修复
144 |
145 | - **ActiveRingChart:** 由于数据值为 0 而导致计算异常.
146 |
147 | # 1.0.0-alpha (2019-09-23)
148 |
149 | ### 初始化代码
150 |
151 | - **Vue to React:** 转换 **Vue** 组件 为 **React** 组件.
152 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2019-present, DataV-Team
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
--------------------------------------------------------------------------------
/QQGroup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DataV-Team/DataV-React/423998d8ebe6a964db29f2890cfb936d1d8a2e10/QQGroup.png
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [ENGLISH](./README_EN.md)
2 |
3 |
4 |
5 |
6 | DataV-React
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | ## DataV-React 是干什么的?
17 |
18 | - DataV-React 是一个基于**React**的数据可视化组件库(当然也有[Vue 版本](https://github.com/DataV-Team/DataV))
19 | - 提供用于提升页面视觉效果的**SVG**边框和装饰
20 | - 提供常用的**图表**如折线图等
21 | - 飞线图/轮播表等其他组件
22 |
23 | ### 注意事项
24 |
25 | **使用了 React Hooks, 简化了许多内部工作。您需要 React 版本 16.8.0 及以上**
26 |
27 | ### npm 安装
28 |
29 | ```shell
30 | $ npm install @jiaminghi/data-view-react
31 | ```
32 |
33 | ### 使用
34 |
35 | ```js
36 | import * as datav from "@jiaminghi/data-view-react";
37 |
38 | datav.BorderBox1;
39 |
40 | // 或者
41 | import { BorderBox1 } from "@jiaminghi/data-view-react";
42 |
43 | // 按需引入
44 | import BorderBox1 from "@jiaminghi/data-view-react/es/borderBox1";
45 | ```
46 |
47 | 详细文档及示例请移步[HomePage](http://datav-react.jiaminghi.com).
48 |
49 | ### UMD 版
50 |
51 | `UMD`版可直接使用`script`标签引入,引入后通过**datav**命名空间使用对应的组件,引入`data-view-react`前请确保已引入`react 和 react-dom`。
52 |
53 | [UMD 版使用示例](./umdExample.html)
54 |
55 | ### TODO
56 |
57 | * **地图组件**
58 | * **TS**重构组件库底层依赖
59 |
60 | ### 致谢
61 |
62 | 组件库的开发基于个人学习和兴趣,由于技术水平及经验的限制,组件尚有许多不完善之处,如有 BUG 可及时提交[issue](https://github.com/DataV-Team/DataV-React/issues/new?template=bug_report.md)或添加反馈群进行反馈,也欢迎提供指正和建议,感谢各位的支持。
63 |
64 | ### 反馈
65 |
66 | 
67 |
68 | ### Demo
69 |
70 | Demo 页面使用了全屏组件,请 F11 全屏后查看。
71 |
72 | - [施工养护综合数据](http://datav-react.jiaminghi.com/demo/construction-data/index.html)
73 |
74 | 
75 |
76 | - [机电运维管理台](http://datav-react.jiaminghi.com/demo/manage-desk/index.html)
77 |
78 | 
79 |
80 | - [机电设备电子档案](http://datav-react.jiaminghi.com/demo/electronic-file/index.html)
81 |
82 | 
83 |
--------------------------------------------------------------------------------
/README_EN.md:
--------------------------------------------------------------------------------
1 | [中文](./README.md)
2 |
3 |
4 |
5 |
6 | DataV-React
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | ## What is DataV-React?
17 |
18 | - DataV-React is a data **visualization** components library based on **React**(Of course there are also[Vue version](https://github.com/DataV-Team/DataV)).
19 | - Provide cool **SVG** borders and decorations.
20 | - Provide common **charts** such as line chart, etc..
21 | - flying line chart, carousel table and etc.
22 |
23 | ### Precautions
24 |
25 | **Using React Hooks simplifies many internal work. You need React version 16.8.0 and above**
26 |
27 | ### Install with npm
28 |
29 | ```shell
30 | $ npm install @jiaminghi/data-view-react
31 | ```
32 |
33 | ### use
34 |
35 | ```js
36 | import * as datav from "@jiaminghi/data-view-react";
37 |
38 | datav.BorderBox1;
39 |
40 | // or
41 | import { BorderBox1 } from "@jiaminghi/data-view-react";
42 |
43 | // Introduced on demand
44 | import BorderBox1 from "@jiaminghi/data-view-react/es/borderBox1";
45 | ```
46 |
47 | Detailed documents and examples can be viewed on the [HomePage](http://datav-react.jiaminghi.com).
48 |
49 | ### UMD version
50 |
51 | The `UMD` version can be directly imported using the `script` tag. After the introduction, the corresponding component is used through the **datav** namespace. Before introducing `data-view-react`, please ensure that `react and react-dom are introduced.
52 |
53 | [UMD version usage example](./umdExample.html)
54 |
55 | ### TODO
56 |
57 | * **Map Component**
58 | * Refactor underlying dependencies using **TS**.
59 |
60 | ### Acknowledgement
61 |
62 | The development of the component library is based on personal learning and interest. Due to technical level and experience limitations, there are still many imperfections in the components. If there are errors, you can submit [issue](https://github.com/DataV-Team/DataV-React/issues/new?template=bug_report.md) in time or add feedback groups for feedback. Welcome to provide corrections and suggestions. Thank you for your support.
63 |
64 | ### Feedback
65 |
66 | 
67 |
68 | ### Demo
69 |
70 | The Demo page uses the full-screen component, please view it after F11 full screen.
71 |
72 | - [Construction Data](http://datav-react.jiaminghi.com/demo/construction-data/index.html)
73 |
74 | 
75 |
76 | - [Manage-Desk](http://datav-react.jiaminghi.com/demo/manage-desk/index.html)
77 |
78 | 
79 |
80 | - [Electronic-File](http://datav-react.jiaminghi.com/demo/electronic-file/index.html)
81 |
82 | 
83 |
--------------------------------------------------------------------------------
/demoImg/construction-data.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DataV-Team/DataV-React/423998d8ebe6a964db29f2890cfb936d1d8a2e10/demoImg/construction-data.jpg
--------------------------------------------------------------------------------
/demoImg/electronic-file.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DataV-Team/DataV-React/423998d8ebe6a964db29f2890cfb936d1d8a2e10/demoImg/electronic-file.jpg
--------------------------------------------------------------------------------
/demoImg/manage-desk.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DataV-Team/DataV-React/423998d8ebe6a964db29f2890cfb936d1d8a2e10/demoImg/manage-desk.jpg
--------------------------------------------------------------------------------
/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DataV-Team/DataV-React/423998d8ebe6a964db29f2890cfb936d1d8a2e10/icon.png
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@jiaminghi/data-view-react",
3 | "version": "1.2.5",
4 | "description": "React Large screen data display component library",
5 | "author": "Duan Yu <949267840@qq.com>",
6 | "license": "MIT",
7 | "repository": "DataV-Team/DataV-React",
8 | "main": "lib/index/index.js",
9 | "module": "es/index/index.js",
10 | "unpkg": "umd/datav.js",
11 | "engines": {
12 | "node": ">=8",
13 | "npm": ">=5"
14 | },
15 | "scripts": {
16 | "test": "cross-env CI=1 react-scripts test --env=jsdom",
17 | "test:watch": "react-scripts test --env=jsdom",
18 | "build": "rollup -c",
19 | "start": "rollup -c -w",
20 | "prepare": "yarn run build"
21 | },
22 | "dependencies": {
23 | "@jiaminghi/charts": "^0.2"
24 | },
25 | "peerDependencies": {
26 | "react": "^16.8.0",
27 | "react-dom": "^16.8.0"
28 | },
29 | "devDependencies": {
30 | "@svgr/rollup": "^2.4.1",
31 | "babel-core": "^6.26.3",
32 | "babel-eslint": "^8.2.5",
33 | "babel-plugin-external-helpers": "^6.22.0",
34 | "babel-preset-env": "^1.7.0",
35 | "babel-preset-react": "^6.24.1",
36 | "babel-preset-stage-0": "^6.24.1",
37 | "classnames": "^2.2.6",
38 | "cross-env": "^5.1.4",
39 | "eslint": "^5.0.1",
40 | "eslint-config-standard": "^11.0.0",
41 | "eslint-config-standard-react": "^6.0.0",
42 | "eslint-plugin-import": "^2.13.0",
43 | "eslint-plugin-node": "^7.0.1",
44 | "eslint-plugin-promise": "^4.0.0",
45 | "eslint-plugin-react": "^7.10.0",
46 | "eslint-plugin-standard": "^3.1.0",
47 | "less": "^3.10.3",
48 | "prop-types": "^15.7.2",
49 | "react": "^16.8.6",
50 | "react-dom": "^16.8.6",
51 | "react-scripts": "^1.1.4",
52 | "rollup": "^1.21.4",
53 | "rollup-plugin-babel": "^3.0.7",
54 | "rollup-plugin-commonjs": "^9.1.3",
55 | "rollup-plugin-node-resolve": "^3.3.0",
56 | "rollup-plugin-peer-deps-external": "^2.2.0",
57 | "rollup-plugin-postcss": "^1.6.2",
58 | "rollup-plugin-replace": "^2.2.0",
59 | "rollup-plugin-uglify": "^6.0.3",
60 | "rollup-plugin-url": "^1.4.0"
61 | },
62 | "files": [
63 | "src",
64 | "lib",
65 | "es",
66 | "umd"
67 | ]
68 | }
69 |
--------------------------------------------------------------------------------
/rollup.config.js:
--------------------------------------------------------------------------------
1 | import babel from 'rollup-plugin-babel'
2 | import commonjs from 'rollup-plugin-commonjs'
3 | import external from 'rollup-plugin-peer-deps-external'
4 | import postcss from 'rollup-plugin-postcss'
5 | import resolve from 'rollup-plugin-node-resolve'
6 | import replace from 'rollup-plugin-replace'
7 | import { uglify } from 'rollup-plugin-uglify'
8 | import url from 'rollup-plugin-url'
9 | import svgr from '@svgr/rollup'
10 |
11 | // 通过 mode 接口拿到 src/components 下的所有文件夹名作为打包后的模块
12 | const fs = require('fs')
13 | const path = require('path')
14 | const componentDir = 'src/components'
15 | const cModuleNames = fs.readdirSync(path.resolve(componentDir))
16 | const cModuleMap = cModuleNames.reduce((prev, name) => {
17 | prev[name] = `${componentDir}/${name}/index.js`
18 |
19 | return prev
20 | }, {})
21 |
22 | const plugins = [
23 | external(),
24 | postcss(),
25 | url(),
26 | svgr(),
27 | babel({
28 | exclude: 'node_modules/**',
29 | plugins: ['external-helpers']
30 | }),
31 | resolve(),
32 | commonjs()
33 | ]
34 |
35 | export default [
36 | {
37 | input: {
38 | index: 'src/index.js',
39 | ...cModuleMap
40 | },
41 | output: [
42 | {
43 | dir: 'lib',
44 | entryFileNames: '[name]/index.js',
45 | format: 'cjs',
46 | sourcemap: true
47 | },
48 | {
49 | dir: 'es',
50 | entryFileNames: '[name]/index.js',
51 | format: 'es',
52 | sourcemap: true
53 | }
54 | ],
55 | plugins,
56 | experimentalCodeSplitting: true
57 | },
58 | {
59 | input: 'src/index.js',
60 | output: {
61 | format: 'umd',
62 | file: 'umd/datav.js',
63 | name: 'datav'
64 | },
65 | plugins: [...plugins, replace({ 'process.env.NODE_ENV': '"development"' })]
66 | },
67 | {
68 | input: 'src/index.js',
69 | output: {
70 | format: 'umd',
71 | file: 'umd/datav.min.js',
72 | name: 'datav'
73 | },
74 | plugins: [
75 | ...plugins,
76 | replace({ 'process.env.NODE_ENV': '"production"' }),
77 | uglify()
78 | ]
79 | }
80 | ]
81 |
--------------------------------------------------------------------------------
/src/.eslintrc:
--------------------------------------------------------------------------------
1 | {
2 | "env": {
3 | "jest": true
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/src/components/activeRingChart/index.js:
--------------------------------------------------------------------------------
1 | import React, { useRef, useState, useEffect, useMemo } from 'react'
2 |
3 | import PropTypes from 'prop-types'
4 |
5 | import classnames from 'classnames'
6 |
7 | import Charts from '@jiaminghi/charts'
8 |
9 | import { deepMerge } from '@jiaminghi/charts/lib/util/index'
10 |
11 | import { deepClone } from '@jiaminghi/c-render/lib/plugin/util'
12 |
13 | import DigitalFlop from '../digitalFlop'
14 |
15 | import { co } from '../../util'
16 |
17 | import './style.less'
18 |
19 | const defaultConfig = {
20 | /**
21 | * @description Ring radius
22 | * @type {String|Number}
23 | * @default radius = '50%'
24 | * @example radius = '50%' | 100
25 | */
26 | radius: '50%',
27 | /**
28 | * @description Active ring radius
29 | * @type {String|Number}
30 | * @default activeRadius = '55%'
31 | * @example activeRadius = '55%' | 110
32 | */
33 | activeRadius: '55%',
34 | /**
35 | * @description Ring data
36 | * @type {Array