@things-factory/board-ui 6.2.102 → 6.2.103

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.
Files changed (151) hide show
  1. package/dist-client/apptools/favorite-tool.d.ts +26 -0
  2. package/dist-client/apptools/favorite-tool.js +129 -0
  3. package/dist-client/apptools/favorite-tool.js.map +1 -0
  4. package/dist-client/board-list/board-importer.d.ts +6 -0
  5. package/dist-client/board-list/board-importer.js +112 -0
  6. package/dist-client/board-list/board-importer.js.map +1 -0
  7. package/dist-client/board-list/board-tile-list.d.ts +22 -0
  8. package/dist-client/board-list/board-tile-list.js +264 -0
  9. package/dist-client/board-list/board-tile-list.js.map +1 -0
  10. package/dist-client/board-list/group-bar.d.ts +14 -0
  11. package/dist-client/board-list/group-bar.js +145 -0
  12. package/dist-client/board-list/group-bar.js.map +1 -0
  13. package/dist-client/board-list/play-group-bar.d.ts +21 -0
  14. package/dist-client/board-list/play-group-bar.js +142 -0
  15. package/dist-client/board-list/play-group-bar.js.map +1 -0
  16. package/dist-client/board-provider.d.ts +3 -0
  17. package/dist-client/board-provider.js +77 -0
  18. package/dist-client/board-provider.js.map +1 -0
  19. package/dist-client/bootstrap.d.ts +2 -0
  20. package/dist-client/bootstrap.js +30 -0
  21. package/dist-client/bootstrap.js.map +1 -0
  22. package/dist-client/data-grist/board-editor.d.ts +14 -0
  23. package/dist-client/data-grist/board-editor.js +110 -0
  24. package/dist-client/data-grist/board-editor.js.map +1 -0
  25. package/dist-client/data-grist/board-renderer.d.ts +2 -0
  26. package/dist-client/data-grist/board-renderer.js +134 -0
  27. package/dist-client/data-grist/board-renderer.js.map +1 -0
  28. package/dist-client/data-grist/color-map-editor.d.ts +4 -0
  29. package/dist-client/data-grist/color-map-editor.js +15 -0
  30. package/dist-client/data-grist/color-map-editor.js.map +1 -0
  31. package/dist-client/data-grist/color-ranges-editor.d.ts +4 -0
  32. package/dist-client/data-grist/color-ranges-editor.js +15 -0
  33. package/dist-client/data-grist/color-ranges-editor.js.map +1 -0
  34. package/dist-client/graphql/board-template.d.ts +5 -0
  35. package/dist-client/graphql/board-template.js +128 -0
  36. package/dist-client/graphql/board-template.js.map +1 -0
  37. package/dist-client/graphql/board.d.ts +19 -0
  38. package/dist-client/graphql/board.js +231 -0
  39. package/dist-client/graphql/board.js.map +1 -0
  40. package/dist-client/graphql/favorite-board.d.ts +1 -0
  41. package/dist-client/graphql/favorite-board.js +24 -0
  42. package/dist-client/graphql/favorite-board.js.map +1 -0
  43. package/dist-client/graphql/group.d.ts +6 -0
  44. package/dist-client/graphql/group.js +125 -0
  45. package/dist-client/graphql/group.js.map +1 -0
  46. package/dist-client/graphql/index.d.ts +6 -0
  47. package/dist-client/graphql/index.js +7 -0
  48. package/dist-client/graphql/index.js.map +1 -0
  49. package/dist-client/graphql/my-board.d.ts +1 -0
  50. package/dist-client/graphql/my-board.js +24 -0
  51. package/dist-client/graphql/my-board.js.map +1 -0
  52. package/dist-client/graphql/play-group.d.ts +7 -0
  53. package/dist-client/graphql/play-group.js +173 -0
  54. package/dist-client/graphql/play-group.js.map +1 -0
  55. package/dist-client/index.d.ts +8 -0
  56. package/dist-client/index.js +9 -0
  57. package/dist-client/index.js.map +1 -0
  58. package/dist-client/pages/attachment-list-page.d.ts +30 -0
  59. package/dist-client/pages/attachment-list-page.js +128 -0
  60. package/dist-client/pages/attachment-list-page.js.map +1 -0
  61. package/dist-client/pages/board-list-page.d.ts +109 -0
  62. package/dist-client/pages/board-list-page.js +532 -0
  63. package/dist-client/pages/board-list-page.js.map +1 -0
  64. package/dist-client/pages/board-modeller-page.d.ts +49 -0
  65. package/dist-client/pages/board-modeller-page.js +309 -0
  66. package/dist-client/pages/board-modeller-page.js.map +1 -0
  67. package/dist-client/pages/board-player-by-name-page.d.ts +4 -0
  68. package/dist-client/pages/board-player-by-name-page.js +32 -0
  69. package/dist-client/pages/board-player-by-name-page.js.map +1 -0
  70. package/dist-client/pages/board-player-page.d.ts +42 -0
  71. package/dist-client/pages/board-player-page.js +230 -0
  72. package/dist-client/pages/board-player-page.js.map +1 -0
  73. package/dist-client/pages/board-template/board-template-list-page.d.ts +37 -0
  74. package/dist-client/pages/board-template/board-template-list-page.js +226 -0
  75. package/dist-client/pages/board-template/board-template-list-page.js.map +1 -0
  76. package/dist-client/pages/board-viewer-by-name-page.d.ts +4 -0
  77. package/dist-client/pages/board-viewer-by-name-page.js +27 -0
  78. package/dist-client/pages/board-viewer-by-name-page.js.map +1 -0
  79. package/dist-client/pages/board-viewer-page.d.ts +41 -0
  80. package/dist-client/pages/board-viewer-page.js +246 -0
  81. package/dist-client/pages/board-viewer-page.js.map +1 -0
  82. package/dist-client/pages/font-list-page.d.ts +9 -0
  83. package/dist-client/pages/font-list-page.js +31 -0
  84. package/dist-client/pages/font-list-page.js.map +1 -0
  85. package/dist-client/pages/play-list-page.d.ts +58 -0
  86. package/dist-client/pages/play-list-page.js +364 -0
  87. package/dist-client/pages/play-list-page.js.map +1 -0
  88. package/dist-client/pages/printable-board-viewer-page.d.ts +11 -0
  89. package/dist-client/pages/printable-board-viewer-page.js +43 -0
  90. package/dist-client/pages/printable-board-viewer-page.js.map +1 -0
  91. package/dist-client/pages/theme/theme-editors.d.ts +5 -0
  92. package/dist-client/pages/theme/theme-editors.js +53 -0
  93. package/dist-client/pages/theme/theme-editors.js.map +1 -0
  94. package/dist-client/pages/theme/theme-list-page.d.ts +49 -0
  95. package/dist-client/pages/theme/theme-list-page.js +318 -0
  96. package/dist-client/pages/theme/theme-list-page.js.map +1 -0
  97. package/dist-client/pages/things-scene-components-with-tools.import +0 -0
  98. package/dist-client/pages/things-scene-components.import +0 -0
  99. package/dist-client/route.d.ts +1 -0
  100. package/dist-client/route.js +41 -0
  101. package/dist-client/route.js.map +1 -0
  102. package/dist-client/setting-let/board-view-setting-let.d.ts +14 -0
  103. package/dist-client/setting-let/board-view-setting-let.js +66 -0
  104. package/dist-client/setting-let/board-view-setting-let.js.map +1 -0
  105. package/dist-client/themes/board-theme.css +76 -0
  106. package/dist-client/tsconfig.tsbuildinfo +1 -0
  107. package/dist-client/viewparts/board-basic-info.d.ts +47 -0
  108. package/dist-client/viewparts/board-basic-info.js +641 -0
  109. package/dist-client/viewparts/board-basic-info.js.map +1 -0
  110. package/dist-client/viewparts/board-info-link.d.ts +12 -0
  111. package/dist-client/viewparts/board-info-link.js +59 -0
  112. package/dist-client/viewparts/board-info-link.js.map +1 -0
  113. package/dist-client/viewparts/board-info.d.ts +14 -0
  114. package/dist-client/viewparts/board-info.js +94 -0
  115. package/dist-client/viewparts/board-info.js.map +1 -0
  116. package/dist-client/viewparts/board-template-builder.d.ts +16 -0
  117. package/dist-client/viewparts/board-template-builder.js +145 -0
  118. package/dist-client/viewparts/board-template-builder.js.map +1 -0
  119. package/dist-client/viewparts/board-versions.d.ts +12 -0
  120. package/dist-client/viewparts/board-versions.js +157 -0
  121. package/dist-client/viewparts/board-versions.js.map +1 -0
  122. package/dist-client/viewparts/group-info-basic.d.ts +16 -0
  123. package/dist-client/viewparts/group-info-basic.js +247 -0
  124. package/dist-client/viewparts/group-info-basic.js.map +1 -0
  125. package/dist-client/viewparts/group-info-import.d.ts +15 -0
  126. package/dist-client/viewparts/group-info-import.js +137 -0
  127. package/dist-client/viewparts/group-info-import.js.map +1 -0
  128. package/dist-client/viewparts/group-info.d.ts +10 -0
  129. package/dist-client/viewparts/group-info.js +92 -0
  130. package/dist-client/viewparts/group-info.js.map +1 -0
  131. package/dist-client/viewparts/index.d.ts +3 -0
  132. package/dist-client/viewparts/index.js +4 -0
  133. package/dist-client/viewparts/index.js.map +1 -0
  134. package/dist-client/viewparts/link-builder.d.ts +22 -0
  135. package/dist-client/viewparts/link-builder.js +217 -0
  136. package/dist-client/viewparts/link-builder.js.map +1 -0
  137. package/dist-client/viewparts/play-group-info-basic.d.ts +16 -0
  138. package/dist-client/viewparts/play-group-info-basic.js +249 -0
  139. package/dist-client/viewparts/play-group-info-basic.js.map +1 -0
  140. package/dist-client/viewparts/play-group-info-link.d.ts +10 -0
  141. package/dist-client/viewparts/play-group-info-link.js +48 -0
  142. package/dist-client/viewparts/play-group-info-link.js.map +1 -0
  143. package/dist-client/viewparts/play-group-info.d.ts +13 -0
  144. package/dist-client/viewparts/play-group-info.js +90 -0
  145. package/dist-client/viewparts/play-group-info.js.map +1 -0
  146. package/dist-server/index.js +5 -0
  147. package/dist-server/index.js.map +1 -0
  148. package/dist-server/migrations/index.js +12 -0
  149. package/dist-server/migrations/index.js.map +1 -0
  150. package/dist-server/tsconfig.tsbuildinfo +1 -0
  151. package/package.json +5 -5
@@ -0,0 +1,109 @@
1
+ import '@material/mwc-icon';
2
+ import '../viewparts/board-info';
3
+ import '../viewparts/group-info';
4
+ import '../board-list/board-tile-list';
5
+ import '../board-list/group-bar';
6
+ import { PageView } from '@operato/shell';
7
+ declare const BoardListPage_base: (new (...args: any[]) => import("lit").LitElement) & (new (...args: any[]) => {
8
+ _storeUnsubscribe: import("redux").Unsubscribe;
9
+ connectedCallback(): void;
10
+ disconnectedCallback(): void;
11
+ stateChanged(_state: unknown): void;
12
+ readonly isConnected: boolean;
13
+ }) & (new (...args: any[]) => {
14
+ _infiniteScrollOptions: {
15
+ threshold: number;
16
+ limit: number;
17
+ totalProp: string;
18
+ pageProp: string;
19
+ };
20
+ onScroll: import("lodash").DebouncedFunc<(e: any) => void>;
21
+ scrollAction(): Promise<void>;
22
+ }) & typeof PageView;
23
+ export declare class BoardListPage extends BoardListPage_base {
24
+ static styles: import("lit").CSSResult[];
25
+ groupId?: string;
26
+ groups: any[];
27
+ boards: any[];
28
+ favorites: any[];
29
+ searchText: string;
30
+ scrollTargetEl: HTMLElement;
31
+ private _page;
32
+ private _total;
33
+ private page?;
34
+ get context(): {
35
+ title: {
36
+ icon: string;
37
+ text: string;
38
+ };
39
+ search: {
40
+ handler: (search: any) => void;
41
+ value: string;
42
+ };
43
+ board_topmenu: boolean;
44
+ };
45
+ constructor();
46
+ render(): import("lit-html").TemplateResult<1>;
47
+ refresh(): Promise<void>;
48
+ getBoards({ page, limit }?: {
49
+ page?: number | undefined;
50
+ limit?: number | undefined;
51
+ }): Promise<any>;
52
+ getFavoriteBoards({ page, limit }?: {
53
+ page?: number | undefined;
54
+ limit?: number | undefined;
55
+ }): Promise<any>;
56
+ getMyBoards({ page, limit }?: {
57
+ page?: number | undefined;
58
+ limit?: number | undefined;
59
+ }): Promise<any>;
60
+ refreshBoards(): Promise<void>;
61
+ appendBoards(): Promise<void>;
62
+ scrollAction(): Promise<void>;
63
+ pageInitialized(): Promise<void>;
64
+ pageUpdated(changes: any, lifecycle: any): Promise<void>;
65
+ stateChanged(state: any): void;
66
+ firstUpdated(): void;
67
+ onInfoBoard(board: any): Promise<void>;
68
+ onInfoGroup(groupId: any): Promise<void>;
69
+ onCreateGroup(group: any): Promise<void>;
70
+ onUpdateGroup(group: any): Promise<void>;
71
+ onDeleteGroup(group: any): Promise<void>;
72
+ onImportBoards({ group, files, overwrite }: {
73
+ group: any;
74
+ files: any;
75
+ overwrite: any;
76
+ }): Promise<void>;
77
+ onCreateBoard(board: any): Promise<void>;
78
+ onCloneBoard({ id, name, description, targetSubdomain, targetGroupId }: {
79
+ id: any;
80
+ name: any;
81
+ description: any;
82
+ targetSubdomain: any;
83
+ targetGroupId: any;
84
+ }): Promise<void>;
85
+ onReleaseBoard(board: any): Promise<void>;
86
+ onRevertBoardVersion({ id, version }: {
87
+ id: any;
88
+ version: any;
89
+ }): Promise<void>;
90
+ onUpdateBoard(board: any): Promise<void>;
91
+ onDeleteBoard(board: any): Promise<void>;
92
+ onJoinPlayGroup({ board, playGroup }: {
93
+ board: any;
94
+ playGroup: any;
95
+ }): Promise<void>;
96
+ onLeavePlayGroup({ board, playGroup }: {
97
+ board: any;
98
+ playGroup: any;
99
+ }): Promise<void>;
100
+ onRegisterTemplate({ id, name, description, visibility }: {
101
+ id: any;
102
+ name: any;
103
+ description: any;
104
+ visibility: any;
105
+ }): Promise<void>;
106
+ refreshFavorites(): Promise<void>;
107
+ _notify(level: 'info' | 'error' | 'warn', message: any, ex?: any): void;
108
+ }
109
+ export {};
@@ -0,0 +1,532 @@
1
+ import { __decorate, __metadata } from "tslib";
2
+ import '@material/mwc-icon';
3
+ import '../viewparts/board-info';
4
+ import '../viewparts/group-info';
5
+ import '../board-list/board-tile-list';
6
+ import '../board-list/group-bar';
7
+ import gql from 'graphql-tag';
8
+ import { css, html } from 'lit';
9
+ import { customElement, property, query, state } from 'lit/decorators.js';
10
+ import { connect } from 'pwa-helpers/connect-mixin.js';
11
+ import { client } from '@operato/graphql';
12
+ import { i18next, localize } from '@operato/i18n';
13
+ import { openOverlay } from '@operato/layout';
14
+ import { pulltorefresh } from '@operato/pull-to-refresh';
15
+ import { navigate, PageView, store } from '@operato/shell';
16
+ import { ScrollbarStyles } from '@operato/styles';
17
+ import InfiniteScrollable from '@operato/utils/mixins/infinite-scrollable.js';
18
+ import { UPDATE_FAVORITES } from '@things-factory/fav-base';
19
+ import { swipe } from '@things-factory/utils';
20
+ import { cloneBoard, releaseBoard, revertBoardVersion, createBoard, createGroup, deleteBoard, deleteGroup, fetchBoardList, fetchFavoriteBoardList, fetchMyBoardList, fetchGroupList, updateBoard, updateGroup, importBoards } from '../graphql';
21
+ let BoardListPage = class BoardListPage extends localize(i18next)(connect(store)(InfiniteScrollable(PageView))) {
22
+ get context() {
23
+ var groupId = this.groupId;
24
+ var group = this.groups && this.groups.find(group => group.id === groupId);
25
+ return {
26
+ title: {
27
+ icon: 'dashboard',
28
+ text: group ? 'Group ' + group.name : groupId == 'favor' ? 'Favorite' : groupId == 'mywork' ? 'My works' : 'Board List'
29
+ },
30
+ search: {
31
+ handler: search => {
32
+ this.searchText = search;
33
+ this.refreshBoards();
34
+ },
35
+ value: this.searchText || ''
36
+ },
37
+ board_topmenu: true
38
+ };
39
+ }
40
+ constructor() {
41
+ super();
42
+ this.groups = [];
43
+ this.boards = [];
44
+ this.favorites = [];
45
+ this.searchText = '';
46
+ this._page = 1;
47
+ this._total = 0; /* required for infinite-scrolling */
48
+ this._infiniteScrollOptions.limit = 50;
49
+ }
50
+ render() {
51
+ return html `
52
+ <group-bar .groups=${this.groups} .groupId=${this.groupId} targetPage="board-list" @info-group=${e => this.onInfoGroup(e.detail)}></group-bar>
53
+
54
+ <board-tile-list
55
+ id="list"
56
+ .boards=${this.boards}
57
+ .favorites=${this.favorites}
58
+ .groups=${this.groups}
59
+ .group=${this.groupId}
60
+ search-text=${this.searchText}
61
+ @info-board=${e => this.onInfoBoard(e.detail)}
62
+ @scroll=${e => {
63
+ this.onScroll(e);
64
+ }}
65
+ @create-board=${e => this.onCreateBoard(e.detail)}
66
+ @refresh-favorites=${e => this.refreshFavorites()}
67
+ creatable
68
+ ></board-tile-list>
69
+ `;
70
+ }
71
+ async refresh() {
72
+ this.groups = (await fetchGroupList()).groups.items;
73
+ if (this.groups) {
74
+ await this.refreshBoards();
75
+ }
76
+ }
77
+ async getBoards({ page = 1, limit = this._infiniteScrollOptions.limit } = {}) {
78
+ if (this.groupId && this.groupId == 'favor') {
79
+ return await this.getFavoriteBoards({
80
+ page,
81
+ limit
82
+ });
83
+ }
84
+ else if (this.groupId && this.groupId == 'mywork') {
85
+ return await this.getMyBoards({
86
+ page,
87
+ limit
88
+ });
89
+ }
90
+ const filters = [];
91
+ if (this.groupId) {
92
+ filters.push({
93
+ name: 'groupId',
94
+ operator: 'eq',
95
+ value: this.groupId
96
+ });
97
+ }
98
+ if (this.searchText) {
99
+ filters.push({
100
+ name: 'name',
101
+ operator: 'search',
102
+ value: '%' + this.searchText + '%'
103
+ });
104
+ }
105
+ var listParam = {
106
+ filters,
107
+ sortings: [
108
+ {
109
+ name: 'name',
110
+ desc: false
111
+ }
112
+ ],
113
+ pagination: {
114
+ page,
115
+ limit
116
+ }
117
+ };
118
+ return (await fetchBoardList(listParam)).boards;
119
+ }
120
+ async getFavoriteBoards({ page = 1, limit = this._infiniteScrollOptions.limit } = {}) {
121
+ const filters = [];
122
+ if (this.searchText) {
123
+ filters.push({
124
+ name: 'name',
125
+ operator: 'search',
126
+ value: '%' + this.searchText + '%'
127
+ });
128
+ }
129
+ var listParam = {
130
+ filters,
131
+ pagination: {
132
+ page,
133
+ limit
134
+ }
135
+ };
136
+ return (await fetchFavoriteBoardList(listParam)).favoriteBoards;
137
+ }
138
+ async getMyBoards({ page = 1, limit = this._infiniteScrollOptions.limit } = {}) {
139
+ const filters = [];
140
+ if (this.searchText) {
141
+ filters.push({
142
+ name: 'name',
143
+ operator: 'search',
144
+ value: '%' + this.searchText + '%'
145
+ });
146
+ }
147
+ var listParam = {
148
+ filters,
149
+ pagination: {
150
+ page,
151
+ limit
152
+ }
153
+ };
154
+ return (await fetchMyBoardList(listParam)).boardsCreatedByMe;
155
+ }
156
+ async refreshBoards() {
157
+ if (!this.groups) {
158
+ await this.refresh();
159
+ return;
160
+ }
161
+ var { items: boards, total } = await this.getBoards();
162
+ this.boards = boards;
163
+ this._page = 1;
164
+ this._total = total;
165
+ this.updateContext();
166
+ this.scrollTargetEl.style.transition = '';
167
+ this.scrollTargetEl.style.transform = `translate3d(0, 0, 0)`;
168
+ }
169
+ async appendBoards() {
170
+ if (!this.groups) {
171
+ await this.refresh();
172
+ return;
173
+ }
174
+ var { items: boards, total } = await this.getBoards({ page: this._page + 1 });
175
+ this.boards = [...this.boards, ...boards];
176
+ this._page = this._page + 1;
177
+ this._total = total;
178
+ }
179
+ async scrollAction() {
180
+ return this.appendBoards();
181
+ }
182
+ async pageInitialized() {
183
+ this.refresh();
184
+ }
185
+ async pageUpdated(changes, lifecycle) {
186
+ var _a;
187
+ if (this.active) {
188
+ this.page = lifecycle.page;
189
+ this.groupId = lifecycle.resourceId;
190
+ this.searchText = ((_a = lifecycle.params) === null || _a === void 0 ? void 0 : _a.search) || '';
191
+ await this.updateComplete;
192
+ this.refreshBoards();
193
+ }
194
+ }
195
+ stateChanged(state) {
196
+ this.favorites = state.favorite.favorites;
197
+ }
198
+ firstUpdated() {
199
+ const list = this.scrollTargetEl;
200
+ pulltorefresh({
201
+ container: this.renderRoot,
202
+ scrollable: list,
203
+ refresh: () => {
204
+ return this.refresh();
205
+ }
206
+ });
207
+ swipe({
208
+ container: list,
209
+ animates: {
210
+ dragging: async (d, opts) => {
211
+ var groups = [{ id: '' }, { id: 'favor' }, ...this.groups];
212
+ var currentIndex = groups.findIndex(group => group.id == this.groupId);
213
+ if ((d > 0 && currentIndex <= 0) || (d < 0 && currentIndex >= groups.length - 1)) {
214
+ /* TODO blocked gesture */
215
+ return false;
216
+ }
217
+ list.style.transform = `translate3d(${d}px, 0, 0)`;
218
+ },
219
+ aborting: async (opts) => {
220
+ list.style.transition = 'transform 0.3s';
221
+ list.style.transform = `translate3d(0, 0, 0)`;
222
+ setTimeout(() => {
223
+ list.style.transition = '';
224
+ });
225
+ },
226
+ swiping: async (d, opts) => {
227
+ var groups = [{ id: '' }, { id: 'favor' }, ...this.groups];
228
+ var currentIndex = groups.findIndex(group => group.id == this.groupId);
229
+ if ((d > 0 && currentIndex <= 0) || (d < 0 && currentIndex >= groups.length - 1)) {
230
+ list.style.transition = '';
231
+ list.style.transform = `translate3d(0, 0, 0)`;
232
+ }
233
+ else {
234
+ list.style.transition = 'transform 0.3s';
235
+ list.style.transform = `translate3d(${d < 0 ? '-100%' : '100%'}, 0, 0)`;
236
+ navigate(`${this.page}/${groups[currentIndex + (d < 0 ? 1 : -1)].id}${this.searchText ? '?search=' + this.searchText : ''}`);
237
+ }
238
+ }
239
+ }
240
+ });
241
+ }
242
+ async onInfoBoard(board) {
243
+ openOverlay('viewpart-info', {
244
+ template: html `
245
+ <board-info
246
+ .board=${board}
247
+ .groupId=${this.groupId}
248
+ @clone-board=${e => this.onCloneBoard(e.detail)}
249
+ @release-board=${e => this.onReleaseBoard(e.detail)}
250
+ @revert-board-version=${e => this.onRevertBoardVersion(e.detail)}
251
+ @update-board=${e => this.onUpdateBoard(e.detail)}
252
+ @delete-board=${e => this.onDeleteBoard(e.detail)}
253
+ @join-playgroup=${e => this.onJoinPlayGroup(e.detail)}
254
+ @leave-playgroup=${e => this.onLeavePlayGroup(e.detail)}
255
+ @register-template=${e => this.onRegisterTemplate(e.detail)}
256
+ ></board-info>
257
+ `
258
+ });
259
+ }
260
+ async onInfoGroup(groupId) {
261
+ openOverlay('viewpart-info', {
262
+ template: html `
263
+ <group-info
264
+ .groupId=${groupId}
265
+ @update-group=${e => this.onUpdateGroup(e.detail)}
266
+ @delete-group=${e => this.onDeleteGroup(e.detail)}
267
+ @create-group=${e => this.onCreateGroup(e.detail)}
268
+ @import-boards=${e => this.onImportBoards(e.detail)}
269
+ ></group-info>
270
+ `
271
+ });
272
+ }
273
+ async onCreateGroup(group) {
274
+ try {
275
+ const data = await createGroup(group);
276
+ data && this._notify('info', i18next.t('text.group created', { group: group.name }));
277
+ }
278
+ catch (ex) {
279
+ this._notify('error', ex, ex);
280
+ }
281
+ this.refresh();
282
+ }
283
+ async onUpdateGroup(group) {
284
+ try {
285
+ const data = await updateGroup(group);
286
+ data && this._notify('info', i18next.t('text.group updated', { group: group.name }));
287
+ }
288
+ catch (ex) {
289
+ this._notify('error', ex, ex);
290
+ }
291
+ this.refresh();
292
+ }
293
+ async onDeleteGroup(group) {
294
+ try {
295
+ const data = await deleteGroup(group.id);
296
+ data && this._notify('info', i18next.t('text.group deleted', { group: group.name }));
297
+ }
298
+ catch (ex) {
299
+ this._notify('error', ex, ex);
300
+ }
301
+ this.refresh();
302
+ }
303
+ async onImportBoards({ group, files, overwrite }) {
304
+ try {
305
+ const data = await importBoards({ groupId: group.id, files, overwrite });
306
+ data && this._notify('info', i18next.t('text.boards imported', { count: files.length, group: group.name }));
307
+ }
308
+ catch (ex) {
309
+ this._notify('error', ex, ex);
310
+ }
311
+ this.refresh();
312
+ }
313
+ async onCreateBoard(board) {
314
+ try {
315
+ if (!board.model) {
316
+ board.model = {
317
+ width: 800,
318
+ height: 600
319
+ };
320
+ }
321
+ const data = await createBoard(board);
322
+ data && this._notify('info', i18next.t('text.board created', { board: board.name }));
323
+ }
324
+ catch (ex) {
325
+ this._notify('error', ex, ex);
326
+ }
327
+ this.refreshBoards();
328
+ }
329
+ async onCloneBoard({ id, name, description, targetSubdomain, targetGroupId }) {
330
+ try {
331
+ const data = await cloneBoard({
332
+ id,
333
+ name,
334
+ description,
335
+ targetSubdomain,
336
+ targetGroupId
337
+ });
338
+ data && this._notify('info', i18next.t('text.board cloned', { board: name }));
339
+ }
340
+ catch (ex) {
341
+ this._notify('error', ex, ex);
342
+ }
343
+ this.refreshBoards();
344
+ }
345
+ async onReleaseBoard(board) {
346
+ try {
347
+ const data = await releaseBoard(board);
348
+ data && this._notify('info', i18next.t('text.board released', { board: board.name }));
349
+ }
350
+ catch (ex) {
351
+ this._notify('error', ex, ex);
352
+ }
353
+ this.refreshBoards();
354
+ }
355
+ async onRevertBoardVersion({ id, version }) {
356
+ try {
357
+ const board = await revertBoardVersion(id, version);
358
+ board && this._notify('info', i18next.t('text.board reverted', { board: board.name, version }));
359
+ }
360
+ catch (ex) {
361
+ this._notify('error', ex, ex);
362
+ }
363
+ this.refreshBoards();
364
+ }
365
+ async onUpdateBoard(board) {
366
+ try {
367
+ const data = await updateBoard(board);
368
+ data && this._notify('info', i18next.t('text.board updated', { board: board.name }));
369
+ }
370
+ catch (ex) {
371
+ this._notify('error', ex, ex);
372
+ }
373
+ this.refreshBoards();
374
+ }
375
+ async onDeleteBoard(board) {
376
+ try {
377
+ const data = await deleteBoard(board.id);
378
+ data && this._notify('info', i18next.t('text.board deleted', { board: board.name }));
379
+ }
380
+ catch (ex) {
381
+ this._notify('error', ex, ex);
382
+ }
383
+ this.refreshBoards();
384
+ }
385
+ async onJoinPlayGroup({ board, playGroup }) {
386
+ try {
387
+ const { data } = await client.mutate({
388
+ mutation: gql `
389
+ mutation JoinPlayGroup($id: String!, $boardIds: [String!]!) {
390
+ joinPlayGroup(id: $id, boardIds: $boardIds) {
391
+ id
392
+ }
393
+ }
394
+ `,
395
+ variables: {
396
+ id: playGroup.id,
397
+ boardIds: [board.id]
398
+ }
399
+ });
400
+ data && this._notify('info', i18next.t('text.joined into play-group', { board: board.name, playGroup: playGroup.name }));
401
+ }
402
+ catch (ex) {
403
+ this._notify('error', ex, ex);
404
+ }
405
+ }
406
+ async onLeavePlayGroup({ board, playGroup }) {
407
+ try {
408
+ const { data } = await client.mutate({
409
+ mutation: gql `
410
+ mutation ($id: String!, $boardIds: [String!]!) {
411
+ leavePlayGroup(id: $id, boardIds: $boardIds) {
412
+ id
413
+ }
414
+ }
415
+ `,
416
+ variables: {
417
+ id: playGroup.id,
418
+ boardIds: [board.id]
419
+ }
420
+ });
421
+ data && this._notify('info', i18next.t('text.leaved from play-group', { board: board.name, playGroup: playGroup.name }));
422
+ }
423
+ catch (ex) {
424
+ this._notify('error', ex, ex);
425
+ }
426
+ }
427
+ async onRegisterTemplate({ id, name, description, visibility }) {
428
+ try {
429
+ const { data } = await client.mutate({
430
+ mutation: gql `
431
+ mutation ($id: String!, $name: String!, $description: String!, $visibility: String!) {
432
+ registerBoardAsTemplate(id: $id, name: $name, description: $description, visibility: $visibility) {
433
+ id
434
+ }
435
+ }
436
+ `,
437
+ variables: {
438
+ id,
439
+ name,
440
+ description,
441
+ visibility
442
+ }
443
+ });
444
+ data &&
445
+ this._notify('info', i18next.t('text.info_x_successfully', { x: i18next.t('text.register-template') }), {
446
+ name
447
+ });
448
+ }
449
+ catch (ex) {
450
+ this._notify('error', ex, ex);
451
+ }
452
+ }
453
+ async refreshFavorites() {
454
+ const { data } = await client.query({
455
+ query: gql `
456
+ query {
457
+ myFavorites {
458
+ id
459
+ routing
460
+ }
461
+ }
462
+ `
463
+ });
464
+ data &&
465
+ store.dispatch({
466
+ type: UPDATE_FAVORITES,
467
+ favorites: data.myFavorites.map(favorite => favorite.routing)
468
+ });
469
+ }
470
+ _notify(level, message, ex) {
471
+ document.dispatchEvent(new CustomEvent('notify', {
472
+ detail: {
473
+ level,
474
+ message,
475
+ ex
476
+ }
477
+ }));
478
+ }
479
+ };
480
+ BoardListPage.styles = [
481
+ ScrollbarStyles,
482
+ css `
483
+ :host {
484
+ display: flex;
485
+ flex-direction: column;
486
+ position: relative;
487
+
488
+ overflow: hidden;
489
+ }
490
+
491
+ board-tile-list {
492
+ flex: 1;
493
+ overflow-y: auto;
494
+ }
495
+
496
+ #create {
497
+ position: absolute;
498
+ bottom: 15px;
499
+ right: 16px;
500
+ }
501
+ `
502
+ ];
503
+ __decorate([
504
+ property({ type: String }),
505
+ __metadata("design:type", String)
506
+ ], BoardListPage.prototype, "groupId", void 0);
507
+ __decorate([
508
+ property({ type: Array }),
509
+ __metadata("design:type", Array)
510
+ ], BoardListPage.prototype, "groups", void 0);
511
+ __decorate([
512
+ property({ type: Array }),
513
+ __metadata("design:type", Array)
514
+ ], BoardListPage.prototype, "boards", void 0);
515
+ __decorate([
516
+ property({ type: Array }),
517
+ __metadata("design:type", Array)
518
+ ], BoardListPage.prototype, "favorites", void 0);
519
+ __decorate([
520
+ state(),
521
+ __metadata("design:type", String)
522
+ ], BoardListPage.prototype, "searchText", void 0);
523
+ __decorate([
524
+ query('board-tile-list'),
525
+ __metadata("design:type", HTMLElement)
526
+ ], BoardListPage.prototype, "scrollTargetEl", void 0);
527
+ BoardListPage = __decorate([
528
+ customElement('board-list-page'),
529
+ __metadata("design:paramtypes", [])
530
+ ], BoardListPage);
531
+ export { BoardListPage };
532
+ //# sourceMappingURL=board-list-page.js.map