@operato/board 1.1.37 → 1.1.39
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 +20 -0
- package/dist/src/ox-board-viewer.d.ts +16 -3
- package/dist/src/ox-board-viewer.js +32 -14
- package/dist/src/ox-board-viewer.js.map +1 -1
- package/dist/src/selector/ox-board-selector.js +0 -1
- package/dist/src/selector/ox-board-selector.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/ox-board-viewer.ts +34 -16
- package/src/selector/ox-board-selector.ts +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@operato/board",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.39",
|
|
4
4
|
"description": "Webcomponent for board following open-wc recommendations",
|
|
5
5
|
"author": "heartyoh",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
"devDependencies": {
|
|
111
111
|
"@custom-elements-manifest/analyzer": "^0.4.17",
|
|
112
112
|
"@hatiolab/prettier-config": "^1.0.0",
|
|
113
|
-
"@hatiolab/things-scene": "^3.0
|
|
113
|
+
"@hatiolab/things-scene": "^3.2.0",
|
|
114
114
|
"@material/mwc-fab": "^0.27.0",
|
|
115
115
|
"@material/mwc-icon": "^0.27.0",
|
|
116
116
|
"@open-wc/eslint-config": "^4.3.0",
|
|
@@ -146,5 +146,5 @@
|
|
|
146
146
|
"prettier --write"
|
|
147
147
|
]
|
|
148
148
|
},
|
|
149
|
-
"gitHead": "
|
|
149
|
+
"gitHead": "f482cfb98b0bb24ff637196cedc2a632ecffacb2"
|
|
150
150
|
}
|
package/src/ox-board-viewer.ts
CHANGED
|
@@ -92,17 +92,20 @@ export class BoardViewer extends LitElement {
|
|
|
92
92
|
@property({ type: Object }) board: any = {}
|
|
93
93
|
@property({ type: Object }) provider: ReferenceProvider | null = null
|
|
94
94
|
@property({ type: Object }) data: any
|
|
95
|
+
@property({ type: Object }) values: any
|
|
95
96
|
|
|
96
97
|
@property({ type: Boolean, reflect: true, attribute: 'hide-fullscreen' }) hideFullscreen = false
|
|
97
98
|
@property({ type: Boolean, reflect: true, attribute: 'hide-navigation' }) hideNavigation = false
|
|
98
99
|
|
|
99
100
|
@state() _scene: any = null
|
|
100
|
-
@state() _forward:
|
|
101
|
-
@state() _backward:
|
|
101
|
+
@state() _forward: { id: string; scene: any }[] = []
|
|
102
|
+
@state() _backward: { id: string; scene: any }[] = []
|
|
102
103
|
|
|
103
104
|
@state() _oldtarget?: HTMLElement
|
|
104
105
|
@state() _fade_animations?: Array<Animation>
|
|
105
106
|
|
|
107
|
+
public currentBoardId?: string = this.board?.id
|
|
108
|
+
|
|
106
109
|
@query('#target') _target!: HTMLElement
|
|
107
110
|
@query('#prev') _prev!: HTMLElement
|
|
108
111
|
@query('#next') _next!: HTMLElement
|
|
@@ -201,13 +204,17 @@ export class BoardViewer extends LitElement {
|
|
|
201
204
|
if (changes.has('data') && this._scene && this.data) {
|
|
202
205
|
this._scene.data = this.data
|
|
203
206
|
}
|
|
207
|
+
|
|
208
|
+
if (changes.has('values') && this._scene && this.values) {
|
|
209
|
+
this._scene.values = this.values
|
|
210
|
+
}
|
|
204
211
|
}
|
|
205
212
|
|
|
206
213
|
async initSceneAsync() {
|
|
207
214
|
if (!this.board || !this.board.id) return
|
|
208
215
|
|
|
209
216
|
this._scene = await this.provider!.get(this.board.id, true)
|
|
210
|
-
this.setupScene(this._scene)
|
|
217
|
+
this.setupScene({ id: this.board.id, scene: this._scene })
|
|
211
218
|
}
|
|
212
219
|
|
|
213
220
|
initScene() {
|
|
@@ -229,7 +236,7 @@ export class BoardViewer extends LitElement {
|
|
|
229
236
|
|
|
230
237
|
this.provider!.add(this.board.id, this._scene)
|
|
231
238
|
|
|
232
|
-
this.setupScene(this._scene)
|
|
239
|
+
this.setupScene({ id: this.board.id, scene: this._scene })
|
|
233
240
|
}
|
|
234
241
|
|
|
235
242
|
closeScene() {
|
|
@@ -243,10 +250,10 @@ export class BoardViewer extends LitElement {
|
|
|
243
250
|
}
|
|
244
251
|
|
|
245
252
|
// delete queued scenes
|
|
246
|
-
this._forward.forEach(scene => scene.release && scene.release())
|
|
253
|
+
this._forward.forEach(({ scene }) => scene.release && scene.release())
|
|
247
254
|
this._forward = []
|
|
248
255
|
|
|
249
|
-
this._backward.forEach(scene => scene.release && scene.release())
|
|
256
|
+
this._backward.forEach(({ scene }) => scene.release && scene.release())
|
|
250
257
|
this._backward = []
|
|
251
258
|
}
|
|
252
259
|
|
|
@@ -255,7 +262,7 @@ export class BoardViewer extends LitElement {
|
|
|
255
262
|
this.transientShowButtons()
|
|
256
263
|
}
|
|
257
264
|
|
|
258
|
-
setupScene(scene: any) {
|
|
265
|
+
setupScene({ id, scene }: { id: string; scene: any }) {
|
|
259
266
|
this._scene = scene
|
|
260
267
|
|
|
261
268
|
const backgroundColor = this._scene?.root.state.fillStyle
|
|
@@ -274,6 +281,7 @@ export class BoardViewer extends LitElement {
|
|
|
274
281
|
if (this.data) {
|
|
275
282
|
this._scene.data = this.data
|
|
276
283
|
}
|
|
284
|
+
this.currentBoardId = id
|
|
277
285
|
|
|
278
286
|
this.bindSceneEvents()
|
|
279
287
|
|
|
@@ -296,17 +304,17 @@ export class BoardViewer extends LitElement {
|
|
|
296
304
|
this.unbindSceneEvents(this._scene)
|
|
297
305
|
/* 원래의 target에 되돌린다. */
|
|
298
306
|
this._scene.target = this._oldtarget
|
|
299
|
-
this._backward.push(this._scene)
|
|
307
|
+
this._backward.push({ id: this.currentBoardId!, scene: this._scene })
|
|
300
308
|
}
|
|
301
309
|
|
|
302
310
|
this._scene = scene
|
|
303
311
|
|
|
304
|
-
this._forward.forEach(scene => scene.release && scene.release())
|
|
312
|
+
this._forward.forEach(({ scene }) => scene.release && scene.release())
|
|
305
313
|
|
|
306
314
|
/* forward를 비운다. */
|
|
307
315
|
this._forward = []
|
|
308
316
|
|
|
309
|
-
this.setupScene(scene)
|
|
317
|
+
this.setupScene({ id: boardId, scene })
|
|
310
318
|
|
|
311
319
|
if (bindingData) {
|
|
312
320
|
scene.data = bindingData
|
|
@@ -317,6 +325,7 @@ export class BoardViewer extends LitElement {
|
|
|
317
325
|
}
|
|
318
326
|
|
|
319
327
|
bindSceneEvents() {
|
|
328
|
+
this._scene.on('run', this.onRunBoard, this)
|
|
320
329
|
this._scene.on('goto', this.onLinkGoto, this)
|
|
321
330
|
this._scene.on('link-open', this.onLinkOpen, this)
|
|
322
331
|
this._scene.on('link-move', this.onLinkMove, this)
|
|
@@ -326,6 +335,7 @@ export class BoardViewer extends LitElement {
|
|
|
326
335
|
}
|
|
327
336
|
|
|
328
337
|
unbindSceneEvents(scene: any) {
|
|
338
|
+
scene.off('run', this.onRunBoard, this)
|
|
329
339
|
scene.off('goto', this.onLinkGoto, this)
|
|
330
340
|
scene.off('link-open', this.onLinkOpen, this)
|
|
331
341
|
scene.off('link-move', this.onLinkMove, this)
|
|
@@ -381,7 +391,7 @@ export class BoardViewer extends LitElement {
|
|
|
381
391
|
/* event handlers */
|
|
382
392
|
|
|
383
393
|
onTapNext() {
|
|
384
|
-
var scene = this._forward.pop()
|
|
394
|
+
var { id, scene } = this._forward.pop() || {}
|
|
385
395
|
if (!scene) return
|
|
386
396
|
|
|
387
397
|
if (this._scene) {
|
|
@@ -389,14 +399,14 @@ export class BoardViewer extends LitElement {
|
|
|
389
399
|
/* 원래의 target에 되돌린다. */
|
|
390
400
|
this._scene.target = this._oldtarget
|
|
391
401
|
this.unbindSceneEvents(this._scene)
|
|
392
|
-
this._backward.push(this._scene)
|
|
402
|
+
this._backward.push({ id: id!, scene: this._scene })
|
|
393
403
|
}
|
|
394
404
|
|
|
395
|
-
this.setupScene(scene)
|
|
405
|
+
this.setupScene({ id: id!, scene })
|
|
396
406
|
}
|
|
397
407
|
|
|
398
408
|
onTapPrev() {
|
|
399
|
-
var scene = this._backward.pop()
|
|
409
|
+
var { id, scene } = this._backward.pop() || {}
|
|
400
410
|
if (!scene) return
|
|
401
411
|
|
|
402
412
|
if (this._scene) {
|
|
@@ -404,10 +414,10 @@ export class BoardViewer extends LitElement {
|
|
|
404
414
|
/* 원래의 target에 되돌린다. */
|
|
405
415
|
this._scene.target = this._oldtarget
|
|
406
416
|
this.unbindSceneEvents(this._scene)
|
|
407
|
-
this._forward.push(this._scene)
|
|
417
|
+
this._forward.push({ id: id!, scene: this._scene })
|
|
408
418
|
}
|
|
409
419
|
|
|
410
|
-
this.setupScene(scene)
|
|
420
|
+
this.setupScene({ id: id!, scene })
|
|
411
421
|
}
|
|
412
422
|
|
|
413
423
|
onTapFullscreen() {
|
|
@@ -418,6 +428,10 @@ export class BoardViewer extends LitElement {
|
|
|
418
428
|
)
|
|
419
429
|
}
|
|
420
430
|
|
|
431
|
+
onRunBoard() {
|
|
432
|
+
this.dispatchEvent(new CustomEvent('run-board', { bubbles: true, composed: true, detail: this.board.id }))
|
|
433
|
+
}
|
|
434
|
+
|
|
421
435
|
onLinkGoto(targetBoardId: string, options: any, fromComponent: any) {
|
|
422
436
|
const { input, output } = options || { input: '(self)' }
|
|
423
437
|
const data = input && fromComponent.root.findFirst(input, fromComponent)?.data
|
|
@@ -477,6 +491,10 @@ export class BoardViewer extends LitElement {
|
|
|
477
491
|
return this._scene?.data
|
|
478
492
|
}
|
|
479
493
|
|
|
494
|
+
getSceneValues() {
|
|
495
|
+
return this._scene?.values
|
|
496
|
+
}
|
|
497
|
+
|
|
480
498
|
async getSceneImageData(base64 = false) {
|
|
481
499
|
if (!this._scene) {
|
|
482
500
|
return
|