@operato/board 1.1.35 → 1.1.37
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/CHANGELOG.md +17 -0
- package/dist/src/modeller/property-sidebar/effects/property-event-hover.js +1 -5
- package/dist/src/modeller/property-sidebar/effects/property-event-hover.js.map +1 -1
- package/dist/src/modeller/property-sidebar/effects/property-event-tap.js +1 -5
- package/dist/src/modeller/property-sidebar/effects/property-event-tap.js.map +1 -1
- package/dist/src/ox-board-list.js +4 -4
- package/dist/src/ox-board-list.js.map +1 -1
- package/dist/src/ox-editor-board-selector.d.ts +15 -0
- package/dist/src/ox-editor-board-selector.js +86 -0
- package/dist/src/ox-editor-board-selector.js.map +1 -0
- package/dist/src/ox-property-editor-board-selector.d.ts +4 -0
- package/dist/src/ox-property-editor-board-selector.js +22 -0
- package/dist/src/ox-property-editor-board-selector.js.map +1 -0
- package/dist/src/selector/board-creation-card.d.ts +14 -0
- package/dist/src/selector/board-creation-card.js +85 -0
- package/dist/src/selector/board-creation-card.js.map +1 -0
- package/dist/src/selector/board-creation-popup.d.ts +19 -0
- package/dist/src/selector/board-creation-popup.js +100 -0
- package/dist/src/selector/board-creation-popup.js.map +1 -0
- package/dist/src/selector/board-selector.d.ts +44 -0
- package/dist/src/selector/board-selector.js +302 -0
- package/dist/src/selector/board-selector.js.map +1 -0
- package/dist/src/selector/board-thumbnail-card.d.ts +15 -0
- package/dist/src/selector/board-thumbnail-card.js +169 -0
- package/dist/src/selector/board-thumbnail-card.js.map +1 -0
- package/dist/src/selector/ox-board-creation-card.d.ts +14 -0
- package/dist/src/selector/ox-board-creation-card.js +85 -0
- package/dist/src/selector/ox-board-creation-card.js.map +1 -0
- package/dist/src/selector/ox-board-selector.d.ts +43 -0
- package/dist/src/selector/ox-board-selector.js +302 -0
- package/dist/src/selector/ox-board-selector.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +24 -8
- package/src/modeller/property-sidebar/effects/property-event-hover.ts +1 -5
- package/src/modeller/property-sidebar/effects/property-event-tap.ts +1 -5
- package/src/ox-board-list.ts +4 -4
- package/src/ox-editor-board-selector.ts +91 -0
- package/src/ox-property-editor-board-selector.ts +23 -0
- package/src/selector/board-creation-popup.ts +102 -0
- package/src/selector/board-thumbnail-card.ts +175 -0
- package/src/selector/ox-board-creation-card.ts +92 -0
- package/src/selector/ox-board-selector.ts +317 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@operato/board",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.37",
|
|
4
4
|
"description": "Webcomponent for board following open-wc recommendations",
|
|
5
5
|
"author": "heartyoh",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -24,6 +24,10 @@
|
|
|
24
24
|
"./ox-board-viewer.js": "./dist/src/ox-board-viewer.js",
|
|
25
25
|
"./ox-board-player.js": "./dist/src/ox-board-player.js",
|
|
26
26
|
"./ox-board-modeller.js": "./dist/src/ox-board-modeller.js",
|
|
27
|
+
"./ox-editor-board-selector.js": "./dist/src/ox-editor-board-selector.js",
|
|
28
|
+
"./ox-property-editor-board-selector.js": "./dist/src/ox-property-editor-board-selector.js",
|
|
29
|
+
"./ox-board-selector.js": "./dist/src/selector/ox-board-selector.js",
|
|
30
|
+
"./ox-board-creation-card.js": "./dist/src/selector/ox-board-creation-card.js",
|
|
27
31
|
"./register-default-groups.js": "./dist/src/component/register-default-groups.js"
|
|
28
32
|
},
|
|
29
33
|
"typesVersions": {
|
|
@@ -52,6 +56,18 @@
|
|
|
52
56
|
"ox-board-modeller.js": [
|
|
53
57
|
"./dist/src/ox-board-modeller.d.ts"
|
|
54
58
|
],
|
|
59
|
+
"ox-editor-board-selector.js": [
|
|
60
|
+
"./dist/src/ox-editor-board-selector.d.ts"
|
|
61
|
+
],
|
|
62
|
+
"ox-property-editor-board-selector.js": [
|
|
63
|
+
"./dist/src/ox-property-editor-board-selector.d.ts"
|
|
64
|
+
],
|
|
65
|
+
"ox-board-selector.js": [
|
|
66
|
+
"./dist/src/selector/ox-board-selector.d.ts"
|
|
67
|
+
],
|
|
68
|
+
"ox-board-creation-card.js": [
|
|
69
|
+
"./dist/src/selector/ox-board-creation-card.d.ts"
|
|
70
|
+
],
|
|
55
71
|
"register-default-groups.js": [
|
|
56
72
|
"./dist/src/component/register-default-groups.d.ts"
|
|
57
73
|
]
|
|
@@ -71,17 +87,17 @@
|
|
|
71
87
|
},
|
|
72
88
|
"dependencies": {
|
|
73
89
|
"@open-wc/scoped-elements": "^2.0.0-next.6",
|
|
74
|
-
"@operato/app": "^1.1.
|
|
75
|
-
"@operato/data-grist": "^1.1.
|
|
76
|
-
"@operato/font": "^1.1.
|
|
90
|
+
"@operato/app": "^1.1.37",
|
|
91
|
+
"@operato/data-grist": "^1.1.37",
|
|
92
|
+
"@operato/font": "^1.1.37",
|
|
77
93
|
"@operato/graphql": "^1.1.13",
|
|
78
94
|
"@operato/i18n": "^1.1.13",
|
|
79
|
-
"@operato/input": "^1.1.
|
|
95
|
+
"@operato/input": "^1.1.37",
|
|
80
96
|
"@operato/markdown": "^1.1.28",
|
|
81
97
|
"@operato/popup": "^1.1.28",
|
|
82
|
-
"@operato/property-editor": "^1.1.
|
|
98
|
+
"@operato/property-editor": "^1.1.37",
|
|
83
99
|
"@operato/styles": "^1.1.28",
|
|
84
|
-
"@operato/utils": "^1.1.
|
|
100
|
+
"@operato/utils": "^1.1.37",
|
|
85
101
|
"@polymer/paper-dropdown-menu": "^3.2.0",
|
|
86
102
|
"@types/file-saver": "^2.0.4",
|
|
87
103
|
"@types/sortablejs": "^1.10.7",
|
|
@@ -130,5 +146,5 @@
|
|
|
130
146
|
"prettier --write"
|
|
131
147
|
]
|
|
132
148
|
},
|
|
133
|
-
"gitHead": "
|
|
149
|
+
"gitHead": "6f015266daddd7faec2219a0b7fbbdc935899378"
|
|
134
150
|
}
|
|
@@ -47,11 +47,7 @@ export class PropertyEventHover extends LitElement {
|
|
|
47
47
|
|
|
48
48
|
${action == 'popup'
|
|
49
49
|
? html`
|
|
50
|
-
<
|
|
51
|
-
value-key="target"
|
|
52
|
-
.value=${target}
|
|
53
|
-
custom-editor
|
|
54
|
-
></things-editor-board-selector>
|
|
50
|
+
<ox-editor-board-selector value-key="target" .value=${target} custom-editor></ox-editor-board-selector>
|
|
55
51
|
`
|
|
56
52
|
: html`
|
|
57
53
|
<input
|
|
@@ -70,11 +70,7 @@ export class PropertyEventTap extends LitElement {
|
|
|
70
70
|
|
|
71
71
|
${action === 'goto' || action?.includes('popup')
|
|
72
72
|
? html`
|
|
73
|
-
<
|
|
74
|
-
value-key="target"
|
|
75
|
-
.value=${target}
|
|
76
|
-
custom-editor
|
|
77
|
-
></things-editor-board-selector>
|
|
73
|
+
<ox-editor-board-selector value-key="target" .value=${target} custom-editor></ox-editor-board-selector>
|
|
78
74
|
`
|
|
79
75
|
: html`
|
|
80
76
|
<input
|
package/src/ox-board-list.ts
CHANGED
|
@@ -404,10 +404,10 @@ class BoardList extends LitElement {
|
|
|
404
404
|
* string인 경우에는 해당 보드의 id로 해석한다.
|
|
405
405
|
*/
|
|
406
406
|
var template = html`
|
|
407
|
-
<
|
|
407
|
+
<board-creation-popup
|
|
408
408
|
.defaultGroup=${this.groupId}
|
|
409
409
|
.groups=${this.groups}
|
|
410
|
-
@create-
|
|
410
|
+
@create-board=${async (e: CustomEvent) => {
|
|
411
411
|
try {
|
|
412
412
|
var { name, description, groupId } = e.detail
|
|
413
413
|
var board: Board = {
|
|
@@ -426,13 +426,13 @@ class BoardList extends LitElement {
|
|
|
426
426
|
|
|
427
427
|
// await sleep(100)
|
|
428
428
|
|
|
429
|
-
this.notify('info', 'new
|
|
429
|
+
this.notify('info', 'new board created')
|
|
430
430
|
} catch (ex: Error | any) {
|
|
431
431
|
console.error(ex)
|
|
432
432
|
this.notify('error', ex, ex)
|
|
433
433
|
}
|
|
434
434
|
}}
|
|
435
|
-
></
|
|
435
|
+
></board-creation-popup>
|
|
436
436
|
`
|
|
437
437
|
|
|
438
438
|
OxPopup.open({
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import '@material/mwc-icon'
|
|
6
|
+
import './selector/ox-board-selector'
|
|
7
|
+
|
|
8
|
+
import { css, html, LitElement } from 'lit'
|
|
9
|
+
import { customElement, property } from 'lit/decorators.js'
|
|
10
|
+
|
|
11
|
+
import { i18next } from '@operato/i18n'
|
|
12
|
+
import { openPopup } from '@operato/layout'
|
|
13
|
+
|
|
14
|
+
@customElement('ox-editor-board-selector')
|
|
15
|
+
export class BoardSelector extends LitElement {
|
|
16
|
+
static get styles() {
|
|
17
|
+
return [
|
|
18
|
+
css`
|
|
19
|
+
:host {
|
|
20
|
+
position: relative;
|
|
21
|
+
display: inline-block;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
input[type='text'] {
|
|
25
|
+
box-sizing: border-box;
|
|
26
|
+
width: 100%;
|
|
27
|
+
height: 100%;
|
|
28
|
+
border: 1px solid rgba(0, 0, 0, 0.2);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
mwc-icon {
|
|
32
|
+
position: absolute;
|
|
33
|
+
top: 0;
|
|
34
|
+
right: 0;
|
|
35
|
+
}
|
|
36
|
+
`
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@property({ type: String }) value?: string
|
|
41
|
+
@property({ type: Object }) properties?: any
|
|
42
|
+
|
|
43
|
+
private popup: any
|
|
44
|
+
|
|
45
|
+
render() {
|
|
46
|
+
return html`
|
|
47
|
+
<input id="text" type="text" .value=${this.value || ''} @change=${(e: Event) => this._onInputChanged(e)} />
|
|
48
|
+
|
|
49
|
+
<mwc-icon @click=${(e: MouseEvent) => this.openSelector()}>dashboard</mwc-icon>
|
|
50
|
+
`
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
_onInputChanged(e: Event) {
|
|
54
|
+
this.value = (e.target as any)?.value
|
|
55
|
+
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
openSelector() {
|
|
59
|
+
if (this.popup) {
|
|
60
|
+
delete this.popup
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/*
|
|
64
|
+
* 기존 설정된 보드가 선택된 상태가 되게 하기 위해서는 selector에 value를 전달해줄 필요가 있음.
|
|
65
|
+
* 주의. value는 object일 수도 있고, string일 수도 있다.
|
|
66
|
+
* string인 경우에는 해당 보드의 id로 해석한다.
|
|
67
|
+
*/
|
|
68
|
+
var value = this.value || {}
|
|
69
|
+
|
|
70
|
+
var template = html`
|
|
71
|
+
<ox-board-selector
|
|
72
|
+
.creatable=${true}
|
|
73
|
+
.value=${value}
|
|
74
|
+
@board-selected=${async (e: CustomEvent) => {
|
|
75
|
+
var board = e.detail.board
|
|
76
|
+
this.value = board.id
|
|
77
|
+
|
|
78
|
+
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
|
|
79
|
+
|
|
80
|
+
this.popup && this.popup.close()
|
|
81
|
+
}}
|
|
82
|
+
></ox-board-selector>
|
|
83
|
+
`
|
|
84
|
+
|
|
85
|
+
this.popup = openPopup(template, {
|
|
86
|
+
backdrop: true,
|
|
87
|
+
size: 'large',
|
|
88
|
+
title: i18next.t('title.select board')
|
|
89
|
+
})
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import './ox-editor-board-selector'
|
|
6
|
+
|
|
7
|
+
import { html } from 'lit'
|
|
8
|
+
import { customElement } from 'lit/decorators.js'
|
|
9
|
+
|
|
10
|
+
import { OxPropertyEditor, PropertySpec } from '@operato/property-editor'
|
|
11
|
+
|
|
12
|
+
@customElement('ox-property-editor-board-selector')
|
|
13
|
+
class PropertyEditorBoardSelector extends OxPropertyEditor {
|
|
14
|
+
static get styles() {
|
|
15
|
+
return [...OxPropertyEditor.styles]
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
editorTemplate(value: any, spec: PropertySpec) {
|
|
19
|
+
return html`
|
|
20
|
+
<ox-editor-board-selector id="editor" .value=${value} .properties=${spec.property}></ox-editor-board-selector>
|
|
21
|
+
`
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import '@material/mwc-textfield'
|
|
2
|
+
import '@material/mwc-textarea'
|
|
3
|
+
import '@material/mwc-select'
|
|
4
|
+
import '@material/mwc-list/mwc-list-item'
|
|
5
|
+
import '@material/mwc-button'
|
|
6
|
+
|
|
7
|
+
import { css, html, LitElement } from 'lit'
|
|
8
|
+
import { customElement, property } from 'lit/decorators.js'
|
|
9
|
+
|
|
10
|
+
import { i18next, localize } from '@operato/i18n'
|
|
11
|
+
|
|
12
|
+
@customElement('board-creation-popup')
|
|
13
|
+
export class BoardCreationPopup extends localize(i18next)(LitElement) {
|
|
14
|
+
static get styles() {
|
|
15
|
+
return [
|
|
16
|
+
css`
|
|
17
|
+
:host {
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
|
|
21
|
+
padding: 10px;
|
|
22
|
+
background-color: white;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
:host > * {
|
|
26
|
+
margin: 10px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
[content] {
|
|
30
|
+
flex: 1;
|
|
31
|
+
display: flex;
|
|
32
|
+
flex-direction: column;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
[content] > * {
|
|
36
|
+
margin: 10px 0;
|
|
37
|
+
}
|
|
38
|
+
`
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@property({ type: String }) defaultGroup?: string
|
|
43
|
+
@property({ type: Array }) groups?: { id: string; name: string }[]
|
|
44
|
+
|
|
45
|
+
render() {
|
|
46
|
+
var groups = this.groups || []
|
|
47
|
+
|
|
48
|
+
return html`
|
|
49
|
+
<div content>
|
|
50
|
+
<mwc-textfield label=${String(i18next.t('label.name'))} name="name" required field-name></mwc-textfield>
|
|
51
|
+
<mwc-textarea
|
|
52
|
+
label=${String(i18next.t('label.description'))}
|
|
53
|
+
name="description"
|
|
54
|
+
field-description
|
|
55
|
+
></mwc-textarea>
|
|
56
|
+
<mwc-select
|
|
57
|
+
label=${String(i18next.t('label.group'))}
|
|
58
|
+
field-group
|
|
59
|
+
helper="If there is no group to choose, you can leave it empty."
|
|
60
|
+
>
|
|
61
|
+
${groups.map(
|
|
62
|
+
group => html`
|
|
63
|
+
<mwc-list-item value=${group.id} ?selected=${this.defaultGroup == group.id}>${group.name}</mwc-list-item>
|
|
64
|
+
`
|
|
65
|
+
)}
|
|
66
|
+
</mwc-select>
|
|
67
|
+
</div>
|
|
68
|
+
|
|
69
|
+
<mwc-button
|
|
70
|
+
raised
|
|
71
|
+
label=${String(i18next.t('button.create'))}
|
|
72
|
+
@click=${(e: MouseEvent) => this.onClickSubmit()}
|
|
73
|
+
></mwc-button>
|
|
74
|
+
`
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
firstUpdated() {
|
|
78
|
+
setTimeout(() => {
|
|
79
|
+
;(this.renderRoot.querySelector('mwc-textfield') as any)?.focus()
|
|
80
|
+
}, 100)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
onClickSubmit() {
|
|
84
|
+
var [name, description, groupId] = ['name', 'description', 'group'].map(attr => {
|
|
85
|
+
return (this.renderRoot.querySelector(`[field-${attr}]`) as any)?.value
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
if (!name) {
|
|
89
|
+
return
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
this.dispatchEvent(
|
|
93
|
+
new CustomEvent('create-board', {
|
|
94
|
+
detail: {
|
|
95
|
+
name,
|
|
96
|
+
description,
|
|
97
|
+
groupId
|
|
98
|
+
}
|
|
99
|
+
})
|
|
100
|
+
)
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { css, html, LitElement } from 'lit'
|
|
2
|
+
import { customElement, property } from 'lit/decorators.js'
|
|
3
|
+
|
|
4
|
+
import { i18next, localize } from '@operato/i18n'
|
|
5
|
+
|
|
6
|
+
@customElement('board-thumbnail-card')
|
|
7
|
+
export class BoardThumbnailCard extends localize(i18next)(LitElement) {
|
|
8
|
+
static get styles() {
|
|
9
|
+
return [
|
|
10
|
+
css`
|
|
11
|
+
:host {
|
|
12
|
+
position: relative;
|
|
13
|
+
|
|
14
|
+
padding: 0;
|
|
15
|
+
margin: 0;
|
|
16
|
+
height: 100%;
|
|
17
|
+
|
|
18
|
+
-webkit-transform-style: preserve-3d;
|
|
19
|
+
transform-style: preserve-3d;
|
|
20
|
+
-webkit-transition: all 0.5s ease-in-out;
|
|
21
|
+
transition: all 0.5s ease-in-out;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
:host(.flipped) {
|
|
25
|
+
-webkit-transform: var(--card-list-flip-transform);
|
|
26
|
+
transform: var(--card-list-flip-transform);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
[front],
|
|
30
|
+
[back] {
|
|
31
|
+
position: absolute;
|
|
32
|
+
|
|
33
|
+
width: 100%;
|
|
34
|
+
height: 100%;
|
|
35
|
+
margin: 0;
|
|
36
|
+
padding: 0;
|
|
37
|
+
|
|
38
|
+
border: var(--card-list-create-border);
|
|
39
|
+
border-radius: var(--card-list-create-border-radius);
|
|
40
|
+
|
|
41
|
+
background-color: #fff;
|
|
42
|
+
|
|
43
|
+
-webkit-backface-visibility: hidden;
|
|
44
|
+
backface-visibility: hidden;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
[front] {
|
|
48
|
+
text-align: center;
|
|
49
|
+
font-size: 0.8em;
|
|
50
|
+
color: var(--card-list-create-color);
|
|
51
|
+
text-transform: capitalize;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
[front] mwc-icon {
|
|
55
|
+
margin-top: 15%;
|
|
56
|
+
display: block;
|
|
57
|
+
font-size: 3.5em;
|
|
58
|
+
color: var(--card-list-create-icon-color);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
[back] {
|
|
62
|
+
-webkit-transform: var(--card-list-flip-transform);
|
|
63
|
+
transform: var(--card-list-flip-transform);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
[back] form {
|
|
67
|
+
padding: var(--card-list-create-form-padding);
|
|
68
|
+
display: flex;
|
|
69
|
+
flex-flow: row wrap;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
[back] form label {
|
|
73
|
+
flex: 1 1 25%;
|
|
74
|
+
font: var(--card-list-create-label-font);
|
|
75
|
+
color: var(--card-list-create-label-color);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
[back] form input,
|
|
79
|
+
[back] form select {
|
|
80
|
+
flex: 1 1 60%;
|
|
81
|
+
width: 10px;
|
|
82
|
+
background-color: #fff;
|
|
83
|
+
border: var(--card-list-create-input-border);
|
|
84
|
+
border-radius: var(--card-list-create-input-border-radius);
|
|
85
|
+
padding: var(--card-list-create-input-padding);
|
|
86
|
+
font: var(--card-list-create-input-font);
|
|
87
|
+
color: var(--card-list-create-input-color);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
form * {
|
|
91
|
+
margin: var(--card-list-create-margin);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
input[type='submit'] {
|
|
95
|
+
background-color: var(--button-background-color) !important;
|
|
96
|
+
margin: var(--button-margin);
|
|
97
|
+
font: var(--button-font);
|
|
98
|
+
color: var(--button-color) !important;
|
|
99
|
+
border-radius: var(--button-radius);
|
|
100
|
+
border: var(--button-border);
|
|
101
|
+
}
|
|
102
|
+
`
|
|
103
|
+
]
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
@property({ type: String }) defaultGroup?: string
|
|
107
|
+
@property({ type: Array }) groups?: { id: string; name: string }[]
|
|
108
|
+
|
|
109
|
+
render() {
|
|
110
|
+
var groups = this.groups || []
|
|
111
|
+
|
|
112
|
+
return html`
|
|
113
|
+
<div @click=${(e: Event) => this.onClickFlip(e)} front><mwc-icon>add_circle_outline</mwc-icon>create board</div>
|
|
114
|
+
|
|
115
|
+
<div @click=${(e: Event) => this.onClickFlip(e)} back>
|
|
116
|
+
<form @submit=${(e: Event) => this.onClickSubmit(e)}>
|
|
117
|
+
<label>${i18next.t('label.name')}</label>
|
|
118
|
+
<input type="text" name="name" />
|
|
119
|
+
|
|
120
|
+
<label>${i18next.t('label.description')}</label>
|
|
121
|
+
<input type="text" name="description" />
|
|
122
|
+
|
|
123
|
+
<label>${i18next.t('label.group')}</label>
|
|
124
|
+
<select .value=${this.defaultGroup || ''} name="groupId">
|
|
125
|
+
${groups.map(
|
|
126
|
+
group => html`
|
|
127
|
+
<option value=${group.id} ?selected=${this.defaultGroup == group.id}>${group.name}</option>
|
|
128
|
+
`
|
|
129
|
+
)}
|
|
130
|
+
</select>
|
|
131
|
+
|
|
132
|
+
<input type="submit" value=${String(i18next.t('button.create'))} />
|
|
133
|
+
</form>
|
|
134
|
+
</div>
|
|
135
|
+
`
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
onClickFlip(e: Event) {
|
|
139
|
+
if ((e.currentTarget as any)?.hasAttribute('front') || (e.target as any)?.hasAttribute('back')) {
|
|
140
|
+
this.classList.toggle('flipped')
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
e.stopPropagation()
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
onClickSubmit(e: Event) {
|
|
147
|
+
e.preventDefault()
|
|
148
|
+
e.stopPropagation()
|
|
149
|
+
|
|
150
|
+
var form = e.target as any
|
|
151
|
+
|
|
152
|
+
var name = form.elements['name'].value
|
|
153
|
+
var description = form.elements['description'].value
|
|
154
|
+
var groupId = form.elements['groupId'].value
|
|
155
|
+
|
|
156
|
+
this.dispatchEvent(
|
|
157
|
+
new CustomEvent('create-board', {
|
|
158
|
+
detail: {
|
|
159
|
+
name,
|
|
160
|
+
description,
|
|
161
|
+
groupId
|
|
162
|
+
}
|
|
163
|
+
})
|
|
164
|
+
)
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
reset() {
|
|
168
|
+
var form = this.shadowRoot?.querySelector('form')
|
|
169
|
+
if (form) {
|
|
170
|
+
form.reset()
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
this.classList.remove('flipped')
|
|
174
|
+
}
|
|
175
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import '@material/mwc-icon'
|
|
2
|
+
import './board-creation-popup'
|
|
3
|
+
|
|
4
|
+
import { css, html, LitElement } from 'lit'
|
|
5
|
+
import { customElement, property } from 'lit/decorators.js'
|
|
6
|
+
|
|
7
|
+
import { i18next, localize } from '@operato/i18n'
|
|
8
|
+
import { openPopup } from '@operato/layout'
|
|
9
|
+
|
|
10
|
+
@customElement('ox-board-creation-card')
|
|
11
|
+
export class BoardCreationCard extends localize(i18next)(LitElement) {
|
|
12
|
+
static get styles() {
|
|
13
|
+
return [
|
|
14
|
+
css`
|
|
15
|
+
:host {
|
|
16
|
+
display: flex;
|
|
17
|
+
border: var(--card-list-create-border);
|
|
18
|
+
border-radius: var(--card-list-create-border-radius);
|
|
19
|
+
|
|
20
|
+
background-color: #fff;
|
|
21
|
+
|
|
22
|
+
align-content: center;
|
|
23
|
+
justify-content: center;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
div {
|
|
27
|
+
text-align: center;
|
|
28
|
+
font-size: 0.8em;
|
|
29
|
+
color: var(--card-list-create-color);
|
|
30
|
+
text-transform: capitalize;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
mwc-icon {
|
|
34
|
+
display: block;
|
|
35
|
+
font-size: 3.5em;
|
|
36
|
+
color: var(--card-list-create-icon-color);
|
|
37
|
+
}
|
|
38
|
+
`
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/* default group id */
|
|
43
|
+
@property({ type: String }) defaultGroup?: string
|
|
44
|
+
@property({ type: Array }) groups: any
|
|
45
|
+
|
|
46
|
+
private popup: any
|
|
47
|
+
|
|
48
|
+
render() {
|
|
49
|
+
return html`<div @click=${(e: Event) => this.onClick()}><mwc-icon>add_circle_outline</mwc-icon>create board</div> `
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
onClick() {
|
|
53
|
+
if (this.popup) {
|
|
54
|
+
delete this.popup
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/*
|
|
58
|
+
* 기존 설정된 이미지가 선택된 상태가 되게 하기 위해서는 selector에 value를 전달해줄 필요가 있음.
|
|
59
|
+
* 주의. value는 object일 수도 있고, string일 수도 있다.
|
|
60
|
+
* string인 경우에는 해당 보드의 id로 해석한다.
|
|
61
|
+
*/
|
|
62
|
+
var template = html`
|
|
63
|
+
<board-creation-popup
|
|
64
|
+
.defaultGroup=${this.defaultGroup}
|
|
65
|
+
.groups=${this.groups}
|
|
66
|
+
@create-board=${async (e: CustomEvent) => {
|
|
67
|
+
var { name, description, groupId } = e.detail
|
|
68
|
+
|
|
69
|
+
this.dispatchEvent(
|
|
70
|
+
new CustomEvent('create-board', {
|
|
71
|
+
detail: {
|
|
72
|
+
name,
|
|
73
|
+
description,
|
|
74
|
+
groupId
|
|
75
|
+
}
|
|
76
|
+
})
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
this.popup && this.popup.close()
|
|
80
|
+
}}
|
|
81
|
+
></board-creation-popup>
|
|
82
|
+
`
|
|
83
|
+
|
|
84
|
+
this.popup = openPopup(template, {
|
|
85
|
+
backdrop: true,
|
|
86
|
+
size: 'large',
|
|
87
|
+
title: i18next.t('title.create-board')
|
|
88
|
+
})
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
reset() {}
|
|
92
|
+
}
|