@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.
Files changed (58) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/assets/favicon.ico +0 -0
  3. package/assets/images/spinner.png +0 -0
  4. package/demo/index.html +240 -204
  5. package/dist/index.d.ts +2 -0
  6. package/dist/index.js +2 -0
  7. package/dist/index.js.map +1 -1
  8. package/dist/tab-card.d.ts +10 -0
  9. package/dist/tab-card.js +65 -0
  10. package/dist/tab-card.js.map +1 -0
  11. package/dist/tab-container.d.ts +20 -0
  12. package/dist/tab-container.js +167 -0
  13. package/dist/tab-container.js.map +1 -0
  14. package/dist/tab.js +9 -6
  15. package/dist/tab.js.map +1 -1
  16. package/dist/templates/index.d.ts +16 -3
  17. package/dist/templates/index.js +3 -2
  18. package/dist/templates/index.js.map +1 -1
  19. package/dist/templates/tab-container.d.ts +16 -0
  20. package/dist/templates/tab-container.js +17 -0
  21. package/dist/templates/tab-container.js.map +1 -0
  22. package/dist/templates/tab.d.ts +0 -1
  23. package/dist/templates/tab.js +2 -3
  24. package/dist/templates/tab.js.map +1 -1
  25. package/helps/scene/component/tab-container.ko.md +58 -0
  26. package/helps/scene/component/tab-container.md +57 -0
  27. package/helps/scene/component/tab-container.zh.md +59 -0
  28. package/helps/scene/images/button-evnet-mapping-01.png +0 -0
  29. package/helps/scene/images/button-evnet-mapping-02.png +0 -0
  30. package/helps/scene/images/button-evnet-mapping-03.png +0 -0
  31. package/helps/scene/images/tab-button-finish-01.gif +0 -0
  32. package/helps/scene/images/tab-container-03.png +0 -0
  33. package/helps/scene/images/tab-container-create-01.png +0 -0
  34. package/helps/scene/images/tab-container-create-02.png +0 -0
  35. package/helps/scene/images/tab-container-create-03.png +0 -0
  36. package/helps/scene/images/tab-container-setting-01.png +0 -0
  37. package/icons/tab-container.png +0 -0
  38. package/logs/.08636eb59927f12972f6774f5947c8507b3564c2-audit.json +20 -0
  39. package/logs/.5e5d741d8b7784a2fbad65eedc0fd46946aaf6f2-audit.json +20 -0
  40. package/logs/application-2022-11-13-11.log +14 -0
  41. package/logs/application-2022-11-13-12.log +6 -0
  42. package/logs/connections-2022-11-13-11.log +70 -0
  43. package/logs/connections-2022-11-13-12.log +35 -0
  44. package/package.json +4 -4
  45. package/src/index.ts +3 -0
  46. package/src/tab-card.ts +76 -0
  47. package/src/tab-container.ts +204 -0
  48. package/src/tab.ts +9 -5
  49. package/src/templates/index.ts +3 -2
  50. package/src/templates/tab-container.ts +17 -0
  51. package/src/templates/tab.ts +2 -3
  52. package/things-scene.config.js +2 -2
  53. package/translations/en.json +4 -0
  54. package/translations/ko.json +4 -0
  55. package/translations/ms.json +4 -0
  56. package/translations/zh.json +4 -0
  57. package/tsconfig.tsbuildinfo +1 -1
  58. 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.8",
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-alpha.0",
35
- "@things-factory/operato-board": "^6.0.0-alpha.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": "69c2b91e518f119fe5ecc0406902709edea110b3"
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'
@@ -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: 'indoor-map'
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 != 'floor') continue
230
+ if (components[i].model.type != 'tab-card') continue
227
231
 
228
- let floorText = components[i].text || ''
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: floorText || String(i + 1),
238
+ text: tabCardText || String(i + 1),
235
239
  fillStyle: fillStyle || 'transparent',
236
240
  activeFillStyle: activeFillStyle,
237
241
  activeLineColor: activeLineColor,
@@ -1,3 +1,4 @@
1
- import tab from './tab'
1
+ import TabContainer from './tab-container'
2
+ import Tab from './tab'
2
3
 
3
- export default [tab]
4
+ export default [TabContainer, Tab]
@@ -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
+ }
@@ -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
  }
@@ -1,5 +1,5 @@
1
- import templates from './dist/templates';
1
+ import templates from './dist/templates'
2
2
 
3
3
  export default {
4
4
  templates
5
- };
5
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "label.active index": "active index",
3
+ "label.add-card": "add card"
4
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "label.active index": "ν™œμ„± νŽ˜μ΄μ§€",
3
+ "label.add-card": "μΉ΄λ“œ μΆ”κ°€"
4
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "label.active index": "[ms] active index",
3
+ "label.add-card": "[ms] add card"
4
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "label.active index": "[zh] active index",
3
+ "label.add-card": "[zh] add card"
4
+ }