@fmsim/machine 0.0.49

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 (274) hide show
  1. package/dist/agv-line.js +48 -0
  2. package/dist/agv-line.js.map +1 -0
  3. package/dist/agv.js +43 -0
  4. package/dist/agv.js.map +1 -0
  5. package/dist/buffer.js +40 -0
  6. package/dist/buffer.js.map +1 -0
  7. package/dist/conveyor-join.js +169 -0
  8. package/dist/conveyor-join.js.map +1 -0
  9. package/dist/conveyor.js +84 -0
  10. package/dist/conveyor.js.map +1 -0
  11. package/dist/crane.js +55 -0
  12. package/dist/crane.js.map +1 -0
  13. package/dist/data-subscription.js +126 -0
  14. package/dist/data-subscription.js.map +1 -0
  15. package/dist/editors/index.js +2 -0
  16. package/dist/editors/index.js.map +1 -0
  17. package/dist/equipment.js +18 -0
  18. package/dist/equipment.js.map +1 -0
  19. package/dist/features/client-api.js +45 -0
  20. package/dist/features/client-api.js.map +1 -0
  21. package/dist/features/conveyor-mixin.js +54 -0
  22. package/dist/features/conveyor-mixin.js.map +1 -0
  23. package/dist/features/mcs-event-handler-mixin.js +65 -0
  24. package/dist/features/mcs-event-handler-mixin.js.map +1 -0
  25. package/dist/features/mcs-status-default.js +67 -0
  26. package/dist/features/mcs-status-default.js.map +1 -0
  27. package/dist/features/mcs-status-mixin.js +39 -0
  28. package/dist/features/mcs-status-mixin.js.map +1 -0
  29. package/dist/features/mcs-transport-mixin.js +39 -0
  30. package/dist/features/mcs-transport-mixin.js.map +1 -0
  31. package/dist/features/mcs-zone-mixin.js +18 -0
  32. package/dist/features/mcs-zone-mixin.js.map +1 -0
  33. package/dist/groups/index.js +10 -0
  34. package/dist/groups/index.js.map +1 -0
  35. package/dist/groups/mcs-acs.js +24 -0
  36. package/dist/groups/mcs-acs.js.map +1 -0
  37. package/dist/groups/mcs-bcs.js +27 -0
  38. package/dist/groups/mcs-bcs.js.map +1 -0
  39. package/dist/groups/mcs-ccs.js +25 -0
  40. package/dist/groups/mcs-ccs.js.map +1 -0
  41. package/dist/groups/mcs-ecs.js +23 -0
  42. package/dist/groups/mcs-ecs.js.map +1 -0
  43. package/dist/groups/mcs-ocs.js +25 -0
  44. package/dist/groups/mcs-ocs.js.map +1 -0
  45. package/dist/groups/mcs-path.js +28 -0
  46. package/dist/groups/mcs-path.js.map +1 -0
  47. package/dist/groups/mcs-scs.js +26 -0
  48. package/dist/groups/mcs-scs.js.map +1 -0
  49. package/dist/groups/mcs-shape.js +26 -0
  50. package/dist/groups/mcs-shape.js.map +1 -0
  51. package/dist/index.js +25 -0
  52. package/dist/index.js.map +1 -0
  53. package/dist/mcs-carrier-holder.js +107 -0
  54. package/dist/mcs-carrier-holder.js.map +1 -0
  55. package/dist/mcs-gauge-capacity-bar.js +170 -0
  56. package/dist/mcs-gauge-capacity-bar.js.map +1 -0
  57. package/dist/mcs-gauge-capacity-circle.js +91 -0
  58. package/dist/mcs-gauge-capacity-circle.js.map +1 -0
  59. package/dist/mcs-machine.js +84 -0
  60. package/dist/mcs-machine.js.map +1 -0
  61. package/dist/mcs-popup.js +82 -0
  62. package/dist/mcs-popup.js.map +1 -0
  63. package/dist/mcs-transport.js +18 -0
  64. package/dist/mcs-transport.js.map +1 -0
  65. package/dist/mcs-unit.js +78 -0
  66. package/dist/mcs-unit.js.map +1 -0
  67. package/dist/mcs-vehicle.js +69 -0
  68. package/dist/mcs-vehicle.js.map +1 -0
  69. package/dist/mcs-zone-unit.js +11 -0
  70. package/dist/mcs-zone-unit.js.map +1 -0
  71. package/dist/oht-line.js +32 -0
  72. package/dist/oht-line.js.map +1 -0
  73. package/dist/oht.js +42 -0
  74. package/dist/oht.js.map +1 -0
  75. package/dist/port.js +32 -0
  76. package/dist/port.js.map +1 -0
  77. package/dist/rtv-rail.js +36 -0
  78. package/dist/rtv-rail.js.map +1 -0
  79. package/dist/shelf.js +41 -0
  80. package/dist/shelf.js.map +1 -0
  81. package/dist/shuttle.js +49 -0
  82. package/dist/shuttle.js.map +1 -0
  83. package/dist/stocker-capacity-bar.js +171 -0
  84. package/dist/stocker-capacity-bar.js.map +1 -0
  85. package/dist/stocker.js +36 -0
  86. package/dist/stocker.js.map +1 -0
  87. package/dist/templates/agv-line-corner.js +34 -0
  88. package/dist/templates/agv-line-corner.js.map +1 -0
  89. package/dist/templates/agv-line-cross.js +34 -0
  90. package/dist/templates/agv-line-cross.js.map +1 -0
  91. package/dist/templates/agv-line-horizontal.js +34 -0
  92. package/dist/templates/agv-line-horizontal.js.map +1 -0
  93. package/dist/templates/agv-line-vertical.js +34 -0
  94. package/dist/templates/agv-line-vertical.js.map +1 -0
  95. package/dist/templates/agv-line.js +15 -0
  96. package/dist/templates/agv-line.js.map +1 -0
  97. package/dist/templates/agv.js +15 -0
  98. package/dist/templates/agv.js.map +1 -0
  99. package/dist/templates/buffer.js +15 -0
  100. package/dist/templates/buffer.js.map +1 -0
  101. package/dist/templates/conveyor-corner.js +33 -0
  102. package/dist/templates/conveyor-corner.js.map +1 -0
  103. package/dist/templates/conveyor-join.js +21 -0
  104. package/dist/templates/conveyor-join.js.map +1 -0
  105. package/dist/templates/conveyor-left.js +33 -0
  106. package/dist/templates/conveyor-left.js.map +1 -0
  107. package/dist/templates/conveyor-middle.js +33 -0
  108. package/dist/templates/conveyor-middle.js.map +1 -0
  109. package/dist/templates/conveyor-right.js +33 -0
  110. package/dist/templates/conveyor-right.js.map +1 -0
  111. package/dist/templates/conveyor.js +18 -0
  112. package/dist/templates/conveyor.js.map +1 -0
  113. package/dist/templates/crane.js +15 -0
  114. package/dist/templates/crane.js.map +1 -0
  115. package/dist/templates/data-subscription.js +16 -0
  116. package/dist/templates/data-subscription.js.map +1 -0
  117. package/dist/templates/equipment.js +15 -0
  118. package/dist/templates/equipment.js.map +1 -0
  119. package/dist/templates/index.js +35 -0
  120. package/dist/templates/index.js.map +1 -0
  121. package/dist/templates/mcs-gauge-capacity-bar.js +18 -0
  122. package/dist/templates/mcs-gauge-capacity-bar.js.map +1 -0
  123. package/dist/templates/mcs-gauge-capacity-circle.js +18 -0
  124. package/dist/templates/mcs-gauge-capacity-circle.js.map +1 -0
  125. package/dist/templates/oht-line-corner.js +34 -0
  126. package/dist/templates/oht-line-corner.js.map +1 -0
  127. package/dist/templates/oht-line-cross.js +34 -0
  128. package/dist/templates/oht-line-cross.js.map +1 -0
  129. package/dist/templates/oht-line-horizontal.js +34 -0
  130. package/dist/templates/oht-line-horizontal.js.map +1 -0
  131. package/dist/templates/oht-line-vertical.js +34 -0
  132. package/dist/templates/oht-line-vertical.js.map +1 -0
  133. package/dist/templates/oht-line.js +15 -0
  134. package/dist/templates/oht-line.js.map +1 -0
  135. package/dist/templates/oht.js +15 -0
  136. package/dist/templates/oht.js.map +1 -0
  137. package/dist/templates/port.js +15 -0
  138. package/dist/templates/port.js.map +1 -0
  139. package/dist/templates/rtv-corner.js +33 -0
  140. package/dist/templates/rtv-corner.js.map +1 -0
  141. package/dist/templates/rtv-left.js +33 -0
  142. package/dist/templates/rtv-left.js.map +1 -0
  143. package/dist/templates/rtv-middle.js +33 -0
  144. package/dist/templates/rtv-middle.js.map +1 -0
  145. package/dist/templates/rtv-rail.js +15 -0
  146. package/dist/templates/rtv-rail.js.map +1 -0
  147. package/dist/templates/rtv-right.js +33 -0
  148. package/dist/templates/rtv-right.js.map +1 -0
  149. package/dist/templates/rtv.js +15 -0
  150. package/dist/templates/rtv.js.map +1 -0
  151. package/dist/templates/shelf.js +15 -0
  152. package/dist/templates/shelf.js.map +1 -0
  153. package/dist/templates/shuttle.js +15 -0
  154. package/dist/templates/shuttle.js.map +1 -0
  155. package/dist/templates/stocker-capacity-bar.js +18 -0
  156. package/dist/templates/stocker-capacity-bar.js.map +1 -0
  157. package/dist/templates/stocker-capacity-circle.js +18 -0
  158. package/dist/templates/stocker-capacity-circle.js.map +1 -0
  159. package/dist/templates/stocker.js +16 -0
  160. package/dist/templates/stocker.js.map +1 -0
  161. package/dist/templates/zone-capacity-bar.js +19 -0
  162. package/dist/templates/zone-capacity-bar.js.map +1 -0
  163. package/dist/tsconfig.tsbuildinfo +1 -0
  164. package/dist/utils/get-locale.js +19 -0
  165. package/dist/utils/get-locale.js.map +1 -0
  166. package/dist/utils/get-value-on-ranges.js +23 -0
  167. package/dist/utils/get-value-on-ranges.js.map +1 -0
  168. package/dist/utils/normalize-angle.js +11 -0
  169. package/dist/utils/normalize-angle.js.map +1 -0
  170. package/dist/utils/safe-round.js +9 -0
  171. package/dist/utils/safe-round.js.map +1 -0
  172. package/dist/zone-capacity-bar.js +162 -0
  173. package/dist/zone-capacity-bar.js.map +1 -0
  174. package/icons/agv-line.png +0 -0
  175. package/icons/agv.png +0 -0
  176. package/icons/buffer.png +0 -0
  177. package/icons/conveyor-corner.png +0 -0
  178. package/icons/conveyor-corner.svg +10 -0
  179. package/icons/conveyor-join.png +0 -0
  180. package/icons/conveyor-left.png +0 -0
  181. package/icons/conveyor-left.svg +6 -0
  182. package/icons/conveyor-middle.png +0 -0
  183. package/icons/conveyor-middle.svg +5 -0
  184. package/icons/conveyor-right.png +0 -0
  185. package/icons/conveyor-right.svg +6 -0
  186. package/icons/conveyor.png +0 -0
  187. package/icons/crane.png +0 -0
  188. package/icons/equipment.png +0 -0
  189. package/icons/icon-data-subscription.png +0 -0
  190. package/icons/oht-line.png +0 -0
  191. package/icons/oht.png +0 -0
  192. package/icons/pallet-empty.svg +3 -0
  193. package/icons/pallet.svg +11 -0
  194. package/icons/path-position.svg +5 -0
  195. package/icons/port.png +0 -0
  196. package/icons/process.png +0 -0
  197. package/icons/rtv-rail.png +0 -0
  198. package/icons/rtv.png +0 -0
  199. package/icons/shelf.png +0 -0
  200. package/icons/shuttle.png +0 -0
  201. package/icons/stocker-capacity-bar.png +0 -0
  202. package/icons/stocker-capacity-circle.png +0 -0
  203. package/icons/stocker.png +0 -0
  204. package/icons/symbol-data-subscription.png +0 -0
  205. package/icons/vehicle.png +0 -0
  206. package/icons/zone-capacity-bar.png +0 -0
  207. package/migration-samples/model.json +7964 -0
  208. package/package.json +59 -0
  209. package/src/agv-line.ts +59 -0
  210. package/src/agv.ts +56 -0
  211. package/src/buffer.ts +50 -0
  212. package/src/conveyor-join.ts +208 -0
  213. package/src/conveyor.ts +101 -0
  214. package/src/crane.ts +72 -0
  215. package/src/data-subscription.ts +150 -0
  216. package/src/editors/index.ts +0 -0
  217. package/src/equipment.ts +21 -0
  218. package/src/features/client-api.ts +52 -0
  219. package/src/features/conveyor-mixin.ts +75 -0
  220. package/src/features/mcs-status-default.ts +76 -0
  221. package/src/features/mcs-status-mixin.ts +53 -0
  222. package/src/features/mcs-zone-mixin.ts +23 -0
  223. package/src/groups/index.ts +10 -0
  224. package/src/groups/mcs-acs.ts +24 -0
  225. package/src/groups/mcs-bcs.ts +27 -0
  226. package/src/groups/mcs-ccs.ts +25 -0
  227. package/src/groups/mcs-ecs.ts +23 -0
  228. package/src/groups/mcs-ocs.ts +25 -0
  229. package/src/groups/mcs-path.ts +28 -0
  230. package/src/groups/mcs-scs.ts +26 -0
  231. package/src/groups/mcs-shape.ts +26 -0
  232. package/src/index.ts +29 -0
  233. package/src/mcs-carrier-holder.ts +141 -0
  234. package/src/mcs-gauge-capacity-circle.ts +113 -0
  235. package/src/mcs-machine.ts +101 -0
  236. package/src/mcs-popup.ts +99 -0
  237. package/src/mcs-transport.ts +20 -0
  238. package/src/mcs-unit.ts +91 -0
  239. package/src/mcs-vehicle.ts +79 -0
  240. package/src/oht-line.ts +43 -0
  241. package/src/oht.ts +55 -0
  242. package/src/port.ts +41 -0
  243. package/src/shelf.ts +53 -0
  244. package/src/shuttle.ts +65 -0
  245. package/src/stocker-capacity-bar.ts +220 -0
  246. package/src/stocker.ts +45 -0
  247. package/src/templates/agv-line.ts +15 -0
  248. package/src/templates/agv.ts +15 -0
  249. package/src/templates/buffer.ts +15 -0
  250. package/src/templates/conveyor.ts +18 -0
  251. package/src/templates/crane.ts +15 -0
  252. package/src/templates/data-subscription.js +16 -0
  253. package/src/templates/equipment.ts +15 -0
  254. package/src/templates/index.ts +43 -0
  255. package/src/templates/oht-line.ts +15 -0
  256. package/src/templates/oht.ts +15 -0
  257. package/src/templates/port.ts +15 -0
  258. package/src/templates/shelf.ts +15 -0
  259. package/src/templates/shuttle.ts +15 -0
  260. package/src/templates/stocker-capacity-bar.ts +18 -0
  261. package/src/templates/stocker-capacity-circle.ts +18 -0
  262. package/src/templates/stocker.ts +16 -0
  263. package/src/templates/zone-capacity-bar.ts +19 -0
  264. package/src/utils/get-locale.ts +22 -0
  265. package/src/utils/get-value-on-ranges.ts +25 -0
  266. package/src/utils/normalize-angle.ts +9 -0
  267. package/src/utils/safe-round.ts +8 -0
  268. package/src/zone-capacity-bar.ts +209 -0
  269. package/things-scene.config.js +7 -0
  270. package/translations/en.json +7 -0
  271. package/translations/ja.json +7 -0
  272. package/translations/ko.json +7 -0
  273. package/translations/ms.json +7 -0
  274. package/translations/zh.json +7 -0
@@ -0,0 +1,15 @@
1
+ const oht = new URL('../../icons/oht.png', import.meta.url).href
2
+
3
+ export default {
4
+ type: 'OHT',
5
+ description: 'OHT',
6
+ icon: oht,
7
+ group: 'OCS',
8
+ model: {
9
+ type: 'OHT',
10
+ left: 100,
11
+ top: 100,
12
+ width: 20,
13
+ height: 20
14
+ }
15
+ }
@@ -0,0 +1,15 @@
1
+ const port = new URL('../../icons/port.png', import.meta.url).href
2
+
3
+ export default {
4
+ type: 'Port',
5
+ description: 'port shape',
6
+ icon: port,
7
+ group: ['BCS', 'CCS', 'ECS', 'SCS'],
8
+ model: {
9
+ type: 'Port',
10
+ left: 100,
11
+ top: 100,
12
+ width: 20,
13
+ height: 20
14
+ }
15
+ }
@@ -0,0 +1,15 @@
1
+ const shelf = new URL('../../icons/shelf.png', import.meta.url).href
2
+
3
+ export default {
4
+ type: 'Shelf',
5
+ description: 'Shelf',
6
+ icon: shelf,
7
+ group: 'SCS',
8
+ model: {
9
+ type: 'Shelf',
10
+ left: 100,
11
+ top: 100,
12
+ width: 20,
13
+ height: 20
14
+ }
15
+ }
@@ -0,0 +1,15 @@
1
+ const shuttle = new URL('../../icons/shuttle.png', import.meta.url).href
2
+
3
+ export default {
4
+ type: 'Shuttle',
5
+ description: 'Shuttle',
6
+ icon: shuttle,
7
+ group: 'CCS',
8
+ model: {
9
+ type: 'Shuttle',
10
+ left: 100,
11
+ top: 100,
12
+ width: 20,
13
+ height: 20
14
+ }
15
+ }
@@ -0,0 +1,18 @@
1
+ const StockerCapacityBar = new URL('../../icons/stocker-capacity-bar.png', import.meta.url).href
2
+
3
+ export default {
4
+ type: 'StockerCapacityBar',
5
+ description: 'StockerCapacityBar',
6
+ icon: StockerCapacityBar,
7
+ group: 'SCS',
8
+ model: {
9
+ type: 'StockerCapacityBar',
10
+ left: 100,
11
+ top: 100,
12
+ width: 200,
13
+ height: 60,
14
+ maxCapacity: 100,
15
+ highWatermark: 100,
16
+ currentUsage: 0
17
+ }
18
+ }
@@ -0,0 +1,18 @@
1
+ const StockerCapacityCircle = new URL('../../icons/stocker-capacity-circle.png', import.meta.url).href
2
+
3
+ export default {
4
+ type: 'StockerCapacityCircle',
5
+ description: 'StockerCapacityCircle',
6
+ icon: StockerCapacityCircle,
7
+ group: 'SCS',
8
+ model: {
9
+ type: 'StockerCapacityCircle',
10
+ cx: 100,
11
+ cy: 100,
12
+ rx: 20,
13
+ ry: 20,
14
+ maxCapacity: 100,
15
+ highWatermark: 100,
16
+ currentUsage: 0
17
+ }
18
+ }
@@ -0,0 +1,16 @@
1
+ const stocker = new URL('../../icons/stocker.png', import.meta.url).href
2
+
3
+ export default {
4
+ type: 'Stocker',
5
+ description: 'stocker',
6
+ icon: stocker,
7
+ group: 'SCS',
8
+ model: {
9
+ type: 'STOCKER',
10
+ left: 100,
11
+ top: 100,
12
+ width: 240,
13
+ height: 100,
14
+ radius: 10
15
+ }
16
+ }
@@ -0,0 +1,19 @@
1
+ const ZoneCapacityBar = new URL('../../icons/zone-capacity-bar.png', import.meta.url).href
2
+
3
+ export default {
4
+ type: 'ZoneCapacityBar',
5
+ description: 'ZoneCapacityBar',
6
+ icon: ZoneCapacityBar,
7
+ group: 'SCS',
8
+ model: {
9
+ type: 'ZoneCapacityBar',
10
+ left: 100,
11
+ top: 100,
12
+ width: 200,
13
+ height: 60,
14
+ maxCapacity: 100,
15
+ highWatermark: 100,
16
+ currentUsage: 0,
17
+ round: 30
18
+ }
19
+ }
@@ -0,0 +1,22 @@
1
+ function getCookieValue(cookieString, variableName) {
2
+ const cookiePairs = cookieString.split(';')
3
+
4
+ for (let i = 0; i < cookiePairs.length; i++) {
5
+ const pair = cookiePairs[i].trim()
6
+ if (pair.startsWith(variableName + '=')) {
7
+ const value = pair.substring(variableName.length + 1)
8
+ return decodeURIComponent(value)
9
+ }
10
+ }
11
+
12
+ return undefined
13
+ }
14
+
15
+ var language
16
+
17
+ export function getLocaleLanguage() {
18
+ if (!language) {
19
+ language = getCookieValue(document.cookie, 'miipLang') || 'ko'
20
+ }
21
+ return language
22
+ }
@@ -0,0 +1,25 @@
1
+ export function getVaueOnRanges(value, param): any {
2
+ for (let range in param) {
3
+ let [from, to]: (number | string)[] = range.split('~')
4
+ let from_defined = !!from
5
+ let to_defined = !!to
6
+
7
+ from = parseFloat(from)
8
+ to = parseFloat(to)
9
+ value = Number(value) || 0
10
+
11
+ // from이나 to 둘 중 하나만 있는 경우 먼저 계산
12
+ if (from_defined && !to_defined && value >= from) {
13
+ return param[range]
14
+ } else if (!from_defined && to_defined && value < from) {
15
+ return param[range]
16
+ }
17
+
18
+ // 소수점이 있으므로 from <= value < to 가 되야함
19
+ if (value >= from && value < to) {
20
+ return param[range]
21
+ }
22
+ }
23
+
24
+ return param['default']
25
+ }
@@ -0,0 +1,9 @@
1
+ export function normalizeAngle(angle: number): number {
2
+ angle = angle % (2 * Math.PI)
3
+ if (angle <= -Math.PI) {
4
+ angle += 2 * Math.PI
5
+ } else if (angle > Math.PI) {
6
+ angle -= 2 * Math.PI
7
+ }
8
+ return angle
9
+ }
@@ -0,0 +1,8 @@
1
+ export function safeRound(round: number, width: number, height: number): number {
2
+ var max = width > height ? (height / width) * 100 : 100
3
+
4
+ if (round >= max) round = max
5
+ else if (round <= 0) round = 0
6
+
7
+ return round
8
+ }
@@ -0,0 +1,209 @@
1
+ import { Component, ComponentNature, POSITION, Properties } from '@hatiolab/things-scene'
2
+ import { LEGEND_CAPACITY } from './features/mcs-status-default'
3
+ import { safeRound } from './utils/safe-round'
4
+ import { getVaueOnRanges } from './utils/get-value-on-ranges'
5
+ import { MCSZoneMixin, MCSZoneMixinProperties } from './features/mcs-zone-mixin'
6
+ import MCSUnit from './mcs-unit'
7
+
8
+ const NATURE: ComponentNature = {
9
+ mutable: false,
10
+ resizable: true,
11
+ rotatable: true,
12
+ properties: [
13
+ ...MCSZoneMixinProperties,
14
+ {
15
+ type: 'number',
16
+ name: 'currentUsage',
17
+ label: 'current-usage'
18
+ },
19
+ {
20
+ type: 'number',
21
+ name: 'highWatermark',
22
+ label: 'high-watermark'
23
+ },
24
+ {
25
+ type: 'number',
26
+ name: 'maxCapacity',
27
+ label: 'max-capacity'
28
+ },
29
+ {
30
+ type: 'number',
31
+ label: 'round',
32
+ name: 'round',
33
+ property: {
34
+ min: 0
35
+ }
36
+ },
37
+ {
38
+ type: 'hidden',
39
+ name: 'usage',
40
+ label: 'usage'
41
+ }
42
+ ],
43
+ 'value-property': 'usage'
44
+ }
45
+
46
+ var controlHandler = {
47
+ ondragmove: function (point: POSITION, index: number, component: Component) {
48
+ var { left, top, width, height } = component.model
49
+
50
+ var transcoorded = component.transcoordP2S(point.x, point.y)
51
+ var round = ((transcoorded.x - left) / (width / 2)) * 100
52
+
53
+ round = safeRound(round, width, height)
54
+
55
+ component.set({
56
+ round
57
+ })
58
+ }
59
+ }
60
+
61
+ export default class ZoneCapacityBar extends MCSZoneMixin(MCSUnit) {
62
+ static get nature() {
63
+ return NATURE
64
+ }
65
+
66
+ get controls() {
67
+ var { left, top, width, round, height } = this.state
68
+ round = round == undefined ? 0 : safeRound(round, width, height)
69
+
70
+ return [
71
+ {
72
+ x: left + (width / 2) * (round / 100),
73
+ y: top,
74
+ handler: controlHandler
75
+ }
76
+ ]
77
+ }
78
+
79
+ getLegendFallback() {
80
+ return LEGEND_CAPACITY
81
+ }
82
+
83
+ get statusColor() {
84
+ return getVaueOnRanges(this.usage, this.legend)
85
+ }
86
+
87
+ get text() {
88
+ return this.usage + '%'
89
+ }
90
+
91
+ render(context: CanvasRenderingContext2D) {
92
+ const { left, top, width, height } = this.bounds
93
+
94
+ if (width >= height) {
95
+ this.renderLandscape(context)
96
+ } else {
97
+ this.renderPortrait(context)
98
+ }
99
+ }
100
+
101
+ renderLandscape(context: CanvasRenderingContext2D) {
102
+ const { left, top, width, height } = this.bounds
103
+ const { lineWidth, strokeStyle, round, fillStyle = '#aaa' } = this.state
104
+
105
+ context.strokeStyle = strokeStyle
106
+ context.lineWidth = lineWidth
107
+
108
+ context.save()
109
+ context.translate(left, top)
110
+
111
+ // gauge background
112
+ context.beginPath()
113
+
114
+ context.fillStyle = fillStyle
115
+ context.roundRect(0, 0, width, height, round)
116
+
117
+ context.fill()
118
+ context.stroke()
119
+
120
+ context.clip()
121
+
122
+ // gauge foreground
123
+ context.beginPath()
124
+
125
+ context.fillStyle = this.statusColor!
126
+
127
+ context.rect(0, 0, (width / 100) * this.usage, height)
128
+ context.fill()
129
+
130
+ context.beginPath()
131
+ context.strokeStyle = strokeStyle
132
+ context.roundRect(0, 0, width, height, round)
133
+ context.stroke()
134
+
135
+ context.beginPath()
136
+
137
+ context.translate(-left, -top)
138
+ context.restore()
139
+ }
140
+
141
+ renderPortrait(context: CanvasRenderingContext2D) {
142
+ const { left, top, width, height } = this.bounds
143
+ const { lineWidth, strokeStyle, round, fillStyle } = this.state
144
+
145
+ context.strokeStyle = strokeStyle
146
+ context.lineWidth = lineWidth
147
+
148
+ context.save()
149
+ context.translate(left, top)
150
+
151
+ // gauge background
152
+ context.beginPath()
153
+
154
+ context.fillStyle = fillStyle
155
+ context.roundRect(0, 0, width, height, round)
156
+
157
+ context.fill()
158
+ context.stroke()
159
+
160
+ context.clip()
161
+
162
+ // gauge foreground
163
+ context.beginPath()
164
+
165
+ context.fillStyle = this.statusColor!
166
+
167
+ context.rect(0, height - (height / 100) * this.usage, width, (height / 100) * this.usage)
168
+ context.fill()
169
+
170
+ context.beginPath()
171
+ context.roundRect(0, 0, width, height, round)
172
+ context.stroke()
173
+
174
+ context.beginPath()
175
+
176
+ context.translate(-left, -top)
177
+ context.restore()
178
+ }
179
+
180
+ get usage() {
181
+ const { currentUsage = 0, maxCapacity = 100 } = this.state
182
+ return Math.round((currentUsage / maxCapacity) * 100)
183
+ }
184
+
185
+ set usage(usage: number) {
186
+ // intentionally have done nothing
187
+ }
188
+
189
+ onchangeData(after: Properties, before: Properties): void {
190
+ const {
191
+ CURRENTCAPACITY = 0,
192
+ MAXCAPACITY = 100,
193
+ HIGHWATERMARK = 100
194
+ } = typeof this.data == 'object' ? this.data : {}
195
+
196
+ const currentUsage = Number(CURRENTCAPACITY) || 0
197
+ const maxCapacity = Number(MAXCAPACITY) || 100
198
+ const highWatermark = Number(HIGHWATERMARK) || 100
199
+
200
+ this.setState({
201
+ currentUsage,
202
+ maxCapacity,
203
+ highWatermark,
204
+ usage: Math.round((currentUsage / maxCapacity) * 100)
205
+ })
206
+ }
207
+ }
208
+
209
+ Component.register('ZoneCapacityBar', ZoneCapacityBar)
@@ -0,0 +1,7 @@
1
+ import templates from './dist/templates'
2
+ import groups from './dist/groups'
3
+
4
+ export default {
5
+ templates,
6
+ groups
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "label.current-usage": "current usage",
3
+ "label.high-watermark": "high watermark",
4
+ "label.legend-name": "legend",
5
+ "label.max-capacity": "max capacity",
6
+ "label.carrier-legend-name": "carrier legend"
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "label.current-usage": "current usage",
3
+ "label.high-watermark": "high watermark",
4
+ "label.legend-name": "legend",
5
+ "label.max-capacity": "max capacity",
6
+ "label.carrier-legend-name": "carrier legend"
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "label.current-usage": "현재 사용량",
3
+ "label.high-watermark": "고수위워터마크",
4
+ "label.legend-name": "레전드",
5
+ "label.max-capacity": "최대 용량",
6
+ "label.carrier-legend-name": "캐리어레전드"
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "label.current-usage": "current usage",
3
+ "label.high-watermark": "high watermark",
4
+ "label.legend-name": "legend",
5
+ "label.max-capacity": "max capacity",
6
+ "label.carrier-legend-name": "carrier legend"
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "label.current-usage": "current usage",
3
+ "label.high-watermark": "high watermark",
4
+ "label.legend-name": "legend",
5
+ "label.max-capacity": "max capacity",
6
+ "label.carrier-legend-name": "carrier legend"
7
+ }