@operato/board 0.2.48 → 0.2.52

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 (127) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/assets/images/components/audio.png +0 -0
  3. package/assets/images/components/both-arrow.png +0 -0
  4. package/assets/images/components/color-image.png +0 -0
  5. package/assets/images/components/container.png +0 -0
  6. package/assets/images/components/dash.png +0 -0
  7. package/assets/images/components/donut.png +0 -0
  8. package/assets/images/components/ellipse.png +0 -0
  9. package/assets/images/components/forklift.png +0 -0
  10. package/assets/images/components/gif-image.png +0 -0
  11. package/assets/images/components/global-reference.png +0 -0
  12. package/assets/images/components/gray-image.png +0 -0
  13. package/assets/images/components/humidity-sensor.png +0 -0
  14. package/assets/images/components/info-window.png +0 -0
  15. package/assets/images/components/line.png +0 -0
  16. package/assets/images/components/local-reference.png +0 -0
  17. package/assets/images/components/person.png +0 -0
  18. package/assets/images/components/polygon.png +0 -0
  19. package/assets/images/components/polyline.png +0 -0
  20. package/assets/images/components/popup.png +0 -0
  21. package/assets/images/components/rect.png +0 -0
  22. package/assets/images/components/single-arrow.png +0 -0
  23. package/assets/images/components/star.png +0 -0
  24. package/assets/images/components/text.png +0 -0
  25. package/assets/images/components/triangle.png +0 -0
  26. package/assets/images/icon-vtoolbar.png +0 -0
  27. package/custom-elements.json +1900 -743
  28. package/dist/src/component/3d.d.ts +2 -0
  29. package/dist/src/component/3d.js +27 -0
  30. package/dist/src/component/3d.js.map +1 -0
  31. package/dist/src/component/chart-and-gauge.d.ts +2 -0
  32. package/dist/src/component/chart-and-gauge.js +26 -0
  33. package/dist/src/component/chart-and-gauge.js.map +1 -0
  34. package/dist/src/component/container.d.ts +2 -0
  35. package/dist/src/component/container.js +60 -0
  36. package/dist/src/component/container.js.map +1 -0
  37. package/dist/src/component/data-source.d.ts +2 -0
  38. package/dist/src/component/data-source.js +28 -0
  39. package/dist/src/component/data-source.js.map +1 -0
  40. package/dist/src/component/etc.d.ts +2 -0
  41. package/dist/src/component/etc.js +82 -0
  42. package/dist/src/component/etc.js.map +1 -0
  43. package/dist/src/component/form.d.ts +2 -0
  44. package/dist/src/component/form.js +40 -0
  45. package/dist/src/component/form.js.map +1 -0
  46. package/dist/src/component/index.d.ts +12 -0
  47. package/dist/src/component/index.js +13 -0
  48. package/dist/src/component/index.js.map +1 -0
  49. package/dist/src/component/iot.d.ts +2 -0
  50. package/dist/src/component/iot.js +50 -0
  51. package/dist/src/component/iot.js.map +1 -0
  52. package/dist/src/component/line.d.ts +2 -0
  53. package/dist/src/component/line.js +130 -0
  54. package/dist/src/component/line.js.map +1 -0
  55. package/dist/src/component/register-default-groups.d.ts +1 -0
  56. package/dist/src/component/register-default-groups.js +28 -0
  57. package/dist/src/component/register-default-groups.js.map +1 -0
  58. package/dist/src/component/shape.d.ts +2 -0
  59. package/dist/src/component/shape.js +152 -0
  60. package/dist/src/component/shape.js.map +1 -0
  61. package/dist/src/component/table.d.ts +2 -0
  62. package/dist/src/component/table.js +26 -0
  63. package/dist/src/component/table.js.map +1 -0
  64. package/dist/src/component/text-and-media.d.ts +2 -0
  65. package/dist/src/component/text-and-media.js +122 -0
  66. package/dist/src/component/text-and-media.js.map +1 -0
  67. package/dist/src/component/warehouse.d.ts +2 -0
  68. package/dist/src/component/warehouse.js +24 -0
  69. package/dist/src/component/warehouse.js.map +1 -0
  70. package/dist/src/graphql/board.d.ts +6 -0
  71. package/dist/src/graphql/board.js +130 -0
  72. package/dist/src/graphql/board.js.map +1 -0
  73. package/dist/src/graphql/favorite-board.d.ts +1 -0
  74. package/dist/src/graphql/favorite-board.js +23 -0
  75. package/dist/src/graphql/favorite-board.js.map +1 -0
  76. package/dist/src/graphql/group.d.ts +7 -0
  77. package/dist/src/graphql/group.js +125 -0
  78. package/dist/src/graphql/group.js.map +1 -0
  79. package/dist/src/graphql/index.d.ts +4 -0
  80. package/dist/src/graphql/index.js +5 -0
  81. package/dist/src/graphql/index.js.map +1 -0
  82. package/dist/src/graphql/play-group.d.ts +8 -0
  83. package/dist/src/graphql/play-group.js +173 -0
  84. package/dist/src/graphql/play-group.js.map +1 -0
  85. package/dist/src/modeller/component-toolbar/component-detail.d.ts +1 -1
  86. package/dist/src/modeller/component-toolbar/component-detail.js +6 -6
  87. package/dist/src/modeller/component-toolbar/component-detail.js.map +1 -1
  88. package/dist/src/modeller/component-toolbar/component-menu.js +1 -2
  89. package/dist/src/modeller/component-toolbar/component-menu.js.map +1 -1
  90. package/dist/src/modeller/component-toolbar/component-toolbar.js +26 -65
  91. package/dist/src/modeller/component-toolbar/component-toolbar.js.map +1 -1
  92. package/dist/src/ox-board-list.d.ts +2 -0
  93. package/dist/src/ox-board-list.js +427 -0
  94. package/dist/src/ox-board-list.js.map +1 -0
  95. package/dist/src/ox-board-modeller.d.ts +6 -1
  96. package/dist/src/ox-board-modeller.js +35 -3
  97. package/dist/src/ox-board-modeller.js.map +1 -1
  98. package/dist/src/types.d.ts +30 -0
  99. package/dist/src/types.js.map +1 -1
  100. package/dist/tsconfig.tsbuildinfo +1 -1
  101. package/package.json +12 -6
  102. package/src/component/3d.ts +29 -0
  103. package/src/component/chart-and-gauge.ts +28 -0
  104. package/src/component/container.ts +62 -0
  105. package/src/component/data-source.ts +30 -0
  106. package/src/component/etc.ts +87 -0
  107. package/src/component/form.ts +42 -0
  108. package/src/component/index.ts +12 -0
  109. package/src/component/iot.ts +52 -0
  110. package/src/component/line.ts +132 -0
  111. package/src/component/register-default-groups.ts +28 -0
  112. package/src/component/shape.ts +154 -0
  113. package/src/component/table.ts +28 -0
  114. package/src/component/text-and-media.ts +124 -0
  115. package/src/component/warehouse.ts +26 -0
  116. package/src/graphql/board.ts +144 -0
  117. package/src/graphql/favorite-board.ts +25 -0
  118. package/src/graphql/group.ts +138 -0
  119. package/src/graphql/index.ts +4 -0
  120. package/src/graphql/play-group.ts +189 -0
  121. package/src/modeller/component-toolbar/component-detail.ts +7 -7
  122. package/src/modeller/component-toolbar/component-menu.ts +2 -5
  123. package/src/modeller/component-toolbar/component-toolbar.ts +35 -67
  124. package/src/ox-board-list.ts +459 -0
  125. package/src/ox-board-modeller.ts +44 -5
  126. package/src/types.ts +48 -0
  127. package/yarn-error.log +0 -18355
@@ -0,0 +1,26 @@
1
+ import { ComponentGroup } from '../types'
2
+
3
+ const icon = `
4
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 30 30" style="enable-background:new 0 0 30 30;" xml:space="preserve">
5
+ <style type="text/css">
6
+ .st0{fill:{{strokeColor}};}
7
+ .st14{fill:none;stroke:{{strokeColor}};stroke-width:2.5;stroke-linecap:round;stroke-miterlimit:10;}
8
+ .st15{fill:none;stroke:{{strokeColor}};stroke-linecap:round;stroke-miterlimit:10;}
9
+ </style>
10
+ <g>
11
+ <polyline class="st14" points="1.5,11.2 15,5.2 28.5,11 "/>
12
+ <line class="st15" x1="3.2" y1="11.6" x2="3.2" y2="23.8"/>
13
+ <line class="st15" x1="26.9" y1="11.6" x2="26.9" y2="23.8"/>
14
+ <line class="st5" x1="1.7" y1="24.8" x2="28.3" y2="24.8"/>
15
+ <rect x="21.1" y="18.3" class="st0" width="3.4" height="5.5"/>
16
+ <path class="st0" d="M5.9,13.6v10.2h13.8V13.6H5.9z M18.7,17.3H6.8v-2.4h11.9V17.3z"/>
17
+ </g>
18
+ </svg>
19
+ `
20
+
21
+ export const warehouse: ComponentGroup = {
22
+ name: 'warehouse',
23
+ description: 'a group of various components used in a warehouse depiction',
24
+ icon,
25
+ templates: []
26
+ }
@@ -0,0 +1,144 @@
1
+ import { buildArgs, client } from '@operato/graphql'
2
+
3
+ import { Board } from '../types'
4
+ import gql from 'graphql-tag'
5
+
6
+ export async function fetchBoardList(listParam = {}) {
7
+ const response = await client.query({
8
+ query: gql`
9
+ {
10
+ boards(${buildArgs(listParam)}) {
11
+ items {
12
+ id
13
+ name
14
+ description
15
+ thumbnail
16
+ createdAt
17
+ updatedAt
18
+ }
19
+ total
20
+ }
21
+ }
22
+ `
23
+ })
24
+
25
+ return response.data
26
+ }
27
+
28
+ export async function fetchBoard(id: string) {
29
+ const response = await client.query({
30
+ query: gql`
31
+ query FetchBoardById($id: String!) {
32
+ board(id: $id) {
33
+ id
34
+ name
35
+ description
36
+ group {
37
+ id
38
+ name
39
+ }
40
+ thumbnail
41
+ model
42
+ createdAt
43
+ creator {
44
+ id
45
+ name
46
+ }
47
+ updatedAt
48
+ updater {
49
+ id
50
+ name
51
+ }
52
+ }
53
+ }
54
+ `,
55
+ variables: { id }
56
+ })
57
+
58
+ return response.data
59
+ }
60
+
61
+ export async function createBoard(board: Board) {
62
+ /*
63
+ input NewBoard {
64
+ name : String!
65
+ description : String
66
+ model : String!
67
+ groupId : String!
68
+ }
69
+ */
70
+
71
+ board.model = JSON.stringify(board.model)
72
+
73
+ const response = await client.mutate({
74
+ mutation: gql`
75
+ mutation CreateBoard($board: NewBoard!) {
76
+ createBoard(board: $board) {
77
+ id
78
+ name
79
+ description
80
+ model
81
+ createdAt
82
+ updatedAt
83
+ }
84
+ }
85
+ `,
86
+ variables: {
87
+ board
88
+ }
89
+ })
90
+
91
+ return response.data
92
+ }
93
+
94
+ export async function updateBoard(board: Board) {
95
+ /*
96
+ input BoardPatch {
97
+ name : String
98
+ description : String
99
+ model : String
100
+ }
101
+ */
102
+ var { id, name, description, model, groupId } = board
103
+ model = JSON.stringify(model)
104
+
105
+ const response = await client.mutate({
106
+ mutation: gql`
107
+ mutation UpdateBoard($id: String!, $patch: BoardPatch!) {
108
+ updateBoard(id: $id, patch: $patch) {
109
+ id
110
+ name
111
+ description
112
+ model
113
+ group {
114
+ id
115
+ name
116
+ }
117
+ createdAt
118
+ updatedAt
119
+ }
120
+ }
121
+ `,
122
+ variables: {
123
+ id,
124
+ patch: { name, description, model, groupId }
125
+ }
126
+ })
127
+
128
+ return response.data
129
+ }
130
+
131
+ export async function deleteBoard(id: string) {
132
+ const response = await client.mutate({
133
+ mutation: gql`
134
+ mutation ($id: String!) {
135
+ deleteBoard(id: $id)
136
+ }
137
+ `,
138
+ variables: {
139
+ id
140
+ }
141
+ })
142
+
143
+ return response.data
144
+ }
@@ -0,0 +1,25 @@
1
+ import { buildArgs, client } from '@operato/graphql'
2
+
3
+ import gql from 'graphql-tag'
4
+
5
+ export async function fetchFavoriteBoardList(listParam = {}) {
6
+ const response = await client.query({
7
+ query: gql`
8
+ {
9
+ favoriteBoards(${buildArgs(listParam)}) {
10
+ items {
11
+ id
12
+ name
13
+ description
14
+ thumbnail
15
+ createdAt
16
+ updatedAt
17
+ }
18
+ total
19
+ }
20
+ }
21
+ `
22
+ })
23
+
24
+ return response.data
25
+ }
@@ -0,0 +1,138 @@
1
+ import { BoardGroup } from '../types'
2
+ import { client } from '@operato/graphql'
3
+ import gql from 'graphql-tag'
4
+
5
+ export async function fetchGroup(id: string) {
6
+ const response = await client.query({
7
+ query: gql`
8
+ query FetchGroupById($id: String!) {
9
+ group(id: $id) {
10
+ id
11
+ name
12
+ description
13
+ createdAt
14
+ creator {
15
+ id
16
+ name
17
+ }
18
+ updatedAt
19
+ updater {
20
+ id
21
+ name
22
+ }
23
+ }
24
+ }
25
+ `,
26
+ variables: { id }
27
+ })
28
+
29
+ return response.data
30
+ }
31
+
32
+ export async function updateGroup(group: BoardGroup) {
33
+ var { id, name, description } = group
34
+
35
+ const response = await client.mutate({
36
+ mutation: gql`
37
+ mutation UpdateGroup($id: String!, $patch: GroupPatch!) {
38
+ updateGroup(id: $id, patch: $patch) {
39
+ id
40
+ name
41
+ description
42
+ createdAt
43
+ updatedAt
44
+ }
45
+ }
46
+ `,
47
+ variables: {
48
+ id,
49
+ patch: { name, description }
50
+ }
51
+ })
52
+
53
+ return response.data
54
+ }
55
+
56
+ export async function deleteGroup(id: string) {
57
+ const response = await client.mutate({
58
+ mutation: gql`
59
+ mutation ($id: String!) {
60
+ deleteGroup(id: $id)
61
+ }
62
+ `,
63
+ variables: {
64
+ id
65
+ }
66
+ })
67
+
68
+ return response.data
69
+ }
70
+
71
+ export async function fetchGroupList() {
72
+ const response = await client.query({
73
+ query: gql`
74
+ {
75
+ groups {
76
+ items {
77
+ id
78
+ name
79
+ description
80
+ createdAt
81
+ updatedAt
82
+ }
83
+ total
84
+ }
85
+ }
86
+ `
87
+ })
88
+
89
+ return response.data
90
+ }
91
+
92
+ export async function createGroup(group: BoardGroup) {
93
+ const response = await client.mutate({
94
+ mutation: gql`
95
+ mutation CreateGroup($group: NewGroup!) {
96
+ createGroup(group: $group) {
97
+ id
98
+ name
99
+ description
100
+ createdAt
101
+ updatedAt
102
+ }
103
+ }
104
+ `,
105
+ variables: { group }
106
+ })
107
+
108
+ return response.data
109
+ }
110
+
111
+ export async function joinGroup(boardId: string, groupId: string) {
112
+ const response = await client.mutate({
113
+ mutation: gql`
114
+ mutation JoinGroup($id: String!, $boardIds: [String!]!) {
115
+ joinGroup(id: $id, boardIds: $boardIds) {
116
+ id
117
+ name
118
+ description
119
+ boards {
120
+ id
121
+ name
122
+ description
123
+ createdAt
124
+ updatedAt
125
+ }
126
+ createdAt
127
+ updatedAt
128
+ }
129
+ }
130
+ `,
131
+ variables: {
132
+ id: groupId,
133
+ boardIds: [boardId]
134
+ }
135
+ })
136
+
137
+ return response.data
138
+ }
@@ -0,0 +1,4 @@
1
+ export * from './board'
2
+ export * from './group'
3
+ export * from './play-group'
4
+ export * from './favorite-board'
@@ -0,0 +1,189 @@
1
+ import { PlayGroup } from '../types'
2
+ import { client } from '@operato/graphql'
3
+ import gql from 'graphql-tag'
4
+
5
+ export async function fetchPlayGroupList() {
6
+ const response = await client.query({
7
+ query: gql`
8
+ {
9
+ playGroups {
10
+ items {
11
+ id
12
+ name
13
+ description
14
+ }
15
+ total
16
+ }
17
+ }
18
+ `
19
+ })
20
+
21
+ return response.data
22
+ }
23
+
24
+ export async function fetchPlayGroup(groupId: string) {
25
+ const response = await client.query({
26
+ query: gql`
27
+ query FetchPlayGroup($id: String!) {
28
+ playGroup(id: $id) {
29
+ id
30
+ name
31
+ description
32
+ boards {
33
+ id
34
+ name
35
+ description
36
+ model
37
+ thumbnail
38
+ createdAt
39
+ creator {
40
+ id
41
+ name
42
+ }
43
+ updatedAt
44
+ updater {
45
+ id
46
+ name
47
+ }
48
+ }
49
+ createdAt
50
+ creator {
51
+ id
52
+ name
53
+ }
54
+ updatedAt
55
+ updater {
56
+ id
57
+ name
58
+ }
59
+ }
60
+ }
61
+ `,
62
+ variables: {
63
+ id: groupId
64
+ }
65
+ })
66
+
67
+ return response.data
68
+ }
69
+
70
+ export async function createPlayGroup(group: PlayGroup) {
71
+ var { name, description } = group
72
+
73
+ const response = await client.mutate({
74
+ mutation: gql`
75
+ mutation CreatePlayGroup($playGroup: NewPlayGroup!) {
76
+ createPlayGroup(playGroup: $playGroup) {
77
+ id
78
+ name
79
+ description
80
+ createdAt
81
+ updatedAt
82
+ }
83
+ }
84
+ `,
85
+ variables: {
86
+ playGroup: { name, description }
87
+ }
88
+ })
89
+
90
+ return response.data
91
+ }
92
+
93
+ export async function updatePlayGroup(group: PlayGroup) {
94
+ var { id, name, description } = group
95
+
96
+ const response = await client.mutate({
97
+ mutation: gql`
98
+ mutation UpdatePlayGroup($id: String!, $patch: PlayGroupPatch!) {
99
+ updatePlayGroup(id: $id, patch: $patch) {
100
+ id
101
+ name
102
+ description
103
+ createdAt
104
+ updatedAt
105
+ }
106
+ }
107
+ `,
108
+ variables: {
109
+ id,
110
+ patch: { name, description }
111
+ }
112
+ })
113
+
114
+ return response.data
115
+ }
116
+
117
+ export async function deletePlayGroup(id: string) {
118
+ const response = await client.mutate({
119
+ mutation: gql`
120
+ mutation ($id: String!) {
121
+ deletePlayGroup(id: $id)
122
+ }
123
+ `,
124
+ variables: {
125
+ id
126
+ }
127
+ })
128
+ return response.data
129
+ }
130
+
131
+ export async function joinPlayGroup(boardId: string, group: PlayGroup) {
132
+ var { id, name, description } = group
133
+
134
+ const response = await client.mutate({
135
+ mutation: gql`
136
+ mutation JoinPlayGroup($id: String!, $boardIds: [String!]!) {
137
+ joinPlayGroup(id: $id, boardIds: $boardIds) {
138
+ id
139
+ name
140
+ description
141
+ boards {
142
+ id
143
+ name
144
+ description
145
+ createdAt
146
+ updatedAt
147
+ }
148
+ createdAt
149
+ updatedAt
150
+ }
151
+ }
152
+ `,
153
+ variables: {
154
+ id,
155
+ boardIds: [boardId]
156
+ }
157
+ })
158
+
159
+ return response.data
160
+ }
161
+
162
+ export async function leavePlayGroup(boardId: string, groupId: string) {
163
+ const response = await client.mutate({
164
+ mutation: gql`
165
+ mutation ($id: String!, $boardIds: [String]!) {
166
+ leavePlayGroup(id: $id, boardIds: $boardIds) {
167
+ id
168
+ name
169
+ description
170
+ boards {
171
+ id
172
+ name
173
+ description
174
+ createdAt
175
+ updatedAt
176
+ }
177
+ createdAt
178
+ updatedAt
179
+ }
180
+ }
181
+ `,
182
+ variables: {
183
+ id: groupId,
184
+ boardIds: [boardId]
185
+ }
186
+ })
187
+
188
+ return response.data
189
+ }
@@ -2,7 +2,9 @@
2
2
  * @license Copyright © HatioLab Inc. All rights reserved.
3
3
  */
4
4
 
5
- import { css, html, LitElement, PropertyValues } from 'lit'
5
+ import '@operato/markdown'
6
+
7
+ import { LitElement, css, html } from 'lit'
6
8
  import { customElement, property } from 'lit/decorators.js'
7
9
 
8
10
  import { ScrollbarStyles } from '@operato/styles'
@@ -19,7 +21,7 @@ class ComponentDetail extends LitElement {
19
21
 
20
22
  background-color: var(--component-detail-background-color, white);
21
23
  margin: 0px;
22
- padding: 0px;
24
+ padding: 10px;
23
25
 
24
26
  width: 360px;
25
27
  height: 100%;
@@ -35,7 +37,7 @@ class ComponentDetail extends LitElement {
35
37
  z-index: 1;
36
38
  }
37
39
 
38
- iframe {
40
+ ox-markdown {
39
41
  flex: 1;
40
42
  }
41
43
  `
@@ -44,10 +46,8 @@ class ComponentDetail extends LitElement {
44
46
  @property({ type: Object }) template: { about: string } | null = null
45
47
 
46
48
  render() {
47
- const { about = '/helps/board-modeller/effects/animation.md' } = this.template || {}
49
+ const { about } = this.template || {}
48
50
 
49
- return this.template ? html` <iframe .src=${about}></iframe> ` : html``
51
+ return html` <ox-markdown .src=${about}></ox-markdown> `
50
52
  }
51
-
52
- updated(changes: PropertyValues<this>) {}
53
53
  }
@@ -4,14 +4,13 @@
4
4
 
5
5
  import './component-detail'
6
6
 
7
- import { css, html, LitElement, PropertyValues } from 'lit'
7
+ import { LitElement, PropertyValues, css, html } from 'lit'
8
+ import { Pallet, PalletItem } from '../../types'
8
9
  import { customElement, property, query, state } from 'lit/decorators.js'
9
10
 
10
11
  import { Scene } from '@hatiolab/things-scene'
11
12
  import { ScrollbarStyles } from '@operato/styles'
12
-
13
13
  import noImage from '../../../../assets/images/components/no-image.png'
14
- import { Pallet, PalletItem } from '../../types'
15
14
 
16
15
  @customElement('component-menu')
17
16
  class ComponentMenu extends LitElement {
@@ -174,8 +173,6 @@ class ComponentMenu extends LitElement {
174
173
  return
175
174
  }
176
175
 
177
- // var group = this.groups.find(g => g.name == this.group)
178
-
179
176
  if (this.scene) {
180
177
  this.template = this.templates.find(template => template.type == type)
181
178
  this.template && this.scene.add(JSON.parse(JSON.stringify(this.template.model)), { cx: 200, cy: 200 })