rhjy-ui 0.1.0 → 0.2.0
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 +133 -109
- package/dist/_plugin-vue_export-helper-dad06003.js +9 -0
- package/dist/_plugin-vue_export-helper-f246444f.cjs +1 -0
- package/dist/data-center/index.cjs +1 -1
- package/dist/data-center/index.js +110 -114
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +8 -4
- package/dist/responsive-info-grid/RhResponsiveInfoGrid.vue.d.ts +53 -0
- package/dist/responsive-info-grid/RhResponsiveInfoGridItem.vue.d.ts +49 -0
- package/dist/responsive-info-grid/index.cjs +1 -0
- package/dist/responsive-info-grid/index.d.ts +2 -0
- package/dist/responsive-info-grid/index.js +54 -0
- package/dist/style.css +1 -1
- package/package.json +53 -47
- package/src/responsive-info-grid/README.md +137 -0
package/README.md
CHANGED
|
@@ -1,109 +1,133 @@
|
|
|
1
|
-
# rhjy-ui
|
|
2
|
-
|
|
3
|
-
`rhjy-ui` is a Vue 3 and Element Plus business UI component library. The first release contains a configurable data-center suite for displaying asynchronous import, export, generation and other background tasks.
|
|
4
|
-
|
|
5
|
-
## Install
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
pnpm add rhjy-ui vue element-plus @element-plus/icons-vue
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
Import the package stylesheet once in the application entrypoint:
|
|
12
|
-
|
|
13
|
-
```ts
|
|
14
|
-
import 'rhjy-ui/style.css'
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
##
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
```vue
|
|
22
|
-
<script setup lang="ts">
|
|
23
|
-
import {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
</
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
1
|
+
# rhjy-ui
|
|
2
|
+
|
|
3
|
+
`rhjy-ui` is a Vue 3 and Element Plus business UI component library. The first release contains a configurable data-center suite for displaying asynchronous import, export, generation and other background tasks.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add rhjy-ui vue element-plus @element-plus/icons-vue
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Import the package stylesheet once in the application entrypoint:
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import 'rhjy-ui/style.css'
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Responsive Info Grid
|
|
18
|
+
|
|
19
|
+
Responsive Info Grid arranges title-content pairs in a configurable grid and switches column counts at the 1200px and 768px breakpoints.
|
|
20
|
+
|
|
21
|
+
```vue
|
|
22
|
+
<script setup lang="ts">
|
|
23
|
+
import {
|
|
24
|
+
RhResponsiveInfoGrid,
|
|
25
|
+
RhResponsiveInfoGridItem,
|
|
26
|
+
} from 'rhjy-ui'
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<template>
|
|
30
|
+
<RhResponsiveInfoGrid>
|
|
31
|
+
<RhResponsiveInfoGridItem title="Project: " content="Smart Campus" />
|
|
32
|
+
<RhResponsiveInfoGridItem title="Owner: " content="Operations Team" />
|
|
33
|
+
<RhResponsiveInfoGridItem title="Devices: " :content="128" />
|
|
34
|
+
<RhResponsiveInfoGridItem title="Summary: " content="All systems operational" :span="2" />
|
|
35
|
+
</RhResponsiveInfoGrid>
|
|
36
|
+
</template>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
See the [Responsive Info Grid component README](https://unpkg.com/rhjy-ui@0.2.0/src/responsive-info-grid/README.md) for subpath imports, the complete props and slots reference, responsive behavior, and more examples.
|
|
40
|
+
|
|
41
|
+
## Data center panel
|
|
42
|
+
|
|
43
|
+
`rhjy-ui` never receives an API URL. Each application supplies a `loadTasks` function and converts its own response into the standard task model.
|
|
44
|
+
|
|
45
|
+
```vue
|
|
46
|
+
<script setup lang="ts">
|
|
47
|
+
import { RhDataCenter } from 'rhjy-ui'
|
|
48
|
+
import type {
|
|
49
|
+
RhDataCenterCategory,
|
|
50
|
+
RhDataCenterLoadTasks,
|
|
51
|
+
} from 'rhjy-ui/data-center'
|
|
52
|
+
|
|
53
|
+
const categories: RhDataCenterCategory[] = [
|
|
54
|
+
{ key: 'all', label: '全部任务' },
|
|
55
|
+
{ key: 'generate', label: '数据生成' },
|
|
56
|
+
{ key: 'import', label: '数据导入' },
|
|
57
|
+
{ key: 'export', label: '数据导出' },
|
|
58
|
+
]
|
|
59
|
+
|
|
60
|
+
const loadTasks: RhDataCenterLoadTasks = async ({ category }) => {
|
|
61
|
+
const response = await requestTaskList({
|
|
62
|
+
taskType: category.key === 'all' ? undefined : category.key,
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
return {
|
|
66
|
+
items: response.list,
|
|
67
|
+
total: response.total,
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const handleTaskAction = ({ action, task }) => {
|
|
72
|
+
if (action === 'download') {
|
|
73
|
+
window.open(task.raw.fileUrl)
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
</script>
|
|
77
|
+
|
|
78
|
+
<template>
|
|
79
|
+
<RhDataCenter
|
|
80
|
+
:categories="categories"
|
|
81
|
+
:load-tasks="loadTasks"
|
|
82
|
+
@task-action="handleTaskAction"
|
|
83
|
+
/>
|
|
84
|
+
</template>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
The “全部任务” rule is application-owned. It may omit `taskType`, pass a fixed value, or combine multiple requests without changing the component.
|
|
88
|
+
|
|
89
|
+
## Task tip flow
|
|
90
|
+
|
|
91
|
+
Use `useRhDataCenter` after a page successfully creates a background task:
|
|
92
|
+
|
|
93
|
+
```vue
|
|
94
|
+
<script setup lang="ts">
|
|
95
|
+
import { RhDataCenterTip, useRhDataCenter } from 'rhjy-ui'
|
|
96
|
+
|
|
97
|
+
const { tipVisible, tipConfig, showTip } = useRhDataCenter()
|
|
98
|
+
|
|
99
|
+
const startExport = async () => {
|
|
100
|
+
const result = await createExportTask()
|
|
101
|
+
showTip({
|
|
102
|
+
type: 'export',
|
|
103
|
+
minutes: Number(result.minutes),
|
|
104
|
+
title: '导出文件生成中,大概需要',
|
|
105
|
+
content: '现在你可关闭弹框,去做其他事情了。',
|
|
106
|
+
})
|
|
107
|
+
}
|
|
108
|
+
</script>
|
|
109
|
+
|
|
110
|
+
<template>
|
|
111
|
+
<RhDataCenterTip v-model="tipVisible" v-bind="tipConfig" />
|
|
112
|
+
</template>
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Standard task model
|
|
116
|
+
|
|
117
|
+
The adapter returns `id`, `categoryKey`, `title`, `createdAt`, `progress`, and one of `waiting`, `processing`, `success`, or `failed`. Optional `tag`, `message`, `actions`, and `raw` provide display and application action context.
|
|
118
|
+
|
|
119
|
+
## Styling
|
|
120
|
+
|
|
121
|
+
Override CSS variables at the application root when needed:
|
|
122
|
+
|
|
123
|
+
```css
|
|
124
|
+
:root {
|
|
125
|
+
--rh-ui-data-center-primary: #00828a;
|
|
126
|
+
--rh-ui-data-center-panel-width: 606px;
|
|
127
|
+
--rh-ui-data-center-panel-height: 500px;
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Releases
|
|
132
|
+
|
|
133
|
+
The package is published with compiled `dist` output. Consumers should use an explicit version such as `rhjy-ui@0.2.0`; application-specific API adapters remain in the consuming project.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=(t,o)=>{const c=t.__vccOpts||t;for(const[r,s]of o)c[r]=s;return c};exports._export_sfc=e;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue");const I={class:"rh-data-center-panel__state"},$=e.defineComponent({__name:"RhDataCenterState",props:{text:{},retryable:{type:Boolean,default:!1}},emits:["retry"],setup(t,{emit:v}){const o=v;return(i,c)=>(e.openBlock(),e.createElementBlock("div",I,[e.createElementVNode("span",null,e.toDisplayString(t.text),1),t.retryable?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"rh-data-center-panel__retry",onClick:c[0]||(c[0]=d=>o("retry"))}," 重新加载 ")):e.createCommentVNode("",!0)]))}}),M={class:"rh-data-center-panel__task"},O={class:"rh-data-center-panel__taskMain"},H={class:"rh-data-center-panel__taskTitle"},F={key:0,class:"rh-data-center-panel__taskTag"},U={key:0,class:"rh-data-center-panel__progress"},K={class:"rh-data-center-panel__meta"},G={key:0,class:"rh-data-center-panel__actions"},W=["disabled","onClick"],q=e.defineComponent({__name:"RhDataCenterTaskItem",props:{task:{}},emits:["action"],setup(t,{emit:v}){const o=t,i=v,c=e.computed(()=>{const d=Number(o.task.progress||0);return Math.min(100,Math.max(0,d))});return(d,h)=>{var p;return e.openBlock(),e.createElementBlock("div",M,[e.createElementVNode("div",O,[e.createElementVNode("div",H,[e.createElementVNode("span",null,e.toDisplayString(t.task.title),1),t.task.tag?(e.openBlock(),e.createElementBlock("span",F,e.toDisplayString(t.task.tag),1)):e.createCommentVNode("",!0)]),t.task.status!=="success"?(e.openBlock(),e.createElementBlock("div",U,[e.createElementVNode("div",{class:e.normalizeClass(["rh-data-center-panel__progressBar",{"is-failed":t.task.status==="failed"}]),style:e.normalizeStyle({width:`${c.value}%`})},null,6)])):e.createCommentVNode("",!0),e.createElementVNode("div",K,e.toDisplayString(t.task.createdAt),1),t.task.message?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["rh-data-center-panel__message",{"is-failed":t.task.status==="failed"}])},e.toDisplayString(t.task.message),3)):e.createCommentVNode("",!0)]),(p=t.task.actions)!=null&&p.length?(e.openBlock(),e.createElementBlock("div",G,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.task.actions,k=>(e.openBlock(),e.createElementBlock("button",{key:k.key,type:"button",class:"rh-data-center-panel__action",disabled:k.disabled,onClick:y=>i("action",k.key)},e.toDisplayString(k.label),9,W))),128))])):e.createCommentVNode("",!0)])}}}),j="数据处理中心",X=606,Y=500,J=1e3,Q="-此处仅展示近15天内的数据-",Z={class:"rh-data-center-panel"},ee={class:"rh-data-center-panel__sidebar"},te=["onClick"],oe={key:0,class:"rh-data-center-panel__categoryCount"},ne={class:"rh-data-center-panel__main"},ae={class:"rh-data-center-panel__title"},le={class:"rh-data-center-panel__scroll"},re={key:0,class:"rh-data-center-panel__footer"},L=e.defineComponent({__name:"RhDataCenterPanel",props:{categories:{},loadTasks:{},activeCategoryKey:{default:void 0},closeable:{type:Boolean,default:!0},showTotal:{type:Boolean,default:!0},recentDaysText:{default:Q}},emits:["close","refresh","task-action","error"],setup(t,{expose:v,emit:o}){const i=t,c=o,d=e.ref(i.activeCategoryKey),h=e.ref({}),p=e.ref({}),k=e.ref({}),y=e.ref({}),_=e.ref({}),u=e.computed(()=>i.categories.find(a=>a.key===d.value)||i.categories[0]),C=e.computed(()=>{var a;return String(((a=u.value)==null?void 0:a.key)??"")}),B=e.computed(()=>h.value[C.value]),T=e.computed(()=>p.value[C.value]===!0),E=e.computed(()=>k.value[C.value]),R=a=>{var n;const s=h.value[String(a.key)];return((n=s==null?void 0:s.counts)==null?void 0:n[String(a.key)])??(s==null?void 0:s.total)},V=async(a=!1)=>{const s=u.value;if(!s)return;const n=String(s.key);if(_.value[n]&&!a)return;_.value[n]=!0,p.value[n]=!0,k.value[n]=void 0;const l=(y.value[n]||0)+1;y.value[n]=l,c("refresh",s);try{const g=await i.loadTasks({category:s});if(y.value[n]!==l||C.value!==n)return;h.value[n]=g}catch(g){if(y.value[n]!==l||C.value!==n)return;k.value[n]=g,c("error",g,s)}finally{y.value[n]===l&&(p.value[n]=!1,_.value[n]=!1)}},N=async a=>{d.value!==a.key&&(d.value=a.key,await V())},w=(a,s)=>{const n=u.value;n&&c("task-action",{action:a,task:s,category:n})};return e.onMounted(()=>{var a;d.value===void 0&&(d.value=(a=i.categories[0])==null?void 0:a.key)}),v({refresh:V}),(a,s)=>{var n;return e.openBlock(),e.createElementBlock("div",Z,[e.createElementVNode("aside",ee,[s[1]||(s[1]=e.createElementVNode("div",{class:"rh-data-center-panel__title"},"数据类型",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.categories,l=>(e.openBlock(),e.createElementBlock("button",{key:l.key,type:"button",class:e.normalizeClass(["rh-data-center-panel__category",{"is-active":d.value===l.key}]),onClick:g=>N(l)},[e.createElementVNode("span",null,e.toDisplayString(l.label),1),R(l)!==void 0?(e.openBlock(),e.createElementBlock("span",oe,e.toDisplayString(R(l)),1)):e.createCommentVNode("",!0)],10,te))),128))]),e.createElementVNode("section",ne,[e.createElementVNode("div",ae,[e.renderSlot(a.$slots,"header",{category:u.value},()=>[s[2]||(s[2]=e.createTextVNode("数据处理进度",-1))]),t.closeable?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"rh-data-center-panel__action",onClick:s[0]||(s[0]=l=>c("close"))},"关闭")):e.createCommentVNode("",!0)]),e.createElementVNode("div",le,[T.value?(e.openBlock(),e.createBlock($,{key:0,text:"加载中..."})):E.value?e.renderSlot(a.$slots,"error",{key:1,error:E.value,retry:V},()=>[e.createVNode($,{text:"任务加载失败",retryable:!0,onRetry:V})]):(n=B.value)!=null&&n.items.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:2},e.renderList(B.value.items,l=>e.renderSlot(a.$slots,"task",{key:l.id,task:l,category:u.value,action:w},()=>[e.createVNode(q,{task:l,onAction:g=>w(g,l)},null,8,["task","onAction"])])),128)):e.renderSlot(a.$slots,"empty",{key:3,category:u.value},()=>[e.createVNode($,{text:"暂无任务"})])]),e.renderSlot(a.$slots,"footer",{result:B.value,category:u.value},()=>{var l;return[t.showTotal?(e.openBlock(),e.createElementBlock("div",re,[e.createElementVNode("span",null,e.toDisplayString(((l=B.value)==null?void 0:l.total)||0)+"条记录",1),e.createElementVNode("span",null,e.toDisplayString(t.recentDaysText),1)])):e.createCommentVNode("",!0)]})])])}}}),se=t=>typeof t=="function"?t():t.value,ie=(t,v)=>{const o=i=>{const c=i.target;if(!c)return;t.some(h=>{var p;return(p=se(h))==null?void 0:p.contains(c)})||v()};e.onMounted(()=>document.addEventListener("click",o,!0)),e.onBeforeUnmount(()=>document.removeEventListener("click",o,!0))},ce=["src"],de=e.defineComponent({__name:"RhDataCenter",props:{modelValue:{type:Boolean,default:void 0},categories:{},loadTasks:{},label:{default:j},width:{default:X},panelHeight:{default:Y},panelRight:{default:0},pollInterval:{default:J},refreshOnOpen:{type:Boolean,default:!0},closeOnClickOutside:{type:Boolean,default:!0},icon:{default:""},activeIcon:{default:""}},emits:["update:modelValue","open","close","refresh","task-action","error"],setup(t,{emit:v}){const o=t,i=v,c=e.ref(!1),d=e.ref(null),h=e.ref(null),p=e.ref(null),k=e.ref({}),y=e.ref(),_=e.ref(!1),u=e.computed(()=>o.modelValue===void 0?c.value:o.modelValue),C=e.computed(()=>u.value?o.activeIcon||o.icon:o.icon||o.activeIcon),B=r=>typeof r=="number"?`${r}px`:r,T=r=>typeof r=="number"?r:Number.parseFloat(r)||0,E=()=>{const r=d.value,f=h.value;if(!r||!f)return;const m=r.getBoundingClientRect(),D=f.offsetWidth||T(o.width),A=T(o.panelRight),b=8,x=m.right-D-A,P=Math.min(Math.max(b,x),Math.max(b,window.innerWidth-D-b)),z=Math.min(m.bottom+8,Math.max(b,window.innerHeight-f.offsetHeight-b));k.value={top:`${z}px`,left:`${P}px`,width:B(o.width),"--rh-ui-data-center-panel-height":B(o.panelHeight)}},R=()=>{_.value||(_.value=!0,window.addEventListener("resize",E),window.addEventListener("scroll",E,!0))},V=()=>{_.value&&(_.value=!1,window.removeEventListener("resize",E),window.removeEventListener("scroll",E,!0))},N=()=>{y.value!==void 0&&(window.clearInterval(y.value),y.value=void 0)},w=()=>{var r;(r=p.value)==null||r.refresh()},a=()=>{N(),!(!u.value||o.pollInterval<=0)&&(y.value=window.setInterval(w,o.pollInterval))},s=r=>{o.modelValue===void 0&&(c.value=r),i("update:modelValue",r)},n=()=>{u.value||(s(!0),i("open"))},l=()=>{u.value&&(s(!1),i("close"))},g=()=>u.value?l():n(),S=()=>{if(document.visibilityState==="hidden"){N();return}a(),w()};return e.watch(u,async r=>{if(N(),V(),!r){document.removeEventListener("visibilitychange",S);return}await e.nextTick(),E(),R(),document.addEventListener("visibilitychange",S),o.refreshOnOpen&&w(),a()},{immediate:!0}),ie([d,h],()=>{o.closeOnClickOutside&&u.value&&l()}),e.onBeforeUnmount(()=>{N(),V(),document.removeEventListener("visibilitychange",S)}),(r,f)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",{ref_key:"triggerRef",ref:d,class:"rh-data-center",onClick:e.withModifiers(g,["stop"])},[e.renderSlot(r.$slots,"trigger",{visible:u.value,open:n,close:l,toggle:g},()=>[e.createElementVNode("span",{class:e.normalizeClass(["rh-data-center__trigger",{"is-active":u.value}])},[C.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:C.value,class:"rh-data-center__icon",alt:""},null,8,ce)):e.createCommentVNode("",!0),e.createElementVNode("span",null,e.toDisplayString(t.label),1)],2)],!0)],512),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[u.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"contentRef",ref:h,class:"rh-data-center__popover",style:e.normalizeStyle(k.value),onClick:f[3]||(f[3]=e.withModifiers(()=>{},["stop"]))},[e.createVNode(L,{ref_key:"panelRef",ref:p,categories:t.categories,"load-tasks":t.loadTasks,closeable:!0,onClose:l,onRefresh:f[0]||(f[0]=m=>i("refresh",m)),onTaskAction:f[1]||(f[1]=m=>i("task-action",m)),onError:f[2]||(f[2]=(m,D)=>i("error",m,D))},{header:e.withCtx(m=>[e.renderSlot(r.$slots,"header",e.normalizeProps(e.guardReactiveProps(m)),()=>[f[4]||(f[4]=e.createTextVNode("数据处理进度",-1))],!0)]),task:e.withCtx(m=>[e.renderSlot(r.$slots,"task",e.normalizeProps(e.guardReactiveProps(m)),void 0,!0)]),empty:e.withCtx(m=>[e.renderSlot(r.$slots,"empty",e.normalizeProps(e.guardReactiveProps(m)),void 0,!0)]),error:e.withCtx(m=>[e.renderSlot(r.$slots,"error",e.normalizeProps(e.guardReactiveProps(m)),void 0,!0)]),footer:e.withCtx(m=>[e.renderSlot(r.$slots,"footer",e.normalizeProps(e.guardReactiveProps(m)),void 0,!0)]),_:3},8,["categories","load-tasks"])],4)):e.createCommentVNode("",!0)]))],64))}});const ue=(t,v)=>{const o=t.__vccOpts||t;for(const[i,c]of v)o[i]=c;return o},me=ue(de,[["__scopeId","data-v-b6caa4d9"]]),ve={key:0,class:"rh-data-center-tip__guide"},pe={class:"rh-data-center-tip__content"},fe={key:0,class:"rh-data-center-tip__minutes"},ke={key:1,class:"rh-data-center-tip__description"},he=e.defineComponent({__name:"RhDataCenterTip",props:{modelValue:{type:Boolean,default:!1},minutes:{default:void 0},type:{default:void 0},title:{default:""},content:{default:""},width:{default:"540px"},showGuideAnimation:{type:Boolean,default:!0}},emits:["update:modelValue","close"],setup(t,{emit:v}){const o=v,i=()=>{o("update:modelValue",!1),o("close")};return(c,d)=>{const h=e.resolveComponent("el-button"),p=e.resolveComponent("el-dialog");return e.openBlock(),e.createBlock(p,{"model-value":t.modelValue,title:t.title||"提示",width:t.width,"append-to-body":"","onUpdate:modelValue":d[0]||(d[0]=k=>o("update:modelValue",k)),onClose:i},{footer:e.withCtx(()=>[e.createVNode(h,{type:"primary",onClick:i},{default:e.withCtx(()=>[...d[1]||(d[1]=[e.createTextVNode("关闭弹框",-1)])]),_:1})]),default:e.withCtx(()=>[t.showGuideAnimation?(e.openBlock(),e.createElementBlock("div",ve)):e.createCommentVNode("",!0),e.createElementVNode("div",pe,[t.minutes!==void 0?(e.openBlock(),e.createElementBlock("span",fe,e.toDisplayString((t.title||"任务处理中,大概需要")+t.minutes+"分钟"),1)):e.createCommentVNode("",!0),t.content?(e.openBlock(),e.createElementBlock("div",ke,e.toDisplayString(t.content),1)):e.createCommentVNode("",!0),e.renderSlot(c.$slots,"extra")])]),_:3},8,["model-value","title","width"])}}}),ye=()=>{const t=e.ref(!1),v=e.ref({});return{tipVisible:t,tipConfig:v,showTip:c=>{v.value={...c},t.value=!0},closeTip:()=>{t.value=!1}}};exports.RhDataCenter=me;exports.RhDataCenterPanel=L;exports.RhDataCenterTip=he;exports.useRhDataCenter=ye;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),I=require("../_plugin-vue_export-helper-f246444f.cjs");const H={class:"rh-data-center-panel__state"},$=e.defineComponent({__name:"RhDataCenterState",props:{text:{},retryable:{type:Boolean,default:!1}},emits:["retry"],setup(t,{emit:v}){const o=v;return(i,d)=>(e.openBlock(),e.createElementBlock("div",H,[e.createElementVNode("span",null,e.toDisplayString(t.text),1),t.retryable?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"rh-data-center-panel__retry",onClick:d[0]||(d[0]=c=>o("retry"))}," 重新加载 ")):e.createCommentVNode("",!0)]))}}),M={class:"rh-data-center-panel__task"},O={class:"rh-data-center-panel__taskMain"},F={class:"rh-data-center-panel__taskTitle"},U={key:0,class:"rh-data-center-panel__taskTag"},K={key:0,class:"rh-data-center-panel__progress"},q={class:"rh-data-center-panel__meta"},G={key:0,class:"rh-data-center-panel__actions"},W=["disabled","onClick"],j=e.defineComponent({__name:"RhDataCenterTaskItem",props:{task:{}},emits:["action"],setup(t,{emit:v}){const o=t,i=v,d=e.computed(()=>{const c=Number(o.task.progress||0);return Math.min(100,Math.max(0,c))});return(c,h)=>{var p;return e.openBlock(),e.createElementBlock("div",M,[e.createElementVNode("div",O,[e.createElementVNode("div",F,[e.createElementVNode("span",null,e.toDisplayString(t.task.title),1),t.task.tag?(e.openBlock(),e.createElementBlock("span",U,e.toDisplayString(t.task.tag),1)):e.createCommentVNode("",!0)]),t.task.status!=="success"?(e.openBlock(),e.createElementBlock("div",K,[e.createElementVNode("div",{class:e.normalizeClass(["rh-data-center-panel__progressBar",{"is-failed":t.task.status==="failed"}]),style:e.normalizeStyle({width:`${d.value}%`})},null,6)])):e.createCommentVNode("",!0),e.createElementVNode("div",q,e.toDisplayString(t.task.createdAt),1),t.task.message?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["rh-data-center-panel__message",{"is-failed":t.task.status==="failed"}])},e.toDisplayString(t.task.message),3)):e.createCommentVNode("",!0)]),(p=t.task.actions)!=null&&p.length?(e.openBlock(),e.createElementBlock("div",G,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.task.actions,k=>(e.openBlock(),e.createElementBlock("button",{key:k.key,type:"button",class:"rh-data-center-panel__action",disabled:k.disabled,onClick:y=>i("action",k.key)},e.toDisplayString(k.label),9,W))),128))])):e.createCommentVNode("",!0)])}}}),X="数据处理中心",Y=606,J=500,Q=1e3,Z="-此处仅展示近15天内的数据-",ee={class:"rh-data-center-panel"},te={class:"rh-data-center-panel__sidebar"},oe=["onClick"],ne={key:0,class:"rh-data-center-panel__categoryCount"},ae={class:"rh-data-center-panel__main"},le={class:"rh-data-center-panel__title"},re={class:"rh-data-center-panel__scroll"},se={key:0,class:"rh-data-center-panel__footer"},L=e.defineComponent({__name:"RhDataCenterPanel",props:{categories:{},loadTasks:{},activeCategoryKey:{default:void 0},closeable:{type:Boolean,default:!0},showTotal:{type:Boolean,default:!0},recentDaysText:{default:Z}},emits:["close","refresh","task-action","error"],setup(t,{expose:v,emit:o}){const i=t,d=o,c=e.ref(i.activeCategoryKey),h=e.ref({}),p=e.ref({}),k=e.ref({}),y=e.ref({}),_=e.ref({}),u=e.computed(()=>i.categories.find(a=>a.key===c.value)||i.categories[0]),C=e.computed(()=>{var a;return String(((a=u.value)==null?void 0:a.key)??"")}),B=e.computed(()=>h.value[C.value]),T=e.computed(()=>p.value[C.value]===!0),E=e.computed(()=>k.value[C.value]),R=a=>{var n;const s=h.value[String(a.key)];return((n=s==null?void 0:s.counts)==null?void 0:n[String(a.key)])??(s==null?void 0:s.total)},V=async(a=!1)=>{const s=u.value;if(!s)return;const n=String(s.key);if(_.value[n]&&!a)return;_.value[n]=!0,p.value[n]=!0,k.value[n]=void 0;const l=(y.value[n]||0)+1;y.value[n]=l,d("refresh",s);try{const g=await i.loadTasks({category:s});if(y.value[n]!==l||C.value!==n)return;h.value[n]=g}catch(g){if(y.value[n]!==l||C.value!==n)return;k.value[n]=g,d("error",g,s)}finally{y.value[n]===l&&(p.value[n]=!1,_.value[n]=!1)}},N=async a=>{c.value!==a.key&&(c.value=a.key,await V())},w=(a,s)=>{const n=u.value;n&&d("task-action",{action:a,task:s,category:n})};return e.onMounted(()=>{var a;c.value===void 0&&(c.value=(a=i.categories[0])==null?void 0:a.key)}),v({refresh:V}),(a,s)=>{var n;return e.openBlock(),e.createElementBlock("div",ee,[e.createElementVNode("aside",te,[s[1]||(s[1]=e.createElementVNode("div",{class:"rh-data-center-panel__title"},"数据类型",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.categories,l=>(e.openBlock(),e.createElementBlock("button",{key:l.key,type:"button",class:e.normalizeClass(["rh-data-center-panel__category",{"is-active":c.value===l.key}]),onClick:g=>N(l)},[e.createElementVNode("span",null,e.toDisplayString(l.label),1),R(l)!==void 0?(e.openBlock(),e.createElementBlock("span",ne,e.toDisplayString(R(l)),1)):e.createCommentVNode("",!0)],10,oe))),128))]),e.createElementVNode("section",ae,[e.createElementVNode("div",le,[e.renderSlot(a.$slots,"header",{category:u.value},()=>[s[2]||(s[2]=e.createTextVNode("数据处理进度",-1))]),t.closeable?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"rh-data-center-panel__action",onClick:s[0]||(s[0]=l=>d("close"))},"关闭")):e.createCommentVNode("",!0)]),e.createElementVNode("div",re,[T.value?(e.openBlock(),e.createBlock($,{key:0,text:"加载中..."})):E.value?e.renderSlot(a.$slots,"error",{key:1,error:E.value,retry:V},()=>[e.createVNode($,{text:"任务加载失败",retryable:!0,onRetry:V})]):(n=B.value)!=null&&n.items.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:2},e.renderList(B.value.items,l=>e.renderSlot(a.$slots,"task",{key:l.id,task:l,category:u.value,action:w},()=>[e.createVNode(j,{task:l,onAction:g=>w(g,l)},null,8,["task","onAction"])])),128)):e.renderSlot(a.$slots,"empty",{key:3,category:u.value},()=>[e.createVNode($,{text:"暂无任务"})])]),e.renderSlot(a.$slots,"footer",{result:B.value,category:u.value},()=>{var l;return[t.showTotal?(e.openBlock(),e.createElementBlock("div",se,[e.createElementVNode("span",null,e.toDisplayString(((l=B.value)==null?void 0:l.total)||0)+"条记录",1),e.createElementVNode("span",null,e.toDisplayString(t.recentDaysText),1)])):e.createCommentVNode("",!0)]})])])}}}),ie=t=>typeof t=="function"?t():t.value,ce=(t,v)=>{const o=i=>{const d=i.target;if(!d)return;t.some(h=>{var p;return(p=ie(h))==null?void 0:p.contains(d)})||v()};e.onMounted(()=>document.addEventListener("click",o,!0)),e.onBeforeUnmount(()=>document.removeEventListener("click",o,!0))},de=["src"],ue=e.defineComponent({__name:"RhDataCenter",props:{modelValue:{type:Boolean,default:void 0},categories:{},loadTasks:{},label:{default:X},width:{default:Y},panelHeight:{default:J},panelRight:{default:0},pollInterval:{default:Q},refreshOnOpen:{type:Boolean,default:!0},closeOnClickOutside:{type:Boolean,default:!0},icon:{default:""},activeIcon:{default:""}},emits:["update:modelValue","open","close","refresh","task-action","error"],setup(t,{emit:v}){const o=t,i=v,d=e.ref(!1),c=e.ref(null),h=e.ref(null),p=e.ref(null),k=e.ref({}),y=e.ref(),_=e.ref(!1),u=e.computed(()=>o.modelValue===void 0?d.value:o.modelValue),C=e.computed(()=>u.value?o.activeIcon||o.icon:o.icon||o.activeIcon),B=r=>typeof r=="number"?`${r}px`:r,T=r=>typeof r=="number"?r:Number.parseFloat(r)||0,E=()=>{const r=c.value,f=h.value;if(!r||!f)return;const m=r.getBoundingClientRect(),D=f.offsetWidth||T(o.width),x=T(o.panelRight),b=8,A=m.right-D-x,P=Math.min(Math.max(b,A),Math.max(b,window.innerWidth-D-b)),z=Math.min(m.bottom+8,Math.max(b,window.innerHeight-f.offsetHeight-b));k.value={top:`${z}px`,left:`${P}px`,width:B(o.width),"--rh-ui-data-center-panel-height":B(o.panelHeight)}},R=()=>{_.value||(_.value=!0,window.addEventListener("resize",E),window.addEventListener("scroll",E,!0))},V=()=>{_.value&&(_.value=!1,window.removeEventListener("resize",E),window.removeEventListener("scroll",E,!0))},N=()=>{y.value!==void 0&&(window.clearInterval(y.value),y.value=void 0)},w=()=>{var r;(r=p.value)==null||r.refresh()},a=()=>{N(),!(!u.value||o.pollInterval<=0)&&(y.value=window.setInterval(w,o.pollInterval))},s=r=>{o.modelValue===void 0&&(d.value=r),i("update:modelValue",r)},n=()=>{u.value||(s(!0),i("open"))},l=()=>{u.value&&(s(!1),i("close"))},g=()=>u.value?l():n(),S=()=>{if(document.visibilityState==="hidden"){N();return}a(),w()};return e.watch(u,async r=>{if(N(),V(),!r){document.removeEventListener("visibilitychange",S);return}await e.nextTick(),E(),R(),document.addEventListener("visibilitychange",S),o.refreshOnOpen&&w(),a()},{immediate:!0}),ce([c,h],()=>{o.closeOnClickOutside&&u.value&&l()}),e.onBeforeUnmount(()=>{N(),V(),document.removeEventListener("visibilitychange",S)}),(r,f)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",{ref_key:"triggerRef",ref:c,class:"rh-data-center",onClick:e.withModifiers(g,["stop"])},[e.renderSlot(r.$slots,"trigger",{visible:u.value,open:n,close:l,toggle:g},()=>[e.createElementVNode("span",{class:e.normalizeClass(["rh-data-center__trigger",{"is-active":u.value}])},[C.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:C.value,class:"rh-data-center__icon",alt:""},null,8,de)):e.createCommentVNode("",!0),e.createElementVNode("span",null,e.toDisplayString(t.label),1)],2)],!0)],512),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[u.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"contentRef",ref:h,class:"rh-data-center__popover",style:e.normalizeStyle(k.value),onClick:f[3]||(f[3]=e.withModifiers(()=>{},["stop"]))},[e.createVNode(L,{ref_key:"panelRef",ref:p,categories:t.categories,"load-tasks":t.loadTasks,closeable:!0,onClose:l,onRefresh:f[0]||(f[0]=m=>i("refresh",m)),onTaskAction:f[1]||(f[1]=m=>i("task-action",m)),onError:f[2]||(f[2]=(m,D)=>i("error",m,D))},{header:e.withCtx(m=>[e.renderSlot(r.$slots,"header",e.normalizeProps(e.guardReactiveProps(m)),()=>[f[4]||(f[4]=e.createTextVNode("数据处理进度",-1))],!0)]),task:e.withCtx(m=>[e.renderSlot(r.$slots,"task",e.normalizeProps(e.guardReactiveProps(m)),void 0,!0)]),empty:e.withCtx(m=>[e.renderSlot(r.$slots,"empty",e.normalizeProps(e.guardReactiveProps(m)),void 0,!0)]),error:e.withCtx(m=>[e.renderSlot(r.$slots,"error",e.normalizeProps(e.guardReactiveProps(m)),void 0,!0)]),footer:e.withCtx(m=>[e.renderSlot(r.$slots,"footer",e.normalizeProps(e.guardReactiveProps(m)),void 0,!0)]),_:3},8,["categories","load-tasks"])],4)):e.createCommentVNode("",!0)]))],64))}});const me=I._export_sfc(ue,[["__scopeId","data-v-b6caa4d9"]]),ve={key:0,class:"rh-data-center-tip__guide"},pe={class:"rh-data-center-tip__content"},fe={key:0,class:"rh-data-center-tip__minutes"},ke={key:1,class:"rh-data-center-tip__description"},he=e.defineComponent({__name:"RhDataCenterTip",props:{modelValue:{type:Boolean,default:!1},minutes:{default:void 0},type:{default:void 0},title:{default:""},content:{default:""},width:{default:"540px"},showGuideAnimation:{type:Boolean,default:!0}},emits:["update:modelValue","close"],setup(t,{emit:v}){const o=v,i=()=>{o("update:modelValue",!1),o("close")};return(d,c)=>{const h=e.resolveComponent("el-button"),p=e.resolveComponent("el-dialog");return e.openBlock(),e.createBlock(p,{"model-value":t.modelValue,title:t.title||"提示",width:t.width,"append-to-body":"","onUpdate:modelValue":c[0]||(c[0]=k=>o("update:modelValue",k)),onClose:i},{footer:e.withCtx(()=>[e.createVNode(h,{type:"primary",onClick:i},{default:e.withCtx(()=>[...c[1]||(c[1]=[e.createTextVNode("关闭弹框",-1)])]),_:1})]),default:e.withCtx(()=>[t.showGuideAnimation?(e.openBlock(),e.createElementBlock("div",ve)):e.createCommentVNode("",!0),e.createElementVNode("div",pe,[t.minutes!==void 0?(e.openBlock(),e.createElementBlock("span",fe,e.toDisplayString((t.title||"任务处理中,大概需要")+t.minutes+"分钟"),1)):e.createCommentVNode("",!0),t.content?(e.openBlock(),e.createElementBlock("div",ke,e.toDisplayString(t.content),1)):e.createCommentVNode("",!0),e.renderSlot(d.$slots,"extra")])]),_:3},8,["model-value","title","width"])}}}),ye=()=>{const t=e.ref(!1),v=e.ref({});return{tipVisible:t,tipConfig:v,showTip:d=>{v.value={...d},t.value=!0},closeTip:()=>{t.value=!1}}};exports.RhDataCenter=me;exports.RhDataCenterPanel=L;exports.RhDataCenterTip=he;exports.useRhDataCenter=ye;
|
|
@@ -1,82 +1,83 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
|
|
1
|
+
import { defineComponent as O, openBlock as l, createElementBlock as i, createElementVNode as h, toDisplayString as g, createCommentVNode as C, computed as D, normalizeClass as K, normalizeStyle as Q, Fragment as U, renderList as q, ref as m, onMounted as Z, renderSlot as T, createTextVNode as X, createBlock as Y, createVNode as S, onBeforeUnmount as ee, watch as oe, nextTick as le, withModifiers as j, Teleport as re, withCtx as L, normalizeProps as N, guardReactiveProps as H, resolveComponent as J } from "vue";
|
|
2
|
+
import { _ as ie } from "../_plugin-vue_export-helper-dad06003.js";
|
|
3
|
+
const ce = { class: "rh-data-center-panel__state" }, W = /* @__PURE__ */ O({
|
|
3
4
|
__name: "RhDataCenterState",
|
|
4
5
|
props: {
|
|
5
6
|
text: {},
|
|
6
7
|
retryable: { type: Boolean, default: !1 }
|
|
7
8
|
},
|
|
8
9
|
emits: ["retry"],
|
|
9
|
-
setup(e, { emit:
|
|
10
|
-
const t =
|
|
11
|
-
return (
|
|
10
|
+
setup(e, { emit: p }) {
|
|
11
|
+
const t = p;
|
|
12
|
+
return (c, d) => (l(), i("div", ce, [
|
|
12
13
|
h("span", null, g(e.text), 1),
|
|
13
|
-
e.retryable ? (l(),
|
|
14
|
+
e.retryable ? (l(), i("button", {
|
|
14
15
|
key: 0,
|
|
15
16
|
type: "button",
|
|
16
17
|
class: "rh-data-center-panel__retry",
|
|
17
|
-
onClick:
|
|
18
|
+
onClick: d[0] || (d[0] = (u) => t("retry"))
|
|
18
19
|
}, " 重新加载 ")) : C("", !0)
|
|
19
20
|
]));
|
|
20
21
|
}
|
|
21
|
-
}),
|
|
22
|
+
}), ue = { class: "rh-data-center-panel__task" }, de = { class: "rh-data-center-panel__taskMain" }, ve = { class: "rh-data-center-panel__taskTitle" }, fe = {
|
|
22
23
|
key: 0,
|
|
23
24
|
class: "rh-data-center-panel__taskTag"
|
|
24
|
-
},
|
|
25
|
+
}, he = {
|
|
25
26
|
key: 0,
|
|
26
27
|
class: "rh-data-center-panel__progress"
|
|
27
|
-
},
|
|
28
|
+
}, me = { class: "rh-data-center-panel__meta" }, pe = {
|
|
28
29
|
key: 0,
|
|
29
30
|
class: "rh-data-center-panel__actions"
|
|
30
|
-
},
|
|
31
|
+
}, ye = ["disabled", "onClick"], _e = /* @__PURE__ */ O({
|
|
31
32
|
__name: "RhDataCenterTaskItem",
|
|
32
33
|
props: {
|
|
33
34
|
task: {}
|
|
34
35
|
},
|
|
35
36
|
emits: ["action"],
|
|
36
|
-
setup(e, { emit:
|
|
37
|
-
const t = e,
|
|
38
|
-
const
|
|
39
|
-
return Math.min(100, Math.max(0,
|
|
37
|
+
setup(e, { emit: p }) {
|
|
38
|
+
const t = e, c = p, d = D(() => {
|
|
39
|
+
const u = Number(t.task.progress || 0);
|
|
40
|
+
return Math.min(100, Math.max(0, u));
|
|
40
41
|
});
|
|
41
|
-
return (
|
|
42
|
+
return (u, b) => {
|
|
42
43
|
var y;
|
|
43
|
-
return l(),
|
|
44
|
-
h("div",
|
|
45
|
-
h("div",
|
|
44
|
+
return l(), i("div", ue, [
|
|
45
|
+
h("div", de, [
|
|
46
|
+
h("div", ve, [
|
|
46
47
|
h("span", null, g(e.task.title), 1),
|
|
47
|
-
e.task.tag ? (l(),
|
|
48
|
+
e.task.tag ? (l(), i("span", fe, g(e.task.tag), 1)) : C("", !0)
|
|
48
49
|
]),
|
|
49
|
-
e.task.status !== "success" ? (l(),
|
|
50
|
+
e.task.status !== "success" ? (l(), i("div", he, [
|
|
50
51
|
h("div", {
|
|
51
52
|
class: K(["rh-data-center-panel__progressBar", { "is-failed": e.task.status === "failed" }]),
|
|
52
|
-
style: Q({ width: `${
|
|
53
|
+
style: Q({ width: `${d.value}%` })
|
|
53
54
|
}, null, 6)
|
|
54
55
|
])) : C("", !0),
|
|
55
|
-
h("div",
|
|
56
|
-
e.task.message ? (l(),
|
|
56
|
+
h("div", me, g(e.task.createdAt), 1),
|
|
57
|
+
e.task.message ? (l(), i("div", {
|
|
57
58
|
key: 1,
|
|
58
59
|
class: K(["rh-data-center-panel__message", { "is-failed": e.task.status === "failed" }])
|
|
59
60
|
}, g(e.task.message), 3)) : C("", !0)
|
|
60
61
|
]),
|
|
61
|
-
(y = e.task.actions) != null && y.length ? (l(),
|
|
62
|
-
(l(!0),
|
|
62
|
+
(y = e.task.actions) != null && y.length ? (l(), i("div", pe, [
|
|
63
|
+
(l(!0), i(U, null, q(e.task.actions, (k) => (l(), i("button", {
|
|
63
64
|
key: k.key,
|
|
64
65
|
type: "button",
|
|
65
66
|
class: "rh-data-center-panel__action",
|
|
66
67
|
disabled: k.disabled,
|
|
67
|
-
onClick: (w) =>
|
|
68
|
-
}, g(k.label), 9,
|
|
68
|
+
onClick: (w) => c("action", k.key)
|
|
69
|
+
}, g(k.label), 9, ye))), 128))
|
|
69
70
|
])) : C("", !0)
|
|
70
71
|
]);
|
|
71
72
|
};
|
|
72
73
|
}
|
|
73
|
-
}),
|
|
74
|
+
}), ke = "数据处理中心", ge = 606, Ce = 500, be = 1e3, Te = "-此处仅展示近15天内的数据-", we = { class: "rh-data-center-panel" }, $e = { class: "rh-data-center-panel__sidebar" }, Re = ["onClick"], Ee = {
|
|
74
75
|
key: 0,
|
|
75
76
|
class: "rh-data-center-panel__categoryCount"
|
|
76
|
-
},
|
|
77
|
+
}, Ae = { class: "rh-data-center-panel__main" }, De = { class: "rh-data-center-panel__title" }, Le = { class: "rh-data-center-panel__scroll" }, Ve = {
|
|
77
78
|
key: 0,
|
|
78
79
|
class: "rh-data-center-panel__footer"
|
|
79
|
-
},
|
|
80
|
+
}, xe = /* @__PURE__ */ O({
|
|
80
81
|
__name: "RhDataCenterPanel",
|
|
81
82
|
props: {
|
|
82
83
|
categories: {},
|
|
@@ -84,11 +85,11 @@ const ie = { class: "rh-data-center-panel__state" }, W = /* @__PURE__ */ S({
|
|
|
84
85
|
activeCategoryKey: { default: void 0 },
|
|
85
86
|
closeable: { type: Boolean, default: !0 },
|
|
86
87
|
showTotal: { type: Boolean, default: !0 },
|
|
87
|
-
recentDaysText: { default:
|
|
88
|
+
recentDaysText: { default: Te }
|
|
88
89
|
},
|
|
89
90
|
emits: ["close", "refresh", "task-action", "error"],
|
|
90
|
-
setup(e, { expose:
|
|
91
|
-
const
|
|
91
|
+
setup(e, { expose: p, emit: t }) {
|
|
92
|
+
const c = e, d = t, u = m(c.activeCategoryKey), b = m({}), y = m({}), k = m({}), w = m({}), R = m({}), v = D(() => c.categories.find((n) => n.key === u.value) || c.categories[0]), E = D(() => {
|
|
92
93
|
var n;
|
|
93
94
|
return String(((n = v.value) == null ? void 0 : n.key) ?? "");
|
|
94
95
|
}), V = D(() => b.value[E.value]), M = D(() => y.value[E.value] === !0), A = D(() => k.value[E.value]), z = (n) => {
|
|
@@ -104,58 +105,58 @@ const ie = { class: "rh-data-center-panel__state" }, W = /* @__PURE__ */ S({
|
|
|
104
105
|
return;
|
|
105
106
|
R.value[a] = !0, y.value[a] = !0, k.value[a] = void 0;
|
|
106
107
|
const s = (w.value[a] || 0) + 1;
|
|
107
|
-
w.value[a] = s,
|
|
108
|
+
w.value[a] = s, d("refresh", r);
|
|
108
109
|
try {
|
|
109
|
-
const $ = await
|
|
110
|
+
const $ = await c.loadTasks({ category: r });
|
|
110
111
|
if (w.value[a] !== s || E.value !== a)
|
|
111
112
|
return;
|
|
112
113
|
b.value[a] = $;
|
|
113
114
|
} catch ($) {
|
|
114
115
|
if (w.value[a] !== s || E.value !== a)
|
|
115
116
|
return;
|
|
116
|
-
k.value[a] = $,
|
|
117
|
+
k.value[a] = $, d("error", $, r);
|
|
117
118
|
} finally {
|
|
118
119
|
w.value[a] === s && (y.value[a] = !1, R.value[a] = !1);
|
|
119
120
|
}
|
|
120
121
|
}, B = async (n) => {
|
|
121
|
-
|
|
122
|
+
u.value !== n.key && (u.value = n.key, await x());
|
|
122
123
|
}, P = (n, r) => {
|
|
123
124
|
const a = v.value;
|
|
124
|
-
a &&
|
|
125
|
+
a && d("task-action", { action: n, task: r, category: a });
|
|
125
126
|
};
|
|
126
127
|
return Z(() => {
|
|
127
128
|
var n;
|
|
128
|
-
|
|
129
|
-
}),
|
|
129
|
+
u.value === void 0 && (u.value = (n = c.categories[0]) == null ? void 0 : n.key);
|
|
130
|
+
}), p({
|
|
130
131
|
refresh: x
|
|
131
132
|
}), (n, r) => {
|
|
132
133
|
var a;
|
|
133
|
-
return l(),
|
|
134
|
-
h("aside",
|
|
134
|
+
return l(), i("div", we, [
|
|
135
|
+
h("aside", $e, [
|
|
135
136
|
r[1] || (r[1] = h("div", { class: "rh-data-center-panel__title" }, "数据类型", -1)),
|
|
136
|
-
(l(!0),
|
|
137
|
+
(l(!0), i(U, null, q(e.categories, (s) => (l(), i("button", {
|
|
137
138
|
key: s.key,
|
|
138
139
|
type: "button",
|
|
139
|
-
class: K(["rh-data-center-panel__category", { "is-active":
|
|
140
|
+
class: K(["rh-data-center-panel__category", { "is-active": u.value === s.key }]),
|
|
140
141
|
onClick: ($) => B(s)
|
|
141
142
|
}, [
|
|
142
143
|
h("span", null, g(s.label), 1),
|
|
143
|
-
z(s) !== void 0 ? (l(),
|
|
144
|
-
], 10,
|
|
144
|
+
z(s) !== void 0 ? (l(), i("span", Ee, g(z(s)), 1)) : C("", !0)
|
|
145
|
+
], 10, Re))), 128))
|
|
145
146
|
]),
|
|
146
|
-
h("section",
|
|
147
|
-
h("div",
|
|
147
|
+
h("section", Ae, [
|
|
148
|
+
h("div", De, [
|
|
148
149
|
T(n.$slots, "header", { category: v.value }, () => [
|
|
149
150
|
r[2] || (r[2] = X("数据处理进度", -1))
|
|
150
151
|
]),
|
|
151
|
-
e.closeable ? (l(),
|
|
152
|
+
e.closeable ? (l(), i("button", {
|
|
152
153
|
key: 0,
|
|
153
154
|
type: "button",
|
|
154
155
|
class: "rh-data-center-panel__action",
|
|
155
|
-
onClick: r[0] || (r[0] = (s) =>
|
|
156
|
+
onClick: r[0] || (r[0] = (s) => d("close"))
|
|
156
157
|
}, "关闭")) : C("", !0)
|
|
157
158
|
]),
|
|
158
|
-
h("div",
|
|
159
|
+
h("div", Le, [
|
|
159
160
|
M.value ? (l(), Y(W, {
|
|
160
161
|
key: 0,
|
|
161
162
|
text: "加载中..."
|
|
@@ -164,18 +165,18 @@ const ie = { class: "rh-data-center-panel__state" }, W = /* @__PURE__ */ S({
|
|
|
164
165
|
error: A.value,
|
|
165
166
|
retry: x
|
|
166
167
|
}, () => [
|
|
167
|
-
|
|
168
|
+
S(W, {
|
|
168
169
|
text: "任务加载失败",
|
|
169
170
|
retryable: !0,
|
|
170
171
|
onRetry: x
|
|
171
172
|
})
|
|
172
|
-
]) : (a = V.value) != null && a.items.length ? (l(!0),
|
|
173
|
+
]) : (a = V.value) != null && a.items.length ? (l(!0), i(U, { key: 2 }, q(V.value.items, (s) => T(n.$slots, "task", {
|
|
173
174
|
key: s.id,
|
|
174
175
|
task: s,
|
|
175
176
|
category: v.value,
|
|
176
177
|
action: P
|
|
177
178
|
}, () => [
|
|
178
|
-
|
|
179
|
+
S(_e, {
|
|
179
180
|
task: s,
|
|
180
181
|
onAction: ($) => P($, s)
|
|
181
182
|
}, null, 8, ["task", "onAction"])
|
|
@@ -183,7 +184,7 @@ const ie = { class: "rh-data-center-panel__state" }, W = /* @__PURE__ */ S({
|
|
|
183
184
|
key: 3,
|
|
184
185
|
category: v.value
|
|
185
186
|
}, () => [
|
|
186
|
-
|
|
187
|
+
S(W, { text: "暂无任务" })
|
|
187
188
|
])
|
|
188
189
|
]),
|
|
189
190
|
T(n.$slots, "footer", {
|
|
@@ -192,7 +193,7 @@ const ie = { class: "rh-data-center-panel__state" }, W = /* @__PURE__ */ S({
|
|
|
192
193
|
}, () => {
|
|
193
194
|
var s;
|
|
194
195
|
return [
|
|
195
|
-
e.showTotal ? (l(),
|
|
196
|
+
e.showTotal ? (l(), i("div", Ve, [
|
|
196
197
|
h("span", null, g(((s = V.value) == null ? void 0 : s.total) || 0) + "条记录", 1),
|
|
197
198
|
h("span", null, g(e.recentDaysText), 1)
|
|
198
199
|
])) : C("", !0)
|
|
@@ -202,37 +203,37 @@ const ie = { class: "rh-data-center-panel__state" }, W = /* @__PURE__ */ S({
|
|
|
202
203
|
]);
|
|
203
204
|
};
|
|
204
205
|
}
|
|
205
|
-
}),
|
|
206
|
-
const t = (
|
|
207
|
-
const
|
|
208
|
-
if (!
|
|
206
|
+
}), Be = (e) => typeof e == "function" ? e() : e.value, Pe = (e, p) => {
|
|
207
|
+
const t = (c) => {
|
|
208
|
+
const d = c.target;
|
|
209
|
+
if (!d)
|
|
209
210
|
return;
|
|
210
211
|
e.some((b) => {
|
|
211
212
|
var y;
|
|
212
|
-
return (y =
|
|
213
|
-
}) ||
|
|
213
|
+
return (y = Be(b)) == null ? void 0 : y.contains(d);
|
|
214
|
+
}) || p();
|
|
214
215
|
};
|
|
215
216
|
Z(() => document.addEventListener("click", t, !0)), ee(() => document.removeEventListener("click", t, !0));
|
|
216
|
-
},
|
|
217
|
+
}, Ie = ["src"], Ne = /* @__PURE__ */ O({
|
|
217
218
|
__name: "RhDataCenter",
|
|
218
219
|
props: {
|
|
219
220
|
modelValue: { type: Boolean, default: void 0 },
|
|
220
221
|
categories: {},
|
|
221
222
|
loadTasks: {},
|
|
222
|
-
label: { default:
|
|
223
|
-
width: { default:
|
|
224
|
-
panelHeight: { default:
|
|
223
|
+
label: { default: ke },
|
|
224
|
+
width: { default: ge },
|
|
225
|
+
panelHeight: { default: Ce },
|
|
225
226
|
panelRight: { default: 0 },
|
|
226
|
-
pollInterval: { default:
|
|
227
|
+
pollInterval: { default: be },
|
|
227
228
|
refreshOnOpen: { type: Boolean, default: !0 },
|
|
228
229
|
closeOnClickOutside: { type: Boolean, default: !0 },
|
|
229
230
|
icon: { default: "" },
|
|
230
231
|
activeIcon: { default: "" }
|
|
231
232
|
},
|
|
232
233
|
emits: ["update:modelValue", "open", "close", "refresh", "task-action", "error"],
|
|
233
|
-
setup(e, { emit:
|
|
234
|
-
const t = e,
|
|
235
|
-
const o =
|
|
234
|
+
setup(e, { emit: p }) {
|
|
235
|
+
const t = e, c = p, d = m(!1), u = m(null), b = m(null), y = m(null), k = m({}), w = m(), R = m(!1), v = D(() => t.modelValue === void 0 ? d.value : t.modelValue), E = D(() => v.value ? t.activeIcon || t.icon : t.icon || t.activeIcon), V = (o) => typeof o == "number" ? `${o}px` : o, M = (o) => typeof o == "number" ? o : Number.parseFloat(o) || 0, A = () => {
|
|
236
|
+
const o = u.value, _ = b.value;
|
|
236
237
|
if (!o || !_)
|
|
237
238
|
return;
|
|
238
239
|
const f = o.getBoundingClientRect(), F = _.offsetWidth || M(t.width), te = M(t.panelRight), I = 8, ae = f.right - F - te, ne = Math.min(
|
|
@@ -260,11 +261,11 @@ const ie = { class: "rh-data-center-panel__state" }, W = /* @__PURE__ */ S({
|
|
|
260
261
|
}, n = () => {
|
|
261
262
|
B(), !(!v.value || t.pollInterval <= 0) && (w.value = window.setInterval(P, t.pollInterval));
|
|
262
263
|
}, r = (o) => {
|
|
263
|
-
t.modelValue === void 0 && (
|
|
264
|
+
t.modelValue === void 0 && (d.value = o), c("update:modelValue", o);
|
|
264
265
|
}, a = () => {
|
|
265
|
-
v.value || (r(!0),
|
|
266
|
+
v.value || (r(!0), c("open"));
|
|
266
267
|
}, s = () => {
|
|
267
|
-
v.value && (r(!1),
|
|
268
|
+
v.value && (r(!1), c("close"));
|
|
268
269
|
}, $ = () => v.value ? s() : a(), G = () => {
|
|
269
270
|
if (document.visibilityState === "hidden") {
|
|
270
271
|
B();
|
|
@@ -278,14 +279,14 @@ const ie = { class: "rh-data-center-panel__state" }, W = /* @__PURE__ */ S({
|
|
|
278
279
|
return;
|
|
279
280
|
}
|
|
280
281
|
await le(), A(), z(), document.addEventListener("visibilitychange", G), t.refreshOnOpen && P(), n();
|
|
281
|
-
}, { immediate: !0 }),
|
|
282
|
+
}, { immediate: !0 }), Pe([u, b], () => {
|
|
282
283
|
t.closeOnClickOutside && v.value && s();
|
|
283
284
|
}), ee(() => {
|
|
284
285
|
B(), x(), document.removeEventListener("visibilitychange", G);
|
|
285
|
-
}), (o, _) => (l(),
|
|
286
|
+
}), (o, _) => (l(), i(U, null, [
|
|
286
287
|
h("div", {
|
|
287
288
|
ref_key: "triggerRef",
|
|
288
|
-
ref:
|
|
289
|
+
ref: u,
|
|
289
290
|
class: "rh-data-center",
|
|
290
291
|
onClick: j($, ["stop"])
|
|
291
292
|
}, [
|
|
@@ -298,18 +299,18 @@ const ie = { class: "rh-data-center-panel__state" }, W = /* @__PURE__ */ S({
|
|
|
298
299
|
h("span", {
|
|
299
300
|
class: K(["rh-data-center__trigger", { "is-active": v.value }])
|
|
300
301
|
}, [
|
|
301
|
-
E.value ? (l(),
|
|
302
|
+
E.value ? (l(), i("img", {
|
|
302
303
|
key: 0,
|
|
303
304
|
src: E.value,
|
|
304
305
|
class: "rh-data-center__icon",
|
|
305
306
|
alt: ""
|
|
306
|
-
}, null, 8,
|
|
307
|
+
}, null, 8, Ie)) : C("", !0),
|
|
307
308
|
h("span", null, g(e.label), 1)
|
|
308
309
|
], 2)
|
|
309
310
|
], !0)
|
|
310
311
|
], 512),
|
|
311
312
|
(l(), Y(re, { to: "body" }, [
|
|
312
|
-
v.value ? (l(),
|
|
313
|
+
v.value ? (l(), i("div", {
|
|
313
314
|
key: 0,
|
|
314
315
|
ref_key: "contentRef",
|
|
315
316
|
ref: b,
|
|
@@ -318,16 +319,16 @@ const ie = { class: "rh-data-center-panel__state" }, W = /* @__PURE__ */ S({
|
|
|
318
319
|
onClick: _[3] || (_[3] = j(() => {
|
|
319
320
|
}, ["stop"]))
|
|
320
321
|
}, [
|
|
321
|
-
|
|
322
|
+
S(xe, {
|
|
322
323
|
ref_key: "panelRef",
|
|
323
324
|
ref: y,
|
|
324
325
|
categories: e.categories,
|
|
325
326
|
"load-tasks": e.loadTasks,
|
|
326
327
|
closeable: !0,
|
|
327
328
|
onClose: s,
|
|
328
|
-
onRefresh: _[0] || (_[0] = (f) =>
|
|
329
|
-
onTaskAction: _[1] || (_[1] = (f) =>
|
|
330
|
-
onError: _[2] || (_[2] = (f, F) =>
|
|
329
|
+
onRefresh: _[0] || (_[0] = (f) => c("refresh", f)),
|
|
330
|
+
onTaskAction: _[1] || (_[1] = (f) => c("task-action", f)),
|
|
331
|
+
onError: _[2] || (_[2] = (f, F) => c("error", f, F))
|
|
331
332
|
}, {
|
|
332
333
|
header: L((f) => [
|
|
333
334
|
T(o.$slots, "header", N(H(f)), () => [
|
|
@@ -353,21 +354,16 @@ const ie = { class: "rh-data-center-panel__state" }, W = /* @__PURE__ */ S({
|
|
|
353
354
|
], 64));
|
|
354
355
|
}
|
|
355
356
|
});
|
|
356
|
-
const
|
|
357
|
-
const t = e.__vccOpts || e;
|
|
358
|
-
for (const [i, u] of m)
|
|
359
|
-
t[i] = u;
|
|
360
|
-
return t;
|
|
361
|
-
}, Fe = /* @__PURE__ */ Ne(Ie, [["__scopeId", "data-v-b6caa4d9"]]), He = {
|
|
357
|
+
const Ke = /* @__PURE__ */ ie(Ne, [["__scopeId", "data-v-b6caa4d9"]]), He = {
|
|
362
358
|
key: 0,
|
|
363
359
|
class: "rh-data-center-tip__guide"
|
|
364
|
-
},
|
|
360
|
+
}, Se = { class: "rh-data-center-tip__content" }, Oe = {
|
|
365
361
|
key: 0,
|
|
366
362
|
class: "rh-data-center-tip__minutes"
|
|
367
363
|
}, Me = {
|
|
368
364
|
key: 1,
|
|
369
365
|
class: "rh-data-center-tip__description"
|
|
370
|
-
},
|
|
366
|
+
}, Ue = /* @__PURE__ */ O({
|
|
371
367
|
__name: "RhDataCenterTip",
|
|
372
368
|
props: {
|
|
373
369
|
modelValue: { type: Boolean, default: !1 },
|
|
@@ -379,50 +375,50 @@ const Ne = (e, m) => {
|
|
|
379
375
|
showGuideAnimation: { type: Boolean, default: !0 }
|
|
380
376
|
},
|
|
381
377
|
emits: ["update:modelValue", "close"],
|
|
382
|
-
setup(e, { emit:
|
|
383
|
-
const t =
|
|
378
|
+
setup(e, { emit: p }) {
|
|
379
|
+
const t = p, c = () => {
|
|
384
380
|
t("update:modelValue", !1), t("close");
|
|
385
381
|
};
|
|
386
|
-
return (
|
|
382
|
+
return (d, u) => {
|
|
387
383
|
const b = J("el-button"), y = J("el-dialog");
|
|
388
384
|
return l(), Y(y, {
|
|
389
385
|
"model-value": e.modelValue,
|
|
390
386
|
title: e.title || "提示",
|
|
391
387
|
width: e.width,
|
|
392
388
|
"append-to-body": "",
|
|
393
|
-
"onUpdate:modelValue":
|
|
394
|
-
onClose:
|
|
389
|
+
"onUpdate:modelValue": u[0] || (u[0] = (k) => t("update:modelValue", k)),
|
|
390
|
+
onClose: c
|
|
395
391
|
}, {
|
|
396
392
|
footer: L(() => [
|
|
397
|
-
|
|
393
|
+
S(b, {
|
|
398
394
|
type: "primary",
|
|
399
|
-
onClick:
|
|
395
|
+
onClick: c
|
|
400
396
|
}, {
|
|
401
|
-
default: L(() => [...
|
|
397
|
+
default: L(() => [...u[1] || (u[1] = [
|
|
402
398
|
X("关闭弹框", -1)
|
|
403
399
|
])]),
|
|
404
400
|
_: 1
|
|
405
401
|
})
|
|
406
402
|
]),
|
|
407
403
|
default: L(() => [
|
|
408
|
-
e.showGuideAnimation ? (l(),
|
|
409
|
-
h("div",
|
|
410
|
-
e.minutes !== void 0 ? (l(),
|
|
411
|
-
e.content ? (l(),
|
|
412
|
-
T(
|
|
404
|
+
e.showGuideAnimation ? (l(), i("div", He)) : C("", !0),
|
|
405
|
+
h("div", Se, [
|
|
406
|
+
e.minutes !== void 0 ? (l(), i("span", Oe, g((e.title || "任务处理中,大概需要") + e.minutes + "分钟"), 1)) : C("", !0),
|
|
407
|
+
e.content ? (l(), i("div", Me, g(e.content), 1)) : C("", !0),
|
|
408
|
+
T(d.$slots, "extra")
|
|
413
409
|
])
|
|
414
410
|
]),
|
|
415
411
|
_: 3
|
|
416
412
|
}, 8, ["model-value", "title", "width"]);
|
|
417
413
|
};
|
|
418
414
|
}
|
|
419
|
-
}),
|
|
420
|
-
const e =
|
|
415
|
+
}), Ge = () => {
|
|
416
|
+
const e = m(!1), p = m({});
|
|
421
417
|
return {
|
|
422
418
|
tipVisible: e,
|
|
423
|
-
tipConfig:
|
|
424
|
-
showTip: (
|
|
425
|
-
|
|
419
|
+
tipConfig: p,
|
|
420
|
+
showTip: (d) => {
|
|
421
|
+
p.value = { ...d }, e.value = !0;
|
|
426
422
|
},
|
|
427
423
|
closeTip: () => {
|
|
428
424
|
e.value = !1;
|
|
@@ -430,8 +426,8 @@ const Ne = (e, m) => {
|
|
|
430
426
|
};
|
|
431
427
|
};
|
|
432
428
|
export {
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
429
|
+
Ke as RhDataCenter,
|
|
430
|
+
xe as RhDataCenterPanel,
|
|
431
|
+
Ue as RhDataCenterTip,
|
|
432
|
+
Ge as useRhDataCenter
|
|
437
433
|
};
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./data-center/index.cjs");require("vue");exports.RhDataCenter=e.RhDataCenter;exports.RhDataCenterPanel=e.RhDataCenterPanel;exports.RhDataCenterTip=e.RhDataCenterTip;exports.useRhDataCenter=e.useRhDataCenter;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./data-center/index.cjs"),t=require("./responsive-info-grid/index.cjs");require("vue");require("./_plugin-vue_export-helper-f246444f.cjs");exports.RhDataCenter=e.RhDataCenter;exports.RhDataCenterPanel=e.RhDataCenterPanel;exports.RhDataCenterTip=e.RhDataCenterTip;exports.useRhDataCenter=e.useRhDataCenter;exports.RhResponsiveInfoGrid=t.RhResponsiveInfoGrid;exports.RhResponsiveInfoGridItem=t.RhResponsiveInfoGridItem;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import { RhDataCenter as
|
|
1
|
+
import { RhDataCenter as a, RhDataCenterPanel as n, RhDataCenterTip as R, useRhDataCenter as i } from "./data-center/index.js";
|
|
2
|
+
import { RhResponsiveInfoGrid as h, RhResponsiveInfoGridItem as m } from "./responsive-info-grid/index.js";
|
|
2
3
|
import "vue";
|
|
4
|
+
import "./_plugin-vue_export-helper-dad06003.js";
|
|
3
5
|
export {
|
|
4
|
-
|
|
6
|
+
a as RhDataCenter,
|
|
5
7
|
n as RhDataCenterPanel,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
R as RhDataCenterTip,
|
|
9
|
+
h as RhResponsiveInfoGrid,
|
|
10
|
+
m as RhResponsiveInfoGridItem,
|
|
11
|
+
i as useRhDataCenter
|
|
8
12
|
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
declare function __VLS_template(): {
|
|
2
|
+
default?(_: {}): any;
|
|
3
|
+
};
|
|
4
|
+
declare const __VLS_component: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
5
|
+
columns?: number;
|
|
6
|
+
tabletColumns?: number;
|
|
7
|
+
mobileColumns?: number;
|
|
8
|
+
gap?: string;
|
|
9
|
+
}>, {
|
|
10
|
+
columns: number;
|
|
11
|
+
tabletColumns: number;
|
|
12
|
+
mobileColumns: number;
|
|
13
|
+
gap: string;
|
|
14
|
+
}>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
15
|
+
columns?: number;
|
|
16
|
+
tabletColumns?: number;
|
|
17
|
+
mobileColumns?: number;
|
|
18
|
+
gap?: string;
|
|
19
|
+
}>, {
|
|
20
|
+
columns: number;
|
|
21
|
+
tabletColumns: number;
|
|
22
|
+
mobileColumns: number;
|
|
23
|
+
gap: string;
|
|
24
|
+
}>>> & Readonly<{}>, {
|
|
25
|
+
columns: number;
|
|
26
|
+
tabletColumns: number;
|
|
27
|
+
mobileColumns: number;
|
|
28
|
+
gap: string;
|
|
29
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
30
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
31
|
+
export default _default;
|
|
32
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
33
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
34
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
35
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
36
|
+
} : {
|
|
37
|
+
type: import('vue').PropType<T[K]>;
|
|
38
|
+
required: true;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
type __VLS_WithDefaults<P, D> = {
|
|
42
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
43
|
+
default: D[K];
|
|
44
|
+
}> : P[K];
|
|
45
|
+
};
|
|
46
|
+
type __VLS_Prettify<T> = {
|
|
47
|
+
[K in keyof T]: T[K];
|
|
48
|
+
} & {};
|
|
49
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
50
|
+
new (): {
|
|
51
|
+
$slots: S;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
declare function __VLS_template(): {
|
|
2
|
+
title?(_: {}): any;
|
|
3
|
+
content?(_: {}): any;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_component: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
6
|
+
title?: string;
|
|
7
|
+
content?: string | number;
|
|
8
|
+
span?: number;
|
|
9
|
+
}>, {
|
|
10
|
+
title: string;
|
|
11
|
+
content: string;
|
|
12
|
+
span: number;
|
|
13
|
+
}>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
14
|
+
title?: string;
|
|
15
|
+
content?: string | number;
|
|
16
|
+
span?: number;
|
|
17
|
+
}>, {
|
|
18
|
+
title: string;
|
|
19
|
+
content: string;
|
|
20
|
+
span: number;
|
|
21
|
+
}>>> & Readonly<{}>, {
|
|
22
|
+
span: number;
|
|
23
|
+
title: string;
|
|
24
|
+
content: string | number;
|
|
25
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
26
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
27
|
+
export default _default;
|
|
28
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
29
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
30
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
31
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
32
|
+
} : {
|
|
33
|
+
type: import('vue').PropType<T[K]>;
|
|
34
|
+
required: true;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
type __VLS_WithDefaults<P, D> = {
|
|
38
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
39
|
+
default: D[K];
|
|
40
|
+
}> : P[K];
|
|
41
|
+
};
|
|
42
|
+
type __VLS_Prettify<T> = {
|
|
43
|
+
[K in keyof T]: T[K];
|
|
44
|
+
} & {};
|
|
45
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
46
|
+
new (): {
|
|
47
|
+
$slots: S;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),o=require("../_plugin-vue_export-helper-f246444f.cjs"),i=e.defineComponent({__name:"RhResponsiveInfoGrid",props:{columns:{default:4},tabletColumns:{default:2},mobileColumns:{default:1},gap:{default:"15px 15px"}},setup(t){return(n,s)=>(e.openBlock(),e.createElementBlock("div",{class:"responsive-info-grid",style:e.normalizeStyle({"--responsive-info-grid-columns":String(t.columns),"--responsive-info-grid-tablet-columns":String(t.tabletColumns),"--responsive-info-grid-mobile-columns":String(t.mobileColumns),"--responsive-info-grid-gap":t.gap})},[e.renderSlot(n.$slots,"default",{},void 0,!0)],4))}});const l=o._export_sfc(i,[["__scopeId","data-v-85b5413b"]]),r={class:"responsive-info-grid-item__title"},d={class:"responsive-info-grid-item__content"},a=e.defineComponent({__name:"RhResponsiveInfoGridItem",props:{title:{default:""},content:{default:""},span:{default:1}},setup(t){return(n,s)=>(e.openBlock(),e.createElementBlock("div",{class:"responsive-info-grid-item",style:e.normalizeStyle({gridColumn:t.span>1?`span ${t.span}`:void 0})},[e.createElementVNode("div",r,[e.renderSlot(n.$slots,"title",{},()=>[e.createTextVNode(e.toDisplayString(t.title),1)],!0)]),e.createElementVNode("div",d,[e.renderSlot(n.$slots,"content",{},()=>[e.createTextVNode(e.toDisplayString(t.content),1)],!0)])],4))}});const c=o._export_sfc(a,[["__scopeId","data-v-67645283"]]);exports.RhResponsiveInfoGrid=l;exports.RhResponsiveInfoGridItem=c;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { defineComponent as l, openBlock as r, createElementBlock as d, normalizeStyle as a, renderSlot as n, createElementVNode as o, createTextVNode as s, toDisplayString as i } from "vue";
|
|
2
|
+
import { _ as c } from "../_plugin-vue_export-helper-dad06003.js";
|
|
3
|
+
const u = /* @__PURE__ */ l({
|
|
4
|
+
__name: "RhResponsiveInfoGrid",
|
|
5
|
+
props: {
|
|
6
|
+
columns: { default: 4 },
|
|
7
|
+
tabletColumns: { default: 2 },
|
|
8
|
+
mobileColumns: { default: 1 },
|
|
9
|
+
gap: { default: "15px 15px" }
|
|
10
|
+
},
|
|
11
|
+
setup(e) {
|
|
12
|
+
return (t, m) => (r(), d("div", {
|
|
13
|
+
class: "responsive-info-grid",
|
|
14
|
+
style: a({
|
|
15
|
+
"--responsive-info-grid-columns": String(e.columns),
|
|
16
|
+
"--responsive-info-grid-tablet-columns": String(e.tabletColumns),
|
|
17
|
+
"--responsive-info-grid-mobile-columns": String(e.mobileColumns),
|
|
18
|
+
"--responsive-info-grid-gap": e.gap
|
|
19
|
+
})
|
|
20
|
+
}, [
|
|
21
|
+
n(t.$slots, "default", {}, void 0, !0)
|
|
22
|
+
], 4));
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
const R = /* @__PURE__ */ c(u, [["__scopeId", "data-v-85b5413b"]]), p = { class: "responsive-info-grid-item__title" }, _ = { class: "responsive-info-grid-item__content" }, f = /* @__PURE__ */ l({
|
|
26
|
+
__name: "RhResponsiveInfoGridItem",
|
|
27
|
+
props: {
|
|
28
|
+
title: { default: "" },
|
|
29
|
+
content: { default: "" },
|
|
30
|
+
span: { default: 1 }
|
|
31
|
+
},
|
|
32
|
+
setup(e) {
|
|
33
|
+
return (t, m) => (r(), d("div", {
|
|
34
|
+
class: "responsive-info-grid-item",
|
|
35
|
+
style: a({ gridColumn: e.span > 1 ? `span ${e.span}` : void 0 })
|
|
36
|
+
}, [
|
|
37
|
+
o("div", p, [
|
|
38
|
+
n(t.$slots, "title", {}, () => [
|
|
39
|
+
s(i(e.title), 1)
|
|
40
|
+
], !0)
|
|
41
|
+
]),
|
|
42
|
+
o("div", _, [
|
|
43
|
+
n(t.$slots, "content", {}, () => [
|
|
44
|
+
s(i(e.content), 1)
|
|
45
|
+
], !0)
|
|
46
|
+
])
|
|
47
|
+
], 4));
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
const I = /* @__PURE__ */ c(f, [["__scopeId", "data-v-67645283"]]);
|
|
51
|
+
export {
|
|
52
|
+
R as RhResponsiveInfoGrid,
|
|
53
|
+
I as RhResponsiveInfoGridItem
|
|
54
|
+
};
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
:root{--rh-ui-data-center-primary: #00828a;--rh-ui-data-center-primary-soft: #cfe8ea;--rh-ui-data-center-panel-width: 606px;--rh-ui-data-center-panel-height: 500px;--rh-ui-data-center-text: #333;--rh-ui-data-center-secondary-text: #999;--rh-ui-data-center-border: #e9e9e9}.rh-data-center-panel{width:var(--rh-ui-data-center-panel-width);height:var(--rh-ui-data-center-panel-height);display:flex;overflow:hidden;box-sizing:border-box;background:#fff;border:1px solid var(--rh-ui-data-center-border);border-radius:8px;box-shadow:0 12px 32px #0f172a29}.rh-data-center-panel__sidebar{width:124px;flex:0 0 124px;box-sizing:border-box;padding:16px 10px;border-right:1px solid var(--rh-ui-data-center-border)}.rh-data-center-panel__main{min-width:0;flex:1;padding:16px 0 10px 15px}.rh-data-center-panel__title{display:flex;align-items:center;justify-content:space-between;margin:0 10px 15px 0;color:var(--rh-ui-data-center-text);font-size:16px;font-weight:600}.rh-data-center-panel__category{width:104px;min-height:32px;display:flex;align-items:center;justify-content:space-between;box-sizing:border-box;margin:10px 0;padding:0 10px;border-radius:3px;color:#666;cursor:pointer;font-size:14px}.rh-data-center-panel__category.is-active{background:var(--rh-ui-data-center-primary-soft);color:var(--rh-ui-data-center-primary);font-weight:600}.rh-data-center-panel__categoryCount{color:#999;font-size:12px;font-weight:400}.rh-data-center-panel__category.is-active .rh-data-center-panel__categoryCount{color:var(--rh-ui-data-center-primary)}.rh-data-center-panel__scroll{height:calc(100% - 48px);padding-right:10px;overflow-y:auto}.rh-data-center-panel__task{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;box-sizing:border-box;min-height:84px;margin-bottom:10px;padding:0 10px 10px 0;border-bottom:1px solid var(--rh-ui-data-center-border)}.rh-data-center-panel__taskMain{min-width:0;flex:1}.rh-data-center-panel__taskTitle{overflow:hidden;color:var(--rh-ui-data-center-text);font-size:14px;line-height:20px;text-overflow:ellipsis;white-space:nowrap}.rh-data-center-panel__taskTag{display:inline-block;margin-left:8px;padding:1px 8px;border-radius:12px;background:#f5f6f7;color:#999;font-size:12px;line-height:20px;vertical-align:1px}.rh-data-center-panel__progress{width:100%;height:4px;margin:7px 0 5px;overflow:hidden;border-radius:4px;background:#edf0f1}.rh-data-center-panel__progressBar{height:100%;border-radius:inherit;background:var(--rh-ui-data-center-primary);transition:width .3s ease}.rh-data-center-panel__progressBar.is-failed{background:#f04444}.rh-data-center-panel__meta,.rh-data-center-panel__message{color:var(--rh-ui-data-center-secondary-text);font-size:11px;line-height:18px}.rh-data-center-panel__message.is-failed{color:#f04444;font-size:12px}.rh-data-center-panel__actions{flex:0 0 auto;display:flex;align-items:flex-end;gap:10px;min-height:56px;padding-bottom:1px}.rh-data-center-panel__action{padding:0;border:0;background:transparent;color:#008ae6;cursor:pointer;font-size:12px;white-space:nowrap}.rh-data-center-panel__action:disabled{color:#bbb;cursor:not-allowed}.rh-data-center-panel__state{min-height:260px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;color:var(--rh-ui-data-center-secondary-text);font-size:14px}.rh-data-center-panel__retry{border:0;background:transparent;color:var(--rh-ui-data-center-primary);cursor:pointer}.rh-data-center-panel__footer{display:flex;justify-content:space-between;box-sizing:border-box;padding:8px 10px 0 0;color:var(--rh-ui-data-center-secondary-text);font-size:12px}.rh-data-center-tip__content{display:flex;flex-direction:column;align-items:center;color:var(--rh-ui-data-center-text)}.rh-data-center-tip__minutes{color:var(--rh-ui-data-center-primary);font-size:18px}.rh-data-center-tip__description{margin:15px 0 30px;font-size:14px;line-height:22px}.rh-data-center-tip__guide{width:120px;height:56px;position:relative;margin:-20px auto 8px;border-radius:50%;background:radial-gradient(circle at 50% 55%,rgba(0,130,138,.18),transparent 65%)}.rh-data-center-tip__guide:after{content:">";position:absolute;top:0;right:15px;color:var(--rh-ui-data-center-primary);font-size:32px;animation:rh-data-center-guide 1.5s ease-in-out infinite}@keyframes rh-data-center-guide{0%,to{transform:translate(-8px,5px)}50%{transform:translate(0)}}.rh-data-center[data-v-b6caa4d9]{position:relative;display:inline-flex;align-items:center}.rh-data-center__trigger[data-v-b6caa4d9]{display:inline-flex;align-items:center;min-height:30px;padding:0 8px;border-radius:4px;color:var(--rh-ui-data-center-text);cursor:pointer;transition:background-color .2s ease,color .2s ease}.rh-data-center__trigger[data-v-b6caa4d9]:hover,.rh-data-center__trigger.is-active[data-v-b6caa4d9]{background:rgba(0,130,138,.08);color:var(--rh-ui-data-center-primary)}.rh-data-center__icon[data-v-b6caa4d9]{width:22px;margin-right:5px}.rh-data-center__popover[data-v-b6caa4d9]{position:fixed;z-index:3000;box-sizing:border-box}
|
|
1
|
+
:root{--rh-ui-data-center-primary: #00828a;--rh-ui-data-center-primary-soft: #cfe8ea;--rh-ui-data-center-panel-width: 606px;--rh-ui-data-center-panel-height: 500px;--rh-ui-data-center-text: #333;--rh-ui-data-center-secondary-text: #999;--rh-ui-data-center-border: #e9e9e9}.rh-data-center-panel{width:var(--rh-ui-data-center-panel-width);height:var(--rh-ui-data-center-panel-height);display:flex;overflow:hidden;box-sizing:border-box;background:#fff;border:1px solid var(--rh-ui-data-center-border);border-radius:8px;box-shadow:0 12px 32px #0f172a29}.rh-data-center-panel__sidebar{width:124px;flex:0 0 124px;box-sizing:border-box;padding:16px 10px;border-right:1px solid var(--rh-ui-data-center-border)}.rh-data-center-panel__main{min-width:0;flex:1;padding:16px 0 10px 15px}.rh-data-center-panel__title{display:flex;align-items:center;justify-content:space-between;margin:0 10px 15px 0;color:var(--rh-ui-data-center-text);font-size:16px;font-weight:600}.rh-data-center-panel__category{width:104px;min-height:32px;display:flex;align-items:center;justify-content:space-between;box-sizing:border-box;margin:10px 0;padding:0 10px;border-radius:3px;color:#666;cursor:pointer;font-size:14px}.rh-data-center-panel__category.is-active{background:var(--rh-ui-data-center-primary-soft);color:var(--rh-ui-data-center-primary);font-weight:600}.rh-data-center-panel__categoryCount{color:#999;font-size:12px;font-weight:400}.rh-data-center-panel__category.is-active .rh-data-center-panel__categoryCount{color:var(--rh-ui-data-center-primary)}.rh-data-center-panel__scroll{height:calc(100% - 48px);padding-right:10px;overflow-y:auto}.rh-data-center-panel__task{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;box-sizing:border-box;min-height:84px;margin-bottom:10px;padding:0 10px 10px 0;border-bottom:1px solid var(--rh-ui-data-center-border)}.rh-data-center-panel__taskMain{min-width:0;flex:1}.rh-data-center-panel__taskTitle{overflow:hidden;color:var(--rh-ui-data-center-text);font-size:14px;line-height:20px;text-overflow:ellipsis;white-space:nowrap}.rh-data-center-panel__taskTag{display:inline-block;margin-left:8px;padding:1px 8px;border-radius:12px;background:#f5f6f7;color:#999;font-size:12px;line-height:20px;vertical-align:1px}.rh-data-center-panel__progress{width:100%;height:4px;margin:7px 0 5px;overflow:hidden;border-radius:4px;background:#edf0f1}.rh-data-center-panel__progressBar{height:100%;border-radius:inherit;background:var(--rh-ui-data-center-primary);transition:width .3s ease}.rh-data-center-panel__progressBar.is-failed{background:#f04444}.rh-data-center-panel__meta,.rh-data-center-panel__message{color:var(--rh-ui-data-center-secondary-text);font-size:11px;line-height:18px}.rh-data-center-panel__message.is-failed{color:#f04444;font-size:12px}.rh-data-center-panel__actions{flex:0 0 auto;display:flex;align-items:flex-end;gap:10px;min-height:56px;padding-bottom:1px}.rh-data-center-panel__action{padding:0;border:0;background:transparent;color:#008ae6;cursor:pointer;font-size:12px;white-space:nowrap}.rh-data-center-panel__action:disabled{color:#bbb;cursor:not-allowed}.rh-data-center-panel__state{min-height:260px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;color:var(--rh-ui-data-center-secondary-text);font-size:14px}.rh-data-center-panel__retry{border:0;background:transparent;color:var(--rh-ui-data-center-primary);cursor:pointer}.rh-data-center-panel__footer{display:flex;justify-content:space-between;box-sizing:border-box;padding:8px 10px 0 0;color:var(--rh-ui-data-center-secondary-text);font-size:12px}.rh-data-center-tip__content{display:flex;flex-direction:column;align-items:center;color:var(--rh-ui-data-center-text)}.rh-data-center-tip__minutes{color:var(--rh-ui-data-center-primary);font-size:18px}.rh-data-center-tip__description{margin:15px 0 30px;font-size:14px;line-height:22px}.rh-data-center-tip__guide{width:120px;height:56px;position:relative;margin:-20px auto 8px;border-radius:50%;background:radial-gradient(circle at 50% 55%,rgba(0,130,138,.18),transparent 65%)}.rh-data-center-tip__guide:after{content:">";position:absolute;top:0;right:15px;color:var(--rh-ui-data-center-primary);font-size:32px;animation:rh-data-center-guide 1.5s ease-in-out infinite}@keyframes rh-data-center-guide{0%,to{transform:translate(-8px,5px)}50%{transform:translate(0)}}.rh-data-center[data-v-b6caa4d9]{position:relative;display:inline-flex;align-items:center}.rh-data-center__trigger[data-v-b6caa4d9]{display:inline-flex;align-items:center;min-height:30px;padding:0 8px;border-radius:4px;color:var(--rh-ui-data-center-text);cursor:pointer;transition:background-color .2s ease,color .2s ease}.rh-data-center__trigger[data-v-b6caa4d9]:hover,.rh-data-center__trigger.is-active[data-v-b6caa4d9]{background:rgba(0,130,138,.08);color:var(--rh-ui-data-center-primary)}.rh-data-center__icon[data-v-b6caa4d9]{width:22px;margin-right:5px}.rh-data-center__popover[data-v-b6caa4d9]{position:fixed;z-index:3000;box-sizing:border-box}.responsive-info-grid[data-v-85b5413b]{display:grid;grid-template-columns:repeat(var(--responsive-info-grid-columns),minmax(0,1fr));gap:var(--responsive-info-grid-gap)}@media (max-width: 1200px){.responsive-info-grid[data-v-85b5413b]{grid-template-columns:repeat(var(--responsive-info-grid-tablet-columns),minmax(0,1fr))}}@media (max-width: 768px){.responsive-info-grid[data-v-85b5413b]{grid-template-columns:repeat(var(--responsive-info-grid-mobile-columns),minmax(0,1fr))}}.responsive-info-grid-item[data-v-67645283]{min-width:0;color:#333;font-size:14px;line-height:22px;word-break:break-all;display:flex}.responsive-info-grid-item__title[data-v-67645283]{display:inline-block;color:#777;white-space:nowrap}.responsive-info-grid-item__content[data-v-67645283]{display:inline}@media (max-width: 768px){.responsive-info-grid-item[data-v-67645283]{grid-column:span 1!important}}
|
package/package.json
CHANGED
|
@@ -1,47 +1,53 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "rhjy-ui",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Vue 3 and Element Plus business UI components",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"publishConfig": {
|
|
7
|
-
"access": "public",
|
|
8
|
-
"registry": "https://registry.npmjs.org"
|
|
9
|
-
},
|
|
10
|
-
"files": [
|
|
11
|
-
"dist",
|
|
12
|
-
"README.md"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "rhjy-ui",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Vue 3 and Element Plus business UI components",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public",
|
|
8
|
+
"registry": "https://registry.npmjs.org"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"README.md",
|
|
13
|
+
"src/responsive-info-grid/README.md"
|
|
14
|
+
],
|
|
15
|
+
"main": "./dist/index.cjs",
|
|
16
|
+
"module": "./dist/index.js",
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"import": "./dist/index.js",
|
|
22
|
+
"require": "./dist/index.cjs"
|
|
23
|
+
},
|
|
24
|
+
"./data-center": {
|
|
25
|
+
"types": "./dist/data-center/index.d.ts",
|
|
26
|
+
"import": "./dist/data-center/index.js",
|
|
27
|
+
"require": "./dist/data-center/index.cjs"
|
|
28
|
+
},
|
|
29
|
+
"./responsive-info-grid": {
|
|
30
|
+
"types": "./dist/responsive-info-grid/index.d.ts",
|
|
31
|
+
"import": "./dist/responsive-info-grid/index.js",
|
|
32
|
+
"require": "./dist/responsive-info-grid/index.cjs"
|
|
33
|
+
},
|
|
34
|
+
"./style.css": "./dist/style.css"
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"typecheck": "tsc --noEmit",
|
|
38
|
+
"package": "vite build",
|
|
39
|
+
"pack:check": "npm pack --dry-run"
|
|
40
|
+
},
|
|
41
|
+
"peerDependencies": {
|
|
42
|
+
"@element-plus/icons-vue": "^2.3.2",
|
|
43
|
+
"element-plus": "^2.14.0",
|
|
44
|
+
"vue": "^3.5.0"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@vitejs/plugin-vue": "^4.1.0",
|
|
48
|
+
"sass": "^1.63.6",
|
|
49
|
+
"typescript": "^5.0.2",
|
|
50
|
+
"vite": "^4.3.9",
|
|
51
|
+
"vite-plugin-dts": "^3.8.3"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# Responsive Info Grid
|
|
2
|
+
|
|
3
|
+
Responsive Info Grid 用于按响应式网格展示标题与内容组成的信息项,适合详情页、概览卡片和只读表单等场景。组件包含布局容器 `RhResponsiveInfoGrid` 和信息项 `RhResponsiveInfoGridItem`。
|
|
4
|
+
|
|
5
|
+
请在应用入口引入一次组件库样式:
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import 'rhjy-ui/style.css'
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 导入方式
|
|
12
|
+
|
|
13
|
+
从主入口导入:
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import {
|
|
17
|
+
RhResponsiveInfoGrid,
|
|
18
|
+
RhResponsiveInfoGridItem,
|
|
19
|
+
} from 'rhjy-ui'
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
也可以从 Responsive Info Grid 子入口导入:
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
import {
|
|
26
|
+
RhResponsiveInfoGrid,
|
|
27
|
+
RhResponsiveInfoGridItem,
|
|
28
|
+
} from 'rhjy-ui/responsive-info-grid'
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
两种方式提供相同的组件,可根据项目的导入规范选择。
|
|
32
|
+
|
|
33
|
+
## RhResponsiveInfoGrid
|
|
34
|
+
|
|
35
|
+
`RhResponsiveInfoGrid` 负责定义网格列数和间距。
|
|
36
|
+
|
|
37
|
+
### Props
|
|
38
|
+
|
|
39
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
40
|
+
| --- | --- | --- | --- |
|
|
41
|
+
| `columns` | `number` | `4` | 宽度大于 1200px 时的列数 |
|
|
42
|
+
| `tabletColumns` | `number` | `2` | 宽度不大于 1200px 且大于 768px 时的列数 |
|
|
43
|
+
| `mobileColumns` | `number` | `1` | 宽度不大于 768px 时的列数 |
|
|
44
|
+
| `gap` | `string` | `'15px 15px'` | CSS Grid 的 `gap` 值,可同时设置行间距和列间距 |
|
|
45
|
+
|
|
46
|
+
### 插槽
|
|
47
|
+
|
|
48
|
+
| 插槽 | 说明 |
|
|
49
|
+
| --- | --- |
|
|
50
|
+
| `default` | 网格内容,通常放置一个或多个 `RhResponsiveInfoGridItem` |
|
|
51
|
+
|
|
52
|
+
### 响应式断点
|
|
53
|
+
|
|
54
|
+
组件根据视口宽度切换列数:
|
|
55
|
+
|
|
56
|
+
| 视口宽度 | 使用的属性 |
|
|
57
|
+
| --- | --- |
|
|
58
|
+
| 大于 1200px | `columns` |
|
|
59
|
+
| 不大于 1200px 且大于 768px | `tabletColumns` |
|
|
60
|
+
| 不大于 768px | `mobileColumns` |
|
|
61
|
+
|
|
62
|
+
## RhResponsiveInfoGridItem
|
|
63
|
+
|
|
64
|
+
`RhResponsiveInfoGridItem` 展示一组标题和内容,并可横跨多列。
|
|
65
|
+
|
|
66
|
+
### Props
|
|
67
|
+
|
|
68
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
69
|
+
| --- | --- | --- | --- |
|
|
70
|
+
| `title` | `string` | `''` | 标题文字;提供 `title` 插槽时作为后备内容 |
|
|
71
|
+
| `content` | `string \| number` | `''` | 内容文字或数字;提供 `content` 插槽时作为后备内容 |
|
|
72
|
+
| `span` | `number` | `1` | 大于 `1` 时横跨指定列数;不大于 `1` 时占一列 |
|
|
73
|
+
|
|
74
|
+
### 插槽
|
|
75
|
+
|
|
76
|
+
| 插槽 | 说明 |
|
|
77
|
+
| --- | --- |
|
|
78
|
+
| `title` | 自定义标题区域;未提供时显示 `title` 属性 |
|
|
79
|
+
| `content` | 自定义内容区域;未提供时显示 `content` 属性 |
|
|
80
|
+
|
|
81
|
+
在视口宽度不大于 768px 时,每个信息项都会强制占一列,`span` 不再横跨多列,以避免移动端内容溢出。
|
|
82
|
+
|
|
83
|
+
## 基础文字内容
|
|
84
|
+
|
|
85
|
+
```vue
|
|
86
|
+
<script setup lang="ts">
|
|
87
|
+
import {
|
|
88
|
+
RhResponsiveInfoGrid,
|
|
89
|
+
RhResponsiveInfoGridItem,
|
|
90
|
+
} from 'rhjy-ui'
|
|
91
|
+
import 'rhjy-ui/style.css'
|
|
92
|
+
</script>
|
|
93
|
+
|
|
94
|
+
<template>
|
|
95
|
+
<RhResponsiveInfoGrid :columns="3" :tablet-columns="2" :mobile-columns="1">
|
|
96
|
+
<RhResponsiveInfoGridItem title="项目名称:" content="智慧园区" />
|
|
97
|
+
<RhResponsiveInfoGridItem title="负责人:" content="张三" />
|
|
98
|
+
<RhResponsiveInfoGridItem title="设备数量:" :content="128" />
|
|
99
|
+
<RhResponsiveInfoGridItem title="项目说明:" content="覆盖园区全部楼栋" :span="2" />
|
|
100
|
+
</RhResponsiveInfoGrid>
|
|
101
|
+
</template>
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## 自定义插槽
|
|
105
|
+
|
|
106
|
+
```vue
|
|
107
|
+
<script setup lang="ts">
|
|
108
|
+
import { ElTag } from 'element-plus'
|
|
109
|
+
import {
|
|
110
|
+
RhResponsiveInfoGrid,
|
|
111
|
+
RhResponsiveInfoGridItem,
|
|
112
|
+
} from 'rhjy-ui/responsive-info-grid'
|
|
113
|
+
import 'rhjy-ui/style.css'
|
|
114
|
+
</script>
|
|
115
|
+
|
|
116
|
+
<template>
|
|
117
|
+
<RhResponsiveInfoGrid gap="20px 24px">
|
|
118
|
+
<RhResponsiveInfoGridItem>
|
|
119
|
+
<template #title>
|
|
120
|
+
<strong>运行状态:</strong>
|
|
121
|
+
</template>
|
|
122
|
+
<template #content>
|
|
123
|
+
<ElTag type="success">正常</ElTag>
|
|
124
|
+
</template>
|
|
125
|
+
</RhResponsiveInfoGridItem>
|
|
126
|
+
|
|
127
|
+
<RhResponsiveInfoGridItem :span="2">
|
|
128
|
+
<template #title>
|
|
129
|
+
<strong>最近更新:</strong>
|
|
130
|
+
</template>
|
|
131
|
+
<template #content>
|
|
132
|
+
<time datetime="2026-09-09T10:30:00+08:00">2026-09-09 10:30</time>
|
|
133
|
+
</template>
|
|
134
|
+
</RhResponsiveInfoGridItem>
|
|
135
|
+
</RhResponsiveInfoGrid>
|
|
136
|
+
</template>
|
|
137
|
+
```
|