@things-factory/board-ui 8.0.0-alpha.9 → 8.0.0-beta.1
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-viewer-page.ts +5 -1
- package/dist-client/pages/board-viewer-page.d.ts +2 -0
- package/dist-client/pages/board-viewer-page.js +8 -1
- package/dist-client/pages/board-viewer-page.js.map +1 -1
- package/dist-client/pages/printable-board-viewer-page.d.ts +1 -0
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +19 -19
|
@@ -75,6 +75,7 @@ export class BoardViewerPage extends connect(store)(PageView) {
|
|
|
75
75
|
@property({ type: Object }) _board: any
|
|
76
76
|
@property({ type: String }) _boardId?: string
|
|
77
77
|
@property({ type: String }) _baseUrl?: string
|
|
78
|
+
@property({ type: String }) _help?: string
|
|
78
79
|
@property({ type: Boolean }) _interactive?: boolean
|
|
79
80
|
@property({ type: Boolean }) _showSpinner?: boolean
|
|
80
81
|
|
|
@@ -97,7 +98,8 @@ export class BoardViewerPage extends connect(store)(PageView) {
|
|
|
97
98
|
/* can set the page title with the 'title' parameter. */
|
|
98
99
|
title:
|
|
99
100
|
this.lifecycle.params['title'] ||
|
|
100
|
-
(this._board ? this._board.name : this._showSpinner ? 'Fetching board...' : 'Board Not Found')
|
|
101
|
+
(this._board ? this._board.name : this._showSpinner ? 'Fetching board...' : 'Board Not Found'),
|
|
102
|
+
help: this._help
|
|
101
103
|
}
|
|
102
104
|
}
|
|
103
105
|
|
|
@@ -113,6 +115,7 @@ export class BoardViewerPage extends connect(store)(PageView) {
|
|
|
113
115
|
?hide-fullscreen=${this._interactive}
|
|
114
116
|
?hide-navigation=${this._interactive}
|
|
115
117
|
.data=${this.data}
|
|
118
|
+
history
|
|
116
119
|
></ox-board-viewer>
|
|
117
120
|
<ox-oops-spinner ?show=${this._showSpinner}></ox-oops-spinner>
|
|
118
121
|
`
|
|
@@ -128,6 +131,7 @@ export class BoardViewerPage extends connect(store)(PageView) {
|
|
|
128
131
|
if (this.active) {
|
|
129
132
|
this._boardId = lifecycle.resourceId
|
|
130
133
|
this._interactive = lifecycle.params['interactive'] === 'true'
|
|
134
|
+
this._help = lifecycle.params['help']
|
|
131
135
|
this.data = parseQuery({ ...lifecycle.params })
|
|
132
136
|
} else {
|
|
133
137
|
/*
|
|
@@ -15,6 +15,7 @@ export declare class BoardViewerPage extends BoardViewerPage_base {
|
|
|
15
15
|
_board: any;
|
|
16
16
|
_boardId?: string;
|
|
17
17
|
_baseUrl?: string;
|
|
18
|
+
_help?: string;
|
|
18
19
|
_interactive?: boolean;
|
|
19
20
|
_showSpinner?: boolean;
|
|
20
21
|
data: any;
|
|
@@ -27,6 +28,7 @@ export declare class BoardViewerPage extends BoardViewerPage_base {
|
|
|
27
28
|
};
|
|
28
29
|
get context(): {
|
|
29
30
|
title: any;
|
|
31
|
+
help: string | undefined;
|
|
30
32
|
};
|
|
31
33
|
render(): import("lit-html").TemplateResult<1>;
|
|
32
34
|
updated(changes: any): void;
|
|
@@ -38,7 +38,8 @@ let BoardViewerPage = class BoardViewerPage extends connect(store)(PageView) {
|
|
|
38
38
|
return {
|
|
39
39
|
/* can set the page title with the 'title' parameter. */
|
|
40
40
|
title: this.lifecycle.params['title'] ||
|
|
41
|
-
(this._board ? this._board.name : this._showSpinner ? 'Fetching board...' : 'Board Not Found')
|
|
41
|
+
(this._board ? this._board.name : this._showSpinner ? 'Fetching board...' : 'Board Not Found'),
|
|
42
|
+
help: this._help
|
|
42
43
|
};
|
|
43
44
|
}
|
|
44
45
|
render() {
|
|
@@ -52,6 +53,7 @@ let BoardViewerPage = class BoardViewerPage extends connect(store)(PageView) {
|
|
|
52
53
|
?hide-fullscreen=${this._interactive}
|
|
53
54
|
?hide-navigation=${this._interactive}
|
|
54
55
|
.data=${this.data}
|
|
56
|
+
history
|
|
55
57
|
></ox-board-viewer>
|
|
56
58
|
<ox-oops-spinner ?show=${this._showSpinner}></ox-oops-spinner>
|
|
57
59
|
`;
|
|
@@ -65,6 +67,7 @@ let BoardViewerPage = class BoardViewerPage extends connect(store)(PageView) {
|
|
|
65
67
|
if (this.active) {
|
|
66
68
|
this._boardId = lifecycle.resourceId;
|
|
67
69
|
this._interactive = lifecycle.params['interactive'] === 'true';
|
|
70
|
+
this._help = lifecycle.params['help'];
|
|
68
71
|
this.data = parseQuery(Object.assign({}, lifecycle.params));
|
|
69
72
|
}
|
|
70
73
|
else {
|
|
@@ -228,6 +231,10 @@ __decorate([
|
|
|
228
231
|
property({ type: String }),
|
|
229
232
|
__metadata("design:type", String)
|
|
230
233
|
], BoardViewerPage.prototype, "_baseUrl", void 0);
|
|
234
|
+
__decorate([
|
|
235
|
+
property({ type: String }),
|
|
236
|
+
__metadata("design:type", String)
|
|
237
|
+
], BoardViewerPage.prototype, "_help", void 0);
|
|
231
238
|
__decorate([
|
|
232
239
|
property({ type: Boolean }),
|
|
233
240
|
__metadata("design:type", Boolean)
|
|
@@ -1 +1 @@
|
|
|
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,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iB,EAAE,CAAC,IAAI,EAAE,CAAA;QAChF,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;YACpB,MAAM,8BAA8B,CAAA;QACtC,CAAC;QAED,OAAO,sBAAsB,CAAC,IAAyB,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,CAAC,CAAA;IACtG,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,KAAK;QACpB,MAAM,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;IAC1C,CAAC;;AAtOM,sBAAM,GAAG;IACd,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAmCF;CACF,AArCY,CAqCZ;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;+CAAY;AACX;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;iDAAkB;AACjB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;iDAAkB;AAChB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;qDAAuB;AACtB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;qDAAuB;AAE1C;IAAR,KAAK,EAAE;;6CAAU;AAIQ;IAAzB,KAAK,CAAC,iBAAiB,CAAC;8BAAe,WAAW;oDAAA;AAlDxC,eAAe;IAD3B,aAAa,CAAC,mBAAmB,CAAC;GACtB,eAAe,CAwO3B","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:\n this.lifecycle.params['title'] ||\n (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 if (!id) {\n return\n }\n\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,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AAEnE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE5C,MAAM,IAAI,GAAG,GAAG,EAAE,GAAE,CAAC,CAAA;AA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AA;QACtC,CAAC;QAED,OAAO,sBAAsB,CAAC,IAAyB,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,CAAC,CAAA;IACtG,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,KAAK;QACpB,MAAM,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;IAC1C,CAAC;;AA1OM,sBAAM,GAAG;IACd,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAmCF;CACF,AArCY,CAqCZ;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;+CAAY;AACX;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;iDAAkB;AACjB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;iDAAkB;AACjB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;8CAAe;AACb;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;qDAAuB;AACtB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;qDAAuB;AAE1C;IAAR,KAAK,EAAE;;6CAAU;AAIQ;IAAzB,KAAK,CAAC,iBAAiB,CAAC;8BAAe,WAAW;oDAAA;AAnDxC,eAAe;IAD3B,aAAa,CAAC,mBAAmB,CAAC;GACtB,eAAe,CA4O3B","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: String }) _help?: 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:\n this.lifecycle.params['title'] ||\n (this._board ? this._board.name : this._showSpinner ? 'Fetching board...' : 'Board Not Found'),\n help: this._help\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 history\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._help = lifecycle.params['help']\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 if (!id) {\n return\n }\n\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"]}
|