@operato/board 1.0.0-alpha.9 → 1.0.0-beta.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 +393 -0
- package/dist/src/graphql/data-subscription.d.ts +7 -0
- package/dist/src/graphql/data-subscription.js +24 -0
- package/dist/src/graphql/data-subscription.js.map +1 -0
- package/dist/src/graphql/scenario.d.ts +6 -0
- package/dist/src/graphql/scenario.js +69 -0
- package/dist/src/graphql/scenario.js.map +1 -0
- package/dist/src/modeller/property-sidebar/abstract-property.js +0 -3
- package/dist/src/modeller/property-sidebar/abstract-property.js.map +1 -1
- package/dist/src/modeller/property-sidebar/data-binding/data-binding-mapper.d.ts +6 -3
- package/dist/src/modeller/property-sidebar/data-binding/data-binding-mapper.js +17 -10
- 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.js +5 -2
- package/dist/src/modeller/property-sidebar/data-binding/data-binding.js.map +1 -1
- package/dist/src/modeller/property-sidebar/effects/property-event-hover.js +14 -4
- package/dist/src/modeller/property-sidebar/effects/property-event-hover.js.map +1 -1
- package/dist/src/modeller/property-sidebar/effects/property-event-tap.js +56 -10
- package/dist/src/modeller/property-sidebar/effects/property-event-tap.js.map +1 -1
- package/dist/src/modeller/property-sidebar/effects/property-shadow.d.ts +1 -1
- package/dist/src/modeller/property-sidebar/effects/property-shadow.js +1 -1
- package/dist/src/modeller/property-sidebar/effects/property-shadow.js.map +1 -1
- package/dist/src/modeller/property-sidebar/effects/value-converter.js +0 -2
- package/dist/src/modeller/property-sidebar/effects/value-converter.js.map +1 -1
- package/dist/src/modeller/property-sidebar/specifics/specific-properties-builder.d.ts +1 -1
- package/dist/src/modeller/property-sidebar/specifics/specific-properties-builder.js +2 -2
- package/dist/src/modeller/property-sidebar/specifics/specific-properties-builder.js.map +1 -1
- package/dist/src/modeller/property-sidebar/styles/styles.d.ts +1 -1
- package/dist/src/modeller/property-sidebar/styles/styles.js +3 -3
- package/dist/src/modeller/property-sidebar/styles/styles.js.map +1 -1
- package/dist/src/ox-board-modeller.d.ts +2 -2
- package/dist/src/ox-board-modeller.js +5 -5
- package/dist/src/ox-board-modeller.js.map +1 -1
- package/dist/src/ox-board-viewer.d.ts +8 -4
- package/dist/src/ox-board-viewer.js +39 -5
- package/dist/src/ox-board-viewer.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +15 -15
- package/src/graphql/data-subscription.ts +30 -0
- package/src/graphql/scenario.ts +79 -0
- package/src/modeller/property-sidebar/abstract-property.ts +0 -4
- package/src/modeller/property-sidebar/data-binding/data-binding-mapper.ts +19 -10
- package/src/modeller/property-sidebar/data-binding/data-binding.ts +7 -5
- package/src/modeller/property-sidebar/effects/property-event-hover.ts +16 -5
- package/src/modeller/property-sidebar/effects/property-event-tap.ts +50 -11
- package/src/modeller/property-sidebar/effects/property-shadow.ts +1 -1
- package/src/modeller/property-sidebar/effects/value-converter.ts +0 -3
- package/src/modeller/property-sidebar/specifics/specific-properties-builder.ts +3 -3
- package/src/modeller/property-sidebar/styles/styles.ts +3 -3
- package/src/ox-board-modeller.ts +6 -7
- package/src/ox-board-viewer.ts +47 -11
- package/yarn-error.log +0 -16185
package/src/ox-board-viewer.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import '@material/mwc-fab'
|
|
2
2
|
import '@material/mwc-icon'
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
import { SCENE_MODE, create } from '@hatiolab/things-scene'
|
|
4
|
+
import { css, html, LitElement, PropertyValues } from 'lit'
|
|
6
5
|
import { customElement, property, query, state } from 'lit/decorators.js'
|
|
6
|
+
|
|
7
|
+
import { Component, create, ReferenceProvider, SCENE_MODE } from '@hatiolab/things-scene'
|
|
7
8
|
import { isIOS, togglefullscreen } from '@operato/utils'
|
|
8
9
|
|
|
10
|
+
import { DataSubscriptionProviderImpl } from './graphql/data-subscription'
|
|
11
|
+
import { runScenario, startScenario } from './graphql/scenario'
|
|
12
|
+
|
|
9
13
|
@customElement('ox-board-viewer')
|
|
10
14
|
export class BoardViewer extends LitElement {
|
|
11
15
|
static styles = css`
|
|
@@ -96,7 +100,7 @@ export class BoardViewer extends LitElement {
|
|
|
96
100
|
|
|
97
101
|
@property({ type: String }) baseUrl: string = ''
|
|
98
102
|
@property({ type: Object }) board: any = {}
|
|
99
|
-
@property({ type: Object }) provider:
|
|
103
|
+
@property({ type: Object }) provider: ReferenceProvider | null = null
|
|
100
104
|
@property({ type: Object }) data: any
|
|
101
105
|
|
|
102
106
|
@property({ type: Boolean, reflect: true, attribute: 'hide-fullscreen' }) hideFullscreen = false
|
|
@@ -196,7 +200,11 @@ export class BoardViewer extends LitElement {
|
|
|
196
200
|
this.closeScene()
|
|
197
201
|
|
|
198
202
|
if (this.board && this.board.id) {
|
|
199
|
-
this.
|
|
203
|
+
if (this.board.model) {
|
|
204
|
+
this.initScene()
|
|
205
|
+
} else {
|
|
206
|
+
this.initSceneAsync()
|
|
207
|
+
}
|
|
200
208
|
}
|
|
201
209
|
}
|
|
202
210
|
|
|
@@ -205,6 +213,13 @@ export class BoardViewer extends LitElement {
|
|
|
205
213
|
}
|
|
206
214
|
}
|
|
207
215
|
|
|
216
|
+
async initSceneAsync() {
|
|
217
|
+
if (!this.board || !this.board.id) return
|
|
218
|
+
|
|
219
|
+
this._scene = await this.provider!.get(this.board.id, true)
|
|
220
|
+
this.setupScene(this._scene)
|
|
221
|
+
}
|
|
222
|
+
|
|
208
223
|
initScene() {
|
|
209
224
|
if (!this.board || !this.board.id) return
|
|
210
225
|
|
|
@@ -213,14 +228,15 @@ export class BoardViewer extends LitElement {
|
|
|
213
228
|
...this.board.model
|
|
214
229
|
},
|
|
215
230
|
mode: SCENE_MODE.VIEW,
|
|
216
|
-
refProvider: this.provider
|
|
231
|
+
refProvider: this.provider!,
|
|
232
|
+
dataSubscriptionProvider: new DataSubscriptionProviderImpl()
|
|
217
233
|
})
|
|
218
234
|
|
|
219
235
|
if (this.baseUrl) {
|
|
220
236
|
this._scene.baseUrl = this.baseUrl
|
|
221
237
|
}
|
|
222
238
|
|
|
223
|
-
this.provider
|
|
239
|
+
this.provider!.add(this.board.id, this._scene)
|
|
224
240
|
|
|
225
241
|
this.setupScene(this._scene)
|
|
226
242
|
}
|
|
@@ -254,7 +270,7 @@ export class BoardViewer extends LitElement {
|
|
|
254
270
|
/* scene의 기존 target을 보관한다. */
|
|
255
271
|
this._oldtarget = this._scene.target
|
|
256
272
|
|
|
257
|
-
this._scene.fit(this.
|
|
273
|
+
this._scene.fit(this._scene.fitMode)
|
|
258
274
|
this._scene.target = this._target
|
|
259
275
|
|
|
260
276
|
if (this.data) {
|
|
@@ -270,7 +286,7 @@ export class BoardViewer extends LitElement {
|
|
|
270
286
|
if (!boardId) return
|
|
271
287
|
|
|
272
288
|
try {
|
|
273
|
-
var scene = await this.provider
|
|
289
|
+
var scene = await this.provider!.get(boardId, true)
|
|
274
290
|
|
|
275
291
|
if (scene === this._scene) {
|
|
276
292
|
scene.release()
|
|
@@ -307,6 +323,8 @@ export class BoardViewer extends LitElement {
|
|
|
307
323
|
this._scene.on('link-open', this.onLinkOpen, this)
|
|
308
324
|
this._scene.on('link-move', this.onLinkMove, this)
|
|
309
325
|
this._scene.on('route-page', this.onRoutePage, this)
|
|
326
|
+
this._scene.on('start-scenario', this.onStartScenario, this)
|
|
327
|
+
this._scene.on('run-scenario', this.onRunScenario, this)
|
|
310
328
|
}
|
|
311
329
|
|
|
312
330
|
unbindSceneEvents(scene: any) {
|
|
@@ -314,6 +332,8 @@ export class BoardViewer extends LitElement {
|
|
|
314
332
|
scene.off('link-open', this.onLinkOpen, this)
|
|
315
333
|
scene.off('link-move', this.onLinkMove, this)
|
|
316
334
|
scene.off('route-page', this.onRoutePage, this)
|
|
335
|
+
scene.off('start-scenario', this.onStartScenario, this)
|
|
336
|
+
scene.off('run-scenario', this.onRunScenario, this)
|
|
317
337
|
}
|
|
318
338
|
|
|
319
339
|
transientShowButtons(stop?: boolean) {
|
|
@@ -400,11 +420,11 @@ export class BoardViewer extends LitElement {
|
|
|
400
420
|
)
|
|
401
421
|
}
|
|
402
422
|
|
|
403
|
-
onLinkGoto(targetBoardId: string, value: any, fromComponent:
|
|
423
|
+
onLinkGoto(targetBoardId: string, value: any, fromComponent: Component) {
|
|
404
424
|
this.showScene(targetBoardId, fromComponent.data)
|
|
405
425
|
}
|
|
406
426
|
|
|
407
|
-
onLinkOpen(url: string, value: any, fromComponent:
|
|
427
|
+
onLinkOpen(url: string, value: any, fromComponent: Component) {
|
|
408
428
|
if (!url) return
|
|
409
429
|
|
|
410
430
|
try {
|
|
@@ -422,7 +442,7 @@ export class BoardViewer extends LitElement {
|
|
|
422
442
|
}
|
|
423
443
|
}
|
|
424
444
|
|
|
425
|
-
onLinkMove(url: string, value: any, fromComponent:
|
|
445
|
+
onLinkMove(url: string, value: any, fromComponent: Component) {
|
|
426
446
|
if (!url) return
|
|
427
447
|
|
|
428
448
|
location.href = url
|
|
@@ -437,6 +457,22 @@ export class BoardViewer extends LitElement {
|
|
|
437
457
|
window.dispatchEvent(new Event('popstate'))
|
|
438
458
|
}
|
|
439
459
|
|
|
460
|
+
async onStartScenario(scenario: string, value: string | number | object, component: Component) {
|
|
461
|
+
try {
|
|
462
|
+
await startScenario(scenario, scenario, value)
|
|
463
|
+
} catch (e) {
|
|
464
|
+
console.error(e)
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
async onRunScenario(scenario: string, value: string | number | object, component: Component) {
|
|
469
|
+
try {
|
|
470
|
+
component.data = await runScenario(scenario, value)
|
|
471
|
+
} catch (e) {
|
|
472
|
+
console.error(e)
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
|
|
440
476
|
async getSceneImageData(base64 = false) {
|
|
441
477
|
if (!this._scene) {
|
|
442
478
|
return
|