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