@operato/grist-editor 1.0.0-alpha.22 → 1.0.0-beta.39
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/.storybook/main.js +2 -2
- package/.storybook/server.mjs +4 -4
- package/LICENSE +2 -2
- package/README.md +29 -9
- package/dist/src/index.js +15 -1
- package/package.json +36 -26
- package/src/index.ts +18 -0
- package/src/ox-grist-editor-crontab.ts +62 -0
- package/src/ox-grist-editor-duration.ts +62 -0
- package/src/{parameters/parameters-editor.ts → ox-grist-editor-parameters.ts} +14 -27
- package/src/ox-grist-editor-partition-keys.ts +86 -0
- package/src/ox-grist-editor-value-map.ts +86 -0
- package/src/ox-grist-renderer-crontab.ts +31 -0
- package/src/{parameters/parameters-editor-builder.ts → ox-parameters-builder.ts} +6 -8
- package/src/ox-popup-crontab-input.ts +75 -0
- package/src/ox-popup-duration-input.ts +75 -0
- package/src/{parameters/parameters-editor-popup.ts → ox-popup-parameters-builder.ts} +10 -9
- package/src/ox-popup-partition-keys-input.ts +97 -0
- package/src/ox-popup-value-map-input.ts +102 -0
- package/stories/ox-grist-editor-crontab.stories.ts +429 -0
- package/themes/app-theme.css +142 -0
- package/themes/form-theme.css +75 -0
- package/themes/grist-theme.css +194 -0
- package/themes/oops-theme.css +26 -0
- package/themes/report-theme.css +47 -0
- package/translations/en.json +3 -0
- package/translations/ko.json +3 -0
- package/translations/ms.json +3 -0
- package/translations/zh.json +3 -0
- package/web-dev-server.config.mjs +9 -8
- package/web-test-runner.config.mjs +7 -19
- package/.editorconfig +0 -29
- package/CHANGELOG.md +0 -116
- package/demo/data-grist-test.html +0 -456
- package/demo/index.html +0 -33
- package/dist/src/code/code-editor.d.ts +0 -6
- package/dist/src/code/code-editor.js +0 -50
- package/dist/src/code/code-editor.js.map +0 -1
- package/dist/src/code/index.d.ts +0 -1
- package/dist/src/code/index.js +0 -5
- package/dist/src/code/index.js.map +0 -1
- package/dist/src/id/id-input.d.ts +0 -19
- package/dist/src/id/id-input.js +0 -119
- package/dist/src/id/id-input.js.map +0 -1
- package/dist/src/id/id-renderer.d.ts +0 -2
- package/dist/src/id/id-renderer.js +0 -9
- package/dist/src/id/id-renderer.js.map +0 -1
- package/dist/src/id/id-selector.d.ts +0 -23
- package/dist/src/id/id-selector.js +0 -197
- package/dist/src/id/id-selector.js.map +0 -1
- package/dist/src/id/index.d.ts +0 -1
- package/dist/src/id/index.js +0 -7
- package/dist/src/id/index.js.map +0 -1
- package/dist/src/index.d.ts +0 -0
- package/dist/src/index.js.map +0 -1
- package/dist/src/object/index.d.ts +0 -1
- package/dist/src/object/index.js +0 -6
- package/dist/src/object/index.js.map +0 -1
- package/dist/src/object/object-editor.d.ts +0 -18
- package/dist/src/object/object-editor.js +0 -152
- package/dist/src/object/object-editor.js.map +0 -1
- package/dist/src/object/object-selector.d.ts +0 -38
- package/dist/src/object/object-selector.js +0 -338
- package/dist/src/object/object-selector.js.map +0 -1
- package/dist/src/parameters/index.d.ts +0 -1
- package/dist/src/parameters/index.js +0 -6
- package/dist/src/parameters/index.js.map +0 -1
- package/dist/src/parameters/parameters-editor-builder.d.ts +0 -4
- package/dist/src/parameters/parameters-editor-builder.js +0 -118
- package/dist/src/parameters/parameters-editor-builder.js.map +0 -1
- package/dist/src/parameters/parameters-editor-popup.d.ts +0 -13
- package/dist/src/parameters/parameters-editor-popup.js +0 -111
- package/dist/src/parameters/parameters-editor-popup.js.map +0 -1
- package/dist/src/parameters/parameters-editor.d.ts +0 -18
- package/dist/src/parameters/parameters-editor.js +0 -106
- package/dist/src/parameters/parameters-editor.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/src/code/code-editor.ts +0 -78
- package/src/code/index.ts +0 -6
- package/src/id/id-input.ts +0 -135
- package/src/id/id-renderer.ts +0 -12
- package/src/id/id-selector.ts +0 -189
- package/src/id/index.ts +0 -8
- package/src/object/index.ts +0 -8
- package/src/object/object-editor.ts +0 -162
- package/src/object/object-selector.ts +0 -346
- package/src/parameters/index.ts +0 -8
|
@@ -2,24 +2,22 @@
|
|
|
2
2
|
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import { LitElement, PropertyValues
|
|
6
|
-
import { OxPropertyEditor, PropertySpec } from '@operato/property-editor'
|
|
5
|
+
import { html, LitElement, PropertyValues } from 'lit'
|
|
7
6
|
import { customElement, property } from 'lit/decorators.js'
|
|
8
7
|
|
|
9
|
-
import {
|
|
10
|
-
import { store } from '@operato/shell'
|
|
8
|
+
import { OxPropertyEditor, PropertySpec } from '@operato/property-editor'
|
|
11
9
|
|
|
12
10
|
/**
|
|
13
11
|
모든 에디터들은 change 이벤트를 지원해야 한다. 또한, 모든 에디터들은 value속성에 값을 가져야 한다.
|
|
14
12
|
|
|
15
13
|
Example:
|
|
16
14
|
|
|
17
|
-
<ox-parameters-
|
|
15
|
+
<ox-parameters-builder value="{{value}}">
|
|
18
16
|
<label>Center X</label>
|
|
19
17
|
<input type="number" .value="${value.cx}">
|
|
20
18
|
<label>Width</label>
|
|
21
19
|
<input type="number" .value="${value.width}">
|
|
22
|
-
</ox-parameters-
|
|
20
|
+
</ox-parameters-builder>
|
|
23
21
|
*/
|
|
24
22
|
|
|
25
23
|
const DEFAULT_VALUE = {
|
|
@@ -43,8 +41,8 @@ const DEFAULT_VALUE = {
|
|
|
43
41
|
date: null
|
|
44
42
|
} as any
|
|
45
43
|
|
|
46
|
-
@customElement('ox-parameters-
|
|
47
|
-
class
|
|
44
|
+
@customElement('ox-parameters-builder')
|
|
45
|
+
class OxParametersBuilder extends LitElement {
|
|
48
46
|
@property({ type: Object }) value: any
|
|
49
47
|
@property({ type: Array }) props?: PropertySpec[]
|
|
50
48
|
@property({ type: Object }) host: any
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import '@operato/input/ox-input-crontab.js'
|
|
2
|
+
|
|
3
|
+
import { css, html, LitElement } from 'lit'
|
|
4
|
+
import { customElement, property } from 'lit/decorators.js'
|
|
5
|
+
|
|
6
|
+
import { i18next } from '@operato/i18n'
|
|
7
|
+
import { closePopup } from '@operato/popup'
|
|
8
|
+
import { ScrollbarStyles } from '@operato/styles'
|
|
9
|
+
|
|
10
|
+
@customElement('ox-popup-crontab-input')
|
|
11
|
+
export class OxPopupCrontabInput extends LitElement {
|
|
12
|
+
static styles = [
|
|
13
|
+
ScrollbarStyles,
|
|
14
|
+
css`
|
|
15
|
+
:host {
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: column;
|
|
18
|
+
|
|
19
|
+
background-color: #fff;
|
|
20
|
+
|
|
21
|
+
width: var(--overlay-center-normal-width, 50%);
|
|
22
|
+
height: var(--overlay-center-normal-height, 50%);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
ox-input-crontab {
|
|
26
|
+
flex: 1;
|
|
27
|
+
overflow-y: auto;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
span {
|
|
31
|
+
flex: 1;
|
|
32
|
+
|
|
33
|
+
display: flex;
|
|
34
|
+
align-items: center;
|
|
35
|
+
justify-content: center;
|
|
36
|
+
|
|
37
|
+
color: var(--primary-color);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.button-container {
|
|
41
|
+
display: flex;
|
|
42
|
+
margin-left: auto;
|
|
43
|
+
}
|
|
44
|
+
`
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
@property({ type: Object }) value: any
|
|
48
|
+
@property({ type: Object }) confirmCallback!: (newval: any) => void
|
|
49
|
+
|
|
50
|
+
render() {
|
|
51
|
+
return html`
|
|
52
|
+
<ox-input-crontab .value=${this.value} @change=${this.onChange.bind(this)}> </ox-input-crontab>
|
|
53
|
+
|
|
54
|
+
<div class="button-container">
|
|
55
|
+
<mwc-button @click=${this.onCancel.bind(this)}>${i18next.t('button.cancel')}</mwc-button>
|
|
56
|
+
<mwc-button @click=${this.onConfirm.bind(this)}>${i18next.t('button.confirm')}</mwc-button>
|
|
57
|
+
</div>
|
|
58
|
+
`
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
private onChange(e: CustomEvent) {
|
|
62
|
+
e.stopPropagation()
|
|
63
|
+
|
|
64
|
+
this.value = e.detail
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
private onCancel(e: Event) {
|
|
68
|
+
closePopup(this)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
private onConfirm(e: Event) {
|
|
72
|
+
this.confirmCallback && this.confirmCallback(this.value)
|
|
73
|
+
closePopup(this)
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import '@operato/input/ox-input-duration.js'
|
|
2
|
+
|
|
3
|
+
import { css, html, LitElement } from 'lit'
|
|
4
|
+
import { customElement, property } from 'lit/decorators.js'
|
|
5
|
+
|
|
6
|
+
import { i18next } from '@operato/i18n'
|
|
7
|
+
import { closePopup } from '@operato/popup'
|
|
8
|
+
import { ScrollbarStyles } from '@operato/styles'
|
|
9
|
+
|
|
10
|
+
@customElement('ox-popup-duration-input')
|
|
11
|
+
export class OxPopupDurationInput extends LitElement {
|
|
12
|
+
static styles = [
|
|
13
|
+
ScrollbarStyles,
|
|
14
|
+
css`
|
|
15
|
+
:host {
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: column;
|
|
18
|
+
|
|
19
|
+
background-color: #fff;
|
|
20
|
+
|
|
21
|
+
width: var(--overlay-center-normal-width, 50%);
|
|
22
|
+
height: var(--overlay-center-normal-height, 50%);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
ox-input-duration {
|
|
26
|
+
flex: 1;
|
|
27
|
+
overflow-y: auto;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
span {
|
|
31
|
+
flex: 1;
|
|
32
|
+
|
|
33
|
+
display: flex;
|
|
34
|
+
align-items: center;
|
|
35
|
+
justify-content: center;
|
|
36
|
+
|
|
37
|
+
color: var(--primary-color);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.button-container {
|
|
41
|
+
display: flex;
|
|
42
|
+
margin-left: auto;
|
|
43
|
+
}
|
|
44
|
+
`
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
@property({ type: Object }) value: any
|
|
48
|
+
@property({ type: Object }) confirmCallback!: (newval: any) => void
|
|
49
|
+
|
|
50
|
+
render() {
|
|
51
|
+
return html`
|
|
52
|
+
<ox-input-duration .value=${this.value} @change=${this.onChange.bind(this)}> </ox-input-duration>
|
|
53
|
+
|
|
54
|
+
<div class="button-container">
|
|
55
|
+
<mwc-button @click=${this.onCancel.bind(this)}>${i18next.t('button.cancel')}</mwc-button>
|
|
56
|
+
<mwc-button @click=${this.onConfirm.bind(this)}>${i18next.t('button.confirm')}</mwc-button>
|
|
57
|
+
</div>
|
|
58
|
+
`
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
private onChange(e: CustomEvent) {
|
|
62
|
+
e.stopPropagation()
|
|
63
|
+
|
|
64
|
+
this.value = e.detail
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
private onCancel(e: Event) {
|
|
68
|
+
closePopup(this)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
private onConfirm(e: Event) {
|
|
72
|
+
this.confirmCallback && this.confirmCallback(this.value)
|
|
73
|
+
closePopup(this)
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { css, html, LitElement } from 'lit'
|
|
2
2
|
import { customElement, property } from 'lit/decorators.js'
|
|
3
3
|
|
|
4
|
-
import { ScrollbarStyles } from '@operato/styles'
|
|
5
4
|
import { i18next } from '@operato/i18n'
|
|
5
|
+
import { closePopup } from '@operato/popup'
|
|
6
|
+
import { ScrollbarStyles } from '@operato/styles'
|
|
6
7
|
|
|
7
|
-
@customElement('ox-parameters-
|
|
8
|
-
export class
|
|
8
|
+
@customElement('ox-popup-parameters-builder')
|
|
9
|
+
export class OxPopupParametersBuilder extends LitElement {
|
|
9
10
|
static styles = [
|
|
10
11
|
ScrollbarStyles,
|
|
11
12
|
css`
|
|
@@ -19,7 +20,7 @@ export class ParametersEditorPopup extends LitElement {
|
|
|
19
20
|
height: var(--overlay-center-normal-height, 50%);
|
|
20
21
|
}
|
|
21
22
|
|
|
22
|
-
ox-parameters-
|
|
23
|
+
ox-parameters-builder {
|
|
23
24
|
flex: 1;
|
|
24
25
|
overflow-y: auto;
|
|
25
26
|
}
|
|
@@ -53,14 +54,14 @@ export class ParametersEditorPopup extends LitElement {
|
|
|
53
54
|
return html`
|
|
54
55
|
${props.length > 0
|
|
55
56
|
? html`
|
|
56
|
-
<ox-parameters-
|
|
57
|
+
<ox-parameters-builder
|
|
57
58
|
.value=${this.value}
|
|
58
59
|
.props=${props}
|
|
59
60
|
.host=${this.host}
|
|
60
61
|
.context=${this.context}
|
|
61
62
|
@property-change=${this.onChange.bind(this)}
|
|
62
63
|
>
|
|
63
|
-
</ox-parameters-
|
|
64
|
+
</ox-parameters-builder>
|
|
64
65
|
`
|
|
65
66
|
: html` <span><i18n-msg msgid="text.no properties to set"></i18n-msg></span> `}
|
|
66
67
|
|
|
@@ -96,11 +97,11 @@ export class ParametersEditorPopup extends LitElement {
|
|
|
96
97
|
}
|
|
97
98
|
|
|
98
99
|
private onCancel(e: Event) {
|
|
99
|
-
|
|
100
|
+
closePopup(this)
|
|
100
101
|
}
|
|
101
102
|
|
|
102
103
|
private onConfirm(e: Event) {
|
|
103
104
|
this.confirmCallback && this.confirmCallback(this.value)
|
|
104
|
-
|
|
105
|
+
closePopup(this)
|
|
105
106
|
}
|
|
106
107
|
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import '@operato/input/ox-input-partition-keys.js'
|
|
2
|
+
|
|
3
|
+
import { css, html, LitElement } from 'lit'
|
|
4
|
+
import { customElement, property } from 'lit/decorators.js'
|
|
5
|
+
|
|
6
|
+
import { i18next } from '@operato/i18n'
|
|
7
|
+
import { closePopup } from '@operato/popup'
|
|
8
|
+
import { ScrollbarStyles } from '@operato/styles'
|
|
9
|
+
|
|
10
|
+
@customElement('ox-popup-partition-keys-input')
|
|
11
|
+
export class OxPopupPartitionKeysInput extends LitElement {
|
|
12
|
+
static styles = [
|
|
13
|
+
ScrollbarStyles,
|
|
14
|
+
css`
|
|
15
|
+
:host {
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: column;
|
|
18
|
+
|
|
19
|
+
background-color: #fff;
|
|
20
|
+
|
|
21
|
+
width: var(--overlay-center-normal-width, 50%);
|
|
22
|
+
height: var(--overlay-center-normal-height, 50%);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
ox-input-partition-keys {
|
|
26
|
+
flex: 1;
|
|
27
|
+
overflow-y: auto;
|
|
28
|
+
padding: 10px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
span {
|
|
32
|
+
flex: 1;
|
|
33
|
+
|
|
34
|
+
display: flex;
|
|
35
|
+
align-items: center;
|
|
36
|
+
justify-content: center;
|
|
37
|
+
|
|
38
|
+
color: var(--primary-color);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.button-container {
|
|
42
|
+
display: flex;
|
|
43
|
+
margin-left: auto;
|
|
44
|
+
}
|
|
45
|
+
`
|
|
46
|
+
]
|
|
47
|
+
|
|
48
|
+
@property({ type: Object }) value: any
|
|
49
|
+
@property({ type: String }) valuetype: string = 'string'
|
|
50
|
+
@property({ type: Object }) confirmCallback!: (newval: any) => void
|
|
51
|
+
|
|
52
|
+
render() {
|
|
53
|
+
return html`
|
|
54
|
+
<ox-input-partition-keys .value=${this.value} @change=${this.onChange.bind(this)}> </ox-input-partition-keys>
|
|
55
|
+
|
|
56
|
+
<div class="button-container">
|
|
57
|
+
<mwc-button @click=${this.onCancel.bind(this)}>${i18next.t('button.cancel')}</mwc-button>
|
|
58
|
+
<mwc-button @click=${this.onConfirm.bind(this)}>${i18next.t('button.confirm')}</mwc-button>
|
|
59
|
+
</div>
|
|
60
|
+
`
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
private onChange(e: CustomEvent) {
|
|
64
|
+
e.stopPropagation()
|
|
65
|
+
|
|
66
|
+
/*
|
|
67
|
+
주의 : 이 팝업 템플릿은 layout 모듈에 의해서 render 되므로,
|
|
68
|
+
layout의 구성에 변화가 발생하면, 다시 render된다.
|
|
69
|
+
이 팝업이 떠 있는 상태에서, 또 다른 팝업이 뜨는 경우도 layout 구성의 변화를 야기한다. (overlay의 갯수의 증가)
|
|
70
|
+
이 경우 value, options, confirmCallback 등 클로져를 사용한 것들이 초기 바인딩된 값으로 다시 바인딩되게 되는데,
|
|
71
|
+
만약, 템플릿 내부에서 이들 속성의 레퍼런스가 변화했다면, 원래 상태로 되돌아가는 현상이 발생하게 된다.
|
|
72
|
+
따라서, 가급적 이들 속성의 레퍼런스를 변화시키지 않는 것이 좋다.
|
|
73
|
+
(이 팝업 클래스를 템플릿으로 사용한 곳의 코드를 참조하세요.)
|
|
74
|
+
=>
|
|
75
|
+
이런 이유로, Object.assign(...)을 사용하였다.
|
|
76
|
+
*/
|
|
77
|
+
|
|
78
|
+
if (!this.value || typeof this.value !== 'object') {
|
|
79
|
+
this.value = {}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
for (let key in this.value) {
|
|
83
|
+
delete this.value[key]
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
Object.assign(this.value, e.detail)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
private onCancel(e: Event) {
|
|
90
|
+
closePopup(this)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
private onConfirm(e: Event) {
|
|
94
|
+
this.confirmCallback && this.confirmCallback(this.value)
|
|
95
|
+
closePopup(this)
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import '@operato/input/ox-input-value-map.js'
|
|
2
|
+
|
|
3
|
+
import { css, html, LitElement } from 'lit'
|
|
4
|
+
import { customElement, property } from 'lit/decorators.js'
|
|
5
|
+
|
|
6
|
+
import { i18next } from '@operato/i18n'
|
|
7
|
+
import { closePopup } from '@operato/popup'
|
|
8
|
+
import { ScrollbarStyles } from '@operato/styles'
|
|
9
|
+
|
|
10
|
+
@customElement('ox-popup-value-map-input')
|
|
11
|
+
export class OxPopupValueMapInput extends LitElement {
|
|
12
|
+
static styles = [
|
|
13
|
+
ScrollbarStyles,
|
|
14
|
+
css`
|
|
15
|
+
:host {
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: column;
|
|
18
|
+
|
|
19
|
+
background-color: #fff;
|
|
20
|
+
|
|
21
|
+
width: var(--overlay-center-normal-width, 50%);
|
|
22
|
+
height: var(--overlay-center-normal-height, 50%);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
ox-input-value-map {
|
|
26
|
+
flex: 1;
|
|
27
|
+
overflow-y: auto;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
span {
|
|
31
|
+
flex: 1;
|
|
32
|
+
|
|
33
|
+
display: flex;
|
|
34
|
+
align-items: center;
|
|
35
|
+
justify-content: center;
|
|
36
|
+
|
|
37
|
+
color: var(--primary-color);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.button-container {
|
|
41
|
+
display: flex;
|
|
42
|
+
margin-left: auto;
|
|
43
|
+
}
|
|
44
|
+
`
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
@property({ type: Object }) value: any
|
|
48
|
+
@property({ type: String }) valuetype: string = 'string'
|
|
49
|
+
@property({ type: Object }) confirmCallback!: (newval: any) => void
|
|
50
|
+
|
|
51
|
+
render() {
|
|
52
|
+
return html`
|
|
53
|
+
<ox-input-value-map
|
|
54
|
+
.value=${this.value}
|
|
55
|
+
keytype="string"
|
|
56
|
+
.valuetype=${this.valuetype}
|
|
57
|
+
@change=${this.onChange.bind(this)}
|
|
58
|
+
>
|
|
59
|
+
</ox-input-value-map>
|
|
60
|
+
|
|
61
|
+
<div class="button-container">
|
|
62
|
+
<mwc-button @click=${this.onCancel.bind(this)}>${i18next.t('button.cancel')}</mwc-button>
|
|
63
|
+
<mwc-button @click=${this.onConfirm.bind(this)}>${i18next.t('button.confirm')}</mwc-button>
|
|
64
|
+
</div>
|
|
65
|
+
`
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
private onChange(e: CustomEvent) {
|
|
69
|
+
e.stopPropagation()
|
|
70
|
+
|
|
71
|
+
/*
|
|
72
|
+
주의 : 이 팝업 템플릿은 layout 모듈에 의해서 render 되므로,
|
|
73
|
+
layout의 구성에 변화가 발생하면, 다시 render된다.
|
|
74
|
+
이 팝업이 떠 있는 상태에서, 또 다른 팝업이 뜨는 경우도 layout 구성의 변화를 야기한다. (overlay의 갯수의 증가)
|
|
75
|
+
이 경우 value, options, confirmCallback 등 클로져를 사용한 것들이 초기 바인딩된 값으로 다시 바인딩되게 되는데,
|
|
76
|
+
만약, 템플릿 내부에서 이들 속성의 레퍼런스가 변화했다면, 원래 상태로 되돌아가는 현상이 발생하게 된다.
|
|
77
|
+
따라서, 가급적 이들 속성의 레퍼런스를 변화시키지 않는 것이 좋다.
|
|
78
|
+
(이 팝업 클래스를 템플릿으로 사용한 곳의 코드를 참조하세요.)
|
|
79
|
+
=>
|
|
80
|
+
이런 이유로, Object.assign(...)을 사용하였다.
|
|
81
|
+
*/
|
|
82
|
+
|
|
83
|
+
if (!this.value) {
|
|
84
|
+
this.value = {}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
for (let key in this.value) {
|
|
88
|
+
delete this.value[key]
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
Object.assign(this.value, e.detail)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
private onCancel(e: Event) {
|
|
95
|
+
closePopup(this)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
private onConfirm(e: Event) {
|
|
99
|
+
this.confirmCallback && this.confirmCallback(this.value)
|
|
100
|
+
closePopup(this)
|
|
101
|
+
}
|
|
102
|
+
}
|