@jnrs/lingshu-smart 2.2.6 → 2.2.8

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 (174) hide show
  1. package/dist/App.vue.d.ts +2 -1
  2. package/dist/App.vue.js +30 -0
  3. package/dist/assets/data/editor_default.d.ts +8 -1
  4. package/dist/assets/data/editor_default.js +59 -0
  5. package/dist/assets/data/editor_default_setting.d.ts +16 -0
  6. package/dist/assets/data/editor_default_setting.js +58 -0
  7. package/dist/assets/data/editor_preset.d.ts +8 -1
  8. package/dist/assets/data/editor_preset.js +51 -0
  9. package/dist/assets/data/editor_preset_menu.d.ts +9 -0
  10. package/dist/assets/data/editor_preset_menu.js +290 -0
  11. package/dist/components/editor/ControlBar/CaseManger.vue.d.ts +3 -15
  12. package/dist/components/editor/ControlBar/CaseManger.vue.js +465 -0
  13. package/dist/components/editor/ControlBar/CaseTitleEdit.vue.d.ts +2 -411
  14. package/dist/components/editor/ControlBar/CaseTitleEdit.vue.js +108 -0
  15. package/dist/components/editor/ControlBar/ExportImportDialog.vue.d.ts +3 -2
  16. package/dist/components/editor/ControlBar/ExportImportDialog.vue.js +280 -0
  17. package/dist/components/editor/ControlBar/MainButton.vue.d.ts +3 -2
  18. package/dist/components/editor/ControlBar/MainButton.vue.js +183 -0
  19. package/dist/components/editor/ControlBar/StepButton.vue.d.ts +2 -1
  20. package/dist/components/editor/ControlBar/StepButton.vue.js +147 -0
  21. package/dist/components/editor/ControlBar/StepRecordVisualizer.vue.d.ts +2 -1
  22. package/dist/components/editor/ControlBar/StepRecordVisualizer.vue.js +98 -0
  23. package/dist/components/editor/DrawingBoard.vue.d.ts +2 -1
  24. package/dist/components/editor/DrawingBoard.vue.js +31 -0
  25. package/dist/components/editor/MenuCard/Equipments.vue.d.ts +2 -1
  26. package/dist/components/editor/MenuCard/Equipments.vue.js +129 -0
  27. package/dist/components/editor/MenuCard/Layers.vue.d.ts +2 -1
  28. package/dist/components/editor/MenuCard/Layers.vue.js +201 -0
  29. package/dist/components/editor/MenuCard/index.vue.d.ts +2 -1
  30. package/dist/components/editor/MenuCard/index.vue.js +84 -0
  31. package/dist/components/editor/OptionCard/Equipment/Base.vue.d.ts +2 -1
  32. package/dist/components/editor/OptionCard/Equipment/Base.vue.js +96 -0
  33. package/dist/components/editor/OptionCard/Equipment/Binds.vue.d.ts +3 -0
  34. package/dist/components/editor/OptionCard/Equipment/Binds.vue.js +443 -0
  35. package/dist/components/editor/OptionCard/Equipment/Bot.vue.d.ts +3 -0
  36. package/dist/components/editor/OptionCard/Equipment/Bot.vue.js +81 -0
  37. package/dist/components/editor/OptionCard/Equipment/DataSets.vue.d.ts +2 -1
  38. package/dist/components/editor/OptionCard/Equipment/DataSets.vue.js +304 -0
  39. package/dist/components/editor/OptionCard/Equipment/DockStore.vue.d.ts +3 -0
  40. package/dist/components/editor/OptionCard/Equipment/DockStore.vue.js +597 -0
  41. package/dist/components/editor/OptionCard/Equipment/Interaction.vue.d.ts +2 -1
  42. package/dist/components/editor/OptionCard/Equipment/Interaction.vue.js +287 -0
  43. package/dist/components/editor/OptionCard/Equipment/Position.backup.vue.d.ts +3 -0
  44. package/dist/components/editor/OptionCard/Equipment/Position.backup.vue.js +440 -0
  45. package/dist/components/editor/OptionCard/Equipment/Position.vue.d.ts +2 -1
  46. package/dist/components/editor/OptionCard/Equipment/Position.vue.js +436 -0
  47. package/dist/components/editor/OptionCard/Equipment/StationSlotGroup.vue.d.ts +2 -1
  48. package/dist/components/editor/OptionCard/Equipment/StationSlotGroup.vue.js +1131 -0
  49. package/dist/components/editor/OptionCard/Equipment/Store.vue.d.ts +3 -0
  50. package/dist/components/editor/OptionCard/Equipment/Store.vue.js +453 -0
  51. package/dist/components/editor/OptionCard/Equipment/Trailer.vue.d.ts +3 -0
  52. package/dist/components/editor/OptionCard/Equipment/Trailer.vue.js +1109 -0
  53. package/dist/components/editor/OptionCard/Equipment/index.vue.d.ts +2 -1
  54. package/dist/components/editor/OptionCard/Equipment/index.vue.js +100 -0
  55. package/dist/components/editor/OptionCard/Equipment/models/MachineTool.vue.d.ts +3 -0
  56. package/dist/components/editor/OptionCard/Equipment/models/MachineTool.vue.js +99 -0
  57. package/dist/components/editor/OptionCard/Equipment/models/Rail.vue.d.ts +3 -0
  58. package/dist/components/editor/OptionCard/Equipment/models/Rail.vue.js +225 -0
  59. package/dist/components/editor/OptionCard/Equipment/models/SingleGripperRobot.vue.d.ts +3 -0
  60. package/dist/components/editor/OptionCard/Equipment/models/SingleGripperRobot.vue.js +99 -0
  61. package/dist/components/editor/OptionCard/Scene/Background.vue.d.ts +2 -1
  62. package/dist/components/editor/OptionCard/Scene/Background.vue.js +543 -0
  63. package/dist/components/editor/OptionCard/Scene/index.vue.d.ts +2 -1
  64. package/dist/components/editor/OptionCard/Scene/index.vue.js +200 -0
  65. package/dist/components/editor/OptionCard/index.vue.d.ts +2 -1
  66. package/dist/components/editor/OptionCard/index.vue.js +73 -0
  67. package/dist/components/editor/index.vue.d.ts +4 -13
  68. package/dist/components/editor/index.vue.js +156 -0
  69. package/dist/components/index.d.ts +2 -2
  70. package/dist/components/index.js +4 -25440
  71. package/dist/components/preview/index.vue.d.ts +6 -5
  72. package/dist/components/preview/index.vue.js +104 -0
  73. package/dist/composables/useStepRecord.d.ts +12 -4
  74. package/dist/composables/useStepRecord.js +135 -0
  75. package/dist/constants/options.d.ts +8 -1
  76. package/dist/constants/options.js +55 -0
  77. package/dist/controller/AppController.d.ts +10 -3
  78. package/dist/controller/AppController.js +168 -0
  79. package/dist/controller/EditorController.d.ts +9 -2
  80. package/dist/controller/EditorController.js +173 -0
  81. package/dist/index.js +1 -1
  82. package/dist/locales/en.js +5 -0
  83. package/dist/locales/i18next.d.ts +1 -1
  84. package/dist/locales/i18next.js +6 -0
  85. package/dist/locales/index.d.ts +2 -2
  86. package/dist/locales/index.js +3 -13
  87. package/dist/locales/zhCn.js +5 -0
  88. package/dist/main.d.ts +3 -0
  89. package/dist/main.js +13 -0
  90. package/dist/playground/EditPageDemo.vue.d.ts +2 -1
  91. package/dist/playground/EditPageDemo.vue.js +57 -0
  92. package/dist/playground/ViewPageDemo.vue.d.ts +2 -27
  93. package/dist/playground/ViewPageDemo.vue.js +277 -0
  94. package/dist/stores/index.js +3 -0
  95. package/dist/stores/useAppStore.d.ts +13 -6
  96. package/dist/stores/useAppStore.js +78 -0
  97. package/dist/stores/useDataStore.d.ts +18 -11
  98. package/dist/stores/useDataStore.js +116 -0
  99. package/dist/stores/useEditorStore.d.ts +27 -20
  100. package/dist/stores/useEditorStore.js +263 -0
  101. package/dist/types/app.types.d.ts +1 -1
  102. package/dist/types/app.types.js +2 -0
  103. package/dist/types/base.types.d.ts +4 -2
  104. package/dist/types/base.types.js +1 -0
  105. package/dist/types/components/config.types.d.ts +11 -3
  106. package/dist/types/components/config.types.js +1 -0
  107. package/dist/types/components/operating.types.d.ts +1 -1
  108. package/dist/types/components/operating.types.js +1 -0
  109. package/dist/types/enums.d.ts +5 -2
  110. package/dist/types/enums.js +46 -0
  111. package/dist/types/guards.d.ts +12 -2
  112. package/dist/types/guards.js +28 -0
  113. package/dist/types/index.d.ts +2 -2
  114. package/dist/types/index.js +8 -0
  115. package/dist/types/models/config.types.d.ts +74 -29
  116. package/dist/types/models/config.types.js +1 -0
  117. package/dist/types/models/operating.types.d.ts +83 -17
  118. package/dist/types/models/operating.types.js +1 -0
  119. package/dist/ui/abstract/ComponentAbs.d.ts +9 -2
  120. package/dist/ui/abstract/ComponentAbs.js +64 -0
  121. package/dist/ui/abstract/ModelAbs.d.ts +12 -2
  122. package/dist/ui/abstract/ModelAbs.js +119 -0
  123. package/dist/ui/components/Entrance.d.ts +8 -1
  124. package/dist/ui/components/Entrance.js +83 -0
  125. package/dist/ui/components/Light.d.ts +26 -3
  126. package/dist/ui/components/Light.js +167 -0
  127. package/dist/ui/components/Progress.d.ts +8 -1
  128. package/dist/ui/components/Progress.js +84 -0
  129. package/dist/ui/components/Resource.d.ts +8 -1
  130. package/dist/ui/components/Resource.js +70 -0
  131. package/dist/ui/components/StationSlot.d.ts +24 -2
  132. package/dist/ui/components/StationSlot.js +207 -0
  133. package/dist/ui/components/StationSlotGroup.d.ts +8 -1
  134. package/dist/ui/components/StationSlotGroup.js +110 -0
  135. package/dist/ui/factories/createGlass.d.ts +9 -1
  136. package/dist/ui/factories/createGlass.js +51 -0
  137. package/dist/ui/factories/createModel.d.ts +9 -2
  138. package/dist/ui/factories/createModel.js +35 -0
  139. package/dist/ui/factories/createShadow.d.ts +12 -4
  140. package/dist/ui/factories/createShadow.js +52 -0
  141. package/dist/ui/factories/createText.d.ts +7 -0
  142. package/dist/ui/factories/createText.js +46 -0
  143. package/dist/ui/models/CleaningMachine.d.ts +14 -0
  144. package/dist/ui/models/CleaningMachine.js +141 -0
  145. package/dist/ui/models/DoubleJointRobot.d.ts +23 -0
  146. package/dist/ui/models/DoubleJointRobot.js +545 -0
  147. package/dist/ui/models/LoadingStation.d.ts +16 -0
  148. package/dist/ui/models/LoadingStation.js +167 -0
  149. package/dist/ui/models/MachineTool.d.ts +5 -4
  150. package/dist/ui/models/MachineTool.js +184 -0
  151. package/dist/ui/models/MarkingMachine.d.ts +16 -0
  152. package/dist/ui/models/MarkingMachine.js +148 -0
  153. package/dist/ui/models/Rail.d.ts +15 -0
  154. package/dist/ui/models/Rail.js +117 -0
  155. package/dist/ui/models/ResourceStore.d.ts +12 -0
  156. package/dist/ui/models/ResourceStore.js +101 -0
  157. package/dist/ui/models/SingleBot.d.ts +20 -0
  158. package/dist/ui/models/SingleBot.js +202 -0
  159. package/dist/ui/models/SingleGripperRobot.d.ts +19 -0
  160. package/dist/ui/models/SingleGripperRobot.js +272 -0
  161. package/dist/ui/models/SingleJointRobot.d.ts +22 -0
  162. package/dist/ui/models/SingleJointRobot.js +346 -0
  163. package/dist/ui/shapes/NamePlate.d.ts +10 -1
  164. package/dist/ui/shapes/NamePlate.js +85 -0
  165. package/dist/ui/shapes/ScrewHole.d.ts +8 -1
  166. package/dist/ui/shapes/ScrewHole.js +57 -0
  167. package/dist/ui/shapes/Texture.d.ts +12 -3
  168. package/dist/ui/shapes/Texture.js +51 -0
  169. package/dist/ui/utils/attr.d.ts +10 -3
  170. package/dist/ui/utils/attr.js +50 -0
  171. package/dist/utils/index.js +92 -0
  172. package/dist/utils/type-guards.d.ts +1 -1
  173. package/dist/utils/type-guards.js +105 -0
  174. package/package.json +2 -2
@@ -0,0 +1,83 @@
1
+ /**
2
+ * @Author : TanRui
3
+ * @WeChat : Tan578853789
4
+ * @File : Entrance.ts
5
+ * @Date : 2025/01/18
6
+ * @desc. : 设备入口
7
+ */
8
+ import { Box } from 'leafer';
9
+ import {} from '@/types';
10
+ import { ComponentAbs } from '../abstract/ComponentAbs';
11
+ export class Entrance extends ComponentAbs {
12
+ constructor(options) {
13
+ const DEFAULTS = {
14
+ x: 0,
15
+ y: 0,
16
+ width: 120,
17
+ height: 30,
18
+ isIn: true,
19
+ isOut: false
20
+ };
21
+ super({ ...DEFAULTS, ...options });
22
+ }
23
+ get ChannelSize() {
24
+ const w = this.config.width * 0.2;
25
+ return w > 35 ? w : 35;
26
+ }
27
+ createUi() {
28
+ const { x, y, width } = this.config;
29
+ const main = new Box({
30
+ className: 'Entrance',
31
+ hittable: false,
32
+ x,
33
+ y,
34
+ width,
35
+ around: 'top',
36
+ overflow: 'hide',
37
+ children: [
38
+ this.renderChannel('outChannel', '下料', this.ChannelSize),
39
+ this.renderChannel('inChannel', '上料', this.config.width - this.ChannelSize)
40
+ ]
41
+ });
42
+ return main;
43
+ }
44
+ renderChannel(className, text, x) {
45
+ return {
46
+ className,
47
+ tag: 'Box',
48
+ x,
49
+ y: 0,
50
+ around: 'top',
51
+ visible: false,
52
+ children: [
53
+ {
54
+ tag: 'Polygon',
55
+ points: [0, 0, 0, 10, this.ChannelSize / 2, this.ChannelSize / 2, this.ChannelSize, 10, this.ChannelSize, 0],
56
+ animation: {
57
+ keyframes: [{ fill: '#65DB79' }, { fill: '#009866', scaleY: 1.1 }],
58
+ duration: 0.3,
59
+ swing: true
60
+ }
61
+ },
62
+ {
63
+ tag: 'Text',
64
+ text: text,
65
+ fill: '#333',
66
+ fontSize: 12,
67
+ fontWeight: 'bold',
68
+ textAlign: 'center',
69
+ y: -2,
70
+ width: this.ChannelSize
71
+ }
72
+ ]
73
+ };
74
+ }
75
+ operating(val) {
76
+ this.ui.findOne('.inChannel')?.set({
77
+ visible: val.isIn
78
+ });
79
+ this.ui.findOne('.outChannel')?.set({
80
+ visible: val.isOut
81
+ });
82
+ }
83
+ }
@@ -1,8 +1,31 @@
1
- import { ILightConfig, ILightOperating } from '../../types';
1
+ /**
2
+ * @Author : TanRui
3
+ * @WeChat : Tan578853789
4
+ * @File : Light.ts
5
+ * @Date : 2025/02/12
6
+ * @desc. : 状态灯
7
+ */
8
+ import type { ILightConfig, ILightOperating } from '@/types';
2
9
  import { Box } from 'leafer';
3
10
  import { ComponentAbs } from '../abstract/ComponentAbs';
4
- export declare class Light extends ComponentAbs<ILightConfig> {
5
- constructor(options: ILightConfig);
11
+ export interface IEllipseLight extends ILightConfig {
12
+ isRingShape?: boolean;
13
+ }
14
+ export interface IRectLightOperating extends Omit<ILightOperating, 'rotating'> {
15
+ }
16
+ /**
17
+ * 圆形灯
18
+ */
19
+ export declare class EllipseLight extends ComponentAbs<IEllipseLight> {
20
+ constructor(options: IEllipseLight);
6
21
  protected createUi(): Box;
7
22
  operating(val: ILightOperating): void;
8
23
  }
24
+ /**
25
+ * 矩形灯
26
+ */
27
+ export declare class RectLight extends ComponentAbs<ILightConfig> {
28
+ constructor(options: ILightConfig);
29
+ protected createUi(): Box;
30
+ operating(val: IRectLightOperating): void;
31
+ }
@@ -0,0 +1,167 @@
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,5 +1,12 @@
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
+ */
1
8
  import { Box } from 'leafer';
2
- import { IProgressConfig, IProgressOperating } from '../../types';
9
+ import { type IProgressConfig, type IProgressOperating } from '@/types';
3
10
  import { ComponentAbs } from '../abstract/ComponentAbs';
4
11
  export declare class Progress extends ComponentAbs<IProgressConfig> {
5
12
  constructor(options: IProgressConfig);
@@ -0,0 +1,84 @@
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,5 +1,12 @@
1
+ /**
2
+ * @Author : TanRui
3
+ * @WeChat : Tan578853789
4
+ * @File : Resource.ts
5
+ * @Date : 2026/02/12
6
+ * @Desc. : 资源类(托盘、刀具等),用于放置在 StationSlot 内
7
+ */
1
8
  import { Box } from 'leafer';
2
- import { IResourceConfig } from '../../types';
9
+ import { type IResourceConfig } from '@/types';
3
10
  import { ComponentAbs } from '../abstract/ComponentAbs';
4
11
  export declare class Resource extends ComponentAbs<IResourceConfig> {
5
12
  constructor(options: IResourceConfig);
@@ -0,0 +1,70 @@
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,4 +1,26 @@
1
- import { IStationSlotConfig, IResourceOperating } from '../../types';
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 { type IStationSlotConfig, type IResourceOperating } from '@/types';
2
24
  import { Box } from 'leafer';
3
25
  import { ComponentAbs } from '../abstract/ComponentAbs';
4
26
  export declare class StationSlot extends ComponentAbs<IStationSlotConfig> {
@@ -7,7 +29,6 @@ export declare class StationSlot extends ComponentAbs<IStationSlotConfig> {
7
29
  protected createUi(): Box;
8
30
  private get autoFixRotation();
9
31
  private get autoCornerRadius();
10
- private setupClickableArea;
11
32
  /**
12
33
  * 添加托盘
13
34
  * @param d
@@ -23,6 +44,7 @@ export declare class StationSlot extends ComponentAbs<IStationSlotConfig> {
23
44
  * @param flag
24
45
  */
25
46
  setSiteWorking(flag: boolean): void;
47
+ toggleVisible(visible: boolean | 0): void;
26
48
  /**
27
49
  * 销毁
28
50
  */