@operato/scene-manufacturing 7.0.6 → 7.3.9
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/db.sqlite +0 -0
- package/dist/tact-timer.js +20 -18
- package/dist/tact-timer.js.map +1 -1
- package/helps/scene/component/manufacturing/tact-timer.ja.md +39 -39
- package/helps/scene/component/manufacturing/tact-timer.ko.md +8 -8
- package/helps/scene/component/manufacturing/tact-timer.md +38 -38
- package/helps/scene/component/manufacturing/tact-timer.ms.md +45 -42
- package/helps/scene/component/manufacturing/tact-timer.zh.md +45 -45
- package/logs/.08636eb59927f12972f6774f5947c8507b3564c2-audit.json +15 -0
- package/logs/.5e5d741d8b7784a2fbad65eedc0fd46946aaf6f2-audit.json +15 -5
- package/logs/application-2024-07-12-16.log +105 -0
- package/logs/application-2024-07-12-17.log +210 -0
- package/logs/application-2024-07-12-19.log +46 -0
- package/logs/connections-2024-07-12-16.log +50 -0
- package/logs/connections-2024-07-12-17.log +100 -0
- package/logs/connections-2024-07-12-19.log +94 -0
- package/package.json +3 -3
- package/src/tact-timer.ts +25 -21
- package/translations/en.json +10 -10
- package/translations/ja.json +10 -10
- package/translations/ko.json +4 -4
- package/translations/ms.json +9 -9
- package/translations/zh.json +9 -9
- package/tsconfig.tsbuildinfo +1 -1
- package/cache/translations/system/en.json +0 -1
- package/cache/translations/system/ko.json +0 -1
- package/icons/tact-timer-mask.svg +0 -37
- package/logs/connections-2024-06-27-22.log +0 -47
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,24 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [7.3.9](https://github.com/things-scene/operato-scene/compare/v7.3.8...v7.3.9) (2024-09-11)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### :bug: Bug Fix
|
|
10
|
+
|
|
11
|
+
* @hatiolab/things-scene version ([5260171](https://github.com/things-scene/operato-scene/commit/52601719115288709ca7e0eee0974cc4677f219e))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## [7.0.7](https://github.com/things-scene/operato-scene/compare/v7.0.6...v7.0.7) (2024-07-13)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### :bug: Bug Fix
|
|
19
|
+
|
|
20
|
+
* upgrade tact-timer ([b1d9521](https://github.com/things-scene/operato-scene/commit/b1d952152a8e2d5ac116d46e595a31f733af0ba4))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
6
24
|
## [7.0.6](https://github.com/things-scene/operato-scene/compare/v7.0.5...v7.0.6) (2024-07-11)
|
|
7
25
|
|
|
8
26
|
|
package/db.sqlite
CHANGED
|
Binary file
|
package/dist/tact-timer.js
CHANGED
|
@@ -39,23 +39,23 @@ const NATURE = {
|
|
|
39
39
|
},
|
|
40
40
|
{
|
|
41
41
|
type: 'color',
|
|
42
|
-
label: '
|
|
43
|
-
name: '
|
|
42
|
+
label: 'before-due-progress-color',
|
|
43
|
+
name: 'beforeDueProgressColor'
|
|
44
44
|
},
|
|
45
45
|
{
|
|
46
46
|
type: 'color',
|
|
47
|
-
label: '
|
|
48
|
-
name: '
|
|
47
|
+
label: 'over-due-progress-color',
|
|
48
|
+
name: 'overDueProgressColor'
|
|
49
49
|
},
|
|
50
50
|
{
|
|
51
51
|
type: 'color',
|
|
52
|
-
label: '
|
|
53
|
-
name: '
|
|
52
|
+
label: 'before-due-font-color',
|
|
53
|
+
name: 'beforeDueFontColor'
|
|
54
54
|
},
|
|
55
55
|
{
|
|
56
56
|
type: 'color',
|
|
57
|
-
label: '
|
|
58
|
-
name: '
|
|
57
|
+
label: 'over-due-font-color',
|
|
58
|
+
name: 'overDueFontColor'
|
|
59
59
|
},
|
|
60
60
|
{
|
|
61
61
|
type: 'color',
|
|
@@ -110,17 +110,17 @@ export default class TactTimer extends RectPath(Shape) {
|
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
start() {
|
|
113
|
-
const { startTime, endTime } = this.state;
|
|
113
|
+
const { startTime, endTime, hidden } = this.state;
|
|
114
114
|
const start = this.parseTime(startTime);
|
|
115
115
|
const end = this.parseTime(endTime);
|
|
116
|
-
if (start && end) {
|
|
116
|
+
if (start && end && !hidden) {
|
|
117
117
|
this._due = end.getTime();
|
|
118
118
|
this._start = start.getTime();
|
|
119
119
|
this.counting();
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
onchange(after) {
|
|
123
|
-
if ('startTime' in after || 'endTime' in after) {
|
|
123
|
+
if ('startTime' in after || 'endTime' in after || 'hidden' in after) {
|
|
124
124
|
this.start();
|
|
125
125
|
}
|
|
126
126
|
if ('maskColor' in after) {
|
|
@@ -137,12 +137,14 @@ export default class TactTimer extends RectPath(Shape) {
|
|
|
137
137
|
return this.imageElement;
|
|
138
138
|
}
|
|
139
139
|
counting() {
|
|
140
|
-
|
|
140
|
+
const { hidden } = this.state;
|
|
141
|
+
if (this.disposed || hidden) {
|
|
141
142
|
return;
|
|
142
143
|
}
|
|
143
144
|
requestAnimationFrame(() => {
|
|
144
|
-
const { showTimer } = this.state;
|
|
145
|
+
const { showTimer, beforeDueFontColor, overDueFontColor, fontColor } = this.state;
|
|
145
146
|
const countdown = this.countdown;
|
|
147
|
+
this.setState('fontColor', (this.countdown > 0 ? beforeDueFontColor : overDueFontColor) || fontColor);
|
|
146
148
|
if (showTimer) {
|
|
147
149
|
const text = format(Math.abs(countdown), this.getState('format'));
|
|
148
150
|
this.text = text;
|
|
@@ -157,7 +159,7 @@ export default class TactTimer extends RectPath(Shape) {
|
|
|
157
159
|
});
|
|
158
160
|
}
|
|
159
161
|
render(context) {
|
|
160
|
-
var { top, left, height, width, round = 0, fontColor, maskColor,
|
|
162
|
+
var { top, left, height, width, round = 0, fontColor, maskColor, beforeDueFontColor, overDueFontColor, beforeDueProgressColor = 'transparent', overDueProgressColor = 'transparent', underThresholdColor = 'transparent', progressDirection = 'increase', progressThreshold = 0, showProgress } = this.state;
|
|
161
163
|
const increase = this.countdown > 0;
|
|
162
164
|
const totalDuration = (this._due - this._start) / 1000;
|
|
163
165
|
const underThreshold = this.countdown / totalDuration < progressThreshold / 100;
|
|
@@ -184,15 +186,15 @@ export default class TactTimer extends RectPath(Shape) {
|
|
|
184
186
|
context.fillStyle = increase
|
|
185
187
|
? underThreshold
|
|
186
188
|
? underThresholdColor
|
|
187
|
-
:
|
|
188
|
-
:
|
|
189
|
+
: beforeDueProgressColor
|
|
190
|
+
: overDueProgressColor;
|
|
189
191
|
context.fill();
|
|
190
192
|
context.beginPath();
|
|
191
193
|
}
|
|
192
194
|
const image = this.getImageElement();
|
|
193
|
-
this.drawImage(context, image, left, top, width, height);
|
|
195
|
+
this.drawImage(context, image, left - 2, top - 2, width + 4, height + 4);
|
|
194
196
|
context.roundRect(left, top, width, height, round);
|
|
195
|
-
this.setState('fontColor', (increase ?
|
|
197
|
+
this.setState('fontColor', (increase ? beforeDueFontColor : overDueFontColor) || fontColor);
|
|
196
198
|
}
|
|
197
199
|
postrender(context) {
|
|
198
200
|
this.drawStroke(context);
|
package/dist/tact-timer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tact-timer.js","sourceRoot":"","sources":["../src/tact-timer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA+B,QAAQ,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAChG,OAAO,MAAM,MAAM,eAAe,CAAA;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAExC,MAAM,MAAM,GAAoB;IAC9B,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,UAAU,EAAE;QACV;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,YAAY;YACnB,IAAI,EAAE,WAAW;YACjB,WAAW,EAAE,gBAAgB;SAC9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CAAC,QAAQ,CAAC;gBACZ,SAAS;gBACT,OAAO;aACR,CAAC,CAAA;QACJ,CAAC;aAAM,IAAI,OAAO,CAAC,IAAI,QAAQ,EAAE,CAAC;YAChC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,CAAC,CAAA;YAChC,IAAI,CAAC,QAAQ,CAAC;gBACZ,SAAS;gBACT,OAAO;aACR,CAAC,CAAA;QACJ,CAAC;aAAM,IAAI,OAAO,CAAC,IAAI,QAAQ,EAAE,CAAC;YAChC,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,GAAI,CAAY,CAAC,KAAK,CAAC,aAAa,CAAC,CAAA;YAC/D,IAAI,CAAC,QAAQ,CAAC;gBACZ,SAAS;gBACT,OAAO;aACR,CAAC,CAAA;QACJ,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,QAAQ,CAAC;gBACZ,SAAS,EAAE,SAAS;gBACpB,OAAO,EAAE,SAAS;aACnB,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;CACF;AAED,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,SAAS,CAAC,CAAA","sourcesContent":["import { Component, ComponentNature, Properties, RectPath, Shape } from '@hatiolab/things-scene'\nimport format from './libs/format'\nimport { MASK } from './tact-timer-mask'\n\nconst NATURE: ComponentNature = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'string',\n label: 'start-time',\n name: 'startTime',\n placeholder: 'YYYYMMDDhhmmss'\n },\n {\n type: 'string',\n label: 'end-time',\n name: 'endTime',\n placeholder: 'YYYYMMDDhhmmss'\n },\n {\n type: 'string',\n label: 'format',\n name: 'format',\n placeholder: 'hh:mm:ss'\n },\n {\n type: 'select',\n label: 'progress-direction',\n name: 'progressDirection',\n property: {\n options: ['', 'increase', 'decrease']\n }\n },\n {\n type: 'color',\n label: 'tact-timer-mask-color',\n name: 'maskColor'\n },\n {\n type: 'color',\n label: 'increase-progress-color',\n name: 'increaseProgressColor'\n },\n {\n type: 'color',\n label: 'decrease-progress-color',\n name: 'decreaseProgressColor'\n },\n {\n type: 'color',\n label: 'increase-font-color',\n name: 'increaseFontColor'\n },\n {\n type: 'color',\n label: 'decrese-font-color',\n name: 'decreaseFontColor'\n },\n {\n type: 'color',\n label: 'under-threshold-color',\n name: 'underThresholdColor'\n },\n {\n type: 'number',\n label: 'progress-threshold',\n name: 'progressThreshold',\n placeholder: '%'\n },\n {\n type: 'number',\n label: 'round',\n name: 'round'\n },\n {\n type: 'boolean',\n label: 'auto-start',\n name: 'autoStart'\n },\n {\n type: 'boolean',\n label: 'show-progress',\n name: 'showProgress'\n },\n {\n type: 'boolean',\n label: 'show-timer',\n name: 'showTimer'\n }\n ],\n help: 'scene/component/manufacturing/tact-timer'\n}\n\nexport default class TactTimer extends RectPath(Shape) {\n private _start: number = 0\n private _due: number = 0\n private imageElement?: HTMLImageElement\n\n get nature() {\n return NATURE\n }\n\n ready() {\n if (!this.app.isViewMode) {\n return\n }\n\n const { autoStart } = this.state\n\n if (autoStart) {\n this.start()\n }\n }\n\n start() {\n const { startTime, endTime } = this.state\n const start = this.parseTime(startTime)\n const end = this.parseTime(endTime)\n\n if (start && end) {\n this._due = end.getTime()\n this._start = start.getTime()\n this.counting()\n }\n }\n\n onchange(after: Properties) {\n if ('startTime' in after || 'endTime' in after) {\n this.start()\n }\n if ('maskColor' in after) {\n delete this.imageElement\n }\n }\n\n getImageElement(): HTMLImageElement | undefined {\n if (!this.imageElement) {\n const { maskColor = 'black' } = this.state\n\n this.imageElement = new Image()\n this.imageElement.src =\n 'data:image/svg+xml;charset=UTF-8;base64,' + btoa(MASK.replace(/{{fillColor}}/g, maskColor))\n }\n\n return this.imageElement\n }\n\n counting() {\n if (this.disposed) {\n return\n }\n\n requestAnimationFrame(() => {\n const { showTimer } = this.state\n const countdown = this.countdown\n\n if (showTimer) {\n const text = format(Math.abs(countdown), this.getState('format'))\n this.text = text\n } else {\n this.text = ''\n }\n\n this.setState('data', this.countdown)\n\n setTimeout(() => {\n this.counting()\n }, 1000)\n })\n }\n\n render(context: CanvasRenderingContext2D) {\n var {\n top,\n left,\n height,\n width,\n round = 0,\n fontColor,\n maskColor,\n increaseFontColor,\n decreaseFontColor,\n increaseProgressColor = 'transparent',\n decreaseProgressColor = 'transparent',\n underThresholdColor = 'transparent',\n progressDirection = 'increase',\n progressThreshold = 0,\n showProgress\n } = this.state\n\n const increase = this.countdown > 0\n const totalDuration = (this._due - this._start) / 1000\n const underThreshold = this.countdown / totalDuration < progressThreshold / 100\n\n // progress의 색상\n context.beginPath()\n context.roundRect(left, top, width, height, round)\n context.clip()\n this.drawFill(context)\n\n // value의 색상\n context.beginPath()\n\n if (!showProgress) {\n return\n }\n\n var progress = Math.abs((this.countdown / totalDuration) * 100)\n\n if (!isNaN(progress)) {\n progress = width - (width * progress) / 100\n progress = Math.max(Math.min(progress, width), 0)\n\n if (progressDirection == 'increase') {\n context.rect(left, top, progress, height)\n } else {\n context.rect(left + progress, top, width - progress, height)\n }\n\n context.fillStyle = increase\n ? underThreshold\n ? underThresholdColor\n : increaseProgressColor\n : decreaseProgressColor\n context.fill()\n\n context.beginPath()\n }\n\n const image = this.getImageElement()\n this.drawImage(context, image!, left, top, width, height)\n\n context.roundRect(left, top, width, height, round)\n\n this.setState('fontColor', (increase ? increaseFontColor : decreaseFontColor) || fontColor)\n }\n\n postrender(context: CanvasRenderingContext2D) {\n this.drawStroke(context)\n this.drawText(context)\n }\n\n parseTime(timeString: string): Date | undefined {\n if (!timeString || timeString.length !== 14) {\n return undefined\n }\n const year = parseInt(timeString.slice(0, 4), 10)\n const month = parseInt(timeString.slice(4, 6), 10) - 1\n const day = parseInt(timeString.slice(6, 8), 10)\n const hour = parseInt(timeString.slice(8, 10), 10)\n const minute = parseInt(timeString.slice(10, 12), 10)\n const second = parseInt(timeString.slice(12, 14), 10)\n\n return new Date(year, month, day, hour, minute, second)\n }\n\n get countdown(): number {\n const due = this._due || 0\n const now = Date.now()\n\n return Math.round((due - now) / 1000)\n }\n\n get value() {\n const { startTime, endTime } = this.state\n return [startTime, endTime]\n }\n\n set value(v) {\n if (v instanceof Array) {\n const [startTime, endTime] = v\n this.setState({\n startTime,\n endTime\n })\n } else if (typeof v == 'object') {\n const { startTime, endTime } = v\n this.setState({\n startTime,\n endTime\n })\n } else if (typeof v == 'string') {\n const [startTime, endTime] = (v as string).split(/[-+/%$#_,]+/)\n this.setState({\n startTime,\n endTime\n })\n } else {\n this.setState({\n startTime: undefined,\n endTime: undefined\n })\n }\n }\n}\n\nComponent.register('tact-timer', TactTimer)\n"]}
|
|
1
|
+
{"version":3,"file":"tact-timer.js","sourceRoot":"","sources":["../src/tact-timer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA+B,QAAQ,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAChG,OAAO,MAAM,MAAM,eAAe,CAAA;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAExC,MAAM,MAAM,GAAoB;IAC9B,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,UAAU,EAAE;QACV;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,YAAY;YACnB,IAAI,EAAE,WAAW;YACjB,WAAW,EAAE,gBAAgB;SAC9B;QACD;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,UAAU;YACjB,IAAI,EAAE,SAAS;YACf,WAAW,EAAE,gBAAgB;SAC9B;QACD;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,QAAQ;YACf,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,UAAU;SACxB;QACD;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,oBAAoB;YAC3B,IAAI,EAAE,mBAAmB;YACzB,QAAQ,EAAE;gBACR,OAAO,EAAE,CAAC,EAAE,EAAE,UAAU,EAAE,UAAU,CAAC;aACtC;SACF;QACD;YACE,IAAI,EAAE,OAAO;YAC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T,OAAO;aACR,CAAC,CAAA;QACJ,CAAC;aAAM,IAAI,OAAO,CAAC,IAAI,QAAQ,EAAE,CAAC;YAChC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,CAAC,CAAA;YAChC,IAAI,CAAC,QAAQ,CAAC;gBACZ,SAAS;gBACT,OAAO;aACR,CAAC,CAAA;QACJ,CAAC;aAAM,IAAI,OAAO,CAAC,IAAI,QAAQ,EAAE,CAAC;YAChC,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,GAAI,CAAY,CAAC,KAAK,CAAC,aAAa,CAAC,CAAA;YAC/D,IAAI,CAAC,QAAQ,CAAC;gBACZ,SAAS;gBACT,OAAO;aACR,CAAC,CAAA;QACJ,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,QAAQ,CAAC;gBACZ,SAAS,EAAE,SAAS;gBACpB,OAAO,EAAE,SAAS;aACnB,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;CACF;AAED,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,SAAS,CAAC,CAAA","sourcesContent":["import { Component, ComponentNature, Properties, RectPath, Shape } from '@hatiolab/things-scene'\nimport format from './libs/format'\nimport { MASK } from './tact-timer-mask'\n\nconst NATURE: ComponentNature = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'string',\n label: 'start-time',\n name: 'startTime',\n placeholder: 'YYYYMMDDhhmmss'\n },\n {\n type: 'string',\n label: 'end-time',\n name: 'endTime',\n placeholder: 'YYYYMMDDhhmmss'\n },\n {\n type: 'string',\n label: 'format',\n name: 'format',\n placeholder: 'hh:mm:ss'\n },\n {\n type: 'select',\n label: 'progress-direction',\n name: 'progressDirection',\n property: {\n options: ['', 'increase', 'decrease']\n }\n },\n {\n type: 'color',\n label: 'tact-timer-mask-color',\n name: 'maskColor'\n },\n {\n type: 'color',\n label: 'before-due-progress-color',\n name: 'beforeDueProgressColor'\n },\n {\n type: 'color',\n label: 'over-due-progress-color',\n name: 'overDueProgressColor'\n },\n {\n type: 'color',\n label: 'before-due-font-color',\n name: 'beforeDueFontColor'\n },\n {\n type: 'color',\n label: 'over-due-font-color',\n name: 'overDueFontColor'\n },\n {\n type: 'color',\n label: 'under-threshold-color',\n name: 'underThresholdColor'\n },\n {\n type: 'number',\n label: 'progress-threshold',\n name: 'progressThreshold',\n placeholder: '%'\n },\n {\n type: 'number',\n label: 'round',\n name: 'round'\n },\n {\n type: 'boolean',\n label: 'auto-start',\n name: 'autoStart'\n },\n {\n type: 'boolean',\n label: 'show-progress',\n name: 'showProgress'\n },\n {\n type: 'boolean',\n label: 'show-timer',\n name: 'showTimer'\n }\n ],\n help: 'scene/component/manufacturing/tact-timer'\n}\n\nexport default class TactTimer extends RectPath(Shape) {\n private _start: number = 0\n private _due: number = 0\n private imageElement?: HTMLImageElement\n\n get nature() {\n return NATURE\n }\n\n ready() {\n if (!this.app.isViewMode) {\n return\n }\n\n const { autoStart } = this.state\n\n if (autoStart) {\n this.start()\n }\n }\n\n start() {\n const { startTime, endTime, hidden } = this.state\n const start = this.parseTime(startTime)\n const end = this.parseTime(endTime)\n\n if (start && end && !hidden) {\n this._due = end.getTime()\n this._start = start.getTime()\n this.counting()\n }\n }\n\n onchange(after: Properties) {\n if ('startTime' in after || 'endTime' in after || 'hidden' in after) {\n this.start()\n }\n\n if ('maskColor' in after) {\n delete this.imageElement\n }\n }\n\n getImageElement(): HTMLImageElement | undefined {\n if (!this.imageElement) {\n const { maskColor = 'black' } = this.state\n\n this.imageElement = new Image()\n this.imageElement.src =\n 'data:image/svg+xml;charset=UTF-8;base64,' + btoa(MASK.replace(/{{fillColor}}/g, maskColor))\n }\n\n return this.imageElement\n }\n\n counting() {\n const { hidden } = this.state\n if (this.disposed || hidden) {\n return\n }\n\n requestAnimationFrame(() => {\n const { showTimer, beforeDueFontColor, overDueFontColor, fontColor } = this.state\n const countdown = this.countdown\n\n this.setState('fontColor', (this.countdown > 0 ? beforeDueFontColor : overDueFontColor) || fontColor)\n\n if (showTimer) {\n const text = format(Math.abs(countdown), this.getState('format'))\n this.text = text\n } else {\n this.text = ''\n }\n\n this.setState('data', this.countdown)\n\n setTimeout(() => {\n this.counting()\n }, 1000)\n })\n }\n\n render(context: CanvasRenderingContext2D) {\n var {\n top,\n left,\n height,\n width,\n round = 0,\n fontColor,\n maskColor,\n beforeDueFontColor,\n overDueFontColor,\n beforeDueProgressColor = 'transparent',\n overDueProgressColor = 'transparent',\n underThresholdColor = 'transparent',\n progressDirection = 'increase',\n progressThreshold = 0,\n showProgress\n } = this.state\n\n const increase = this.countdown > 0\n const totalDuration = (this._due - this._start) / 1000\n const underThreshold = this.countdown / totalDuration < progressThreshold / 100\n\n // progress의 색상\n context.beginPath()\n context.roundRect(left, top, width, height, round)\n context.clip()\n this.drawFill(context)\n\n // value의 색상\n context.beginPath()\n\n if (!showProgress) {\n return\n }\n\n var progress = Math.abs((this.countdown / totalDuration) * 100)\n\n if (!isNaN(progress)) {\n progress = width - (width * progress) / 100\n progress = Math.max(Math.min(progress, width), 0)\n\n if (progressDirection == 'increase') {\n context.rect(left, top, progress, height)\n } else {\n context.rect(left + progress, top, width - progress, height)\n }\n\n context.fillStyle = increase\n ? underThreshold\n ? underThresholdColor\n : beforeDueProgressColor\n : overDueProgressColor\n context.fill()\n\n context.beginPath()\n }\n\n const image = this.getImageElement()\n this.drawImage(context, image!, left - 2, top - 2, width + 4, height + 4)\n\n context.roundRect(left, top, width, height, round)\n\n this.setState('fontColor', (increase ? beforeDueFontColor : overDueFontColor) || fontColor)\n }\n\n postrender(context: CanvasRenderingContext2D) {\n this.drawStroke(context)\n this.drawText(context)\n }\n\n parseTime(timeString: string): Date | undefined {\n if (!timeString || timeString.length !== 14) {\n return undefined\n }\n const year = parseInt(timeString.slice(0, 4), 10)\n const month = parseInt(timeString.slice(4, 6), 10) - 1\n const day = parseInt(timeString.slice(6, 8), 10)\n const hour = parseInt(timeString.slice(8, 10), 10)\n const minute = parseInt(timeString.slice(10, 12), 10)\n const second = parseInt(timeString.slice(12, 14), 10)\n\n return new Date(year, month, day, hour, minute, second)\n }\n\n get countdown(): number {\n const due = this._due || 0\n const now = Date.now()\n\n return Math.round((due - now) / 1000)\n }\n\n get value() {\n const { startTime, endTime } = this.state\n return [startTime, endTime]\n }\n\n set value(v) {\n if (v instanceof Array) {\n const [startTime, endTime] = v\n this.setState({\n startTime,\n endTime\n })\n } else if (typeof v == 'object') {\n const { startTime, endTime } = v\n this.setState({\n startTime,\n endTime\n })\n } else if (typeof v == 'string') {\n const [startTime, endTime] = (v as string).split(/[-+/%$#_,]+/)\n this.setState({\n startTime,\n endTime\n })\n } else {\n this.setState({\n startTime: undefined,\n endTime: undefined\n })\n }\n }\n}\n\nComponent.register('tact-timer', TactTimer)\n"]}
|
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
|
|
1
|
+
# Tact Timer
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
"Tact Timer"は、生産ラインや工程で使用される時間管理ツールで、特定の作業や活動に割り当てられた時間を設定および管理するために使用されます。このツールは開始時間と終了時間に基づいてリアルタイムで経過時間を計算および監視し、プログレスバーとカウントダウンテキストを表示してユーザーに現在の進行状況を視覚的に表現します。これにより、生産プロセスを効率的に管理し、生産量を最適化するのに役立ちます。
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## properties
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- 開始時間(startTime)
|
|
8
8
|
- 作業の開始時間を設定します。
|
|
9
|
-
-
|
|
10
|
-
-
|
|
9
|
+
- フォーマット: 'YYYYMMDDhhmmss'
|
|
10
|
+
- 終了時間(endTime)
|
|
11
11
|
- 作業の終了時間を設定します。
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
- 'increase'
|
|
19
|
-
- 'decrease'
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
12
|
+
- フォーマット: 'YYYYMMDDhhmmss'
|
|
13
|
+
- カウントダウンフォーマット(format)
|
|
14
|
+
- フォーマット: 'hh:mm:ss'
|
|
15
|
+
- カウントダウン結果の表示フォーマット
|
|
16
|
+
- 進行方向(progressDirection)
|
|
17
|
+
- プログレスバーの進行方向を設定します。
|
|
18
|
+
- 'increase': 増加する方向
|
|
19
|
+
- 'decrease': 減少する方向
|
|
20
|
+
- 期限前進行色(beforeDueProgressColor)
|
|
21
|
+
- 期限前の進行色
|
|
22
|
+
- 期限後進行色(overDueProgressColor)
|
|
23
|
+
- 期限後の進行色
|
|
24
|
+
- 期限前フォント色(beforeDueFontColor)
|
|
25
|
+
- 期限前のフォント色
|
|
26
|
+
- 期限後フォント色(overDueFontColor)
|
|
27
|
+
- 期限後のフォント色
|
|
28
|
+
- 進行しきい値(progressThreshold)
|
|
29
|
+
- 警告しきい値(%)。進行状況がしきい値以下の場合、しきい値以下の色が使用されます
|
|
30
|
+
- しきい値以下の色(underThresholdColor)
|
|
31
|
+
- しきい値以下の場合の進行色
|
|
32
|
+
- 自動開始(autoStart)
|
|
33
|
+
- カウントダウンを自動的に開始します。
|
|
34
|
+
- 丸くする(round)
|
|
35
|
+
- コンポーネントの四角の四隅の丸みの半径サイズ
|
|
36
36
|
- 進行色を表示(showProgress)
|
|
37
|
-
-
|
|
37
|
+
- 背景色で進行状況を表示します。
|
|
38
38
|
- タイマーを表示(showTimer)
|
|
39
|
-
-
|
|
39
|
+
- 残り時間または経過時間をテキストで表示します。
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
## data
|
|
42
42
|
|
|
43
|
-
-
|
|
43
|
+
- 設定された開始時間と終了時間に基づいて、毎秒現在の残り時間が更新されます。
|
|
44
44
|
- タイマーは設定された終了時間を基準に 0 までカウントダウンされます。
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
## value
|
|
47
47
|
|
|
48
|
-
`value
|
|
48
|
+
`value`プロパティは`startTime`と`endTime`をさまざまな形式で設定するために使用でき、複数の特殊文字を使用して時間を区切ることができます:
|
|
49
49
|
|
|
50
|
-
-
|
|
50
|
+
- 配列として設定: `['YYYYMMDDhhmmss', 'YYYYMMDDhhmmss']`
|
|
51
51
|
|
|
52
52
|
```javascript
|
|
53
53
|
component.value = ['20240101000000', '20240101235959']
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
-
-
|
|
56
|
+
- オブジェクトとして設定:
|
|
57
57
|
|
|
58
58
|
```javascript
|
|
59
59
|
component.value = { startTime: '20240101000000', endTime: '20240101235959' }
|
|
60
60
|
```
|
|
61
61
|
|
|
62
|
-
-
|
|
62
|
+
- 特殊文字を含む文字列として設定:
|
|
63
63
|
- 使用可能な特殊文字: `-`, `/`, `%`, `$`, `#`, `_`, `,`
|
|
64
64
|
```javascript
|
|
65
65
|
component.value = '20240101000000-20240101235959'
|
|
@@ -17,14 +17,14 @@
|
|
|
17
17
|
- 프로그레스 바의 진행 방향을 설정합니다.
|
|
18
18
|
- 'increase': 증가하는 방향으로 진행
|
|
19
19
|
- 'decrease': 감소하는 방향으로 진행
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
20
|
+
- 만기 이전 진행 색상(beforeDueProgressColor)
|
|
21
|
+
- 만기 이전의 진행 색상
|
|
22
|
+
- 만기 이후 진행 색상(overDueProgressColor)
|
|
23
|
+
- 만기 이후의 진행 색상
|
|
24
|
+
- 만기 이전 폰트 색상(beforeDueFontColor)
|
|
25
|
+
- 만기 이전의 폰트 색상
|
|
26
|
+
- 만기 이후 폰트 색상(overDueFontColor)
|
|
27
|
+
- 만기 이후의 폰트 색상
|
|
28
28
|
- 진행 임계값(progressThreshold)
|
|
29
29
|
- 경고 임계값(%). 진행 상황이 임계값 이하인 경우 임계 이하 색상이 사용됨
|
|
30
30
|
- 임계 이하 색상(underThresholdColor)
|
|
@@ -1,66 +1,66 @@
|
|
|
1
|
-
|
|
1
|
+
# Tact Timer
|
|
2
2
|
|
|
3
|
-
"Tact Timer" is a time management tool used in production lines or processes
|
|
3
|
+
"Tact Timer" is a time management tool used in production lines or processes to set and manage the time allocated to specific tasks or activities. This tool calculates and monitors elapsed time in real-time based on the start and end times and displays the current progress visually to the user using a progress bar and countdown text. This helps manage the production process efficiently and optimize output.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## properties
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- start time(startTime)
|
|
8
8
|
- Sets the start time of the task.
|
|
9
9
|
- Format: 'YYYYMMDDhhmmss'
|
|
10
|
-
-
|
|
10
|
+
- end time(endTime)
|
|
11
11
|
- Sets the end time of the task.
|
|
12
12
|
- Format: 'YYYYMMDDhhmmss'
|
|
13
|
-
-
|
|
13
|
+
- countdown format(format)
|
|
14
14
|
- Format: 'hh:mm:ss'
|
|
15
15
|
- Format for displaying the countdown result
|
|
16
|
-
-
|
|
17
|
-
- Sets the direction of
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
- Font color
|
|
26
|
-
-
|
|
27
|
-
- Font color
|
|
28
|
-
-
|
|
29
|
-
- Warning threshold
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
-
-
|
|
16
|
+
- progress direction(progressDirection)
|
|
17
|
+
- Sets the direction of the progress bar.
|
|
18
|
+
- 'increase': Progress increases
|
|
19
|
+
- 'decrease': Progress decreases
|
|
20
|
+
- before due progress color(beforeDueProgressColor)
|
|
21
|
+
- Progress color before due
|
|
22
|
+
- over due progress color(overDueProgressColor)
|
|
23
|
+
- Progress color after due
|
|
24
|
+
- before due font color(beforeDueFontColor)
|
|
25
|
+
- Font color before due
|
|
26
|
+
- over due font color(overDueFontColor)
|
|
27
|
+
- Font color after due
|
|
28
|
+
- progress threshold(progressThreshold)
|
|
29
|
+
- Warning threshold(%). Under threshold color is used when progress is below the threshold
|
|
30
|
+
- under threshold color(underThresholdColor)
|
|
31
|
+
- Progress color when below threshold
|
|
32
|
+
- auto start(autoStart)
|
|
33
33
|
- Automatically starts the countdown
|
|
34
|
-
-
|
|
35
|
-
- Radius size of the rounded
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
-
|
|
34
|
+
- round(round)
|
|
35
|
+
- Radius size of the rounded corners of the component's rectangular area
|
|
36
|
+
- show progress color(showProgress)
|
|
37
|
+
- Displays the progress as a background color
|
|
38
|
+
- show timer(showTimer)
|
|
39
|
+
- Displays the remaining or elapsed time as text
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
## data
|
|
42
42
|
|
|
43
|
-
- The
|
|
43
|
+
- The remaining time is updated every second based on the set start and end times.
|
|
44
44
|
- The timer counts down to 0 based on the set end time.
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
## value
|
|
47
47
|
|
|
48
|
-
The `value`
|
|
48
|
+
The `value` attribute can be used to set `startTime` and `endTime` in various formats, and can use various special characters to separate the times:
|
|
49
49
|
|
|
50
|
-
-
|
|
50
|
+
- Set as an array: `['YYYYMMDDhhmmss', 'YYYYMMDDhhmmss']`
|
|
51
51
|
|
|
52
52
|
```javascript
|
|
53
53
|
component.value = ['20240101000000', '20240101235959']
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
-
-
|
|
56
|
+
- Set as an object:
|
|
57
57
|
|
|
58
58
|
```javascript
|
|
59
59
|
component.value = { startTime: '20240101000000', endTime: '20240101235959' }
|
|
60
60
|
```
|
|
61
61
|
|
|
62
|
-
-
|
|
63
|
-
-
|
|
62
|
+
- Set as a string with special characters:
|
|
63
|
+
- Available special characters: `-`, `/`, `%`, `$`, `#`, `_`, `,`
|
|
64
64
|
```javascript
|
|
65
65
|
component.value = '20240101000000-20240101235959'
|
|
66
66
|
component.value = '20240101000000/20240101235959'
|
|
@@ -71,4 +71,4 @@ The `value` property can be used to set the `startTime` and `endTime` in differe
|
|
|
71
71
|
component.value = '20240101000000,20240101235959'
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
-
In all cases, the component
|
|
74
|
+
In all cases, the component parses the provided `startTime` and `endTime` and updates its state accordingly.
|
|
@@ -1,66 +1,69 @@
|
|
|
1
|
-
|
|
1
|
+
# Tact Timer
|
|
2
2
|
|
|
3
|
-
"Tact Timer" adalah alat pengurusan masa yang digunakan dalam barisan pengeluaran atau proses
|
|
3
|
+
"Tact Timer" adalah alat pengurusan masa yang digunakan dalam barisan pengeluaran atau proses untuk menetapkan dan menguruskan masa yang diperuntukkan untuk tugas atau aktiviti tertentu. Alat ini berdasarkan masa mula dan masa tamat untuk mengira dan memantau masa yang telah berlalu secara masa nyata, serta memaparkan bar kemajuan dan teks kiraan masa untuk memberikan gambaran visual tentang kemajuan semasa kepada pengguna. Ini membantu dalam menguruskan proses pengeluaran dengan cekap dan mengoptimumkan hasil pengeluaran.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## properties
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
7
|
+
- masa mula(startTime)
|
|
8
|
+
- Tetapkan masa mula tugas.
|
|
9
9
|
- Format: 'YYYYMMDDhhmmss'
|
|
10
|
-
-
|
|
11
|
-
-
|
|
10
|
+
- masa tamat(endTime)
|
|
11
|
+
- Tetapkan masa tamat tugas.
|
|
12
12
|
- Format: 'YYYYMMDDhhmmss'
|
|
13
|
-
-
|
|
13
|
+
- format kiraan masa(format)
|
|
14
14
|
- Format: 'hh:mm:ss'
|
|
15
|
-
- Format paparan hasil kiraan
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
- Warna kemajuan
|
|
22
|
-
-
|
|
23
|
-
- Warna kemajuan
|
|
24
|
-
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
-
|
|
29
|
-
|
|
30
|
-
- Warna
|
|
15
|
+
- Format paparan hasil kiraan masa
|
|
16
|
+
- arah kemajuan(progressDirection)
|
|
17
|
+
- Tetapkan arah kemajuan bar kemajuan.
|
|
18
|
+
- 'increase': Kemajuan meningkat
|
|
19
|
+
- 'decrease': Kemajuan menurun
|
|
20
|
+
- warna kemajuan sebelum tarikh akhir(beforeDueProgressColor)
|
|
21
|
+
- Warna kemajuan sebelum tarikh akhir
|
|
22
|
+
- warna kemajuan selepas tarikh akhir(overDueProgressColor)
|
|
23
|
+
- Warna kemajuan selepas tarikh akhir
|
|
24
|
+
- warna fon sebelum tarikh akhir(beforeDueFont
|
|
25
|
+
|
|
26
|
+
Color)
|
|
27
|
+
|
|
28
|
+
- Warna fon sebelum tarikh akhir
|
|
29
|
+
- warna fon selepas tarikh akhir(overDueFontColor)
|
|
30
|
+
- Warna fon selepas tarikh akhir
|
|
31
|
+
- ambang kemajuan(progressThreshold)
|
|
32
|
+
- Ambang amaran(%). Warna di bawah ambang digunakan jika kemajuan di bawah ambang
|
|
33
|
+
- warna di bawah ambang(underThresholdColor)
|
|
31
34
|
- Warna kemajuan di bawah ambang
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
- Saiz jejari
|
|
36
|
-
-
|
|
37
|
-
- Menunjukkan kemajuan
|
|
38
|
-
-
|
|
39
|
-
-
|
|
35
|
+
- mula automatik(autoStart)
|
|
36
|
+
- Memulakan kiraan masa secara automatik
|
|
37
|
+
- bulat(round)
|
|
38
|
+
- Saiz jejari bulat bagi keempat-empat sudut kawasan segi empat komponen
|
|
39
|
+
- tunjukkan warna kemajuan(showProgress)
|
|
40
|
+
- Menunjukkan tahap kemajuan dengan warna latar belakang
|
|
41
|
+
- tunjukkan pemasa(showTimer)
|
|
42
|
+
- Memaparkan masa yang tinggal atau masa yang telah berlalu dalam teks
|
|
40
43
|
|
|
41
|
-
|
|
44
|
+
## data
|
|
42
45
|
|
|
43
|
-
-
|
|
44
|
-
- Pemasa
|
|
46
|
+
- Masa yang tinggal dikemas kini setiap saat berdasarkan masa mula dan masa tamat yang ditetapkan.
|
|
47
|
+
- Pemasa mengira masa sehingga 0 berdasarkan masa tamat yang ditetapkan.
|
|
45
48
|
|
|
46
|
-
|
|
49
|
+
## value
|
|
47
50
|
|
|
48
|
-
|
|
51
|
+
Harta `value` boleh digunakan untuk menetapkan `startTime` dan `endTime` dalam pelbagai format, dan boleh menggunakan pelbagai aksara khas untuk memisahkan masa:
|
|
49
52
|
|
|
50
|
-
-
|
|
53
|
+
- Tetapkan sebagai array: `['YYYYMMDDhhmmss', 'YYYYMMDDhhmmss']`
|
|
51
54
|
|
|
52
55
|
```javascript
|
|
53
56
|
component.value = ['20240101000000', '20240101235959']
|
|
54
57
|
```
|
|
55
58
|
|
|
56
|
-
-
|
|
59
|
+
- Tetapkan sebagai objek:
|
|
57
60
|
|
|
58
61
|
```javascript
|
|
59
62
|
component.value = { startTime: '20240101000000', endTime: '20240101235959' }
|
|
60
63
|
```
|
|
61
64
|
|
|
62
|
-
-
|
|
63
|
-
-
|
|
65
|
+
- Tetapkan sebagai rentetan yang mengandungi aksara khas:
|
|
66
|
+
- Aksara khas yang boleh digunakan: `-`, `/`, `%`, `$`, `#`, `_`, `,`
|
|
64
67
|
```javascript
|
|
65
68
|
component.value = '20240101000000-20240101235959'
|
|
66
69
|
component.value = '20240101000000/20240101235959'
|
|
@@ -71,4 +74,4 @@ Property `value` boleh digunakan untuk menetapkan `startTime` dan `endTime` dala
|
|
|
71
74
|
component.value = '20240101000000,20240101235959'
|
|
72
75
|
```
|
|
73
76
|
|
|
74
|
-
Dalam semua kes, komponen akan mengurai `startTime` dan `endTime` yang
|
|
77
|
+
Dalam semua kes, komponen akan mengurai `startTime` dan `endTime` yang disediakan dan mengemas kini status mengikut keadaan.
|