@things-factory/board-ui 7.0.1-alpha.5 → 7.0.1-alpha.9
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/client/pages/board-modeller-page.ts +4 -3
- package/client/pages/board-player-page.ts +6 -5
- package/client/pages/board-viewer-page.ts +6 -5
- package/dist-client/pages/board-modeller-page.d.ts +1 -0
- package/dist-client/pages/board-modeller-page.js +4 -3
- package/dist-client/pages/board-modeller-page.js.map +1 -1
- package/dist-client/pages/board-player-page.d.ts +1 -0
- package/dist-client/pages/board-player-page.js +6 -5
- package/dist-client/pages/board-player-page.js.map +1 -1
- package/dist-client/pages/board-viewer-page.d.ts +1 -0
- package/dist-client/pages/board-viewer-page.js +6 -5
- package/dist-client/pages/board-viewer-page.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -4
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import './things-scene-components.import'
|
|
2
2
|
import '@operato/board/ox-board-modeller.js'
|
|
3
|
+
import '@operato/oops'
|
|
3
4
|
|
|
4
5
|
import gql from 'graphql-tag'
|
|
5
6
|
import { css, html } from 'lit'
|
|
@@ -55,11 +56,11 @@ export class BoardModellerPage extends connect(store)(PageView) {
|
|
|
55
56
|
position: relative;
|
|
56
57
|
}
|
|
57
58
|
|
|
58
|
-
board-modeller {
|
|
59
|
+
ox-board-modeller {
|
|
59
60
|
flex: 1;
|
|
60
61
|
}
|
|
61
62
|
|
|
62
|
-
oops-note {
|
|
63
|
+
ox-oops-note {
|
|
63
64
|
display: block;
|
|
64
65
|
position: absolute;
|
|
65
66
|
left: 50%;
|
|
@@ -190,7 +191,7 @@ export class BoardModellerPage extends connect(store)(PageView) {
|
|
|
190
191
|
var oops = !this.preparing && !this.model && this.oopsNote
|
|
191
192
|
|
|
192
193
|
return oops
|
|
193
|
-
? html` <oops-note icon=${oops.icon} title=${oops.title} description=${oops.description}></oops-note> `
|
|
194
|
+
? html` <ox-oops-note icon=${oops.icon} title=${oops.title} description=${oops.description}></ox-oops-note> `
|
|
194
195
|
: html`
|
|
195
196
|
<ox-board-modeller
|
|
196
197
|
.mode=${this.mode}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import './things-scene-components.import'
|
|
2
2
|
import '@operato/board/ox-board-player.js'
|
|
3
|
+
import '@operato/oops'
|
|
3
4
|
|
|
4
5
|
import gql from 'graphql-tag'
|
|
5
6
|
import { css, html } from 'lit'
|
|
@@ -45,7 +46,7 @@ export class BoardPlayerPage extends connect(store)(PageView) {
|
|
|
45
46
|
flex: 1;
|
|
46
47
|
}
|
|
47
48
|
|
|
48
|
-
oops-spinner {
|
|
49
|
+
ox-oops-spinner {
|
|
49
50
|
display: none;
|
|
50
51
|
position: absolute;
|
|
51
52
|
left: 50%;
|
|
@@ -53,11 +54,11 @@ export class BoardPlayerPage extends connect(store)(PageView) {
|
|
|
53
54
|
transform: translate(-50%, -50%);
|
|
54
55
|
}
|
|
55
56
|
|
|
56
|
-
oops-spinner[show] {
|
|
57
|
+
ox-oops-spinner[show] {
|
|
57
58
|
display: block;
|
|
58
59
|
}
|
|
59
60
|
|
|
60
|
-
oops-note {
|
|
61
|
+
ox-oops-note {
|
|
61
62
|
display: block;
|
|
62
63
|
position: absolute;
|
|
63
64
|
left: 50%;
|
|
@@ -179,10 +180,10 @@ export class BoardPlayerPage extends connect(store)(PageView) {
|
|
|
179
180
|
var oops = !this.showSpinner && !this.playGroup && this.oopsNote
|
|
180
181
|
|
|
181
182
|
return oops
|
|
182
|
-
? html` <oops-note icon=${oops.icon} title=${oops.title} description=${oops.description}></oops-note> `
|
|
183
|
+
? html` <ox-oops-note icon=${oops.icon} title=${oops.title} description=${oops.description}></ox-oops-note> `
|
|
183
184
|
: html`
|
|
184
185
|
<ox-board-player .boards=${this.boards} .data=${this.data} .provider=${this.provider}></ox-board-player>
|
|
185
|
-
<oops-spinner ?show=${this.showSpinner}></oops-spinner>
|
|
186
|
+
<ox-oops-spinner ?show=${this.showSpinner}></ox-oops-spinner>
|
|
186
187
|
`
|
|
187
188
|
}
|
|
188
189
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import './things-scene-components.import'
|
|
2
2
|
import '@operato/board/ox-board-viewer.js'
|
|
3
|
+
import '@operato/oops'
|
|
3
4
|
|
|
4
5
|
import gql from 'graphql-tag'
|
|
5
6
|
import { css, html } from 'lit'
|
|
@@ -49,7 +50,7 @@ export class BoardViewerPage extends connect(store)(PageView) {
|
|
|
49
50
|
flex: 1;
|
|
50
51
|
}
|
|
51
52
|
|
|
52
|
-
oops-spinner {
|
|
53
|
+
ox-oops-spinner {
|
|
53
54
|
display: none;
|
|
54
55
|
position: absolute;
|
|
55
56
|
left: 50%;
|
|
@@ -57,11 +58,11 @@ export class BoardViewerPage extends connect(store)(PageView) {
|
|
|
57
58
|
transform: translate(-50%, -50%);
|
|
58
59
|
}
|
|
59
60
|
|
|
60
|
-
oops-spinner[show] {
|
|
61
|
+
ox-oops-spinner[show] {
|
|
61
62
|
display: block;
|
|
62
63
|
}
|
|
63
64
|
|
|
64
|
-
oops-note {
|
|
65
|
+
ox-oops-note {
|
|
65
66
|
display: block;
|
|
66
67
|
position: absolute;
|
|
67
68
|
left: 50%;
|
|
@@ -102,7 +103,7 @@ export class BoardViewerPage extends connect(store)(PageView) {
|
|
|
102
103
|
var oops = !this._showSpinner && !this._board && this.oopsNote
|
|
103
104
|
|
|
104
105
|
return oops
|
|
105
|
-
? html` <oops-note icon=${oops.icon} title=${oops.title} description=${oops.description}></oops-note> `
|
|
106
|
+
? html` <ox-oops-note icon=${oops.icon} title=${oops.title} description=${oops.description}></ox-oops-note> `
|
|
106
107
|
: html`
|
|
107
108
|
<ox-board-viewer
|
|
108
109
|
.board=${this._board}
|
|
@@ -111,7 +112,7 @@ export class BoardViewerPage extends connect(store)(PageView) {
|
|
|
111
112
|
?hide-navigation=${this._interactive}
|
|
112
113
|
.data=${this.data}
|
|
113
114
|
></ox-board-viewer>
|
|
114
|
-
<oops-spinner ?show=${this._showSpinner}></oops-spinner>
|
|
115
|
+
<ox-oops-spinner ?show=${this._showSpinner}></ox-oops-spinner>
|
|
115
116
|
`
|
|
116
117
|
}
|
|
117
118
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import './things-scene-components.import';
|
|
2
2
|
import '@operato/board/ox-board-modeller.js';
|
|
3
|
+
import '@operato/oops';
|
|
3
4
|
import { BoardModeller } from '@operato/board/ox-board-modeller.js';
|
|
4
5
|
import { PageView } from '@operato/shell';
|
|
5
6
|
declare const BoardModellerPage_base: (new (...args: any[]) => {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import './things-scene-components.import';
|
|
3
3
|
import '@operato/board/ox-board-modeller.js';
|
|
4
|
+
import '@operato/oops';
|
|
4
5
|
import gql from 'graphql-tag';
|
|
5
6
|
import { css, html } from 'lit';
|
|
6
7
|
import { customElement, property, query } from 'lit/decorators.js';
|
|
@@ -135,7 +136,7 @@ let BoardModellerPage = class BoardModellerPage extends connect(store)(PageView)
|
|
|
135
136
|
render() {
|
|
136
137
|
var oops = !this.preparing && !this.model && this.oopsNote;
|
|
137
138
|
return oops
|
|
138
|
-
? html ` <oops-note icon=${oops.icon} title=${oops.title} description=${oops.description}></oops-note> `
|
|
139
|
+
? html ` <ox-oops-note icon=${oops.icon} title=${oops.title} description=${oops.description}></ox-oops-note> `
|
|
139
140
|
: html `
|
|
140
141
|
<ox-board-modeller
|
|
141
142
|
.mode=${this.mode}
|
|
@@ -232,11 +233,11 @@ BoardModellerPage.styles = [
|
|
|
232
233
|
position: relative;
|
|
233
234
|
}
|
|
234
235
|
|
|
235
|
-
board-modeller {
|
|
236
|
+
ox-board-modeller {
|
|
236
237
|
flex: 1;
|
|
237
238
|
}
|
|
238
239
|
|
|
239
|
-
oops-note {
|
|
240
|
+
ox-oops-note {
|
|
240
241
|
display: block;
|
|
241
242
|
position: absolute;
|
|
242
243
|
left: 50%;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"board-modeller-page.js","sourceRoot":"","sources":["../../client/pages/board-modeller-page.ts"],"names":[],"mappings":";AAAA,OAAO,kCAAkC,CAAA;AACzC,OAAO,qCAAqC,CAAA;AAE5C,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA;AAEtD,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAA;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAA;AACpE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AAEtD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,UAAU,MAAM,6CAA6C,CAAA;AAEpE,MAAM,IAAI,GAAG,GAAG,EAAE,GAAE,CAAC,CAAA;AAGd,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC;IAC7D;QACE,KAAK,EAAE,CAAA;QAgDmB,cAAS,GAAY,EAAE,CAAA;QACvB,UAAK,GAAQ,IAAI,CAAA;QACjB,YAAO,GAAY,EAAE,CAAA;QACtB,aAAQ,GAAQ,EAAE,CAAA;QACjB,SAAI,GA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,EAAE,MAAM,EAAE,CAAC;;oDAAwB;AACnD;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;gDAAkB;AAC7C;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;kDAAsB;AACjD;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;mDAAmB;AAC7C;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;+CAAkB;AAC7C;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;uDAA+B;AAC3D;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;kDAA+B;AAC1D;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;gDAAkB;AAC7C;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;6DAAkD;AAC5E;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;gDAAgB;AAC1C;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;yDAAoB;AAC9C;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;oDAAoB;AAGhD;IAAC,KAAK,CAAC,mBAAmB,CAAC;8BAAY,aAAa;mDAAA;AAhEzC,iBAAiB;IAD7B,aAAa,CAAC,qBAAqB,CAAC;;GACxB,iBAAiB,CAwQ7B;SAxQY,iBAAiB","sourcesContent":["import './things-scene-components.import'\nimport '@operato/board/ox-board-modeller.js'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { connect } from 'pwa-helpers/connect-mixin.js'\n\nimport { BoardModeller } from '@operato/board/ox-board-modeller.js'\nimport { OxPropertyEditor } from '@operato/property-editor'\nimport { PageView, store } from '@operato/shell'\nimport { hasPrivilege } from '@things-factory/auth-base/dist-client'\nimport { client, gqlContext } from '@operato/graphql'\nimport { i18next } from '@operato/i18n'\nimport { OxPrompt } from '@operato/popup/ox-prompt.js'\n\nimport { provider } from '../board-provider'\nimport components from './things-scene-components-with-tools.import'\n\nconst NOOP = () => {}\n\n@customElement('board-modeller-page')\nexport class BoardModellerPage extends connect(store)(PageView) {\n constructor() {\n super()\n\n components.forEach(({ templates = [], groups = [] }) => {\n groups.forEach(group => BoardModeller.registerGroup(group))\n BoardModeller.registerTemplate(templates)\n })\n\n /* 컴포넌트에서 정의된 에디터들을 MODELLER_EDITORS에 등록 */\n var addedEditors = {}\n for (let component in components) {\n let { editors } = components[component]\n\n editors &&\n editors.forEach(editor => {\n let { type, element } = editor\n\n addedEditors[type] = element\n })\n }\n\n OxPropertyEditor.register(addedEditors)\n }\n\n static styles = [\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n overflow: hidden;\n position: relative;\n }\n\n board-modeller {\n flex: 1;\n }\n\n oops-note {\n display: block;\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n }\n `\n ]\n\n @property({ type: String }) boardId?: string | null\n @property({ type: String }) boardName?: string = ''\n @property({ type: Object }) model: any = null\n @property({ type: String }) baseUrl?: string = ''\n @property({ type: Array }) selected: any = []\n @property({ type: Number }) mode?: number = 1\n @property({ type: Boolean }) hideProperty?: boolean = false\n @property({ type: String }) overlay?: string | null = null\n @property({ type: Object }) scene: any = null\n @property({ type: Array }) componentGroupList?: any[] = BoardModeller.groups\n @property({ type: Array }) fonts: any = []\n @property({ type: Array }) propertyEditor: any\n @property({ type: Boolean }) preparing?: boolean\n\n private board: any = null\n @query('ox-board-modeller') modeller?: BoardModeller\n\n get context() {\n return {\n title: this.board ? this.boardName : this.preparing ? 'Fetching board...' : 'Board Not Found',\n help: 'board-modeller/modeller',\n widebleed: true\n }\n }\n\n get oopsNote() {\n return {\n icon: 'color_lens',\n title: 'EMPTY BOARD',\n description: 'There are no board to be designed'\n }\n }\n\n async refresh() {\n if (!this.boardId) {\n this.board = null\n this.model = null\n\n return\n }\n try {\n this.preparing = true\n this.updateContext()\n\n var response = await client.query({\n query: gql`\n query FetchBoardById($id: String!) {\n board(id: $id) {\n id\n name\n model\n }\n }\n `,\n variables: { id: this.boardId },\n context: gqlContext()\n })\n\n var board = response.data.board\n\n if (!board) {\n this.board = null\n throw 'board not found'\n }\n\n this.board = {\n ...board,\n model: JSON.parse(board.model)\n }\n\n this.boardName = this.board.name\n this.model = {\n ...this.board.model\n }\n } catch (ex) {\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n level: 'error',\n message: ex,\n ex\n }\n })\n )\n } finally {\n this.preparing = false\n this.updateContext()\n }\n }\n\n async updated(changes) {\n if (changes.has('boardId')) {\n if (await hasPrivilege({ privilege: 'mutation', category: 'board' })) {\n this.refresh()\n } else {\n this.boardId = null\n this.model = null\n this.modeller?.close()\n }\n }\n }\n\n pageUpdated(changes, lifecycle) {\n if (this.active) {\n this.boardId = lifecycle.resourceId\n } else {\n this.boardId = null\n this.model = null\n this.modeller?.close()\n }\n }\n\n stateChanged(state) {\n this.baseUrl = state.route.rootPath\n this.fonts = state.font\n }\n\n render() {\n var oops = !this.preparing && !this.model && this.oopsNote\n\n return oops\n ? html` <oops-note icon=${oops.icon} title=${oops.title} description=${oops.description}></oops-note> `\n : html`\n <ox-board-modeller\n .mode=${this.mode}\n @mode-changed=${e => {\n this.mode = e.detail.value\n }}\n .model=${this.model}\n @model-changed=${e => {\n this.model = e.detail.value\n }}\n .scene=${this.scene}\n @scene-changed=${e => {\n this.scene = e.detail.value\n }}\n .selected=${this.selected}\n @selected-changed=${e => {\n this.selected = e.detail.value\n }}\n .baseUrl=${this.baseUrl}\n .provider=${provider}\n @save-model=${e => this.saveBoard()}\n .componentGroupList=${this.componentGroupList}\n .fonts=${this.fonts}\n .hideProperty=${this.hideProperty}\n >\n </ox-board-modeller>\n `\n }\n\n async updateBoard() {\n try {\n this.preparing = true\n\n var { id, name, description, groupId } = this.board\n var model = JSON.stringify(this.scene.model)\n\n await client.mutate({\n mutation: gql`\n mutation UpdateBoard($id: String!, $patch: BoardPatch!) {\n updateBoard(id: $id, patch: $patch) {\n id\n }\n }\n `,\n variables: {\n id,\n patch: { name, description, model, groupId }\n },\n context: gqlContext()\n })\n\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n level: 'info',\n message: i18next.t('text.saved')\n }\n })\n )\n } catch (ex) {\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n level: 'error',\n message: ex,\n ex: ex\n }\n })\n )\n } finally {\n this.preparing = false\n }\n\n this.updateContext()\n }\n\n async saveBoard() {\n await this.updateBoard()\n this.modeller?.preserve()\n }\n\n async canDeactivate(): Promise<boolean> {\n if (this.modeller?.hasUnpreservedChanges()) {\n return await OxPrompt.open({\n title: i18next.t('text.are_you_sure'),\n text: i18next.t('prompt.sure to navigate away?'),\n confirmButton: { text: i18next.t('button.confirm') },\n cancelButton: { text: i18next.t('button.cancel') }\n })\n }\n\n return true\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"board-modeller-page.js","sourceRoot":"","sources":["../../client/pages/board-modeller-page.ts"],"names":[],"mappings":";AAAA,OAAO,kCAAkC,CAAA;AACzC,OAAO,qCAAqC,CAAA;AAC5C,OAAO,eAAe,CAAA;AAEtB,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA;AAEtD,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAA;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;A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D;AAC5E;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;gDAAgB;AAC1C;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;yDAAoB;AAC9C;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;oDAAoB;AAGhD;IAAC,KAAK,CAAC,mBAAmB,CAAC;8BAAY,aAAa;mDAAA;AAhEzC,iBAAiB;IAD7B,aAAa,CAAC,qBAAqB,CAAC;;GACxB,iBAAiB,CAwQ7B;SAxQY,iBAAiB","sourcesContent":["import './things-scene-components.import'\nimport '@operato/board/ox-board-modeller.js'\nimport '@operato/oops'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { connect } from 'pwa-helpers/connect-mixin.js'\n\nimport { BoardModeller } from '@operato/board/ox-board-modeller.js'\nimport { OxPropertyEditor } from '@operato/property-editor'\nimport { PageView, store } from '@operato/shell'\nimport { hasPrivilege } from '@things-factory/auth-base/dist-client'\nimport { client, gqlContext } from '@operato/graphql'\nimport { i18next } from '@operato/i18n'\nimport { OxPrompt } from '@operato/popup/ox-prompt.js'\n\nimport { provider } from '../board-provider'\nimport components from './things-scene-components-with-tools.import'\n\nconst NOOP = () => {}\n\n@customElement('board-modeller-page')\nexport class BoardModellerPage extends connect(store)(PageView) {\n constructor() {\n super()\n\n components.forEach(({ templates = [], groups = [] }) => {\n groups.forEach(group => BoardModeller.registerGroup(group))\n BoardModeller.registerTemplate(templates)\n })\n\n /* 컴포넌트에서 정의된 에디터들을 MODELLER_EDITORS에 등록 */\n var addedEditors = {}\n for (let component in components) {\n let { editors } = components[component]\n\n editors &&\n editors.forEach(editor => {\n let { type, element } = editor\n\n addedEditors[type] = element\n })\n }\n\n OxPropertyEditor.register(addedEditors)\n }\n\n static styles = [\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n overflow: hidden;\n position: relative;\n }\n\n ox-board-modeller {\n flex: 1;\n }\n\n ox-oops-note {\n display: block;\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n }\n `\n ]\n\n @property({ type: String }) boardId?: string | null\n @property({ type: String }) boardName?: string = ''\n @property({ type: Object }) model: any = null\n @property({ type: String }) baseUrl?: string = ''\n @property({ type: Array }) selected: any = []\n @property({ type: Number }) mode?: number = 1\n @property({ type: Boolean }) hideProperty?: boolean = false\n @property({ type: String }) overlay?: string | null = null\n @property({ type: Object }) scene: any = null\n @property({ type: Array }) componentGroupList?: any[] = BoardModeller.groups\n @property({ type: Array }) fonts: any = []\n @property({ type: Array }) propertyEditor: any\n @property({ type: Boolean }) preparing?: boolean\n\n private board: any = null\n @query('ox-board-modeller') modeller?: BoardModeller\n\n get context() {\n return {\n title: this.board ? this.boardName : this.preparing ? 'Fetching board...' : 'Board Not Found',\n help: 'board-modeller/modeller',\n widebleed: true\n }\n }\n\n get oopsNote() {\n return {\n icon: 'color_lens',\n title: 'EMPTY BOARD',\n description: 'There are no board to be designed'\n }\n }\n\n async refresh() {\n if (!this.boardId) {\n this.board = null\n this.model = null\n\n return\n }\n try {\n this.preparing = true\n this.updateContext()\n\n var response = await client.query({\n query: gql`\n query FetchBoardById($id: String!) {\n board(id: $id) {\n id\n name\n model\n }\n }\n `,\n variables: { id: this.boardId },\n context: gqlContext()\n })\n\n var board = response.data.board\n\n if (!board) {\n this.board = null\n throw 'board not found'\n }\n\n this.board = {\n ...board,\n model: JSON.parse(board.model)\n }\n\n this.boardName = this.board.name\n this.model = {\n ...this.board.model\n }\n } catch (ex) {\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n level: 'error',\n message: ex,\n ex\n }\n })\n )\n } finally {\n this.preparing = false\n this.updateContext()\n }\n }\n\n async updated(changes) {\n if (changes.has('boardId')) {\n if (await hasPrivilege({ privilege: 'mutation', category: 'board' })) {\n this.refresh()\n } else {\n this.boardId = null\n this.model = null\n this.modeller?.close()\n }\n }\n }\n\n pageUpdated(changes, lifecycle) {\n if (this.active) {\n this.boardId = lifecycle.resourceId\n } else {\n this.boardId = null\n this.model = null\n this.modeller?.close()\n }\n }\n\n stateChanged(state) {\n this.baseUrl = state.route.rootPath\n this.fonts = state.font\n }\n\n render() {\n var oops = !this.preparing && !this.model && this.oopsNote\n\n return oops\n ? html` <ox-oops-note icon=${oops.icon} title=${oops.title} description=${oops.description}></ox-oops-note> `\n : html`\n <ox-board-modeller\n .mode=${this.mode}\n @mode-changed=${e => {\n this.mode = e.detail.value\n }}\n .model=${this.model}\n @model-changed=${e => {\n this.model = e.detail.value\n }}\n .scene=${this.scene}\n @scene-changed=${e => {\n this.scene = e.detail.value\n }}\n .selected=${this.selected}\n @selected-changed=${e => {\n this.selected = e.detail.value\n }}\n .baseUrl=${this.baseUrl}\n .provider=${provider}\n @save-model=${e => this.saveBoard()}\n .componentGroupList=${this.componentGroupList}\n .fonts=${this.fonts}\n .hideProperty=${this.hideProperty}\n >\n </ox-board-modeller>\n `\n }\n\n async updateBoard() {\n try {\n this.preparing = true\n\n var { id, name, description, groupId } = this.board\n var model = JSON.stringify(this.scene.model)\n\n await client.mutate({\n mutation: gql`\n mutation UpdateBoard($id: String!, $patch: BoardPatch!) {\n updateBoard(id: $id, patch: $patch) {\n id\n }\n }\n `,\n variables: {\n id,\n patch: { name, description, model, groupId }\n },\n context: gqlContext()\n })\n\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n level: 'info',\n message: i18next.t('text.saved')\n }\n })\n )\n } catch (ex) {\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n level: 'error',\n message: ex,\n ex: ex\n }\n })\n )\n } finally {\n this.preparing = false\n }\n\n this.updateContext()\n }\n\n async saveBoard() {\n await this.updateBoard()\n this.modeller?.preserve()\n }\n\n async canDeactivate(): Promise<boolean> {\n if (this.modeller?.hasUnpreservedChanges()) {\n return await OxPrompt.open({\n title: i18next.t('text.are_you_sure'),\n text: i18next.t('prompt.sure to navigate away?'),\n confirmButton: { text: i18next.t('button.confirm') },\n cancelButton: { text: i18next.t('button.cancel') }\n })\n }\n\n return true\n }\n}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import './things-scene-components.import';
|
|
2
2
|
import '@operato/board/ox-board-player.js';
|
|
3
|
+
import '@operato/oops';
|
|
3
4
|
import { PageView } from '@operato/shell';
|
|
4
5
|
import { BoardPlayer } from '@operato/board/ox-board-player.js';
|
|
5
6
|
declare const BoardPlayerPage_base: (new (...args: any[]) => {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import './things-scene-components.import';
|
|
3
3
|
import '@operato/board/ox-board-player.js';
|
|
4
|
+
import '@operato/oops';
|
|
4
5
|
import gql from 'graphql-tag';
|
|
5
6
|
import { css, html } from 'lit';
|
|
6
7
|
import { customElement, state, query } from 'lit/decorators.js';
|
|
@@ -108,10 +109,10 @@ let BoardPlayerPage = class BoardPlayerPage extends connect(store)(PageView) {
|
|
|
108
109
|
render() {
|
|
109
110
|
var oops = !this.showSpinner && !this.playGroup && this.oopsNote;
|
|
110
111
|
return oops
|
|
111
|
-
? html ` <oops-note icon=${oops.icon} title=${oops.title} description=${oops.description}></oops-note> `
|
|
112
|
+
? html ` <ox-oops-note icon=${oops.icon} title=${oops.title} description=${oops.description}></ox-oops-note> `
|
|
112
113
|
: html `
|
|
113
114
|
<ox-board-player .boards=${this.boards} .data=${this.data} .provider=${this.provider}></ox-board-player>
|
|
114
|
-
<oops-spinner ?show=${this.showSpinner}></oops-spinner>
|
|
115
|
+
<ox-oops-spinner ?show=${this.showSpinner}></ox-oops-spinner>
|
|
115
116
|
`;
|
|
116
117
|
}
|
|
117
118
|
pageUpdated(changes, lifecycle) {
|
|
@@ -174,7 +175,7 @@ BoardPlayerPage.styles = [
|
|
|
174
175
|
flex: 1;
|
|
175
176
|
}
|
|
176
177
|
|
|
177
|
-
oops-spinner {
|
|
178
|
+
ox-oops-spinner {
|
|
178
179
|
display: none;
|
|
179
180
|
position: absolute;
|
|
180
181
|
left: 50%;
|
|
@@ -182,11 +183,11 @@ BoardPlayerPage.styles = [
|
|
|
182
183
|
transform: translate(-50%, -50%);
|
|
183
184
|
}
|
|
184
185
|
|
|
185
|
-
oops-spinner[show] {
|
|
186
|
+
ox-oops-spinner[show] {
|
|
186
187
|
display: block;
|
|
187
188
|
}
|
|
188
189
|
|
|
189
|
-
oops-note {
|
|
190
|
+
ox-oops-note {
|
|
190
191
|
display: block;
|
|
191
192
|
position: absolute;
|
|
192
193
|
left: 50%;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"board-player-page.js","sourceRoot":"","sources":["../../client/pages/board-player-page.ts"],"names":[],"mappings":";AAAA,OAAO,kCAAkC,CAAA;AACzC,OAAO,mCAAmC,CAAA;
|
|
1
|
+
{"version":3,"file":"board-player-page.js","sourceRoot":"","sources":["../../client/pages/board-player-page.ts"],"names":[],"mappings":";AAAA,OAAO,kCAAkC,CAAA;AACzC,OAAO,mCAAmC,CAAA;AAC1C,OAAO,eAAe,CAAA;AAEtB,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA;AAEtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AACvD,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AACnE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAEpD,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAA;AAE/D,SAAS,UAAU,CAAC,KAAU;IAC5B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CAAC,OAAO,EAAE,CAAA;iBACf;YACH,CAAC;SACF,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,eAAe;;QACnB,MAAM,CAAA,MAAA,IAAI,CAAC,0BAA0B,0CAAE,WAAW,EAAE,CAAA,CAAA;QACpD,OAAO,IAAI,CAAC,0BAA0B,CAAA;IACxC,CAAC;;AA/MM,sBAAM,GAAG;IACd,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAkCF;CACF,CAAA;AAED;IAAC,KAAK,EAAE;;6CAAU;AAClB;IAAC,KAAK,EAAE;;kDAAe;AACvB;IAAC,KAAK,EAAE;;oDAA4B;AACpC;IAAC,KAAK,EAAE;;+CAAY;AACpB;IAAC,KAAK,EAAE;;gDAAiB;AACzB;IAAC,KAAK,EAAE;;oDAAsB;AAK9B;IAAC,KAAK,CAAC,iBAAiB,CAAC;8BAAe,WAAW;oDAAA;AAjDxC,eAAe;IAD3B,aAAa,CAAC,mBAAmB,CAAC;GACtB,eAAe,CAiN3B;SAjNY,eAAe","sourcesContent":["import './things-scene-components.import'\nimport '@operato/board/ox-board-player.js'\nimport '@operato/oops'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, state, query } from 'lit/decorators.js'\nimport { connect } from 'pwa-helpers/connect-mixin.js'\n\nimport { createBoardProvider } from '../board-provider'\nimport { store, PageView } from '@operato/shell'\nimport { clientSettingStore } from '@operato/shell/object-store.js'\nimport { client, subscribe } from '@operato/graphql'\nimport { ReferenceMap } from '@hatiolab/things-scene'\nimport { BoardPlayer } from '@operato/board/ox-board-player.js'\n\nfunction parseQuery(query: any) {\n for (const key in query) {\n if (query.hasOwnProperty(key)) {\n try {\n query[key] = JSON.parse(query[key])\n } catch (error) {\n // do nothing\n }\n }\n }\n\n return query\n}\n\n@customElement('board-player-page')\nexport class BoardPlayerPage extends connect(store)(PageView) {\n static styles = [\n css`\n :host {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n\n overflow: hidden;\n position: relative;\n }\n\n ox-board-player {\n flex: 1;\n }\n\n ox-oops-spinner {\n display: none;\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n }\n\n ox-oops-spinner[show] {\n display: block;\n }\n\n ox-oops-note {\n display: block;\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n }\n `\n ]\n\n @state() data: any\n @state() playGroup: any\n @state() playGroupId?: string | null\n @state() boards: any\n @state() baseUrl?: string\n @state() showSpinner?: boolean\n\n private provider?: ReferenceMap<unknown> & { dispose?: () => void }\n private subscriptionForAutoRefresh\n\n @query('ox-board-player') boardPlayer?: BoardPlayer\n\n connectedCallback() {\n super.connectedCallback()\n\n this.provider = createBoardProvider()\n }\n\n disconnectedCallback() {\n super.disconnectedCallback()\n\n this.provider!.dispose!()\n delete this.provider\n }\n\n async fetch(id: string) {\n return await client.query({\n query: gql`\n query ($id: String!) {\n response: playGroup(id: $id) {\n id\n name\n description\n boards {\n id\n model\n }\n }\n }\n `,\n variables: {\n id\n }\n })\n }\n\n async refresh() {\n if (!this.playGroupId) {\n return\n }\n\n try {\n this.showSpinner = true\n this.updateContext()\n\n const response = await this.fetch(this.playGroupId)\n\n this.playGroup = response.data.response\n\n if (!this.playGroup) {\n throw 'playgroup not found'\n }\n\n this.boards = this.playGroup.boards\n } catch (ex) {\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n level: 'error',\n message: ex,\n ex\n }\n })\n )\n } finally {\n this.showSpinner = false\n this.updateContext()\n\n const { autoRefresh = true } = (await clientSettingStore.get('board-view'))?.value || {}\n autoRefresh && this.startSubscribingForAutoRefresh()\n }\n }\n\n updated(changes) {\n if (changes.has('playGroupId')) {\n this.boardPlayer!.stop()\n this.refresh()\n }\n }\n\n stateChanged(state) {\n this.baseUrl = state.app.baseUrl\n }\n\n get oopsNote() {\n return {\n icon: 'style',\n title: 'EMPTY PLAYGROUP',\n description: 'There are no board to be shown'\n }\n }\n\n get context() {\n return {\n title: this.playGroup ? this.playGroup.name : this.showSpinner ? 'Fetching playgroup...' : 'Playgroup Not Found'\n }\n }\n\n render() {\n var oops = !this.showSpinner && !this.playGroup && this.oopsNote\n\n return oops\n ? html` <ox-oops-note icon=${oops.icon} title=${oops.title} description=${oops.description}></ox-oops-note> `\n : html`\n <ox-board-player .boards=${this.boards} .data=${this.data} .provider=${this.provider}></ox-board-player>\n <ox-oops-spinner ?show=${this.showSpinner}></ox-oops-spinner>\n `\n }\n\n pageUpdated(changes, lifecycle) {\n if (this.active) {\n this.playGroupId = lifecycle.resourceId\n this.data = parseQuery({ ...lifecycle.params })\n\n this.refresh()\n } else {\n this.stopSubscribing()\n\n this.playGroupId = null\n this.boardPlayer!.stop()\n }\n }\n\n async startSubscribingForAutoRefresh() {\n if (!this.playGroup) {\n return\n }\n\n await this.stopSubscribing()\n\n this.subscriptionForAutoRefresh = await subscribe(\n {\n query: gql`\n subscription ($id: String!) {\n playGroup(id: $id) {\n id\n }\n }\n `,\n variables: {\n id: this.playGroup.id\n }\n },\n {\n next: async ({ data }) => {\n await this.stopSubscribing()\n\n // location.reload()\n if (data) {\n this.refresh()\n }\n }\n }\n )\n }\n\n async stopSubscribing() {\n await this.subscriptionForAutoRefresh?.unsubscribe()\n delete this.subscriptionForAutoRefresh\n }\n}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import './things-scene-components.import';
|
|
2
2
|
import '@operato/board/ox-board-viewer.js';
|
|
3
|
+
import '@operato/oops';
|
|
3
4
|
import { BoardViewer } from '@operato/board';
|
|
4
5
|
import { PageView } from '@operato/shell';
|
|
5
6
|
declare const BoardViewerPage_base: (new (...args: any[]) => {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import './things-scene-components.import';
|
|
3
3
|
import '@operato/board/ox-board-viewer.js';
|
|
4
|
+
import '@operato/oops';
|
|
4
5
|
import gql from 'graphql-tag';
|
|
5
6
|
import { css, html } from 'lit';
|
|
6
7
|
import { customElement, property, query, state } from 'lit/decorators.js';
|
|
@@ -42,7 +43,7 @@ let BoardViewerPage = class BoardViewerPage extends connect(store)(PageView) {
|
|
|
42
43
|
render() {
|
|
43
44
|
var oops = !this._showSpinner && !this._board && this.oopsNote;
|
|
44
45
|
return oops
|
|
45
|
-
? html ` <oops-note icon=${oops.icon} title=${oops.title} description=${oops.description}></oops-note> `
|
|
46
|
+
? html ` <ox-oops-note icon=${oops.icon} title=${oops.title} description=${oops.description}></ox-oops-note> `
|
|
46
47
|
: html `
|
|
47
48
|
<ox-board-viewer
|
|
48
49
|
.board=${this._board}
|
|
@@ -51,7 +52,7 @@ let BoardViewerPage = class BoardViewerPage extends connect(store)(PageView) {
|
|
|
51
52
|
?hide-navigation=${this._interactive}
|
|
52
53
|
.data=${this.data}
|
|
53
54
|
></ox-board-viewer>
|
|
54
|
-
<oops-spinner ?show=${this._showSpinner}></oops-spinner>
|
|
55
|
+
<ox-oops-spinner ?show=${this._showSpinner}></ox-oops-spinner>
|
|
55
56
|
`;
|
|
56
57
|
}
|
|
57
58
|
updated(changes) {
|
|
@@ -190,7 +191,7 @@ BoardViewerPage.styles = [
|
|
|
190
191
|
flex: 1;
|
|
191
192
|
}
|
|
192
193
|
|
|
193
|
-
oops-spinner {
|
|
194
|
+
ox-oops-spinner {
|
|
194
195
|
display: none;
|
|
195
196
|
position: absolute;
|
|
196
197
|
left: 50%;
|
|
@@ -198,11 +199,11 @@ BoardViewerPage.styles = [
|
|
|
198
199
|
transform: translate(-50%, -50%);
|
|
199
200
|
}
|
|
200
201
|
|
|
201
|
-
oops-spinner[show] {
|
|
202
|
+
ox-oops-spinner[show] {
|
|
202
203
|
display: block;
|
|
203
204
|
}
|
|
204
205
|
|
|
205
|
-
oops-note {
|
|
206
|
+
ox-oops-note {
|
|
206
207
|
display: block;
|
|
207
208
|
position: absolute;
|
|
208
209
|
left: 50%;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
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AAe,CAkO3B;SAlOY,eAAe","sourcesContent":["import './things-scene-components.import'\nimport '@operato/board/ox-board-viewer.js'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { connect } from 'pwa-helpers/connect-mixin.js'\n\nimport { buildLabelPrintCommand } from '@operato/barcode'\nimport { BoardViewer } from '@operato/board'\nimport { store, PageView } from '@operato/shell'\nimport { client, gqlContext, subscribe } from '@operato/graphql'\nimport { clientSettingStore } from '@operato/shell/object-store.js'\n\nimport { provider } from '../board-provider'\n\nconst NOOP = () => {}\n\nfunction parseQuery(query: any) {\n for (const key in query) {\n if (query.hasOwnProperty(key)) {\n try {\n query[key] = JSON.parse(query[key])\n } catch (error) {\n // do nothing\n }\n }\n }\n\n return query\n}\n\n@customElement('board-viewer-page')\nexport class BoardViewerPage extends connect(store)(PageView) {\n static styles = [\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n width: 100%; /* 전체화면보기를 위해서 필요함. */\n height: 100%;\n\n overflow: hidden;\n position: relative;\n }\n\n ox-board-viewer {\n flex: 1;\n }\n\n oops-spinner {\n display: none;\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n }\n\n oops-spinner[show] {\n display: block;\n }\n\n oops-note {\n display: block;\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n }\n `\n ]\n\n @property({ type: Object }) _board: any\n @property({ type: String }) _boardId?: string\n @property({ type: String }) _baseUrl?: string\n @property({ type: Boolean }) _interactive?: boolean\n @property({ type: Boolean }) _showSpinner?: boolean\n\n @state() data: any\n\n subscriptionForAutoRefresh\n\n @query('ox-board-viewer') boardViewer!: BoardViewer\n\n get oopsNote() {\n return {\n icon: 'insert_chart_outlined',\n title: 'EMPTY BOARD',\n description: 'There are no board to be shown'\n }\n }\n\n get context() {\n return {\n /* can set the page title with the 'title' parameter. */\n title: this.lifecycle.params['title'] || (this._board ? this._board.name : this._showSpinner ? 'Fetching board...' : 'Board Not Found')\n }\n }\n\n render() {\n var oops = !this._showSpinner && !this._board && this.oopsNote\n\n return oops\n ? html` <oops-note icon=${oops.icon} title=${oops.title} description=${oops.description}></oops-note> `\n : html`\n <ox-board-viewer\n .board=${this._board}\n .provider=${provider}\n ?hide-fullscreen=${this._interactive}\n ?hide-navigation=${this._interactive}\n .data=${this.data}\n ></ox-board-viewer>\n <oops-spinner ?show=${this._showSpinner}></oops-spinner>\n `\n }\n\n updated(changes) {\n if (changes.has('_boardId')) {\n this.refresh()\n }\n }\n\n pageUpdated(changes, lifecycle) {\n if (this.active) {\n this._boardId = lifecycle.resourceId\n this._interactive = lifecycle.params['interactive'] === 'true'\n this.data = parseQuery({ ...lifecycle.params })\n } else {\n /*\n * 비활성화된 페이지에서 render update가 발생하지 않으므로, 강제로 scene을 close 한다.\n * 화면이 inactive 될 때, 굳이 scene을 close하는 이유는,\n * 새로운 board가 선택되어 뷰어가 열릴 때, 기존 보드 잔상이 보이지 않도록 하기위해서이다.\n */\n this.stopSubscribing()\n\n if (this._boardId) {\n let boardViewer = this.boardViewer\n boardViewer && boardViewer.closeScene()\n }\n\n this._boardId = ''\n }\n }\n\n stateChanged(state) {\n this._baseUrl = state.app.baseUrl\n }\n\n async fetch(id: string) {\n return await client.query({\n query: gql`\n query ($id: String!) {\n response: board(id: $id) {\n id\n name\n model\n }\n }\n `,\n variables: { id },\n context: gqlContext()\n })\n }\n\n async refresh() {\n if (!this._boardId) {\n this._board = null\n return\n }\n\n try {\n this._showSpinner = true\n this.updateContext()\n\n var { data, errors } = await this.fetch(this._boardId)\n\n var board = data?.response\n\n if (!board) {\n this._board = null\n const message = errors?.map(error => error.message).join('\\n')\n throw message || 'board not found'\n }\n\n this._board = {\n ...board,\n model: JSON.parse(board.model)\n }\n } catch (ex) {\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n level: 'error',\n message: ex,\n ex\n }\n })\n )\n } finally {\n this._showSpinner = false\n this.updateContext()\n\n const { autoRefresh = true } = (await clientSettingStore.get('board-view'))?.value || {}\n autoRefresh && this.startSubscribingForAutoRefresh()\n }\n }\n\n async startSubscribingForAutoRefresh() {\n if (!this._board) {\n return\n }\n\n await this.stopSubscribing()\n\n this.subscriptionForAutoRefresh = await subscribe(\n {\n query: gql`\n subscription ($id: String!) {\n board(id: $id) {\n id\n }\n }\n `,\n variables: {\n id: this._board.id\n }\n },\n {\n next: async ({ data }) => {\n await this.stopSubscribing()\n\n if (data) {\n this.refresh()\n }\n }\n }\n )\n }\n\n async stopSubscribing() {\n await this.subscriptionForAutoRefresh?.unsubscribe()\n delete this.subscriptionForAutoRefresh\n }\n\n async getGrf() {\n var { labelRotation } = this._board.model\n\n var { width, height, data } = (await this.boardViewer.getSceneImageData()) || {}\n if (!width || !data) {\n throw 'Cannot get SceneImageData...'\n }\n\n return buildLabelPrintCommand(data as Uint8ClampedArray, width, height, labelRotation, false, false)\n }\n\n async printTrick(image) {\n await this.boardViewer.printTrick(image)\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"board-viewer-page.js","sourceRoot":"","sources":["../../client/pages/board-viewer-page.ts"],"names":[],"mappings":";AAAA,OAAO,kCAAkC,CAAA;AACzC,OAAO,mCAAmC,CAAA;AAC1C,OAAO,eAAe,CAAA;AAEtB,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA;AAEtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAE,MAAM,EAAE,UAAU,E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AC,WAAW,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;IAC1C,CAAC;;AAhOM,sBAAM,GAAG;IACd,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAmCF;CACF,CAAA;AAED;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;+CAAY;AACvC;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;iDAAkB;AAC7C;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;iDAAkB;AAC7C;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;qDAAuB;AACnD;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;qDAAuB;AAEnD;IAAC,KAAK,EAAE;;6CAAU;AAIlB;IAAC,KAAK,CAAC,iBAAiB,CAAC;8BAAe,WAAW;oDAAA;AAlDxC,eAAe;IAD3B,aAAa,CAAC,mBAAmB,CAAC;GACtB,eAAe,CAkO3B;SAlOY,eAAe","sourcesContent":["import './things-scene-components.import'\nimport '@operato/board/ox-board-viewer.js'\nimport '@operato/oops'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { connect } from 'pwa-helpers/connect-mixin.js'\n\nimport { buildLabelPrintCommand } from '@operato/barcode'\nimport { BoardViewer } from '@operato/board'\nimport { store, PageView } from '@operato/shell'\nimport { client, gqlContext, subscribe } from '@operato/graphql'\nimport { clientSettingStore } from '@operato/shell/object-store.js'\n\nimport { provider } from '../board-provider'\n\nconst NOOP = () => {}\n\nfunction parseQuery(query: any) {\n for (const key in query) {\n if (query.hasOwnProperty(key)) {\n try {\n query[key] = JSON.parse(query[key])\n } catch (error) {\n // do nothing\n }\n }\n }\n\n return query\n}\n\n@customElement('board-viewer-page')\nexport class BoardViewerPage extends connect(store)(PageView) {\n static styles = [\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n width: 100%; /* 전체화면보기를 위해서 필요함. */\n height: 100%;\n\n overflow: hidden;\n position: relative;\n }\n\n ox-board-viewer {\n flex: 1;\n }\n\n ox-oops-spinner {\n display: none;\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n }\n\n ox-oops-spinner[show] {\n display: block;\n }\n\n ox-oops-note {\n display: block;\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n }\n `\n ]\n\n @property({ type: Object }) _board: any\n @property({ type: String }) _boardId?: string\n @property({ type: String }) _baseUrl?: string\n @property({ type: Boolean }) _interactive?: boolean\n @property({ type: Boolean }) _showSpinner?: boolean\n\n @state() data: any\n\n subscriptionForAutoRefresh\n\n @query('ox-board-viewer') boardViewer!: BoardViewer\n\n get oopsNote() {\n return {\n icon: 'insert_chart_outlined',\n title: 'EMPTY BOARD',\n description: 'There are no board to be shown'\n }\n }\n\n get context() {\n return {\n /* can set the page title with the 'title' parameter. */\n title: this.lifecycle.params['title'] || (this._board ? this._board.name : this._showSpinner ? 'Fetching board...' : 'Board Not Found')\n }\n }\n\n render() {\n var oops = !this._showSpinner && !this._board && this.oopsNote\n\n return oops\n ? html` <ox-oops-note icon=${oops.icon} title=${oops.title} description=${oops.description}></ox-oops-note> `\n : html`\n <ox-board-viewer\n .board=${this._board}\n .provider=${provider}\n ?hide-fullscreen=${this._interactive}\n ?hide-navigation=${this._interactive}\n .data=${this.data}\n ></ox-board-viewer>\n <ox-oops-spinner ?show=${this._showSpinner}></ox-oops-spinner>\n `\n }\n\n updated(changes) {\n if (changes.has('_boardId')) {\n this.refresh()\n }\n }\n\n pageUpdated(changes, lifecycle) {\n if (this.active) {\n this._boardId = lifecycle.resourceId\n this._interactive = lifecycle.params['interactive'] === 'true'\n this.data = parseQuery({ ...lifecycle.params })\n } else {\n /*\n * 비활성화된 페이지에서 render update가 발생하지 않으므로, 강제로 scene을 close 한다.\n * 화면이 inactive 될 때, 굳이 scene을 close하는 이유는,\n * 새로운 board가 선택되어 뷰어가 열릴 때, 기존 보드 잔상이 보이지 않도록 하기위해서이다.\n */\n this.stopSubscribing()\n\n if (this._boardId) {\n let boardViewer = this.boardViewer\n boardViewer && boardViewer.closeScene()\n }\n\n this._boardId = ''\n }\n }\n\n stateChanged(state) {\n this._baseUrl = state.app.baseUrl\n }\n\n async fetch(id: string) {\n return await client.query({\n query: gql`\n query ($id: String!) {\n response: board(id: $id) {\n id\n name\n model\n }\n }\n `,\n variables: { id },\n context: gqlContext()\n })\n }\n\n async refresh() {\n if (!this._boardId) {\n this._board = null\n return\n }\n\n try {\n this._showSpinner = true\n this.updateContext()\n\n var { data, errors } = await this.fetch(this._boardId)\n\n var board = data?.response\n\n if (!board) {\n this._board = null\n const message = errors?.map(error => error.message).join('\\n')\n throw message || 'board not found'\n }\n\n this._board = {\n ...board,\n model: JSON.parse(board.model)\n }\n } catch (ex) {\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n level: 'error',\n message: ex,\n ex\n }\n })\n )\n } finally {\n this._showSpinner = false\n this.updateContext()\n\n const { autoRefresh = true } = (await clientSettingStore.get('board-view'))?.value || {}\n autoRefresh && this.startSubscribingForAutoRefresh()\n }\n }\n\n async startSubscribingForAutoRefresh() {\n if (!this._board) {\n return\n }\n\n await this.stopSubscribing()\n\n this.subscriptionForAutoRefresh = await subscribe(\n {\n query: gql`\n subscription ($id: String!) {\n board(id: $id) {\n id\n }\n }\n `,\n variables: {\n id: this._board.id\n }\n },\n {\n next: async ({ data }) => {\n await this.stopSubscribing()\n\n if (data) {\n this.refresh()\n }\n }\n }\n )\n }\n\n async stopSubscribing() {\n await this.subscriptionForAutoRefresh?.unsubscribe()\n delete this.subscriptionForAutoRefresh\n }\n\n async getGrf() {\n var { labelRotation } = this._board.model\n\n var { width, height, data } = (await this.boardViewer.getSceneImageData()) || {}\n if (!width || !data) {\n throw 'Cannot get SceneImageData...'\n }\n\n return buildLabelPrintCommand(data as Uint8ClampedArray, width, height, labelRotation, false, false)\n }\n\n async printTrick(image) {\n await this.boardViewer.printTrick(image)\n }\n}\n"]}
|