@operato/scene-manufacturing 7.3.17 → 7.3.19
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/package.json +2 -2
- package/CHANGELOG.md +0 -205
- package/src/index.ts +0 -1
- package/src/libs/format.ts +0 -47
- package/src/tact-timer-mask.ts +0 -34
- package/src/tact-timer.ts +0 -322
- package/src/templates/index.ts +0 -3
- package/src/templates/tact-timer.ts +0 -27
- package/tsconfig.json +0 -22
- package/tsconfig.tsbuildinfo +0 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@operato/scene-manufacturing",
|
|
3
3
|
"description": "Things scene components for manufacturing industry",
|
|
4
|
-
"version": "7.3.
|
|
4
|
+
"version": "7.3.19",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"things-scene": true,
|
|
7
7
|
"author": "heartyoh",
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"prettier --write"
|
|
58
58
|
]
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "ff73072a62ee02520f9d986d0095f6d329de64f9"
|
|
61
61
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
# Change Log
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
-
|
|
6
|
-
## [7.3.17](https://github.com/things-scene/operato-scene/compare/v7.3.16...v7.3.17) (2024-12-20)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
### :bug: Bug Fix
|
|
10
|
-
|
|
11
|
-
* set started automatically when autostart is set on starting time ([f5e8b17](https://github.com/things-scene/operato-scene/commit/f5e8b17250d0e810fbb4c3ef7686ea11e264c067))
|
|
12
|
-
* typo tact-timer ([0917c8c](https://github.com/things-scene/operato-scene/commit/0917c8c32d6b5ca5c1512d339b12332492a46d9b))
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
## [7.3.16](https://github.com/things-scene/operato-scene/compare/v7.3.15...v7.3.16) (2024-10-12)
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
### :bug: Bug Fix
|
|
20
|
-
|
|
21
|
-
* support started property for tact-timer ([9241954](https://github.com/things-scene/operato-scene/commit/92419544454015531c94c3c3566bb94e2066a827))
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
## [7.3.9](https://github.com/things-scene/operato-scene/compare/v7.3.8...v7.3.9) (2024-09-11)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
### :bug: Bug Fix
|
|
29
|
-
|
|
30
|
-
* @hatiolab/things-scene version ([5260171](https://github.com/things-scene/operato-scene/commit/52601719115288709ca7e0eee0974cc4677f219e))
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
## [7.0.7](https://github.com/things-scene/operato-scene/compare/v7.0.6...v7.0.7) (2024-07-13)
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
### :bug: Bug Fix
|
|
38
|
-
|
|
39
|
-
* upgrade tact-timer ([b1d9521](https://github.com/things-scene/operato-scene/commit/b1d952152a8e2d5ac116d46e595a31f733af0ba4))
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
## [7.0.6](https://github.com/things-scene/operato-scene/compare/v7.0.5...v7.0.6) (2024-07-11)
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
### :bug: Bug Fix
|
|
47
|
-
|
|
48
|
-
* make tact-timer mask color settable ([a59cf40](https://github.com/things-scene/operato-scene/commit/a59cf408706de9087212a6aa21333c1aa1c874f3))
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
## [7.0.4](https://github.com/things-scene/operato-scene/compare/v7.0.3...v7.0.4) (2024-07-08)
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
### :bug: Bug Fix
|
|
56
|
-
|
|
57
|
-
* support startTime, endTime, showProgress, showTimer and mask image for tact-timer ([dc7557e](https://github.com/things-scene/operato-scene/commit/dc7557eed23744b922b65ccbba4ea276f13545b5))
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
## [7.0.3](https://github.com/things-scene/operato-scene/compare/v7.0.2...v7.0.3) (2024-07-05)
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
### :bug: Bug Fix
|
|
65
|
-
|
|
66
|
-
* missing component icons ([371d826](https://github.com/things-scene/operato-scene/commit/371d826cd905485d787d45a9a77b1a4cd28a52d7))
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
## [7.0.1](https://github.com/things-scene/operato-scene/compare/v7.0.0...v7.0.1) (2024-06-30)
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
### :bug: Bug Fix
|
|
74
|
-
|
|
75
|
-
* things-factory@7.0.0 ([f4cfe44](https://github.com/things-scene/operato-scene/commit/f4cfe44cb565e7b8fdc0df210a722b6526871848))
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
## [7.0.0](https://github.com/things-scene/operato-scene/compare/v7.0.0-rc.4...v7.0.0) (2024-06-30)
|
|
80
|
-
|
|
81
|
-
**Note:** Version bump only for package @operato/scene-manufacturing
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
## [7.0.0-rc.3](https://github.com/things-scene/operato-scene/compare/v7.0.0-rc.2...v7.0.0-rc.3) (2024-06-28)
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
### :bug: Bug Fix
|
|
91
|
-
|
|
92
|
-
* remove minus limit from tact-timer ([dc7d2d0](https://github.com/things-scene/operato-scene/commit/dc7d2d012cff03e5bc462fe2f01780b280927e48))
|
|
93
|
-
* setting value-format for chart series ([c77c295](https://github.com/things-scene/operato-scene/commit/c77c295946b01828ab3b37c0c0739f12ea42d63a))
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
## [7.0.0-rc.1](https://github.com/things-scene/operato-scene/compare/v7.0.0-rc.0...v7.0.0-rc.1) (2024-06-21)
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
### :bug: Bug Fix
|
|
101
|
-
|
|
102
|
-
* apply v7-rc dependencies ([eee5612](https://github.com/things-scene/operato-scene/commit/eee5612e1d569387c284a7c6c49d64ef44b6d701))
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
## [7.0.0-rc.0](https://github.com/things-scene/operato-scene/compare/v2.0.0-beta.8...v7.0.0-rc.0) (2024-06-21)
|
|
107
|
-
|
|
108
|
-
**Note:** Version bump only for package @operato/scene-manufacturing
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
## [2.0.0-beta.0](https://github.com/things-scene/operato-scene/compare/v2.0.0-alpha.12...v2.0.0-beta.0) (2024-06-01)
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
### :rocket: New Features
|
|
118
|
-
|
|
119
|
-
* 2.0.0-beta.0 ([a2e2869](https://github.com/things-scene/operato-scene/commit/a2e28694eedf5bab0c54bcab5432d54ec59edd7f))
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
### :bug: Bug Fix
|
|
123
|
-
|
|
124
|
-
* allowJs in tsconfig option ([fa77174](https://github.com/things-scene/operato-scene/commit/fa771742188f21f177f0a85281570f59f0c478cf))
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
## [2.0.0-alpha.9](https://github.com/things-scene/operato-scene/compare/v2.0.0-alpha.8...v2.0.0-alpha.9) (2024-04-11)
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
### :bug: Bug Fix
|
|
132
|
-
|
|
133
|
-
* things-factory@7.0.1 ([a9f4c18](https://github.com/things-scene/operato-scene/commit/a9f4c1873b80c540e4c2e16649e127ccffcf9a4c))
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
## [2.0.0-alpha.6](https://github.com/things-scene/operato-scene/compare/v2.0.0-alpha.5...v2.0.0-alpha.6) (2024-03-24)
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
### :bug: Bug Fix
|
|
141
|
-
|
|
142
|
-
* translation ([266d423](https://github.com/things-scene/operato-scene/commit/266d423d9d6992464f45a437acc90ccf8ed33bf6))
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
## [2.0.0-alpha.5](https://github.com/things-scene/operato-scene/compare/v2.0.0-alpha.4...v2.0.0-alpha.5) (2024-03-21)
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
### :bug: Bug Fix
|
|
150
|
-
|
|
151
|
-
* 컴포넌트 명 다국어 ([fbc26d9](https://github.com/things-scene/operato-scene/commit/fbc26d9fb24e858541598ba55e2b8d33f2df8d8a))
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
## [2.0.0-alpha.4](https://github.com/things-scene/operato-scene/compare/v2.0.0-alpha.3...v2.0.0-alpha.4) (2024-03-21)
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
### :bug: Bug Fix
|
|
159
|
-
|
|
160
|
-
* 컴포넌트 명 다국어 ([64e1f08](https://github.com/things-scene/operato-scene/commit/64e1f08af32d2ac193c3d31b0025f8d06f569ca4))
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
## [2.0.0-alpha.0](https://github.com/things-scene/operato-scene/compare/v1.3.9...v2.0.0-alpha.0) (2024-01-14)
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
### :bug: Bug Fix
|
|
168
|
-
|
|
169
|
-
* 2.0.0-alpha.0 ([93274e3](https://github.com/things-scene/operato-scene/commit/93274e36c5d184f339f83899654dd48b4786ac2b))
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
## [1.3.4](https://github.com/things-scene/operato-scene/compare/v1.3.3...v1.3.4) (2023-12-04)
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
### :bug: Bug Fix
|
|
177
|
-
|
|
178
|
-
* remove ignored files ([412acb0](https://github.com/things-scene/operato-scene/commit/412acb035e727fb6ee10cbcae85a06ed961d115e))
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
## [1.3.3](https://github.com/things-scene/operato-scene/compare/v1.3.2...v1.3.3) (2023-12-02)
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
### :bug: Bug Fix
|
|
186
|
-
|
|
187
|
-
* tact-timer missing parameter ([be02dce](https://github.com/things-scene/operato-scene/commit/be02dce0dc06802abd2be02840f3f2e80539296f))
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
## [1.3.1](https://github.com/things-scene/operato-scene/compare/v1.3.0...v1.3.1) (2023-12-01)
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
### :bug: Bug Fix
|
|
195
|
-
|
|
196
|
-
* complete tact-timer in manufacturing module ([7b569d9](https://github.com/things-scene/operato-scene/commit/7b569d9c98e2732791b4cbd07166896c6e4df440))
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
## [1.3.0](https://github.com/things-scene/operato-scene/compare/v1.2.91...v1.3.0) (2023-11-30)
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
### :rocket: New Features
|
|
204
|
-
|
|
205
|
-
* add manufacturing module ([55cdb2d](https://github.com/things-scene/operato-scene/commit/55cdb2d13018c71cdf825efba0647757bd79e3ee))
|
package/src/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as TactTimer } from './tact-timer'
|
package/src/libs/format.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 문자열 길이를 늘려주는 함수
|
|
3
|
-
*
|
|
4
|
-
* @param {String} i
|
|
5
|
-
* @param {Number} len
|
|
6
|
-
*/
|
|
7
|
-
function ii(i: string, len?: number) {
|
|
8
|
-
var s = i
|
|
9
|
-
len = len || 2
|
|
10
|
-
while (s.length < len) s = '0' + s
|
|
11
|
-
return s
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* 시간 표시 포맷을 맞추는 함수
|
|
16
|
-
*
|
|
17
|
-
* @param {Number} seconds seconds
|
|
18
|
-
* @param {string} timeFormat hh:mm:ss
|
|
19
|
-
*/
|
|
20
|
-
export default function formatTime(seconds = 0, timeFormat = '') {
|
|
21
|
-
var h = 0,
|
|
22
|
-
m = 0,
|
|
23
|
-
s = 0
|
|
24
|
-
var formatted = ''
|
|
25
|
-
|
|
26
|
-
h = Math.floor(seconds / 3600)
|
|
27
|
-
formatted = timeFormat.replace(/(^|[^\\])hh+/g, '$1' + ii(h.toString()))
|
|
28
|
-
formatted = formatted.replace(/(^|[^\\])h/g, '$1' + h)
|
|
29
|
-
if (timeFormat !== formatted) {
|
|
30
|
-
timeFormat = formatted
|
|
31
|
-
seconds %= 3600
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
m = Math.floor(seconds / 60)
|
|
35
|
-
formatted = timeFormat.replace(/(^|[^\\])mm+/g, '$1' + ii(m.toString()))
|
|
36
|
-
formatted = formatted.replace(/(^|[^\\])m/g, '$1' + m)
|
|
37
|
-
if (timeFormat !== formatted) {
|
|
38
|
-
timeFormat = formatted
|
|
39
|
-
seconds %= 60
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
s = seconds
|
|
43
|
-
formatted = timeFormat.replace(/(^|[^\\])ss+/g, '$1' + ii(s.toString()))
|
|
44
|
-
formatted = formatted.replace(/(^|[^\\])s/g, '$1' + s)
|
|
45
|
-
|
|
46
|
-
return formatted
|
|
47
|
-
}
|
package/src/tact-timer-mask.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export const MASK: string = `
|
|
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
|
-
`
|
package/src/tact-timer.ts
DELETED
|
@@ -1,322 +0,0 @@
|
|
|
1
|
-
import { Component, ComponentNature, Properties, RectPath, Shape } from '@hatiolab/things-scene'
|
|
2
|
-
import format from './libs/format'
|
|
3
|
-
import { MASK } from './tact-timer-mask'
|
|
4
|
-
|
|
5
|
-
const NATURE: ComponentNature = {
|
|
6
|
-
mutable: false,
|
|
7
|
-
resizable: true,
|
|
8
|
-
rotatable: true,
|
|
9
|
-
properties: [
|
|
10
|
-
{
|
|
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'
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
type: 'string',
|
|
24
|
-
label: 'format',
|
|
25
|
-
name: 'format',
|
|
26
|
-
placeholder: 'hh:mm:ss'
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
type: 'select',
|
|
30
|
-
label: 'progress-direction',
|
|
31
|
-
name: 'progressDirection',
|
|
32
|
-
property: {
|
|
33
|
-
options: ['', 'increase', 'decrease']
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
type: 'color',
|
|
38
|
-
label: 'tact-timer-mask-color',
|
|
39
|
-
name: 'maskColor'
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
type: 'color',
|
|
43
|
-
label: 'before-due-progress-color',
|
|
44
|
-
name: 'beforeDueProgressColor'
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
type: 'color',
|
|
48
|
-
label: 'over-due-progress-color',
|
|
49
|
-
name: 'overDueProgressColor'
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
type: 'color',
|
|
53
|
-
label: 'before-due-font-color',
|
|
54
|
-
name: 'beforeDueFontColor'
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
type: 'color',
|
|
58
|
-
label: 'over-due-font-color',
|
|
59
|
-
name: 'overDueFontColor'
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
type: 'color',
|
|
63
|
-
label: 'under-threshold-color',
|
|
64
|
-
name: 'underThresholdColor'
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
type: 'number',
|
|
68
|
-
label: 'progress-threshold',
|
|
69
|
-
name: 'progressThreshold',
|
|
70
|
-
placeholder: '%'
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
type: 'number',
|
|
74
|
-
label: 'round',
|
|
75
|
-
name: 'round'
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
type: 'boolean',
|
|
79
|
-
label: 'auto-start',
|
|
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'
|
|
91
|
-
}
|
|
92
|
-
],
|
|
93
|
-
help: 'scene/component/manufacturing/tact-timer'
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
export default class TactTimer extends RectPath(Shape) {
|
|
97
|
-
private _start: number = 0
|
|
98
|
-
private _due: number = 0
|
|
99
|
-
private imageElement?: HTMLImageElement
|
|
100
|
-
|
|
101
|
-
get nature() {
|
|
102
|
-
return NATURE
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
ready() {
|
|
106
|
-
if (!this.app.isViewMode) {
|
|
107
|
-
return
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
const { autoStart, started } = this.state
|
|
111
|
-
|
|
112
|
-
if (autoStart || started) {
|
|
113
|
-
this.setState('started', true)
|
|
114
|
-
|
|
115
|
-
this.start()
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
start() {
|
|
120
|
-
const { startTime, endTime, hidden } = this.state
|
|
121
|
-
const start = this.parseTime(startTime)
|
|
122
|
-
const end = this.parseTime(endTime)
|
|
123
|
-
|
|
124
|
-
if (start && end && !hidden) {
|
|
125
|
-
this._due = end.getTime()
|
|
126
|
-
this._start = start.getTime()
|
|
127
|
-
this.counting()
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
stop() {
|
|
132
|
-
this.started = false
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
onchange(after: Properties) {
|
|
136
|
-
if ('startTime' in after || 'endTime' in after || 'hidden' in after) {
|
|
137
|
-
this.start()
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
if ('maskColor' in after) {
|
|
141
|
-
delete this.imageElement
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
getImageElement(): HTMLImageElement | undefined {
|
|
146
|
-
if (!this.imageElement) {
|
|
147
|
-
const { maskColor = 'black' } = this.state
|
|
148
|
-
|
|
149
|
-
this.imageElement = new Image()
|
|
150
|
-
this.imageElement.src =
|
|
151
|
-
'data:image/svg+xml;charset=UTF-8;base64,' + btoa(MASK.replace(/{{fillColor}}/g, maskColor))
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
return this.imageElement
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
counting() {
|
|
158
|
-
const { hidden, started } = this.state
|
|
159
|
-
if (this.disposed || hidden || !started) {
|
|
160
|
-
return
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
requestAnimationFrame(() => {
|
|
164
|
-
const { showTimer, beforeDueFontColor, overDueFontColor, fontColor } = this.state
|
|
165
|
-
const countdown = this.countdown
|
|
166
|
-
|
|
167
|
-
this.setState('fontColor', (this.countdown > 0 ? beforeDueFontColor : overDueFontColor) || fontColor)
|
|
168
|
-
|
|
169
|
-
if (showTimer) {
|
|
170
|
-
const text = format(Math.abs(countdown), this.getState('format'))
|
|
171
|
-
this.text = text
|
|
172
|
-
} else {
|
|
173
|
-
this.text = ''
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
this.setState('data', this.countdown)
|
|
177
|
-
|
|
178
|
-
setTimeout(() => {
|
|
179
|
-
this.counting()
|
|
180
|
-
}, 1000)
|
|
181
|
-
})
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
render(context: CanvasRenderingContext2D) {
|
|
185
|
-
var {
|
|
186
|
-
top,
|
|
187
|
-
left,
|
|
188
|
-
height,
|
|
189
|
-
width,
|
|
190
|
-
round = 0,
|
|
191
|
-
fontColor,
|
|
192
|
-
maskColor,
|
|
193
|
-
beforeDueFontColor,
|
|
194
|
-
overDueFontColor,
|
|
195
|
-
beforeDueProgressColor = 'transparent',
|
|
196
|
-
overDueProgressColor = 'transparent',
|
|
197
|
-
underThresholdColor = 'transparent',
|
|
198
|
-
progressDirection = 'increase',
|
|
199
|
-
progressThreshold = 0,
|
|
200
|
-
showProgress
|
|
201
|
-
} = this.state
|
|
202
|
-
|
|
203
|
-
const increase = this.countdown > 0
|
|
204
|
-
const totalDuration = (this._due - this._start) / 1000
|
|
205
|
-
const underThreshold = this.countdown / totalDuration < progressThreshold / 100
|
|
206
|
-
|
|
207
|
-
// progress의 색상
|
|
208
|
-
context.beginPath()
|
|
209
|
-
context.roundRect(left, top, width, height, round)
|
|
210
|
-
context.clip()
|
|
211
|
-
this.drawFill(context)
|
|
212
|
-
|
|
213
|
-
// value의 색상
|
|
214
|
-
context.beginPath()
|
|
215
|
-
|
|
216
|
-
if (!showProgress) {
|
|
217
|
-
return
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
var progress = Math.abs((this.countdown / totalDuration) * 100)
|
|
221
|
-
|
|
222
|
-
if (!isNaN(progress)) {
|
|
223
|
-
progress = width - (width * progress) / 100
|
|
224
|
-
progress = Math.max(Math.min(progress, width), 0)
|
|
225
|
-
|
|
226
|
-
if (progressDirection == 'increase') {
|
|
227
|
-
context.rect(left, top, progress, height)
|
|
228
|
-
} else {
|
|
229
|
-
context.rect(left + progress, top, width - progress, height)
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
context.fillStyle = increase
|
|
233
|
-
? underThreshold
|
|
234
|
-
? underThresholdColor
|
|
235
|
-
: beforeDueProgressColor
|
|
236
|
-
: overDueProgressColor
|
|
237
|
-
context.fill()
|
|
238
|
-
|
|
239
|
-
context.beginPath()
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
const image = this.getImageElement()
|
|
243
|
-
this.drawImage(context, image!, left - 2, top - 2, width + 4, height + 4)
|
|
244
|
-
|
|
245
|
-
context.roundRect(left, top, width, height, round)
|
|
246
|
-
|
|
247
|
-
this.setState('fontColor', (increase ? beforeDueFontColor : overDueFontColor) || fontColor)
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
postrender(context: CanvasRenderingContext2D) {
|
|
251
|
-
this.drawStroke(context)
|
|
252
|
-
this.drawText(context)
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
parseTime(timeString: string): Date | undefined {
|
|
256
|
-
if (!timeString || timeString.length !== 14) {
|
|
257
|
-
return undefined
|
|
258
|
-
}
|
|
259
|
-
const year = parseInt(timeString.slice(0, 4), 10)
|
|
260
|
-
const month = parseInt(timeString.slice(4, 6), 10) - 1
|
|
261
|
-
const day = parseInt(timeString.slice(6, 8), 10)
|
|
262
|
-
const hour = parseInt(timeString.slice(8, 10), 10)
|
|
263
|
-
const minute = parseInt(timeString.slice(10, 12), 10)
|
|
264
|
-
const second = parseInt(timeString.slice(12, 14), 10)
|
|
265
|
-
|
|
266
|
-
return new Date(year, month, day, hour, minute, second)
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
get countdown(): number {
|
|
270
|
-
const due = this._due || 0
|
|
271
|
-
const now = Date.now()
|
|
272
|
-
|
|
273
|
-
return Math.round((due - now) / 1000)
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
get value() {
|
|
277
|
-
const { startTime, endTime } = this.state
|
|
278
|
-
return [startTime, endTime]
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
set value(v) {
|
|
282
|
-
if (v instanceof Array) {
|
|
283
|
-
const [startTime, endTime] = v
|
|
284
|
-
this.setState({
|
|
285
|
-
startTime,
|
|
286
|
-
endTime
|
|
287
|
-
})
|
|
288
|
-
} else if (typeof v == 'object') {
|
|
289
|
-
const { startTime, endTime } = v
|
|
290
|
-
this.setState({
|
|
291
|
-
startTime,
|
|
292
|
-
endTime
|
|
293
|
-
})
|
|
294
|
-
} else if (typeof v == 'string') {
|
|
295
|
-
const [startTime, endTime] = (v as string).split(/[-+/%$#_,]+/)
|
|
296
|
-
this.setState({
|
|
297
|
-
startTime,
|
|
298
|
-
endTime
|
|
299
|
-
})
|
|
300
|
-
} else {
|
|
301
|
-
this.setState({
|
|
302
|
-
startTime: undefined,
|
|
303
|
-
endTime: undefined
|
|
304
|
-
})
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
get started() {
|
|
309
|
-
return this.getState('started')
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
set started(started) {
|
|
313
|
-
if (this.started !== started) {
|
|
314
|
-
this.setState('started', started)
|
|
315
|
-
if (started) {
|
|
316
|
-
this.start()
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
Component.register('tact-timer', TactTimer)
|
package/src/templates/index.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
const icon = new URL('../../icons/tact-timer.png', import.meta.url).href
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
type: 'tact-timer',
|
|
5
|
-
description: 'tact timer',
|
|
6
|
-
group: 'etc' /* line|shape|textAndMedia|chartAndGauge|table|container|dataSource|IoT|3D|warehouse|form|etc */,
|
|
7
|
-
icon,
|
|
8
|
-
model: {
|
|
9
|
-
type: 'tact-timer',
|
|
10
|
-
left: 100,
|
|
11
|
-
top: 100,
|
|
12
|
-
width: 200,
|
|
13
|
-
height: 40,
|
|
14
|
-
fontSize: 80,
|
|
15
|
-
lineWidth: 1,
|
|
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
|
|
26
|
-
}
|
|
27
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "es2018",
|
|
4
|
-
"module": "esnext",
|
|
5
|
-
"moduleResolution": "node",
|
|
6
|
-
"noEmitOnError": true,
|
|
7
|
-
"lib": ["es2019", "dom"],
|
|
8
|
-
"strict": true,
|
|
9
|
-
"esModuleInterop": false,
|
|
10
|
-
"allowJs": true,
|
|
11
|
-
"allowSyntheticDefaultImports": true,
|
|
12
|
-
"experimentalDecorators": true,
|
|
13
|
-
"importHelpers": true,
|
|
14
|
-
"outDir": "dist",
|
|
15
|
-
"sourceMap": true,
|
|
16
|
-
"inlineSources": true,
|
|
17
|
-
"rootDir": "src",
|
|
18
|
-
"declaration": true,
|
|
19
|
-
"incremental": true
|
|
20
|
-
},
|
|
21
|
-
"include": ["**/*.ts", "*.d.ts"]
|
|
22
|
-
}
|