@operato/scene-tab 1.1.8 β 1.1.15
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/assets/favicon.ico +0 -0
- package/assets/images/spinner.png +0 -0
- package/demo/index.html +240 -204
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/tab-card.d.ts +10 -0
- package/dist/tab-card.js +65 -0
- package/dist/tab-card.js.map +1 -0
- package/dist/tab-container.d.ts +20 -0
- package/dist/tab-container.js +167 -0
- package/dist/tab-container.js.map +1 -0
- package/dist/tab.js +9 -6
- package/dist/tab.js.map +1 -1
- package/dist/templates/index.d.ts +16 -3
- package/dist/templates/index.js +3 -2
- package/dist/templates/index.js.map +1 -1
- package/dist/templates/tab-container.d.ts +16 -0
- package/dist/templates/tab-container.js +17 -0
- package/dist/templates/tab-container.js.map +1 -0
- package/dist/templates/tab.d.ts +0 -1
- package/dist/templates/tab.js +2 -3
- package/dist/templates/tab.js.map +1 -1
- package/helps/scene/component/tab-container.ko.md +58 -0
- package/helps/scene/component/tab-container.md +57 -0
- package/helps/scene/component/tab-container.zh.md +59 -0
- package/helps/scene/images/button-evnet-mapping-01.png +0 -0
- package/helps/scene/images/button-evnet-mapping-02.png +0 -0
- package/helps/scene/images/button-evnet-mapping-03.png +0 -0
- package/helps/scene/images/tab-button-finish-01.gif +0 -0
- package/helps/scene/images/tab-container-03.png +0 -0
- package/helps/scene/images/tab-container-create-01.png +0 -0
- package/helps/scene/images/tab-container-create-02.png +0 -0
- package/helps/scene/images/tab-container-create-03.png +0 -0
- package/helps/scene/images/tab-container-setting-01.png +0 -0
- package/icons/tab-container.png +0 -0
- package/logs/.08636eb59927f12972f6774f5947c8507b3564c2-audit.json +20 -0
- package/logs/.5e5d741d8b7784a2fbad65eedc0fd46946aaf6f2-audit.json +20 -0
- package/logs/application-2022-11-13-11.log +14 -0
- package/logs/application-2022-11-13-12.log +6 -0
- package/logs/connections-2022-11-13-11.log +70 -0
- package/logs/connections-2022-11-13-12.log +35 -0
- package/package.json +4 -4
- package/src/index.ts +3 -0
- package/src/tab-card.ts +76 -0
- package/src/tab-container.ts +204 -0
- package/src/tab.ts +9 -5
- package/src/templates/index.ts +3 -2
- package/src/templates/tab-container.ts +17 -0
- package/src/templates/tab.ts +2 -3
- package/things-scene.config.js +2 -2
- package/translations/en.json +4 -0
- package/translations/ko.json +4 -0
- package/translations/ms.json +4 -0
- package/translations/zh.json +4 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/images/icon-button.png +0 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"keep": {
|
|
3
|
+
"days": true,
|
|
4
|
+
"amount": 14
|
|
5
|
+
},
|
|
6
|
+
"auditLog": "logs/.5e5d741d8b7784a2fbad65eedc0fd46946aaf6f2-audit.json",
|
|
7
|
+
"files": [
|
|
8
|
+
{
|
|
9
|
+
"date": 1668305632737,
|
|
10
|
+
"name": "logs/connections-2022-11-13-11.log",
|
|
11
|
+
"hash": "92b5a5784b7ecd0a635f48151736b7f4694661cb60da2f3356fc2c3763067370"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"date": 1668310623258,
|
|
15
|
+
"name": "logs/connections-2022-11-13-12.log",
|
|
16
|
+
"hash": "9827208d4a25978610634d4d0297f8b056db5eec06278d5b1baf16df63c4b684"
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"hashType": "sha256"
|
|
20
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
2022-11-13T11:13:52+09:00 info: File Storage is Ready.
|
|
2
|
+
2022-11-13T11:13:52+09:00 error: oracledb module loading failed
|
|
3
|
+
2022-11-13T11:14:05+09:00 info: File Storage is Ready.
|
|
4
|
+
2022-11-13T11:14:05+09:00 error: oracledb module loading failed
|
|
5
|
+
2022-11-13T11:14:06+09:00 info: Default DataSource established
|
|
6
|
+
2022-11-13T11:14:06+09:00 info: Transaction DataSource established
|
|
7
|
+
2022-11-13T11:14:07+09:00 info: π Server ready at http://0.0.0.0:3000/graphql
|
|
8
|
+
2022-11-13T11:14:07+09:00 info: π Subscriptions ready at ws://0.0.0.0:3000/graphql
|
|
9
|
+
2022-11-13T11:47:26+09:00 info: File Storage is Ready.
|
|
10
|
+
2022-11-13T11:47:26+09:00 error: oracledb module loading failed
|
|
11
|
+
2022-11-13T11:47:27+09:00 info: Default DataSource established
|
|
12
|
+
2022-11-13T11:47:27+09:00 info: Transaction DataSource established
|
|
13
|
+
2022-11-13T11:47:28+09:00 info: π Server ready at http://0.0.0.0:3000/graphql
|
|
14
|
+
2022-11-13T11:47:28+09:00 info: π Subscriptions ready at ws://0.0.0.0:3000/graphql
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
2022-11-13T12:37:02+09:00 info: File Storage is Ready.
|
|
2
|
+
2022-11-13T12:37:03+09:00 error: oracledb module loading failed
|
|
3
|
+
2022-11-13T12:37:04+09:00 info: Default DataSource established
|
|
4
|
+
2022-11-13T12:37:04+09:00 info: Transaction DataSource established
|
|
5
|
+
2022-11-13T12:37:04+09:00 info: π Server ready at http://0.0.0.0:3000/graphql
|
|
6
|
+
2022-11-13T12:37:04+09:00 info: π Subscriptions ready at ws://0.0.0.0:3000/graphql
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
2022-11-13T11:14:07+09:00 info: Initializing ConnectionManager...
|
|
2
|
+
2022-11-13T11:14:07+09:00 info: Connector 'echo-back-server' started to ready
|
|
3
|
+
2022-11-13T11:14:07+09:00 info: Connector 'echo-back' started to ready
|
|
4
|
+
2022-11-13T11:14:07+09:00 info: Connector 'http-connector' started to ready
|
|
5
|
+
2022-11-13T11:14:07+09:00 info: Connector 'graphql-connector' started to ready
|
|
6
|
+
2022-11-13T11:14:07+09:00 info: Connector 'sqlite-connector' started to ready
|
|
7
|
+
2022-11-13T11:14:07+09:00 info: Connector 'postgresql-connector' started to ready
|
|
8
|
+
2022-11-13T11:14:07+09:00 info: Connector 'mqtt-connector' started to ready
|
|
9
|
+
2022-11-13T11:14:07+09:00 info: Connector 'mssql-connector' started to ready
|
|
10
|
+
2022-11-13T11:14:07+09:00 info: Connector 'oracle-connector' started to ready
|
|
11
|
+
2022-11-13T11:14:07+09:00 info: Connector 'mysql-connector' started to ready
|
|
12
|
+
2022-11-13T11:14:07+09:00 info: Connector 'socket-server' started to ready
|
|
13
|
+
2022-11-13T11:14:07+09:00 info: echo-back-servers are ready
|
|
14
|
+
2022-11-13T11:14:07+09:00 info: echo-back connections are ready
|
|
15
|
+
2022-11-13T11:14:07+09:00 info: http-connector connections are ready
|
|
16
|
+
2022-11-13T11:14:07+09:00 info: graphql-connector connections are ready
|
|
17
|
+
2022-11-13T11:14:07+09:00 info: sqlite-connector connections are ready
|
|
18
|
+
2022-11-13T11:14:07+09:00 info: postgresql-connector connections are ready
|
|
19
|
+
2022-11-13T11:14:07+09:00 info: mqtt-connector connections are ready
|
|
20
|
+
2022-11-13T11:14:07+09:00 info: mssql-connector connections are ready
|
|
21
|
+
2022-11-13T11:14:07+09:00 info: oracle-connector connections are ready
|
|
22
|
+
2022-11-13T11:14:07+09:00 info: mysql-connector connections are ready
|
|
23
|
+
2022-11-13T11:14:07+09:00 info: socket servers are ready
|
|
24
|
+
2022-11-13T11:14:07+09:00 info: All connector for 'echo-back-server' ready
|
|
25
|
+
2022-11-13T11:14:07+09:00 info: All connector for 'echo-back' ready
|
|
26
|
+
2022-11-13T11:14:07+09:00 info: All connector for 'http-connector' ready
|
|
27
|
+
2022-11-13T11:14:07+09:00 info: All connector for 'graphql-connector' ready
|
|
28
|
+
2022-11-13T11:14:07+09:00 info: All connector for 'sqlite-connector' ready
|
|
29
|
+
2022-11-13T11:14:07+09:00 info: All connector for 'postgresql-connector' ready
|
|
30
|
+
2022-11-13T11:14:07+09:00 info: All connector for 'mqtt-connector' ready
|
|
31
|
+
2022-11-13T11:14:07+09:00 info: All connector for 'mssql-connector' ready
|
|
32
|
+
2022-11-13T11:14:07+09:00 info: All connector for 'oracle-connector' ready
|
|
33
|
+
2022-11-13T11:14:07+09:00 info: All connector for 'mysql-connector' ready
|
|
34
|
+
2022-11-13T11:14:07+09:00 info: All connector for 'socket-server' ready
|
|
35
|
+
2022-11-13T11:14:07+09:00 info: ConnectionManager initialization done:
|
|
36
|
+
2022-11-13T11:47:28+09:00 info: Initializing ConnectionManager...
|
|
37
|
+
2022-11-13T11:47:28+09:00 info: Connector 'echo-back-server' started to ready
|
|
38
|
+
2022-11-13T11:47:28+09:00 info: Connector 'echo-back' started to ready
|
|
39
|
+
2022-11-13T11:47:28+09:00 info: Connector 'http-connector' started to ready
|
|
40
|
+
2022-11-13T11:47:28+09:00 info: Connector 'graphql-connector' started to ready
|
|
41
|
+
2022-11-13T11:47:28+09:00 info: Connector 'sqlite-connector' started to ready
|
|
42
|
+
2022-11-13T11:47:28+09:00 info: Connector 'postgresql-connector' started to ready
|
|
43
|
+
2022-11-13T11:47:28+09:00 info: Connector 'mqtt-connector' started to ready
|
|
44
|
+
2022-11-13T11:47:28+09:00 info: Connector 'mssql-connector' started to ready
|
|
45
|
+
2022-11-13T11:47:28+09:00 info: Connector 'oracle-connector' started to ready
|
|
46
|
+
2022-11-13T11:47:28+09:00 info: Connector 'mysql-connector' started to ready
|
|
47
|
+
2022-11-13T11:47:28+09:00 info: Connector 'socket-server' started to ready
|
|
48
|
+
2022-11-13T11:47:28+09:00 info: echo-back-servers are ready
|
|
49
|
+
2022-11-13T11:47:28+09:00 info: echo-back connections are ready
|
|
50
|
+
2022-11-13T11:47:28+09:00 info: http-connector connections are ready
|
|
51
|
+
2022-11-13T11:47:28+09:00 info: graphql-connector connections are ready
|
|
52
|
+
2022-11-13T11:47:28+09:00 info: sqlite-connector connections are ready
|
|
53
|
+
2022-11-13T11:47:28+09:00 info: postgresql-connector connections are ready
|
|
54
|
+
2022-11-13T11:47:28+09:00 info: mqtt-connector connections are ready
|
|
55
|
+
2022-11-13T11:47:28+09:00 info: mssql-connector connections are ready
|
|
56
|
+
2022-11-13T11:47:28+09:00 info: oracle-connector connections are ready
|
|
57
|
+
2022-11-13T11:47:28+09:00 info: mysql-connector connections are ready
|
|
58
|
+
2022-11-13T11:47:28+09:00 info: socket servers are ready
|
|
59
|
+
2022-11-13T11:47:28+09:00 info: All connector for 'echo-back-server' ready
|
|
60
|
+
2022-11-13T11:47:28+09:00 info: All connector for 'echo-back' ready
|
|
61
|
+
2022-11-13T11:47:28+09:00 info: All connector for 'http-connector' ready
|
|
62
|
+
2022-11-13T11:47:28+09:00 info: All connector for 'graphql-connector' ready
|
|
63
|
+
2022-11-13T11:47:28+09:00 info: All connector for 'sqlite-connector' ready
|
|
64
|
+
2022-11-13T11:47:28+09:00 info: All connector for 'postgresql-connector' ready
|
|
65
|
+
2022-11-13T11:47:28+09:00 info: All connector for 'mqtt-connector' ready
|
|
66
|
+
2022-11-13T11:47:28+09:00 info: All connector for 'mssql-connector' ready
|
|
67
|
+
2022-11-13T11:47:28+09:00 info: All connector for 'oracle-connector' ready
|
|
68
|
+
2022-11-13T11:47:28+09:00 info: All connector for 'mysql-connector' ready
|
|
69
|
+
2022-11-13T11:47:28+09:00 info: All connector for 'socket-server' ready
|
|
70
|
+
2022-11-13T11:47:28+09:00 info: ConnectionManager initialization done:
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
2022-11-13T12:37:05+09:00 info: Initializing ConnectionManager...
|
|
2
|
+
2022-11-13T12:37:05+09:00 info: Connector 'echo-back-server' started to ready
|
|
3
|
+
2022-11-13T12:37:05+09:00 info: Connector 'echo-back' started to ready
|
|
4
|
+
2022-11-13T12:37:05+09:00 info: Connector 'http-connector' started to ready
|
|
5
|
+
2022-11-13T12:37:05+09:00 info: Connector 'graphql-connector' started to ready
|
|
6
|
+
2022-11-13T12:37:05+09:00 info: Connector 'sqlite-connector' started to ready
|
|
7
|
+
2022-11-13T12:37:05+09:00 info: Connector 'postgresql-connector' started to ready
|
|
8
|
+
2022-11-13T12:37:05+09:00 info: Connector 'mqtt-connector' started to ready
|
|
9
|
+
2022-11-13T12:37:05+09:00 info: Connector 'mssql-connector' started to ready
|
|
10
|
+
2022-11-13T12:37:05+09:00 info: Connector 'oracle-connector' started to ready
|
|
11
|
+
2022-11-13T12:37:05+09:00 info: Connector 'mysql-connector' started to ready
|
|
12
|
+
2022-11-13T12:37:05+09:00 info: Connector 'socket-server' started to ready
|
|
13
|
+
2022-11-13T12:37:05+09:00 info: echo-back-servers are ready
|
|
14
|
+
2022-11-13T12:37:05+09:00 info: echo-back connections are ready
|
|
15
|
+
2022-11-13T12:37:05+09:00 info: http-connector connections are ready
|
|
16
|
+
2022-11-13T12:37:05+09:00 info: graphql-connector connections are ready
|
|
17
|
+
2022-11-13T12:37:05+09:00 info: sqlite-connector connections are ready
|
|
18
|
+
2022-11-13T12:37:05+09:00 info: postgresql-connector connections are ready
|
|
19
|
+
2022-11-13T12:37:05+09:00 info: mqtt-connector connections are ready
|
|
20
|
+
2022-11-13T12:37:05+09:00 info: mssql-connector connections are ready
|
|
21
|
+
2022-11-13T12:37:05+09:00 info: oracle-connector connections are ready
|
|
22
|
+
2022-11-13T12:37:05+09:00 info: mysql-connector connections are ready
|
|
23
|
+
2022-11-13T12:37:05+09:00 info: socket servers are ready
|
|
24
|
+
2022-11-13T12:37:05+09:00 info: All connector for 'echo-back-server' ready
|
|
25
|
+
2022-11-13T12:37:05+09:00 info: All connector for 'echo-back' ready
|
|
26
|
+
2022-11-13T12:37:05+09:00 info: All connector for 'http-connector' ready
|
|
27
|
+
2022-11-13T12:37:05+09:00 info: All connector for 'graphql-connector' ready
|
|
28
|
+
2022-11-13T12:37:05+09:00 info: All connector for 'sqlite-connector' ready
|
|
29
|
+
2022-11-13T12:37:05+09:00 info: All connector for 'postgresql-connector' ready
|
|
30
|
+
2022-11-13T12:37:05+09:00 info: All connector for 'mqtt-connector' ready
|
|
31
|
+
2022-11-13T12:37:05+09:00 info: All connector for 'mssql-connector' ready
|
|
32
|
+
2022-11-13T12:37:05+09:00 info: All connector for 'oracle-connector' ready
|
|
33
|
+
2022-11-13T12:37:05+09:00 info: All connector for 'mysql-connector' ready
|
|
34
|
+
2022-11-13T12:37:05+09:00 info: All connector for 'socket-server' ready
|
|
35
|
+
2022-11-13T12:37:05+09:00 info: ConnectionManager initialization done:
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Tab style container for Things Scene",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "heartyoh",
|
|
6
|
-
"version": "1.1.
|
|
6
|
+
"version": "1.1.15",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"module": "dist/index.js",
|
|
9
9
|
"things-scene": true,
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@hatiolab/prettier-config": "^1.0.0",
|
|
34
|
-
"@things-factory/builder": "^6.0.0-
|
|
35
|
-
"@things-factory/operato-board": "^6.0.0-
|
|
34
|
+
"@things-factory/builder": "^6.0.0-zeta.0",
|
|
35
|
+
"@things-factory/operato-board": "^6.0.0-zeta.0",
|
|
36
36
|
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
|
37
37
|
"@typescript-eslint/parser": "^4.33.0",
|
|
38
38
|
"@web/dev-server": "^0.1.28",
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"prettier --write"
|
|
58
58
|
]
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "0a162cf5aec001a92274259a2833cec351d1ad67"
|
|
61
61
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Copyright Β© HatioLab Inc. All rights reserved.
|
|
3
3
|
*/
|
|
4
|
+
|
|
5
|
+
export { default as TabCard } from './tab-card'
|
|
6
|
+
export { default as TabContainer } from './tab-container'
|
|
4
7
|
export { default as Tab } from './tab'
|
|
5
8
|
export { default as TabButton } from './tab-button'
|
package/src/tab-card.ts
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Β© HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import { Component, ComponentNature, Container } from '@hatiolab/things-scene'
|
|
5
|
+
|
|
6
|
+
import TabContainer from './tab-container'
|
|
7
|
+
|
|
8
|
+
const NATURE: ComponentNature = {
|
|
9
|
+
mutable: false,
|
|
10
|
+
resizable: true,
|
|
11
|
+
rotatable: true,
|
|
12
|
+
properties: [
|
|
13
|
+
{
|
|
14
|
+
type: 'action',
|
|
15
|
+
label: 'remove',
|
|
16
|
+
name: 'remove',
|
|
17
|
+
property: {
|
|
18
|
+
icon: 'remove_circle',
|
|
19
|
+
action: function (tabCard: TabCard) {
|
|
20
|
+
let tabContainer = tabCard.parent as TabContainer
|
|
21
|
+
tabContainer.removeComponent(tabCard)
|
|
22
|
+
tabContainer.set('activeIndex', 0)
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export default class TabCard extends Container {
|
|
30
|
+
private _clickPoint?: Component
|
|
31
|
+
|
|
32
|
+
get hasTextProperty() {
|
|
33
|
+
return false
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
get showMoveHandle() {
|
|
37
|
+
return false
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/*
|
|
41
|
+
* PATH 리μ€νΈλ₯Ό μ§μ μμ ν μ μλ μ§λ₯Ό κ²°μ νλ€.
|
|
42
|
+
*
|
|
43
|
+
* μΌλ°μ μΌλ‘ PATHλ λ°μ΄λ μμ±μ μν΄μ λ
Όλ¦¬μ μΌλ‘ μμ±λλ―λ‘, μ§μ μμ νμ§ μλλ€.(return false)
|
|
44
|
+
* κ·Έλ¬λ, κ° κΌμ§μ λ€μ΄ κ°λ³λ‘ μμ§μ΄λ λ€κ°νλ₯λ path λΌλ λͺ¨λΈλ°μ΄νλ₯Ό κ°μ§λ―λ‘, μ§μ μμ μ΄ κ°λ₯ν μ μλ€.(return true)
|
|
45
|
+
*
|
|
46
|
+
* Immutable μ»΄ν¬λνΈμ νμμ λ°κΎΈλ λ°©λ²μ λ°μ΄λλ₯Ό μ΄μ©ν 리μ¬μ΄μ¦λ, νΉλ³ν 컨νΈλ‘€μ ν΅ν΄μ κ°λ₯νλ€.
|
|
47
|
+
*/
|
|
48
|
+
get mutable() {
|
|
49
|
+
return false
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/*
|
|
53
|
+
* BOUNDλ₯Ό ν΅ν΄μ 리μ¬μ΄μ¦λ₯Ό ν μ μλ μ§λ₯Ό κ²°μ νλ€.
|
|
54
|
+
*
|
|
55
|
+
* μΌλ°μ μΌλ‘ λ©΄μ μ κ°λ μ»΄ν¬λνΈλ λμ²΄λ‘ κ°λ₯νλ€.(return true)
|
|
56
|
+
* κ·Έλ¬λ, LINE λ± λ©΄μ μ κ°μ§μ§μλ μ»΄ν¬λνΈλ κ°λ₯νμ§ μλλ‘ μ μνλ€.(return false)
|
|
57
|
+
*/
|
|
58
|
+
get resizable() {
|
|
59
|
+
return false
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/*
|
|
63
|
+
* νμ μ ν μ μλ μ§λ₯Ό κ²°μ νλ€.
|
|
64
|
+
*
|
|
65
|
+
* μΌλ°μ μΌλ‘ λͺ¨λ μ»΄ν¬λνΈλ κ°λ₯νλ€.(return true)
|
|
66
|
+
*/
|
|
67
|
+
get rotatable() {
|
|
68
|
+
return false
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
get nature() {
|
|
72
|
+
return NATURE
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
Component.register('tab-card', TabCard)
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Β© HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import { CardLayout, Component, ComponentNature, Container, Model, POINT, State } from '@hatiolab/things-scene'
|
|
5
|
+
|
|
6
|
+
import TabCard from './tab-card'
|
|
7
|
+
|
|
8
|
+
const LABEL_WIDTH = 25
|
|
9
|
+
const LABEL_HEIGHT = 25
|
|
10
|
+
|
|
11
|
+
function rgba(r: number, g: number, b: number, a: number) {
|
|
12
|
+
return `rgba(${r}, ${g}, ${b}, ${a})`
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const NATURE: ComponentNature = {
|
|
16
|
+
mutable: false,
|
|
17
|
+
resizable: true,
|
|
18
|
+
rotatable: true,
|
|
19
|
+
properties: [
|
|
20
|
+
{
|
|
21
|
+
type: 'action',
|
|
22
|
+
label: 'add-card',
|
|
23
|
+
name: 'addCard',
|
|
24
|
+
property: {
|
|
25
|
+
icon: 'add_circle',
|
|
26
|
+
action: (tabContainer: TabContainer) => {
|
|
27
|
+
tabContainer.addCard()
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
type: 'number',
|
|
33
|
+
label: 'active index',
|
|
34
|
+
name: 'activeIndex'
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
'value-property': 'activeIndex',
|
|
38
|
+
help: 'scene/component/tab-container'
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export default class TabContainer extends Container {
|
|
42
|
+
private _focused: boolean = false
|
|
43
|
+
private __down_point?: POINT
|
|
44
|
+
|
|
45
|
+
get nature() {
|
|
46
|
+
return NATURE
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
get layout() {
|
|
50
|
+
return CardLayout
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
get layoutConfig() {
|
|
54
|
+
return this.get('layoutConfig')
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
set layoutConfig(config) {
|
|
58
|
+
this.set('layoutConfig', config)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
get activeCard(): TabCard {
|
|
62
|
+
return this.components[this.get('layoutConfig').activeIndex] as TabCard
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
get activeIndex() {
|
|
66
|
+
return this.get('activeIndex')
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
set activeIndex(activeIndex: number) {
|
|
70
|
+
this.set('activeIndex', Number(activeIndex))
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
ready() {
|
|
74
|
+
super.ready()
|
|
75
|
+
|
|
76
|
+
if (this.components.length == 0) this.addCard()
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
postrender(context: CanvasRenderingContext2D) {
|
|
80
|
+
if (!this.app.isViewMode && this._focused) {
|
|
81
|
+
var { left, top, width, fillStyle } = this.state
|
|
82
|
+
|
|
83
|
+
// tabCard μ ν ν 그리기
|
|
84
|
+
for (let i = 0; i < this.components.length; i++) {
|
|
85
|
+
context.beginPath()
|
|
86
|
+
|
|
87
|
+
context.rect(left - LABEL_WIDTH, top + i * LABEL_HEIGHT, LABEL_WIDTH, LABEL_HEIGHT)
|
|
88
|
+
|
|
89
|
+
let color = 255 - ((20 * (i + 1)) % 255)
|
|
90
|
+
context.fillStyle = rgba(color, color, color, 1)
|
|
91
|
+
context.fill()
|
|
92
|
+
|
|
93
|
+
context.closePath()
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
context.beginPath()
|
|
97
|
+
|
|
98
|
+
context.moveTo(left, top)
|
|
99
|
+
context.lineTo(left - LABEL_WIDTH, top)
|
|
100
|
+
context.lineTo(left - LABEL_WIDTH, top + this.components.length * LABEL_HEIGHT)
|
|
101
|
+
context.lineTo(left, top + this.components.length * LABEL_HEIGHT)
|
|
102
|
+
|
|
103
|
+
context.strokeStyle = '#ccc'
|
|
104
|
+
context.stroke()
|
|
105
|
+
|
|
106
|
+
context.closePath()
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
super.postrender(context)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
contains(x: number, y: number) {
|
|
113
|
+
var contains = super.contains(x, y)
|
|
114
|
+
|
|
115
|
+
if (this.app.isViewMode) return contains
|
|
116
|
+
|
|
117
|
+
var { left, top, width } = this.bounds
|
|
118
|
+
var h = LABEL_HEIGHT
|
|
119
|
+
|
|
120
|
+
contains =
|
|
121
|
+
contains ||
|
|
122
|
+
// card selector μμμ ν¬ν¨λλμ§
|
|
123
|
+
(x < Math.max(left - LABEL_WIDTH, left) &&
|
|
124
|
+
x > Math.min(left - LABEL_WIDTH, left) &&
|
|
125
|
+
y < Math.max(top + h * this.size(), top) &&
|
|
126
|
+
y > Math.min(top + h * this.size(), top))
|
|
127
|
+
|
|
128
|
+
if (contains) this._focused = true
|
|
129
|
+
else this._focused = false
|
|
130
|
+
|
|
131
|
+
this.invalidate()
|
|
132
|
+
return contains
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
onchange(after: State) {
|
|
136
|
+
if ('activeIndex' in after) {
|
|
137
|
+
this.layoutConfig = {
|
|
138
|
+
...this.layoutConfig,
|
|
139
|
+
activeIndex: after.activeIndex
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
onmouseup(e: MouseEvent) {
|
|
145
|
+
var down_point = this.__down_point
|
|
146
|
+
delete this.__down_point
|
|
147
|
+
|
|
148
|
+
if (!down_point || down_point.x != e.offsetX || down_point.y != e.offsetY) {
|
|
149
|
+
return
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
var point = this.transcoordC2S(e.offsetX, e.offsetY)
|
|
153
|
+
|
|
154
|
+
var { left, top } = this.state
|
|
155
|
+
|
|
156
|
+
var x = point.x - left
|
|
157
|
+
var y = point.y - top
|
|
158
|
+
|
|
159
|
+
if (x > 0) return
|
|
160
|
+
|
|
161
|
+
y /= LABEL_HEIGHT
|
|
162
|
+
y = Math.floor(y)
|
|
163
|
+
|
|
164
|
+
if (!this.layoutConfig) this.layoutConfig = {}
|
|
165
|
+
|
|
166
|
+
if (y >= this.components.length) return
|
|
167
|
+
|
|
168
|
+
// /* μμ± λ²νΌμ΄ ν΄λ¦λλ©΄, μλ‘μ΄ tabCardλ₯Ό μΆκ°νλ€. */
|
|
169
|
+
// if(y == this.components.length) {
|
|
170
|
+
// this.add(Model.compile({
|
|
171
|
+
// type: 'tab-card',
|
|
172
|
+
// width: 100,
|
|
173
|
+
// height: 100
|
|
174
|
+
// }))
|
|
175
|
+
// }
|
|
176
|
+
this.set('activeIndex', y)
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
onmousedown(e: MouseEvent) {
|
|
180
|
+
this.__down_point = {
|
|
181
|
+
x: e.offsetX,
|
|
182
|
+
y: e.offsetY
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
addCard() {
|
|
187
|
+
const color = 255 - ((20 * (this.components.length + 1)) % 255)
|
|
188
|
+
const hex = color.toString(16)
|
|
189
|
+
|
|
190
|
+
const tabCard = Model.compile({
|
|
191
|
+
type: 'tab-card',
|
|
192
|
+
fillStyle: `#${hex}${hex}${hex}`,
|
|
193
|
+
top: 0,
|
|
194
|
+
left: 0,
|
|
195
|
+
width: 100,
|
|
196
|
+
height: 100
|
|
197
|
+
})
|
|
198
|
+
|
|
199
|
+
this.addComponent(tabCard)
|
|
200
|
+
this.set('activeIndex', this.components.length - 1)
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
Component.register('tab-container', TabContainer)
|
package/src/tab.ts
CHANGED
|
@@ -29,7 +29,11 @@ const NATURE: ComponentNature = {
|
|
|
29
29
|
label: 'tab-reference',
|
|
30
30
|
name: 'reference',
|
|
31
31
|
property: {
|
|
32
|
-
component:
|
|
32
|
+
component: (c: Component) => {
|
|
33
|
+
/* this means compare target component */
|
|
34
|
+
const ret = ['tab-container', 'indoor-map'].includes(c.model.type as string)
|
|
35
|
+
return ret
|
|
36
|
+
}
|
|
33
37
|
}
|
|
34
38
|
},
|
|
35
39
|
{
|
|
@@ -147,7 +151,7 @@ export default class Tab extends Container {
|
|
|
147
151
|
postrender(context: CanvasRenderingContext2D) {
|
|
148
152
|
super.postrender(context)
|
|
149
153
|
|
|
150
|
-
if (!this.app.isEditMode) return
|
|
154
|
+
// if (!this.app.isEditMode) return
|
|
151
155
|
|
|
152
156
|
var { left, top, width, fillStyle } = this.state
|
|
153
157
|
|
|
@@ -223,15 +227,15 @@ export default class Tab extends Container {
|
|
|
223
227
|
}
|
|
224
228
|
|
|
225
229
|
for (let i = 0; i < components.length; i++) {
|
|
226
|
-
if (components[i].model.type != '
|
|
230
|
+
if (components[i].model.type != 'tab-card') continue
|
|
227
231
|
|
|
228
|
-
let
|
|
232
|
+
let tabCardText = components[i].text || ''
|
|
229
233
|
|
|
230
234
|
children.push(
|
|
231
235
|
Model.compile({
|
|
232
236
|
type: 'tab-button',
|
|
233
237
|
index: i,
|
|
234
|
-
text:
|
|
238
|
+
text: tabCardText || String(i + 1),
|
|
235
239
|
fillStyle: fillStyle || 'transparent',
|
|
236
240
|
activeFillStyle: activeFillStyle,
|
|
237
241
|
activeLineColor: activeLineColor,
|
package/src/templates/index.ts
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const icon = new URL('../../icons/tab-container.png', import.meta.url).href
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
type: 'tab-container',
|
|
5
|
+
description: 'tab container(card layout)',
|
|
6
|
+
group: 'container' /* line|shape|textAndMedia|chartAndGauge|table|container|dataSource|IoT|3D|warehouse|form|etc */,
|
|
7
|
+
icon,
|
|
8
|
+
model: {
|
|
9
|
+
type: 'tab-container',
|
|
10
|
+
left: 100,
|
|
11
|
+
top: 100,
|
|
12
|
+
width: 200,
|
|
13
|
+
height: 200,
|
|
14
|
+
fontSize: 80,
|
|
15
|
+
lineWidth: 1
|
|
16
|
+
}
|
|
17
|
+
}
|
package/src/templates/tab.ts
CHANGED
|
@@ -2,7 +2,7 @@ const icon = new URL('../../icons/tab.png', import.meta.url).href
|
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
4
|
type: 'tab',
|
|
5
|
-
description: 'container tab',
|
|
5
|
+
description: 'tab-container control tab',
|
|
6
6
|
group: 'container' /* line|shape|textAndMedia|chartAndGauge|table|container|dataSource|IoT|3D|warehouse|form|etc */,
|
|
7
7
|
icon,
|
|
8
8
|
model: {
|
|
@@ -16,6 +16,5 @@ export default {
|
|
|
16
16
|
activeFillStyle: 'red',
|
|
17
17
|
strokeStyle: 'white',
|
|
18
18
|
fontColor: 'white'
|
|
19
|
-
}
|
|
20
|
-
about: '/helps/scene/component/tab.md'
|
|
19
|
+
}
|
|
21
20
|
}
|
package/things-scene.config.js
CHANGED