Merge branch 'dev-3.10' of git.mesalab.cn:nezha/nezha-fronted into dev-3.10

This commit is contained in:
zyh
2024-05-24 10:56:09 +08:00
39 changed files with 33721 additions and 0 deletions

1
.gitignore vendored
View File

@@ -19,3 +19,4 @@ nezha-fronted/src/components/common/rightBox/tempRoghtBox.vue
nezha-fronted/exportHtml/
nezha-fronted/src/a.txt
nezha-fronted/src/components/common/testTopology.vue
nezha-docs/.docs/

1
nezha-docs/.eslintignore Normal file
View File

@@ -0,0 +1 @@
dist

34
nezha-docs/.eslintrc.cjs Normal file
View File

@@ -0,0 +1,34 @@
// @ts-check
const { defineConfig } = require('eslint-define-config');
module.exports = defineConfig({
root: true,
extends: [
'eslint:recommended',
'plugin:node/recommended',
'plugin:@typescript-eslint/recommended',
],
plugins: ['import'],
parser: '@typescript-eslint/parser',
parserOptions: {
sourceType: 'module',
ecmaVersion: 2021,
},
rules: {
'no-debugger': ['error'],
'@typescript-eslint/no-var-requires': 'off',
'node/no-unpublished-require': 'off',
'node/no-extraneous-import': 'off',
'node/no-extraneous-require': 'off',
'node/no-missing-import': 'off',
'node/no-missing-require': 'off',
'no-undef': 'off',
'node/no-unpublished-import': 'off',
'node/no-unsupported-features/es-syntax': 'off',
'no-process-exit': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'no-constant-condition': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-explicit-any': 'off',
},
});

View File

@@ -0,0 +1,7 @@
module.exports = {
semi: true,
singleQuote: true,
tabWidth: 2,
trailingComma: 'all',
printWidth: 80,
};

View File

@@ -0,0 +1,61 @@
import { defineConfig } from 'vitepress';
import { applyPlugins } from '@ruabick/md-demo-plugins';
import { genTemp } from '@ruabick/vite-plugin-gen-temp';
import { genApiDoc } from '@ruabick/vite-plugin-gen-api-doc';
import { sidebar } from './sidebar.js';
import { resolve } from 'path';
export default defineConfig({
lang: 'zh-CN',
lastUpdated: true,
base: process.env.NODE_ENV === 'production' ? '/nezha' : '/',
locales: {
'/': {
lang: 'zh-CN',
title: 'nezha',
description: '',
},
'/en/': {
lang: 'en-US',
title: 'nezha',
description: '',
},
},
themeConfig: {
logo: '/logo.svg',
localeLinks: {
text: '',
items: [
{ text: '简体中文', link: '/' },
{ text: 'English', link: '/en/' },
],
},
nav: [{ text: '指南', link: '/guide' }],
sidebar,
algolia: {},
socialLinks: [
{ icon: 'github', link: 'https://github.com//nezha' },
],
},
vue: {},
vite: {
plugins: [genTemp(), genApiDoc()],
resolve: {
alias: {
'nezha': resolve('./src/'),
},
},
},
markdown: {
config: (md) => {
applyPlugins(md);
},
theme: {
light: 'github-light',
dark: 'github-dark',
},
},
buildEnd() {
process.exit(0);
},
});

View File

@@ -0,0 +1,43 @@
export const sidebar = {
'/en/': [
{
text: 'Guide',
items: [
{ text: 'Button', link: '/en/' },
],
},
],
'/': [
{
text: '介绍',
items: [
{ text: '简介', link: '/' },
],
},
{
text: '组件',
items: [
{
text: 'chartList',
link: '/chartList',
items: [
{ text: 'chartHeader', link: '/chartHeader' },
{
text: 'panelChart',
link: '/panelChart',
items: [
{
text: 'chart',
link: '/chart',
items: [
{text: 'chartTimeSeries', link: '/chartTimeSeries'}
]
}
]
},
]
},
],
}
],
};

View File

@@ -0,0 +1,15 @@
import DefaultTheme from 'vitepress/theme';
import DemoBlock from '@ruabick/vitepress-demo-block';
import '@ruabick/vitepress-demo-block/dist/style.css';
import './var.css';
export default {
...DefaultTheme,
enhanceApp({ app, router, siteData }) {
// app is the Vue 3 app instance from `createApp()`.
// router is VitePress' custom router. `siteData` is
// a `ref` of current site-level metadata.
app.component('demo', DemoBlock);
},
};

View File

@@ -0,0 +1,64 @@
:root {
--vp-code-block-bg: #f9fafb;
/* --vp-code-block-bg: var(--vp-c-bg-alt); */
--vp-code-line-highlight-color: rgba(0, 0, 0, 0.5);
--vp-code-line-number-color: var(--vp-c-text-dark-3);
--vp-code-copy-code-hover-bg: rgba(255, 255, 255, 0.05);
--vp-code-copy-code-active-text: var(--vp-c-bg-alt);
--demi-border-color: #ebedf1;
}
.dark {
--vp-code-block-bg: var(--vp-c-bg-alt);
}
.vp-doc [class*='language-']:before {
color: var(--vp-c-text-2);
}
@media (min-width: 640px) {
.vp-doc div[class*='language-'] {
border-radius: 4px;
margin: 16px 0;
}
}
@media (max-width: 639px) {
.vp-doc div[class*='language-'] {
border-radius: 4px;
}
}
.vp-doc table {
display: table;
width: 100%;
font-size: 15px;
}
.vp-doc tr {
border-top: 1px solid var(--demi-border-color);
}
.vp-doc tr:nth-child(2n) {
background-color: unset;
}
.vp-doc th,
.vp-doc td {
border: 1px solid var(--demi-border-color);
padding: 10px 20px;
}
.vp-doc th {
font-size: 15px;
font-weight: 600;
background-color: var(--vp-c-white-soft);
}
.vp-doc table td:first-child {
font-size: 15px;
font-weight: 600;
}

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1659323377213"
class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1327"
xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200">
<defs>
<style type="text/css">
@font-face {
font-family: feedback-iconfont;
src: url("//at.alicdn.com/t/font_1031158_u69w8yhxdu.woff2?t=1630033759944") format("woff2"), url("//at.alicdn.com/t/font_1031158_u69w8yhxdu.woff?t=1630033759944") format("woff"), url("//at.alicdn.com/t/font_1031158_u69w8yhxdu.ttf?t=1630033759944") format("truetype");
}
</style>
</defs>
<path
d="M167 607v250h251v72H155C122.194 929 95.538 902.672 95.008 869.992L95 869V607h72z m762 0v262c0 33.137-26.863 60-60 60H604v-72h253V607h72zM869 98c33.137 0 60 26.863 60 60v263h-72V170H604V98zM418 98v72H167v251H95V158C95 125.194 121.328 98.538 154.008 98.008L155 98h263z"
fill="#213547" p-id="1328"></path>
<path d="M339.5 416.5m-57.5 0a57.5 57.5 0 1 0 115 0 57.5 57.5 0 1 0-115 0Z" fill="#213547" p-id="1329"></path>
<path d="M684.5 416.5m-57.5 0a57.5 57.5 0 1 0 115 0 57.5 57.5 0 1 0-115 0Z" fill="#213547" p-id="1330"></path>
<path d="M397 589c0 63.513 51.711 115 115.5 115S628 652.513 628 589" fill="#213547" p-id="1331"></path>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

32815
nezha-docs/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

55
nezha-docs/package.json Normal file
View File

@@ -0,0 +1,55 @@
{
"name": "nezha-docs",
"version": "0.0.0",
"description": "",
"type": "module",
"types": "./dist/index.d.ts",
"main": "./dist/nezha.umd.cjs",
"module": "./dist/nezha.js",
"exports": {
".": {
"import": "./dist/nezha.js",
"require": "./dist/nezha.umd.cjs"
},
"./dist/style.css": "./dist/style.css"
},
"scripts": {
"dev": "initial-scan docs && vitepress dev .docs --host",
"build": "vite build",
"site:build": "initial-scan docs && cross-env NODE_ENV=production vitepress build .docs",
"serve": "cross-env NODE_ENV=production vitepress serve .docs --host",
"deploy": "gh-pages -d .docs/.vitepress/dist -t true",
"docs-build-deploy": "yarn docs-build && yarn docs-deploy",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
"lint": "eslint src/**/*.{vue,js,ts,tsx}",
"lint-fix": "yarn lint -- --fix",
"release": "np"
},
"keywords": [],
"author": "",
"license": "MIT",
"devDependencies": {
"@ruabick/md-demo-plugins": "latest",
"@ruabick/vite-plugin-gen-api-doc": "latest",
"@ruabick/vite-plugin-gen-temp": "latest",
"@ruabick/vitepress-demo-block": "latest",
"@typescript-eslint/eslint-plugin": "^5.33.1",
"@typescript-eslint/parser": "^5.33.1",
"@vitejs/plugin-vue": "^3.0.1",
"cross-env": "^7.0.3",
"eslint": "^8.20.0",
"eslint-define-config": "^1.6.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-node": "^11.1.0",
"gh-pages": "^4.0.0",
"np": "^7.6.2",
"prettier": "^2.7.1",
"vite": "latest",
"vite-plugin-dts": "^1.4.0",
"vitepress": "latest",
"vue": "latest"
},
"dependencies": {
"@arco-design/arco-vue-scripts": "^0.2.9"
}
}

View File

@@ -0,0 +1,25 @@
<script setup>
import { ref } from 'vue';
import MyButton from 'nezha';
const count = ref(0);
function onClick() {
count.value++;
}
</script>
<template>
<div>
<p>
<span class="">点击次数:</span>
<span>{{ count }}</span>
</p>
<MyButton @click="onClick">count++</MyButton>
</div>
</template>
<style>
.text {
font-size: 14px;
}
</style>

View File

@@ -0,0 +1,9 @@
---
map:
path: /
---
## 简介
1. 开发规范 https://docs.geedge.net/pages/viewpage.action?pageId=8034494
2. 思维导图 https://docs.geedge.net/pages/viewpage.action?pageId=67209306 可以查看解压后的纯文字版Html
3. 字体图标替换 https://docs.geedge.net/pages/viewpage.action?pageId=67214849

View File

@@ -0,0 +1,7 @@
<script lang="ts" setup>
</script>
<template>
<div>
</template>

View File

@@ -0,0 +1,9 @@
---
map:
path: /
---
## 简介
1. 开发规范 https://docs.geedge.net/pages/viewpage.action?pageId=8034494
2. 思维导图 https://docs.geedge.net/pages/viewpage.action?pageId=67209306 可以查看解压后的纯文字版Html
3. 字体图标替换 https://docs.geedge.net/pages/viewpage.action?pageId=67214849

View File

@@ -0,0 +1,56 @@
<script lang="ts" setup>
const props = withDefaults(defineProps<{
/**
* chart相关信息 主要是要里面的 id 以及 params
*/
chartInfo?: { },
/**
* chart数据
*/
chartData?: { },
/**
* 需要自定义echarts的option时传入非必须传入该值时仍需传对应格式的chartData
*/
customChartOption?: { },
/**
* 是否全屏
*/
isFullscreen?: boolean,
/**
* 是否显示loading
*/
loading?: boolean,
/**
* 是否锁定
*/
panelLock?: boolean,
/**
* 是否报错
*/
isError?: boolean,
/**
* 相对时间
*/
multipleTime?: {},
/**
* 相差时间
*/
minusTime?: {},
/**
* 但是否显示全部数据
*/
showAllData?: {},
/**
* dashboard 相关变量
*/
globalVariables?: {},
}>(), {
})
</script>
<template>
<div>
</div>
</template>

View File

@@ -0,0 +1,17 @@
<script lang="ts" setup>
const props = withDefaults(defineProps<{
/**
* chart相关信息 主要是要里面的 id 以及 params
*/
chartInfo?: { },
}>(), {
})
</script>
<template>
<div>
</div>
</template>

View File

@@ -0,0 +1,9 @@
<script lang="ts" setup>
</script>
<template>
<div></div>
</template>
<style>
</style>

View File

@@ -0,0 +1,10 @@
---
map:
path: /chartTimeSeries
---
时序图 使用了 uplot重构 uplot参考链接 https://github.com/leeoniya/uPlot
遇到相关问题 可以去他的demo里面查看 相关api 也可以在他的源码里看到
# 关联组件
1. chart-legend legend 相关组件
<API src="./chartTimeSeries.vue" lang="en"></API>

View File

@@ -0,0 +1,10 @@
---
map:
path: /chartTimeSeries
---
时序图 使用了 uplot重构 uplot参考链接 https://github.com/leeoniya/uPlot
遇到相关问题 可以去他的demo里面查看 相关api 也可以在他的源码里看到
# 关联组件
1. chart-legend legend 相关组件
<API src="./chartTimeSeries.vue" lang="zh"></API>

View File

@@ -0,0 +1,9 @@
<script lang="ts" setup>
</script>
<template>
<div></div>
</template>
<style>
</style>

View File

@@ -0,0 +1,34 @@
---
map:
path: /chart
---
# 关联组件
1. chartTimeSeries 时序图
2. chartAutotopology 自动播放project topology
3. chartBar 柱状图
4. chartClock 时钟
5. chartDiagram topo图
6. chartEndpointInfo endpoint详情 关联 dashboard
7. chartGauge
8. chartGroup 组
9. chartLog 日志
10. chartNoData 没有数据
11. chartPie 饼图
12. chartDoughnut
13. chartRose 玫瑰图
14. chartStat 单值图
15. chartTable 表格
16. chartText 文本
17. chartAssetInfo asset详情 关联 dashboard
18. chartTreemap 树状图
19. chartUrl 链接
20. chartHexagonD3 蜂窝图
21. chartMap 地图
22. chartTopology 弃用
23. chartBubble 气泡图
24. chartRank 排行榜
25. chartSankey 桑葚图
26. chartFunnel 漏斗图
<API src="./chart.vue" lang="en"></API>

View File

@@ -0,0 +1,34 @@
---
map:
path: /chart
---
# 关联组件
1. chartTimeSeries 时序图
2. chartAutotopology 自动播放project topology
3. chartBar 柱状图
4. chartClock 时钟
5. chartDiagram topo图
6. chartEndpointInfo endpoint详情 关联 dashboard
7. chartGauge
8. chartGroup 组
9. chartLog 日志
10. chartNoData 没有数据
11. chartPie 饼图
12. chartDoughnut
13. chartRose 玫瑰图
14. chartStat 单值图
15. chartTable 表格
16. chartText 文本
17. chartAssetInfo asset详情 关联 dashboard
18. chartTreemap 树状图
19. chartUrl 链接
20. chartHexagonD3 蜂窝图
21. chartMap 地图
22. chartTopology 弃用
23. chartBubble 气泡图
24. chartRank 排行榜
25. chartSankey 桑葚图
26. chartFunnel 漏斗图
<API src="./chart.vue" lang="zh"></API>

View File

@@ -0,0 +1,39 @@
<script lang="ts" setup>
const props = withDefaults(defineProps<{
/**
* chart相关信息 如id 位置等
*/
chartInfo?: string,
/**
* 是否报错
*/
isError?: boolean,
/**
* chart相关数据 若报错 取 item.error
*/
chartData?: { },
/**
* 是否显示全部数据
*/
showAllData?: boolean,
/**
* 全部数据的长度
*/
allDataLength?: number,
/**
* 是否为快照
*/
isExportHtml?: boolean,
/**
* 是否为预览
*/
isPreview?: boolean,
}>(), {
})
</script>
<template>
<div>
</div>
</template>

View File

@@ -0,0 +1,9 @@
<script lang="ts" setup>
</script>
<template>
<div></div>
</template>
<style>
</style>

View File

@@ -0,0 +1,17 @@
---
map:
path: /chartHeader
---
ChartScreenHeader props 跟chartHeader是一样的 不一样的只是右侧的工具菜单
# 示例代码
```
<chart-header>
</chart-header>
```
```
<chart-screen-header>
</chart-screen-header>
```
<API src="./chartHeader.vue" lang="en"></API>

View File

@@ -0,0 +1,17 @@
---
map:
path: /chartHeader
---
ChartScreenHeader props 跟chartHeader是一样的 不一样的只是右侧的工具菜单
# 示例代码
```
<chart-header>
</chart-header>
```
```
<chart-screen-header>
</chart-screen-header>
```
<API src="./chartHeader.vue" lang="zh"></API>

View File

@@ -0,0 +1,65 @@
<script lang="ts" setup>
const props = withDefaults(defineProps<{
/**
* dashboard Id 唯一
*/
dashboardId?: string,
/**
* 底部弹窗的相关信息
*/
chartDetailInfo?: Object,
/**
* 时间范围
*/
timeRange?: Array,
/**
* 是否是组
*/
isGroup? : boolean,
/**
* 组相关信息 包括 位置 宽高等
*/
groupInfo?: Object,
/**
* 父页面位置
*/
from?: string,
/**
* 所有组件相关信息
*/
dataList?: Array,
/**
* 是否是快照文件
*/
isExportHtml?: boolean,
/**
* 快照文件相关数据
*/
dataJson?: {},
/**
* 用于判断 dashboard变量是否加载完成
*/
variablesInit?: boolean,
/**
*
*/
showTool?: boolean
}>(), {
dashboardId: '',
chartDetailInfo: {},
timeRange: ['start', 'end', 'type dashboard.vue/timeData'],
isGroup: false,
groupInfo: {},
from: '',
dataList: [],
isExportHtml: false,
dataJson: {},
variablesInit: true,
showTool: true,
})
</script>
<template>
<div>
</div>
</template>

View File

@@ -0,0 +1,9 @@
<script lang="ts" setup>
</script>
<template>
<div></div>
</template>
<style>
</style>

View File

@@ -0,0 +1,20 @@
---
map:
path: /chartList
---
# 关联组件
1. grid-layout 拖拽组件容器 参考链接 https://jbaysolutions.github.io/vue-grid-layout/zh/
2. grid-item 拖拽组件 该组件以拉取到本地 修改了高度不支持小数的问题
3. panel-chart 图表组件实例
# 示例代码
```
<grid-layout>
<grid-item v-for="item in arr">
<panel-chart />
</grid-item>
</grid-layout>
```
<API src="./chartList.vue" lang="en"></API>

View File

@@ -0,0 +1,20 @@
---
map:
path: /chartList
---
# 关联组件
1. grid-layout 拖拽组件容器 参考链接 https://jbaysolutions.github.io/vue-grid-layout/zh/
2. grid-item 拖拽组件 该组件以拉取到本地 修改了高度不支持小数的问题
3. panel-chart 图表组件实例
# 示例代码
```
<grid-layout>
<grid-item v-for="item in arr">
<panel-chart />
</grid-item>
</grid-layout>
```
<API src="./chartList.vue" lang="zh"></API>

1
nezha-docs/src/index.ts Normal file
View File

@@ -0,0 +1 @@
export { default } from './__docs__/index.vue';

View File

@@ -0,0 +1,9 @@
<script lang="ts" setup>
</script>
<template>
<div></div>
</template>
<style>
</style>

View File

@@ -0,0 +1,21 @@
---
map:
path: /panelChart
---
# 关联组件
1. chartHeader chart-header相关设置
2. chart 去除头部的组件实例
3. ChartScreenHeader 全屏chart-header相关设置
# 示例代码
```
<div>
<chart-header v-if= '!isFullscreen' />
<chart-screen-header v-if= 'isFullscreen' />
<chart />
</div>
```
<API src="./panelChart.vue" lang="zh"></API>

View File

@@ -0,0 +1,20 @@
---
map:
path: /panelChart
---
# 关联组件
1. chartHeader chart-header相关设置
2. chart 去除头部的组件实例
3. ChartScreenHeader 全屏chart-header相关设置
# 示例代码
```
<div>
<chart-header v-if= '!isFullscreen' />
<chart-screen-header v-if= 'isFullscreen' />
<chart />
</div>
```
<API src="./panelChart.vue" lang="zh"></API>

View File

@@ -0,0 +1,47 @@
<script lang="ts" setup>
const props = withDefaults(defineProps<{
/**
* chart详细信息
*/
chartInfo?: {},
/**
* 时间范围
*/
timeRange?: [],
/**
* 是否全屏
*/
isFullscreen?: boolean,
/**
* 是否锁定
*/
panelLock?: boolean,
/**
* header 是否为hover激活
*/
showHeader?: boolean,
/**
* 是否为快照
*/
isExportHtml?: boolean,
/**
* 快照数据
*/
dataJson?: { },
/**
* 隐藏图表的悬浮文字
*/
hiddenText?: string,
/**
* 是否为预览
*/
isPreview?: string,
}>(), {
})
</script>
<template>
<div>
</div>
</template>

48
nezha-docs/tsconfig.json Normal file
View File

@@ -0,0 +1,48 @@
{
"compilerOptions": {
"baseUrl": "./",
"outDir": "dist",
"sourceMap": false,
"target": "ES2022",
"module": "ES2022",
"moduleResolution": "node",
"allowJs": false,
"noUnusedLocals": true,
"strictNullChecks": true,
"noImplicitAny": true,
"noImplicitThis": true,
"experimentalDecorators": true,
"resolveJsonModule": true,
"esModuleInterop": true,
"removeComments": false,
"declaration": true,
"isolatedModules": true,
"jsx": "preserve",
"lib": [
"esnext",
"dom",
],
"types": [],
"skipLibCheck": true,
// "files": "src/index.ts",
"emitDeclarationOnly": true,
"declarationDir": "dist",
"rootDir": ".",
"paths": {
"@/*": [
"src/*"
],
"nezha": [
"src/index.ts"
]
}
},
"include": [
"src/*"
],
"exclude": [
"node_modules",
"dist",
"packages/**/__tests__"
]
}

28
nezha-docs/vite.config.ts Normal file
View File

@@ -0,0 +1,28 @@
import { resolve } from 'path';
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import dts from 'vite-plugin-dts';
import packageJson from './package.json'
export default defineConfig({
plugins: [vue(), dts()],
build: {
lib: {
entry: resolve(__dirname, './src/index.ts'),
name: 'nezha-docs',
// the proper extensions will be added
fileName: 'nezha-docs',
},
rollupOptions: {
// 确保外部化处理那些你不想打包进库的依赖
// @ts-ignore
external: ['vue', ...Object.keys(packageJson.dependencies || {}), ...Object.keys(packageJson.peerDependencies || {})],
output: {
// 在 UMD 构建模式下为这些外部化的依赖提供一个全局变量
globals: {
vue: 'Vue',
},
},
},
},
});

View File

@@ -36,3 +36,10 @@ https://docs.geedge.net/pages/viewpage.action?pageId=67209306
dev 正常启动
dev:html 导出为html
# 部分组件Api
nezha-docs目录下 运行 npm i && npm run dev 若无法运行 尝试切换不同的node版本
新增 参考其中一个src下任意一个文件夹 创建对应文件。 或者可以根据项目目录创建
之后再docs sidebar.js 创建相应的目录 link 关联到对应index.md里面的 'path'