rhjy-ui 0.1.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 +109 -0
- package/dist/data-center/RhDataCenter.vue.d.ts +127 -0
- package/dist/data-center/RhDataCenterPanel.vue.d.ts +89 -0
- package/dist/data-center/RhDataCenterTip.vue.d.ts +74 -0
- package/dist/data-center/components/RhDataCenterState.vue.d.ts +35 -0
- package/dist/data-center/components/RhDataCenterTaskItem.vue.d.ts +21 -0
- package/dist/data-center/constants.d.ts +11 -0
- package/dist/data-center/hooks/useClickOutside.d.ts +5 -0
- package/dist/data-center/index.cjs +1 -0
- package/dist/data-center/index.d.ts +6 -0
- package/dist/data-center/index.js +437 -0
- package/dist/data-center/types.d.ts +42 -0
- package/dist/data-center/useRhDataCenter.d.ts +19 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +8 -0
- package/dist/style.css +1 -0
- package/package.json +47 -0
package/README.md
ADDED
|
@@ -0,0 +1,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
|
+
## Data center panel
|
|
18
|
+
|
|
19
|
+
`rhjy-ui` never receives an API URL. Each application supplies a `loadTasks` function and converts its own response into the standard task model.
|
|
20
|
+
|
|
21
|
+
```vue
|
|
22
|
+
<script setup lang="ts">
|
|
23
|
+
import { RhDataCenter } from 'rhjy-ui'
|
|
24
|
+
import type {
|
|
25
|
+
RhDataCenterCategory,
|
|
26
|
+
RhDataCenterLoadTasks,
|
|
27
|
+
} from 'rhjy-ui/data-center'
|
|
28
|
+
|
|
29
|
+
const categories: RhDataCenterCategory[] = [
|
|
30
|
+
{ key: 'all', label: '全部任务' },
|
|
31
|
+
{ key: 'generate', label: '数据生成' },
|
|
32
|
+
{ key: 'import', label: '数据导入' },
|
|
33
|
+
{ key: 'export', label: '数据导出' },
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
const loadTasks: RhDataCenterLoadTasks = async ({ category }) => {
|
|
37
|
+
const response = await requestTaskList({
|
|
38
|
+
taskType: category.key === 'all' ? undefined : category.key,
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
return {
|
|
42
|
+
items: response.list,
|
|
43
|
+
total: response.total,
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const handleTaskAction = ({ action, task }) => {
|
|
48
|
+
if (action === 'download') {
|
|
49
|
+
window.open(task.raw.fileUrl)
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
</script>
|
|
53
|
+
|
|
54
|
+
<template>
|
|
55
|
+
<RhDataCenter
|
|
56
|
+
:categories="categories"
|
|
57
|
+
:load-tasks="loadTasks"
|
|
58
|
+
@task-action="handleTaskAction"
|
|
59
|
+
/>
|
|
60
|
+
</template>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
The “全部任务” rule is application-owned. It may omit `taskType`, pass a fixed value, or combine multiple requests without changing the component.
|
|
64
|
+
|
|
65
|
+
## Task tip flow
|
|
66
|
+
|
|
67
|
+
Use `useRhDataCenter` after a page successfully creates a background task:
|
|
68
|
+
|
|
69
|
+
```vue
|
|
70
|
+
<script setup lang="ts">
|
|
71
|
+
import { RhDataCenterTip, useRhDataCenter } from 'rhjy-ui'
|
|
72
|
+
|
|
73
|
+
const { tipVisible, tipConfig, showTip } = useRhDataCenter()
|
|
74
|
+
|
|
75
|
+
const startExport = async () => {
|
|
76
|
+
const result = await createExportTask()
|
|
77
|
+
showTip({
|
|
78
|
+
type: 'export',
|
|
79
|
+
minutes: Number(result.minutes),
|
|
80
|
+
title: '导出文件生成中,大概需要',
|
|
81
|
+
content: '现在你可关闭弹框,去做其他事情了。',
|
|
82
|
+
})
|
|
83
|
+
}
|
|
84
|
+
</script>
|
|
85
|
+
|
|
86
|
+
<template>
|
|
87
|
+
<RhDataCenterTip v-model="tipVisible" v-bind="tipConfig" />
|
|
88
|
+
</template>
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Standard task model
|
|
92
|
+
|
|
93
|
+
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.
|
|
94
|
+
|
|
95
|
+
## Styling
|
|
96
|
+
|
|
97
|
+
Override CSS variables at the application root when needed:
|
|
98
|
+
|
|
99
|
+
```css
|
|
100
|
+
:root {
|
|
101
|
+
--rh-ui-data-center-primary: #00828a;
|
|
102
|
+
--rh-ui-data-center-panel-width: 606px;
|
|
103
|
+
--rh-ui-data-center-panel-height: 500px;
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Releases
|
|
108
|
+
|
|
109
|
+
The package is published with compiled `dist` output. Consumers should use an explicit version such as `rhjy-ui@0.1.0`; application-specific API adapters remain in the consuming project.
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { RhDataCenterCategory, RhDataCenterLoadTasks, RhDataCenterTaskActionPayload } from './types';
|
|
2
|
+
|
|
3
|
+
declare function __VLS_template(): {
|
|
4
|
+
trigger?(_: {
|
|
5
|
+
visible: boolean;
|
|
6
|
+
open: () => void;
|
|
7
|
+
close: () => void;
|
|
8
|
+
toggle: () => void;
|
|
9
|
+
}): any;
|
|
10
|
+
header?(_: {
|
|
11
|
+
category: RhDataCenterCategory;
|
|
12
|
+
}): any;
|
|
13
|
+
task?(_: {
|
|
14
|
+
task: import('./types').RhDataCenterTask;
|
|
15
|
+
category: RhDataCenterCategory;
|
|
16
|
+
action: (action: string, task: import('./types').RhDataCenterTask) => void;
|
|
17
|
+
}): any;
|
|
18
|
+
empty?(_: {
|
|
19
|
+
category: RhDataCenterCategory;
|
|
20
|
+
}): any;
|
|
21
|
+
error?(_: {
|
|
22
|
+
error: unknown;
|
|
23
|
+
retry: (force?: boolean) => Promise<void>;
|
|
24
|
+
}): any;
|
|
25
|
+
footer?(_: {
|
|
26
|
+
result: import('./types').RhDataCenterTaskResult;
|
|
27
|
+
category: RhDataCenterCategory;
|
|
28
|
+
}): any;
|
|
29
|
+
};
|
|
30
|
+
declare const __VLS_component: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
31
|
+
modelValue?: boolean;
|
|
32
|
+
categories: RhDataCenterCategory[];
|
|
33
|
+
loadTasks: RhDataCenterLoadTasks;
|
|
34
|
+
label?: string;
|
|
35
|
+
width?: string | number;
|
|
36
|
+
panelHeight?: string | number;
|
|
37
|
+
panelRight?: string | number;
|
|
38
|
+
pollInterval?: number;
|
|
39
|
+
refreshOnOpen?: boolean;
|
|
40
|
+
closeOnClickOutside?: boolean;
|
|
41
|
+
icon?: string;
|
|
42
|
+
activeIcon?: string;
|
|
43
|
+
}>, {
|
|
44
|
+
modelValue: any;
|
|
45
|
+
label: string;
|
|
46
|
+
width: number;
|
|
47
|
+
panelHeight: number;
|
|
48
|
+
panelRight: number;
|
|
49
|
+
pollInterval: number;
|
|
50
|
+
refreshOnOpen: boolean;
|
|
51
|
+
closeOnClickOutside: boolean;
|
|
52
|
+
icon: string;
|
|
53
|
+
activeIcon: string;
|
|
54
|
+
}>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
55
|
+
"update:modelValue": (value: boolean) => void;
|
|
56
|
+
open: () => void;
|
|
57
|
+
close: () => void;
|
|
58
|
+
refresh: (category: RhDataCenterCategory) => void;
|
|
59
|
+
"task-action": (payload: RhDataCenterTaskActionPayload) => void;
|
|
60
|
+
error: (error: unknown, category: RhDataCenterCategory) => void;
|
|
61
|
+
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
62
|
+
modelValue?: boolean;
|
|
63
|
+
categories: RhDataCenterCategory[];
|
|
64
|
+
loadTasks: RhDataCenterLoadTasks;
|
|
65
|
+
label?: string;
|
|
66
|
+
width?: string | number;
|
|
67
|
+
panelHeight?: string | number;
|
|
68
|
+
panelRight?: string | number;
|
|
69
|
+
pollInterval?: number;
|
|
70
|
+
refreshOnOpen?: boolean;
|
|
71
|
+
closeOnClickOutside?: boolean;
|
|
72
|
+
icon?: string;
|
|
73
|
+
activeIcon?: string;
|
|
74
|
+
}>, {
|
|
75
|
+
modelValue: any;
|
|
76
|
+
label: string;
|
|
77
|
+
width: number;
|
|
78
|
+
panelHeight: number;
|
|
79
|
+
panelRight: number;
|
|
80
|
+
pollInterval: number;
|
|
81
|
+
refreshOnOpen: boolean;
|
|
82
|
+
closeOnClickOutside: boolean;
|
|
83
|
+
icon: string;
|
|
84
|
+
activeIcon: string;
|
|
85
|
+
}>>> & Readonly<{
|
|
86
|
+
onClose?: () => any;
|
|
87
|
+
onRefresh?: (category: RhDataCenterCategory) => any;
|
|
88
|
+
"onTask-action"?: (payload: RhDataCenterTaskActionPayload) => any;
|
|
89
|
+
onError?: (error: unknown, category: RhDataCenterCategory) => any;
|
|
90
|
+
"onUpdate:modelValue"?: (value: boolean) => any;
|
|
91
|
+
onOpen?: () => any;
|
|
92
|
+
}>, {
|
|
93
|
+
label: string;
|
|
94
|
+
width: string | number;
|
|
95
|
+
modelValue: boolean;
|
|
96
|
+
panelHeight: string | number;
|
|
97
|
+
panelRight: string | number;
|
|
98
|
+
pollInterval: number;
|
|
99
|
+
refreshOnOpen: boolean;
|
|
100
|
+
closeOnClickOutside: boolean;
|
|
101
|
+
icon: string;
|
|
102
|
+
activeIcon: string;
|
|
103
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
104
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
105
|
+
export default _default;
|
|
106
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
107
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
108
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
109
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
110
|
+
} : {
|
|
111
|
+
type: import('vue').PropType<T[K]>;
|
|
112
|
+
required: true;
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
type __VLS_WithDefaults<P, D> = {
|
|
116
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
117
|
+
default: D[K];
|
|
118
|
+
}> : P[K];
|
|
119
|
+
};
|
|
120
|
+
type __VLS_Prettify<T> = {
|
|
121
|
+
[K in keyof T]: T[K];
|
|
122
|
+
} & {};
|
|
123
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
124
|
+
new (): {
|
|
125
|
+
$slots: S;
|
|
126
|
+
};
|
|
127
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { RhDataCenterCategory, RhDataCenterLoadTasks, RhDataCenterTask, RhDataCenterTaskActionPayload, RhDataCenterTaskResult } from './types';
|
|
2
|
+
|
|
3
|
+
declare function __VLS_template(): {
|
|
4
|
+
header?(_: {
|
|
5
|
+
category: RhDataCenterCategory;
|
|
6
|
+
}): any;
|
|
7
|
+
error?(_: {
|
|
8
|
+
error: unknown;
|
|
9
|
+
retry: (force?: boolean) => Promise<void>;
|
|
10
|
+
}): any;
|
|
11
|
+
task?(_: {
|
|
12
|
+
task: RhDataCenterTask;
|
|
13
|
+
category: RhDataCenterCategory;
|
|
14
|
+
action: (action: string, task: RhDataCenterTask) => void;
|
|
15
|
+
}): any;
|
|
16
|
+
empty?(_: {
|
|
17
|
+
category: RhDataCenterCategory;
|
|
18
|
+
}): any;
|
|
19
|
+
footer?(_: {
|
|
20
|
+
result: RhDataCenterTaskResult;
|
|
21
|
+
category: RhDataCenterCategory;
|
|
22
|
+
}): any;
|
|
23
|
+
};
|
|
24
|
+
declare const __VLS_component: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
25
|
+
categories: RhDataCenterCategory[];
|
|
26
|
+
loadTasks: RhDataCenterLoadTasks;
|
|
27
|
+
activeCategoryKey?: string | number;
|
|
28
|
+
closeable?: boolean;
|
|
29
|
+
showTotal?: boolean;
|
|
30
|
+
recentDaysText?: string;
|
|
31
|
+
}>, {
|
|
32
|
+
activeCategoryKey: any;
|
|
33
|
+
closeable: boolean;
|
|
34
|
+
showTotal: boolean;
|
|
35
|
+
recentDaysText: string;
|
|
36
|
+
}>>, {
|
|
37
|
+
refresh: (force?: boolean) => Promise<void>;
|
|
38
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
39
|
+
close: () => void;
|
|
40
|
+
refresh: (category: RhDataCenterCategory) => void;
|
|
41
|
+
"task-action": (payload: RhDataCenterTaskActionPayload) => void;
|
|
42
|
+
error: (error: unknown, category: RhDataCenterCategory) => void;
|
|
43
|
+
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
44
|
+
categories: RhDataCenterCategory[];
|
|
45
|
+
loadTasks: RhDataCenterLoadTasks;
|
|
46
|
+
activeCategoryKey?: string | number;
|
|
47
|
+
closeable?: boolean;
|
|
48
|
+
showTotal?: boolean;
|
|
49
|
+
recentDaysText?: string;
|
|
50
|
+
}>, {
|
|
51
|
+
activeCategoryKey: any;
|
|
52
|
+
closeable: boolean;
|
|
53
|
+
showTotal: boolean;
|
|
54
|
+
recentDaysText: string;
|
|
55
|
+
}>>> & Readonly<{
|
|
56
|
+
onClose?: () => any;
|
|
57
|
+
onRefresh?: (category: RhDataCenterCategory) => any;
|
|
58
|
+
"onTask-action"?: (payload: RhDataCenterTaskActionPayload) => any;
|
|
59
|
+
onError?: (error: unknown, category: RhDataCenterCategory) => any;
|
|
60
|
+
}>, {
|
|
61
|
+
activeCategoryKey: string | number;
|
|
62
|
+
closeable: boolean;
|
|
63
|
+
showTotal: boolean;
|
|
64
|
+
recentDaysText: string;
|
|
65
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
66
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
67
|
+
export default _default;
|
|
68
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
69
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
70
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
71
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
72
|
+
} : {
|
|
73
|
+
type: import('vue').PropType<T[K]>;
|
|
74
|
+
required: true;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
type __VLS_WithDefaults<P, D> = {
|
|
78
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
79
|
+
default: D[K];
|
|
80
|
+
}> : P[K];
|
|
81
|
+
};
|
|
82
|
+
type __VLS_Prettify<T> = {
|
|
83
|
+
[K in keyof T]: T[K];
|
|
84
|
+
} & {};
|
|
85
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
86
|
+
new (): {
|
|
87
|
+
$slots: S;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
declare function __VLS_template(): {
|
|
2
|
+
extra?(_: {}): any;
|
|
3
|
+
};
|
|
4
|
+
declare const __VLS_component: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
5
|
+
modelValue?: boolean;
|
|
6
|
+
minutes?: number;
|
|
7
|
+
type?: string | number;
|
|
8
|
+
title?: string;
|
|
9
|
+
content?: string;
|
|
10
|
+
width?: string | number;
|
|
11
|
+
showGuideAnimation?: boolean;
|
|
12
|
+
}>, {
|
|
13
|
+
modelValue: boolean;
|
|
14
|
+
minutes: any;
|
|
15
|
+
type: any;
|
|
16
|
+
title: string;
|
|
17
|
+
content: string;
|
|
18
|
+
width: string;
|
|
19
|
+
showGuideAnimation: boolean;
|
|
20
|
+
}>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
21
|
+
"update:modelValue": (value: boolean) => void;
|
|
22
|
+
close: () => void;
|
|
23
|
+
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
24
|
+
modelValue?: boolean;
|
|
25
|
+
minutes?: number;
|
|
26
|
+
type?: string | number;
|
|
27
|
+
title?: string;
|
|
28
|
+
content?: string;
|
|
29
|
+
width?: string | number;
|
|
30
|
+
showGuideAnimation?: boolean;
|
|
31
|
+
}>, {
|
|
32
|
+
modelValue: boolean;
|
|
33
|
+
minutes: any;
|
|
34
|
+
type: any;
|
|
35
|
+
title: string;
|
|
36
|
+
content: string;
|
|
37
|
+
width: string;
|
|
38
|
+
showGuideAnimation: boolean;
|
|
39
|
+
}>>> & Readonly<{
|
|
40
|
+
onClose?: () => any;
|
|
41
|
+
"onUpdate:modelValue"?: (value: boolean) => any;
|
|
42
|
+
}>, {
|
|
43
|
+
type: string | number;
|
|
44
|
+
title: string;
|
|
45
|
+
width: string | number;
|
|
46
|
+
modelValue: boolean;
|
|
47
|
+
minutes: number;
|
|
48
|
+
content: string;
|
|
49
|
+
showGuideAnimation: boolean;
|
|
50
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
51
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
52
|
+
export default _default;
|
|
53
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
54
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
55
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
56
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
57
|
+
} : {
|
|
58
|
+
type: import('vue').PropType<T[K]>;
|
|
59
|
+
required: true;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
type __VLS_WithDefaults<P, D> = {
|
|
63
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
64
|
+
default: D[K];
|
|
65
|
+
}> : P[K];
|
|
66
|
+
};
|
|
67
|
+
type __VLS_Prettify<T> = {
|
|
68
|
+
[K in keyof T]: T[K];
|
|
69
|
+
} & {};
|
|
70
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
71
|
+
new (): {
|
|
72
|
+
$slots: S;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
2
|
+
text: string;
|
|
3
|
+
retryable?: boolean;
|
|
4
|
+
}>, {
|
|
5
|
+
retryable: boolean;
|
|
6
|
+
}>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
7
|
+
retry: () => void;
|
|
8
|
+
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
9
|
+
text: string;
|
|
10
|
+
retryable?: boolean;
|
|
11
|
+
}>, {
|
|
12
|
+
retryable: boolean;
|
|
13
|
+
}>>> & Readonly<{
|
|
14
|
+
onRetry?: () => any;
|
|
15
|
+
}>, {
|
|
16
|
+
retryable: boolean;
|
|
17
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
18
|
+
export default _default;
|
|
19
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
20
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
21
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
22
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
23
|
+
} : {
|
|
24
|
+
type: import('vue').PropType<T[K]>;
|
|
25
|
+
required: true;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
type __VLS_WithDefaults<P, D> = {
|
|
29
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
30
|
+
default: D[K];
|
|
31
|
+
}> : P[K];
|
|
32
|
+
};
|
|
33
|
+
type __VLS_Prettify<T> = {
|
|
34
|
+
[K in keyof T]: T[K];
|
|
35
|
+
} & {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { RhDataCenterTask } from '../types';
|
|
2
|
+
|
|
3
|
+
declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
4
|
+
task: RhDataCenterTask;
|
|
5
|
+
}>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
6
|
+
action: (action: string) => void;
|
|
7
|
+
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
8
|
+
task: RhDataCenterTask;
|
|
9
|
+
}>>> & Readonly<{
|
|
10
|
+
onAction?: (action: string) => any;
|
|
11
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
12
|
+
export default _default;
|
|
13
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
14
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
15
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
16
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
17
|
+
} : {
|
|
18
|
+
type: import('vue').PropType<T[K]>;
|
|
19
|
+
required: true;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const RH_DATA_CENTER_TASK_STATUS: {
|
|
2
|
+
readonly Waiting: "waiting";
|
|
3
|
+
readonly Processing: "processing";
|
|
4
|
+
readonly Success: "success";
|
|
5
|
+
readonly Failed: "failed";
|
|
6
|
+
};
|
|
7
|
+
export declare const RH_DATA_CENTER_DEFAULT_LABEL = "\u6570\u636E\u5904\u7406\u4E2D\u5FC3";
|
|
8
|
+
export declare const RH_DATA_CENTER_DEFAULT_WIDTH = 606;
|
|
9
|
+
export declare const RH_DATA_CENTER_DEFAULT_HEIGHT = 500;
|
|
10
|
+
export declare const RH_DATA_CENTER_DEFAULT_POLL_INTERVAL = 1000;
|
|
11
|
+
export declare const RH_DATA_CENTER_RECENT_DAYS_TEXT = "-\u6B64\u5904\u4EC5\u5C55\u793A\u8FD115\u5929\u5185\u7684\u6570\u636E-";
|
|
@@ -0,0 +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;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
|
|
2
|
+
export { default as RhDataCenter } from './RhDataCenter.vue';
|
|
3
|
+
export { default as RhDataCenterPanel } from './RhDataCenterPanel.vue';
|
|
4
|
+
export { default as RhDataCenterTip } from './RhDataCenterTip.vue';
|
|
5
|
+
export { default as useRhDataCenter } from './useRhDataCenter';
|
|
6
|
+
export type { RhDataCenterCategory, RhDataCenterLoadTasks, RhDataCenterTask, RhDataCenterTaskAction, RhDataCenterTaskActionPayload, RhDataCenterTaskResult, RhDataCenterTaskStatus, RhDataCenterTipConfig, } from './types';
|
|
@@ -0,0 +1,437 @@
|
|
|
1
|
+
import { defineComponent as S, openBlock as l, createElementBlock as c, 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 p, onMounted as Z, renderSlot as T, createTextVNode as X, createBlock as Y, createVNode as O, 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
|
+
const ie = { class: "rh-data-center-panel__state" }, W = /* @__PURE__ */ S({
|
|
3
|
+
__name: "RhDataCenterState",
|
|
4
|
+
props: {
|
|
5
|
+
text: {},
|
|
6
|
+
retryable: { type: Boolean, default: !1 }
|
|
7
|
+
},
|
|
8
|
+
emits: ["retry"],
|
|
9
|
+
setup(e, { emit: m }) {
|
|
10
|
+
const t = m;
|
|
11
|
+
return (i, u) => (l(), c("div", ie, [
|
|
12
|
+
h("span", null, g(e.text), 1),
|
|
13
|
+
e.retryable ? (l(), c("button", {
|
|
14
|
+
key: 0,
|
|
15
|
+
type: "button",
|
|
16
|
+
class: "rh-data-center-panel__retry",
|
|
17
|
+
onClick: u[0] || (u[0] = (d) => t("retry"))
|
|
18
|
+
}, " 重新加载 ")) : C("", !0)
|
|
19
|
+
]));
|
|
20
|
+
}
|
|
21
|
+
}), ce = { class: "rh-data-center-panel__task" }, ue = { class: "rh-data-center-panel__taskMain" }, de = { class: "rh-data-center-panel__taskTitle" }, ve = {
|
|
22
|
+
key: 0,
|
|
23
|
+
class: "rh-data-center-panel__taskTag"
|
|
24
|
+
}, fe = {
|
|
25
|
+
key: 0,
|
|
26
|
+
class: "rh-data-center-panel__progress"
|
|
27
|
+
}, he = { class: "rh-data-center-panel__meta" }, me = {
|
|
28
|
+
key: 0,
|
|
29
|
+
class: "rh-data-center-panel__actions"
|
|
30
|
+
}, pe = ["disabled", "onClick"], ye = /* @__PURE__ */ S({
|
|
31
|
+
__name: "RhDataCenterTaskItem",
|
|
32
|
+
props: {
|
|
33
|
+
task: {}
|
|
34
|
+
},
|
|
35
|
+
emits: ["action"],
|
|
36
|
+
setup(e, { emit: m }) {
|
|
37
|
+
const t = e, i = m, u = D(() => {
|
|
38
|
+
const d = Number(t.task.progress || 0);
|
|
39
|
+
return Math.min(100, Math.max(0, d));
|
|
40
|
+
});
|
|
41
|
+
return (d, b) => {
|
|
42
|
+
var y;
|
|
43
|
+
return l(), c("div", ce, [
|
|
44
|
+
h("div", ue, [
|
|
45
|
+
h("div", de, [
|
|
46
|
+
h("span", null, g(e.task.title), 1),
|
|
47
|
+
e.task.tag ? (l(), c("span", ve, g(e.task.tag), 1)) : C("", !0)
|
|
48
|
+
]),
|
|
49
|
+
e.task.status !== "success" ? (l(), c("div", fe, [
|
|
50
|
+
h("div", {
|
|
51
|
+
class: K(["rh-data-center-panel__progressBar", { "is-failed": e.task.status === "failed" }]),
|
|
52
|
+
style: Q({ width: `${u.value}%` })
|
|
53
|
+
}, null, 6)
|
|
54
|
+
])) : C("", !0),
|
|
55
|
+
h("div", he, g(e.task.createdAt), 1),
|
|
56
|
+
e.task.message ? (l(), c("div", {
|
|
57
|
+
key: 1,
|
|
58
|
+
class: K(["rh-data-center-panel__message", { "is-failed": e.task.status === "failed" }])
|
|
59
|
+
}, g(e.task.message), 3)) : C("", !0)
|
|
60
|
+
]),
|
|
61
|
+
(y = e.task.actions) != null && y.length ? (l(), c("div", me, [
|
|
62
|
+
(l(!0), c(U, null, q(e.task.actions, (k) => (l(), c("button", {
|
|
63
|
+
key: k.key,
|
|
64
|
+
type: "button",
|
|
65
|
+
class: "rh-data-center-panel__action",
|
|
66
|
+
disabled: k.disabled,
|
|
67
|
+
onClick: (w) => i("action", k.key)
|
|
68
|
+
}, g(k.label), 9, pe))), 128))
|
|
69
|
+
])) : C("", !0)
|
|
70
|
+
]);
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
}), _e = "数据处理中心", ke = 606, ge = 500, Ce = 1e3, be = "-此处仅展示近15天内的数据-", Te = { class: "rh-data-center-panel" }, we = { class: "rh-data-center-panel__sidebar" }, $e = ["onClick"], Re = {
|
|
74
|
+
key: 0,
|
|
75
|
+
class: "rh-data-center-panel__categoryCount"
|
|
76
|
+
}, Ee = { class: "rh-data-center-panel__main" }, Ae = { class: "rh-data-center-panel__title" }, De = { class: "rh-data-center-panel__scroll" }, Le = {
|
|
77
|
+
key: 0,
|
|
78
|
+
class: "rh-data-center-panel__footer"
|
|
79
|
+
}, Ve = /* @__PURE__ */ S({
|
|
80
|
+
__name: "RhDataCenterPanel",
|
|
81
|
+
props: {
|
|
82
|
+
categories: {},
|
|
83
|
+
loadTasks: {},
|
|
84
|
+
activeCategoryKey: { default: void 0 },
|
|
85
|
+
closeable: { type: Boolean, default: !0 },
|
|
86
|
+
showTotal: { type: Boolean, default: !0 },
|
|
87
|
+
recentDaysText: { default: be }
|
|
88
|
+
},
|
|
89
|
+
emits: ["close", "refresh", "task-action", "error"],
|
|
90
|
+
setup(e, { expose: m, emit: t }) {
|
|
91
|
+
const i = e, u = t, d = p(i.activeCategoryKey), b = p({}), y = p({}), k = p({}), w = p({}), R = p({}), v = D(() => i.categories.find((n) => n.key === d.value) || i.categories[0]), E = D(() => {
|
|
92
|
+
var n;
|
|
93
|
+
return String(((n = v.value) == null ? void 0 : n.key) ?? "");
|
|
94
|
+
}), V = D(() => b.value[E.value]), M = D(() => y.value[E.value] === !0), A = D(() => k.value[E.value]), z = (n) => {
|
|
95
|
+
var a;
|
|
96
|
+
const r = b.value[String(n.key)];
|
|
97
|
+
return ((a = r == null ? void 0 : r.counts) == null ? void 0 : a[String(n.key)]) ?? (r == null ? void 0 : r.total);
|
|
98
|
+
}, x = async (n = !1) => {
|
|
99
|
+
const r = v.value;
|
|
100
|
+
if (!r)
|
|
101
|
+
return;
|
|
102
|
+
const a = String(r.key);
|
|
103
|
+
if (R.value[a] && !n)
|
|
104
|
+
return;
|
|
105
|
+
R.value[a] = !0, y.value[a] = !0, k.value[a] = void 0;
|
|
106
|
+
const s = (w.value[a] || 0) + 1;
|
|
107
|
+
w.value[a] = s, u("refresh", r);
|
|
108
|
+
try {
|
|
109
|
+
const $ = await i.loadTasks({ category: r });
|
|
110
|
+
if (w.value[a] !== s || E.value !== a)
|
|
111
|
+
return;
|
|
112
|
+
b.value[a] = $;
|
|
113
|
+
} catch ($) {
|
|
114
|
+
if (w.value[a] !== s || E.value !== a)
|
|
115
|
+
return;
|
|
116
|
+
k.value[a] = $, u("error", $, r);
|
|
117
|
+
} finally {
|
|
118
|
+
w.value[a] === s && (y.value[a] = !1, R.value[a] = !1);
|
|
119
|
+
}
|
|
120
|
+
}, B = async (n) => {
|
|
121
|
+
d.value !== n.key && (d.value = n.key, await x());
|
|
122
|
+
}, P = (n, r) => {
|
|
123
|
+
const a = v.value;
|
|
124
|
+
a && u("task-action", { action: n, task: r, category: a });
|
|
125
|
+
};
|
|
126
|
+
return Z(() => {
|
|
127
|
+
var n;
|
|
128
|
+
d.value === void 0 && (d.value = (n = i.categories[0]) == null ? void 0 : n.key);
|
|
129
|
+
}), m({
|
|
130
|
+
refresh: x
|
|
131
|
+
}), (n, r) => {
|
|
132
|
+
var a;
|
|
133
|
+
return l(), c("div", Te, [
|
|
134
|
+
h("aside", we, [
|
|
135
|
+
r[1] || (r[1] = h("div", { class: "rh-data-center-panel__title" }, "数据类型", -1)),
|
|
136
|
+
(l(!0), c(U, null, q(e.categories, (s) => (l(), c("button", {
|
|
137
|
+
key: s.key,
|
|
138
|
+
type: "button",
|
|
139
|
+
class: K(["rh-data-center-panel__category", { "is-active": d.value === s.key }]),
|
|
140
|
+
onClick: ($) => B(s)
|
|
141
|
+
}, [
|
|
142
|
+
h("span", null, g(s.label), 1),
|
|
143
|
+
z(s) !== void 0 ? (l(), c("span", Re, g(z(s)), 1)) : C("", !0)
|
|
144
|
+
], 10, $e))), 128))
|
|
145
|
+
]),
|
|
146
|
+
h("section", Ee, [
|
|
147
|
+
h("div", Ae, [
|
|
148
|
+
T(n.$slots, "header", { category: v.value }, () => [
|
|
149
|
+
r[2] || (r[2] = X("数据处理进度", -1))
|
|
150
|
+
]),
|
|
151
|
+
e.closeable ? (l(), c("button", {
|
|
152
|
+
key: 0,
|
|
153
|
+
type: "button",
|
|
154
|
+
class: "rh-data-center-panel__action",
|
|
155
|
+
onClick: r[0] || (r[0] = (s) => u("close"))
|
|
156
|
+
}, "关闭")) : C("", !0)
|
|
157
|
+
]),
|
|
158
|
+
h("div", De, [
|
|
159
|
+
M.value ? (l(), Y(W, {
|
|
160
|
+
key: 0,
|
|
161
|
+
text: "加载中..."
|
|
162
|
+
})) : A.value ? T(n.$slots, "error", {
|
|
163
|
+
key: 1,
|
|
164
|
+
error: A.value,
|
|
165
|
+
retry: x
|
|
166
|
+
}, () => [
|
|
167
|
+
O(W, {
|
|
168
|
+
text: "任务加载失败",
|
|
169
|
+
retryable: !0,
|
|
170
|
+
onRetry: x
|
|
171
|
+
})
|
|
172
|
+
]) : (a = V.value) != null && a.items.length ? (l(!0), c(U, { key: 2 }, q(V.value.items, (s) => T(n.$slots, "task", {
|
|
173
|
+
key: s.id,
|
|
174
|
+
task: s,
|
|
175
|
+
category: v.value,
|
|
176
|
+
action: P
|
|
177
|
+
}, () => [
|
|
178
|
+
O(ye, {
|
|
179
|
+
task: s,
|
|
180
|
+
onAction: ($) => P($, s)
|
|
181
|
+
}, null, 8, ["task", "onAction"])
|
|
182
|
+
])), 128)) : T(n.$slots, "empty", {
|
|
183
|
+
key: 3,
|
|
184
|
+
category: v.value
|
|
185
|
+
}, () => [
|
|
186
|
+
O(W, { text: "暂无任务" })
|
|
187
|
+
])
|
|
188
|
+
]),
|
|
189
|
+
T(n.$slots, "footer", {
|
|
190
|
+
result: V.value,
|
|
191
|
+
category: v.value
|
|
192
|
+
}, () => {
|
|
193
|
+
var s;
|
|
194
|
+
return [
|
|
195
|
+
e.showTotal ? (l(), c("div", Le, [
|
|
196
|
+
h("span", null, g(((s = V.value) == null ? void 0 : s.total) || 0) + "条记录", 1),
|
|
197
|
+
h("span", null, g(e.recentDaysText), 1)
|
|
198
|
+
])) : C("", !0)
|
|
199
|
+
];
|
|
200
|
+
})
|
|
201
|
+
])
|
|
202
|
+
]);
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
}), xe = (e) => typeof e == "function" ? e() : e.value, Be = (e, m) => {
|
|
206
|
+
const t = (i) => {
|
|
207
|
+
const u = i.target;
|
|
208
|
+
if (!u)
|
|
209
|
+
return;
|
|
210
|
+
e.some((b) => {
|
|
211
|
+
var y;
|
|
212
|
+
return (y = xe(b)) == null ? void 0 : y.contains(u);
|
|
213
|
+
}) || m();
|
|
214
|
+
};
|
|
215
|
+
Z(() => document.addEventListener("click", t, !0)), ee(() => document.removeEventListener("click", t, !0));
|
|
216
|
+
}, Pe = ["src"], Ie = /* @__PURE__ */ S({
|
|
217
|
+
__name: "RhDataCenter",
|
|
218
|
+
props: {
|
|
219
|
+
modelValue: { type: Boolean, default: void 0 },
|
|
220
|
+
categories: {},
|
|
221
|
+
loadTasks: {},
|
|
222
|
+
label: { default: _e },
|
|
223
|
+
width: { default: ke },
|
|
224
|
+
panelHeight: { default: ge },
|
|
225
|
+
panelRight: { default: 0 },
|
|
226
|
+
pollInterval: { default: Ce },
|
|
227
|
+
refreshOnOpen: { type: Boolean, default: !0 },
|
|
228
|
+
closeOnClickOutside: { type: Boolean, default: !0 },
|
|
229
|
+
icon: { default: "" },
|
|
230
|
+
activeIcon: { default: "" }
|
|
231
|
+
},
|
|
232
|
+
emits: ["update:modelValue", "open", "close", "refresh", "task-action", "error"],
|
|
233
|
+
setup(e, { emit: m }) {
|
|
234
|
+
const t = e, i = m, u = p(!1), d = p(null), b = p(null), y = p(null), k = p({}), w = p(), R = p(!1), v = D(() => t.modelValue === void 0 ? u.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 = () => {
|
|
235
|
+
const o = d.value, _ = b.value;
|
|
236
|
+
if (!o || !_)
|
|
237
|
+
return;
|
|
238
|
+
const f = o.getBoundingClientRect(), F = _.offsetWidth || M(t.width), te = M(t.panelRight), I = 8, ae = f.right - F - te, ne = Math.min(
|
|
239
|
+
Math.max(I, ae),
|
|
240
|
+
Math.max(I, window.innerWidth - F - I)
|
|
241
|
+
), se = Math.min(
|
|
242
|
+
f.bottom + 8,
|
|
243
|
+
Math.max(I, window.innerHeight - _.offsetHeight - I)
|
|
244
|
+
);
|
|
245
|
+
k.value = {
|
|
246
|
+
top: `${se}px`,
|
|
247
|
+
left: `${ne}px`,
|
|
248
|
+
width: V(t.width),
|
|
249
|
+
"--rh-ui-data-center-panel-height": V(t.panelHeight)
|
|
250
|
+
};
|
|
251
|
+
}, z = () => {
|
|
252
|
+
R.value || (R.value = !0, window.addEventListener("resize", A), window.addEventListener("scroll", A, !0));
|
|
253
|
+
}, x = () => {
|
|
254
|
+
R.value && (R.value = !1, window.removeEventListener("resize", A), window.removeEventListener("scroll", A, !0));
|
|
255
|
+
}, B = () => {
|
|
256
|
+
w.value !== void 0 && (window.clearInterval(w.value), w.value = void 0);
|
|
257
|
+
}, P = () => {
|
|
258
|
+
var o;
|
|
259
|
+
(o = y.value) == null || o.refresh();
|
|
260
|
+
}, n = () => {
|
|
261
|
+
B(), !(!v.value || t.pollInterval <= 0) && (w.value = window.setInterval(P, t.pollInterval));
|
|
262
|
+
}, r = (o) => {
|
|
263
|
+
t.modelValue === void 0 && (u.value = o), i("update:modelValue", o);
|
|
264
|
+
}, a = () => {
|
|
265
|
+
v.value || (r(!0), i("open"));
|
|
266
|
+
}, s = () => {
|
|
267
|
+
v.value && (r(!1), i("close"));
|
|
268
|
+
}, $ = () => v.value ? s() : a(), G = () => {
|
|
269
|
+
if (document.visibilityState === "hidden") {
|
|
270
|
+
B();
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
n(), P();
|
|
274
|
+
};
|
|
275
|
+
return oe(v, async (o) => {
|
|
276
|
+
if (B(), x(), !o) {
|
|
277
|
+
document.removeEventListener("visibilitychange", G);
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
await le(), A(), z(), document.addEventListener("visibilitychange", G), t.refreshOnOpen && P(), n();
|
|
281
|
+
}, { immediate: !0 }), Be([d, b], () => {
|
|
282
|
+
t.closeOnClickOutside && v.value && s();
|
|
283
|
+
}), ee(() => {
|
|
284
|
+
B(), x(), document.removeEventListener("visibilitychange", G);
|
|
285
|
+
}), (o, _) => (l(), c(U, null, [
|
|
286
|
+
h("div", {
|
|
287
|
+
ref_key: "triggerRef",
|
|
288
|
+
ref: d,
|
|
289
|
+
class: "rh-data-center",
|
|
290
|
+
onClick: j($, ["stop"])
|
|
291
|
+
}, [
|
|
292
|
+
T(o.$slots, "trigger", {
|
|
293
|
+
visible: v.value,
|
|
294
|
+
open: a,
|
|
295
|
+
close: s,
|
|
296
|
+
toggle: $
|
|
297
|
+
}, () => [
|
|
298
|
+
h("span", {
|
|
299
|
+
class: K(["rh-data-center__trigger", { "is-active": v.value }])
|
|
300
|
+
}, [
|
|
301
|
+
E.value ? (l(), c("img", {
|
|
302
|
+
key: 0,
|
|
303
|
+
src: E.value,
|
|
304
|
+
class: "rh-data-center__icon",
|
|
305
|
+
alt: ""
|
|
306
|
+
}, null, 8, Pe)) : C("", !0),
|
|
307
|
+
h("span", null, g(e.label), 1)
|
|
308
|
+
], 2)
|
|
309
|
+
], !0)
|
|
310
|
+
], 512),
|
|
311
|
+
(l(), Y(re, { to: "body" }, [
|
|
312
|
+
v.value ? (l(), c("div", {
|
|
313
|
+
key: 0,
|
|
314
|
+
ref_key: "contentRef",
|
|
315
|
+
ref: b,
|
|
316
|
+
class: "rh-data-center__popover",
|
|
317
|
+
style: Q(k.value),
|
|
318
|
+
onClick: _[3] || (_[3] = j(() => {
|
|
319
|
+
}, ["stop"]))
|
|
320
|
+
}, [
|
|
321
|
+
O(Ve, {
|
|
322
|
+
ref_key: "panelRef",
|
|
323
|
+
ref: y,
|
|
324
|
+
categories: e.categories,
|
|
325
|
+
"load-tasks": e.loadTasks,
|
|
326
|
+
closeable: !0,
|
|
327
|
+
onClose: s,
|
|
328
|
+
onRefresh: _[0] || (_[0] = (f) => i("refresh", f)),
|
|
329
|
+
onTaskAction: _[1] || (_[1] = (f) => i("task-action", f)),
|
|
330
|
+
onError: _[2] || (_[2] = (f, F) => i("error", f, F))
|
|
331
|
+
}, {
|
|
332
|
+
header: L((f) => [
|
|
333
|
+
T(o.$slots, "header", N(H(f)), () => [
|
|
334
|
+
_[4] || (_[4] = X("数据处理进度", -1))
|
|
335
|
+
], !0)
|
|
336
|
+
]),
|
|
337
|
+
task: L((f) => [
|
|
338
|
+
T(o.$slots, "task", N(H(f)), void 0, !0)
|
|
339
|
+
]),
|
|
340
|
+
empty: L((f) => [
|
|
341
|
+
T(o.$slots, "empty", N(H(f)), void 0, !0)
|
|
342
|
+
]),
|
|
343
|
+
error: L((f) => [
|
|
344
|
+
T(o.$slots, "error", N(H(f)), void 0, !0)
|
|
345
|
+
]),
|
|
346
|
+
footer: L((f) => [
|
|
347
|
+
T(o.$slots, "footer", N(H(f)), void 0, !0)
|
|
348
|
+
]),
|
|
349
|
+
_: 3
|
|
350
|
+
}, 8, ["categories", "load-tasks"])
|
|
351
|
+
], 4)) : C("", !0)
|
|
352
|
+
]))
|
|
353
|
+
], 64));
|
|
354
|
+
}
|
|
355
|
+
});
|
|
356
|
+
const Ne = (e, m) => {
|
|
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 = {
|
|
362
|
+
key: 0,
|
|
363
|
+
class: "rh-data-center-tip__guide"
|
|
364
|
+
}, Oe = { class: "rh-data-center-tip__content" }, Se = {
|
|
365
|
+
key: 0,
|
|
366
|
+
class: "rh-data-center-tip__minutes"
|
|
367
|
+
}, Me = {
|
|
368
|
+
key: 1,
|
|
369
|
+
class: "rh-data-center-tip__description"
|
|
370
|
+
}, Ke = /* @__PURE__ */ S({
|
|
371
|
+
__name: "RhDataCenterTip",
|
|
372
|
+
props: {
|
|
373
|
+
modelValue: { type: Boolean, default: !1 },
|
|
374
|
+
minutes: { default: void 0 },
|
|
375
|
+
type: { default: void 0 },
|
|
376
|
+
title: { default: "" },
|
|
377
|
+
content: { default: "" },
|
|
378
|
+
width: { default: "540px" },
|
|
379
|
+
showGuideAnimation: { type: Boolean, default: !0 }
|
|
380
|
+
},
|
|
381
|
+
emits: ["update:modelValue", "close"],
|
|
382
|
+
setup(e, { emit: m }) {
|
|
383
|
+
const t = m, i = () => {
|
|
384
|
+
t("update:modelValue", !1), t("close");
|
|
385
|
+
};
|
|
386
|
+
return (u, d) => {
|
|
387
|
+
const b = J("el-button"), y = J("el-dialog");
|
|
388
|
+
return l(), Y(y, {
|
|
389
|
+
"model-value": e.modelValue,
|
|
390
|
+
title: e.title || "提示",
|
|
391
|
+
width: e.width,
|
|
392
|
+
"append-to-body": "",
|
|
393
|
+
"onUpdate:modelValue": d[0] || (d[0] = (k) => t("update:modelValue", k)),
|
|
394
|
+
onClose: i
|
|
395
|
+
}, {
|
|
396
|
+
footer: L(() => [
|
|
397
|
+
O(b, {
|
|
398
|
+
type: "primary",
|
|
399
|
+
onClick: i
|
|
400
|
+
}, {
|
|
401
|
+
default: L(() => [...d[1] || (d[1] = [
|
|
402
|
+
X("关闭弹框", -1)
|
|
403
|
+
])]),
|
|
404
|
+
_: 1
|
|
405
|
+
})
|
|
406
|
+
]),
|
|
407
|
+
default: L(() => [
|
|
408
|
+
e.showGuideAnimation ? (l(), c("div", He)) : C("", !0),
|
|
409
|
+
h("div", Oe, [
|
|
410
|
+
e.minutes !== void 0 ? (l(), c("span", Se, g((e.title || "任务处理中,大概需要") + e.minutes + "分钟"), 1)) : C("", !0),
|
|
411
|
+
e.content ? (l(), c("div", Me, g(e.content), 1)) : C("", !0),
|
|
412
|
+
T(u.$slots, "extra")
|
|
413
|
+
])
|
|
414
|
+
]),
|
|
415
|
+
_: 3
|
|
416
|
+
}, 8, ["model-value", "title", "width"]);
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
}), Ue = () => {
|
|
420
|
+
const e = p(!1), m = p({});
|
|
421
|
+
return {
|
|
422
|
+
tipVisible: e,
|
|
423
|
+
tipConfig: m,
|
|
424
|
+
showTip: (u) => {
|
|
425
|
+
m.value = { ...u }, e.value = !0;
|
|
426
|
+
},
|
|
427
|
+
closeTip: () => {
|
|
428
|
+
e.value = !1;
|
|
429
|
+
}
|
|
430
|
+
};
|
|
431
|
+
};
|
|
432
|
+
export {
|
|
433
|
+
Fe as RhDataCenter,
|
|
434
|
+
Ve as RhDataCenterPanel,
|
|
435
|
+
Ke as RhDataCenterTip,
|
|
436
|
+
Ue as useRhDataCenter
|
|
437
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export interface RhDataCenterCategory {
|
|
2
|
+
key: string | number;
|
|
3
|
+
label: string;
|
|
4
|
+
query?: unknown;
|
|
5
|
+
}
|
|
6
|
+
export type RhDataCenterTaskStatus = 'waiting' | 'processing' | 'success' | 'failed';
|
|
7
|
+
export interface RhDataCenterTaskAction {
|
|
8
|
+
key: string;
|
|
9
|
+
label: string;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface RhDataCenterTask {
|
|
13
|
+
id: string | number;
|
|
14
|
+
categoryKey: string | number;
|
|
15
|
+
title: string;
|
|
16
|
+
tag?: string;
|
|
17
|
+
createdAt?: string;
|
|
18
|
+
progress?: number;
|
|
19
|
+
status: RhDataCenterTaskStatus;
|
|
20
|
+
message?: string;
|
|
21
|
+
actions?: RhDataCenterTaskAction[];
|
|
22
|
+
raw?: unknown;
|
|
23
|
+
}
|
|
24
|
+
export interface RhDataCenterTaskResult {
|
|
25
|
+
items: RhDataCenterTask[];
|
|
26
|
+
total: number;
|
|
27
|
+
counts?: Record<string, number>;
|
|
28
|
+
}
|
|
29
|
+
export type RhDataCenterLoadTasks = (context: {
|
|
30
|
+
category: RhDataCenterCategory;
|
|
31
|
+
}) => Promise<RhDataCenterTaskResult>;
|
|
32
|
+
export interface RhDataCenterTaskActionPayload {
|
|
33
|
+
action: string;
|
|
34
|
+
task: RhDataCenterTask;
|
|
35
|
+
category: RhDataCenterCategory;
|
|
36
|
+
}
|
|
37
|
+
export interface RhDataCenterTipConfig {
|
|
38
|
+
minutes?: number;
|
|
39
|
+
type?: string | number;
|
|
40
|
+
title?: string;
|
|
41
|
+
content?: string;
|
|
42
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { RhDataCenterTipConfig } from './types';
|
|
2
|
+
|
|
3
|
+
declare const useRhDataCenter: () => {
|
|
4
|
+
tipVisible: import('vue').Ref<boolean, boolean>;
|
|
5
|
+
tipConfig: import('vue').Ref<{
|
|
6
|
+
minutes?: number;
|
|
7
|
+
type?: string | number;
|
|
8
|
+
title?: string;
|
|
9
|
+
content?: string;
|
|
10
|
+
}, RhDataCenterTipConfig | {
|
|
11
|
+
minutes?: number;
|
|
12
|
+
type?: string | number;
|
|
13
|
+
title?: string;
|
|
14
|
+
content?: string;
|
|
15
|
+
}>;
|
|
16
|
+
showTip: (config: RhDataCenterTipConfig) => void;
|
|
17
|
+
closeTip: () => void;
|
|
18
|
+
};
|
|
19
|
+
export default useRhDataCenter;
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +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;
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
package/dist/style.css
ADDED
|
@@ -0,0 +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}
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "rhjy-ui",
|
|
3
|
+
"version": "0.1.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
|
+
"main": "./dist/index.cjs",
|
|
15
|
+
"module": "./dist/index.js",
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"import": "./dist/index.js",
|
|
21
|
+
"require": "./dist/index.cjs"
|
|
22
|
+
},
|
|
23
|
+
"./data-center": {
|
|
24
|
+
"types": "./dist/data-center/index.d.ts",
|
|
25
|
+
"import": "./dist/data-center/index.js",
|
|
26
|
+
"require": "./dist/data-center/index.cjs"
|
|
27
|
+
},
|
|
28
|
+
"./style.css": "./dist/style.css"
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"typecheck": "tsc --noEmit",
|
|
32
|
+
"package": "vite build",
|
|
33
|
+
"pack:check": "npm pack --dry-run"
|
|
34
|
+
},
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"@element-plus/icons-vue": "^2.3.2",
|
|
37
|
+
"element-plus": "^2.14.0",
|
|
38
|
+
"vue": "^3.5.0"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@vitejs/plugin-vue": "^4.1.0",
|
|
42
|
+
"sass": "^1.63.6",
|
|
43
|
+
"typescript": "^5.0.2",
|
|
44
|
+
"vite": "^4.3.9",
|
|
45
|
+
"vite-plugin-dts": "^3.8.3"
|
|
46
|
+
}
|
|
47
|
+
}
|