@things-factory/board-ui 6.2.15 → 6.2.17
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/graphql/board-template.ts +141 -0
- package/client/graphql/index.ts +1 -0
- package/client/pages/board-list-page.ts +28 -0
- package/client/pages/board-template/board-template-list-page.ts +59 -108
- package/client/pages/font-list-page.ts +1 -2
- package/client/viewparts/board-basic-info.ts +0 -4
- package/client/viewparts/board-info-link.ts +14 -1
- package/client/viewparts/board-template-builder.ts +133 -0
- package/client/viewparts/link-builder.ts +3 -3
- package/dist-client/graphql/board-template.d.ts +5 -0
- package/dist-client/graphql/board-template.js +128 -0
- package/dist-client/graphql/board-template.js.map +1 -0
- 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/pages/board-list-page.d.ts +6 -0
- package/dist-client/pages/board-list-page.js +27 -0
- package/dist-client/pages/board-list-page.js.map +1 -1
- package/dist-client/pages/board-template/board-template-list-page.d.ts +2 -13
- package/dist-client/pages/board-template/board-template-list-page.js +64 -92
- package/dist-client/pages/board-template/board-template-list-page.js.map +1 -1
- package/dist-client/pages/font-list-page.d.ts +0 -1
- package/dist-client/pages/font-list-page.js +1 -2
- package/dist-client/pages/font-list-page.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-client/viewparts/board-basic-info.js +0 -2
- package/dist-client/viewparts/board-basic-info.js.map +1 -1
- package/dist-client/viewparts/board-info-link.d.ts +2 -0
- package/dist-client/viewparts/board-info-link.js +11 -0
- package/dist-client/viewparts/board-info-link.js.map +1 -1
- package/dist-client/viewparts/board-template-builder.d.ts +16 -0
- package/dist-client/viewparts/board-template-builder.js +145 -0
- package/dist-client/viewparts/board-template-builder.js.map +1 -0
- package/dist-client/viewparts/link-builder.js +3 -3
- package/dist-client/viewparts/link-builder.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/translations/en.json +5 -0
- package/translations/ja.json +5 -0
- package/translations/ko.json +5 -0
- package/translations/ms.json +5 -0
- package/translations/zh.json +6 -1
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import gql from 'graphql-tag'
|
|
2
|
+
|
|
3
|
+
import { client } from '@operato/graphql'
|
|
4
|
+
import { gqlBuilder } from '@things-factory/utils'
|
|
5
|
+
|
|
6
|
+
export async function fetchBoardTemplateList(listParam = {}) {
|
|
7
|
+
const response = await client.query({
|
|
8
|
+
query: gql`
|
|
9
|
+
{
|
|
10
|
+
boardTemplates(${gqlBuilder.buildArgs(listParam)}) {
|
|
11
|
+
items {
|
|
12
|
+
id
|
|
13
|
+
name
|
|
14
|
+
description
|
|
15
|
+
thumbnail
|
|
16
|
+
visibility
|
|
17
|
+
createdAt
|
|
18
|
+
updatedAt
|
|
19
|
+
}
|
|
20
|
+
total
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
`
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
return response.data
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export async function fetchBoardTemplate(id) {
|
|
30
|
+
const response = await client.query({
|
|
31
|
+
query: gql`
|
|
32
|
+
query FetchBoardTemplate($id: String!) {
|
|
33
|
+
boardTemplate(id: $id) {
|
|
34
|
+
id
|
|
35
|
+
name
|
|
36
|
+
description
|
|
37
|
+
thumbnail
|
|
38
|
+
model
|
|
39
|
+
visibility
|
|
40
|
+
createdAt
|
|
41
|
+
creator {
|
|
42
|
+
id
|
|
43
|
+
name
|
|
44
|
+
}
|
|
45
|
+
updatedAt
|
|
46
|
+
updater {
|
|
47
|
+
id
|
|
48
|
+
name
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
`,
|
|
53
|
+
variables: { id }
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
return response.data
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export async function createBoardTemplate(boardTemplate) {
|
|
60
|
+
/*
|
|
61
|
+
input NewBoard {
|
|
62
|
+
name : String!
|
|
63
|
+
description : String
|
|
64
|
+
model : String!
|
|
65
|
+
visibility : String!
|
|
66
|
+
}
|
|
67
|
+
*/
|
|
68
|
+
|
|
69
|
+
boardTemplate.model = JSON.stringify(boardTemplate.model)
|
|
70
|
+
|
|
71
|
+
const response = await client.mutate({
|
|
72
|
+
mutation: gql`
|
|
73
|
+
mutation CreateBoardTemplate($boardTemplate: NewBoardTemplate!) {
|
|
74
|
+
createBoardTemplate(boardTemplate: $boardTemplate) {
|
|
75
|
+
id
|
|
76
|
+
name
|
|
77
|
+
description
|
|
78
|
+
model
|
|
79
|
+
visibility
|
|
80
|
+
createdAt
|
|
81
|
+
updatedAt
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
`,
|
|
85
|
+
variables: {
|
|
86
|
+
boardTemplate
|
|
87
|
+
}
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
return response.data
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export async function updateBoardTemplate(boardTemplate) {
|
|
94
|
+
/*
|
|
95
|
+
input BoardPatch {
|
|
96
|
+
name : String
|
|
97
|
+
description : String
|
|
98
|
+
model : String
|
|
99
|
+
visibility : String
|
|
100
|
+
}
|
|
101
|
+
*/
|
|
102
|
+
var { id, name, description, model, visibility } = boardTemplate
|
|
103
|
+
model = JSON.stringify(model)
|
|
104
|
+
|
|
105
|
+
const response = await client.mutate({
|
|
106
|
+
mutation: gql`
|
|
107
|
+
mutation UpdateBoard($id: String!, $patch: BoardTemplatePatch!) {
|
|
108
|
+
updateBoard(id: $id, patch: $patch) {
|
|
109
|
+
id
|
|
110
|
+
name
|
|
111
|
+
description
|
|
112
|
+
model
|
|
113
|
+
visibility
|
|
114
|
+
createdAt
|
|
115
|
+
updatedAt
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
`,
|
|
119
|
+
variables: {
|
|
120
|
+
id,
|
|
121
|
+
patch: { name, description, model, visibility }
|
|
122
|
+
}
|
|
123
|
+
})
|
|
124
|
+
|
|
125
|
+
return response.data
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export async function deleteBoardTemplate(id) {
|
|
129
|
+
const response = await client.mutate({
|
|
130
|
+
mutation: gql`
|
|
131
|
+
mutation ($id: String!) {
|
|
132
|
+
deleteBoardTemplate(id: $id)
|
|
133
|
+
}
|
|
134
|
+
`,
|
|
135
|
+
variables: {
|
|
136
|
+
id
|
|
137
|
+
}
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
return response.data
|
|
141
|
+
}
|
package/client/graphql/index.ts
CHANGED
|
@@ -360,6 +360,7 @@ export class BoardListPage extends localize(i18next)(connect(store)(InfiniteScro
|
|
|
360
360
|
@delete-board=${e => this.onDeleteBoard(e.detail)}
|
|
361
361
|
@join-playgroup=${e => this.onJoinPlayGroup(e.detail)}
|
|
362
362
|
@leave-playgroup=${e => this.onLeavePlayGroup(e.detail)}
|
|
363
|
+
@register-template=${e => this.onRegisterTemplate(e.detail)}
|
|
363
364
|
></board-info>
|
|
364
365
|
`
|
|
365
366
|
})
|
|
@@ -549,6 +550,33 @@ export class BoardListPage extends localize(i18next)(connect(store)(InfiniteScro
|
|
|
549
550
|
}
|
|
550
551
|
}
|
|
551
552
|
|
|
553
|
+
async onRegisterTemplate({ id, name, description, visibility }) {
|
|
554
|
+
try {
|
|
555
|
+
const { data } = await client.mutate({
|
|
556
|
+
mutation: gql`
|
|
557
|
+
mutation ($id: String!, $name: String!, $description: String!, $visibility: String!) {
|
|
558
|
+
registerBoardAsTemplate(id: $id, name: $name, description: $description, visibility: $visibility) {
|
|
559
|
+
id
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
`,
|
|
563
|
+
variables: {
|
|
564
|
+
id,
|
|
565
|
+
name,
|
|
566
|
+
description,
|
|
567
|
+
visibility
|
|
568
|
+
}
|
|
569
|
+
})
|
|
570
|
+
|
|
571
|
+
data &&
|
|
572
|
+
this._notify('info', i18next.t('text.info_x_successfully', { x: i18next.t('text.register-template') }), {
|
|
573
|
+
name
|
|
574
|
+
})
|
|
575
|
+
} catch (ex) {
|
|
576
|
+
this._notify('error', ex, ex)
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
|
|
552
580
|
async refreshFavorites() {
|
|
553
581
|
const { data } = await client.query({
|
|
554
582
|
query: gql`
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import '@operato/data-grist'
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { CommonGristStyles, ScrollbarStyles } from '@operato/styles'
|
|
4
4
|
import { PageView, store } from '@operato/shell'
|
|
5
5
|
import { css, html } from 'lit'
|
|
6
|
-
import { customElement, property, query } from 'lit/decorators.js'
|
|
6
|
+
import { customElement, property, query, state } from 'lit/decorators.js'
|
|
7
7
|
import { ScopedElementsMixin } from '@open-wc/scoped-elements'
|
|
8
|
-
import {
|
|
8
|
+
import { DataGrist, FetchOption, getEditor, getRenderer } from '@operato/data-grist'
|
|
9
9
|
import { client } from '@operato/graphql'
|
|
10
10
|
import { i18next, localize } from '@operato/i18n'
|
|
11
|
-
import { notify
|
|
11
|
+
import { notify } from '@operato/layout'
|
|
12
12
|
import { OxPopup } from '@operato/popup'
|
|
13
13
|
|
|
14
14
|
import { connect } from 'pwa-helpers/connect-mixin'
|
|
@@ -33,6 +33,7 @@ export class BoardTemplateListPage extends connect(store)(localize(i18next)(Scop
|
|
|
33
33
|
]
|
|
34
34
|
|
|
35
35
|
@property({ type: Object }) gristConfig: any
|
|
36
|
+
@state() visibility: string = ''
|
|
36
37
|
|
|
37
38
|
@query('ox-grist') private grist!: DataGrist
|
|
38
39
|
@query('#sorter-control') private sortersControl!: OxPopup
|
|
@@ -51,19 +52,8 @@ export class BoardTemplateListPage extends connect(store)(localize(i18next)(Scop
|
|
|
51
52
|
this.grist.toggleHeadroom()
|
|
52
53
|
}
|
|
53
54
|
},
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
{
|
|
57
|
-
title: i18next.t('button.save'),
|
|
58
|
-
action: this._updateBoardTemplate.bind(this),
|
|
59
|
-
...CommonButtonStyles.save
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
title: i18next.t('button.delete'),
|
|
63
|
-
action: this._deleteBoardTemplate.bind(this),
|
|
64
|
-
...CommonButtonStyles.delete
|
|
65
|
-
}
|
|
66
|
-
]
|
|
55
|
+
board_topmenu: true,
|
|
56
|
+
help: 'board-service/board-template'
|
|
67
57
|
}
|
|
68
58
|
}
|
|
69
59
|
|
|
@@ -72,24 +62,7 @@ export class BoardTemplateListPage extends connect(store)(localize(i18next)(Scop
|
|
|
72
62
|
<ox-grist mode="CARD" .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>
|
|
73
63
|
<div slot="headroom">
|
|
74
64
|
<div id="filters">
|
|
75
|
-
<ox-filters-form autofocus></ox-filters-form>
|
|
76
|
-
</div>
|
|
77
|
-
|
|
78
|
-
<div id="sorters">
|
|
79
|
-
Sort
|
|
80
|
-
<mwc-icon
|
|
81
|
-
@click=${e => {
|
|
82
|
-
const target = e.currentTarget
|
|
83
|
-
this.sortersControl.open({
|
|
84
|
-
right: 0,
|
|
85
|
-
top: target.offsetTop + target.offsetHeight
|
|
86
|
-
})
|
|
87
|
-
}}
|
|
88
|
-
>expand_more</mwc-icon
|
|
89
|
-
>
|
|
90
|
-
<ox-popup id="sorter-control">
|
|
91
|
-
<ox-sorters-control> </ox-sorters-control>
|
|
92
|
-
</ox-popup>
|
|
65
|
+
<ox-filters-form autofocus without-search></ox-filters-form>
|
|
93
66
|
</div>
|
|
94
67
|
</div>
|
|
95
68
|
</ox-grist>
|
|
@@ -99,18 +72,18 @@ export class BoardTemplateListPage extends connect(store)(localize(i18next)(Scop
|
|
|
99
72
|
async pageInitialized(lifecycle: any) {
|
|
100
73
|
this.gristConfig = {
|
|
101
74
|
list: {
|
|
75
|
+
thumbnail: 'thumbnail',
|
|
102
76
|
fields: ['name', 'description'],
|
|
103
|
-
details: ['
|
|
77
|
+
details: ['visibility', 'creator', 'createdAt']
|
|
104
78
|
},
|
|
105
79
|
columns: [
|
|
106
80
|
{ type: 'gutter', gutterName: 'sequence' },
|
|
107
|
-
{ type: 'gutter', gutterName: 'row-selector', multiple: true },
|
|
108
81
|
{
|
|
109
82
|
type: 'string',
|
|
110
83
|
name: 'name',
|
|
111
84
|
header: i18next.t('field.name'),
|
|
112
85
|
record: {
|
|
113
|
-
editable:
|
|
86
|
+
editable: false
|
|
114
87
|
},
|
|
115
88
|
filter: 'search',
|
|
116
89
|
sortable: true,
|
|
@@ -121,15 +94,50 @@ export class BoardTemplateListPage extends connect(store)(localize(i18next)(Scop
|
|
|
121
94
|
name: 'description',
|
|
122
95
|
header: i18next.t('field.description'),
|
|
123
96
|
record: {
|
|
124
|
-
editable:
|
|
97
|
+
editable: false
|
|
125
98
|
},
|
|
126
99
|
filter: 'search',
|
|
127
100
|
width: 200
|
|
128
101
|
},
|
|
102
|
+
{
|
|
103
|
+
type: 'boolean',
|
|
104
|
+
name: 'mine',
|
|
105
|
+
record: {
|
|
106
|
+
editable: false
|
|
107
|
+
},
|
|
108
|
+
hidden: true,
|
|
109
|
+
width: 0
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
type: 'select-buttons',
|
|
113
|
+
name: 'visibility',
|
|
114
|
+
header: i18next.t('field.visibility'),
|
|
115
|
+
label: true,
|
|
116
|
+
record: {
|
|
117
|
+
editable: false
|
|
118
|
+
},
|
|
119
|
+
filter: {
|
|
120
|
+
operator: 'in',
|
|
121
|
+
options: ['private', 'public', 'domain'],
|
|
122
|
+
value: this.visibility,
|
|
123
|
+
label: '' /* empty intentionally */
|
|
124
|
+
},
|
|
125
|
+
width: 200
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
type: 'image',
|
|
129
|
+
name: 'thumbnail',
|
|
130
|
+
header: i18next.t('field.thumbnail'),
|
|
131
|
+
record: {
|
|
132
|
+
editable: false
|
|
133
|
+
},
|
|
134
|
+
width: 200
|
|
135
|
+
},
|
|
129
136
|
{
|
|
130
137
|
type: 'resource-object',
|
|
131
|
-
name: '
|
|
132
|
-
header: i18next.t('field.
|
|
138
|
+
name: 'creator',
|
|
139
|
+
header: i18next.t('field.creator'),
|
|
140
|
+
label: true,
|
|
133
141
|
record: {
|
|
134
142
|
editable: false
|
|
135
143
|
},
|
|
@@ -138,8 +146,9 @@ export class BoardTemplateListPage extends connect(store)(localize(i18next)(Scop
|
|
|
138
146
|
},
|
|
139
147
|
{
|
|
140
148
|
type: 'datetime',
|
|
141
|
-
name: '
|
|
142
|
-
header: i18next.t('field.
|
|
149
|
+
name: 'createdAt',
|
|
150
|
+
header: i18next.t('field.created_at'),
|
|
151
|
+
label: true,
|
|
143
152
|
record: {
|
|
144
153
|
editable: false
|
|
145
154
|
},
|
|
@@ -148,9 +157,8 @@ export class BoardTemplateListPage extends connect(store)(localize(i18next)(Scop
|
|
|
148
157
|
}
|
|
149
158
|
],
|
|
150
159
|
rows: {
|
|
151
|
-
selectable:
|
|
152
|
-
|
|
153
|
-
}
|
|
160
|
+
selectable: false,
|
|
161
|
+
appendable: false
|
|
154
162
|
},
|
|
155
163
|
sorters: [
|
|
156
164
|
{
|
|
@@ -162,7 +170,7 @@ export class BoardTemplateListPage extends connect(store)(localize(i18next)(Scop
|
|
|
162
170
|
|
|
163
171
|
async pageUpdated(changes: any, lifecycle: any) {
|
|
164
172
|
if (this.active) {
|
|
165
|
-
|
|
173
|
+
this.grist.fetch()
|
|
166
174
|
}
|
|
167
175
|
}
|
|
168
176
|
|
|
@@ -175,14 +183,15 @@ export class BoardTemplateListPage extends connect(store)(localize(i18next)(Scop
|
|
|
175
183
|
id
|
|
176
184
|
name
|
|
177
185
|
description
|
|
178
|
-
state
|
|
179
186
|
model
|
|
180
187
|
thumbnail
|
|
181
|
-
|
|
188
|
+
visibility
|
|
189
|
+
mine
|
|
190
|
+
creator {
|
|
182
191
|
id
|
|
183
192
|
name
|
|
184
193
|
}
|
|
185
|
-
|
|
194
|
+
createdAt
|
|
186
195
|
}
|
|
187
196
|
total
|
|
188
197
|
}
|
|
@@ -200,62 +209,4 @@ export class BoardTemplateListPage extends connect(store)(localize(i18next)(Scop
|
|
|
200
209
|
records: response.data.responses.items || []
|
|
201
210
|
}
|
|
202
211
|
}
|
|
203
|
-
|
|
204
|
-
async _deleteBoardTemplate() {
|
|
205
|
-
if (confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }))) {
|
|
206
|
-
const ids = this.grist.selected.map(record => record.id)
|
|
207
|
-
if (ids && ids.length > 0) {
|
|
208
|
-
const [mutateFunction, { error }] = useMutation(`
|
|
209
|
-
mutation ($ids: [String!]!) {
|
|
210
|
-
deleteBoardTemplates(ids: $ids)
|
|
211
|
-
}`)
|
|
212
|
-
|
|
213
|
-
mutateFunction({
|
|
214
|
-
variables: {
|
|
215
|
-
ids
|
|
216
|
-
}
|
|
217
|
-
})
|
|
218
|
-
|
|
219
|
-
if (!error) {
|
|
220
|
-
this.grist.fetch()
|
|
221
|
-
notify({
|
|
222
|
-
message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
|
|
223
|
-
})
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
async _updateBoardTemplate() {
|
|
230
|
-
let patches = this.grist.dirtyRecords
|
|
231
|
-
if (patches && patches.length) {
|
|
232
|
-
patches = patches.map(patch => {
|
|
233
|
-
let patchField: any = patch.id ? { id: patch.id } : {}
|
|
234
|
-
const dirtyFields = patch.__dirtyfields__
|
|
235
|
-
for (let key in dirtyFields) {
|
|
236
|
-
patchField[key] = dirtyFields[key].after
|
|
237
|
-
}
|
|
238
|
-
patchField.cuFlag = patch.__dirty__
|
|
239
|
-
|
|
240
|
-
return patchField
|
|
241
|
-
})
|
|
242
|
-
|
|
243
|
-
const [mutateFunction, { error }] = useMutation(`
|
|
244
|
-
mutation ($patches: [BoardTemplatePatch!]!) {
|
|
245
|
-
updateMultipleBoardTemplate(patches: $patches) {
|
|
246
|
-
name
|
|
247
|
-
}
|
|
248
|
-
}`)
|
|
249
|
-
|
|
250
|
-
mutateFunction({
|
|
251
|
-
variables: {
|
|
252
|
-
patches
|
|
253
|
-
}
|
|
254
|
-
})
|
|
255
|
-
|
|
256
|
-
if (!error) {
|
|
257
|
-
this.grist.fetch()
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
212
|
}
|
|
@@ -597,8 +597,6 @@ export class BoardInfo extends connect(store)(LitElement) {
|
|
|
597
597
|
composed: true
|
|
598
598
|
})
|
|
599
599
|
)
|
|
600
|
-
|
|
601
|
-
this.close()
|
|
602
600
|
}
|
|
603
601
|
|
|
604
602
|
async updateBoard() {
|
|
@@ -612,8 +610,6 @@ export class BoardInfo extends connect(store)(LitElement) {
|
|
|
612
610
|
composed: true
|
|
613
611
|
})
|
|
614
612
|
)
|
|
615
|
-
|
|
616
|
-
this.close()
|
|
617
613
|
}
|
|
618
614
|
|
|
619
615
|
async deleteBoard() {
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { css, html, LitElement } from 'lit'
|
|
2
2
|
import { customElement, property, state } from 'lit/decorators.js'
|
|
3
|
+
import { OxPrompt } from '@operato/popup/ox-prompt.js'
|
|
4
|
+
import { i18next } from '@operato/i18n'
|
|
3
5
|
|
|
4
6
|
import './link-builder.js'
|
|
7
|
+
import './board-template-builder.js'
|
|
5
8
|
|
|
6
9
|
@customElement('board-info-link')
|
|
7
10
|
export class BoardInfoLink extends LitElement {
|
|
@@ -9,11 +12,14 @@ export class BoardInfoLink extends LitElement {
|
|
|
9
12
|
css`
|
|
10
13
|
:host {
|
|
11
14
|
display: flex;
|
|
15
|
+
flex-direction: column;
|
|
12
16
|
background-color: var(--main-section-background-color);
|
|
13
17
|
position: relative;
|
|
14
18
|
text-align: center;
|
|
15
19
|
color: var(--label-color);
|
|
16
20
|
font: var(--label-font);
|
|
21
|
+
|
|
22
|
+
overflow-y: auto;
|
|
17
23
|
}
|
|
18
24
|
|
|
19
25
|
link-builder {
|
|
@@ -21,6 +27,11 @@ export class BoardInfoLink extends LitElement {
|
|
|
21
27
|
text-align: start;
|
|
22
28
|
}
|
|
23
29
|
|
|
30
|
+
board-template-builder {
|
|
31
|
+
flex: 1;
|
|
32
|
+
text-align: start;
|
|
33
|
+
}
|
|
34
|
+
|
|
24
35
|
@media screen and (max-width: 460px) {
|
|
25
36
|
:host {
|
|
26
37
|
width: 100vw;
|
|
@@ -29,7 +40,7 @@ export class BoardInfoLink extends LitElement {
|
|
|
29
40
|
`
|
|
30
41
|
]
|
|
31
42
|
|
|
32
|
-
@property({ type: Object }) board?: { id: string; name: string }
|
|
43
|
+
@property({ type: Object }) board?: { id: string; name: string; description: string }
|
|
33
44
|
|
|
34
45
|
render() {
|
|
35
46
|
return html`
|
|
@@ -38,6 +49,8 @@ export class BoardInfoLink extends LitElement {
|
|
|
38
49
|
target-id=${this.board?.id || ''}
|
|
39
50
|
target-name=${this.board?.name || ''}
|
|
40
51
|
></link-builder>
|
|
52
|
+
|
|
53
|
+
<board-template-builder .board=${this.board}> </board-template-builder>
|
|
41
54
|
`
|
|
42
55
|
}
|
|
43
56
|
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import '@material/mwc-icon'
|
|
2
|
+
import '@operato/i18n/ox-i18n.js'
|
|
3
|
+
|
|
4
|
+
import { css, html, LitElement, PropertyValues } from 'lit'
|
|
5
|
+
import { customElement, property, state } from 'lit/decorators.js'
|
|
6
|
+
|
|
7
|
+
import { ScrollbarStyles } from '@operato/styles'
|
|
8
|
+
import { i18next } from '@operato/i18n'
|
|
9
|
+
import { OxPrompt } from '@operato/popup/ox-prompt.js'
|
|
10
|
+
|
|
11
|
+
@customElement('board-template-builder')
|
|
12
|
+
export class BoardTemplateBuilder extends LitElement {
|
|
13
|
+
static styles = [
|
|
14
|
+
ScrollbarStyles,
|
|
15
|
+
css`
|
|
16
|
+
:host {
|
|
17
|
+
display: flex;
|
|
18
|
+
padding: var(--padding-wide);
|
|
19
|
+
|
|
20
|
+
/* for narrow mode */
|
|
21
|
+
flex-direction: column;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
div[template] {
|
|
25
|
+
display: grid;
|
|
26
|
+
position: relative;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
label {
|
|
30
|
+
font: var(--label-font);
|
|
31
|
+
color: var(--label-color);
|
|
32
|
+
text-transform: capitalize;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
input,
|
|
36
|
+
select,
|
|
37
|
+
textarea {
|
|
38
|
+
border: var(--border-dark-color);
|
|
39
|
+
border-radius: var(--border-radius);
|
|
40
|
+
margin: var(--input-margin);
|
|
41
|
+
padding: var(--input-padding);
|
|
42
|
+
font: var(--input-font);
|
|
43
|
+
flex: 1 1 0%;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
textarea {
|
|
47
|
+
min-height: 132px;
|
|
48
|
+
resize: none;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
select:focus,
|
|
52
|
+
input:focus,
|
|
53
|
+
textarea:focus,
|
|
54
|
+
button {
|
|
55
|
+
outline: none;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
button:hover {
|
|
59
|
+
border: var(--button-activ-border);
|
|
60
|
+
box-shadow: var(--button-active-box-shadow);
|
|
61
|
+
}
|
|
62
|
+
`
|
|
63
|
+
]
|
|
64
|
+
|
|
65
|
+
@property({ type: Object }) board?: { id: string; name: string; description: string }
|
|
66
|
+
|
|
67
|
+
@state() visibility?: string = 'private'
|
|
68
|
+
@state() name?: string = ''
|
|
69
|
+
@state() description?: string = ''
|
|
70
|
+
|
|
71
|
+
render() {
|
|
72
|
+
const name = this.name || this.board?.name || ''
|
|
73
|
+
const description = this.description || this.board?.description || ''
|
|
74
|
+
|
|
75
|
+
return html`
|
|
76
|
+
<div template>
|
|
77
|
+
<h3>
|
|
78
|
+
<ox-title-with-help topic="board-service/board-template" msgid="label.board-template"
|
|
79
|
+
>board template</ox-title-with-help
|
|
80
|
+
>
|
|
81
|
+
</h3>
|
|
82
|
+
<label for="name">${i18next.t('field.name')}</label>
|
|
83
|
+
<input id="name" type="text" .value=${name} @change=${e => (this.name = e.target.value)} />
|
|
84
|
+
|
|
85
|
+
<label for="description">${i18next.t('field.description')}</label>
|
|
86
|
+
<textarea
|
|
87
|
+
id="description"
|
|
88
|
+
.value=${this.description}
|
|
89
|
+
@change=${e => (this.description = e.target.value)}
|
|
90
|
+
></textarea>
|
|
91
|
+
|
|
92
|
+
<label>${i18next.t('field.visibility')}</label>
|
|
93
|
+
<select
|
|
94
|
+
@change=${e => (this.visibility = e.target.value)}
|
|
95
|
+
placeholder="choose visibility ..."
|
|
96
|
+
.value=${this.visibility}
|
|
97
|
+
>
|
|
98
|
+
<option value="private">private</option>
|
|
99
|
+
<option value="domain">domain</option>
|
|
100
|
+
<option value="public">public</option>
|
|
101
|
+
</select>
|
|
102
|
+
|
|
103
|
+
<button @click=${this.registerBoardAsTemplate}>${i18next.t('text.register-template')}</button>
|
|
104
|
+
</div>
|
|
105
|
+
`
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
async registerBoardAsTemplate() {
|
|
109
|
+
if (
|
|
110
|
+
await OxPrompt.open({
|
|
111
|
+
title: i18next.t('text.are_you_sure'),
|
|
112
|
+
text: i18next.t('text.sure_to_x', { x: i18next.t('text.register-template') }),
|
|
113
|
+
confirmButton: { text: i18next.t('button.confirm') },
|
|
114
|
+
cancelButton: { text: i18next.t('button.cancel') }
|
|
115
|
+
})
|
|
116
|
+
) {
|
|
117
|
+
const { id } = this.board || {}
|
|
118
|
+
|
|
119
|
+
this.dispatchEvent(
|
|
120
|
+
new CustomEvent('register-template', {
|
|
121
|
+
detail: {
|
|
122
|
+
id,
|
|
123
|
+
name: this.name || this.board?.name,
|
|
124
|
+
description: this.description || this.board?.description,
|
|
125
|
+
visibility: this.visibility
|
|
126
|
+
},
|
|
127
|
+
bubbles: true,
|
|
128
|
+
composed: true
|
|
129
|
+
})
|
|
130
|
+
)
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
@@ -68,7 +68,7 @@ export class LinkBuilder extends LitElement {
|
|
|
68
68
|
|
|
69
69
|
[button-in-field] {
|
|
70
70
|
position: absolute;
|
|
71
|
-
top:
|
|
71
|
+
top: 64px;
|
|
72
72
|
right: 6px;
|
|
73
73
|
|
|
74
74
|
background-color: white;
|
|
@@ -98,11 +98,11 @@ export class LinkBuilder extends LitElement {
|
|
|
98
98
|
render() {
|
|
99
99
|
return html`
|
|
100
100
|
<div link>
|
|
101
|
-
<
|
|
101
|
+
<h3>
|
|
102
102
|
<ox-title-with-help topic="operato-board/headless-link" msgid="label.headless-link"
|
|
103
103
|
>headless-link</ox-title-with-help
|
|
104
104
|
>
|
|
105
|
-
</
|
|
105
|
+
</h3>
|
|
106
106
|
<textarea id="link" .value=${this.link || ''} readonly></textarea>
|
|
107
107
|
<mwc-icon button-in-field clipboard-copy>content_copy</mwc-icon>
|
|
108
108
|
<label for="key">${i18next.t('label.headless-link query-key')}</label>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function fetchBoardTemplateList(listParam?: {}): Promise<any>;
|
|
2
|
+
export declare function fetchBoardTemplate(id: any): Promise<any>;
|
|
3
|
+
export declare function createBoardTemplate(boardTemplate: any): Promise<any>;
|
|
4
|
+
export declare function updateBoardTemplate(boardTemplate: any): Promise<any>;
|
|
5
|
+
export declare function deleteBoardTemplate(id: any): Promise<any>;
|