@things-factory/board-ui 6.1.197 → 6.2.5
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-list/board-tile-list.ts +1 -0
- package/client/board-list/group-bar.ts +7 -1
- package/client/graphql/index.ts +1 -0
- package/client/graphql/my-board.ts +25 -0
- package/client/pages/{board-list-page.js → board-list-page.ts} +127 -64
- package/client/pages/{play-list-page.js → play-list-page.ts} +38 -40
- package/dist-client/board-list/board-tile-list.d.ts +1 -0
- package/dist-client/board-list/board-tile-list.js +4 -0
- package/dist-client/board-list/board-tile-list.js.map +1 -1
- package/dist-client/board-list/group-bar.d.ts +1 -0
- package/dist-client/board-list/group-bar.js +10 -1
- package/dist-client/board-list/group-bar.js.map +1 -1
- package/dist-client/graphql/index.d.ts +1 -0
- package/dist-client/graphql/index.js +1 -0
- package/dist-client/graphql/index.js.map +1 -1
- package/dist-client/graphql/my-board.d.ts +1 -0
- package/dist-client/graphql/my-board.js +24 -0
- package/dist-client/graphql/my-board.js.map +1 -0
- package/dist-client/pages/board-list-page.d.ts +103 -0
- package/dist-client/pages/board-list-page.js +144 -63
- package/dist-client/pages/board-list-page.js.map +1 -1
- package/dist-client/pages/play-list-page.d.ts +57 -0
- package/dist-client/pages/play-list-page.js +62 -41
- package/dist-client/pages/play-list-page.js.map +1 -1
- package/dist-client/pages/theme/theme-editors.d.ts +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/dist-client/viewparts/menu-tools.d.ts +0 -20
- package/dist-client/viewparts/menu-tools.js +0 -147
- package/dist-client/viewparts/menu-tools.js.map +0 -1
|
@@ -112,6 +112,7 @@ export class BoardTileList extends LitElement {
|
|
|
112
112
|
@property({ type: Array }) favorites: any[] = []
|
|
113
113
|
@property({ type: Array }) groups: any[] = []
|
|
114
114
|
@property({ type: String }) group?: string
|
|
115
|
+
@property({ type: String, attribute: 'search-text' }) searchText?: string
|
|
115
116
|
@property({ type: Boolean, attribute: 'reorderable' }) reorderable: boolean = false
|
|
116
117
|
|
|
117
118
|
private draggedItem
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '@material/mwc-icon'
|
|
2
2
|
|
|
3
|
-
import { css, html, LitElement } from 'lit'
|
|
3
|
+
import { css, html, nothing, LitElement } from 'lit'
|
|
4
4
|
import { customElement, property } from 'lit/decorators.js'
|
|
5
5
|
|
|
6
6
|
import ScrollBooster from 'scrollbooster'
|
|
@@ -70,6 +70,7 @@ export default class GroupBar extends LitElement {
|
|
|
70
70
|
@property({ type: Array }) groups?: any[]
|
|
71
71
|
@property({ type: String }) groupId?: string
|
|
72
72
|
@property({ type: String }) targetPage?: string
|
|
73
|
+
@property({ type: Boolean, attribute: true }) creatable?: boolean
|
|
73
74
|
|
|
74
75
|
private __sb?: ScrollBooster
|
|
75
76
|
|
|
@@ -84,6 +85,11 @@ export default class GroupBar extends LitElement {
|
|
|
84
85
|
<a href="${this.targetPage}/favor"><mwc-icon>star</mwc-icon></a>
|
|
85
86
|
</li>
|
|
86
87
|
|
|
88
|
+
${this.creatable
|
|
89
|
+
? html`<li ?active=${this.groupId === 'mywork'}>
|
|
90
|
+
<a href="${this.targetPage}/mywork"><mwc-icon>engineering</mwc-icon></a>
|
|
91
|
+
</li>`
|
|
92
|
+
: nothing}
|
|
87
93
|
${(this.groups || []).map(
|
|
88
94
|
group => html`
|
|
89
95
|
<li ?active=${this.groupId === group.id} @long-press=${e => this.infoGroup(group.id)}>
|
package/client/graphql/index.ts
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import gql from 'graphql-tag'
|
|
2
|
+
import { client } from '@operato/graphql'
|
|
3
|
+
import { gqlBuilder } from '@things-factory/utils'
|
|
4
|
+
|
|
5
|
+
export async function fetchMyBoardList(listParam = {}) {
|
|
6
|
+
const response = await client.query({
|
|
7
|
+
query: gql`
|
|
8
|
+
{
|
|
9
|
+
boardsCreatedByMe(${gqlBuilder.buildArgs(listParam)}) {
|
|
10
|
+
items {
|
|
11
|
+
id
|
|
12
|
+
name
|
|
13
|
+
description
|
|
14
|
+
thumbnail
|
|
15
|
+
createdAt
|
|
16
|
+
updatedAt
|
|
17
|
+
}
|
|
18
|
+
total
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
`
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
return response.data
|
|
25
|
+
}
|
|
@@ -6,6 +6,7 @@ import '../board-list/group-bar'
|
|
|
6
6
|
|
|
7
7
|
import gql from 'graphql-tag'
|
|
8
8
|
import { css, html } from 'lit'
|
|
9
|
+
import { customElement, property, query, queryAll, state } from 'lit/decorators.js'
|
|
9
10
|
import { connect } from 'pwa-helpers/connect-mixin.js'
|
|
10
11
|
|
|
11
12
|
import { client } from '@operato/graphql'
|
|
@@ -28,58 +29,75 @@ import {
|
|
|
28
29
|
deleteGroup,
|
|
29
30
|
fetchBoardList,
|
|
30
31
|
fetchFavoriteBoardList,
|
|
32
|
+
fetchMyBoardList,
|
|
31
33
|
fetchGroupList,
|
|
32
34
|
updateBoard,
|
|
33
35
|
updateGroup,
|
|
34
36
|
importBoards
|
|
35
37
|
} from '../graphql'
|
|
36
38
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
39
|
+
@customElement('board-list-page')
|
|
40
|
+
export class BoardListPage extends localize(i18next)(connect(store)(InfiniteScrollable(PageView))) {
|
|
41
|
+
static styles = [
|
|
42
|
+
ScrollbarStyles,
|
|
43
|
+
css`
|
|
44
|
+
:host {
|
|
45
|
+
display: flex;
|
|
46
|
+
flex-direction: column;
|
|
47
|
+
position: relative;
|
|
48
|
+
|
|
49
|
+
overflow: hidden;
|
|
50
|
+
}
|
|
49
51
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
board-tile-list {
|
|
53
|
+
flex: 1;
|
|
54
|
+
overflow-y: auto;
|
|
55
|
+
}
|
|
54
56
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
57
|
+
#create {
|
|
58
|
+
position: absolute;
|
|
59
|
+
bottom: 15px;
|
|
60
|
+
right: 16px;
|
|
61
|
+
}
|
|
62
|
+
`
|
|
63
|
+
]
|
|
63
64
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
65
|
+
@property({ type: String }) groupId?: String
|
|
66
|
+
@property({ type: Array }) groups: any[] = []
|
|
67
|
+
@property({ type: Array }) boards: any[] = []
|
|
68
|
+
@property({ type: Array }) favorites: any[] = []
|
|
69
|
+
@property({ type: Array }) boardPermissions: any[] = []
|
|
70
|
+
|
|
71
|
+
@state() searchText: string = ''
|
|
72
|
+
|
|
73
|
+
@query('board-tile-list') scrollTargetEl!: HTMLElement
|
|
74
|
+
|
|
75
|
+
private _page: number = 1
|
|
76
|
+
private _total: number = 0
|
|
77
|
+
|
|
78
|
+
private page?: string
|
|
75
79
|
|
|
76
80
|
get context() {
|
|
77
|
-
var
|
|
81
|
+
var groupId = this.groupId
|
|
82
|
+
var group = this.groups && this.groups.find(group => group.id === groupId)
|
|
78
83
|
|
|
79
84
|
return {
|
|
80
85
|
title: {
|
|
81
86
|
icon: 'dashboard',
|
|
82
|
-
text: group
|
|
87
|
+
text: group
|
|
88
|
+
? 'Group ' + group.name
|
|
89
|
+
: groupId == 'favor'
|
|
90
|
+
? 'Favorite'
|
|
91
|
+
: groupId == 'mywork'
|
|
92
|
+
? 'My works'
|
|
93
|
+
: 'Board List'
|
|
94
|
+
},
|
|
95
|
+
search: {
|
|
96
|
+
handler: search => {
|
|
97
|
+
this.searchText = search
|
|
98
|
+
this.refreshBoards()
|
|
99
|
+
},
|
|
100
|
+
value: this.searchText || ''
|
|
83
101
|
},
|
|
84
102
|
board_topmenu: true
|
|
85
103
|
}
|
|
@@ -88,9 +106,6 @@ class BoardListPage extends localize(i18next)(connect(store)(InfiniteScrollable(
|
|
|
88
106
|
constructor() {
|
|
89
107
|
super()
|
|
90
108
|
|
|
91
|
-
this._page = 1
|
|
92
|
-
this._total = 0
|
|
93
|
-
|
|
94
109
|
this._infiniteScrollOptions.limit = 50
|
|
95
110
|
}
|
|
96
111
|
|
|
@@ -101,6 +116,7 @@ class BoardListPage extends localize(i18next)(connect(store)(InfiniteScrollable(
|
|
|
101
116
|
.groupId=${this.groupId}
|
|
102
117
|
targetPage="board-list"
|
|
103
118
|
@info-group=${e => this.onInfoGroup(e.detail)}
|
|
119
|
+
?creatable=${this.boardPermissions?.includes('Modeller')}
|
|
104
120
|
></group-bar>
|
|
105
121
|
|
|
106
122
|
<board-tile-list
|
|
@@ -109,6 +125,7 @@ class BoardListPage extends localize(i18next)(connect(store)(InfiniteScrollable(
|
|
|
109
125
|
.favorites=${this.favorites}
|
|
110
126
|
.groups=${this.groups}
|
|
111
127
|
.group=${this.groupId}
|
|
128
|
+
search-text=${this.searchText}
|
|
112
129
|
?creatable=${this.boardPermissions?.includes('Modeller')}
|
|
113
130
|
@info-board=${e => this.onInfoBoard(e.detail)}
|
|
114
131
|
@scroll=${e => {
|
|
@@ -120,10 +137,6 @@ class BoardListPage extends localize(i18next)(connect(store)(InfiniteScrollable(
|
|
|
120
137
|
`
|
|
121
138
|
}
|
|
122
139
|
|
|
123
|
-
get scrollTargetEl() {
|
|
124
|
-
return this.shadowRoot.querySelector('board-tile-list')
|
|
125
|
-
}
|
|
126
|
-
|
|
127
140
|
async refresh() {
|
|
128
141
|
this.groups = (await fetchGroupList()).groups.items
|
|
129
142
|
|
|
@@ -133,22 +146,38 @@ class BoardListPage extends localize(i18next)(connect(store)(InfiniteScrollable(
|
|
|
133
146
|
}
|
|
134
147
|
|
|
135
148
|
async getBoards({ page = 1, limit = this._infiniteScrollOptions.limit } = {}) {
|
|
136
|
-
if (this.groupId && this.groupId == 'favor')
|
|
149
|
+
if (this.groupId && this.groupId == 'favor') {
|
|
137
150
|
return await this.getFavoriteBoards({
|
|
138
151
|
page,
|
|
139
152
|
limit
|
|
140
153
|
})
|
|
154
|
+
} else if (this.groupId && this.groupId == 'mywork') {
|
|
155
|
+
return await this.getMyBoards({
|
|
156
|
+
page,
|
|
157
|
+
limit
|
|
158
|
+
})
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const filters = [] as any[]
|
|
162
|
+
|
|
163
|
+
if (this.groupId) {
|
|
164
|
+
filters.push({
|
|
165
|
+
name: 'groupId',
|
|
166
|
+
operator: 'eq',
|
|
167
|
+
value: this.groupId
|
|
168
|
+
})
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
if (this.searchText) {
|
|
172
|
+
filters.push({
|
|
173
|
+
name: 'name',
|
|
174
|
+
operator: 'search',
|
|
175
|
+
value: '%' + this.searchText + '%'
|
|
176
|
+
})
|
|
177
|
+
}
|
|
141
178
|
|
|
142
179
|
var listParam = {
|
|
143
|
-
filters
|
|
144
|
-
? [
|
|
145
|
-
{
|
|
146
|
-
name: 'groupId',
|
|
147
|
-
operator: 'eq',
|
|
148
|
-
value: this.groupId
|
|
149
|
-
}
|
|
150
|
-
]
|
|
151
|
-
: [],
|
|
180
|
+
filters,
|
|
152
181
|
sortings: [
|
|
153
182
|
{
|
|
154
183
|
name: 'name',
|
|
@@ -165,7 +194,18 @@ class BoardListPage extends localize(i18next)(connect(store)(InfiniteScrollable(
|
|
|
165
194
|
}
|
|
166
195
|
|
|
167
196
|
async getFavoriteBoards({ page = 1, limit = this._infiniteScrollOptions.limit } = {}) {
|
|
197
|
+
const filters = [] as any[]
|
|
198
|
+
|
|
199
|
+
if (this.searchText) {
|
|
200
|
+
filters.push({
|
|
201
|
+
name: 'name',
|
|
202
|
+
operator: 'search',
|
|
203
|
+
value: '%' + this.searchText + '%'
|
|
204
|
+
})
|
|
205
|
+
}
|
|
206
|
+
|
|
168
207
|
var listParam = {
|
|
208
|
+
filters,
|
|
169
209
|
pagination: {
|
|
170
210
|
page,
|
|
171
211
|
limit
|
|
@@ -175,6 +215,28 @@ class BoardListPage extends localize(i18next)(connect(store)(InfiniteScrollable(
|
|
|
175
215
|
return (await fetchFavoriteBoardList(listParam)).favoriteBoards
|
|
176
216
|
}
|
|
177
217
|
|
|
218
|
+
async getMyBoards({ page = 1, limit = this._infiniteScrollOptions.limit } = {}) {
|
|
219
|
+
const filters = [] as any[]
|
|
220
|
+
|
|
221
|
+
if (this.searchText) {
|
|
222
|
+
filters.push({
|
|
223
|
+
name: 'name',
|
|
224
|
+
operator: 'search',
|
|
225
|
+
value: '%' + this.searchText + '%'
|
|
226
|
+
})
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
var listParam = {
|
|
230
|
+
filters,
|
|
231
|
+
pagination: {
|
|
232
|
+
page,
|
|
233
|
+
limit
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
return (await fetchMyBoardList(listParam)).boardsCreatedByMe
|
|
238
|
+
}
|
|
239
|
+
|
|
178
240
|
async refreshBoards() {
|
|
179
241
|
if (!this.groups) {
|
|
180
242
|
await this.refresh()
|
|
@@ -188,10 +250,8 @@ class BoardListPage extends localize(i18next)(connect(store)(InfiniteScrollable(
|
|
|
188
250
|
|
|
189
251
|
this.updateContext()
|
|
190
252
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
list.style.transition = ''
|
|
194
|
-
list.style.transform = `translate3d(0, 0, 0)`
|
|
253
|
+
this.scrollTargetEl.style.transition = ''
|
|
254
|
+
this.scrollTargetEl.style.transform = `translate3d(0, 0, 0)`
|
|
195
255
|
}
|
|
196
256
|
|
|
197
257
|
async appendBoards() {
|
|
@@ -218,6 +278,7 @@ class BoardListPage extends localize(i18next)(connect(store)(InfiniteScrollable(
|
|
|
218
278
|
if (this.active) {
|
|
219
279
|
this.page = lifecycle.page
|
|
220
280
|
this.groupId = lifecycle.resourceId
|
|
281
|
+
this.searchText = lifecycle.params?.search || ''
|
|
221
282
|
|
|
222
283
|
await this.updateComplete
|
|
223
284
|
|
|
@@ -231,10 +292,10 @@ class BoardListPage extends localize(i18next)(connect(store)(InfiniteScrollable(
|
|
|
231
292
|
}
|
|
232
293
|
|
|
233
294
|
firstUpdated() {
|
|
234
|
-
|
|
295
|
+
const list = this.scrollTargetEl
|
|
235
296
|
|
|
236
297
|
pulltorefresh({
|
|
237
|
-
container: this.
|
|
298
|
+
container: this.renderRoot,
|
|
238
299
|
scrollable: list,
|
|
239
300
|
refresh: () => {
|
|
240
301
|
return this.refresh()
|
|
@@ -274,7 +335,11 @@ class BoardListPage extends localize(i18next)(connect(store)(InfiniteScrollable(
|
|
|
274
335
|
list.style.transition = 'transform 0.3s'
|
|
275
336
|
list.style.transform = `translate3d(${d < 0 ? '-100%' : '100%'}, 0, 0)`
|
|
276
337
|
|
|
277
|
-
navigate(
|
|
338
|
+
navigate(
|
|
339
|
+
`${this.page}/${groups[currentIndex + (d < 0 ? 1 : -1)].id}${
|
|
340
|
+
this.searchText ? '?search=' + this.searchText : ''
|
|
341
|
+
}`
|
|
342
|
+
)
|
|
278
343
|
}
|
|
279
344
|
}
|
|
280
345
|
}
|
|
@@ -503,7 +568,7 @@ class BoardListPage extends localize(i18next)(connect(store)(InfiniteScrollable(
|
|
|
503
568
|
})
|
|
504
569
|
}
|
|
505
570
|
|
|
506
|
-
_notify(level, message, ex) {
|
|
571
|
+
_notify(level: 'info' | 'error' | 'warn', message: any, ex?: any) {
|
|
507
572
|
document.dispatchEvent(
|
|
508
573
|
new CustomEvent('notify', {
|
|
509
574
|
detail: {
|
|
@@ -515,5 +580,3 @@ class BoardListPage extends localize(i18next)(connect(store)(InfiniteScrollable(
|
|
|
515
580
|
)
|
|
516
581
|
}
|
|
517
582
|
}
|
|
518
|
-
|
|
519
|
-
window.customElements.define('board-list-page', BoardListPage)
|
|
@@ -6,6 +6,7 @@ import '../board-list/play-group-bar'
|
|
|
6
6
|
|
|
7
7
|
import gql from 'graphql-tag'
|
|
8
8
|
import { css, html } from 'lit'
|
|
9
|
+
import { customElement, property, query, queryAll, state } from 'lit/decorators.js'
|
|
9
10
|
import { connect } from 'pwa-helpers/connect-mixin.js'
|
|
10
11
|
|
|
11
12
|
import { UPDATE_FAVORITES } from '@things-factory/fav-base'
|
|
@@ -27,42 +28,41 @@ import {
|
|
|
27
28
|
updatePlayGroup
|
|
28
29
|
} from '../graphql'
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
31
|
+
@customElement('play-list-page')
|
|
32
|
+
export class PlayListPage extends localize(i18next)(connect(store)(PageView)) {
|
|
33
|
+
static styles = [
|
|
34
|
+
ScrollbarStyles,
|
|
35
|
+
css`
|
|
36
|
+
:host {
|
|
37
|
+
display: flex;
|
|
38
|
+
flex-direction: column;
|
|
39
|
+
position: relative;
|
|
40
|
+
|
|
41
|
+
overflow: hidden;
|
|
42
|
+
}
|
|
42
43
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
board-tile-list {
|
|
45
|
+
flex: 1;
|
|
46
|
+
overflow-y: auto;
|
|
47
|
+
}
|
|
47
48
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
49
|
+
#play {
|
|
50
|
+
position: absolute;
|
|
51
|
+
bottom: 15px;
|
|
52
|
+
right: 16px;
|
|
53
|
+
text-decoration: auto;
|
|
54
|
+
}
|
|
55
|
+
`
|
|
56
|
+
]
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
58
|
+
@property({ type: String }) groupId?: string
|
|
59
|
+
@property({ type: Array }) groups: any[] = []
|
|
60
|
+
@property({ type: Array }) boards: any[] = []
|
|
61
|
+
@property({ type: Array }) favorites: any[] = []
|
|
62
|
+
|
|
63
|
+
@query('board-tile-list') boardTileList!: HTMLElement
|
|
64
|
+
|
|
65
|
+
private page?: string
|
|
66
66
|
|
|
67
67
|
get context() {
|
|
68
68
|
var group = this.groups && this.groups.find(group => group.id === this.groupId)
|
|
@@ -116,12 +116,12 @@ class PlayListPage extends localize(i18next)(connect(store)(PageView)) {
|
|
|
116
116
|
|
|
117
117
|
if (!this.groupId) {
|
|
118
118
|
let groupId = this.groups && this.groups[0] && this.groups[0].id
|
|
119
|
-
var newURL = new URL(window.location)
|
|
119
|
+
var newURL = new URL(window.location.href)
|
|
120
120
|
|
|
121
121
|
newURL.pathname += `/${groupId}`
|
|
122
122
|
|
|
123
123
|
if (groupId) {
|
|
124
|
-
navigate(newURL, true)
|
|
124
|
+
navigate(newURL.href, true)
|
|
125
125
|
}
|
|
126
126
|
return
|
|
127
127
|
}
|
|
@@ -135,7 +135,7 @@ class PlayListPage extends localize(i18next)(connect(store)(PageView)) {
|
|
|
135
135
|
|
|
136
136
|
this.updateContext()
|
|
137
137
|
|
|
138
|
-
var list = this.
|
|
138
|
+
var list = this.boardTileList
|
|
139
139
|
|
|
140
140
|
list.style.transition = ''
|
|
141
141
|
list.style.transform = `translate3d(0, 0, 0)`
|
|
@@ -161,7 +161,7 @@ class PlayListPage extends localize(i18next)(connect(store)(PageView)) {
|
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
firstUpdated() {
|
|
164
|
-
var list = this.
|
|
164
|
+
var list = this.boardTileList
|
|
165
165
|
|
|
166
166
|
pulltorefresh({
|
|
167
167
|
container: this.shadowRoot,
|
|
@@ -383,7 +383,7 @@ class PlayListPage extends localize(i18next)(connect(store)(PageView)) {
|
|
|
383
383
|
})
|
|
384
384
|
}
|
|
385
385
|
|
|
386
|
-
_notify(level, message, ex) {
|
|
386
|
+
_notify(level: 'info' | 'warn' | 'error', message: any, ex?: any) {
|
|
387
387
|
document.dispatchEvent(
|
|
388
388
|
new CustomEvent('notify', {
|
|
389
389
|
detail: {
|
|
@@ -395,5 +395,3 @@ class PlayListPage extends localize(i18next)(connect(store)(PageView)) {
|
|
|
395
395
|
)
|
|
396
396
|
}
|
|
397
397
|
}
|
|
398
|
-
|
|
399
|
-
window.customElements.define('play-list-page', PlayListPage)
|
|
@@ -254,6 +254,10 @@ __decorate([
|
|
|
254
254
|
property({ type: String }),
|
|
255
255
|
__metadata("design:type", String)
|
|
256
256
|
], BoardTileList.prototype, "group", void 0);
|
|
257
|
+
__decorate([
|
|
258
|
+
property({ type: String, attribute: 'search-text' }),
|
|
259
|
+
__metadata("design:type", String)
|
|
260
|
+
], BoardTileList.prototype, "searchText", void 0);
|
|
257
261
|
__decorate([
|
|
258
262
|
property({ type: Boolean, attribute: 'reorderable' }),
|
|
259
263
|
__metadata("design:type", Boolean)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"board-tile-list.js","sourceRoot":"","sources":["../../client/board-list/board-tile-list.ts"],"names":[],"mappings":";AAAA,OAAO,0CAA0C,CAAA;AACjD,OAAO,oBAAoB,CAAA;AAE3B,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAgB,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAE/C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAGlC,IAAM,aAAa,GAAnB,MAAM,aAAc,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YACjB,KAAK,EAAE,GAAG,CAAA;;;wBAGQ,OAAO;;;;;;OAMxB;SACF,CAAC,CAAA;QAEF,IAAI,CAAC,gBAAgB,EAAE,CAAA;IACzB,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,mBAAmB,CAAC,CAAC,CAAA;IAC1D,CAAC;;AA9PM,oBAAM,GAAG;IACd,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA6FF;CACF,CAAA;AAED;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;;gDAA2B;AAC/E;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;6CAAmB;AAC7C;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;gDAAsB;AAChD;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;6CAAmB;AAC7C;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;4CAAe;AAC1C;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC;;kDAA6B;AAvGxE,aAAa;IADzB,aAAa,CAAC,iBAAiB,CAAC;GACpB,aAAa,CAgQzB;SAhQY,aAAa","sourcesContent":["import '@operato/board/ox-board-creation-card.js'\nimport '@material/mwc-icon'\n\nimport gql from 'graphql-tag'\nimport { css, html, LitElement, PropertyValues } from 'lit'\nimport { customElement, property, state, query } from 'lit/decorators.js'\nimport { keyed } from 'lit/directives/keyed.js'\n\nimport { client } from '@operato/graphql'\n\n@customElement('board-tile-list')\nexport class BoardTileList extends LitElement {\n static styles = [\n css`\n :host {\n overflow: auto;\n padding: var(--popup-content-padding);\n display: grid;\n\n grid-template-columns: var(--card-list-template);\n grid-auto-rows: var(--card-list-rows-height);\n grid-gap: 20px;\n --mdc-button-horizontal-padding: var(--padding-default);\n }\n\n [card] {\n position: relative;\n align-items: center;\n overflow: hidden;\n }\n\n [card][create] {\n overflow: visible;\n background-color: initial;\n }\n\n [card] > a {\n display: flex;\n }\n\n [card]:hover {\n cursor: pointer;\n }\n\n [name] {\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n margin-top: var(--margin-narrow);\n width: calc(100% - 45px);\n color: var(--primary-text-color);\n font-weight: bolder;\n font-size: var(--fontsize-small);\n }\n\n img {\n display: block;\n\n margin: auto;\n max-width: 100%;\n max-height: 100%;\n }\n\n mwc-icon[iconBtn] {\n float: right;\n margin-top: -20px;\n margin-left: 2px;\n color: var(--board-list-star-color);\n font-size: 1.4em;\n }\n mwc-icon[info] {\n color: var(--primary-color);\n }\n\n mwc-icon[iconBtn][favored],\n mwc-icon[info]:hover {\n color: var(--board-list-star-active-color);\n }\n\n a {\n display: block;\n border-radius: var(--card-list-border-radius);\n border: var(--border-dark-color);\n box-sizing: border-box;\n background-color: var(--card-list-background-color);\n margin: 0px;\n height: calc(100% - 25px);\n }\n\n :host > *:hover [info] {\n opacity: 1;\n -webkit-transition: opacity 0.8s;\n -moz-transition: opacity 0.8s;\n -o-transition: opacity 0.8s;\n transition: opacity 0.8s;\n }\n\n [draggable='true'] {\n cursor: grab;\n }\n\n @media screen and (max-width: 800px), screen and (max-height: 600px) {\n ox-board-creation-card {\n display: none;\n }\n }\n `\n ]\n\n @property({ type: Boolean, attribute: 'creatable' }) creatable: boolean = false\n @property({ type: Array }) boards: any[] = []\n @property({ type: Array }) favorites: any[] = []\n @property({ type: Array }) groups: any[] = []\n @property({ type: String }) group?: string\n @property({ type: Boolean, attribute: 'reorderable' }) reorderable: boolean = false\n\n private draggedItem\n\n connectedCallback() {\n super.connectedCallback()\n\n if (this.reorderable) {\n this.renderRoot.addEventListener('dragstart', (e: Event) => {\n const target = e.target! as HTMLElement\n this.draggedItem = target.closest('[card]')\n ;(e as DragEvent).dataTransfer?.setData('text/plain', target.innerHTML)\n })\n\n this.renderRoot.addEventListener('dragover', (e: Event) => {\n e.preventDefault()\n\n const target = e.target! as HTMLElement\n const targetItem = target.closest('[card]')\n if (targetItem && targetItem !== this.draggedItem) {\n const targetRect = targetItem.getBoundingClientRect()\n const mousePos = (e as DragEvent).clientX - targetRect.left\n\n if (mousePos < targetRect.width / 2) {\n // 마우스 위치가 아이템 좌측 반절에 있을 때\n this.renderRoot.insertBefore(this.draggedItem, targetItem)\n } else {\n // 마우스 위치가 아이템 우측 반절에 있을 때\n this.renderRoot.insertBefore(this.draggedItem, targetItem.nextSibling)\n }\n }\n })\n\n this.renderRoot.addEventListener('drop', (e: Event) => {\n e.preventDefault()\n\n const boardIds = Array.from(this.renderRoot.querySelectorAll('[card]'))\n .map(board => board.getAttribute('id'))\n .filter(Boolean)\n\n this.dispatchEvent(\n new CustomEvent('reordered', {\n detail: {\n groupId: this.group,\n boardIds\n }\n })\n )\n })\n }\n }\n\n render() {\n var boards = this.boards || []\n\n return html`\n ${this.creatable\n ? html`\n <ox-board-creation-card\n .groups=${this.groups}\n .defaultGroup=${this.group}\n @create-board=${e => this.onCreateBoard(e)}\n card\n create\n ></ox-board-creation-card>\n `\n : html``}\n ${keyed(\n Date.now(),\n boards.map(\n board =>\n html`\n <div card draggable=\"true\" id=${board.id}>\n <a href=\"board-viewer/${board.id}\"> <img src=${board.thumbnail} /> </a>\n\n <div name>${board.name}</div>\n <!-- <div description>${board.description}</div> -->\n\n <mwc-icon\n iconBtn\n info\n @click=${e => {\n this.infoBoard(board)\n e.preventDefault()\n }}\n >info</mwc-icon\n >\n\n ${(this.favorites || []).includes(board.id)\n ? html` <mwc-icon iconBtn favored @click=${e => this.removeFavorite(board.id)}>star</mwc-icon> `\n : html` <mwc-icon iconBtn @click=${e => this.addFavorite(board.id)}>star_border</mwc-icon> `}\n </div>\n `\n )\n )}\n `\n }\n\n updated(changes: PropertyValues<this>) {\n var creationCard = this.renderRoot.querySelector('ox-board-creation-card') as any\n if (creationCard) {\n creationCard.reset()\n }\n }\n\n onCreateBoard(e) {\n this.dispatchEvent(\n new CustomEvent('create-board', {\n detail: e.detail\n })\n )\n }\n\n infoBoard(board) {\n this.dispatchEvent(\n new CustomEvent('info-board', {\n detail: board\n })\n )\n }\n\n async removeFavorite(boardId) {\n await client.query({\n query: gql`\n mutation {\n deleteFavorite(routing: \"${boardId}\")\n }\n `\n })\n\n this.refreshFavorites()\n }\n\n async addFavorite(boardId) {\n await client.query({\n query: gql`\n mutation {\n createFavorite(favorite: {\n routing: \"${boardId}\"\n }) {\n id\n routing\n }\n }\n `\n })\n\n this.refreshFavorites()\n }\n\n async refreshFavorites() {\n this.dispatchEvent(new CustomEvent('refresh-favorites'))\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"board-tile-list.js","sourceRoot":"","sources":["../../client/board-list/board-tile-list.ts"],"names":[],"mappings":";AAAA,OAAO,0CAA0C,CAAA;AACjD,OAAO,oBAAoB,CAAA;AAE3B,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAgB,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAE/C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAGlC,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,UAAU;IAAtC;;QAkGgD,cAAS,GAAY,KAAK,CAAA;QACpD,WAAM,GAAU,EAAE,CAAA;QAClB,cAAS,GAAU,EAAE,CAAA;QACrB,WAAM,GAAU,EAAE,CAAA;QAGU,gBAAW,GAAY,KAAK,CAAA;IAyJrF,CAAC;IArJC,iBAAiB;QACf,KAAK,CAAC,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CAAA;IAC1D,CAAC;;AA/PM,oBAAM,GAAG;IACd,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA6FF;CACF,CAAA;AAED;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;;gDAA2B;AAC/E;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;6CAAmB;AAC7C;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;gDAAsB;AAChD;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;6CAAmB;AAC7C;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;4CAAe;AAC1C;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC;;iDAAoB;AACzE;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC;;kDAA6B;AAxGxE,aAAa;IADzB,aAAa,CAAC,iBAAiB,CAAC;GACpB,aAAa,CAiQzB;SAjQY,aAAa","sourcesContent":["import '@operato/board/ox-board-creation-card.js'\nimport '@material/mwc-icon'\n\nimport gql from 'graphql-tag'\nimport { css, html, LitElement, PropertyValues } from 'lit'\nimport { customElement, property, state, query } from 'lit/decorators.js'\nimport { keyed } from 'lit/directives/keyed.js'\n\nimport { client } from '@operato/graphql'\n\n@customElement('board-tile-list')\nexport class BoardTileList extends LitElement {\n static styles = [\n css`\n :host {\n overflow: auto;\n padding: var(--popup-content-padding);\n display: grid;\n\n grid-template-columns: var(--card-list-template);\n grid-auto-rows: var(--card-list-rows-height);\n grid-gap: 20px;\n --mdc-button-horizontal-padding: var(--padding-default);\n }\n\n [card] {\n position: relative;\n align-items: center;\n overflow: hidden;\n }\n\n [card][create] {\n overflow: visible;\n background-color: initial;\n }\n\n [card] > a {\n display: flex;\n }\n\n [card]:hover {\n cursor: pointer;\n }\n\n [name] {\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n margin-top: var(--margin-narrow);\n width: calc(100% - 45px);\n color: var(--primary-text-color);\n font-weight: bolder;\n font-size: var(--fontsize-small);\n }\n\n img {\n display: block;\n\n margin: auto;\n max-width: 100%;\n max-height: 100%;\n }\n\n mwc-icon[iconBtn] {\n float: right;\n margin-top: -20px;\n margin-left: 2px;\n color: var(--board-list-star-color);\n font-size: 1.4em;\n }\n mwc-icon[info] {\n color: var(--primary-color);\n }\n\n mwc-icon[iconBtn][favored],\n mwc-icon[info]:hover {\n color: var(--board-list-star-active-color);\n }\n\n a {\n display: block;\n border-radius: var(--card-list-border-radius);\n border: var(--border-dark-color);\n box-sizing: border-box;\n background-color: var(--card-list-background-color);\n margin: 0px;\n height: calc(100% - 25px);\n }\n\n :host > *:hover [info] {\n opacity: 1;\n -webkit-transition: opacity 0.8s;\n -moz-transition: opacity 0.8s;\n -o-transition: opacity 0.8s;\n transition: opacity 0.8s;\n }\n\n [draggable='true'] {\n cursor: grab;\n }\n\n @media screen and (max-width: 800px), screen and (max-height: 600px) {\n ox-board-creation-card {\n display: none;\n }\n }\n `\n ]\n\n @property({ type: Boolean, attribute: 'creatable' }) creatable: boolean = false\n @property({ type: Array }) boards: any[] = []\n @property({ type: Array }) favorites: any[] = []\n @property({ type: Array }) groups: any[] = []\n @property({ type: String }) group?: string\n @property({ type: String, attribute: 'search-text' }) searchText?: string\n @property({ type: Boolean, attribute: 'reorderable' }) reorderable: boolean = false\n\n private draggedItem\n\n connectedCallback() {\n super.connectedCallback()\n\n if (this.reorderable) {\n this.renderRoot.addEventListener('dragstart', (e: Event) => {\n const target = e.target! as HTMLElement\n this.draggedItem = target.closest('[card]')\n ;(e as DragEvent).dataTransfer?.setData('text/plain', target.innerHTML)\n })\n\n this.renderRoot.addEventListener('dragover', (e: Event) => {\n e.preventDefault()\n\n const target = e.target! as HTMLElement\n const targetItem = target.closest('[card]')\n if (targetItem && targetItem !== this.draggedItem) {\n const targetRect = targetItem.getBoundingClientRect()\n const mousePos = (e as DragEvent).clientX - targetRect.left\n\n if (mousePos < targetRect.width / 2) {\n // 마우스 위치가 아이템 좌측 반절에 있을 때\n this.renderRoot.insertBefore(this.draggedItem, targetItem)\n } else {\n // 마우스 위치가 아이템 우측 반절에 있을 때\n this.renderRoot.insertBefore(this.draggedItem, targetItem.nextSibling)\n }\n }\n })\n\n this.renderRoot.addEventListener('drop', (e: Event) => {\n e.preventDefault()\n\n const boardIds = Array.from(this.renderRoot.querySelectorAll('[card]'))\n .map(board => board.getAttribute('id'))\n .filter(Boolean)\n\n this.dispatchEvent(\n new CustomEvent('reordered', {\n detail: {\n groupId: this.group,\n boardIds\n }\n })\n )\n })\n }\n }\n\n render() {\n var boards = this.boards || []\n\n return html`\n ${this.creatable\n ? html`\n <ox-board-creation-card\n .groups=${this.groups}\n .defaultGroup=${this.group}\n @create-board=${e => this.onCreateBoard(e)}\n card\n create\n ></ox-board-creation-card>\n `\n : html``}\n ${keyed(\n Date.now(),\n boards.map(\n board =>\n html`\n <div card draggable=\"true\" id=${board.id}>\n <a href=\"board-viewer/${board.id}\"> <img src=${board.thumbnail} /> </a>\n\n <div name>${board.name}</div>\n <!-- <div description>${board.description}</div> -->\n\n <mwc-icon\n iconBtn\n info\n @click=${e => {\n this.infoBoard(board)\n e.preventDefault()\n }}\n >info</mwc-icon\n >\n\n ${(this.favorites || []).includes(board.id)\n ? html` <mwc-icon iconBtn favored @click=${e => this.removeFavorite(board.id)}>star</mwc-icon> `\n : html` <mwc-icon iconBtn @click=${e => this.addFavorite(board.id)}>star_border</mwc-icon> `}\n </div>\n `\n )\n )}\n `\n }\n\n updated(changes: PropertyValues<this>) {\n var creationCard = this.renderRoot.querySelector('ox-board-creation-card') as any\n if (creationCard) {\n creationCard.reset()\n }\n }\n\n onCreateBoard(e) {\n this.dispatchEvent(\n new CustomEvent('create-board', {\n detail: e.detail\n })\n )\n }\n\n infoBoard(board) {\n this.dispatchEvent(\n new CustomEvent('info-board', {\n detail: board\n })\n )\n }\n\n async removeFavorite(boardId) {\n await client.query({\n query: gql`\n mutation {\n deleteFavorite(routing: \"${boardId}\")\n }\n `\n })\n\n this.refreshFavorites()\n }\n\n async addFavorite(boardId) {\n await client.query({\n query: gql`\n mutation {\n createFavorite(favorite: {\n routing: \"${boardId}\"\n }) {\n id\n routing\n }\n }\n `\n })\n\n this.refreshFavorites()\n }\n\n async refreshFavorites() {\n this.dispatchEvent(new CustomEvent('refresh-favorites'))\n }\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import '@material/mwc-icon';
|
|
3
|
-
import { css, html, LitElement } from 'lit';
|
|
3
|
+
import { css, html, nothing, LitElement } from 'lit';
|
|
4
4
|
import { customElement, property } from 'lit/decorators.js';
|
|
5
5
|
import ScrollBooster from 'scrollbooster';
|
|
6
6
|
import { longpressable } from '@things-factory/utils';
|
|
@@ -16,6 +16,11 @@ let GroupBar = class GroupBar extends LitElement {
|
|
|
16
16
|
<a href="${this.targetPage}/favor"><mwc-icon>star</mwc-icon></a>
|
|
17
17
|
</li>
|
|
18
18
|
|
|
19
|
+
${this.creatable
|
|
20
|
+
? html `<li ?active=${this.groupId === 'mywork'}>
|
|
21
|
+
<a href="${this.targetPage}/mywork"><mwc-icon>engineering</mwc-icon></a>
|
|
22
|
+
</li>`
|
|
23
|
+
: nothing}
|
|
19
24
|
${(this.groups || []).map(group => html `
|
|
20
25
|
<li ?active=${this.groupId === group.id} @long-press=${e => this.infoGroup(group.id)}>
|
|
21
26
|
<a href=${`${this.targetPage}/${group.id}`}>${group.name}</a>
|
|
@@ -134,6 +139,10 @@ __decorate([
|
|
|
134
139
|
property({ type: String }),
|
|
135
140
|
__metadata("design:type", String)
|
|
136
141
|
], GroupBar.prototype, "targetPage", void 0);
|
|
142
|
+
__decorate([
|
|
143
|
+
property({ type: Boolean, attribute: true }),
|
|
144
|
+
__metadata("design:type", Boolean)
|
|
145
|
+
], GroupBar.prototype, "creatable", void 0);
|
|
137
146
|
GroupBar = __decorate([
|
|
138
147
|
customElement('group-bar')
|
|
139
148
|
], GroupBar);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group-bar.js","sourceRoot":"","sources":["../../client/board-list/group-bar.ts"],"names":[],"mappings":";AAAA,OAAO,oBAAoB,CAAA;AAE3B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"group-bar.js","sourceRoot":"","sources":["../../client/board-list/group-bar.ts"],"names":[],"mappings":";AAAA,OAAO,oBAAoB,CAAA;AAE3B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE3D,OAAO,aAAa,MAAM,eAAe,CAAA;AAEzC,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAGtC,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,UAAU;IAkE9C,MAAM;QACJ,OAAO,IAAI,CAAA;;sBAEO,CAAC,IAAI,CAAC,OAAO;oBACf,IAAI,CAAC,UAAU,IAAI,EAAE;;;sBAGnB,IAAI,CAAC,OAAO,KAAK,OAAO;qBACzB,IAAI,CAAC,UAAU;;;UAG1B,IAAI,CAAC,SAAS;YACd,CAAC,CAAC,IAAI,CAAA,eAAe,IAAI,CAAC,OAAO,KAAK,QAAQ;yBAC/B,IAAI,CAAC,UAAU;kBACtB;YACR,CAAC,CAAC,OAAO;UACT,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,GAAG,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IAAI,CAAC,CAAA;QAEtD,gBAAgB;QAChB,aAAa,CAAC,YAAY,CAAC,CAAA;QAE3B,YAAa,CAAC,gBAAgB,CAAC,YAAY,EAAE,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,CAAA;QAEjF,IAAI,CAAC,IAAI,GAAG,IAAI,aAAa,CAAC;YAC5B,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,YAAY;YACrB,IAAI,EAAE,GAAG;YACT,QAAQ,EAAE,IAAI,CAAC,EAAE;gBACf,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAA;YACnC,CAAC;SACF,CAAC,CAAA;IACJ,CAAC;;AA7IM,eAAM,GAAG;IACd,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAsDF;CACF,CAAA;AAED;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;wCAAe;AACzC;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;yCAAiB;AAC5C;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;4CAAoB;AAC/C;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;;2CAAoB;AA9D9C,QAAQ;IAD5B,aAAa,CAAC,WAAW,CAAC;GACN,QAAQ,CA+I5B;eA/IoB,QAAQ","sourcesContent":["import '@material/mwc-icon'\n\nimport { css, html, nothing, LitElement } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport ScrollBooster from 'scrollbooster'\n\nimport { longpressable } from '@things-factory/utils'\n\n@customElement('group-bar')\nexport default class GroupBar extends LitElement {\n static styles = [\n css`\n :host {\n background-color: var(--group-bar-background-color);\n\n overflow-x: hidden;\n }\n\n ul {\n display: flex;\n list-style: none;\n margin: 0;\n padding: 0;\n white-space: nowrap;\n }\n\n li {\n display: inline-block;\n padding: 0px 3px;\n\n border-bottom: var(--group-bar-line);\n }\n\n li[active] {\n border-color: var(--group-bar-active-line-color);\n }\n\n li a {\n display: block;\n padding: 5px 4px 1px 4px;\n text-decoration: none;\n font: var(--group-bar-textbutton);\n color: rgba(255, 255, 255, 0.8);\n }\n\n li[active] a {\n font: var(--group-bar-textbutton-active);\n color: rgba(255, 255, 255, 1);\n }\n\n li[padding] {\n flex: 1;\n }\n\n li[add] {\n padding: 5px 4px 1px 4px;\n }\n\n li[add] * {\n color: rgba(255, 255, 255, 0.5);\n }\n\n mwc-icon {\n vertical-align: middle;\n }\n `\n ]\n\n @property({ type: Array }) groups?: any[]\n @property({ type: String }) groupId?: string\n @property({ type: String }) targetPage?: string\n @property({ type: Boolean, attribute: true }) creatable?: boolean\n\n private __sb?: ScrollBooster\n\n render() {\n return html`\n <ul>\n <li ?active=${!this.groupId}>\n <a href=${this.targetPage || ''}><mwc-icon>dashboard</mwc-icon></a>\n </li>\n\n <li ?active=${this.groupId === 'favor'}>\n <a href=\"${this.targetPage}/favor\"><mwc-icon>star</mwc-icon></a>\n </li>\n\n ${this.creatable\n ? html`<li ?active=${this.groupId === 'mywork'}>\n <a href=\"${this.targetPage}/mywork\"><mwc-icon>engineering</mwc-icon></a>\n </li>`\n : nothing}\n ${(this.groups || []).map(\n group => html`\n <li ?active=${this.groupId === group.id} @long-press=${e => this.infoGroup(group.id)}>\n <a href=${`${this.targetPage}/${group.id}`}>${group.name}</a>\n </li>\n `\n )}\n\n <li padding></li>\n\n <li add>\n <mwc-icon @click=${e => this.infoGroup()}>add</mwc-icon>\n </li>\n </ul>\n `\n }\n\n infoGroup(groupId?: string) {\n this.dispatchEvent(\n new CustomEvent('info-group', {\n detail: groupId\n })\n )\n }\n\n onWheelEvent(e) {\n var delta = Math.max(-1, Math.min(1, e.wheelDelta || -e.detail))\n this.scrollLeft -= delta * 40\n\n e.preventDefault()\n }\n\n updated(change) {\n if (change.has('groups')) {\n /* groups가 바뀔 때마다, contents의 폭이 달라지므로, 다시 폭을 계산해준다. */\n this.__sb && this.__sb.updateMetrics()\n }\n\n if (change.has('groupId')) {\n var active = this.renderRoot.querySelector('li[active]')\n active && active.scrollIntoView()\n }\n }\n\n firstUpdated() {\n var scrollTarget = this.renderRoot.querySelector('ul')\n\n /* long-press */\n longpressable(scrollTarget)\n\n scrollTarget!.addEventListener('mousewheel', this.onWheelEvent.bind(this), false)\n\n this.__sb = new ScrollBooster({\n viewport: this,\n content: scrollTarget,\n mode: 'x',\n onUpdate: data => {\n this.scrollLeft = data.position.x\n }\n })\n }\n}\n"]}
|