@operato/board 7.1.16 → 7.1.17

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@operato/board",
3
- "version": "7.1.16",
3
+ "version": "7.1.17",
4
4
  "description": "Webcomponent for board following open-wc recommendations",
5
5
  "author": "heartyoh",
6
6
  "main": "dist/src/index.js",
@@ -159,5 +159,5 @@
159
159
  "prettier --write"
160
160
  ]
161
161
  },
162
- "gitHead": "f21c1eb55d0abde327ddff71c3470f19e5eeec64"
162
+ "gitHead": "c127f2156e496f321b87748fa0c52f63f1670334"
163
163
  }
@@ -125,6 +125,7 @@ export class BoardViewer extends LitElement {
125
125
  @property({ type: Object }) provider: ReferenceProvider | null = null
126
126
  @property({ type: Object }) data: any
127
127
  @property({ type: Object }) values: any
128
+ @property({ type: Boolean }) history: boolean = false
128
129
 
129
130
  @property({ type: Boolean, reflect: true, attribute: 'hide-fullscreen' }) hideFullscreen = false
130
131
  @property({ type: Boolean, reflect: true, attribute: 'hide-navigation' }) hideNavigation = false
@@ -305,7 +306,7 @@ export class BoardViewer extends LitElement {
305
306
  this.transientShowButtons()
306
307
  }
307
308
 
308
- setupScene({ id, scene }: { id: string; scene: any }) {
309
+ setupScene({ id, scene }: { id: string; scene: any }, history?: -1 | 0 | 1) {
309
310
  this._scene = scene
310
311
 
311
312
  const backgroundColor = this._scene?.root.state.fillStyle
@@ -332,6 +333,14 @@ export class BoardViewer extends LitElement {
332
333
  this.bindSceneEvents()
333
334
 
334
335
  this.transientShowButtons()
336
+
337
+ if (this.history && typeof history !== 'undefined' /* && document.querySelector('things-app') */) {
338
+ const currentUrl = new URL(window.location.href)
339
+ const paths = currentUrl.pathname.split('/')
340
+
341
+ paths[paths.length - 1] = this.currentBoardId
342
+ window.history.replaceState({}, '', `${currentUrl.origin}${paths.join('/')}${currentUrl.search}`)
343
+ }
335
344
  }
336
345
 
337
346
  async showScene(boardId: string, bindingData?: any) {
@@ -360,7 +369,7 @@ export class BoardViewer extends LitElement {
360
369
  /* forward를 비운다. */
361
370
  this._forward = []
362
371
 
363
- this.setupScene({ id: boardId, scene })
372
+ this.setupScene({ id: boardId, scene }, 0)
364
373
 
365
374
  if (bindingData) {
366
375
  scene.data = bindingData
@@ -465,10 +474,10 @@ export class BoardViewer extends LitElement {
465
474
  /* 원래의 target에 되돌린다. */
466
475
  this._scene.target = this._oldtarget
467
476
  this.unbindSceneEvents(this._scene)
468
- this._backward.push({ id: id!, scene: this._scene })
477
+ this._backward.push({ id: this.currentBoardId!, scene: this._scene })
469
478
  }
470
479
 
471
- this.setupScene({ id: id!, scene })
480
+ this.setupScene({ id: id!, scene }, 1)
472
481
  }
473
482
 
474
483
  onTapPrev() {
@@ -480,10 +489,10 @@ export class BoardViewer extends LitElement {
480
489
  /* 원래의 target에 되돌린다. */
481
490
  this._scene.target = this._oldtarget
482
491
  this.unbindSceneEvents(this._scene)
483
- this._forward.push({ id: id!, scene: this._scene })
492
+ this._forward.push({ id: this.currentBoardId!, scene: this._scene })
484
493
  }
485
494
 
486
- this.setupScene({ id: id!, scene })
495
+ this.setupScene({ id: id!, scene }, -1)
487
496
  }
488
497
 
489
498
  onTapFullscreen() {