@operato/scene-manufacturing 1.3.19 → 1.3.21
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-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 +2 -2
- package/dist/tact-timer.js +39 -26
- 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 -15
- package/logs/.5e5d741d8b7784a2fbad65eedc0fd46946aaf6f2-audit.json +30 -5
- package/logs/{application-2024-07-06-11.log → application-2024-07-11-12.log} +8 -8
- package/logs/application-2024-07-11-13.log +23 -0
- package/logs/{application-2024-07-06-03.log → application-2024-07-12-16.log} +9 -9
- 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-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/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 +2 -2
- package/{icons/tact-timer-mask.svg → src/tact-timer-mask.ts} +4 -3
- package/src/tact-timer.ts +51 -36
- package/translations/en.json +13 -11
- package/translations/ja.json +11 -9
- package/translations/ko.json +7 -5
- package/translations/ms.json +11 -9
- package/translations/zh.json +9 -7
- 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/logs/application-2024-07-06-01.log +0 -105
- 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
|
+
## [1.3.21](https://github.com/things-scene/operato-scene/compare/v1.3.20...v1.3.21) (2024-07-12)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### :bug: Bug Fix
|
|
10
|
+
|
|
11
|
+
* upgrade tact-timer ([6e73ec8](https://github.com/things-scene/operato-scene/commit/6e73ec85f2a71116a48bb33623ca0917339641c1))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## [1.3.20](https://github.com/things-scene/operato-scene/compare/v1.3.19...v1.3.20) (2024-07-11)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### :bug: Bug Fix
|
|
19
|
+
|
|
20
|
+
* make tact-timer mask color settable ([29ac68c](https://github.com/things-scene/operato-scene/commit/29ac68cd91885d001494ded3843688aad20bbc21))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
6
24
|
## [1.3.19](https://github.com/things-scene/operato-scene/compare/v1.3.18...v1.3.19) (2024-07-06)
|
|
7
25
|
|
|
8
26
|
|
package/db.sqlite
CHANGED
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const MASK: string;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export const MASK = `
|
|
2
|
+
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" viewBox="0 0 95 23">
|
|
3
|
+
<defs>
|
|
4
|
+
<style>
|
|
5
|
+
.cls-1 {
|
|
6
|
+
fill: url(#linear-gradient);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.cls-1, .cls-2 {
|
|
10
|
+
stroke-width: 0px;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.cls-2 {
|
|
14
|
+
fill: {{fillColor}};
|
|
15
|
+
}
|
|
16
|
+
</style>
|
|
17
|
+
<linearGradient id="linear-gradient" x1="47.4" y1="85.6" x2="47.4" y2="95" gradientTransform="translate(0 -74)" gradientUnits="userSpaceOnUse">
|
|
18
|
+
<stop offset="0" stop-color="#000" stop-opacity="0"/>
|
|
19
|
+
<stop offset=".9" stop-color="#000" stop-opacity=".2"/>
|
|
20
|
+
</linearGradient>
|
|
21
|
+
</defs>
|
|
22
|
+
<rect class="cls-1" x="1.4" y="11.6" width="92.1" height="9.5" rx="2.6" ry="2.6"/>
|
|
23
|
+
<path class="cls-2" d="M95,0H0v23h95V0ZM92.5,17.9c0,1.4-1.2,2.6-2.6,2.6H5.1c-1.4,0-2.6-1.2-2.6-2.6V5.1c0-1.4,1.2-2.6,2.6-2.6h84.8c1.4,0,2.6,1.2,2.6,2.6v12.8Z"/>
|
|
24
|
+
<path class="cls-2" d="M47.9,3.1c0-.6.7-.6.7-.6v-.7h-2.5v.7s.7,0,.7.6v16.7s0,.7-.7.8v.6h2.5v-.6c-.7-.1-.7-.8-.7-.8V3.1Z"/>
|
|
25
|
+
<path class="cls-2" d="M38.6,3.1c0-.6.7-.6.7-.6v-.7h-2.5v.7s.7,0,.7.6v16.7s0,.7-.7.8v.6h2.5v-.6c-.7-.1-.7-.8-.7-.8V3.1Z"/>
|
|
26
|
+
<path class="cls-2" d="M29.3,3.1c0-.6.7-.6.7-.6v-.7h-2.5v.7s.7,0,.7.6v16.7s0,.7-.7.8v.6h2.5v-.6c-.7-.1-.7-.8-.7-.8V3.1Z"/>
|
|
27
|
+
<path class="cls-2" d="M19.9,3.1c0-.6.7-.6.7-.6v-.7h-2.5v.7s.7,0,.7.6v16.7s0,.7-.7.8v.6h2.5v-.6c-.7-.1-.7-.8-.7-.8V3.1Z"/>
|
|
28
|
+
<path class="cls-2" d="M11,3.1c0-.6.7-.6.7-.6v-.7h-2.5v.7s.7,0,.7.6v16.7s0,.7-.7.8v.6h2.5v-.6c-.7-.1-.7-.8-.7-.8V3.1Z"/>
|
|
29
|
+
<path class="cls-2" d="M84.9,3.1c0-.6.7-.6.7-.6v-.7h-2.5v.7s.7,0,.7.6v16.7s0,.7-.7.8v.6h2.5v-.6c-.7-.1-.7-.8-.7-.8V3.1Z"/>
|
|
30
|
+
<path class="cls-2" d="M75.6,3.1c0-.6.7-.6.7-.6v-.7h-2.5v.7s.7,0,.7.6v16.7s0,.7-.7.8v.6h2.5v-.6c-.7-.1-.7-.8-.7-.8V3.1Z"/>
|
|
31
|
+
<path class="cls-2" d="M66.4,3.1c0-.6.7-.6.7-.6v-.7h-2.5v.7s.7,0,.7.6v16.7s0,.7-.7.8v.6h2.5v-.6c-.7-.1-.7-.8-.7-.8V3.1Z"/>
|
|
32
|
+
<path class="cls-2" d="M57.2,3.1c0-.6.7-.6.7-.6v-.7h-2.5v.7s.7,0,.7.6v16.7s0,.7-.7.8v.6h2.5v-.6c-.7-.1-.7-.8-.7-.8V3.1Z"/>
|
|
33
|
+
</svg>
|
|
34
|
+
`;
|
|
35
|
+
//# sourceMappingURL=tact-timer-mask.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tact-timer-mask.js","sourceRoot":"","sources":["../src/tact-timer-mask.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,IAAI,GAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiC3B,CAAA","sourcesContent":["export const MASK: string = `\n<svg id=\"Layer_1\" data-name=\"Layer 1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" version=\"1.1\" viewBox=\"0 0 95 23\">\n <defs>\n <style>\n .cls-1 {\n fill: url(#linear-gradient);\n }\n\n .cls-1, .cls-2 {\n stroke-width: 0px;\n }\n\n .cls-2 {\n fill: {{fillColor}};\n }\n </style>\n <linearGradient id=\"linear-gradient\" x1=\"47.4\" y1=\"85.6\" x2=\"47.4\" y2=\"95\" gradientTransform=\"translate(0 -74)\" gradientUnits=\"userSpaceOnUse\">\n <stop offset=\"0\" stop-color=\"#000\" stop-opacity=\"0\"/>\n <stop offset=\".9\" stop-color=\"#000\" stop-opacity=\".2\"/>\n </linearGradient>\n </defs>\n <rect class=\"cls-1\" x=\"1.4\" y=\"11.6\" width=\"92.1\" height=\"9.5\" rx=\"2.6\" ry=\"2.6\"/>\n <path class=\"cls-2\" d=\"M95,0H0v23h95V0ZM92.5,17.9c0,1.4-1.2,2.6-2.6,2.6H5.1c-1.4,0-2.6-1.2-2.6-2.6V5.1c0-1.4,1.2-2.6,2.6-2.6h84.8c1.4,0,2.6,1.2,2.6,2.6v12.8Z\"/>\n <path class=\"cls-2\" d=\"M47.9,3.1c0-.6.7-.6.7-.6v-.7h-2.5v.7s.7,0,.7.6v16.7s0,.7-.7.8v.6h2.5v-.6c-.7-.1-.7-.8-.7-.8V3.1Z\"/>\n <path class=\"cls-2\" d=\"M38.6,3.1c0-.6.7-.6.7-.6v-.7h-2.5v.7s.7,0,.7.6v16.7s0,.7-.7.8v.6h2.5v-.6c-.7-.1-.7-.8-.7-.8V3.1Z\"/>\n <path class=\"cls-2\" d=\"M29.3,3.1c0-.6.7-.6.7-.6v-.7h-2.5v.7s.7,0,.7.6v16.7s0,.7-.7.8v.6h2.5v-.6c-.7-.1-.7-.8-.7-.8V3.1Z\"/>\n <path class=\"cls-2\" d=\"M19.9,3.1c0-.6.7-.6.7-.6v-.7h-2.5v.7s.7,0,.7.6v16.7s0,.7-.7.8v.6h2.5v-.6c-.7-.1-.7-.8-.7-.8V3.1Z\"/>\n <path class=\"cls-2\" d=\"M11,3.1c0-.6.7-.6.7-.6v-.7h-2.5v.7s.7,0,.7.6v16.7s0,.7-.7.8v.6h2.5v-.6c-.7-.1-.7-.8-.7-.8V3.1Z\"/>\n <path class=\"cls-2\" d=\"M84.9,3.1c0-.6.7-.6.7-.6v-.7h-2.5v.7s.7,0,.7.6v16.7s0,.7-.7.8v.6h2.5v-.6c-.7-.1-.7-.8-.7-.8V3.1Z\"/>\n <path class=\"cls-2\" d=\"M75.6,3.1c0-.6.7-.6.7-.6v-.7h-2.5v.7s.7,0,.7.6v16.7s0,.7-.7.8v.6h2.5v-.6c-.7-.1-.7-.8-.7-.8V3.1Z\"/>\n <path class=\"cls-2\" d=\"M66.4,3.1c0-.6.7-.6.7-.6v-.7h-2.5v.7s.7,0,.7.6v16.7s0,.7-.7.8v.6h2.5v-.6c-.7-.1-.7-.8-.7-.8V3.1Z\"/>\n <path class=\"cls-2\" d=\"M57.2,3.1c0-.6.7-.6.7-.6v-.7h-2.5v.7s.7,0,.7.6v16.7s0,.7-.7.8v.6h2.5v-.6c-.7-.1-.7-.8-.7-.8V3.1Z\"/>\n</svg>\n`\n"]}
|
package/dist/tact-timer.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { ComponentNature, Properties, Shape } from '@hatiolab/things-scene';
|
|
2
2
|
declare const TactTimer_base: typeof Shape;
|
|
3
3
|
export default class TactTimer extends TactTimer_base {
|
|
4
|
-
static MASK: HTMLImageElement;
|
|
5
|
-
static get mask(): HTMLImageElement;
|
|
6
4
|
private _start;
|
|
7
5
|
private _due;
|
|
6
|
+
private imageElement?;
|
|
8
7
|
get nature(): ComponentNature;
|
|
9
8
|
ready(): void;
|
|
10
9
|
start(): void;
|
|
11
10
|
onchange(after: Properties): void;
|
|
11
|
+
getImageElement(): HTMLImageElement | undefined;
|
|
12
12
|
counting(): void;
|
|
13
13
|
render(context: CanvasRenderingContext2D): void;
|
|
14
14
|
postrender(context: CanvasRenderingContext2D): void;
|
package/dist/tact-timer.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Component, RectPath, Shape } from '@hatiolab/things-scene';
|
|
2
2
|
import format from './libs/format';
|
|
3
|
-
|
|
3
|
+
import { MASK } from './tact-timer-mask';
|
|
4
4
|
const NATURE = {
|
|
5
5
|
mutable: false,
|
|
6
6
|
resizable: true,
|
|
@@ -34,23 +34,28 @@ const NATURE = {
|
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
36
|
type: 'color',
|
|
37
|
-
label: '
|
|
38
|
-
name: '
|
|
37
|
+
label: 'tact-timer-mask-color',
|
|
38
|
+
name: 'maskColor'
|
|
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
|
+
},
|
|
55
|
+
{
|
|
56
|
+
type: 'color',
|
|
57
|
+
label: 'over-due-font-color',
|
|
58
|
+
name: 'overDueFontColor'
|
|
54
59
|
},
|
|
55
60
|
{
|
|
56
61
|
type: 'color',
|
|
@@ -92,13 +97,6 @@ export default class TactTimer extends RectPath(Shape) {
|
|
|
92
97
|
this._start = 0;
|
|
93
98
|
this._due = 0;
|
|
94
99
|
}
|
|
95
|
-
static get mask() {
|
|
96
|
-
if (!TactTimer.MASK) {
|
|
97
|
-
TactTimer.MASK = new Image();
|
|
98
|
-
TactTimer.MASK.src = mask;
|
|
99
|
-
}
|
|
100
|
-
return TactTimer.MASK;
|
|
101
|
-
}
|
|
102
100
|
get nature() {
|
|
103
101
|
return NATURE;
|
|
104
102
|
}
|
|
@@ -112,27 +110,41 @@ export default class TactTimer extends RectPath(Shape) {
|
|
|
112
110
|
}
|
|
113
111
|
}
|
|
114
112
|
start() {
|
|
115
|
-
const { startTime, endTime } = this.state;
|
|
113
|
+
const { startTime, endTime, hidden } = this.state;
|
|
116
114
|
const start = this.parseTime(startTime);
|
|
117
115
|
const end = this.parseTime(endTime);
|
|
118
|
-
if (start && end) {
|
|
116
|
+
if (start && end && !hidden) {
|
|
119
117
|
this._due = end.getTime();
|
|
120
118
|
this._start = start.getTime();
|
|
121
119
|
this.counting();
|
|
122
120
|
}
|
|
123
121
|
}
|
|
124
122
|
onchange(after) {
|
|
125
|
-
if ('startTime' in after || 'endTime' in after) {
|
|
123
|
+
if ('startTime' in after || 'endTime' in after || 'hidden' in after) {
|
|
126
124
|
this.start();
|
|
127
125
|
}
|
|
126
|
+
if ('maskColor' in after) {
|
|
127
|
+
delete this.imageElement;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
getImageElement() {
|
|
131
|
+
if (!this.imageElement) {
|
|
132
|
+
const { maskColor = 'black' } = this.state;
|
|
133
|
+
this.imageElement = new Image();
|
|
134
|
+
this.imageElement.src =
|
|
135
|
+
'data:image/svg+xml;charset=UTF-8;base64,' + btoa(MASK.replace(/{{fillColor}}/g, maskColor));
|
|
136
|
+
}
|
|
137
|
+
return this.imageElement;
|
|
128
138
|
}
|
|
129
139
|
counting() {
|
|
130
|
-
|
|
140
|
+
const { hidden } = this.state;
|
|
141
|
+
if (this.disposed || hidden) {
|
|
131
142
|
return;
|
|
132
143
|
}
|
|
133
144
|
requestAnimationFrame(() => {
|
|
134
|
-
const { showTimer } = this.state;
|
|
145
|
+
const { showTimer, beforeDueFontColor, overDueFontColor, fontColor } = this.state;
|
|
135
146
|
const countdown = this.countdown;
|
|
147
|
+
this.setState('fontColor', (this.countdown > 0 ? beforeDueFontColor : overDueFontColor) || fontColor);
|
|
136
148
|
if (showTimer) {
|
|
137
149
|
const text = format(Math.abs(countdown), this.getState('format'));
|
|
138
150
|
this.text = text;
|
|
@@ -147,7 +159,7 @@ export default class TactTimer extends RectPath(Shape) {
|
|
|
147
159
|
});
|
|
148
160
|
}
|
|
149
161
|
render(context) {
|
|
150
|
-
var { top, left, height, width, round = 0, fontColor,
|
|
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;
|
|
151
163
|
const increase = this.countdown > 0;
|
|
152
164
|
const totalDuration = (this._due - this._start) / 1000;
|
|
153
165
|
const underThreshold = this.countdown / totalDuration < progressThreshold / 100;
|
|
@@ -174,14 +186,15 @@ export default class TactTimer extends RectPath(Shape) {
|
|
|
174
186
|
context.fillStyle = increase
|
|
175
187
|
? underThreshold
|
|
176
188
|
? underThresholdColor
|
|
177
|
-
:
|
|
178
|
-
:
|
|
189
|
+
: beforeDueProgressColor
|
|
190
|
+
: overDueProgressColor;
|
|
179
191
|
context.fill();
|
|
180
192
|
context.beginPath();
|
|
181
193
|
}
|
|
182
|
-
this.
|
|
194
|
+
const image = this.getImageElement();
|
|
195
|
+
this.drawImage(context, image, left - 2, top - 2, width + 4, height + 4);
|
|
183
196
|
context.roundRect(left, top, width, height, round);
|
|
184
|
-
this.setState('fontColor', (increase ?
|
|
197
|
+
this.setState('fontColor', (increase ? beforeDueFontColor : overDueFontColor) || fontColor);
|
|
185
198
|
}
|
|
186
199
|
postrender(context) {
|
|
187
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;AAElC,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,8BAA8B,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAA;AAE1E,MA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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'\n\nconst mask = new URL('../icons/tact-timer-mask.svg', import.meta.url).href\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: '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 static MASK: HTMLImageElement\n\n static get mask() {\n if (!TactTimer.MASK) {\n TactTimer.MASK = new Image()\n TactTimer.MASK.src = mask\n }\n\n return TactTimer.MASK\n }\n\n private _start: number = 0\n private _due: number = 0\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 }\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 increaseFontColor,\n decreaseFontColor,\n increaseProgressColor = 'transparent',\n decreaseProgressColor = 'transparent',\n underThresholdColor = 'transparent',\n progressDirection = 'increase',\n progressThreshold = 0,\n showProgress,\n showTimer\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 this.drawImage(context, TactTimer.mask, left, top, width, height)\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;YACb,KAAK,EAAE,uBAAuB;YAC9B,IAAI,EAAE,WAAW;SAClB;QACD;YACE,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,2BAA2B;YAClC,IAAI,EAAE,wBAAwB;SAC/B;QACD;YACE,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,yBAAyB;YAChC,IAAI,EAAE,sBAAsB;SAC7B;QACD;YACE,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,uBAAuB;YAC9B,IAAI,EAAE,oBAAo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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.
|