@qy_better_lib/hooks 0.0.14 → 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.
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ECOption } from './type';
|
|
2
|
+
declare const options: ECOption;
|
|
3
|
+
/**
|
|
4
|
+
* Echarts图表字体、间距自适应
|
|
5
|
+
* @param size
|
|
6
|
+
* @param defalteWidth
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
export declare function auto_chart_size(size: number, defalteWidth?: number): number | undefined;
|
|
10
|
+
export default options;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ECOption } from './type';
|
|
2
|
+
import * as echarts from 'echarts/core';
|
|
3
|
+
/**
|
|
4
|
+
* echarts类
|
|
5
|
+
* @returns echartsType
|
|
6
|
+
*/
|
|
7
|
+
export default function useEcharts(): {
|
|
8
|
+
renderChart: (option: ECOption, domId: string, isdark?: boolean, renderer?: "canvas" | "svg") => echarts.ECharts | undefined;
|
|
9
|
+
removeChart: (domId: string) => void;
|
|
10
|
+
getChart: (domId: string) => echarts.ECharts | undefined;
|
|
11
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { BarSeriesOption, LineSeriesOption, PieSeriesOption, ScatterSeriesOption } from 'echarts/charts';
|
|
2
|
+
import { TitleComponentOption, TooltipComponentOption, ToolboxComponentOption, GridComponentOption, VisualMapComponentOption, LegendComponentOption, MarkLineComponentOption } from 'echarts/components';
|
|
3
|
+
import { DataZoomComponentOption } from 'echarts';
|
|
4
|
+
export type ECOption = echarts.ComposeOption<BarSeriesOption | LineSeriesOption | TitleComponentOption | ToolboxComponentOption | TooltipComponentOption | GridComponentOption | VisualMapComponentOption | PieSeriesOption | LegendComponentOption | MarkLineComponentOption | DataZoomComponentOption | ScatterSeriesOption>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Cell, Node, Options, Edge } from '@antv/x6';
|
|
2
|
+
interface LayoutFlow {
|
|
3
|
+
/**画布配置 */
|
|
4
|
+
option: Partial<Options.Manual>;
|
|
5
|
+
/**数据属性配置 */
|
|
6
|
+
props?: LayoutFlowProp;
|
|
7
|
+
}
|
|
8
|
+
type LayoutFlowProp = {
|
|
9
|
+
key: string | number;
|
|
10
|
+
children: string;
|
|
11
|
+
};
|
|
12
|
+
/**自动排布配置 */
|
|
13
|
+
export type LayoutFlowNodeOption = {
|
|
14
|
+
/**节点宽度 */
|
|
15
|
+
node_w: number;
|
|
16
|
+
/**节点高度 */
|
|
17
|
+
node_h: number;
|
|
18
|
+
/**节点间距 */
|
|
19
|
+
nodesep: number;
|
|
20
|
+
/**层间距 */
|
|
21
|
+
ranksep: number;
|
|
22
|
+
};
|
|
23
|
+
/**自动排布类型 */
|
|
24
|
+
type LayoutDirection = 'LR' | 'RL' | 'TB' | 'BT';
|
|
25
|
+
type EventOption = {
|
|
26
|
+
[name: string]: (args: Record<string, any>) => void;
|
|
27
|
+
};
|
|
28
|
+
type CustomElementOption = {
|
|
29
|
+
nodes: Record<string, any>;
|
|
30
|
+
edges: Record<string, any>;
|
|
31
|
+
};
|
|
32
|
+
/**自动排布流程 */
|
|
33
|
+
export declare function useLayoutFlow(options: LayoutFlow): {
|
|
34
|
+
init: (container: HTMLElement) => void;
|
|
35
|
+
add_graph_elements: (elements: Cell[]) => void;
|
|
36
|
+
layout: (cfg: LayoutFlowNodeOption, dir?: LayoutDirection) => void;
|
|
37
|
+
center_content: (padding: number) => void;
|
|
38
|
+
createNodes: (node_options: Node.Metadata[]) => Node[];
|
|
39
|
+
createEdges: (edge_options: Edge.Metadata[]) => Edge[];
|
|
40
|
+
register_event: (event_options: EventOption) => void;
|
|
41
|
+
register_custom_elements: (el_options: CustomElementOption) => void;
|
|
42
|
+
get_nodes: () => any;
|
|
43
|
+
clear: () => void;
|
|
44
|
+
};
|
|
45
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { default as mqtt } from 'mqtt';
|
|
2
|
+
export default function useMQTT(url: string, options?: mqtt.IClientOptions): {
|
|
3
|
+
connect: ({ success, err, receive }: {
|
|
4
|
+
success: () => void;
|
|
5
|
+
err: (e: any) => void;
|
|
6
|
+
receive: (...args: any) => void;
|
|
7
|
+
}) => void;
|
|
8
|
+
close: () => void;
|
|
9
|
+
subscribe: (topic: any) => void;
|
|
10
|
+
unsubscribe: (topic: any) => void;
|
|
11
|
+
publish: (topic: any, msg: string) => void;
|
|
12
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qy_better_lib/hooks",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0
|
|
4
|
+
"version": "0.1.0",
|
|
5
5
|
"description": "qy better lib hooks",
|
|
6
6
|
"author": "luhuiming",
|
|
7
7
|
"license": "ISC",
|
|
@@ -36,11 +36,17 @@
|
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
+
"@antv/x6": "^2.18.1",
|
|
40
|
+
"@types/dagre": "^0.7.53",
|
|
39
41
|
"@types/node": "^24.5.2",
|
|
40
42
|
"@vitejs/plugin-vue": "^6.0.1",
|
|
43
|
+
"dagre": "^0.8.5",
|
|
44
|
+
"echarts": "5.6.0",
|
|
41
45
|
"mitt": "^3.0.1",
|
|
46
|
+
"mqtt": "^5.14.1",
|
|
42
47
|
"vite": "^7.1.7",
|
|
43
48
|
"vite-plugin-dts": "^4.5.4",
|
|
44
49
|
"vue": "^3.5.22"
|
|
45
|
-
}
|
|
50
|
+
},
|
|
51
|
+
"dependencies": {}
|
|
46
52
|
}
|