@operato/board 1.4.68 → 1.4.70
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/src/graphql/play-group.d.ts +5 -0
- package/dist/src/graphql/play-group.js +32 -0
- package/dist/src/graphql/play-group.js.map +1 -1
- package/dist/src/modeller/property-sidebar/effects/property-event-tap.d.ts +4 -0
- package/dist/src/modeller/property-sidebar/effects/property-event-tap.js +15 -2
- package/dist/src/modeller/property-sidebar/effects/property-event-tap.js.map +1 -1
- package/dist/src/ox-board-viewer.d.ts +2 -0
- package/dist/src/ox-board-viewer.js +16 -0
- package/dist/src/ox-board-viewer.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/graphql/play-group.ts +36 -0
- package/src/modeller/property-sidebar/effects/property-event-tap.ts +11 -2
- package/src/ox-board-viewer.ts +17 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@operato/board",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.70",
|
|
4
4
|
"description": "Webcomponent for board following open-wc recommendations",
|
|
5
5
|
"author": "heartyoh",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -148,5 +148,5 @@
|
|
|
148
148
|
"prettier --write"
|
|
149
149
|
]
|
|
150
150
|
},
|
|
151
|
-
"gitHead": "
|
|
151
|
+
"gitHead": "54b9782f1806073281637fe3211e1eea1c7a5606"
|
|
152
152
|
}
|
|
@@ -2,6 +2,25 @@ import { PlayGroup } from '../types'
|
|
|
2
2
|
import { client } from '@operato/graphql'
|
|
3
3
|
import gql from 'graphql-tag'
|
|
4
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
|
+
|
|
5
24
|
export async function fetchPlayGroupList() {
|
|
6
25
|
const response = await client.query({
|
|
7
26
|
query: gql`
|
|
@@ -67,6 +86,23 @@ export async function fetchPlayGroup(groupId: string) {
|
|
|
67
86
|
return response.data
|
|
68
87
|
}
|
|
69
88
|
|
|
89
|
+
export async function fetchPlayGroupByName(name: string) {
|
|
90
|
+
const response = await client.query({
|
|
91
|
+
query: gql`
|
|
92
|
+
query FetchPlayGroupByName($id: String!) {
|
|
93
|
+
playGroupByName(name: $name) {
|
|
94
|
+
id
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
`,
|
|
98
|
+
variables: {
|
|
99
|
+
name
|
|
100
|
+
}
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
return response.data.playGroupByName
|
|
104
|
+
}
|
|
105
|
+
|
|
70
106
|
export async function createPlayGroup(group: PlayGroup) {
|
|
71
107
|
var { name, description } = group
|
|
72
108
|
|
|
@@ -11,6 +11,7 @@ import { property, state } from 'lit/decorators.js'
|
|
|
11
11
|
import { Properties, Scene } from '@hatiolab/things-scene'
|
|
12
12
|
|
|
13
13
|
import { scenarios } from '../../../graphql/scenario'
|
|
14
|
+
import { playlists } from '../../../graphql/play-group'
|
|
14
15
|
import { EffectsSharedStyle } from './effects-shared-style'
|
|
15
16
|
import { convert } from './value-converter'
|
|
16
17
|
|
|
@@ -23,6 +24,7 @@ export class PropertyEventTap extends LitElement {
|
|
|
23
24
|
@property({ type: Object }) scene?: Scene
|
|
24
25
|
|
|
25
26
|
@state() scenarios: { value: string; description: string }[] = []
|
|
27
|
+
@state() playlists: { value: string; description: string }[] = []
|
|
26
28
|
@state() targetList: { value: string; description: string }[] = []
|
|
27
29
|
|
|
28
30
|
async firstUpdated() {
|
|
@@ -47,11 +49,16 @@ export class PropertyEventTap extends LitElement {
|
|
|
47
49
|
this.scenarios = (await scenarios()).map(({ name, description }) => {
|
|
48
50
|
return { value: name, description }
|
|
49
51
|
})
|
|
52
|
+
} else if ((e.target as HTMLSelectElement).value == 'goto-playlist') {
|
|
53
|
+
this.playlists = (await playlists()).map(({ name, description }) => {
|
|
54
|
+
return { value: name, description }
|
|
55
|
+
})
|
|
50
56
|
}
|
|
51
57
|
}}
|
|
52
58
|
>
|
|
53
59
|
<option value=""></option>
|
|
54
60
|
<option value="goto">go to target board</option>
|
|
61
|
+
<option value="goto-playlist">go to target playlist</option>
|
|
55
62
|
<option value="link-open">open new window for target link</option>
|
|
56
63
|
<option value="link-move">move to target link</option>
|
|
57
64
|
<option value="route-page">route to page</option>
|
|
@@ -94,7 +101,7 @@ export class PropertyEventTap extends LitElement {
|
|
|
94
101
|
)}
|
|
95
102
|
</datalist>
|
|
96
103
|
`}
|
|
97
|
-
${action === 'goto' || action?.includes('popup')
|
|
104
|
+
${action === 'goto' || action === 'goto-playlist' || action?.includes('popup')
|
|
98
105
|
? html`
|
|
99
106
|
<label for="input"> <ox-i18n msgid="label.input-data">input</ox-i18n> </label>
|
|
100
107
|
<input
|
|
@@ -175,6 +182,8 @@ export class PropertyEventTap extends LitElement {
|
|
|
175
182
|
case 'start-scenario':
|
|
176
183
|
case 'run-scenario':
|
|
177
184
|
return this.scenarios
|
|
185
|
+
case 'goto-playlist':
|
|
186
|
+
return this.playlists
|
|
178
187
|
default:
|
|
179
188
|
return []
|
|
180
189
|
}
|
|
@@ -206,7 +215,7 @@ export class PropertyEventTap extends LitElement {
|
|
|
206
215
|
}
|
|
207
216
|
|
|
208
217
|
var { action } = this.value
|
|
209
|
-
if (action !== 'goto' && !action?.includes('popup')) {
|
|
218
|
+
if (action !== 'goto' && action !== 'goto-playlist' && !action?.includes('popup')) {
|
|
210
219
|
/* clear unused options */
|
|
211
220
|
delete this.value.options
|
|
212
221
|
}
|
package/src/ox-board-viewer.ts
CHANGED
|
@@ -14,6 +14,7 @@ import { DataSubscriptionProviderImpl } from './graphql/data-subscription.js'
|
|
|
14
14
|
import { runScenario, startScenario } from './graphql/scenario.js'
|
|
15
15
|
|
|
16
16
|
import { BoardComponentInfo } from './ox-board-component-info.js'
|
|
17
|
+
import { fetchPlayGroupByName } from './graphql/play-group.js'
|
|
17
18
|
|
|
18
19
|
@customElement('ox-board-viewer')
|
|
19
20
|
export class BoardViewer extends LitElement {
|
|
@@ -344,9 +345,18 @@ export class BoardViewer extends LitElement {
|
|
|
344
345
|
}
|
|
345
346
|
}
|
|
346
347
|
|
|
348
|
+
async gotoPlayer(playGroupName: string, bindingData?: any) {
|
|
349
|
+
const id = (await fetchPlayGroupByName(playGroupName))?.id
|
|
350
|
+
const queryString = bindingData ? new URLSearchParams(bindingData).toString() : ''
|
|
351
|
+
|
|
352
|
+
history.pushState({}, '', `board-player?${queryString}`)
|
|
353
|
+
window.dispatchEvent(new Event('popstate'))
|
|
354
|
+
}
|
|
355
|
+
|
|
347
356
|
bindSceneEvents() {
|
|
348
357
|
this._scene.on('run', this.onRunBoard, this)
|
|
349
358
|
this._scene.on('goto', this.onLinkGoto, this)
|
|
359
|
+
this._scene.on('goto-playlist', this.onLinkGotoPlaylist, this)
|
|
350
360
|
this._scene.on('link-open', this.onLinkOpen, this)
|
|
351
361
|
this._scene.on('link-move', this.onLinkMove, this)
|
|
352
362
|
this._scene.on('route-page', this.onRoutePage, this)
|
|
@@ -358,6 +368,7 @@ export class BoardViewer extends LitElement {
|
|
|
358
368
|
unbindSceneEvents(scene: any) {
|
|
359
369
|
scene.off('run', this.onRunBoard, this)
|
|
360
370
|
scene.off('goto', this.onLinkGoto, this)
|
|
371
|
+
scene.off('goto-playlist', this.onLinkGotoPlaylist, this)
|
|
361
372
|
scene.off('link-open', this.onLinkOpen, this)
|
|
362
373
|
scene.off('link-move', this.onLinkMove, this)
|
|
363
374
|
scene.off('route-page', this.onRoutePage, this)
|
|
@@ -460,6 +471,12 @@ export class BoardViewer extends LitElement {
|
|
|
460
471
|
this.showScene(targetBoardId, data)
|
|
461
472
|
}
|
|
462
473
|
|
|
474
|
+
onLinkGotoPlaylist(targetPlayGroupName: string, options: any, fromComponent: any) {
|
|
475
|
+
const { input, output } = options || { input: '(self)' }
|
|
476
|
+
const data = input && fromComponent.root.findFirst(input, fromComponent)?.data
|
|
477
|
+
this.gotoPlayer(targetPlayGroupName, data)
|
|
478
|
+
}
|
|
479
|
+
|
|
463
480
|
onLinkOpen(url: string, value: any, fromComponent: Component) {
|
|
464
481
|
if (!url) return
|
|
465
482
|
|