@jnrs/lingshu-smart 2.2.8 → 2.2.10

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.
Files changed (176) hide show
  1. package/dist/App.vue.d.ts +1 -2
  2. package/dist/assets/data/editor_default_setting.d.ts +1 -8
  3. package/dist/assets/data/editor_preset_menu.d.ts +1 -8
  4. package/dist/components/editor/ControlBar/CaseManger.vue.d.ts +15 -3
  5. package/dist/components/editor/ControlBar/CaseTitleEdit.vue.d.ts +411 -2
  6. package/dist/components/editor/ControlBar/ExportImportDialog.vue.d.ts +2 -3
  7. package/dist/components/editor/ControlBar/MainButton.vue.d.ts +2 -3
  8. package/dist/components/editor/ControlBar/StepButton.vue.d.ts +1 -2
  9. package/dist/components/editor/ControlBar/StepRecordVisualizer.vue.d.ts +1 -2
  10. package/dist/components/editor/DrawingBoard.vue.d.ts +1 -2
  11. package/dist/components/editor/MenuCard/Equipments.vue.d.ts +1 -2
  12. package/dist/components/editor/MenuCard/Layers.vue.d.ts +1 -2
  13. package/dist/components/editor/MenuCard/index.vue.d.ts +1 -2
  14. package/dist/components/editor/OptionCard/Equipment/Base.vue.d.ts +1 -2
  15. package/dist/components/editor/OptionCard/Equipment/DataSets.vue.d.ts +1 -2
  16. package/dist/components/editor/OptionCard/Equipment/Interaction.vue.d.ts +1 -2
  17. package/dist/components/editor/OptionCard/Equipment/Position.vue.d.ts +1 -2
  18. package/dist/components/editor/OptionCard/Equipment/StationSlotGroup.vue.d.ts +1 -2
  19. package/dist/components/editor/OptionCard/Equipment/index.vue.d.ts +1 -2
  20. package/dist/components/editor/OptionCard/Equipment/models/MachineTool.vue.d.ts +1 -2
  21. package/dist/components/editor/OptionCard/Equipment/models/Rail.vue.d.ts +1 -2
  22. package/dist/components/editor/OptionCard/Equipment/models/SingleJointRobot.vue.d.ts +2 -0
  23. package/dist/components/editor/OptionCard/Scene/Background.vue.d.ts +1 -2
  24. package/dist/components/editor/OptionCard/Scene/index.vue.d.ts +1 -2
  25. package/dist/components/editor/OptionCard/index.vue.d.ts +1 -2
  26. package/dist/components/editor/index.vue.d.ts +13 -4
  27. package/dist/components/index.d.ts +2 -2
  28. package/dist/components/index.js +27281 -4
  29. package/dist/components/preview/index.vue.d.ts +5 -6
  30. package/dist/composables/useStepRecord.d.ts +4 -12
  31. package/dist/constants/options.d.ts +1 -8
  32. package/dist/controller/AppController.d.ts +3 -10
  33. package/dist/controller/EditorController.d.ts +2 -9
  34. package/dist/index.js +1 -1
  35. package/dist/json/cases.json +577 -20
  36. package/dist/locales/i18next.d.ts +1 -1
  37. package/dist/locales/index.d.ts +2 -2
  38. package/dist/locales/index.js +13 -3
  39. package/dist/main.d.ts +0 -3
  40. package/dist/playground/EditPageDemo.vue.d.ts +1 -2
  41. package/dist/playground/ViewPageDemo.vue.d.ts +27 -2
  42. package/dist/stores/useAppStore.d.ts +5 -12
  43. package/dist/stores/useDataStore.d.ts +11 -18
  44. package/dist/stores/useEditorStore.d.ts +20 -27
  45. package/dist/types/app.types.d.ts +1 -1
  46. package/dist/types/base.types.d.ts +1 -1
  47. package/dist/types/components/config.types.d.ts +1 -1
  48. package/dist/types/components/operating.types.d.ts +1 -1
  49. package/dist/types/enums.d.ts +1 -1
  50. package/dist/types/guards.d.ts +5 -12
  51. package/dist/types/index.d.ts +2 -2
  52. package/dist/types/models/config.types.d.ts +49 -47
  53. package/dist/types/models/operating.types.d.ts +53 -53
  54. package/dist/ui/abstract/ComponentAbs.d.ts +2 -9
  55. package/dist/ui/abstract/ModelAbs.d.ts +2 -10
  56. package/dist/ui/components/Entrance.d.ts +1 -8
  57. package/dist/ui/components/Light.d.ts +1 -8
  58. package/dist/ui/components/Progress.d.ts +1 -8
  59. package/dist/ui/components/Resource.d.ts +1 -8
  60. package/dist/ui/components/StationSlot.d.ts +1 -23
  61. package/dist/ui/components/StationSlotGroup.d.ts +1 -8
  62. package/dist/ui/factories/createGlass.d.ts +0 -6
  63. package/dist/ui/factories/createModel.d.ts +2 -9
  64. package/dist/ui/factories/createShadow.d.ts +1 -9
  65. package/dist/ui/factories/createText.d.ts +0 -7
  66. package/dist/ui/models/CleaningMachine.d.ts +1 -1
  67. package/dist/ui/models/DoubleJointRobot.d.ts +19 -20
  68. package/dist/ui/models/LoadingStation.d.ts +1 -1
  69. package/dist/ui/models/MachineTool.d.ts +1 -1
  70. package/dist/ui/models/MarkingMachine.d.ts +1 -1
  71. package/dist/ui/models/Rail.d.ts +1 -1
  72. package/dist/ui/models/ResourceStore.d.ts +1 -1
  73. package/dist/ui/models/SingleJointRobot.d.ts +3 -3
  74. package/dist/ui/shapes/NamePlate.d.ts +0 -7
  75. package/dist/ui/shapes/ScrewHole.d.ts +0 -7
  76. package/dist/ui/shapes/Texture.d.ts +1 -8
  77. package/dist/ui/utils/attr.d.ts +2 -9
  78. package/dist/utils/type-guards.d.ts +1 -1
  79. package/package.json +3 -3
  80. package/dist/App.vue.js +0 -30
  81. package/dist/assets/data/editor_default.d.ts +0 -16
  82. package/dist/assets/data/editor_default.js +0 -59
  83. package/dist/assets/data/editor_default_setting.js +0 -58
  84. package/dist/assets/data/editor_preset.d.ts +0 -9
  85. package/dist/assets/data/editor_preset.js +0 -51
  86. package/dist/assets/data/editor_preset_menu.js +0 -290
  87. package/dist/components/editor/ControlBar/CaseManger.vue.js +0 -465
  88. package/dist/components/editor/ControlBar/CaseTitleEdit.vue.js +0 -108
  89. package/dist/components/editor/ControlBar/ExportImportDialog.vue.js +0 -280
  90. package/dist/components/editor/ControlBar/MainButton.vue.js +0 -183
  91. package/dist/components/editor/ControlBar/StepButton.vue.js +0 -147
  92. package/dist/components/editor/ControlBar/StepRecordVisualizer.vue.js +0 -98
  93. package/dist/components/editor/DrawingBoard.vue.js +0 -31
  94. package/dist/components/editor/MenuCard/Equipments.vue.js +0 -129
  95. package/dist/components/editor/MenuCard/Layers.vue.js +0 -201
  96. package/dist/components/editor/MenuCard/index.vue.js +0 -84
  97. package/dist/components/editor/OptionCard/Equipment/Base.vue.js +0 -96
  98. package/dist/components/editor/OptionCard/Equipment/Binds.vue.d.ts +0 -3
  99. package/dist/components/editor/OptionCard/Equipment/Binds.vue.js +0 -443
  100. package/dist/components/editor/OptionCard/Equipment/Bot.vue.d.ts +0 -3
  101. package/dist/components/editor/OptionCard/Equipment/Bot.vue.js +0 -81
  102. package/dist/components/editor/OptionCard/Equipment/DataSets.vue.js +0 -304
  103. package/dist/components/editor/OptionCard/Equipment/DockStore.vue.d.ts +0 -3
  104. package/dist/components/editor/OptionCard/Equipment/DockStore.vue.js +0 -597
  105. package/dist/components/editor/OptionCard/Equipment/Interaction.vue.js +0 -287
  106. package/dist/components/editor/OptionCard/Equipment/Position.backup.vue.d.ts +0 -3
  107. package/dist/components/editor/OptionCard/Equipment/Position.backup.vue.js +0 -440
  108. package/dist/components/editor/OptionCard/Equipment/Position.vue.js +0 -436
  109. package/dist/components/editor/OptionCard/Equipment/StationSlotGroup.vue.js +0 -1131
  110. package/dist/components/editor/OptionCard/Equipment/Store.vue.d.ts +0 -3
  111. package/dist/components/editor/OptionCard/Equipment/Store.vue.js +0 -453
  112. package/dist/components/editor/OptionCard/Equipment/Trailer.vue.d.ts +0 -3
  113. package/dist/components/editor/OptionCard/Equipment/Trailer.vue.js +0 -1109
  114. package/dist/components/editor/OptionCard/Equipment/index.vue.js +0 -100
  115. package/dist/components/editor/OptionCard/Equipment/models/MachineTool.vue.js +0 -99
  116. package/dist/components/editor/OptionCard/Equipment/models/Rail.vue.js +0 -225
  117. package/dist/components/editor/OptionCard/Equipment/models/SingleGripperRobot.vue.d.ts +0 -3
  118. package/dist/components/editor/OptionCard/Equipment/models/SingleGripperRobot.vue.js +0 -99
  119. package/dist/components/editor/OptionCard/Scene/Background.vue.js +0 -543
  120. package/dist/components/editor/OptionCard/Scene/index.vue.js +0 -200
  121. package/dist/components/editor/OptionCard/index.vue.js +0 -73
  122. package/dist/components/editor/index.vue.js +0 -156
  123. package/dist/components/preview/index.vue.js +0 -104
  124. package/dist/composables/useStepRecord.js +0 -135
  125. package/dist/constants/options.js +0 -55
  126. package/dist/controller/AppController.js +0 -168
  127. package/dist/controller/EditorController.js +0 -173
  128. package/dist/locales/en.js +0 -5
  129. package/dist/locales/i18next.js +0 -6
  130. package/dist/locales/zhCn.js +0 -5
  131. package/dist/main.js +0 -13
  132. package/dist/playground/EditPageDemo.vue.js +0 -57
  133. package/dist/playground/ViewPageDemo.vue.js +0 -277
  134. package/dist/stores/index.js +0 -3
  135. package/dist/stores/useAppStore.js +0 -78
  136. package/dist/stores/useDataStore.js +0 -116
  137. package/dist/stores/useEditorStore.js +0 -263
  138. package/dist/types/app.types.js +0 -2
  139. package/dist/types/base.types.js +0 -1
  140. package/dist/types/components/config.types.js +0 -1
  141. package/dist/types/components/operating.types.js +0 -1
  142. package/dist/types/enums.js +0 -46
  143. package/dist/types/guards.js +0 -28
  144. package/dist/types/index.js +0 -8
  145. package/dist/types/models/config.types.js +0 -1
  146. package/dist/types/models/operating.types.js +0 -1
  147. package/dist/ui/abstract/ComponentAbs.js +0 -64
  148. package/dist/ui/abstract/ModelAbs.js +0 -119
  149. package/dist/ui/components/Entrance.js +0 -83
  150. package/dist/ui/components/Light.js +0 -167
  151. package/dist/ui/components/Progress.js +0 -84
  152. package/dist/ui/components/Resource.js +0 -70
  153. package/dist/ui/components/StationSlot.js +0 -207
  154. package/dist/ui/components/StationSlotGroup.js +0 -110
  155. package/dist/ui/factories/createGlass.js +0 -51
  156. package/dist/ui/factories/createModel.js +0 -35
  157. package/dist/ui/factories/createShadow.js +0 -52
  158. package/dist/ui/factories/createText.js +0 -46
  159. package/dist/ui/models/CleaningMachine.js +0 -141
  160. package/dist/ui/models/DoubleJointRobot.js +0 -545
  161. package/dist/ui/models/LoadingStation.js +0 -167
  162. package/dist/ui/models/MachineTool.js +0 -184
  163. package/dist/ui/models/MarkingMachine.js +0 -148
  164. package/dist/ui/models/Rail.js +0 -117
  165. package/dist/ui/models/ResourceStore.js +0 -101
  166. package/dist/ui/models/SingleBot.d.ts +0 -20
  167. package/dist/ui/models/SingleBot.js +0 -202
  168. package/dist/ui/models/SingleGripperRobot.d.ts +0 -19
  169. package/dist/ui/models/SingleGripperRobot.js +0 -272
  170. package/dist/ui/models/SingleJointRobot.js +0 -346
  171. package/dist/ui/shapes/NamePlate.js +0 -85
  172. package/dist/ui/shapes/ScrewHole.js +0 -57
  173. package/dist/ui/shapes/Texture.js +0 -51
  174. package/dist/ui/utils/attr.js +0 -50
  175. package/dist/utils/index.js +0 -92
  176. package/dist/utils/type-guards.js +0 -105
@@ -1,167 +0,0 @@
1
- /**
2
- * @Author : TanRui
3
- * @WeChat : Tan578853789
4
- * @File : Light.ts
5
- * @Date : 2025/02/12
6
- * @desc. : 状态灯
7
- */
8
- import { Box, Ellipse } from 'leafer';
9
- import { ComponentAbs } from '../abstract/ComponentAbs';
10
- /**
11
- * 圆形灯
12
- */
13
- export class EllipseLight extends ComponentAbs {
14
- constructor(options) {
15
- const DEFAULTS = {
16
- x: 0,
17
- y: 0,
18
- width: 100,
19
- height: 100,
20
- color: '#424242',
21
- strokeColor: '#DBDEE6',
22
- strokeWidth: 3,
23
- isRingShape: false,
24
- showShadow: false
25
- };
26
- super({ ...DEFAULTS, ...options });
27
- }
28
- createUi() {
29
- const { x, y, width, height, color, strokeColor, strokeWidth, showShadow } = this.config;
30
- const main = new Box({
31
- hittable: false,
32
- className: 'Light',
33
- x,
34
- y,
35
- width,
36
- height,
37
- cornerRadius: width,
38
- stroke: strokeColor,
39
- strokeWidth,
40
- around: 'center',
41
- shadow: showShadow
42
- ? {
43
- spread: 1,
44
- blur: 2,
45
- color: 'rgba(0,0,0,0.4)'
46
- }
47
- : null
48
- });
49
- const mid = new Ellipse({
50
- className: 'mid',
51
- x: this.width_05,
52
- y: this.width_05,
53
- width: this.width_05,
54
- height: this.width_05,
55
- around: 'center',
56
- stroke: 'rgba(255,255,255,0.5)',
57
- strokeWidth: 1,
58
- fill: color
59
- });
60
- const rotateLight = new Ellipse({
61
- className: 'rotateLight',
62
- x: this.width_05,
63
- y: this.width_05,
64
- width: width * 0.9,
65
- height: width * 0.9,
66
- around: 'center',
67
- cornerRadius: this.width_05,
68
- fill: 'rgba(66,66,66,1)'
69
- });
70
- main.add([rotateLight, mid]);
71
- return main;
72
- }
73
- // 操作:灯颜色变化 & 灯旋转 & 灯闪烁
74
- operating(val) {
75
- if (!this.config.isRingShape) {
76
- this.ui.findOne('.mid')?.set({
77
- fill: {
78
- color: val.color
79
- }
80
- });
81
- }
82
- let animObj = {};
83
- if (Object.hasOwn(val, 'rotating') && val.rotating) {
84
- animObj = {
85
- keyframes: [{ rotation: 0 }, { rotation: 360 }],
86
- duration: 0.3,
87
- easing: 'linear',
88
- loop: true
89
- };
90
- }
91
- if (Object.hasOwn(val, 'blinking') && val.blinking) {
92
- animObj = {
93
- keyframes: [{ fill: val.color }, { fill: this.config.color }, { fill: val.color }],
94
- duration: 0.5,
95
- loop: true
96
- };
97
- }
98
- this.ui.findOne('.rotateLight')?.set({
99
- fill: {
100
- type: 'linear',
101
- stops: [
102
- { offset: 0, color: val.color },
103
- { offset: 0.5, color: val.color },
104
- { offset: 1, color: 'rgba(0,0,0,0.8)' }
105
- ]
106
- },
107
- animation: animObj
108
- });
109
- }
110
- }
111
- /**
112
- * 矩形灯
113
- */
114
- export class RectLight extends ComponentAbs {
115
- constructor(options) {
116
- const DEFAULTS = {
117
- x: 0,
118
- y: 0,
119
- width: 50,
120
- height: 4,
121
- color: '#424242',
122
- strokeColor: '#DBDEE6',
123
- strokeWidth: 0,
124
- cornerRadius: 10,
125
- showShadow: false
126
- };
127
- super({ ...DEFAULTS, ...options });
128
- }
129
- createUi() {
130
- const { x, y, width, height, color, strokeColor, strokeWidth, cornerRadius, showShadow } = this.config;
131
- const main = new Box({
132
- hittable: false,
133
- className: 'RectLight',
134
- x,
135
- y,
136
- width,
137
- height,
138
- stroke: strokeColor,
139
- cornerRadius,
140
- strokeWidth,
141
- around: 'center',
142
- fill: color,
143
- shadow: showShadow
144
- ? {
145
- spread: 1,
146
- blur: 2,
147
- color: 'rgba(0,0,0,0.4)'
148
- }
149
- : null
150
- });
151
- return main;
152
- }
153
- // 操作:灯颜色变化 & 灯闪烁(矩形灯不支持旋转)
154
- operating(val) {
155
- let animObj = {};
156
- if (Object.hasOwn(val, 'blinking') && val.blinking) {
157
- animObj = {
158
- keyframes: [{ fill: val.color }, { fill: this.config.color }, { fill: val.color }],
159
- duration: 0.5,
160
- loop: true
161
- };
162
- }
163
- this.ui.findOne('.RectLight')?.set({
164
- animation: animObj
165
- });
166
- }
167
- }
@@ -1,84 +0,0 @@
1
- /**
2
- * @Author : TanRui
3
- * @WeChat : Tan578853789
4
- * @File : Progress.ts
5
- * @Date : 2026/04/09 (updated to match Resource style)
6
- * @Desc. : 进度条组件,继承自 ComponentAbs,用于统一 UI 管理
7
- */
8
- import { Box } from 'leafer';
9
- import {} from '@/types';
10
- import { ComponentAbs } from '../abstract/ComponentAbs';
11
- export class Progress extends ComponentAbs {
12
- constructor(options) {
13
- const DEFAULTS = {
14
- x: 0,
15
- y: 0,
16
- width: 50,
17
- height: 18,
18
- fill: 'rgba(0,0,0,0.1)',
19
- progress: 0,
20
- textContent: '',
21
- textShow: true,
22
- textPosition: 'center'
23
- };
24
- super({ ...DEFAULTS, ...options });
25
- }
26
- createUi() {
27
- const { x, y, width, height, fill, progress, textContent, textShow, textPosition } = this.config;
28
- const main = new Box({
29
- hittable: false,
30
- className: 'Progress',
31
- x,
32
- y,
33
- width,
34
- height,
35
- fill,
36
- cornerRadius: 20,
37
- overflow: 'hide',
38
- stroke: 'rgba(0,0,0,0.1)',
39
- strokeWidth: 1,
40
- around: 'center',
41
- children: [
42
- {
43
- className: 'textContent-bg',
44
- tag: 'Rect',
45
- x: 0,
46
- y: 0,
47
- width: width * progress,
48
- height: height,
49
- cornerRadius: 20,
50
- fill: {
51
- type: 'linear',
52
- from: 'left',
53
- stops: ['#61C654', '#009866']
54
- }
55
- },
56
- {
57
- visible: textShow,
58
- className: 'textContent-text',
59
- tag: 'Text',
60
- width,
61
- height,
62
- text: textContent,
63
- textAlign: textPosition,
64
- verticalAlign: 'middle',
65
- fontSize: 14,
66
- fontWeight: 'black',
67
- fill: '#424242'
68
- }
69
- ]
70
- });
71
- return main;
72
- }
73
- // 操作: 进度变化 & 文本变化
74
- operating(val) {
75
- this.ui.findOne('.textContent-text')?.set({
76
- text: val.textContent
77
- });
78
- if (typeof val.percent === 'number') {
79
- this.ui.findOne('.textContent-bg')?.animate({
80
- width: this.config.width * val.percent
81
- });
82
- }
83
- }
84
- }
@@ -1,70 +0,0 @@
1
- /**
2
- * @Author : TanRui
3
- * @WeChat : Tan578853789
4
- * @File : Resource.ts
5
- * @Date : 2026/02/12
6
- * @Desc. : 资源类(托盘、刀具等),用于放置在 StationSlot 内
7
- */
8
- import { Box } from 'leafer';
9
- import { EnumResourceType, EnumComponent } from '@/types';
10
- import { ComponentAbs } from '../abstract/ComponentAbs';
11
- import { createText } from '../factories/createText';
12
- export class Resource extends ComponentAbs {
13
- constructor(options) {
14
- const DEFAULTS = {
15
- className: EnumComponent.RESOURCE,
16
- x: 0,
17
- y: 0,
18
- width: 50,
19
- height: 50,
20
- name: '',
21
- color: 'rgba(255,255,255,1)',
22
- hittable: true,
23
- resourceType: EnumResourceType.PALLET,
24
- rawData: { id: '' }
25
- };
26
- super({ ...DEFAULTS, ...options });
27
- }
28
- createUi() {
29
- const { x, y, width, height, color, resourceType, name, hittable } = this.config;
30
- // 主容器
31
- const main = new Box({
32
- hittable,
33
- className: `Resource-${resourceType}`,
34
- x,
35
- y,
36
- width,
37
- height,
38
- fill: color,
39
- cornerRadius: this.autoCornerRadius,
40
- around: 'center',
41
- zIndex: 10,
42
- opacity: 0,
43
- data: this.config,
44
- animation: {
45
- keyframes: [{ scale: 1.2, opacity: 0 }, { scale: 0.95, opacity: 1 }, { scale: 1 }],
46
- duration: 0.5
47
- },
48
- animationOut: {
49
- keyframes: [
50
- { scale: 1, opacity: 1 },
51
- { scale: 0.5, opacity: 0 }
52
- ],
53
- duration: 0.3
54
- },
55
- children: [
56
- createText({
57
- name,
58
- width,
59
- height,
60
- fill: 'rgba(255,255,255,0.8)'
61
- })
62
- ]
63
- });
64
- return main;
65
- }
66
- get autoCornerRadius() {
67
- const { resourceType, width } = this.config;
68
- return resourceType === EnumResourceType.TOOL ? width : (width || 0) * 0.1;
69
- }
70
- }
@@ -1,207 +0,0 @@
1
- /**
2
- * @Author : TanRui
3
- * @WeChat : Tan578853789
4
- * @File : StationSlot.ts
5
- * @Date : 2026/02/12
6
- *
7
- * @classdesc
8
- * 工位槽位(Station Slot)是工位中用于承载资源(Resource)的容器。
9
- * 它负责管理资源的生命周期,包括添加、移除及状态同步,确保资源与工位之间的强关联和统一控制。
10
- *
11
- * @design
12
- * 当前采用 **方案一:真实添加/移除资源对象**。
13
- * - 资源在插入时被实际加入场景图(或容器),移除时从场景中销毁或解绑。
14
- * - 优点:逻辑直观,内存管理明确。
15
- * - 缺点:频繁创建/销毁可能影响性能(尤其在高频率操作场景)。
16
- *
17
- * @future
18
- * 后续可根据实际性能表现,切换至 **方案二:通过可见性(如 `visible` 属性)模拟添加/移除**。
19
- * - 资源始终存在于场景中,仅通过状态控制显示/隐藏。
20
- * - 适用于需要频繁切换但资源复用率高的场景。
21
- * - 基于方案一、二再添加个对象池机制的混合模式,即优先去资源池读取。
22
- */
23
- import { EnumResourceType, EnumComponent } from '@/types';
24
- import { Box, Text } from 'leafer';
25
- import { Resource } from './Resource';
26
- import { createShadow } from '../factories/createShadow';
27
- import { createText } from '../factories/createText';
28
- import { ComponentAbs } from '../abstract/ComponentAbs';
29
- import { setCursor } from '../utils/attr';
30
- export class StationSlot extends ComponentAbs {
31
- children = [];
32
- constructor(options) {
33
- const DEFAULTS = {
34
- className: EnumComponent.STATION_SLOT,
35
- name: '',
36
- index: 0,
37
- x: 0,
38
- y: 0,
39
- width: 50,
40
- height: 50,
41
- rotation: 0,
42
- parentRotation: 0,
43
- resourceType: EnumResourceType.PALLET,
44
- disabled: false,
45
- hittable: true,
46
- visible: true,
47
- showContainer: true
48
- };
49
- super({ ...DEFAULTS, ...options });
50
- }
51
- // 创建 UI
52
- createUi() {
53
- const { x, y, name, width, height, resourceType, hittable, disabled, visible, showContainer, origin = 'center', around = 'center' } = this.config;
54
- const main = new Box({
55
- hittable,
56
- visible,
57
- className: `StationSlot-${resourceType}`,
58
- x,
59
- y,
60
- width,
61
- height,
62
- origin,
63
- around,
64
- disabled,
65
- cornerRadius: this.autoCornerRadius,
66
- rotation: this.autoFixRotation,
67
- fill: 'rgba(255, 255, 255, 0.3)',
68
- hitFill: 'all',
69
- stroke: 'rgba(255, 255, 255, 0.7)',
70
- strokeWidth: 3,
71
- data: this.config,
72
- children: [
73
- createText({
74
- name,
75
- width,
76
- height,
77
- fill: 'rgba(0,0,0,0.2)'
78
- })
79
- ]
80
- });
81
- // 可交互时添加 hover 状态
82
- setCursor(main, { hittable: this.config.hittable, hitSelf: true, clickable: true }, 'border');
83
- if (showContainer) {
84
- const shadowCvs = createShadow({
85
- width,
86
- height,
87
- cornerRadius: this.autoCornerRadius,
88
- shadow: null
89
- });
90
- main.add(shadowCvs);
91
- }
92
- else {
93
- main.fill = 'rgba(0, 0, 0, 0)';
94
- main.stroke = 'rgba(0, 0, 0, 0)';
95
- }
96
- return main;
97
- }
98
- // 自动计算工位槽位的旋转补偿角度
99
- get autoFixRotation() {
100
- const parentRotation = this.config.parentRotation;
101
- const rotation = this.config.rotation ?? 0;
102
- if (!parentRotation)
103
- return rotation;
104
- let r = 0;
105
- if (parentRotation === 90)
106
- r = -90;
107
- if (parentRotation === -90)
108
- r = 90;
109
- if (parentRotation > 90)
110
- r = -180;
111
- if (parentRotation < -90)
112
- r = 180;
113
- return r + rotation;
114
- }
115
- // 根据类型自动计算圆角
116
- get autoCornerRadius() {
117
- const defaultType = this.config.resourceType;
118
- const width = this.config.width || 0;
119
- return defaultType === EnumResourceType.TOOL ? width : width * 0.1;
120
- }
121
- // private setupClickableArea(cornerRadius: number): void {
122
- // const clickableBox = new Box({
123
- // className: 'palletAndCutterSiteClickableBox',
124
- // width: this.config.width,
125
- // height: this.config.height,
126
- // fill: '#f40',
127
- // opacity: 0,
128
- // cornerRadius,
129
- // hoverStyle: {
130
- // opacity: 1,
131
- // zIndex: 0
132
- // },
133
- // children: [
134
- // new Text({
135
- // text: '放置',
136
- // textAlign: 'center',
137
- // verticalAlign: 'middle',
138
- // lineHeight: this.config.width * 0.4,
139
- // fontSize: this.config.width * 0.4,
140
- // fontWeight: 'black',
141
- // fill: '#fff',
142
- // width: this.config.width,
143
- // height: this.config.height
144
- // })
145
- // ]
146
- // })
147
- // this.ui?.add(clickableBox)
148
- // }
149
- /**
150
- * 添加托盘
151
- * @param d
152
- */
153
- addPallet(d) {
154
- const { width, height, resourceType } = this.config;
155
- const resource = new Resource({
156
- x: this.width_05,
157
- y: this.height_05,
158
- width: width - 5,
159
- height: height - 5,
160
- name: d.name,
161
- color: d.color,
162
- resourceType,
163
- rawData: d.rawData
164
- }).init();
165
- this.children.push(resource);
166
- this.ui.add(resource.ui);
167
- }
168
- /**
169
- * 移除托盘
170
- * @param d
171
- */
172
- removeAllPallet(d) {
173
- for (const item of this.children) {
174
- item.ui.destroy();
175
- }
176
- this.children = [];
177
- }
178
- /**
179
- * 设置工位是否正在使用
180
- * @param flag
181
- */
182
- setSiteWorking(flag) {
183
- const anim = flag
184
- ? {
185
- animation: {
186
- style: { fill: 'rgb(0, 255, 42)' },
187
- duration: 0.5,
188
- reverse: true,
189
- swing: true,
190
- loop: true
191
- }
192
- }
193
- : { animation: { style: { fill: '' } } };
194
- this.ui?.set(anim);
195
- }
196
- // 切换 ui 的 visible
197
- toggleVisible(visible) {
198
- this.ui?.set({ visible });
199
- }
200
- /**
201
- * 销毁
202
- */
203
- destroyUI() {
204
- this.removeAllPallet();
205
- this.ui?.destroy();
206
- }
207
- }
@@ -1,110 +0,0 @@
1
- /**
2
- * @Author : TanRui
3
- * @WeChat : Tan578853789
4
- * @File : StationSlotGroup.ts
5
- * @Date : 2026/04/08
6
- * @Desc. : 工位槽位组容器(类封装,支持动态操作)
7
- */
8
- import { UI, Flow } from 'leafer';
9
- import { StationSlot } from '../components/StationSlot';
10
- import { ComponentAbs } from '../abstract/ComponentAbs';
11
- /**
12
- * 工位槽位组容器
13
- * @param config - 工位槽位组配置
14
- * @param rotation - 可选的旋转角度,应用于所有子槽位
15
- * @returns StationSlotGroup 实例,包含 Flow 容器和操作方法
16
- */
17
- export class StationSlotGroup extends ComponentAbs {
18
- parentRotation;
19
- stationSlotInstances; // 存储 StationSlot 实例的 Map,key 为 IStationSlotConfig.index
20
- constructor(options, parentRotation) {
21
- super(options);
22
- this.parentRotation = parentRotation || 0;
23
- this.stationSlotInstances = new Map();
24
- }
25
- // 获取自动宽度来限制工位换行
26
- get autoSize() {
27
- const { flowOptions, stationSlots } = this.config;
28
- const flow = flowOptions.flow;
29
- const flowWrap = flowOptions.flowWrap;
30
- const quantity = flowOptions.oneDirectionMaxQuantity;
31
- const gapOffset = flowOptions.gap * (quantity - 1);
32
- const maxWidth = Math.max(...stationSlots.map((d) => d.width));
33
- const maxHeight = Math.max(...stationSlots.map((d) => d.height));
34
- if (flowWrap === false) {
35
- return {
36
- width: this.config.width,
37
- height: this.config.height
38
- };
39
- }
40
- if (flow === 'x' || flow === 'x-reverse') {
41
- return {
42
- width: maxWidth * quantity + gapOffset,
43
- height: this.config.height
44
- };
45
- }
46
- if (flow === 'y' || flow === 'y-reverse') {
47
- return {
48
- width: this.config.width,
49
- height: maxHeight * quantity + gapOffset
50
- };
51
- }
52
- return {
53
- width: this.config.width,
54
- height: this.config.height
55
- };
56
- }
57
- // 创建 UI
58
- createUi() {
59
- const { x, y, rotation, zIndex, stationSlots, flowOptions, hittable = true, origin = 'center', around = 'center' } = this.config;
60
- const stationSlotsUi = [];
61
- for (const item of stationSlots) {
62
- if (typeof item.index !== 'number') {
63
- console.warn('StationSlot 缺少有效的 index 字段:', item);
64
- continue;
65
- }
66
- const slotInstance = new StationSlot({
67
- ...item,
68
- parentRotation: this.parentRotation
69
- }).init();
70
- this.stationSlotInstances.set(item.index, slotInstance);
71
- stationSlotsUi.push(slotInstance.ui);
72
- }
73
- const main = new Flow({
74
- ...flowOptions,
75
- className: 'StationSlotGroup',
76
- hittable,
77
- x,
78
- y,
79
- rotation,
80
- zIndex,
81
- width: this.autoSize.width,
82
- height: this.autoSize.height,
83
- origin,
84
- around,
85
- flowAlign: 'center',
86
- children: stationSlotsUi
87
- });
88
- return main;
89
- }
90
- /**
91
- * 操作方法:处理资源新增/移除
92
- */
93
- operating(val) {
94
- if (typeof val.index !== 'number') {
95
- console.warn('IResourceOperating 缺少有效的 index 字段:', val);
96
- return;
97
- }
98
- const stationSlot = this.stationSlotInstances.get(val.index);
99
- if (!stationSlot) {
100
- console.warn(`处理资源失败:未找到 index=${val.index} 的工位槽,rawData:`, val.rawData);
101
- return;
102
- }
103
- if (val.handleType === 'add') {
104
- stationSlot.addPallet(val);
105
- }
106
- else if (val.handleType === 'remove') {
107
- stationSlot.removeAllPallet();
108
- }
109
- }
110
- }
@@ -1,51 +0,0 @@
1
- /**
2
- * @Author : YourName
3
- * @File : createGlass.ts
4
- * @Date : 2026/04/07
5
- * @Desc. : 创建玻璃质感背景的工厂函数
6
- */
7
- import { Box } from 'leafer';
8
- import { Texture } from '../shapes/Texture';
9
- /**
10
- * 创建具有磨砂玻璃效果的 Box 容器
11
- */
12
- export function createGlass(config) {
13
- const { x, y, width, height, cornerRadius = 10, origin = 'center', around = 'center' } = config;
14
- const glassBox = new Box({
15
- x,
16
- y,
17
- width,
18
- height,
19
- cornerRadius,
20
- origin,
21
- around,
22
- hittable: false,
23
- className: 'Glass',
24
- fill: {
25
- type: 'linear',
26
- from: 'top-left',
27
- to: 'bottom-right',
28
- stops: [
29
- { offset: 0, color: 'rgba(255, 255, 255, 0.8)' },
30
- { offset: 1, color: 'rgba(239, 251, 255, 0.5)' }
31
- ]
32
- },
33
- shadow: {
34
- blur: 3,
35
- color: 'rgba(0,0,0,0.3)'
36
- },
37
- stroke: 'rgba(255, 255, 255, 0.3)',
38
- strokeWidth: 1
39
- });
40
- // 添加纹理
41
- glassBox.add(Texture({
42
- width,
43
- height,
44
- cornerRadius,
45
- effect: 'VerticalBar',
46
- opacity: 0.08,
47
- scale: 0.015,
48
- rotation: 45
49
- }));
50
- return glassBox;
51
- }