@operato/board 8.0.0-beta.0 → 8.0.0-beta.1
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 +9 -0
- package/package.json +14 -14
- package/.storybook/main.js +0 -3
- package/.storybook/server.mjs +0 -8
- package/src/component/3d.ts +0 -29
- package/src/component/chart-and-gauge.ts +0 -28
- package/src/component/container.ts +0 -63
- package/src/component/data-source.ts +0 -30
- package/src/component/etc.ts +0 -88
- package/src/component/form.ts +0 -42
- package/src/component/index.ts +0 -12
- package/src/component/iot.ts +0 -52
- package/src/component/line.ts +0 -156
- package/src/component/register-default-groups.ts +0 -28
- package/src/component/shape.ts +0 -156
- package/src/component/table.ts +0 -28
- package/src/component/text-and-media.ts +0 -125
- package/src/component/warehouse.ts +0 -26
- package/src/data-storage/data-storage.ts +0 -76
- package/src/graphql/board.ts +0 -144
- package/src/graphql/data-subscription.ts +0 -30
- package/src/graphql/favorite-board.ts +0 -25
- package/src/graphql/group.ts +0 -138
- package/src/graphql/index.ts +0 -4
- package/src/graphql/play-group.ts +0 -225
- package/src/graphql/scenario.ts +0 -79
- package/src/index.ts +0 -10
- package/src/modeller/component-toolbar/component-detail.ts +0 -52
- package/src/modeller/component-toolbar/component-menu.ts +0 -196
- package/src/modeller/component-toolbar/component-toolbar.ts +0 -196
- package/src/modeller/component-toolbar/mode-icons.ts +0 -88
- package/src/modeller/edit-toolbar-style.ts +0 -232
- package/src/modeller/edit-toolbar.ts +0 -587
- package/src/modeller/property-sidebar/abstract-property.ts +0 -69
- package/src/modeller/property-sidebar/data-binding/data-binding-mapper.ts +0 -475
- package/src/modeller/property-sidebar/data-binding/data-binding-value-map.ts +0 -19
- package/src/modeller/property-sidebar/data-binding/data-binding-value-range.ts +0 -19
- package/src/modeller/property-sidebar/data-binding/data-binding.ts +0 -480
- package/src/modeller/property-sidebar/effects/effects-shared-style.ts +0 -62
- package/src/modeller/property-sidebar/effects/effects.ts +0 -69
- package/src/modeller/property-sidebar/effects/property-animation.ts +0 -146
- package/src/modeller/property-sidebar/effects/property-animations.ts +0 -93
- package/src/modeller/property-sidebar/effects/property-event-hover.ts +0 -200
- package/src/modeller/property-sidebar/effects/property-event-tap.ts +0 -251
- package/src/modeller/property-sidebar/effects/property-event.ts +0 -73
- package/src/modeller/property-sidebar/effects/property-shadow.ts +0 -114
- package/src/modeller/property-sidebar/effects/value-converter.ts +0 -23
- package/src/modeller/property-sidebar/inspector/inspector.ts +0 -404
- package/src/modeller/property-sidebar/property-shared-style.ts +0 -136
- package/src/modeller/property-sidebar/property-sidebar.ts +0 -326
- package/src/modeller/property-sidebar/shapes/box-padding-editor-styles.ts +0 -94
- package/src/modeller/property-sidebar/shapes/shapes.ts +0 -432
- package/src/modeller/property-sidebar/specifics/specific-properties-builder.ts +0 -152
- package/src/modeller/property-sidebar/specifics/specifics.ts +0 -81
- package/src/modeller/property-sidebar/styles/styles.ts +0 -577
- package/src/modeller/scene-viewer/confidential-overlay.ts +0 -18
- package/src/modeller/scene-viewer/ox-scene-handler.ts +0 -40
- package/src/modeller/scene-viewer/ox-scene-layer.ts +0 -42
- package/src/modeller/scene-viewer/ox-scene-property.ts +0 -10
- package/src/modeller/scene-viewer/ox-scene-viewer.ts +0 -263
- package/src/ox-board-component-info.ts +0 -236
- package/src/ox-board-list.ts +0 -401
- package/src/ox-board-modeller.ts +0 -408
- package/src/ox-board-player-style.ts +0 -200
- package/src/ox-board-player.ts +0 -333
- package/src/ox-board-template-list.ts +0 -267
- package/src/ox-board-template-viewer.ts +0 -198
- package/src/ox-board-viewer.ts +0 -727
- package/src/ox-editor-board-selector.ts +0 -91
- package/src/ox-property-editor-board-selector.ts +0 -23
- package/src/player/ox-board-player-carousel.ts +0 -197
- package/src/player/ox-board-player-grid.ts +0 -78
- package/src/player/ox-board-wrapper.ts +0 -152
- package/src/selector/board-creation-popup.ts +0 -151
- package/src/selector/board-thumbnail-card.ts +0 -175
- package/src/selector/ox-board-creation-card.ts +0 -98
- package/src/selector/ox-board-selector.ts +0 -382
- package/src/types.ts +0 -63
- package/stories/property-data-binding.stories.ts +0 -34
- package/tsconfig.json +0 -24
- package/web-dev-server.config.mjs +0 -30
- package/web-test-runner.config.mjs +0 -29
package/src/graphql/group.ts
DELETED
@@ -1,138 +0,0 @@
|
|
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
|
-
}
|
package/src/graphql/index.ts
DELETED
@@ -1,225 +0,0 @@
|
|
1
|
-
import { PlayGroup } from '../types'
|
2
|
-
import { client } from '@operato/graphql'
|
3
|
-
import gql from 'graphql-tag'
|
4
|
-
|
5
|
-
export async function playlists(): Promise<{ name: string; description: string }[]> {
|
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.playGroups.items
|
22
|
-
}
|
23
|
-
|
24
|
-
export async function fetchPlayGroupList() {
|
25
|
-
const response = await client.query({
|
26
|
-
query: gql`
|
27
|
-
{
|
28
|
-
playGroups {
|
29
|
-
items {
|
30
|
-
id
|
31
|
-
name
|
32
|
-
description
|
33
|
-
}
|
34
|
-
total
|
35
|
-
}
|
36
|
-
}
|
37
|
-
`
|
38
|
-
})
|
39
|
-
|
40
|
-
return response.data
|
41
|
-
}
|
42
|
-
|
43
|
-
export async function fetchPlayGroup(groupId: string) {
|
44
|
-
const response = await client.query({
|
45
|
-
query: gql`
|
46
|
-
query FetchPlayGroup($id: String!) {
|
47
|
-
playGroup(id: $id) {
|
48
|
-
id
|
49
|
-
name
|
50
|
-
description
|
51
|
-
boards {
|
52
|
-
id
|
53
|
-
name
|
54
|
-
description
|
55
|
-
model
|
56
|
-
thumbnail
|
57
|
-
createdAt
|
58
|
-
creator {
|
59
|
-
id
|
60
|
-
name
|
61
|
-
}
|
62
|
-
updatedAt
|
63
|
-
updater {
|
64
|
-
id
|
65
|
-
name
|
66
|
-
}
|
67
|
-
}
|
68
|
-
createdAt
|
69
|
-
creator {
|
70
|
-
id
|
71
|
-
name
|
72
|
-
}
|
73
|
-
updatedAt
|
74
|
-
updater {
|
75
|
-
id
|
76
|
-
name
|
77
|
-
}
|
78
|
-
}
|
79
|
-
}
|
80
|
-
`,
|
81
|
-
variables: {
|
82
|
-
id: groupId
|
83
|
-
}
|
84
|
-
})
|
85
|
-
|
86
|
-
return response.data
|
87
|
-
}
|
88
|
-
|
89
|
-
export async function fetchPlayGroupByName(name: string) {
|
90
|
-
const response = await client.query({
|
91
|
-
query: gql`
|
92
|
-
query FetchPlayGroupByName($name: String!) {
|
93
|
-
playGroupByName(name: $name) {
|
94
|
-
id
|
95
|
-
}
|
96
|
-
}
|
97
|
-
`,
|
98
|
-
variables: {
|
99
|
-
name
|
100
|
-
}
|
101
|
-
})
|
102
|
-
|
103
|
-
return response.data.playGroupByName
|
104
|
-
}
|
105
|
-
|
106
|
-
export async function createPlayGroup(group: PlayGroup) {
|
107
|
-
var { name, description } = group
|
108
|
-
|
109
|
-
const response = await client.mutate({
|
110
|
-
mutation: gql`
|
111
|
-
mutation CreatePlayGroup($playGroup: NewPlayGroup!) {
|
112
|
-
createPlayGroup(playGroup: $playGroup) {
|
113
|
-
id
|
114
|
-
name
|
115
|
-
description
|
116
|
-
createdAt
|
117
|
-
updatedAt
|
118
|
-
}
|
119
|
-
}
|
120
|
-
`,
|
121
|
-
variables: {
|
122
|
-
playGroup: { name, description }
|
123
|
-
}
|
124
|
-
})
|
125
|
-
|
126
|
-
return response.data
|
127
|
-
}
|
128
|
-
|
129
|
-
export async function updatePlayGroup(group: PlayGroup) {
|
130
|
-
var { id, name, description } = group
|
131
|
-
|
132
|
-
const response = await client.mutate({
|
133
|
-
mutation: gql`
|
134
|
-
mutation UpdatePlayGroup($id: String!, $patch: PlayGroupPatch!) {
|
135
|
-
updatePlayGroup(id: $id, patch: $patch) {
|
136
|
-
id
|
137
|
-
name
|
138
|
-
description
|
139
|
-
createdAt
|
140
|
-
updatedAt
|
141
|
-
}
|
142
|
-
}
|
143
|
-
`,
|
144
|
-
variables: {
|
145
|
-
id,
|
146
|
-
patch: { name, description }
|
147
|
-
}
|
148
|
-
})
|
149
|
-
|
150
|
-
return response.data
|
151
|
-
}
|
152
|
-
|
153
|
-
export async function deletePlayGroup(id: string) {
|
154
|
-
const response = await client.mutate({
|
155
|
-
mutation: gql`
|
156
|
-
mutation ($id: String!) {
|
157
|
-
deletePlayGroup(id: $id)
|
158
|
-
}
|
159
|
-
`,
|
160
|
-
variables: {
|
161
|
-
id
|
162
|
-
}
|
163
|
-
})
|
164
|
-
return response.data
|
165
|
-
}
|
166
|
-
|
167
|
-
export async function joinPlayGroup(boardId: string, group: PlayGroup) {
|
168
|
-
var { id, name, description } = group
|
169
|
-
|
170
|
-
const response = await client.mutate({
|
171
|
-
mutation: gql`
|
172
|
-
mutation JoinPlayGroup($id: String!, $boardIds: [String!]!) {
|
173
|
-
joinPlayGroup(id: $id, boardIds: $boardIds) {
|
174
|
-
id
|
175
|
-
name
|
176
|
-
description
|
177
|
-
boards {
|
178
|
-
id
|
179
|
-
name
|
180
|
-
description
|
181
|
-
createdAt
|
182
|
-
updatedAt
|
183
|
-
}
|
184
|
-
createdAt
|
185
|
-
updatedAt
|
186
|
-
}
|
187
|
-
}
|
188
|
-
`,
|
189
|
-
variables: {
|
190
|
-
id,
|
191
|
-
boardIds: [boardId]
|
192
|
-
}
|
193
|
-
})
|
194
|
-
|
195
|
-
return response.data
|
196
|
-
}
|
197
|
-
|
198
|
-
export async function leavePlayGroup(boardId: string, groupId: string) {
|
199
|
-
const response = await client.mutate({
|
200
|
-
mutation: gql`
|
201
|
-
mutation ($id: String!, $boardIds: [String]!) {
|
202
|
-
leavePlayGroup(id: $id, boardIds: $boardIds) {
|
203
|
-
id
|
204
|
-
name
|
205
|
-
description
|
206
|
-
boards {
|
207
|
-
id
|
208
|
-
name
|
209
|
-
description
|
210
|
-
createdAt
|
211
|
-
updatedAt
|
212
|
-
}
|
213
|
-
createdAt
|
214
|
-
updatedAt
|
215
|
-
}
|
216
|
-
}
|
217
|
-
`,
|
218
|
-
variables: {
|
219
|
-
id: groupId,
|
220
|
-
boardIds: [boardId]
|
221
|
-
}
|
222
|
-
})
|
223
|
-
|
224
|
-
return response.data
|
225
|
-
}
|
package/src/graphql/scenario.ts
DELETED
@@ -1,79 +0,0 @@
|
|
1
|
-
import gql from 'graphql-tag'
|
2
|
-
|
3
|
-
import { client } from '@operato/graphql'
|
4
|
-
|
5
|
-
export const scenarios = async (): Promise<{ name: string; description: string }[]> => {
|
6
|
-
var response = await client.query({
|
7
|
-
query: gql`
|
8
|
-
query {
|
9
|
-
scenarios {
|
10
|
-
items {
|
11
|
-
name
|
12
|
-
description
|
13
|
-
}
|
14
|
-
}
|
15
|
-
}
|
16
|
-
`
|
17
|
-
})
|
18
|
-
|
19
|
-
if (response.errors) {
|
20
|
-
return []
|
21
|
-
}
|
22
|
-
|
23
|
-
return response.data.scenarios.items
|
24
|
-
}
|
25
|
-
|
26
|
-
export const startScenario = async (
|
27
|
-
scenarioName: string,
|
28
|
-
instanceName: string,
|
29
|
-
variables: string | number | object
|
30
|
-
) => {
|
31
|
-
if (!scenarioName) {
|
32
|
-
return
|
33
|
-
}
|
34
|
-
|
35
|
-
if (client) {
|
36
|
-
var response = await client.query({
|
37
|
-
query: gql`
|
38
|
-
mutation ($instanceName: String, $scenarioName: String!, $variables: Object) {
|
39
|
-
startScenario(instanceName: $instanceName, scenarioName: $scenarioName, variables: $variables) {
|
40
|
-
state
|
41
|
-
message
|
42
|
-
data
|
43
|
-
}
|
44
|
-
}
|
45
|
-
`,
|
46
|
-
variables: {
|
47
|
-
instanceName: instanceName,
|
48
|
-
scenarioName: scenarioName,
|
49
|
-
variables
|
50
|
-
}
|
51
|
-
})
|
52
|
-
|
53
|
-
return response?.data?.startScenario?.data
|
54
|
-
}
|
55
|
-
}
|
56
|
-
|
57
|
-
export const runScenario = async (scenarioName: string, variables: string | number | object) => {
|
58
|
-
if (!scenarioName) return
|
59
|
-
|
60
|
-
if (client) {
|
61
|
-
var response = await client.query({
|
62
|
-
query: gql`
|
63
|
-
mutation ($scenarioName: String!, $variables: Object) {
|
64
|
-
runScenario(scenarioName: $scenarioName, variables: $variables) {
|
65
|
-
state
|
66
|
-
message
|
67
|
-
data
|
68
|
-
}
|
69
|
-
}
|
70
|
-
`,
|
71
|
-
variables: {
|
72
|
-
scenarioName: scenarioName,
|
73
|
-
variables
|
74
|
-
}
|
75
|
-
})
|
76
|
-
|
77
|
-
return response?.data?.runScenario?.data
|
78
|
-
}
|
79
|
-
}
|
package/src/index.ts
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
export * from './types.js'
|
2
|
-
|
3
|
-
export { registerDefaultGroups } from './component/register-default-groups.js'
|
4
|
-
export { BoardDataStorage, PlaylistStorage } from './data-storage/data-storage.js'
|
5
|
-
|
6
|
-
export * from './ox-board-viewer.js'
|
7
|
-
export * from './ox-board-player.js'
|
8
|
-
export * from './ox-board-modeller.js'
|
9
|
-
export * from './ox-board-list.js'
|
10
|
-
export * from './ox-board-template-viewer.js'
|
@@ -1,52 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright © HatioLab Inc. All rights reserved.
|
3
|
-
*/
|
4
|
-
|
5
|
-
import '@operato/markdown'
|
6
|
-
|
7
|
-
import { css, html, LitElement } from 'lit'
|
8
|
-
import { property } from 'lit/decorators.js'
|
9
|
-
|
10
|
-
import { ScrollbarStyles } from '@operato/styles'
|
11
|
-
|
12
|
-
export class ComponentDetail extends LitElement {
|
13
|
-
static styles = [
|
14
|
-
ScrollbarStyles,
|
15
|
-
css`
|
16
|
-
:host {
|
17
|
-
display: flex;
|
18
|
-
flex-direction: column;
|
19
|
-
align-content: stretch;
|
20
|
-
|
21
|
-
background-color: var(--component-detail-background-color, white);
|
22
|
-
margin: 0px;
|
23
|
-
padding: 10px;
|
24
|
-
|
25
|
-
width: 360px;
|
26
|
-
height: 100%;
|
27
|
-
|
28
|
-
overflow: hidden;
|
29
|
-
|
30
|
-
border: 2px solid var(--component-detail-border-color);
|
31
|
-
box-sizing: border-box;
|
32
|
-
|
33
|
-
position: absolute;
|
34
|
-
top: 0px;
|
35
|
-
|
36
|
-
z-index: 1;
|
37
|
-
}
|
38
|
-
|
39
|
-
ox-markdown {
|
40
|
-
flex: 1;
|
41
|
-
}
|
42
|
-
`
|
43
|
-
]
|
44
|
-
|
45
|
-
@property({ type: Object }) template: { about: string } | null = null
|
46
|
-
|
47
|
-
render() {
|
48
|
-
const { about } = this.template || {}
|
49
|
-
|
50
|
-
return html` <ox-markdown .src=${about}></ox-markdown> `
|
51
|
-
}
|
52
|
-
}
|
@@ -1,196 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright © HatioLab Inc. All rights reserved.
|
3
|
-
*/
|
4
|
-
|
5
|
-
import { css, html, LitElement, PropertyValues } from 'lit'
|
6
|
-
import { property, query, state } from 'lit/decorators.js'
|
7
|
-
|
8
|
-
import { Scene } from '@hatiolab/things-scene'
|
9
|
-
import { ScopedElementsMixin } from '@open-wc/scoped-elements'
|
10
|
-
import { ScrollbarStyles } from '@operato/styles'
|
11
|
-
import { i18next } from '@operato/i18n'
|
12
|
-
|
13
|
-
import { Pallet, PalletItem } from '../../types'
|
14
|
-
import { ComponentDetail } from './component-detail'
|
15
|
-
|
16
|
-
const noImage = new URL('../../../../icons/components/no-image.png', import.meta.url).href
|
17
|
-
|
18
|
-
export class ComponentMenu extends ScopedElementsMixin(LitElement) {
|
19
|
-
static styles = [
|
20
|
-
ScrollbarStyles,
|
21
|
-
css`
|
22
|
-
:host {
|
23
|
-
display: flex;
|
24
|
-
flex-direction: column;
|
25
|
-
align-content: stretch;
|
26
|
-
|
27
|
-
background-color: var(--component-menu-background-color, var(--md-sys-color-secondary-container));
|
28
|
-
color: var(--component-menu-color, var(--md-sys-color-on-secondary-container));
|
29
|
-
margin: 0px;
|
30
|
-
padding: 0px;
|
31
|
-
|
32
|
-
width: 180px;
|
33
|
-
height: 100%;
|
34
|
-
|
35
|
-
overflow: visible;
|
36
|
-
|
37
|
-
border: 2px solid var(--component-menu-border-color, var(--md-sys-color-secondary));
|
38
|
-
box-sizing: border-box;
|
39
|
-
|
40
|
-
position: absolute;
|
41
|
-
top: 0px;
|
42
|
-
|
43
|
-
z-index: 1;
|
44
|
-
}
|
45
|
-
|
46
|
-
h2 {
|
47
|
-
background-color: var(--component-menu-border-color, var(--md-sys-color-secondary));
|
48
|
-
padding: 1px 5px;
|
49
|
-
margin: 0;
|
50
|
-
font: var(--component-menu-title);
|
51
|
-
color: var(--md-sys-color-on-secondary);
|
52
|
-
text-transform: capitalize;
|
53
|
-
}
|
54
|
-
|
55
|
-
[templates] {
|
56
|
-
flex: 1;
|
57
|
-
|
58
|
-
display: block;
|
59
|
-
margin: 0;
|
60
|
-
padding: 0;
|
61
|
-
overflow-y: auto;
|
62
|
-
|
63
|
-
background-color: var(--component-menu-background-color, var(--md-sys-color-secondary-container));
|
64
|
-
color: var(--component-menu-color, var(--md-sys-color-on-secondary-container));
|
65
|
-
}
|
66
|
-
|
67
|
-
[template] {
|
68
|
-
display: flex;
|
69
|
-
align-items: center;
|
70
|
-
min-height: var(--component-menu-item-icon-size);
|
71
|
-
padding: 0 5px 0 0;
|
72
|
-
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
|
73
|
-
font-size: 11px;
|
74
|
-
color: var(--component-menu-item-color, var(--md-sys-color-on-secondary-container));
|
75
|
-
text-transform: capitalize;
|
76
|
-
}
|
77
|
-
|
78
|
-
[template]:hover,
|
79
|
-
[template]:focus {
|
80
|
-
color: var(--component-menu-item-hover-color, var(--md-sys-color-secondary));
|
81
|
-
font-weight: bold;
|
82
|
-
cursor: pointer;
|
83
|
-
}
|
84
|
-
|
85
|
-
[template] img {
|
86
|
-
margin: 5px;
|
87
|
-
width: var(--component-menu-item-icon-size);
|
88
|
-
height: var(--component-menu-item-icon-size);
|
89
|
-
}
|
90
|
-
|
91
|
-
component-detail {
|
92
|
-
position: absolute;
|
93
|
-
top: 0;
|
94
|
-
left: 180px;
|
95
|
-
height: 100%;
|
96
|
-
outline: none;
|
97
|
-
}
|
98
|
-
|
99
|
-
component-detail[hidden] {
|
100
|
-
display: none;
|
101
|
-
}
|
102
|
-
`
|
103
|
-
]
|
104
|
-
|
105
|
-
@property({ type: Object }) groups: Pallet[] = []
|
106
|
-
@property({ type: Object }) scene: Scene | null = null
|
107
|
-
@property({ type: String }) group: string | null = ''
|
108
|
-
|
109
|
-
@state() templates: PalletItem[] = []
|
110
|
-
@state() template: PalletItem | any
|
111
|
-
|
112
|
-
@query('component-detail') detail!: HTMLElement
|
113
|
-
|
114
|
-
static get scopedElements() {
|
115
|
-
return {
|
116
|
-
'component-detail': ComponentDetail
|
117
|
-
}
|
118
|
-
}
|
119
|
-
|
120
|
-
render() {
|
121
|
-
return this.group
|
122
|
-
? html`
|
123
|
-
<h2 onclick=${(e: MouseEvent) => e.stopPropagation()}>${this.group} list</h2>
|
124
|
-
|
125
|
-
<div templates @mouseover=${(e: MouseEvent) => this.onHoverComponent(e)}>
|
126
|
-
${(this.templates || []).map(template => {
|
127
|
-
const { type } = template
|
128
|
-
|
129
|
-
return html`
|
130
|
-
<div @click=${this.onClickTemplate} data-type=${type} template>
|
131
|
-
<img src=${String(this.templateIcon(template))} />${i18next.t(`component.${type}`)}
|
132
|
-
</div>
|
133
|
-
`
|
134
|
-
})}
|
135
|
-
</div>
|
136
|
-
|
137
|
-
<component-detail
|
138
|
-
tabindex="-1"
|
139
|
-
@focusout=${() => {
|
140
|
-
this.template = null
|
141
|
-
}}
|
142
|
-
.template=${this.template}
|
143
|
-
hidden
|
144
|
-
>
|
145
|
-
</component-detail>
|
146
|
-
`
|
147
|
-
: html``
|
148
|
-
}
|
149
|
-
|
150
|
-
updated(changes: PropertyValues<this>) {
|
151
|
-
if (changes.has('group')) {
|
152
|
-
if (!this.group) {
|
153
|
-
this.templates = []
|
154
|
-
this.setAttribute('hidden', '')
|
155
|
-
} else {
|
156
|
-
this.templates = this.groups.find((g: Pallet) => g.name === this.group)?.templates || []
|
157
|
-
this.removeAttribute('active')
|
158
|
-
}
|
159
|
-
}
|
160
|
-
|
161
|
-
if (changes.has('template')) {
|
162
|
-
this.template && this.template.about
|
163
|
-
? this.detail.removeAttribute('hidden')
|
164
|
-
: this.detail.setAttribute('hidden', '')
|
165
|
-
}
|
166
|
-
}
|
167
|
-
|
168
|
-
findTemplate(type: string | null | undefined) {
|
169
|
-
this.template = type && this.templates.find(template => template.type == type)
|
170
|
-
}
|
171
|
-
|
172
|
-
onHoverComponent(e: MouseEvent) {
|
173
|
-
const button = e.target as HTMLElement
|
174
|
-
this.findTemplate(button!.closest('[data-type]')?.getAttribute('data-type'))
|
175
|
-
}
|
176
|
-
|
177
|
-
onClickTemplate(e: MouseEvent) {
|
178
|
-
var item = e.target as HTMLElement
|
179
|
-
var type = item.closest('[data-type]')?.getAttribute('data-type')
|
180
|
-
|
181
|
-
if (!type) {
|
182
|
-
return
|
183
|
-
}
|
184
|
-
|
185
|
-
if (this.scene) {
|
186
|
-
this.template = this.templates.find(template => template.type == type)
|
187
|
-
this.template && this.scene.startAddMode(JSON.parse(JSON.stringify(this.template.model)))
|
188
|
-
}
|
189
|
-
|
190
|
-
this.group = null
|
191
|
-
}
|
192
|
-
|
193
|
-
templateIcon(template: PalletItem) {
|
194
|
-
return template.icon || noImage
|
195
|
-
}
|
196
|
-
}
|