@jnrs/lingshu-smart 1.0.1 → 2.2.3
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 +34 -8
- package/dist/App.vue.d.ts +2 -0
- package/dist/assets/json/menu.json.d.ts +187 -0
- package/dist/components/editor/ControlBar/CaseMangerButton.vue.d.ts +31 -0
- package/dist/components/editor/ControlBar/CaseTitleEdit.vue.d.ts +412 -0
- package/dist/components/editor/ControlBar/ExportImportDialog.vue.d.ts +4 -0
- package/dist/components/editor/ControlBar/MainButton.vue.d.ts +17 -0
- package/dist/components/editor/ControlBar/StepButton.vue.d.ts +2 -0
- package/dist/components/editor/ControlBar/StepRecordVisualizer.vue.d.ts +9 -0
- package/dist/components/editor/DrawingBoard.vue.d.ts +2 -0
- package/dist/components/editor/MenuCard/Equipments.vue.d.ts +2 -0
- package/dist/components/editor/MenuCard/Layers.vue.d.ts +2 -0
- package/dist/components/editor/MenuCard/index.vue.d.ts +2 -0
- package/dist/components/editor/OptionCard/Equipment/Base.vue.d.ts +2 -0
- package/dist/components/editor/OptionCard/Equipment/Position.vue.d.ts +2 -0
- package/dist/components/editor/OptionCard/Equipment/index.vue.d.ts +2 -0
- package/dist/components/editor/OptionCard/Scene/Background.vue.d.ts +2 -0
- package/dist/components/editor/OptionCard/Scene/index.vue.d.ts +2 -0
- package/dist/components/editor/OptionCard/index.vue.d.ts +2 -0
- package/dist/components/editor/index.vue.d.ts +37 -0
- package/dist/components/index.d.ts +2 -1
- package/dist/components/index.js +24472 -1
- package/dist/composables/useStepRecord.d.ts +11 -0
- package/dist/constants/options.d.ts +9 -0
- package/dist/core/EditorManager.d.ts +33 -0
- package/dist/core/ViewContainer.d.ts +19 -0
- package/dist/favicon.ico +0 -0
- package/dist/index.js +1 -4
- package/dist/json/case.json +70 -0
- package/dist/locales/en.d.ts +0 -9
- package/dist/locales/index.js +8 -26
- package/dist/locales/zhCn.d.ts +0 -9
- package/dist/main.d.ts +0 -0
- package/dist/playground/EditPage.vue.d.ts +2 -0
- package/dist/playground/ViewPage.vue.d.ts +2 -0
- package/dist/stores/index.d.ts +1 -0
- package/dist/stores/useEditorStore.d.ts +14324 -0
- package/dist/types/components.d.ts +8 -0
- package/dist/types/index.d.ts +84 -1
- package/dist/types/model.d.ts +9 -0
- package/dist/ui/components/Light.d.ts +23 -0
- package/dist/ui/components/Progress.d.ts +24 -0
- package/dist/ui/components/Resource.d.ts +26 -0
- package/dist/ui/components/StationSlot.d.ts +36 -0
- package/dist/ui/models/BaseModel.d.ts +32 -0
- package/dist/ui/models/MachineTool.d.ts +12 -0
- package/dist/ui/models/ModelsFactory.d.ts +5 -0
- package/dist/ui/shapes/Glass.d.ts +12 -0
- package/dist/ui/shapes/NamePlate.d.ts +15 -0
- package/dist/ui/shapes/ScrewHole.d.ts +11 -0
- package/dist/ui/shapes/Texture.d.ts +12 -0
- package/dist/utils/index.d.ts +39 -0
- package/dist/utils/type-guards.d.ts +18 -0
- package/package.json +15 -7
package/dist/types/index.d.ts
CHANGED
|
@@ -1 +1,84 @@
|
|
|
1
|
-
|
|
1
|
+
import { IStroke, IFill, IShadowEffect } from 'leafer';
|
|
2
|
+
export type * from './components';
|
|
3
|
+
/**
|
|
4
|
+
* 包含所有设备共有的属性
|
|
5
|
+
*/
|
|
6
|
+
export interface IBaseModel {
|
|
7
|
+
id?: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
equipmentName?: string;
|
|
10
|
+
nameplate?: string;
|
|
11
|
+
width?: number;
|
|
12
|
+
height?: number;
|
|
13
|
+
x?: number;
|
|
14
|
+
y?: number;
|
|
15
|
+
zIndex?: number;
|
|
16
|
+
rotation?: number;
|
|
17
|
+
scale?: number;
|
|
18
|
+
cornerRadius?: number;
|
|
19
|
+
fill?: IFill;
|
|
20
|
+
stroke?: IStroke;
|
|
21
|
+
innerShadow?: IShadowEffect | IShadowEffect[];
|
|
22
|
+
shadow?: IShadowEffect | IShadowEffect[];
|
|
23
|
+
visible?: boolean;
|
|
24
|
+
editable?: boolean;
|
|
25
|
+
clickable?: boolean;
|
|
26
|
+
draggable?: boolean;
|
|
27
|
+
data?: IBaseModel;
|
|
28
|
+
children?: IBaseModel[];
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* 图层
|
|
32
|
+
*/
|
|
33
|
+
export interface ILayer extends IBaseModel {
|
|
34
|
+
selected?: boolean;
|
|
35
|
+
tags?: string[];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* 场景
|
|
39
|
+
*/
|
|
40
|
+
export interface IScene {
|
|
41
|
+
width: number;
|
|
42
|
+
height: number;
|
|
43
|
+
zoomType: 'fit' | number;
|
|
44
|
+
fill?: {
|
|
45
|
+
type: 'solid' | 'linear' | 'radial' | 'image';
|
|
46
|
+
color: string;
|
|
47
|
+
opacity: number;
|
|
48
|
+
stops: {
|
|
49
|
+
offset: number;
|
|
50
|
+
color: string;
|
|
51
|
+
}[];
|
|
52
|
+
url?: string;
|
|
53
|
+
from?: string;
|
|
54
|
+
to?: string;
|
|
55
|
+
};
|
|
56
|
+
stroke?: IStroke;
|
|
57
|
+
texture?: string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* 方案
|
|
61
|
+
*/
|
|
62
|
+
export interface ICase {
|
|
63
|
+
id: string;
|
|
64
|
+
isActive: boolean;
|
|
65
|
+
title: string;
|
|
66
|
+
layers: ILayer[];
|
|
67
|
+
scene: IScene;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* 设备菜单
|
|
71
|
+
*/
|
|
72
|
+
export interface IEquipmentsMenu {
|
|
73
|
+
title: string;
|
|
74
|
+
tag: string;
|
|
75
|
+
children: Partial<IBaseModel>[];
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* 容器
|
|
79
|
+
*/
|
|
80
|
+
export interface IContainer {
|
|
81
|
+
appDomId?: string | HTMLElement;
|
|
82
|
+
autoStart?: boolean;
|
|
83
|
+
editable?: boolean;
|
|
84
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Box } from 'leafer';
|
|
2
|
+
interface ILightConfig {
|
|
3
|
+
x?: number;
|
|
4
|
+
y?: number;
|
|
5
|
+
width?: number;
|
|
6
|
+
height?: number;
|
|
7
|
+
midColor?: string;
|
|
8
|
+
strokeColor?: string;
|
|
9
|
+
strokeWidth?: number;
|
|
10
|
+
isRingShape?: boolean;
|
|
11
|
+
}
|
|
12
|
+
interface ILightTurnOnValue {
|
|
13
|
+
color: string;
|
|
14
|
+
rotation?: boolean;
|
|
15
|
+
blink?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare class Light {
|
|
18
|
+
readonly ui: Box;
|
|
19
|
+
config: Required<ILightConfig>;
|
|
20
|
+
constructor(options?: ILightConfig);
|
|
21
|
+
setLightTurnOn(val: ILightTurnOnValue): void;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Box } from 'leafer';
|
|
2
|
+
interface IProgressConfig {
|
|
3
|
+
x?: number;
|
|
4
|
+
y?: number;
|
|
5
|
+
width?: number;
|
|
6
|
+
height?: number;
|
|
7
|
+
fill?: string;
|
|
8
|
+
progress?: number;
|
|
9
|
+
textContent?: string;
|
|
10
|
+
textShow?: boolean;
|
|
11
|
+
textPosition?: TextPosition;
|
|
12
|
+
}
|
|
13
|
+
interface IProgressSetValue {
|
|
14
|
+
percent: number;
|
|
15
|
+
textContent: string;
|
|
16
|
+
}
|
|
17
|
+
type TextPosition = 'left' | 'center' | 'right';
|
|
18
|
+
export declare class Progress {
|
|
19
|
+
readonly ui: Box;
|
|
20
|
+
config: Required<IProgressConfig>;
|
|
21
|
+
constructor(options?: IProgressConfig);
|
|
22
|
+
set(val: IProgressSetValue): void;
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Box } from 'leafer';
|
|
2
|
+
import { StationResourceType } from '../../types/components';
|
|
3
|
+
export interface IResourceConfig {
|
|
4
|
+
x?: number;
|
|
5
|
+
y?: number;
|
|
6
|
+
width?: number;
|
|
7
|
+
height?: number;
|
|
8
|
+
targetCode?: string;
|
|
9
|
+
targetState?: string;
|
|
10
|
+
color?: string;
|
|
11
|
+
data?: any;
|
|
12
|
+
clickable?: boolean;
|
|
13
|
+
draggable?: boolean;
|
|
14
|
+
showLog?: boolean;
|
|
15
|
+
resourceType?: StationResourceType;
|
|
16
|
+
}
|
|
17
|
+
export declare class Resource {
|
|
18
|
+
readonly ui: Box;
|
|
19
|
+
readonly data: any;
|
|
20
|
+
config: Required<IResourceConfig>;
|
|
21
|
+
constructor(options?: IResourceConfig);
|
|
22
|
+
get autoCornerRadius(): number;
|
|
23
|
+
private setupClickableBehavior;
|
|
24
|
+
private setupLogging;
|
|
25
|
+
destroy(): void;
|
|
26
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Box } from 'leafer';
|
|
2
|
+
import { StationResourceType } from '../../types/components';
|
|
3
|
+
interface IStationData {
|
|
4
|
+
equipmentId?: string;
|
|
5
|
+
stationType?: StationResourceType;
|
|
6
|
+
siteIndex?: number;
|
|
7
|
+
clickable?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface IStationSlotConfig {
|
|
10
|
+
x?: number;
|
|
11
|
+
y?: number;
|
|
12
|
+
width?: number;
|
|
13
|
+
height?: number;
|
|
14
|
+
fill?: string;
|
|
15
|
+
showSiteText?: boolean;
|
|
16
|
+
siteIndex?: number;
|
|
17
|
+
rotation?: number;
|
|
18
|
+
data?: IStationData;
|
|
19
|
+
clickable?: boolean;
|
|
20
|
+
showLog?: boolean;
|
|
21
|
+
stationType?: StationResourceType;
|
|
22
|
+
}
|
|
23
|
+
export declare class StationSlot {
|
|
24
|
+
readonly ui: Box;
|
|
25
|
+
private config;
|
|
26
|
+
private children;
|
|
27
|
+
constructor(options?: IStationSlotConfig);
|
|
28
|
+
get autoCornerRadius(): number;
|
|
29
|
+
private createShadowCanvas;
|
|
30
|
+
private setupClickableArea;
|
|
31
|
+
addPallet(d: any): void;
|
|
32
|
+
removeAllPallet(d?: any): void;
|
|
33
|
+
setSiteWorking(flag: boolean): void;
|
|
34
|
+
destroy(): void;
|
|
35
|
+
}
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { IBaseModel } from '../../types';
|
|
2
|
+
import { UI, PointerEvent } from 'leafer';
|
|
3
|
+
export interface IEventHandler {
|
|
4
|
+
/**
|
|
5
|
+
* 快速点击事件(左键单击)
|
|
6
|
+
*/
|
|
7
|
+
onTap?: (config: IBaseModel, e: PointerEvent) => void;
|
|
8
|
+
/**
|
|
9
|
+
* 右键 tap 事件(右键单击)
|
|
10
|
+
*/
|
|
11
|
+
onMenuTap?: (config: IBaseModel, e: PointerEvent) => void;
|
|
12
|
+
/**
|
|
13
|
+
* 拖动事件
|
|
14
|
+
*/
|
|
15
|
+
onDragEnd?: (config: IBaseModel, e: PointerEvent) => void;
|
|
16
|
+
}
|
|
17
|
+
export declare abstract class BaseModel<T extends IBaseModel = IBaseModel> {
|
|
18
|
+
private _config;
|
|
19
|
+
ui: UI;
|
|
20
|
+
private eventHandler;
|
|
21
|
+
constructor(config: T);
|
|
22
|
+
get config(): T;
|
|
23
|
+
get isClickable(): boolean;
|
|
24
|
+
get isDraggable(): boolean;
|
|
25
|
+
get width_05(): number;
|
|
26
|
+
protected abstract createUi(): UI;
|
|
27
|
+
destroyUI(): void;
|
|
28
|
+
setEventHandler(handler: IEventHandler): void;
|
|
29
|
+
private tapCallback;
|
|
30
|
+
private menuTapCallback;
|
|
31
|
+
private dragCallback;
|
|
32
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IMachineTool } from '../../types/model';
|
|
2
|
+
import { Box } from 'leafer';
|
|
3
|
+
import { BaseModel } from './BaseModel';
|
|
4
|
+
export declare class MachineTool extends BaseModel<IMachineTool> {
|
|
5
|
+
private get width();
|
|
6
|
+
private get height();
|
|
7
|
+
private get siteCount();
|
|
8
|
+
private get LightSize();
|
|
9
|
+
private get width_08();
|
|
10
|
+
private get autoFixRotation();
|
|
11
|
+
protected createUi(): Box;
|
|
12
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Box } from 'leafer';
|
|
2
|
+
interface IGlassConfig {
|
|
3
|
+
width?: number;
|
|
4
|
+
height?: number;
|
|
5
|
+
cornerRadius?: number;
|
|
6
|
+
}
|
|
7
|
+
export declare class Glass {
|
|
8
|
+
readonly ui: Box;
|
|
9
|
+
config: Required<IGlassConfig>;
|
|
10
|
+
constructor(options?: IGlassConfig);
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Box } from 'leafer';
|
|
2
|
+
export interface NamePlateOptions {
|
|
3
|
+
title: string;
|
|
4
|
+
x?: number;
|
|
5
|
+
y?: number;
|
|
6
|
+
width?: number;
|
|
7
|
+
height?: number;
|
|
8
|
+
cornerRadius?: number;
|
|
9
|
+
fill?: string;
|
|
10
|
+
textColor?: string;
|
|
11
|
+
fontSize?: number;
|
|
12
|
+
screwHole?: boolean;
|
|
13
|
+
zIndex?: number | string;
|
|
14
|
+
}
|
|
15
|
+
export declare function NamePlateUi(options: NamePlateOptions): Box;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Box } from 'leafer';
|
|
2
|
+
export type ScrewHoleStyle = 'light' | 'dark';
|
|
3
|
+
export interface ScrewHoleOptions {
|
|
4
|
+
x?: number;
|
|
5
|
+
y?: number;
|
|
6
|
+
width?: number;
|
|
7
|
+
height?: number;
|
|
8
|
+
fill?: string;
|
|
9
|
+
styleType?: ScrewHoleStyle;
|
|
10
|
+
}
|
|
11
|
+
export declare function ScrewHoleUi(options?: ScrewHoleOptions): Box;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Box } from 'leafer';
|
|
2
|
+
export type TextureEffect = 'LightGrid' | 'DarkGrid' | 'MatrixGrid' | 'LightDot' | 'DarkDot' | 'WoodFloor' | 'VerticalBar';
|
|
3
|
+
export interface ITextureOptions {
|
|
4
|
+
width?: number;
|
|
5
|
+
height?: number;
|
|
6
|
+
effect?: TextureEffect;
|
|
7
|
+
opacity?: number;
|
|
8
|
+
scale?: number;
|
|
9
|
+
rotation?: number;
|
|
10
|
+
cornerRadius?: number;
|
|
11
|
+
}
|
|
12
|
+
export declare function TextureUi(options?: ITextureOptions): Box;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ILayer } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* 数字生成器
|
|
4
|
+
* @param {*} start 起始值
|
|
5
|
+
* @param {*} end 结束值
|
|
6
|
+
* @param {*} shouldLoop 是否无限循环
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
export declare function numberLoopGenerator(start: number, end: number, shouldLoop?: boolean): Generator<number, void, unknown>;
|
|
10
|
+
/**
|
|
11
|
+
* 在 n 秒内把变量从值 x 线性递增到 y
|
|
12
|
+
* @param {*} x 初始值
|
|
13
|
+
* @param {*} y 结束值
|
|
14
|
+
* @param {*} n 递增时长
|
|
15
|
+
* @param {*} rate 帧率(别低于100否则进度条动画来不及显示)
|
|
16
|
+
* @param {*} callback 回调函数
|
|
17
|
+
* @returns
|
|
18
|
+
*/
|
|
19
|
+
export declare const linearIncrease: (x: number | undefined, y: number | undefined, n: number | undefined, rate: number | undefined, callback: (val: number | string) => void) => false | Promise<unknown>;
|
|
20
|
+
/**
|
|
21
|
+
* 将单个图层对象的指定字段从百分比转换为像素
|
|
22
|
+
* @param data 图层对象 (非数组)
|
|
23
|
+
* @param cvsWidth 画布宽度
|
|
24
|
+
* @param cvsHeight 画布高度
|
|
25
|
+
* @param keys 需要转换的字段名列表,默认为 ['x', 'y']
|
|
26
|
+
* @returns 转换后的新图层对象
|
|
27
|
+
*/
|
|
28
|
+
export declare const usePercent2Px: (data: ILayer, cvsWidth?: number, cvsHeight?: number, keys?: string[]) => ILayer;
|
|
29
|
+
export declare const transX: (percent?: number, w?: number) => number;
|
|
30
|
+
export declare const transY: (percent?: number, h?: number) => number;
|
|
31
|
+
/**
|
|
32
|
+
* 百分比值 & px值相互转换
|
|
33
|
+
* @param val 目标值
|
|
34
|
+
* @param size 容器
|
|
35
|
+
* @param getPercent 是否获取百分比
|
|
36
|
+
* @returns
|
|
37
|
+
*/
|
|
38
|
+
export declare function trans(val?: number, size?: number, getPercent?: boolean): number;
|
|
39
|
+
export declare function transFraction(val?: number, size?: number): number;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ICase, IScene, ILayer } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* 校验 IScene
|
|
4
|
+
*/
|
|
5
|
+
declare function isIScene(scene: any): scene is IScene;
|
|
6
|
+
/**
|
|
7
|
+
* 校验 ILayer
|
|
8
|
+
*/
|
|
9
|
+
declare function isILayer(layer: any): layer is ILayer;
|
|
10
|
+
/**
|
|
11
|
+
* 校验 ICase
|
|
12
|
+
*/
|
|
13
|
+
declare function isICase(item: any): item is ICase;
|
|
14
|
+
/**
|
|
15
|
+
* 顶层数组守卫
|
|
16
|
+
*/
|
|
17
|
+
declare function isICaseArray(data: unknown): data is ICase[];
|
|
18
|
+
export { isICase, isICaseArray, isILayer, isIScene };
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jnrs/lingshu-smart",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "2.2.3",
|
|
4
|
+
"description": "LingShu Smart 2D Digital Twin System.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jnrs",
|
|
7
7
|
"lingshu-smart"
|
|
8
8
|
],
|
|
9
|
-
"author": "
|
|
9
|
+
"author": "talia_tan",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"repository": {
|
|
12
12
|
"type": "git",
|
|
@@ -38,26 +38,34 @@
|
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"@vueuse/core": "^14.1.0",
|
|
42
|
-
"element-plus": "^2.11.9",
|
|
43
41
|
"@element-plus/icons-vue": "^2.3.2",
|
|
42
|
+
"@vueuse/core": "^14.1.0",
|
|
43
|
+
"element-plus": "^2.13.3",
|
|
44
44
|
"pinia": "^3.0.3",
|
|
45
45
|
"pinia-plugin-persistedstate": "^4.7.1",
|
|
46
46
|
"vue": "^3.5.22",
|
|
47
47
|
"vue-i18n": "^9.14.5",
|
|
48
|
-
"@jnrs/shared": "1.1.
|
|
48
|
+
"@jnrs/shared": "1.1.12"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
+
"@types/lodash-es": "^4.17.12",
|
|
51
52
|
"@vitejs/plugin-vue": "^6.0.1",
|
|
52
53
|
"rimraf": "^6.0.1",
|
|
53
54
|
"typescript": "^5.9.3",
|
|
54
55
|
"vite": "^7.1.7",
|
|
55
56
|
"vite-plugin-css-injected-by-js": "^3.5.2",
|
|
56
57
|
"vite-plugin-dts": "^4.5.4",
|
|
58
|
+
"vite-plugin-vue-devtools": "^8.0.5",
|
|
57
59
|
"vue-tsc": "^3.1.0"
|
|
58
60
|
},
|
|
61
|
+
"dependencies": {
|
|
62
|
+
"leafer": "^2.0.2",
|
|
63
|
+
"leafer-x-dot-matrix": "^1.0.2",
|
|
64
|
+
"leafer-x-ruler": "^2.0.0",
|
|
65
|
+
"object-hash": "^3.0.0"
|
|
66
|
+
},
|
|
59
67
|
"scripts": {
|
|
60
|
-
"dev": "vite
|
|
68
|
+
"dev": "vite",
|
|
61
69
|
"build": "vue-tsc --build && vite build",
|
|
62
70
|
"release": "node ./scripts/release.mjs",
|
|
63
71
|
"type-check": "vue-tsc --build"
|