rtcpts 0.0.72 → 0.0.73
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/LICENSE +22 -22
- package/README.md +91 -91
- package/dist/charts-ChkiYQxb.cjs +1 -0
- package/dist/{charts-fA1hE3y8.js → charts-DKkEg_xR.js} +28 -21
- package/dist/charts.cjs.js +1 -1
- package/dist/charts.es.js +1 -1
- package/dist/components/j-c-more-menu/index.d.ts +17 -1
- package/dist/components/j-c-more-menu/types.d.ts +6 -1
- package/dist/components/j-ch-line/index.d.ts +10 -0
- package/dist/components/j-ch-line/types.d.ts +7 -0
- package/dist/index.css +1 -1
- package/dist/rtcpt-styles.css +1 -1
- package/dist/rtcpt.cjs.js +1 -1
- package/dist/rtcpt.es.js +2888 -2872
- package/dist/svg-raw.d.ts +4 -4
- package/package.json +95 -95
- package/dist/charts-DJRnfFOn.cjs +0 -1
package/LICENSE
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025
|
|
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 all
|
|
13
|
-
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 THE
|
|
21
|
-
SOFTWARE.
|
|
22
|
-
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025
|
|
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 all
|
|
13
|
+
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 THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
package/README.md
CHANGED
|
@@ -1,92 +1,92 @@
|
|
|
1
|
-
# RTCPT - Vue 3 + Quasar 组件库
|
|
2
|
-
|
|
3
|
-
RTCPT 是一个基于 Vue 3、TypeScript 和 Quasar 构建的现代企业级组件库。
|
|
4
|
-
|
|
5
|
-
[在线文档](https://ngiot-frontend-cpt.redteatest.com/zh-cn/)
|
|
6
|
-
|
|
7
|
-
### 分支管理
|
|
8
|
-
|
|
9
|
-
1. **创建开发分支**: 开发新功能或修复问题时,应基于 `dev` 分支创建对应的功能分支。分支命名格式为 `feat/`、`fix/`、
|
|
10
|
-
`refactor/`、`docs/`、`perf/` 或 `chore/` 前缀,后跟具体描述。
|
|
11
|
-
|
|
12
|
-
2. **提交代码审查**: 完成开发后,通过 Pull Request (PR) 或 Merge Request (MR) 提交至 `dev` 分支进行代码审查。提交后可保留自建分支,无需删除。
|
|
13
|
-
|
|
14
|
-
3. **版本发布流程**: 在 `dev` 分支完成构建后(执行 `npm run build-all`),需先执行 `npm login` 进行身份验证,随后执行
|
|
15
|
-
`npm run patch` 发布新版本。
|
|
16
|
-
|
|
17
|
-
## 项目特点
|
|
18
|
-
|
|
19
|
-
- 基于 Quasar 的现代化 UI 组件
|
|
20
|
-
- 全面的 TypeScript 类型支持
|
|
21
|
-
- 开箱即用的企业级业务组件
|
|
22
|
-
- 内置国际化支持 (i18n)
|
|
23
|
-
- 权限控制系统
|
|
24
|
-
- 基于 Chart.js 的数据可视化
|
|
25
|
-
- 高度可定制的主题配置
|
|
26
|
-
|
|
27
|
-
## 分支命名规范 (Branching Guidelines)
|
|
28
|
-
|
|
29
|
-
为了保持组件库开发的条理性以及 CI/CD 流程的自动化,本项目采用语义化分支命名规范。
|
|
30
|
-
|
|
31
|
-
### 1. 核心分支 (Core Branches)
|
|
32
|
-
|
|
33
|
-
| 分支名 | 说明 |
|
|
34
|
-
|:------|:-------------------------------|
|
|
35
|
-
| `dev` | 开发分支。日常功能集成的基准分支,所有 PR 默认合并至此。 |
|
|
36
|
-
|
|
37
|
-
---
|
|
38
|
-
|
|
39
|
-
### 2. 短期协作分支 (Supporting Branches)
|
|
40
|
-
|
|
41
|
-
所有短期分支应遵循 `类别/描述` 的格式,使用小写字母并以中划线分隔。
|
|
42
|
-
|
|
43
|
-
#### 功能开发 (Feature)
|
|
44
|
-
|
|
45
|
-
用于开发新组件或新特性。
|
|
46
|
-
|
|
47
|
-
- 格式: `feat/description`
|
|
48
|
-
- 示例: `git checkout -b feat/button-component`
|
|
49
|
-
|
|
50
|
-
#### 缺陷修复 (Bugfix)
|
|
51
|
-
|
|
52
|
-
用于修复组件 Bug。
|
|
53
|
-
|
|
54
|
-
- 格式: `fix/description`
|
|
55
|
-
- 示例: `git checkout -b fix/select-dropdown-overflow`
|
|
56
|
-
|
|
57
|
-
#### 代码重构 (Refactor)
|
|
58
|
-
|
|
59
|
-
不影响功能逻辑的代码结构调整。
|
|
60
|
-
|
|
61
|
-
- 格式: `refactor/description`
|
|
62
|
-
- 示例: `git checkout -b refactor/use-callback-optimization`
|
|
63
|
-
|
|
64
|
-
#### 文档更新 (Docs)
|
|
65
|
-
|
|
66
|
-
仅涉及文档、注释、Storybook 示例的修改。
|
|
67
|
-
|
|
68
|
-
- 格式: `docs/description`
|
|
69
|
-
- 示例: `git checkout -b docs/add-api-tables`
|
|
70
|
-
|
|
71
|
-
#### 性能优化 (Perf)
|
|
72
|
-
|
|
73
|
-
专门针对组件渲染性能或包体积的优化。
|
|
74
|
-
|
|
75
|
-
- 格式: `perf/description`
|
|
76
|
-
- 示例: `git checkout -b perf/reduce-bundle-size`
|
|
77
|
-
|
|
78
|
-
#### 辅助任务 (Chore)
|
|
79
|
-
|
|
80
|
-
构建流程、依赖库更新、CI 配置等非业务逻辑修改。
|
|
81
|
-
|
|
82
|
-
- 格式: `chore/description`
|
|
83
|
-
- 示例: `git checkout -b chore/upgrade-react-18`
|
|
84
|
-
|
|
85
|
-
---
|
|
86
|
-
|
|
87
|
-
### 3. 工作流建议 (Workflow)
|
|
88
|
-
|
|
89
|
-
1. **同步主分支**: 开发前确保 `develop` 分支是最新的。
|
|
90
|
-
2. **创建分支**: 从 `develop` 拉取新分支。
|
|
91
|
-
```bash
|
|
1
|
+
# RTCPT - Vue 3 + Quasar 组件库
|
|
2
|
+
|
|
3
|
+
RTCPT 是一个基于 Vue 3、TypeScript 和 Quasar 构建的现代企业级组件库。
|
|
4
|
+
|
|
5
|
+
[在线文档](https://ngiot-frontend-cpt.redteatest.com/zh-cn/)
|
|
6
|
+
|
|
7
|
+
### 分支管理
|
|
8
|
+
|
|
9
|
+
1. **创建开发分支**: 开发新功能或修复问题时,应基于 `dev` 分支创建对应的功能分支。分支命名格式为 `feat/`、`fix/`、
|
|
10
|
+
`refactor/`、`docs/`、`perf/` 或 `chore/` 前缀,后跟具体描述。
|
|
11
|
+
|
|
12
|
+
2. **提交代码审查**: 完成开发后,通过 Pull Request (PR) 或 Merge Request (MR) 提交至 `dev` 分支进行代码审查。提交后可保留自建分支,无需删除。
|
|
13
|
+
|
|
14
|
+
3. **版本发布流程**: 在 `dev` 分支完成构建后(执行 `npm run build-all`),需先执行 `npm login` 进行身份验证,随后执行
|
|
15
|
+
`npm run patch` 发布新版本。
|
|
16
|
+
|
|
17
|
+
## 项目特点
|
|
18
|
+
|
|
19
|
+
- 基于 Quasar 的现代化 UI 组件
|
|
20
|
+
- 全面的 TypeScript 类型支持
|
|
21
|
+
- 开箱即用的企业级业务组件
|
|
22
|
+
- 内置国际化支持 (i18n)
|
|
23
|
+
- 权限控制系统
|
|
24
|
+
- 基于 Chart.js 的数据可视化
|
|
25
|
+
- 高度可定制的主题配置
|
|
26
|
+
|
|
27
|
+
## 分支命名规范 (Branching Guidelines)
|
|
28
|
+
|
|
29
|
+
为了保持组件库开发的条理性以及 CI/CD 流程的自动化,本项目采用语义化分支命名规范。
|
|
30
|
+
|
|
31
|
+
### 1. 核心分支 (Core Branches)
|
|
32
|
+
|
|
33
|
+
| 分支名 | 说明 |
|
|
34
|
+
|:------|:-------------------------------|
|
|
35
|
+
| `dev` | 开发分支。日常功能集成的基准分支,所有 PR 默认合并至此。 |
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
### 2. 短期协作分支 (Supporting Branches)
|
|
40
|
+
|
|
41
|
+
所有短期分支应遵循 `类别/描述` 的格式,使用小写字母并以中划线分隔。
|
|
42
|
+
|
|
43
|
+
#### 功能开发 (Feature)
|
|
44
|
+
|
|
45
|
+
用于开发新组件或新特性。
|
|
46
|
+
|
|
47
|
+
- 格式: `feat/description`
|
|
48
|
+
- 示例: `git checkout -b feat/button-component`
|
|
49
|
+
|
|
50
|
+
#### 缺陷修复 (Bugfix)
|
|
51
|
+
|
|
52
|
+
用于修复组件 Bug。
|
|
53
|
+
|
|
54
|
+
- 格式: `fix/description`
|
|
55
|
+
- 示例: `git checkout -b fix/select-dropdown-overflow`
|
|
56
|
+
|
|
57
|
+
#### 代码重构 (Refactor)
|
|
58
|
+
|
|
59
|
+
不影响功能逻辑的代码结构调整。
|
|
60
|
+
|
|
61
|
+
- 格式: `refactor/description`
|
|
62
|
+
- 示例: `git checkout -b refactor/use-callback-optimization`
|
|
63
|
+
|
|
64
|
+
#### 文档更新 (Docs)
|
|
65
|
+
|
|
66
|
+
仅涉及文档、注释、Storybook 示例的修改。
|
|
67
|
+
|
|
68
|
+
- 格式: `docs/description`
|
|
69
|
+
- 示例: `git checkout -b docs/add-api-tables`
|
|
70
|
+
|
|
71
|
+
#### 性能优化 (Perf)
|
|
72
|
+
|
|
73
|
+
专门针对组件渲染性能或包体积的优化。
|
|
74
|
+
|
|
75
|
+
- 格式: `perf/description`
|
|
76
|
+
- 示例: `git checkout -b perf/reduce-bundle-size`
|
|
77
|
+
|
|
78
|
+
#### 辅助任务 (Chore)
|
|
79
|
+
|
|
80
|
+
构建流程、依赖库更新、CI 配置等非业务逻辑修改。
|
|
81
|
+
|
|
82
|
+
- 格式: `chore/description`
|
|
83
|
+
- 示例: `git checkout -b chore/upgrade-react-18`
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
### 3. 工作流建议 (Workflow)
|
|
88
|
+
|
|
89
|
+
1. **同步主分支**: 开发前确保 `develop` 分支是最新的。
|
|
90
|
+
2. **创建分支**: 从 `develop` 拉取新分支。
|
|
91
|
+
```bash
|
|
92
92
|
git checkout -b feat/your-feature-name
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const a=require("vue"),g=require("chart.js/auto"),y=(e,i)=>{const n=e.__vccOpts||e;for(const[o,s]of i)n[o]=s;return n};function k(e){return Object.prototype.toString.call(e)==="[object Object]"}function h(e,i){if(!i)return{...e};const n={...e};for(const o of Object.keys(i)){const s=i[o],u=e[o];if(s!==void 0){if(s===null){n[o]=null;continue}k(u)&&k(s)?n[o]=h(u,s):n[o]=s}}return n}const $=a.defineComponent({name:"JChBar",props:{labels:{type:Array,default:()=>[],required:!0},datasets:{type:Array,required:!0},options:{type:Object,default:()=>({}),required:!1},height:{type:Number,default:300}},setup(e){const i=a.ref(null),n=a.ref(null);let o=null;const s=d=>{let t=d.querySelector("div.chartjs-tooltip");return t||(t=document.createElement("div"),t.className="chartjs-tooltip",t.style.background="#ffffff",t.style.borderRadius="8px",t.style.boxShadow="0 4px 12px rgba(0, 0, 0, 0.15)",t.style.color="#323232",t.style.opacity="0",t.style.pointerEvents="none",t.style.position="absolute",t.style.transform="translate(-50%, 0)",t.style.transition="all .1s ease",t.style.padding="8px 10px",t.style.font="12px Open Sans, sans-serif",d.appendChild(t)),t},u=d=>{const{chart:t,tooltip:r}=d,c=n.value;if(!c)return;const l=s(c);if(r.opacity===0){l.style.opacity="0";return}if(r.body){const m=r.title||[],v=r.body.map(p=>p.lines);if(l.innerHTML="",m.length){const p=document.createElement("div");p.style.fontWeight="600",p.style.marginBottom="4px",p.textContent=m.join(" "),l.appendChild(p)}v.forEach(p=>{const C=document.createElement("div");C.textContent=p.join(" "),l.appendChild(C)})}const{offsetLeft:b,offsetTop:x}=t.canvas;l.style.opacity="1",l.style.left=`${b+r.caretX}px`,l.style.top=`${x+r.caretY}px`},f=()=>{var c;o&&o.destroy();const d=(c=i.value)==null?void 0:c.getContext("2d");if(!d)return;const t={labels:e.labels,datasets:e.datasets.map(l=>({...l,type:"bar",borderWidth:l.borderWidth??0,borderRadius:l.borderRadius??4,maxBarThickness:l.maxBarThickness??34,backgroundColor:l.backgroundColor||"#3A416F"}))},r={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!0,position:"bottom",labels:{color:"#969799",pointStyle:"rect",padding:20,usePointStyle:!0,font:{size:11,family:"Open Sans",style:"normal",lineHeight:1}}},tooltip:{enabled:!1,external:u}},scales:{y:{border:{display:!1},grid:{display:!0,drawOnChartArea:!0,drawTicks:!1,color:"#f5f6fa"},ticks:{display:!0,padding:10,color:"#969799"}},x:{border:{display:!1},grid:{display:!1,drawOnChartArea:!0,drawTicks:!0},ticks:{display:!0,color:"#969799",padding:10}}}};o=new g.Chart(d,{type:"bar",data:t,options:h(r,e.options)})};return a.onMounted(()=>{f()}),a.watch([()=>e.labels,()=>e.datasets,()=>e.height],()=>{f()},{deep:!0}),{barChartCanvas:i,chartContainer:n}}}),S={ref:"chartContainer",style:{position:"relative"}};function O(e,i,n,o,s,u){return a.openBlock(),a.createElementBlock("div",S,[a.createElementVNode("div",null,[a.createElementVNode("canvas",{ref:"barChartCanvas",style:a.normalizeStyle([{width:"100%"},{height:e.height+"px",maxHeight:e.height+"px"}])},null,4)])],512)}const _=y($,[["render",O],["__scopeId","data-v-69a44652"]]),w=a.defineComponent({name:"JChBarLine",props:{labels:{type:Array,default:()=>[],required:!0},datasets:{type:Array,required:!0},options:{type:Object,default:()=>({}),required:!1},height:{type:Number,default:300}},setup(e){const i=a.ref(null);let n=null;const o=()=>{var t;n&&n.destroy();const s=(t=i.value)==null?void 0:t.getContext("2d");if(!s)return;const u=e.datasets.map(r=>{let c={};const l=r.type==="line"?"line":"bar";return r.type==="line"?c={type:"line",tension:.4,pointRadius:0,borderWidth:3,fill:!1,backgroundColor:"transparent",maxBarThickness:void 0}:r.type==="bar"&&(c={type:"bar",borderWidth:0,borderRadius:4,borderSkipped:!1,fill:void 0,maxBarThickness:34,backgroundColor:r.backgroundColor}),{type:l,...r,...c}}),f={labels:e.labels,datasets:u},d={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!0,position:"bottom",labels:{color:"#969799",pointStyle:"rect",padding:20,usePointStyle:!0,font:{size:11,family:"Open Sans",style:"normal",lineHeight:1}}},tooltip:{borderWidth:1,backgroundColor:"white",titleColor:"black",bodyColor:"black",borderColor:"#eeeeee",padding:12,callbacks:{label:r=>`${r.dataset.label||""}: ${r.formattedValue}`}}},interaction:{intersect:!1,mode:"index"},scales:{y:{beginAtZero:!0,border:{display:!1},grid:{display:!0,drawOnChartArea:!0,drawTicks:!1,color:"#f5f6fa"},ticks:{display:!0,padding:10,color:"#969799",font:{size:11,family:"Open Sans",style:"normal",lineHeight:2}}},x:{border:{display:!1},grid:{display:!1,drawOnChartArea:!0,drawTicks:!0},ticks:{display:!0,color:"#969799",padding:10,font:{size:11,family:"Open Sans",style:"normal",lineHeight:2},callback:(r,c)=>{const l=e.labels[c];return l&&l.length>13?`${l.slice(0,13)}...`:l}}}}};n=new g.Chart(s,{data:f,options:h(d,e.options)})};return a.onMounted(()=>{o()}),a.watch([()=>e.labels,()=>e.datasets,()=>e.height],()=>{o()},{deep:!0}),{mixedChartCanvas:i}}});function A(e,i,n,o,s,u){return a.openBlock(),a.createElementBlock("div",null,[a.createElementVNode("canvas",{ref:"mixedChartCanvas",style:a.normalizeStyle([{width:"100%"},{height:e.height+"px",maxHeight:e.height+"px"}])},null,4)])}const E=y(w,[["render",A]]),T=a.defineComponent({name:"JChBubble",props:{labels:{type:Array,default:()=>[],required:!1},datasets:{type:Array,required:!0},options:{type:Object,default:()=>({}),required:!1},height:{type:Number,default:300}},setup(e){const i=a.ref(null);let n=null;const o=()=>{var d;n&&n.destroy();const s=(d=i.value)==null?void 0:d.getContext("2d");if(!s)return;const u={labels:e.labels,datasets:e.datasets.map(t=>({...t,backgroundColor:t.backgroundColor||"rgba(54, 162, 235, 0.6)"}))},f={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!0,position:"bottom",labels:{color:"#969799",pointStyle:"rect",padding:20,usePointStyle:!0,font:{size:11,family:"Open Sans",style:"normal",lineHeight:1}}},tooltip:{borderWidth:1,backgroundColor:"white",titleColor:"black",bodyColor:"black",borderColor:"#eeeeee",padding:12,callbacks:{label:t=>`${t.dataset.label||""}: ${t.formattedValue}`}}},interaction:{intersect:!1,mode:"index"},scales:{y:{beginAtZero:!0,border:{display:!1},grid:{display:!0,drawOnChartArea:!0,drawTicks:!1,color:"#f5f6fa"},ticks:{display:!0,padding:10,color:"#969799",font:{size:11,family:"Open Sans",style:"normal",lineHeight:2}}},x:{border:{display:!1},grid:{display:!0,drawOnChartArea:!0,drawTicks:!0,color:"#f5f6fa"},ticks:{display:!0,color:"#969799",padding:10,font:{size:11,family:"Open Sans",style:"normal",lineHeight:2},callback:(t,r)=>{const c=e.labels[r];return c?typeof c=="string"&&c.length>13?`${c.slice(0,13)}...`:c:t}}}}};n=new g.Chart(s,{type:"bubble",data:u,options:h(f,e.options)})};return a.onMounted(()=>{o()}),a.watch([()=>e.labels,()=>e.datasets,()=>e.height],()=>{o()},{deep:!0}),{bubbleChartCanvas:i}}});function q(e,i,n,o,s,u){return a.openBlock(),a.createElementBlock("div",null,[a.createElementVNode("canvas",{ref:"bubbleChartCanvas",style:a.normalizeStyle([{width:"100%"},{height:e.height+"px",maxHeight:e.height+"px"}])},null,4)])}const B=y(T,[["render",q]]),H={tension:.4,pointRadius:2,borderWidth:3,fill:!1},j=a.defineComponent({name:"JChLine",props:{labels:{type:Array,default:()=>[],required:!0},datasets:{type:Array,required:!0},options:{type:Object,default:()=>({}),required:!1},lineStyle:{type:Object,default:()=>({})},height:{type:Number,default:300},unitName:{type:String,default:""}},setup(e){const i=a.ref(null);let n=null;const o=()=>{var d;n&&n.destroy();const s=(d=i.value)==null?void 0:d.getContext("2d");if(!s)return;const u={labels:e.labels,datasets:e.datasets.map(t=>({...t,...H,...e.lineStyle,backgroundColor:"transparent",type:"line"}))},f={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!0,position:"bottom",labels:{color:"#969799",pointStyle:"line",padding:20,usePointStyle:!0,font:{size:11,family:"Open Sans",style:"normal",lineHeight:1}}},tooltip:{borderWidth:1,backgroundColor:"white",titleColor:"black",bodyColor:"black",borderColor:"#eeeeee",padding:12,callbacks:{label:t=>`${t.dataset.label||""}: ${t.formattedValue} ${e.unitName}`}}},interaction:{intersect:!1,mode:"index"},scales:{y:{beginAtZero:!0,border:{display:!1},grid:{display:!0,drawOnChartArea:!0,drawTicks:!1,color:"#f5f6fa"},ticks:{display:!0,padding:10,color:"#969799",font:{size:11,family:"Open Sans",style:"normal",lineHeight:2}}},x:{border:{display:!1,dash:[5,5]},grid:{display:!1,drawOnChartArea:!1,drawTicks:!1},ticks:{display:!0,color:"#969799",padding:20,font:{size:10,family:"Open Sans",style:"normal"},callback:(t,r,c)=>{const l=e.labels[r];return l.length>13?`${l.slice(0,13)}...`:l}}}}};n=new g.Chart(s,{type:"line",data:u,options:h(f,e.options)})};return a.onMounted(()=>{o()}),a.watch([()=>e.labels,()=>e.datasets,()=>e.lineStyle],()=>{o()},{deep:!0}),{lineChartCanvas:i}}}),z={ref:"chartContainer"};function N(e,i,n,o,s,u){return a.openBlock(),a.createElementBlock("div",z,[a.createElementVNode("canvas",{ref:"lineChartCanvas",style:a.normalizeStyle([{width:"100%"},{height:e.height+"px",maxHeight:e.height+"px"}])},null,4)],512)}const L=y(j,[["render",N],["__scopeId","data-v-1f926288"]]),W=a.defineComponent({name:"JChPieDoughnut",props:{type:{type:String,required:!0,validator:e=>["pie","doughnut"].includes(e)},labels:{type:Array,default:()=>[],required:!0},datasets:{type:Array,required:!0},options:{type:Object,default:()=>({}),required:!1},height:{type:Number,default:300}},setup(e){const i=a.ref(null),n=a.ref(null);let o=null;const s=d=>{let t=d.querySelector("div.chartjs-tooltip");return t||(t=document.createElement("div"),t.className="chartjs-tooltip",t.style.background="#ffffff",t.style.borderRadius="8px",t.style.boxShadow="0 4px 12px rgba(0, 0, 0, 0.15)",t.style.color="#323232",t.style.opacity="0",t.style.pointerEvents="none",t.style.position="absolute",t.style.transform="translate(-50%, 0)",t.style.transition="all .1s ease",t.style.padding="8px 10px",t.style.font="12px Open Sans, sans-serif",d.appendChild(t)),t},u=d=>{const{chart:t,tooltip:r}=d,c=n.value;if(!c)return;const l=s(c);if(r.opacity===0){l.style.opacity="0";return}if(r.body){const m=r.title||[],v=r.body.map(p=>p.lines);if(l.innerHTML="",m.length){const p=document.createElement("div");p.style.fontWeight="600",p.style.marginBottom="4px",p.textContent=m.join(" "),l.appendChild(p)}v.forEach(p=>{const C=document.createElement("div");C.textContent=p.join(" "),l.appendChild(C)})}const{offsetLeft:b,offsetTop:x}=t.canvas;l.style.opacity="1",l.style.left=`${b+r.caretX}px`,l.style.top=`${x+r.caretY}px`},f=()=>{var l;o&&o.destroy();const d=(l=i.value)==null?void 0:l.getContext("2d");if(!d)return;const t=e.type,r={labels:e.labels,datasets:e.datasets.map(b=>({...b,type:t,borderWidth:b.borderWidth??2}))},c={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!0,position:"bottom",labels:{color:"#969799",pointStyle:"rect",padding:20,usePointStyle:!0,font:{size:11,family:"Open Sans",style:"normal",lineHeight:1}}},tooltip:{enabled:!1,external:u}},interaction:{intersect:!0,mode:"index"}};o=new g.Chart(d,{type:t,data:r,options:h(c,e.options)})};return a.onMounted(()=>{f()}),a.watch([()=>e.labels,()=>e.datasets,()=>e.type],()=>{f()},{deep:!0}),{chartCanvas:i,chartContainer:n}}}),R={ref:"chartContainer",style:{position:"relative"}};function V(e,i,n,o,s,u){return a.openBlock(),a.createElementBlock("div",R,[a.createElementVNode("canvas",{ref:"chartCanvas",style:a.normalizeStyle([{width:"100%"},{height:e.height+"px",maxHeight:e.height+"px"}])},null,4)],512)}const D=y(W,[["render",V]]),I=a.defineComponent({name:"JChRadar",props:{labels:{type:Array,default:()=>[],required:!0},datasets:{type:Array,required:!0},options:{type:Object,default:()=>({}),required:!1},height:{type:Number,default:300}},setup(e){const i=a.ref(null);let n=null;const o=()=>{var d;n&&n.destroy();const s=(d=i.value)==null?void 0:d.getContext("2d");if(!s)return;const u={labels:e.labels,datasets:e.datasets.map(t=>({...t,type:"radar",fill:t.fill??!0,backgroundColor:t.backgroundColor||"rgba(58,65,111,0.2)",borderColor:t.borderColor||"rgba(58,65,111,1)",borderWidth:t.borderWidth??2}))},f={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!0,position:"bottom",labels:{color:"#969799",pointStyle:"rect",padding:20,usePointStyle:!0,font:{size:11,family:"Open Sans",style:"normal",lineHeight:1}}},tooltip:{borderWidth:1,backgroundColor:"white",titleColor:"black",bodyColor:"black",borderColor:"#eeeeee",padding:12,callbacks:{label:t=>`${t.dataset.label||""}: ${t.formattedValue}`}}},interaction:{intersect:!1,mode:"index"},scales:{r:{beginAtZero:!0,angleLines:{color:"#f5f6fa"},grid:{color:"#f5f6fa"},pointLabels:{color:"#969799",font:{size:11,family:"Open Sans"}},ticks:{display:!1}}}};n=new g.Chart(s,{type:"radar",data:u,options:h(f,e.options)})};return a.onMounted(()=>{o()}),a.watch([()=>e.labels,()=>e.datasets,()=>e.height],()=>{o()},{deep:!0}),{radarChartCanvas:i}}});function P(e,i,n,o,s,u){return a.openBlock(),a.createElementBlock("div",null,[a.createElementVNode("canvas",{ref:"radarChartCanvas",style:a.normalizeStyle([{width:"100%"},{height:e.height+"px",maxHeight:e.height+"px"}])},null,4)])}const M=y(I,[["render",P]]);exports._export_sfc=y;exports.index=_;exports.index$1=E;exports.index$2=B;exports.index$3=L;exports.index$4=D;exports.index$5=M;
|
|
@@ -181,7 +181,7 @@ function j(e, i, a, l, o, c) {
|
|
|
181
181
|
])
|
|
182
182
|
], 512);
|
|
183
183
|
}
|
|
184
|
-
const
|
|
184
|
+
const M = /* @__PURE__ */ O(q, [["render", j], ["__scopeId", "data-v-69a44652"]]), E = g({
|
|
185
185
|
name: "JChBarLine",
|
|
186
186
|
props: {
|
|
187
187
|
labels: {
|
|
@@ -328,7 +328,7 @@ const Z = /* @__PURE__ */ O(q, [["render", j], ["__scopeId", "data-v-e2691574"]]
|
|
|
328
328
|
};
|
|
329
329
|
}
|
|
330
330
|
});
|
|
331
|
-
function
|
|
331
|
+
function L(e, i, a, l, o, c) {
|
|
332
332
|
return v(), x("div", null, [
|
|
333
333
|
y("canvas", {
|
|
334
334
|
ref: "mixedChartCanvas",
|
|
@@ -336,7 +336,7 @@ function W(e, i, a, l, o, c) {
|
|
|
336
336
|
}, null, 4)
|
|
337
337
|
]);
|
|
338
338
|
}
|
|
339
|
-
const
|
|
339
|
+
const F = /* @__PURE__ */ O(E, [["render", L]]), W = g({
|
|
340
340
|
name: "JChBubble",
|
|
341
341
|
props: {
|
|
342
342
|
labels: {
|
|
@@ -448,7 +448,7 @@ const M = /* @__PURE__ */ O(E, [["render", W]]), z = g({
|
|
|
448
448
|
};
|
|
449
449
|
}
|
|
450
450
|
});
|
|
451
|
-
function
|
|
451
|
+
function z(e, i, a, l, o, c) {
|
|
452
452
|
return v(), x("div", null, [
|
|
453
453
|
y("canvas", {
|
|
454
454
|
ref: "bubbleChartCanvas",
|
|
@@ -456,7 +456,12 @@ function R(e, i, a, l, o, c) {
|
|
|
456
456
|
}, null, 4)
|
|
457
457
|
]);
|
|
458
458
|
}
|
|
459
|
-
const
|
|
459
|
+
const U = /* @__PURE__ */ O(W, [["render", z]]), R = {
|
|
460
|
+
tension: 0.4,
|
|
461
|
+
pointRadius: 2,
|
|
462
|
+
borderWidth: 3,
|
|
463
|
+
fill: !1
|
|
464
|
+
}, N = g({
|
|
460
465
|
name: "JChLine",
|
|
461
466
|
props: {
|
|
462
467
|
labels: {
|
|
@@ -473,6 +478,10 @@ const F = /* @__PURE__ */ O(z, [["render", R]]), L = g({
|
|
|
473
478
|
default: () => ({}),
|
|
474
479
|
required: !1
|
|
475
480
|
},
|
|
481
|
+
lineStyle: {
|
|
482
|
+
type: Object,
|
|
483
|
+
default: () => ({})
|
|
484
|
+
},
|
|
476
485
|
height: {
|
|
477
486
|
type: Number,
|
|
478
487
|
default: 300
|
|
@@ -495,10 +504,8 @@ const F = /* @__PURE__ */ O(z, [["render", R]]), L = g({
|
|
|
495
504
|
// 使用 props.labels
|
|
496
505
|
datasets: e.datasets.map((t) => ({
|
|
497
506
|
...t,
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
borderWidth: 3,
|
|
501
|
-
fill: !1,
|
|
507
|
+
...R,
|
|
508
|
+
...e.lineStyle,
|
|
502
509
|
backgroundColor: "transparent",
|
|
503
510
|
type: "line"
|
|
504
511
|
}))
|
|
@@ -599,7 +606,7 @@ const F = /* @__PURE__ */ O(z, [["render", R]]), L = g({
|
|
|
599
606
|
return m(() => {
|
|
600
607
|
l();
|
|
601
608
|
}), C(
|
|
602
|
-
[() => e.labels, () => e.datasets],
|
|
609
|
+
[() => e.labels, () => e.datasets, () => e.lineStyle],
|
|
603
610
|
() => {
|
|
604
611
|
l();
|
|
605
612
|
},
|
|
@@ -609,7 +616,7 @@ const F = /* @__PURE__ */ O(z, [["render", R]]), L = g({
|
|
|
609
616
|
};
|
|
610
617
|
}
|
|
611
618
|
}), B = { ref: "chartContainer" };
|
|
612
|
-
function
|
|
619
|
+
function D(e, i, a, l, o, c) {
|
|
613
620
|
return v(), x("div", B, [
|
|
614
621
|
y("canvas", {
|
|
615
622
|
ref: "lineChartCanvas",
|
|
@@ -617,7 +624,7 @@ function N(e, i, a, l, o, c) {
|
|
|
617
624
|
}, null, 4)
|
|
618
625
|
], 512);
|
|
619
626
|
}
|
|
620
|
-
const G = /* @__PURE__ */ O(
|
|
627
|
+
const G = /* @__PURE__ */ O(N, [["render", D], ["__scopeId", "data-v-1f926288"]]), I = g({
|
|
621
628
|
name: "JChPieDoughnut",
|
|
622
629
|
props: {
|
|
623
630
|
type: {
|
|
@@ -732,19 +739,19 @@ const G = /* @__PURE__ */ O(L, [["render", N], ["__scopeId", "data-v-1a079ae0"]]
|
|
|
732
739
|
chartContainer: a
|
|
733
740
|
};
|
|
734
741
|
}
|
|
735
|
-
}),
|
|
742
|
+
}), P = {
|
|
736
743
|
ref: "chartContainer",
|
|
737
744
|
style: { position: "relative" }
|
|
738
745
|
};
|
|
739
|
-
function
|
|
740
|
-
return v(), x("div",
|
|
746
|
+
function V(e, i, a, l, o, c) {
|
|
747
|
+
return v(), x("div", P, [
|
|
741
748
|
y("canvas", {
|
|
742
749
|
ref: "chartCanvas",
|
|
743
750
|
style: k([{ width: "100%" }, { height: e.height + "px", maxHeight: e.height + "px" }])
|
|
744
751
|
}, null, 4)
|
|
745
752
|
], 512);
|
|
746
753
|
}
|
|
747
|
-
const K = /* @__PURE__ */ O(
|
|
754
|
+
const K = /* @__PURE__ */ O(I, [["render", V]]), J = g({
|
|
748
755
|
name: "JChRadar",
|
|
749
756
|
props: {
|
|
750
757
|
labels: {
|
|
@@ -860,7 +867,7 @@ const K = /* @__PURE__ */ O(P, [["render", I]]), V = g({
|
|
|
860
867
|
};
|
|
861
868
|
}
|
|
862
869
|
});
|
|
863
|
-
function
|
|
870
|
+
function Y(e, i, a, l, o, c) {
|
|
864
871
|
return v(), x("div", null, [
|
|
865
872
|
y("canvas", {
|
|
866
873
|
ref: "radarChartCanvas",
|
|
@@ -868,13 +875,13 @@ function J(e, i, a, l, o, c) {
|
|
|
868
875
|
}, null, 4)
|
|
869
876
|
]);
|
|
870
877
|
}
|
|
871
|
-
const Q = /* @__PURE__ */ O(
|
|
878
|
+
const Q = /* @__PURE__ */ O(J, [["render", Y]]);
|
|
872
879
|
export {
|
|
873
880
|
O as _,
|
|
874
|
-
|
|
875
|
-
|
|
881
|
+
F as a,
|
|
882
|
+
U as b,
|
|
876
883
|
G as c,
|
|
877
884
|
K as d,
|
|
878
885
|
Q as e,
|
|
879
|
-
|
|
886
|
+
M as i
|
|
880
887
|
};
|
package/dist/charts.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./charts-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./charts-ChkiYQxb.cjs");exports.JChBar=e.index;exports.JChBarLine=e.index$1;exports.JChBubble=e.index$2;exports.JChLine=e.index$3;exports.JChPieDoughnut=e.index$4;exports.JChRadar=e.index$5;
|
package/dist/charts.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PropType, DefineComponent, ExtractPropTypes, ComputedRef, ComponentOptionsMixin, PublicProps, SlotsType, ComponentProvideOptions } from 'vue';
|
|
2
|
-
import { QIcon, QItem, QItemSection, QList, QMenu, QMenuProps, ComponentConstructor } from 'quasar';
|
|
2
|
+
import { QIcon, QItem, QItemSection, QList, QMenu, QBtn, QMenuProps, ComponentConstructor } from 'quasar';
|
|
3
3
|
type BoolLike<T> = boolean | ((item: T) => boolean);
|
|
4
4
|
type LabelLike<T> = string | ((ctx: {
|
|
5
5
|
item: T;
|
|
@@ -43,6 +43,10 @@ declare const _default: DefineComponent<ExtractPropTypes<{
|
|
|
43
43
|
type: PropType<"md" | "lg">;
|
|
44
44
|
default: string;
|
|
45
45
|
};
|
|
46
|
+
btnSize: {
|
|
47
|
+
type: PropType<number | undefined>;
|
|
48
|
+
default: number;
|
|
49
|
+
};
|
|
46
50
|
fit: {
|
|
47
51
|
type: PropType<boolean | undefined>;
|
|
48
52
|
default: undefined;
|
|
@@ -93,6 +97,12 @@ declare const _default: DefineComponent<ExtractPropTypes<{
|
|
|
93
97
|
shouldShowAction: (action: JCMoreMenuAction<any>) => boolean;
|
|
94
98
|
size: ComputedRef<"lg" | "md">;
|
|
95
99
|
showEmptyPlaceholder: ComputedRef<boolean>;
|
|
100
|
+
computedBtnSizeStyle: ComputedRef<{
|
|
101
|
+
width: string;
|
|
102
|
+
height: string;
|
|
103
|
+
minWidth: string;
|
|
104
|
+
minHeight: string;
|
|
105
|
+
} | undefined>;
|
|
96
106
|
computedFit: ComputedRef<boolean>;
|
|
97
107
|
computedOffset: ComputedRef<[number, number] | undefined>;
|
|
98
108
|
computedAnchor: ComputedRef<"top left" | "top middle" | "top right" | "top start" | "top end" | "center left" | "center middle" | "center right" | "center start" | "center end" | "bottom left" | "bottom middle" | "bottom right" | "bottom start" | "bottom end" | undefined>;
|
|
@@ -123,6 +133,10 @@ declare const _default: DefineComponent<ExtractPropTypes<{
|
|
|
123
133
|
type: PropType<"md" | "lg">;
|
|
124
134
|
default: string;
|
|
125
135
|
};
|
|
136
|
+
btnSize: {
|
|
137
|
+
type: PropType<number | undefined>;
|
|
138
|
+
default: number;
|
|
139
|
+
};
|
|
126
140
|
fit: {
|
|
127
141
|
type: PropType<boolean | undefined>;
|
|
128
142
|
default: undefined;
|
|
@@ -179,6 +193,7 @@ declare const _default: DefineComponent<ExtractPropTypes<{
|
|
|
179
193
|
offset: [number, number];
|
|
180
194
|
self: "top left" | "top middle" | "top right" | "top start" | "top end" | "center left" | "center middle" | "center right" | "center start" | "center end" | "bottom left" | "bottom middle" | "bottom right" | "bottom start" | "bottom end" | undefined;
|
|
181
195
|
actions: JCMoreMenuAction<any>[];
|
|
196
|
+
btnSize: number | undefined;
|
|
182
197
|
fit: boolean | undefined;
|
|
183
198
|
triggerSize: string;
|
|
184
199
|
listMinWidth: string | undefined;
|
|
@@ -191,6 +206,7 @@ declare const _default: DefineComponent<ExtractPropTypes<{
|
|
|
191
206
|
QList: ComponentConstructor<QList>;
|
|
192
207
|
QItem: ComponentConstructor<QItem>;
|
|
193
208
|
QItemSection: ComponentConstructor<QItemSection>;
|
|
209
|
+
QBtn: ComponentConstructor<QBtn>;
|
|
194
210
|
JCPermission: DefineComponent<ExtractPropTypes<{
|
|
195
211
|
code: {
|
|
196
212
|
type: PropType<string | null>;
|
|
@@ -58,9 +58,14 @@ export interface JCMoreMenuProps<T = any> {
|
|
|
58
58
|
*/
|
|
59
59
|
size?: JCMoreMenuSizeType;
|
|
60
60
|
/**
|
|
61
|
-
*
|
|
61
|
+
* 触发按钮宽高(px)
|
|
62
62
|
* @default undefined
|
|
63
63
|
*/
|
|
64
|
+
btnSize?: number;
|
|
65
|
+
/**
|
|
66
|
+
* 是否适应宽度
|
|
67
|
+
* @default 28
|
|
68
|
+
*/
|
|
64
69
|
fit?: boolean;
|
|
65
70
|
/**
|
|
66
71
|
* 是否紧凑模式
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Ref, DefineComponent, ExtractPropTypes, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
|
|
2
2
|
import { ChartDataset } from 'chart.js/auto';
|
|
3
|
+
import { JChLineStyle, JChLineDataset } from './types';
|
|
3
4
|
declare const _default: DefineComponent<ExtractPropTypes<{
|
|
4
5
|
labels: {
|
|
5
6
|
type: ArrayConstructor;
|
|
@@ -15,6 +16,10 @@ declare const _default: DefineComponent<ExtractPropTypes<{
|
|
|
15
16
|
default: () => {};
|
|
16
17
|
required: false;
|
|
17
18
|
};
|
|
19
|
+
lineStyle: {
|
|
20
|
+
type: () => JChLineStyle;
|
|
21
|
+
default: () => {};
|
|
22
|
+
};
|
|
18
23
|
height: {
|
|
19
24
|
type: NumberConstructor;
|
|
20
25
|
default: number;
|
|
@@ -40,6 +45,10 @@ declare const _default: DefineComponent<ExtractPropTypes<{
|
|
|
40
45
|
default: () => {};
|
|
41
46
|
required: false;
|
|
42
47
|
};
|
|
48
|
+
lineStyle: {
|
|
49
|
+
type: () => JChLineStyle;
|
|
50
|
+
default: () => {};
|
|
51
|
+
};
|
|
43
52
|
height: {
|
|
44
53
|
type: NumberConstructor;
|
|
45
54
|
default: number;
|
|
@@ -52,6 +61,7 @@ declare const _default: DefineComponent<ExtractPropTypes<{
|
|
|
52
61
|
options: {};
|
|
53
62
|
height: number;
|
|
54
63
|
labels: unknown[];
|
|
64
|
+
lineStyle: Partial<Pick< JChLineDataset, "fill" | "borderWidth" | "pointRadius" | "tension">>;
|
|
55
65
|
unitName: string;
|
|
56
66
|
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
57
67
|
export default _default;
|
|
@@ -2,6 +2,8 @@ import { ChartDataset, ChartOptions } from 'chart.js/auto';
|
|
|
2
2
|
import { DefineComponent } from 'vue';
|
|
3
3
|
/** 折线图数据集类型 */
|
|
4
4
|
export type JChLineDataset = ChartDataset<'line'>;
|
|
5
|
+
/** 折线样式配置 */
|
|
6
|
+
export type JChLineStyle = Partial<Pick<JChLineDataset, 'tension' | 'pointRadius' | 'borderWidth' | 'fill'>>;
|
|
5
7
|
/** JChLine Props 接口 */
|
|
6
8
|
export interface JChLineProps {
|
|
7
9
|
/**
|
|
@@ -20,6 +22,11 @@ export interface JChLineProps {
|
|
|
20
22
|
* @default {}
|
|
21
23
|
*/
|
|
22
24
|
options?: Partial<ChartOptions<'line'>>;
|
|
25
|
+
/**
|
|
26
|
+
* 折线样式(用于覆写默认样式)
|
|
27
|
+
* @default { tension: 0.4, pointRadius: 2, borderWidth: 3, fill: false }
|
|
28
|
+
*/
|
|
29
|
+
lineStyle?: JChLineStyle;
|
|
23
30
|
/**
|
|
24
31
|
* 图表高度 (px)
|
|
25
32
|
* @default 300
|