@operato/scene-manufacturing 7.0.3 → 7.0.6
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/CHANGELOG.md +18 -0
- package/cache/translations/system/en.json +1 -1
- package/cache/translations/system/ko.json +1 -1
- package/db.sqlite +0 -0
- package/dist/tact-timer-mask.d.ts +1 -0
- package/dist/tact-timer-mask.js +35 -0
- package/dist/tact-timer-mask.js.map +1 -0
- package/dist/tact-timer.d.ts +7 -3
- package/dist/tact-timer.js +113 -21
- package/dist/tact-timer.js.map +1 -1
- package/dist/templates/index.d.ts +9 -0
- package/dist/templates/tact-timer.d.ts +9 -0
- package/dist/templates/tact-timer.js +10 -1
- package/dist/templates/tact-timer.js.map +1 -1
- package/helps/scene/component/manufacturing/tact-timer.ja.md +50 -16
- package/helps/scene/component/manufacturing/tact-timer.ko.md +61 -24
- package/helps/scene/component/manufacturing/tact-timer.md +52 -15
- package/helps/scene/component/manufacturing/tact-timer.ms.md +49 -12
- package/helps/scene/component/manufacturing/tact-timer.zh.md +50 -13
- package/icons/tact-timer-mask.svg +37 -0
- package/logs/.08636eb59927f12972f6774f5947c8507b3564c2-audit.json +6 -6
- package/logs/.5e5d741d8b7784a2fbad65eedc0fd46946aaf6f2-audit.json +30 -0
- package/logs/application-2024-07-11-12.log +23 -0
- package/logs/application-2024-07-11-13.log +23 -0
- package/logs/connections-2024-07-06-01.log +50 -0
- package/logs/connections-2024-07-06-03.log +50 -0
- package/logs/connections-2024-07-06-11.log +47 -0
- package/logs/connections-2024-07-06-12.log +50 -0
- package/logs/connections-2024-07-11-12.log +47 -0
- package/logs/connections-2024-07-11-13.log +47 -0
- package/package.json +2 -2
- package/schema.graphql +40 -76
- package/src/tact-timer-mask.ts +34 -0
- package/src/tact-timer.ts +119 -27
- package/src/templates/tact-timer.ts +10 -1
- package/translations/en.json +6 -1
- package/translations/ja.json +6 -1
- package/translations/ko.json +6 -1
- package/translations/ms.json +6 -1
- package/translations/zh.json +6 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/logs/application-2024-07-05-08.log +0 -105
- package/logs/application-2024-07-05-12.log +0 -105
- package/src/tact-timer.svg +0 -33
package/src/tact-timer.ts
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
1
|
import { Component, ComponentNature, Properties, RectPath, Shape } from '@hatiolab/things-scene'
|
|
6
|
-
|
|
7
2
|
import format from './libs/format'
|
|
3
|
+
import { MASK } from './tact-timer-mask'
|
|
8
4
|
|
|
9
5
|
const NATURE: ComponentNature = {
|
|
10
6
|
mutable: false,
|
|
@@ -12,10 +8,16 @@ const NATURE: ComponentNature = {
|
|
|
12
8
|
rotatable: true,
|
|
13
9
|
properties: [
|
|
14
10
|
{
|
|
15
|
-
type: '
|
|
16
|
-
label: '
|
|
17
|
-
name: '
|
|
18
|
-
placeholder: '
|
|
11
|
+
type: 'string',
|
|
12
|
+
label: 'start-time',
|
|
13
|
+
name: 'startTime',
|
|
14
|
+
placeholder: 'YYYYMMDDhhmmss'
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
type: 'string',
|
|
18
|
+
label: 'end-time',
|
|
19
|
+
name: 'endTime',
|
|
20
|
+
placeholder: 'YYYYMMDDhhmmss'
|
|
19
21
|
},
|
|
20
22
|
{
|
|
21
23
|
type: 'string',
|
|
@@ -31,6 +33,11 @@ const NATURE: ComponentNature = {
|
|
|
31
33
|
options: ['', 'increase', 'decrease']
|
|
32
34
|
}
|
|
33
35
|
},
|
|
36
|
+
{
|
|
37
|
+
type: 'color',
|
|
38
|
+
label: 'tact-timer-mask-color',
|
|
39
|
+
name: 'maskColor'
|
|
40
|
+
},
|
|
34
41
|
{
|
|
35
42
|
type: 'color',
|
|
36
43
|
label: 'increase-progress-color',
|
|
@@ -71,14 +78,25 @@ const NATURE: ComponentNature = {
|
|
|
71
78
|
type: 'boolean',
|
|
72
79
|
label: 'auto-start',
|
|
73
80
|
name: 'autoStart'
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
type: 'boolean',
|
|
84
|
+
label: 'show-progress',
|
|
85
|
+
name: 'showProgress'
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
type: 'boolean',
|
|
89
|
+
label: 'show-timer',
|
|
90
|
+
name: 'showTimer'
|
|
74
91
|
}
|
|
75
92
|
],
|
|
76
|
-
'value-property': 'tactTime',
|
|
77
93
|
help: 'scene/component/manufacturing/tact-timer'
|
|
78
94
|
}
|
|
79
95
|
|
|
80
96
|
export default class TactTimer extends RectPath(Shape) {
|
|
81
|
-
private
|
|
97
|
+
private _start: number = 0
|
|
98
|
+
private _due: number = 0
|
|
99
|
+
private imageElement?: HTMLImageElement
|
|
82
100
|
|
|
83
101
|
get nature() {
|
|
84
102
|
return NATURE
|
|
@@ -97,14 +115,36 @@ export default class TactTimer extends RectPath(Shape) {
|
|
|
97
115
|
}
|
|
98
116
|
|
|
99
117
|
start() {
|
|
100
|
-
|
|
101
|
-
this.
|
|
118
|
+
const { startTime, endTime } = this.state
|
|
119
|
+
const start = this.parseTime(startTime)
|
|
120
|
+
const end = this.parseTime(endTime)
|
|
121
|
+
|
|
122
|
+
if (start && end) {
|
|
123
|
+
this._due = end.getTime()
|
|
124
|
+
this._start = start.getTime()
|
|
125
|
+
this.counting()
|
|
126
|
+
}
|
|
102
127
|
}
|
|
103
128
|
|
|
104
129
|
onchange(after: Properties) {
|
|
105
|
-
if ('
|
|
130
|
+
if ('startTime' in after || 'endTime' in after) {
|
|
106
131
|
this.start()
|
|
107
132
|
}
|
|
133
|
+
if ('maskColor' in after) {
|
|
134
|
+
delete this.imageElement
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
getImageElement(): HTMLImageElement | undefined {
|
|
139
|
+
if (!this.imageElement) {
|
|
140
|
+
const { maskColor = 'black' } = this.state
|
|
141
|
+
|
|
142
|
+
this.imageElement = new Image()
|
|
143
|
+
this.imageElement.src =
|
|
144
|
+
'data:image/svg+xml;charset=UTF-8;base64,' + btoa(MASK.replace(/{{fillColor}}/g, maskColor))
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
return this.imageElement
|
|
108
148
|
}
|
|
109
149
|
|
|
110
150
|
counting() {
|
|
@@ -113,10 +153,15 @@ export default class TactTimer extends RectPath(Shape) {
|
|
|
113
153
|
}
|
|
114
154
|
|
|
115
155
|
requestAnimationFrame(() => {
|
|
156
|
+
const { showTimer } = this.state
|
|
116
157
|
const countdown = this.countdown
|
|
117
158
|
|
|
118
|
-
|
|
119
|
-
|
|
159
|
+
if (showTimer) {
|
|
160
|
+
const text = format(Math.abs(countdown), this.getState('format'))
|
|
161
|
+
this.text = text
|
|
162
|
+
} else {
|
|
163
|
+
this.text = ''
|
|
164
|
+
}
|
|
120
165
|
|
|
121
166
|
this.setState('data', this.countdown)
|
|
122
167
|
|
|
@@ -128,24 +173,26 @@ export default class TactTimer extends RectPath(Shape) {
|
|
|
128
173
|
|
|
129
174
|
render(context: CanvasRenderingContext2D) {
|
|
130
175
|
var {
|
|
131
|
-
tactTime,
|
|
132
176
|
top,
|
|
133
177
|
left,
|
|
134
178
|
height,
|
|
135
179
|
width,
|
|
136
180
|
round = 0,
|
|
137
181
|
fontColor,
|
|
182
|
+
maskColor,
|
|
138
183
|
increaseFontColor,
|
|
139
184
|
decreaseFontColor,
|
|
140
185
|
increaseProgressColor = 'transparent',
|
|
141
186
|
decreaseProgressColor = 'transparent',
|
|
142
187
|
underThresholdColor = 'transparent',
|
|
143
188
|
progressDirection = 'increase',
|
|
144
|
-
progressThreshold = 0
|
|
189
|
+
progressThreshold = 0,
|
|
190
|
+
showProgress
|
|
145
191
|
} = this.state
|
|
146
192
|
|
|
147
193
|
const increase = this.countdown > 0
|
|
148
|
-
const
|
|
194
|
+
const totalDuration = (this._due - this._start) / 1000
|
|
195
|
+
const underThreshold = this.countdown / totalDuration < progressThreshold / 100
|
|
149
196
|
|
|
150
197
|
// progress의 색상
|
|
151
198
|
context.beginPath()
|
|
@@ -156,7 +203,11 @@ export default class TactTimer extends RectPath(Shape) {
|
|
|
156
203
|
// value의 색상
|
|
157
204
|
context.beginPath()
|
|
158
205
|
|
|
159
|
-
|
|
206
|
+
if (!showProgress) {
|
|
207
|
+
return
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
var progress = Math.abs((this.countdown / totalDuration) * 100)
|
|
160
211
|
|
|
161
212
|
if (!isNaN(progress)) {
|
|
162
213
|
progress = width - (width * progress) / 100
|
|
@@ -178,6 +229,9 @@ export default class TactTimer extends RectPath(Shape) {
|
|
|
178
229
|
context.beginPath()
|
|
179
230
|
}
|
|
180
231
|
|
|
232
|
+
const image = this.getImageElement()
|
|
233
|
+
this.drawImage(context, image!, left, top, width, height)
|
|
234
|
+
|
|
181
235
|
context.roundRect(left, top, width, height, round)
|
|
182
236
|
|
|
183
237
|
this.setState('fontColor', (increase ? increaseFontColor : decreaseFontColor) || fontColor)
|
|
@@ -188,20 +242,58 @@ export default class TactTimer extends RectPath(Shape) {
|
|
|
188
242
|
this.drawText(context)
|
|
189
243
|
}
|
|
190
244
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
245
|
+
parseTime(timeString: string): Date | undefined {
|
|
246
|
+
if (!timeString || timeString.length !== 14) {
|
|
247
|
+
return undefined
|
|
248
|
+
}
|
|
249
|
+
const year = parseInt(timeString.slice(0, 4), 10)
|
|
250
|
+
const month = parseInt(timeString.slice(4, 6), 10) - 1
|
|
251
|
+
const day = parseInt(timeString.slice(6, 8), 10)
|
|
252
|
+
const hour = parseInt(timeString.slice(8, 10), 10)
|
|
253
|
+
const minute = parseInt(timeString.slice(10, 12), 10)
|
|
254
|
+
const second = parseInt(timeString.slice(12, 14), 10)
|
|
255
|
+
|
|
256
|
+
return new Date(year, month, day, hour, minute, second)
|
|
197
257
|
}
|
|
198
258
|
|
|
199
|
-
get countdown() {
|
|
259
|
+
get countdown(): number {
|
|
200
260
|
const due = this._due || 0
|
|
201
261
|
const now = Date.now()
|
|
202
262
|
|
|
203
263
|
return Math.round((due - now) / 1000)
|
|
204
264
|
}
|
|
265
|
+
|
|
266
|
+
get value() {
|
|
267
|
+
const { startTime, endTime } = this.state
|
|
268
|
+
return [startTime, endTime]
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
set value(v) {
|
|
272
|
+
if (v instanceof Array) {
|
|
273
|
+
const [startTime, endTime] = v
|
|
274
|
+
this.setState({
|
|
275
|
+
startTime,
|
|
276
|
+
endTime
|
|
277
|
+
})
|
|
278
|
+
} else if (typeof v == 'object') {
|
|
279
|
+
const { startTime, endTime } = v
|
|
280
|
+
this.setState({
|
|
281
|
+
startTime,
|
|
282
|
+
endTime
|
|
283
|
+
})
|
|
284
|
+
} else if (typeof v == 'string') {
|
|
285
|
+
const [startTime, endTime] = (v as string).split(/[-+/%$#_,]+/)
|
|
286
|
+
this.setState({
|
|
287
|
+
startTime,
|
|
288
|
+
endTime
|
|
289
|
+
})
|
|
290
|
+
} else {
|
|
291
|
+
this.setState({
|
|
292
|
+
startTime: undefined,
|
|
293
|
+
endTime: undefined
|
|
294
|
+
})
|
|
295
|
+
}
|
|
296
|
+
}
|
|
205
297
|
}
|
|
206
298
|
|
|
207
299
|
Component.register('tact-timer', TactTimer)
|
|
@@ -13,6 +13,15 @@ export default {
|
|
|
13
13
|
height: 40,
|
|
14
14
|
fontSize: 80,
|
|
15
15
|
lineWidth: 1,
|
|
16
|
-
round: 10
|
|
16
|
+
round: 10,
|
|
17
|
+
showProgress: true,
|
|
18
|
+
showTimer: true,
|
|
19
|
+
progressDirection: 'decrease',
|
|
20
|
+
increaseProgressColor: 'green',
|
|
21
|
+
decreaseProgressColor: 'red',
|
|
22
|
+
increaseFontColor: 'navy',
|
|
23
|
+
decreaseFontColor: 'orange',
|
|
24
|
+
underThresholdColor: 'yellow',
|
|
25
|
+
progressThreshold: 30
|
|
17
26
|
}
|
|
18
27
|
}
|
package/translations/en.json
CHANGED
|
@@ -8,5 +8,10 @@
|
|
|
8
8
|
"label.progress-direction": "Progress Direction",
|
|
9
9
|
"label.progress-threshold": "Progress Threshold",
|
|
10
10
|
"label.tact-time": "Tact Time",
|
|
11
|
-
"label.under-threshold-color": "Under Threshold Color"
|
|
11
|
+
"label.under-threshold-color": "Under Threshold Color",
|
|
12
|
+
"label.show-progress": "show progress",
|
|
13
|
+
"label.show-timer": "show timer",
|
|
14
|
+
"label.start-time": "start time",
|
|
15
|
+
"label.end-time": "end time",
|
|
16
|
+
"label.tact-timer-mask-color": "mask color"
|
|
12
17
|
}
|
package/translations/ja.json
CHANGED
|
@@ -8,5 +8,10 @@
|
|
|
8
8
|
"label.progress-direction": "進行方向",
|
|
9
9
|
"label.progress-threshold": "進行閾値",
|
|
10
10
|
"label.tact-time": "標準所要時間",
|
|
11
|
-
"label.under-threshold-color": "閾値以下の色"
|
|
11
|
+
"label.under-threshold-color": "閾値以下の色",
|
|
12
|
+
"label.show-progress": "進捗を表示",
|
|
13
|
+
"label.show-timer": "タイマーを表示",
|
|
14
|
+
"label.start-time": "開始時間",
|
|
15
|
+
"label.end-time": "終了時間",
|
|
16
|
+
"label.tact-timer-mask-color": "マスクの色"
|
|
12
17
|
}
|
package/translations/ko.json
CHANGED
|
@@ -8,5 +8,10 @@
|
|
|
8
8
|
"label.progress-direction": "진행 방향",
|
|
9
9
|
"label.progress-threshold": "진행 임계값",
|
|
10
10
|
"label.tact-time": "tact time",
|
|
11
|
-
"label.under-threshold-color": "임계이하 색상"
|
|
11
|
+
"label.under-threshold-color": "임계이하 색상",
|
|
12
|
+
"label.show-progress": "진행색상 보이기",
|
|
13
|
+
"label.show-timer": "타이머 보이기",
|
|
14
|
+
"label.start-time": "시작 시간",
|
|
15
|
+
"label.end-time": "완료 시간",
|
|
16
|
+
"label.tact-timer-mask-color": "마스크 색상"
|
|
12
17
|
}
|
package/translations/ms.json
CHANGED
|
@@ -8,5 +8,10 @@
|
|
|
8
8
|
"label.progress-direction": "arah kemajuan",
|
|
9
9
|
"label.progress-threshold": "ambang kemajuan",
|
|
10
10
|
"label.tact-time": "masa standard",
|
|
11
|
-
"label.under-threshold-color": "warna bawah ambang"
|
|
11
|
+
"label.under-threshold-color": "warna bawah ambang",
|
|
12
|
+
"label.show-progress": "tunjuk kemajuan",
|
|
13
|
+
"label.show-timer": "tunjuk pemasa",
|
|
14
|
+
"label.start-time": "masa mula",
|
|
15
|
+
"label.end-time": "masa tamat",
|
|
16
|
+
"label.tact-timer-mask-color": "warna topeng"
|
|
12
17
|
}
|
package/translations/zh.json
CHANGED
|
@@ -8,5 +8,10 @@
|
|
|
8
8
|
"label.progress-direction": "进度方向",
|
|
9
9
|
"label.progress-threshold": "进度阈值",
|
|
10
10
|
"label.tact-time": "标准耗时",
|
|
11
|
-
"label.under-threshold-color": "低于阈值颜色"
|
|
11
|
+
"label.under-threshold-color": "低于阈值颜色",
|
|
12
|
+
"label.show-progress": "显示进度",
|
|
13
|
+
"label.show-timer": "显示计时器",
|
|
14
|
+
"label.start-time": "开始时间",
|
|
15
|
+
"label.end-time": "完成时间",
|
|
16
|
+
"label.tact-timer-mask-color": "遮罩颜色"
|
|
12
17
|
}
|