@things-factory/board-ui 6.1.23 → 6.1.27
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/{board-provider.js → board-provider.ts} +5 -5
- package/client/data-grist/{board-editor.js → board-editor.ts} +31 -34
- package/client/data-grist/{board-renderer.js → board-renderer.ts} +10 -13
- package/client/pages/{board-modeller-page.js → board-modeller-page.ts} +44 -57
- package/client/pages/{board-player-page.js → board-player-page.ts} +51 -57
- package/client/pages/{board-viewer-page.js → board-viewer-page.ts} +50 -58
- package/client/pages/{printable-board-viewer-page.js → printable-board-viewer-page.ts} +2 -2
- package/client/pages/share/share-importer.ts +97 -0
- package/client/pages/share/share-list-page.ts +358 -0
- package/client/setting-let/{board-view-setting-let.js → board-view-setting-let.ts} +15 -21
- package/client/things-scene-import.d.ts +4 -0
- package/dist-client/board-provider.d.ts +3 -0
- package/dist-client/board-provider.js +77 -0
- package/dist-client/board-provider.js.map +1 -0
- package/dist-client/bootstrap.d.ts +2 -0
- package/dist-client/bootstrap.js +13 -0
- package/dist-client/bootstrap.js.map +1 -0
- package/dist-client/data-grist/board-editor.d.ts +14 -0
- package/dist-client/data-grist/board-editor.js +108 -0
- package/dist-client/data-grist/board-editor.js.map +1 -0
- package/dist-client/data-grist/board-renderer.d.ts +2 -0
- package/dist-client/data-grist/board-renderer.js +133 -0
- package/dist-client/data-grist/board-renderer.js.map +1 -0
- package/dist-client/index.d.ts +5 -0
- package/dist-client/index.js +6 -0
- package/dist-client/index.js.map +1 -0
- package/dist-client/pages/board-modeller-page.d.ts +48 -0
- package/dist-client/pages/board-modeller-page.js +284 -0
- package/dist-client/pages/board-modeller-page.js.map +1 -0
- package/dist-client/pages/board-player-page.d.ts +43 -0
- package/dist-client/pages/board-player-page.js +225 -0
- package/dist-client/pages/board-player-page.js.map +1 -0
- package/dist-client/pages/board-viewer-page.d.ts +39 -0
- package/dist-client/pages/board-viewer-page.js +224 -0
- package/dist-client/pages/board-viewer-page.js.map +1 -0
- package/dist-client/pages/printable-board-viewer-page.d.ts +11 -0
- package/dist-client/pages/printable-board-viewer-page.js +43 -0
- package/dist-client/pages/printable-board-viewer-page.js.map +1 -0
- package/dist-client/pages/share/share-importer.d.ts +22 -0
- package/dist-client/pages/share/share-importer.js +100 -0
- package/dist-client/pages/share/share-importer.js.map +1 -0
- package/dist-client/pages/share/share-list-page.d.ts +62 -0
- package/dist-client/pages/share/share-list-page.js +341 -0
- package/dist-client/pages/share/share-list-page.js.map +1 -0
- package/dist-client/pages/things-scene-components-with-tools.import +0 -0
- package/dist-client/pages/things-scene-components.import +0 -0
- package/dist-client/route.d.ts +1 -0
- package/dist-client/route.js +17 -0
- package/dist-client/route.js.map +1 -0
- package/dist-client/setting-let/board-view-setting-let.d.ts +14 -0
- package/dist-client/setting-let/board-view-setting-let.js +70 -0
- package/dist-client/setting-let/board-view-setting-let.js.map +1 -0
- package/dist-client/themes/board-theme.css +107 -0
- package/dist-client/tsconfig.tsbuildinfo +1 -0
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +12 -8
- /package/client/{bootstrap.js → bootstrap.ts} +0 -0
- /package/client/{index.js → index.ts} +0 -0
- /package/client/{route.js → route.ts} +0 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import './things-scene-components.import';
|
|
2
|
+
import '@operato/board/ox-board-player.js';
|
|
3
|
+
import { PageView } from '@operato/shell';
|
|
4
|
+
import { ReferenceMap } from '@hatiolab/things-scene';
|
|
5
|
+
import { BoardPlayer } from '@operato/board/ox-board-player.js';
|
|
6
|
+
declare const BoardPlayerPage_base: (new (...args: any[]) => {
|
|
7
|
+
_storeUnsubscribe: import("redux").Unsubscribe;
|
|
8
|
+
connectedCallback(): void;
|
|
9
|
+
disconnectedCallback(): void;
|
|
10
|
+
stateChanged(_state: unknown): void;
|
|
11
|
+
readonly isConnected: boolean;
|
|
12
|
+
}) & typeof PageView;
|
|
13
|
+
export declare class BoardPlayerPage extends BoardPlayerPage_base {
|
|
14
|
+
static styles: import("lit").CSSResult[];
|
|
15
|
+
_playGroup: any;
|
|
16
|
+
_playGroupId?: string | null;
|
|
17
|
+
_boards: any;
|
|
18
|
+
_baseUrl?: string;
|
|
19
|
+
_showSpinner?: boolean;
|
|
20
|
+
provider?: ReferenceMap<unknown> & {
|
|
21
|
+
dispose?: () => void;
|
|
22
|
+
};
|
|
23
|
+
subscriptionForAutoRefresh: any;
|
|
24
|
+
boardPlayer?: BoardPlayer;
|
|
25
|
+
connectedCallback(): void;
|
|
26
|
+
disconnectedCallback(): void;
|
|
27
|
+
refresh(): Promise<void>;
|
|
28
|
+
updated(changes: any): void;
|
|
29
|
+
stateChanged(state: any): void;
|
|
30
|
+
get oopsNote(): {
|
|
31
|
+
icon: string;
|
|
32
|
+
title: string;
|
|
33
|
+
description: string;
|
|
34
|
+
};
|
|
35
|
+
get context(): {
|
|
36
|
+
title: any;
|
|
37
|
+
};
|
|
38
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
39
|
+
pageUpdated(changes: any, lifecycle: any): void;
|
|
40
|
+
startSubscribingForAutoRefresh(): Promise<void>;
|
|
41
|
+
stopSubscribing(): Promise<void>;
|
|
42
|
+
}
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import './things-scene-components.import';
|
|
3
|
+
import '@operato/board/ox-board-player.js';
|
|
4
|
+
import gql from 'graphql-tag';
|
|
5
|
+
import { css, html } from 'lit';
|
|
6
|
+
import { customElement, property, query } from 'lit/decorators.js';
|
|
7
|
+
import { connect } from 'pwa-helpers/connect-mixin.js';
|
|
8
|
+
import { createBoardProvider } from '../board-provider';
|
|
9
|
+
import { store, PageView } from '@operato/shell';
|
|
10
|
+
import { clientSettingStore } from '@operato/shell/object-store.js';
|
|
11
|
+
import { client, subscribe } from '@operato/graphql';
|
|
12
|
+
import { BoardPlayer } from '@operato/board/ox-board-player.js';
|
|
13
|
+
const NOOP = () => { };
|
|
14
|
+
let BoardPlayerPage = class BoardPlayerPage extends connect(store)(PageView) {
|
|
15
|
+
connectedCallback() {
|
|
16
|
+
super.connectedCallback();
|
|
17
|
+
this.provider = createBoardProvider();
|
|
18
|
+
}
|
|
19
|
+
disconnectedCallback() {
|
|
20
|
+
super.disconnectedCallback();
|
|
21
|
+
this.provider.dispose();
|
|
22
|
+
delete this.provider;
|
|
23
|
+
}
|
|
24
|
+
async refresh() {
|
|
25
|
+
var _a;
|
|
26
|
+
if (!this._playGroupId) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
try {
|
|
30
|
+
this._showSpinner = true;
|
|
31
|
+
this.updateContext();
|
|
32
|
+
this._playGroup = (await client.query({
|
|
33
|
+
query: gql `
|
|
34
|
+
query FetchPlayGroup($id: String!) {
|
|
35
|
+
playGroup(id: $id) {
|
|
36
|
+
id
|
|
37
|
+
name
|
|
38
|
+
description
|
|
39
|
+
boards {
|
|
40
|
+
id
|
|
41
|
+
name
|
|
42
|
+
description
|
|
43
|
+
model
|
|
44
|
+
thumbnail
|
|
45
|
+
createdAt
|
|
46
|
+
creator {
|
|
47
|
+
id
|
|
48
|
+
name
|
|
49
|
+
}
|
|
50
|
+
updatedAt
|
|
51
|
+
updater {
|
|
52
|
+
id
|
|
53
|
+
name
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
`,
|
|
59
|
+
variables: {
|
|
60
|
+
id: this._playGroupId
|
|
61
|
+
}
|
|
62
|
+
})).data.playGroup;
|
|
63
|
+
if (!this._playGroup) {
|
|
64
|
+
throw 'playgroup not found';
|
|
65
|
+
}
|
|
66
|
+
this._boards = this._playGroup.boards;
|
|
67
|
+
}
|
|
68
|
+
catch (ex) {
|
|
69
|
+
document.dispatchEvent(new CustomEvent('notify', {
|
|
70
|
+
detail: {
|
|
71
|
+
level: 'error',
|
|
72
|
+
message: ex,
|
|
73
|
+
ex
|
|
74
|
+
}
|
|
75
|
+
}));
|
|
76
|
+
}
|
|
77
|
+
finally {
|
|
78
|
+
this._showSpinner = false;
|
|
79
|
+
this.updateContext();
|
|
80
|
+
const { autoRefresh = false } = ((_a = (await clientSettingStore.get('board-view'))) === null || _a === void 0 ? void 0 : _a.value) || {};
|
|
81
|
+
autoRefresh && this.startSubscribingForAutoRefresh();
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
updated(changes) {
|
|
85
|
+
if (changes.has('_playGroupId')) {
|
|
86
|
+
this.boardPlayer.stop();
|
|
87
|
+
this.refresh();
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
stateChanged(state) {
|
|
91
|
+
this._baseUrl = state.app.baseUrl;
|
|
92
|
+
}
|
|
93
|
+
get oopsNote() {
|
|
94
|
+
return {
|
|
95
|
+
icon: 'style',
|
|
96
|
+
title: 'EMPTY PLAYGROUP',
|
|
97
|
+
description: 'There are no board to be shown'
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
get context() {
|
|
101
|
+
return {
|
|
102
|
+
title: this._playGroup
|
|
103
|
+
? this._playGroup.name
|
|
104
|
+
: this._showSpinner
|
|
105
|
+
? 'Fetching playgroup...'
|
|
106
|
+
: 'Playgroup Not Found'
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
render() {
|
|
110
|
+
var oops = !this._showSpinner && !this._playGroup && this.oopsNote;
|
|
111
|
+
return oops
|
|
112
|
+
? html ` <oops-note icon=${oops.icon} title=${oops.title} description=${oops.description}></oops-note> `
|
|
113
|
+
: html `
|
|
114
|
+
<ox-board-player .boards=${this._boards} .provider=${this.provider}></ox-board-player>
|
|
115
|
+
<oops-spinner ?show=${this._showSpinner}></oops-spinner>
|
|
116
|
+
`;
|
|
117
|
+
}
|
|
118
|
+
pageUpdated(changes, lifecycle) {
|
|
119
|
+
if (this.active) {
|
|
120
|
+
this._playGroupId = lifecycle.resourceId;
|
|
121
|
+
this.refresh();
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
this.stopSubscribing();
|
|
125
|
+
this._playGroupId = null;
|
|
126
|
+
this.boardPlayer.stop();
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
async startSubscribingForAutoRefresh() {
|
|
130
|
+
if (!this._playGroupId) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
await this.stopSubscribing();
|
|
134
|
+
this.subscriptionForAutoRefresh = await subscribe({
|
|
135
|
+
query: gql `
|
|
136
|
+
subscription ($id: String!) {
|
|
137
|
+
playGroup(id: $id) {
|
|
138
|
+
id
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
`,
|
|
142
|
+
variables: {
|
|
143
|
+
id: this._playGroupId
|
|
144
|
+
}
|
|
145
|
+
}, {
|
|
146
|
+
next: async ({ data }) => {
|
|
147
|
+
await this.stopSubscribing();
|
|
148
|
+
if (data) {
|
|
149
|
+
this.refresh();
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
async stopSubscribing() {
|
|
155
|
+
var _a;
|
|
156
|
+
await ((_a = this.subscriptionForAutoRefresh) === null || _a === void 0 ? void 0 : _a.unsubscribe());
|
|
157
|
+
delete this.subscriptionForAutoRefresh;
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
BoardPlayerPage.styles = [
|
|
161
|
+
css `
|
|
162
|
+
:host {
|
|
163
|
+
display: flex;
|
|
164
|
+
flex-direction: column;
|
|
165
|
+
width: 100%;
|
|
166
|
+
height: 100%;
|
|
167
|
+
|
|
168
|
+
overflow: hidden;
|
|
169
|
+
position: relative;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
ox-board-player {
|
|
173
|
+
flex: 1;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
oops-spinner {
|
|
177
|
+
display: none;
|
|
178
|
+
position: absolute;
|
|
179
|
+
left: 50%;
|
|
180
|
+
top: 50%;
|
|
181
|
+
transform: translate(-50%, -50%);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
oops-spinner[show] {
|
|
185
|
+
display: block;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
oops-note {
|
|
189
|
+
display: block;
|
|
190
|
+
position: absolute;
|
|
191
|
+
left: 50%;
|
|
192
|
+
top: 50%;
|
|
193
|
+
transform: translate(-50%, -50%);
|
|
194
|
+
}
|
|
195
|
+
`
|
|
196
|
+
];
|
|
197
|
+
__decorate([
|
|
198
|
+
property({ type: Object }),
|
|
199
|
+
__metadata("design:type", Object)
|
|
200
|
+
], BoardPlayerPage.prototype, "_playGroup", void 0);
|
|
201
|
+
__decorate([
|
|
202
|
+
property({ type: String }),
|
|
203
|
+
__metadata("design:type", Object)
|
|
204
|
+
], BoardPlayerPage.prototype, "_playGroupId", void 0);
|
|
205
|
+
__decorate([
|
|
206
|
+
property({ type: Array }),
|
|
207
|
+
__metadata("design:type", Object)
|
|
208
|
+
], BoardPlayerPage.prototype, "_boards", void 0);
|
|
209
|
+
__decorate([
|
|
210
|
+
property({ type: String }),
|
|
211
|
+
__metadata("design:type", String)
|
|
212
|
+
], BoardPlayerPage.prototype, "_baseUrl", void 0);
|
|
213
|
+
__decorate([
|
|
214
|
+
property({ type: Boolean }),
|
|
215
|
+
__metadata("design:type", Boolean)
|
|
216
|
+
], BoardPlayerPage.prototype, "_showSpinner", void 0);
|
|
217
|
+
__decorate([
|
|
218
|
+
query('ox-board-player'),
|
|
219
|
+
__metadata("design:type", BoardPlayer)
|
|
220
|
+
], BoardPlayerPage.prototype, "boardPlayer", void 0);
|
|
221
|
+
BoardPlayerPage = __decorate([
|
|
222
|
+
customElement('board-player-page')
|
|
223
|
+
], BoardPlayerPage);
|
|
224
|
+
export { BoardPlayerPage };
|
|
225
|
+
//# sourceMappingURL=board-player-page.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"board-player-page.js","sourceRoot":"","sources":["../../client/pages/board-player-page.ts"],"names":[],"mappings":";AAAA,OAAO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AE,EAAE;gBACvB,MAAM,IAAI,CAAC,eAAe,EAAE,CAAA;gBAE5B,IAAI,IAAI,EAAE;oBACR,IAAI,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;;AAzNM,sBAAM,GAAG;IACd,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAkCF;CACF,CAAA;AAED;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;mDAAgB;AAC3C;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;qDAA6B;AACxD;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;gDAAa;AACvC;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;iDAAkB;AAC7C;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;qDAAuB;AAKnD;IAAC,KAAK,CAAC,iBAAiB,CAAC;8BAAe,WAAW;oDAAA;AAhDxC,eAAe;IAD3B,aAAa,CAAC,mBAAmB,CAAC;GACtB,eAAe,CA2N3B;SA3NY,eAAe","sourcesContent":["import './things-scene-components.import'\nimport '@operato/board/ox-board-player.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 { 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\nconst NOOP = () => {}\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 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 }) _playGroup: any\n @property({ type: String }) _playGroupId?: string | null\n @property({ type: Array }) _boards: any\n @property({ type: String }) _baseUrl?: string\n @property({ type: Boolean }) _showSpinner?: boolean\n\n provider?: ReferenceMap<unknown> & { dispose?: () => void }\n 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 refresh() {\n if (!this._playGroupId) {\n return\n }\n\n try {\n this._showSpinner = true\n this.updateContext()\n\n this._playGroup = (\n await client.query({\n query: gql`\n query FetchPlayGroup($id: String!) {\n playGroup(id: $id) {\n id\n name\n description\n boards {\n id\n name\n description\n model\n thumbnail\n createdAt\n creator {\n id\n name\n }\n updatedAt\n updater {\n id\n name\n }\n }\n }\n }\n `,\n variables: {\n id: this._playGroupId\n }\n })\n ).data.playGroup\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 = false } = (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\n ? this._playGroup.name\n : this._showSpinner\n ? 'Fetching playgroup...'\n : 'Playgroup Not Found'\n }\n }\n\n render() {\n var oops = !this._showSpinner && !this._playGroup && 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-player .boards=${this._boards} .provider=${this.provider}></ox-board-player>\n <oops-spinner ?show=${this._showSpinner}></oops-spinner>\n `\n }\n\n pageUpdated(changes, lifecycle) {\n if (this.active) {\n this._playGroupId = lifecycle.resourceId\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._playGroupId) {\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._playGroupId\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"]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import './things-scene-components.import';
|
|
2
|
+
import '@operato/board/ox-board-viewer.js';
|
|
3
|
+
import { BoardViewer } from '@operato/board';
|
|
4
|
+
import { PageView } from '@operato/shell';
|
|
5
|
+
declare const BoardViewerPage_base: (new (...args: any[]) => {
|
|
6
|
+
_storeUnsubscribe: import("redux").Unsubscribe;
|
|
7
|
+
connectedCallback(): void;
|
|
8
|
+
disconnectedCallback(): void;
|
|
9
|
+
stateChanged(_state: unknown): void;
|
|
10
|
+
readonly isConnected: boolean;
|
|
11
|
+
}) & typeof PageView;
|
|
12
|
+
export declare class BoardViewerPage extends BoardViewerPage_base {
|
|
13
|
+
static styles: import("lit").CSSResult[];
|
|
14
|
+
_board: any;
|
|
15
|
+
_boardId?: string;
|
|
16
|
+
_baseUrl?: string;
|
|
17
|
+
_interactive?: boolean;
|
|
18
|
+
_showSpinner?: boolean;
|
|
19
|
+
subscriptionForAutoRefresh: any;
|
|
20
|
+
boardViewer: BoardViewer;
|
|
21
|
+
get oopsNote(): {
|
|
22
|
+
icon: string;
|
|
23
|
+
title: string;
|
|
24
|
+
description: string;
|
|
25
|
+
};
|
|
26
|
+
get context(): {
|
|
27
|
+
title: any;
|
|
28
|
+
};
|
|
29
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
30
|
+
updated(changes: any): void;
|
|
31
|
+
pageUpdated(changes: any, lifecycle: any): void;
|
|
32
|
+
stateChanged(state: any): void;
|
|
33
|
+
refresh(): Promise<void>;
|
|
34
|
+
startSubscribingForAutoRefresh(): Promise<void>;
|
|
35
|
+
stopSubscribing(): Promise<void>;
|
|
36
|
+
getGrf(): Promise<string>;
|
|
37
|
+
printTrick(image: any): Promise<void>;
|
|
38
|
+
}
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import './things-scene-components.import';
|
|
3
|
+
import '@operato/board/ox-board-viewer.js';
|
|
4
|
+
import gql from 'graphql-tag';
|
|
5
|
+
import { css, html } from 'lit';
|
|
6
|
+
import { customElement, property, query } from 'lit/decorators.js';
|
|
7
|
+
import { connect } from 'pwa-helpers/connect-mixin.js';
|
|
8
|
+
import { buildLabelPrintCommand } from '@operato/barcode';
|
|
9
|
+
import { BoardViewer } from '@operato/board';
|
|
10
|
+
import { store, PageView } from '@operato/shell';
|
|
11
|
+
import { client, gqlContext, subscribe } from '@operato/graphql';
|
|
12
|
+
import { clientSettingStore } from '@operato/shell/object-store.js';
|
|
13
|
+
import { provider } from '../board-provider';
|
|
14
|
+
const NOOP = () => { };
|
|
15
|
+
let BoardViewerPage = class BoardViewerPage extends connect(store)(PageView) {
|
|
16
|
+
get oopsNote() {
|
|
17
|
+
return {
|
|
18
|
+
icon: 'insert_chart_outlined',
|
|
19
|
+
title: 'EMPTY BOARD',
|
|
20
|
+
description: 'There are no board to be shown'
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
get context() {
|
|
24
|
+
return {
|
|
25
|
+
/* can set the page title with the 'title' parameter. */
|
|
26
|
+
title: this.lifecycle.params['title'] ||
|
|
27
|
+
(this._board ? this._board.name : this._showSpinner ? 'Fetching board...' : 'Board Not Found')
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
render() {
|
|
31
|
+
var oops = !this._showSpinner && !this._board && this.oopsNote;
|
|
32
|
+
return oops
|
|
33
|
+
? html ` <oops-note icon=${oops.icon} title=${oops.title} description=${oops.description}></oops-note> `
|
|
34
|
+
: html `
|
|
35
|
+
<ox-board-viewer
|
|
36
|
+
.board=${this._board}
|
|
37
|
+
.provider=${provider}
|
|
38
|
+
?hide-fullscreen=${this._interactive}
|
|
39
|
+
?hide-navigation=${this._interactive}
|
|
40
|
+
></ox-board-viewer>
|
|
41
|
+
<oops-spinner ?show=${this._showSpinner}></oops-spinner>
|
|
42
|
+
`;
|
|
43
|
+
}
|
|
44
|
+
updated(changes) {
|
|
45
|
+
if (changes.has('_boardId')) {
|
|
46
|
+
this.refresh();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
pageUpdated(changes, lifecycle) {
|
|
50
|
+
if (this.active) {
|
|
51
|
+
this._boardId = lifecycle.resourceId;
|
|
52
|
+
this._interactive = lifecycle.params['interactive'] === 'true';
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
/*
|
|
56
|
+
* 비활성화된 페이지에서 render update가 발생하지 않으므로, 강제로 scene을 close 한다.
|
|
57
|
+
* 화면이 inactive 될 때, 굳이 scene을 close하는 이유는,
|
|
58
|
+
* 새로운 board가 선택되어 뷰어가 열릴 때, 기존 보드 잔상이 보이지 않도록 하기위해서이다.
|
|
59
|
+
*/
|
|
60
|
+
this.stopSubscribing();
|
|
61
|
+
if (this._boardId) {
|
|
62
|
+
let boardViewer = this.boardViewer;
|
|
63
|
+
boardViewer && boardViewer.closeScene();
|
|
64
|
+
}
|
|
65
|
+
this._boardId = '';
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
stateChanged(state) {
|
|
69
|
+
this._baseUrl = state.app.baseUrl;
|
|
70
|
+
}
|
|
71
|
+
async refresh() {
|
|
72
|
+
var _a;
|
|
73
|
+
if (!this._boardId) {
|
|
74
|
+
this._board = null;
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
try {
|
|
78
|
+
this._showSpinner = true;
|
|
79
|
+
this.updateContext();
|
|
80
|
+
var response = await client.query({
|
|
81
|
+
query: gql `
|
|
82
|
+
query FetchBoardById($id: String!) {
|
|
83
|
+
board(id: $id) {
|
|
84
|
+
id
|
|
85
|
+
name
|
|
86
|
+
model
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
`,
|
|
90
|
+
variables: { id: this._boardId },
|
|
91
|
+
context: gqlContext()
|
|
92
|
+
});
|
|
93
|
+
var board = response.data.board;
|
|
94
|
+
if (!board) {
|
|
95
|
+
this._board = null;
|
|
96
|
+
throw 'board not found';
|
|
97
|
+
}
|
|
98
|
+
this._board = Object.assign(Object.assign({}, board), { model: JSON.parse(board.model) });
|
|
99
|
+
}
|
|
100
|
+
catch (ex) {
|
|
101
|
+
document.dispatchEvent(new CustomEvent('notify', {
|
|
102
|
+
detail: {
|
|
103
|
+
level: 'error',
|
|
104
|
+
message: ex,
|
|
105
|
+
ex
|
|
106
|
+
}
|
|
107
|
+
}));
|
|
108
|
+
}
|
|
109
|
+
finally {
|
|
110
|
+
this._showSpinner = false;
|
|
111
|
+
this.updateContext();
|
|
112
|
+
const { autoRefresh = false } = ((_a = (await clientSettingStore.get('board-view'))) === null || _a === void 0 ? void 0 : _a.value) || {};
|
|
113
|
+
autoRefresh && this.startSubscribingForAutoRefresh();
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
async startSubscribingForAutoRefresh() {
|
|
117
|
+
if (!this._boardId) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
await this.stopSubscribing();
|
|
121
|
+
this.subscriptionForAutoRefresh = await subscribe({
|
|
122
|
+
query: gql `
|
|
123
|
+
subscription ($id: String!) {
|
|
124
|
+
board(id: $id) {
|
|
125
|
+
id
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
`,
|
|
129
|
+
variables: {
|
|
130
|
+
id: this._boardId
|
|
131
|
+
}
|
|
132
|
+
}, {
|
|
133
|
+
next: async ({ data }) => {
|
|
134
|
+
await this.stopSubscribing();
|
|
135
|
+
if (data) {
|
|
136
|
+
this.refresh();
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
async stopSubscribing() {
|
|
142
|
+
var _a;
|
|
143
|
+
await ((_a = this.subscriptionForAutoRefresh) === null || _a === void 0 ? void 0 : _a.unsubscribe());
|
|
144
|
+
delete this.subscriptionForAutoRefresh;
|
|
145
|
+
}
|
|
146
|
+
async getGrf() {
|
|
147
|
+
var { labelRotation } = this._board.model;
|
|
148
|
+
var { width, height, data } = (await this.boardViewer.getSceneImageData()) || {};
|
|
149
|
+
if (!width || !data) {
|
|
150
|
+
throw 'Cannot get SceneImageData...';
|
|
151
|
+
}
|
|
152
|
+
return buildLabelPrintCommand(data, width, height, labelRotation, false, false);
|
|
153
|
+
}
|
|
154
|
+
async printTrick(image) {
|
|
155
|
+
await this.boardViewer.printTrick(image);
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
BoardViewerPage.styles = [
|
|
159
|
+
css `
|
|
160
|
+
:host {
|
|
161
|
+
display: flex;
|
|
162
|
+
flex-direction: column;
|
|
163
|
+
|
|
164
|
+
width: 100%; /* 전체화면보기를 위해서 필요함. */
|
|
165
|
+
height: 100%;
|
|
166
|
+
|
|
167
|
+
overflow: hidden;
|
|
168
|
+
position: relative;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
ox-board-viewer {
|
|
172
|
+
flex: 1;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
oops-spinner {
|
|
176
|
+
display: none;
|
|
177
|
+
position: absolute;
|
|
178
|
+
left: 50%;
|
|
179
|
+
top: 50%;
|
|
180
|
+
transform: translate(-50%, -50%);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
oops-spinner[show] {
|
|
184
|
+
display: block;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
oops-note {
|
|
188
|
+
display: block;
|
|
189
|
+
position: absolute;
|
|
190
|
+
left: 50%;
|
|
191
|
+
top: 50%;
|
|
192
|
+
transform: translate(-50%, -50%);
|
|
193
|
+
}
|
|
194
|
+
`
|
|
195
|
+
];
|
|
196
|
+
__decorate([
|
|
197
|
+
property({ type: Object }),
|
|
198
|
+
__metadata("design:type", Object)
|
|
199
|
+
], BoardViewerPage.prototype, "_board", void 0);
|
|
200
|
+
__decorate([
|
|
201
|
+
property({ type: String }),
|
|
202
|
+
__metadata("design:type", String)
|
|
203
|
+
], BoardViewerPage.prototype, "_boardId", void 0);
|
|
204
|
+
__decorate([
|
|
205
|
+
property({ type: String }),
|
|
206
|
+
__metadata("design:type", String)
|
|
207
|
+
], BoardViewerPage.prototype, "_baseUrl", void 0);
|
|
208
|
+
__decorate([
|
|
209
|
+
property({ type: Boolean }),
|
|
210
|
+
__metadata("design:type", Boolean)
|
|
211
|
+
], BoardViewerPage.prototype, "_interactive", void 0);
|
|
212
|
+
__decorate([
|
|
213
|
+
property({ type: Boolean }),
|
|
214
|
+
__metadata("design:type", Boolean)
|
|
215
|
+
], BoardViewerPage.prototype, "_showSpinner", void 0);
|
|
216
|
+
__decorate([
|
|
217
|
+
query('ox-board-viewer'),
|
|
218
|
+
__metadata("design:type", BoardViewer)
|
|
219
|
+
], BoardViewerPage.prototype, "boardViewer", void 0);
|
|
220
|
+
BoardViewerPage = __decorate([
|
|
221
|
+
customElement('board-viewer-page')
|
|
222
|
+
], BoardViewerPage);
|
|
223
|
+
export { BoardViewerPage };
|
|
224
|
+
//# sourceMappingURL=board-viewer-page.js.map
|
|
@@ -0,0 +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;AAE1C,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,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;AAGd,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC;IAkD3D,IAAI,QAAQ;QACV,OAAO;YACL,IAAI,EAAE,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,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;;AAzNM,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;AAInD;IAAC,KAAK,CAAC,iBAAiB,CAAC;8BAAe,WAAW;oDAAA;AAhDxC,eAAe;IAD3B,aAAa,CAAC,mBAAmB,CAAC;GACtB,eAAe,CA2N3B;SA3NY,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 } 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\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 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` <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 ></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 } 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 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 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 } 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 = false } = (await clientSettingStore.get('board-view'))?.value || {}\n autoRefresh && this.startSubscribingForAutoRefresh()\n }\n }\n\n async startSubscribingForAutoRefresh() {\n if (!this._boardId) {\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._boardId\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"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BoardViewerPage } from './board-viewer-page';
|
|
2
|
+
export declare class PrintableBoardViewerPage extends BoardViewerPage {
|
|
3
|
+
get context(): {
|
|
4
|
+
printable: {
|
|
5
|
+
accept: string[];
|
|
6
|
+
content: () => Promise<any>;
|
|
7
|
+
};
|
|
8
|
+
title: any;
|
|
9
|
+
};
|
|
10
|
+
fetchImage(): Promise<unknown>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { BoardViewerPage } from './board-viewer-page';
|
|
2
|
+
function serialize(obj) {
|
|
3
|
+
var str = [];
|
|
4
|
+
for (var p in obj)
|
|
5
|
+
if (obj.hasOwnProperty(p)) {
|
|
6
|
+
str.push(encodeURIComponent(p) + '=' + encodeURIComponent(obj[p]));
|
|
7
|
+
}
|
|
8
|
+
return str.join('&');
|
|
9
|
+
}
|
|
10
|
+
function readFileAsync(file) {
|
|
11
|
+
return new Promise((resolve, reject) => {
|
|
12
|
+
let reader = new FileReader();
|
|
13
|
+
reader.onload = () => {
|
|
14
|
+
resolve(reader.result);
|
|
15
|
+
};
|
|
16
|
+
reader.onerror = reject;
|
|
17
|
+
reader.readAsDataURL(file);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
export class PrintableBoardViewerPage extends BoardViewerPage {
|
|
21
|
+
get context() {
|
|
22
|
+
return Object.assign(Object.assign({}, super.context), { printable: {
|
|
23
|
+
accept: ['preview'],
|
|
24
|
+
content: async () => {
|
|
25
|
+
const image = await this.fetchImage();
|
|
26
|
+
await this.printTrick(image);
|
|
27
|
+
return this;
|
|
28
|
+
}
|
|
29
|
+
} });
|
|
30
|
+
}
|
|
31
|
+
async fetchImage() {
|
|
32
|
+
const modelId = this._boardId;
|
|
33
|
+
const data = {
|
|
34
|
+
title: this.context.title
|
|
35
|
+
};
|
|
36
|
+
const queryString = serialize(data);
|
|
37
|
+
const url = `${location.origin}/screenshot/${modelId}${queryString ? '?' + queryString : ''}`;
|
|
38
|
+
const response = await fetch(url);
|
|
39
|
+
return await readFileAsync(await response.blob());
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
customElements.define('printable-board-viewer-page', PrintableBoardViewerPage);
|
|
43
|
+
//# sourceMappingURL=printable-board-viewer-page.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"printable-board-viewer-page.js","sourceRoot":"","sources":["../../client/pages/printable-board-viewer-page.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAErD,SAAS,SAAS,CAAC,GAAG;IACpB,IAAI,GAAG,GAAG,EAAc,CAAA;IACxB,KAAK,IAAI,CAAC,IAAI,GAAG;QACf,IAAI,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE;YACzB,GAAG,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;SACnE;IACH,OAAO,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AACtB,CAAC;AAED,SAAS,aAAa,CAAC,IAAI;IACzB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,IAAI,MAAM,GAAG,IAAI,UAAU,EAAE,CAAA;QAE7B,MAAM,CAAC,MAAM,GAAG,GAAG,EAAE;YACnB,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;QACxB,CAAC,CAAA;QAED,MAAM,CAAC,OAAO,GAAG,MAAM,CAAA;QACvB,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAA;IAC5B,CAAC,CAAC,CAAA;AACJ,CAAC;AAED,MAAM,OAAO,wBAAyB,SAAQ,eAAe;IAC3D,IAAI,OAAO;QACT,uCACK,KAAK,CAAC,OAAO,KAChB,SAAS,EAAE;gBACT,MAAM,EAAE,CAAC,SAAS,CAAC;gBACnB,OAAO,EAAE,KAAK,IAAI,EAAE;oBAClB,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,UAAU,EAAE,CAAA;oBACrC,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;oBAE5B,OAAO,IAAW,CAAA;gBACpB,CAAC;aACF,IACF;IACH,CAAC;IAED,KAAK,CAAC,UAAU;QACd,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAA;QAC7B,MAAM,IAAI,GAAG;YACX,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK;SAC1B,CAAA;QACD,MAAM,WAAW,GAAG,SAAS,CAAC,IAAI,CAAC,CAAA;QACnC,MAAM,GAAG,GAAG,GAAG,QAAQ,CAAC,MAAM,eAAe,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,GAAG,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE,CAAA;QAE7F,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,CAAA;QACjC,OAAO,MAAM,aAAa,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAA;IACnD,CAAC;CACF;AAED,cAAc,CAAC,MAAM,CAAC,6BAA6B,EAAE,wBAAwB,CAAC,CAAA","sourcesContent":["import { BoardViewerPage } from './board-viewer-page'\n\nfunction serialize(obj) {\n var str = [] as string[]\n for (var p in obj)\n if (obj.hasOwnProperty(p)) {\n str.push(encodeURIComponent(p) + '=' + encodeURIComponent(obj[p]))\n }\n return str.join('&')\n}\n\nfunction readFileAsync(file) {\n return new Promise((resolve, reject) => {\n let reader = new FileReader()\n\n reader.onload = () => {\n resolve(reader.result)\n }\n\n reader.onerror = reject\n reader.readAsDataURL(file)\n })\n}\n\nexport class PrintableBoardViewerPage extends BoardViewerPage {\n get context() {\n return {\n ...super.context,\n printable: {\n accept: ['preview'],\n content: async () => {\n const image = await this.fetchImage()\n await this.printTrick(image)\n\n return this as any\n }\n }\n }\n }\n\n async fetchImage() {\n const modelId = this._boardId\n const data = {\n title: this.context.title\n }\n const queryString = serialize(data)\n const url = `${location.origin}/screenshot/${modelId}${queryString ? '?' + queryString : ''}`\n\n const response = await fetch(url)\n return await readFileAsync(await response.blob())\n }\n}\n\ncustomElements.define('printable-board-viewer-page', PrintableBoardViewerPage)\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import '@operato/data-grist';
|
|
2
|
+
import { LitElement } from 'lit';
|
|
3
|
+
export declare class ShareImporter extends LitElement {
|
|
4
|
+
static styles: import("lit").CSSResult[];
|
|
5
|
+
shares: any[];
|
|
6
|
+
columns: {
|
|
7
|
+
list: {
|
|
8
|
+
fields: string[];
|
|
9
|
+
};
|
|
10
|
+
pagination: {
|
|
11
|
+
infinite: boolean;
|
|
12
|
+
};
|
|
13
|
+
columns: {
|
|
14
|
+
type: string;
|
|
15
|
+
name: string;
|
|
16
|
+
header: string;
|
|
17
|
+
width: number;
|
|
18
|
+
}[];
|
|
19
|
+
};
|
|
20
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
21
|
+
save(): Promise<void>;
|
|
22
|
+
}
|