@operato/board 0.2.50 → 0.3.2
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 +52 -0
- package/custom-elements.json +2675 -1894
- package/demo/index.html +3 -3
- package/dist/src/component/3d.d.ts +2 -2
- package/dist/src/component/3d.js.map +1 -1
- package/dist/src/component/chart-and-gauge.d.ts +2 -2
- package/dist/src/component/chart-and-gauge.js.map +1 -1
- package/dist/src/component/container.d.ts +2 -2
- package/dist/src/component/container.js.map +1 -1
- package/dist/src/component/data-source.d.ts +2 -2
- package/dist/src/component/data-source.js.map +1 -1
- package/dist/src/component/etc.d.ts +2 -2
- package/dist/src/component/etc.js.map +1 -1
- package/dist/src/component/form.d.ts +2 -2
- package/dist/src/component/form.js.map +1 -1
- package/dist/src/component/iot.d.ts +2 -2
- package/dist/src/component/iot.js.map +1 -1
- package/dist/src/component/line.d.ts +2 -2
- package/dist/src/component/line.js.map +1 -1
- package/dist/src/component/shape.d.ts +2 -2
- package/dist/src/component/shape.js.map +1 -1
- package/dist/src/component/table.d.ts +2 -2
- package/dist/src/component/table.js.map +1 -1
- package/dist/src/component/text-and-media.d.ts +2 -2
- package/dist/src/component/text-and-media.js.map +1 -1
- package/dist/src/component/warehouse.d.ts +2 -2
- package/dist/src/component/warehouse.js.map +1 -1
- package/dist/src/graphql/board.d.ts +6 -0
- package/dist/src/graphql/board.js +130 -0
- package/dist/src/graphql/board.js.map +1 -0
- package/dist/src/graphql/favorite-board.d.ts +1 -0
- package/dist/src/graphql/favorite-board.js +23 -0
- package/dist/src/graphql/favorite-board.js.map +1 -0
- package/dist/src/graphql/group.d.ts +7 -0
- package/dist/src/graphql/group.js +125 -0
- package/dist/src/graphql/group.js.map +1 -0
- package/dist/src/graphql/index.d.ts +4 -0
- package/dist/src/graphql/index.js +5 -0
- package/dist/src/graphql/index.js.map +1 -0
- package/dist/src/graphql/play-group.d.ts +8 -0
- package/dist/src/graphql/play-group.js +173 -0
- package/dist/src/graphql/play-group.js.map +1 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.js +3 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/modeller/component-toolbar/component-toolbar.js +35 -1
- package/dist/src/modeller/component-toolbar/component-toolbar.js.map +1 -1
- package/dist/src/modeller/component-toolbar/mode-icons.d.ts +2 -0
- package/dist/src/modeller/component-toolbar/mode-icons.js +86 -0
- package/dist/src/modeller/component-toolbar/mode-icons.js.map +1 -0
- package/dist/src/modeller/property-sidebar/data-binding/data-binding-mapper.d.ts +2 -2
- package/dist/src/modeller/property-sidebar/data-binding/data-binding-mapper.js +4 -5
- package/dist/src/modeller/property-sidebar/data-binding/data-binding-mapper.js.map +1 -1
- package/dist/src/modeller/property-sidebar/data-binding/data-binding.d.ts +2 -2
- package/dist/src/modeller/property-sidebar/data-binding/data-binding.js +3 -3
- package/dist/src/modeller/property-sidebar/data-binding/data-binding.js.map +1 -1
- package/dist/src/modeller/property-sidebar/effects/effects.js +2 -2
- package/dist/src/modeller/property-sidebar/effects/effects.js.map +1 -1
- package/dist/src/modeller/property-sidebar/effects/property-animation.d.ts +1 -1
- package/dist/src/modeller/property-sidebar/effects/property-animation.js +2 -2
- package/dist/src/modeller/property-sidebar/effects/property-animation.js.map +1 -1
- package/dist/src/modeller/property-sidebar/effects/property-animations.js +2 -2
- package/dist/src/modeller/property-sidebar/effects/property-animations.js.map +1 -1
- package/dist/src/modeller/property-sidebar/effects/property-event-hover.d.ts +1 -1
- package/dist/src/modeller/property-sidebar/effects/property-event-hover.js +3 -3
- package/dist/src/modeller/property-sidebar/effects/property-event-hover.js.map +1 -1
- package/dist/src/modeller/property-sidebar/effects/property-event-tap.d.ts +1 -1
- package/dist/src/modeller/property-sidebar/effects/property-event-tap.js +3 -3
- package/dist/src/modeller/property-sidebar/effects/property-event-tap.js.map +1 -1
- package/dist/src/modeller/property-sidebar/effects/property-event.js +2 -2
- package/dist/src/modeller/property-sidebar/effects/property-event.js.map +1 -1
- package/dist/src/modeller/property-sidebar/effects/property-shadow.js +2 -2
- package/dist/src/modeller/property-sidebar/effects/property-shadow.js.map +1 -1
- package/dist/src/modeller/property-sidebar/inspector/inspector.d.ts +1 -1
- package/dist/src/modeller/property-sidebar/inspector/inspector.js +1 -1
- package/dist/src/modeller/property-sidebar/inspector/inspector.js.map +1 -1
- package/dist/src/modeller/property-sidebar/shapes/shapes.d.ts +2 -2
- package/dist/src/modeller/property-sidebar/shapes/shapes.js +3 -3
- package/dist/src/modeller/property-sidebar/shapes/shapes.js.map +1 -1
- package/dist/src/modeller/property-sidebar/specifics/specific-properties-builder.js +1 -1
- package/dist/src/modeller/property-sidebar/specifics/specific-properties-builder.js.map +1 -1
- package/dist/src/ox-board-list.d.ts +2 -0
- package/dist/src/ox-board-list.js +427 -0
- package/dist/src/ox-board-list.js.map +1 -0
- package/dist/src/ox-board-modeller.d.ts +5 -5
- package/dist/src/ox-board-modeller.js +3 -3
- package/dist/src/ox-board-modeller.js.map +1 -1
- package/dist/src/types.d.ts +18 -1
- package/dist/src/types.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +23 -10
- package/src/component/3d.ts +2 -2
- package/src/component/chart-and-gauge.ts +2 -2
- package/src/component/container.ts +2 -2
- package/src/component/data-source.ts +2 -2
- package/src/component/etc.ts +2 -2
- package/src/component/form.ts +2 -2
- package/src/component/iot.ts +2 -2
- package/src/component/line.ts +2 -2
- package/src/component/shape.ts +2 -2
- package/src/component/table.ts +2 -2
- package/src/component/text-and-media.ts +2 -2
- package/src/component/warehouse.ts +2 -2
- package/src/graphql/board.ts +144 -0
- package/src/graphql/favorite-board.ts +25 -0
- package/src/graphql/group.ts +138 -0
- package/src/graphql/index.ts +4 -0
- package/src/graphql/play-group.ts +189 -0
- package/src/index.ts +5 -0
- package/src/modeller/component-toolbar/component-toolbar.ts +42 -4
- package/src/modeller/component-toolbar/mode-icons.ts +86 -0
- package/src/modeller/property-sidebar/data-binding/data-binding-mapper.ts +5 -5
- package/src/modeller/property-sidebar/data-binding/data-binding.ts +5 -4
- package/src/modeller/property-sidebar/effects/effects.ts +2 -3
- package/src/modeller/property-sidebar/effects/property-animation.ts +2 -2
- package/src/modeller/property-sidebar/effects/property-animations.ts +2 -3
- package/src/modeller/property-sidebar/effects/property-event-hover.ts +4 -3
- package/src/modeller/property-sidebar/effects/property-event-tap.ts +4 -3
- package/src/modeller/property-sidebar/effects/property-event.ts +2 -3
- package/src/modeller/property-sidebar/effects/property-shadow.ts +2 -3
- package/src/modeller/property-sidebar/inspector/inspector.ts +1 -1
- package/src/modeller/property-sidebar/shapes/shapes.ts +3 -3
- package/src/modeller/property-sidebar/specifics/specific-properties-builder.ts +1 -1
- package/src/ox-board-list.ts +459 -0
- package/src/ox-board-modeller.ts +9 -8
- package/src/types.ts +21 -1
- package/tsconfig.json +1 -0
- package/web-dev-server.config.mjs +2 -0
- package/yarn-error.log +18355 -0
package/src/component/iot.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComponentGroup } from '../types'
|
|
2
2
|
|
|
3
3
|
const icon = `
|
|
4
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">
|
|
@@ -44,7 +44,7 @@ const icon = `
|
|
|
44
44
|
</svg>
|
|
45
45
|
`
|
|
46
46
|
|
|
47
|
-
export const iot:
|
|
47
|
+
export const iot: ComponentGroup = {
|
|
48
48
|
name: 'IoT',
|
|
49
49
|
description: 'a group of various IoT protocols',
|
|
50
50
|
icon,
|
package/src/component/line.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComponentGroup } from '../types'
|
|
2
2
|
import bothArrow from '../../../assets/images/components/both-arrow.png'
|
|
3
3
|
import dash from '../../../assets/images/components/dash.png'
|
|
4
4
|
import lineIcon from '../../../assets/images/components/line.png'
|
|
@@ -18,7 +18,7 @@ const icon = `
|
|
|
18
18
|
</svg>
|
|
19
19
|
`
|
|
20
20
|
|
|
21
|
-
export const line:
|
|
21
|
+
export const line: ComponentGroup = {
|
|
22
22
|
name: 'line',
|
|
23
23
|
description: 'a group of various lines',
|
|
24
24
|
icon,
|
package/src/component/shape.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComponentGroup } from '../types'
|
|
2
2
|
import donut from '../../../assets/images/components/donut.png'
|
|
3
3
|
import ellipse from '../../../assets/images/components/ellipse.png'
|
|
4
4
|
import polygon from '../../../assets/images/components/polygon.png'
|
|
@@ -18,7 +18,7 @@ const icon = `
|
|
|
18
18
|
</svg>
|
|
19
19
|
`
|
|
20
20
|
|
|
21
|
-
export const shape:
|
|
21
|
+
export const shape: ComponentGroup = {
|
|
22
22
|
name: 'shape',
|
|
23
23
|
description: 'a group of simple basic shapes',
|
|
24
24
|
icon,
|
package/src/component/table.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComponentGroup } from '../types'
|
|
2
2
|
|
|
3
3
|
const icon = `
|
|
4
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">
|
|
@@ -20,7 +20,7 @@ const icon = `
|
|
|
20
20
|
</svg>
|
|
21
21
|
`
|
|
22
22
|
|
|
23
|
-
export const table:
|
|
23
|
+
export const table: ComponentGroup = {
|
|
24
24
|
name: 'table',
|
|
25
25
|
description: 'a group of various tables',
|
|
26
26
|
icon,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComponentGroup } from '../types'
|
|
2
2
|
import audio from '../../../assets/images/components/audio.png'
|
|
3
3
|
import colorImage from '../../../assets/images/components/color-image.png'
|
|
4
4
|
import gifImage from '../../../assets/images/components/gif-image.png'
|
|
@@ -21,7 +21,7 @@ const icon = `
|
|
|
21
21
|
</svg>
|
|
22
22
|
`
|
|
23
23
|
|
|
24
|
-
export const textAndMedia:
|
|
24
|
+
export const textAndMedia: ComponentGroup = {
|
|
25
25
|
name: 'textAndMedia',
|
|
26
26
|
description: 'a group of text and various media components',
|
|
27
27
|
icon,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComponentGroup } from '../types'
|
|
2
2
|
|
|
3
3
|
const icon = `
|
|
4
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">
|
|
@@ -18,7 +18,7 @@ const icon = `
|
|
|
18
18
|
</svg>
|
|
19
19
|
`
|
|
20
20
|
|
|
21
|
-
export const warehouse:
|
|
21
|
+
export const warehouse: ComponentGroup = {
|
|
22
22
|
name: 'warehouse',
|
|
23
23
|
description: 'a group of various components used in a warehouse depiction',
|
|
24
24
|
icon,
|
|
@@ -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,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
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
import './component-menu'
|
|
6
6
|
|
|
7
|
+
import { ICON_EDIT_MODE, ICON_SHIFT_MODE } from './mode-icons'
|
|
7
8
|
import { LitElement, PropertyValues, css, html } from 'lit'
|
|
8
9
|
import { SCENE_MODE, Scene } from '@hatiolab/things-scene'
|
|
9
10
|
import { customElement, property, query, queryAll } from 'lit/decorators.js'
|
|
10
11
|
|
|
11
|
-
import {
|
|
12
|
+
import { ComponentGroup } from '../../types'
|
|
12
13
|
|
|
13
14
|
@customElement('component-toolbar')
|
|
14
15
|
class ComponentToolbar extends LitElement {
|
|
@@ -37,6 +38,10 @@ class ComponentToolbar extends LitElement {
|
|
|
37
38
|
box-sizing: border-box;
|
|
38
39
|
}
|
|
39
40
|
|
|
41
|
+
#shift[active] {
|
|
42
|
+
background-color: #beb9b3;
|
|
43
|
+
}
|
|
44
|
+
|
|
40
45
|
component-menu {
|
|
41
46
|
position: absolute;
|
|
42
47
|
top: 0;
|
|
@@ -51,11 +56,12 @@ class ComponentToolbar extends LitElement {
|
|
|
51
56
|
`
|
|
52
57
|
]
|
|
53
58
|
|
|
54
|
-
@property({ type: Array }) componentGroupList:
|
|
59
|
+
@property({ type: Array }) componentGroupList: ComponentGroup[] = []
|
|
55
60
|
@property({ type: String }) group?: string | null
|
|
56
61
|
@property({ type: Object }) scene!: Scene
|
|
57
|
-
@property({ type: Number }) mode: SCENE_MODE = SCENE_MODE.
|
|
62
|
+
@property({ type: Number }) mode: SCENE_MODE = SCENE_MODE.EDIT
|
|
58
63
|
|
|
64
|
+
@query('#shift') shift!: HTMLImageElement
|
|
59
65
|
@query('component-menu') private menu!: HTMLElement
|
|
60
66
|
@queryAll('[data-group]') private groups!: NodeListOf<HTMLElement>
|
|
61
67
|
|
|
@@ -67,11 +73,16 @@ class ComponentToolbar extends LitElement {
|
|
|
67
73
|
|
|
68
74
|
this.icons = (this.componentGroupList || [])
|
|
69
75
|
.filter(group => group.templates?.length > 0)
|
|
70
|
-
.reduce((sum, group:
|
|
76
|
+
.reduce((sum, group: ComponentGroup) => {
|
|
71
77
|
sum[group.name] =
|
|
72
78
|
'data:image/svg+xml;charset=UTF-8;base64,' + btoa(group.icon.replace(/{{strokeColor}}/g, color))
|
|
73
79
|
return sum
|
|
74
80
|
}, {} as { [name: string]: string })
|
|
81
|
+
|
|
82
|
+
this.icons['mode-edit'] =
|
|
83
|
+
'data:image/svg+xml;charset=UTF-8;base64,' + btoa(ICON_EDIT_MODE.replace(/{{strokeColor}}/g, color))
|
|
84
|
+
this.icons['mode-shift'] =
|
|
85
|
+
'data:image/svg+xml;charset=UTF-8;base64,' + btoa(ICON_SHIFT_MODE.replace(/{{strokeColor}}/g, color))
|
|
75
86
|
}
|
|
76
87
|
|
|
77
88
|
if (changes.has('group')) {
|
|
@@ -87,8 +98,11 @@ class ComponentToolbar extends LitElement {
|
|
|
87
98
|
|
|
88
99
|
render() {
|
|
89
100
|
const componentList = this.componentGroupList || []
|
|
101
|
+
const modeIcon = this.icons[this.mode === SCENE_MODE.EDIT ? 'mode-edit' : 'mode-shift']
|
|
90
102
|
|
|
91
103
|
return html`
|
|
104
|
+
<img id="shift" .src=${modeIcon} @click=${(e: MouseEvent) => this._onClickShift(e)} />
|
|
105
|
+
|
|
92
106
|
${componentList
|
|
93
107
|
.filter(group => group.templates?.length > 0)
|
|
94
108
|
.map(
|
|
@@ -115,6 +129,30 @@ class ComponentToolbar extends LitElement {
|
|
|
115
129
|
`
|
|
116
130
|
}
|
|
117
131
|
|
|
132
|
+
_setMode(mode: SCENE_MODE) {
|
|
133
|
+
this.mode = mode
|
|
134
|
+
|
|
135
|
+
this.dispatchEvent(
|
|
136
|
+
new CustomEvent('mode-changed', {
|
|
137
|
+
bubbles: true,
|
|
138
|
+
composed: true,
|
|
139
|
+
detail: { value: mode }
|
|
140
|
+
})
|
|
141
|
+
)
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
_onClickShift(e: MouseEvent) {
|
|
145
|
+
const shift = this.shift
|
|
146
|
+
|
|
147
|
+
if (shift.hasAttribute('active')) {
|
|
148
|
+
shift.removeAttribute('active')
|
|
149
|
+
this._setMode(SCENE_MODE.EDIT)
|
|
150
|
+
} else {
|
|
151
|
+
shift.setAttribute('active', '')
|
|
152
|
+
this._setMode(SCENE_MODE.SHIFT)
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
118
156
|
async _onClickGroup(e: MouseEvent) {
|
|
119
157
|
var button = e.target as HTMLElement
|
|
120
158
|
|