@things-factory/integration-ui 5.0.0-alpha.4 → 5.0.0-alpha.42
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/bootstrap.js +11 -7
- package/client/grist/dynamic-selector.js +2 -3
- package/client/grist/task-type-selector.js +3 -4
- package/client/pages/connection.js +8 -14
- package/client/pages/scenario-detail.js +6 -5
- package/client/pages/scenario.js +7 -14
- package/package.json +14 -14
- package/client/grist/crontab-editor-popup.js +0 -610
- package/client/grist/crontab-editor.js +0 -65
- package/client/grist/json-editor.js +0 -120
- package/client/grist/json-grist-editor.js +0 -108
- package/client/grist/parameters-editor-builder.js +0 -133
- package/client/grist/parameters-editor-popup.js +0 -112
- package/client/grist/parameters-editor.js +0 -117
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import 'codemirror/mode/javascript/javascript'
|
|
6
|
-
import 'codemirror/addon/display/fullscreen'
|
|
7
|
-
import 'codemirror/addon/display/autorefresh'
|
|
8
|
-
|
|
9
|
-
import FullScreenStyle from '!!text-loader!codemirror/addon/display/fullscreen.css'
|
|
10
|
-
import CodeMirrorStyle from '!!text-loader!codemirror/lib/codemirror.css'
|
|
11
|
-
import NightThemeStyle from '!!text-loader!codemirror/theme/night.css'
|
|
12
|
-
import CodeMirror from 'codemirror'
|
|
13
|
-
import { css, html, LitElement, unsafeCSS } from 'lit'
|
|
14
|
-
|
|
15
|
-
import { i18next } from '@operato/i18n'
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
WEB Component for code-mirror json editor.
|
|
19
|
-
*/
|
|
20
|
-
export class JsonEditor extends LitElement {
|
|
21
|
-
static get properties() {
|
|
22
|
-
return {
|
|
23
|
-
/**
|
|
24
|
-
* `value`는 에디터에서 작성중인 contents이다.
|
|
25
|
-
*/
|
|
26
|
-
value: String,
|
|
27
|
-
confirmCallback: Object
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
static get styles() {
|
|
32
|
-
return [
|
|
33
|
-
css`
|
|
34
|
-
${unsafeCSS(CodeMirrorStyle)}
|
|
35
|
-
${unsafeCSS(FullScreenStyle)}
|
|
36
|
-
${unsafeCSS(NightThemeStyle)}
|
|
37
|
-
`,
|
|
38
|
-
css`
|
|
39
|
-
:host {
|
|
40
|
-
display: flex;
|
|
41
|
-
flex-direction: column;
|
|
42
|
-
|
|
43
|
-
background-color: #fff;
|
|
44
|
-
|
|
45
|
-
width: var(--overlay-center-normal-width, 50%);
|
|
46
|
-
height: var(--overlay-center-normal-height, 50%);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.CodeMirror {
|
|
50
|
-
flex: 1;
|
|
51
|
-
resize: none;
|
|
52
|
-
font-size: 16px;
|
|
53
|
-
line-height: 20px;
|
|
54
|
-
border: 0px;
|
|
55
|
-
padding: 0px;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.button-container {
|
|
59
|
-
display: flex;
|
|
60
|
-
margin-left: auto;
|
|
61
|
-
}
|
|
62
|
-
`
|
|
63
|
-
]
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
firstUpdated() {
|
|
67
|
-
this.editor.focus()
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
updated(change) {
|
|
71
|
-
if (change.has('value')) {
|
|
72
|
-
this.editor.setValue(this.value === undefined ? '' : String(this.value))
|
|
73
|
-
this.editor.refresh()
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
render() {
|
|
78
|
-
return html`
|
|
79
|
-
<textarea></textarea>
|
|
80
|
-
|
|
81
|
-
<div class="button-container">
|
|
82
|
-
<mwc-button @click=${this.oncancel.bind(this)}>${i18next.t('button.cancel')}</mwc-button>
|
|
83
|
-
<mwc-button @click=${this.onconfirm.bind(this)}>${i18next.t('button.confirm')}</mwc-button>
|
|
84
|
-
</div>
|
|
85
|
-
`
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
get editor() {
|
|
89
|
-
if (!this._editor) {
|
|
90
|
-
let textarea = this.shadowRoot.querySelector('textarea')
|
|
91
|
-
|
|
92
|
-
if (textarea) {
|
|
93
|
-
this._editor = CodeMirror.fromTextArea(textarea, {
|
|
94
|
-
value: this.value,
|
|
95
|
-
mode: 'javascript',
|
|
96
|
-
tabSize: 2,
|
|
97
|
-
lineNumbers: false,
|
|
98
|
-
showCursorWhenSelecting: true,
|
|
99
|
-
theme: 'night',
|
|
100
|
-
autoRefresh: {
|
|
101
|
-
delay: 500
|
|
102
|
-
}
|
|
103
|
-
})
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
return this._editor
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
oncancel(e) {
|
|
111
|
-
history.back()
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
onconfirm(e) {
|
|
115
|
-
this.confirmCallback && this.confirmCallback(this.editor.getValue())
|
|
116
|
-
history.back()
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
customElements.define('json-editor', JsonEditor)
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import '@material/mwc-icon'
|
|
2
|
-
import './json-editor'
|
|
3
|
-
|
|
4
|
-
import { css, html, LitElement } from 'lit'
|
|
5
|
-
|
|
6
|
-
import { openPopup } from '@operato/layout'
|
|
7
|
-
|
|
8
|
-
export class JsonGristEditor extends LitElement {
|
|
9
|
-
static get properties() {
|
|
10
|
-
return {
|
|
11
|
-
value: Object,
|
|
12
|
-
column: Object,
|
|
13
|
-
record: Object,
|
|
14
|
-
row: Number
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
static get styles() {
|
|
19
|
-
return css`
|
|
20
|
-
:host {
|
|
21
|
-
display: flex;
|
|
22
|
-
flex-flow: row nowrap;
|
|
23
|
-
align-items: center;
|
|
24
|
-
|
|
25
|
-
padding: 7px 0px;
|
|
26
|
-
box-sizing: border-box;
|
|
27
|
-
|
|
28
|
-
width: 100%;
|
|
29
|
-
height: 100%;
|
|
30
|
-
|
|
31
|
-
border: 0;
|
|
32
|
-
background-color: transparent;
|
|
33
|
-
|
|
34
|
-
font: var(--grist-object-editor-font);
|
|
35
|
-
color: var(--grist-object-editor-color);
|
|
36
|
-
|
|
37
|
-
justify-content: inherit;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
span {
|
|
41
|
-
display: flex;
|
|
42
|
-
flex: auto;
|
|
43
|
-
|
|
44
|
-
justify-content: inherit;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
mwc-icon {
|
|
48
|
-
width: 20px;
|
|
49
|
-
font-size: 1.5em;
|
|
50
|
-
margin-left: auto;
|
|
51
|
-
}
|
|
52
|
-
`
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
render() {
|
|
56
|
-
return html` ${this.value} `
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
async firstUpdated() {
|
|
60
|
-
this.value = this.record[this.column.name]
|
|
61
|
-
this.template = ((this.column.record || {}).options || {}).template
|
|
62
|
-
|
|
63
|
-
await this.updateComplete
|
|
64
|
-
|
|
65
|
-
this.shadowRoot.addEventListener('click', e => {
|
|
66
|
-
e.stopPropagation()
|
|
67
|
-
|
|
68
|
-
this.openEditor()
|
|
69
|
-
})
|
|
70
|
-
|
|
71
|
-
this.openEditor()
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
openEditor() {
|
|
75
|
-
if (this.popup) {
|
|
76
|
-
delete this.popup
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
const confirmCallback = value => {
|
|
80
|
-
this.dispatchEvent(
|
|
81
|
-
new CustomEvent('field-change', {
|
|
82
|
-
bubbles: true,
|
|
83
|
-
composed: true,
|
|
84
|
-
detail: {
|
|
85
|
-
before: this.value,
|
|
86
|
-
after: value,
|
|
87
|
-
record: this.record,
|
|
88
|
-
column: this.column,
|
|
89
|
-
row: this.row
|
|
90
|
-
}
|
|
91
|
-
})
|
|
92
|
-
)
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
var value = this.value || ''
|
|
96
|
-
var template =
|
|
97
|
-
this.template ||
|
|
98
|
-
html` <json-editor .value=${value} .confirmCallback=${confirmCallback.bind(this)}></json-editor> `
|
|
99
|
-
|
|
100
|
-
this.popup = openPopup(template, {
|
|
101
|
-
backdrop: true,
|
|
102
|
-
size: 'large',
|
|
103
|
-
title: 'select item'
|
|
104
|
-
})
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
customElements.define('json-grist-editor', JsonGristEditor)
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import '@things-factory/modeller-ui'
|
|
6
|
-
|
|
7
|
-
import { html, LitElement } from 'lit'
|
|
8
|
-
import { connect } from 'pwa-helpers/connect-mixin'
|
|
9
|
-
|
|
10
|
-
import { OxPropertyEditor } from '@operato/property-editor'
|
|
11
|
-
import { store } from '@operato/shell'
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
모든 에디터들은 change 이벤트를 지원해야 한다. 또한, 모든 에디터들은 value속성에 값을 가져야 한다.
|
|
15
|
-
|
|
16
|
-
Example:
|
|
17
|
-
|
|
18
|
-
<parameters-editor-builder value="{{value}}">
|
|
19
|
-
<label>Center X</label>
|
|
20
|
-
<input type="number" .value="${value.cx}">
|
|
21
|
-
<label>Width</label>
|
|
22
|
-
<input type="number" .value="${value.width}">
|
|
23
|
-
</parameters-editor-builder>
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
const DEFAULT_VALUE = {
|
|
27
|
-
legend: '',
|
|
28
|
-
number: 0,
|
|
29
|
-
angle: 0,
|
|
30
|
-
string: '',
|
|
31
|
-
text: '',
|
|
32
|
-
textarea: '',
|
|
33
|
-
checkbox: false,
|
|
34
|
-
select: '',
|
|
35
|
-
color: '#000000',
|
|
36
|
-
'solidcolor-stops': null,
|
|
37
|
-
'gradientcolor-stops': null,
|
|
38
|
-
'gltf-selector': '',
|
|
39
|
-
'image-selector': '',
|
|
40
|
-
multiplecolor: null,
|
|
41
|
-
editortable: null,
|
|
42
|
-
imageselector: '',
|
|
43
|
-
options: null,
|
|
44
|
-
date: null
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
class ParametersEditorBuilder extends connect(store)(LitElement) {
|
|
48
|
-
static get properties() {
|
|
49
|
-
return {
|
|
50
|
-
value: Object,
|
|
51
|
-
props: Array,
|
|
52
|
-
host: Object,
|
|
53
|
-
propertyEditor: Object
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
render() {
|
|
58
|
-
return html`<slot></slot>`
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
firstUpdated() {
|
|
62
|
-
this.addEventListener('change', this._onValueChanged.bind(this))
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
updated(change) {
|
|
66
|
-
change.has('props') && this._onPropsChanged(this.props)
|
|
67
|
-
change.has('value') && this._setValues()
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
_onPropsChanged(props) {
|
|
71
|
-
this.textContent = ''
|
|
72
|
-
;(props || []).forEach(prop => {
|
|
73
|
-
let elementType = OxPropertyEditor.getEditor(prop.type)
|
|
74
|
-
if (!elementType) {
|
|
75
|
-
console.warn('Property Editor not defined', prop.type)
|
|
76
|
-
return
|
|
77
|
-
}
|
|
78
|
-
let element = document.createElement(elementType)
|
|
79
|
-
|
|
80
|
-
element.label = prop.label
|
|
81
|
-
element.type = prop.type
|
|
82
|
-
element.placeholder = prop.placeholder
|
|
83
|
-
element.host = this.host
|
|
84
|
-
element.context = this.context
|
|
85
|
-
element.setAttribute('name', prop.name)
|
|
86
|
-
|
|
87
|
-
if (prop.observe) {
|
|
88
|
-
element.observe = prop.observe
|
|
89
|
-
}
|
|
90
|
-
element.property = prop.property
|
|
91
|
-
element.setAttribute('property-editor', true)
|
|
92
|
-
|
|
93
|
-
this.appendChild(element)
|
|
94
|
-
})
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
_setValues() {
|
|
98
|
-
var value = this.value || {}
|
|
99
|
-
Array.from(this.querySelectorAll('[name]')).forEach(prop => {
|
|
100
|
-
let name = prop.getAttribute('name')
|
|
101
|
-
prop.value = value[name] === undefined ? DEFAULT_VALUE[prop.type] : value[name]
|
|
102
|
-
})
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
_getValues() {
|
|
106
|
-
var value = {}
|
|
107
|
-
Array.from(this.querySelectorAll('[name]')).forEach(prop => {
|
|
108
|
-
let name = prop.getAttribute('name')
|
|
109
|
-
value[name] = prop.value === undefined ? DEFAULT_VALUE[prop.type] : prop.value
|
|
110
|
-
})
|
|
111
|
-
|
|
112
|
-
return value
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
_onValueChanged(e) {
|
|
116
|
-
e.stopPropagation()
|
|
117
|
-
var prop = e.target
|
|
118
|
-
|
|
119
|
-
if (!prop || !prop.hasAttribute('property-editor')) {
|
|
120
|
-
return
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
this.dispatchEvent(
|
|
124
|
-
new CustomEvent('property-change', {
|
|
125
|
-
bubbles: true,
|
|
126
|
-
composed: true,
|
|
127
|
-
detail: this._getValues()
|
|
128
|
-
})
|
|
129
|
-
)
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
customElements.define('parameters-editor-builder', ParametersEditorBuilder)
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { css, html, LitElement } from 'lit'
|
|
2
|
-
|
|
3
|
-
import { i18next } from '@operato/i18n'
|
|
4
|
-
import { ScrollbarStyles } from '@operato/styles'
|
|
5
|
-
|
|
6
|
-
export class ParametersEditorPopup extends LitElement {
|
|
7
|
-
static get properties() {
|
|
8
|
-
return {
|
|
9
|
-
value: Object,
|
|
10
|
-
props: Object,
|
|
11
|
-
host: Object,
|
|
12
|
-
context: Object,
|
|
13
|
-
confirmCallback: Object
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
static get styles() {
|
|
18
|
-
return [
|
|
19
|
-
ScrollbarStyles,
|
|
20
|
-
css`
|
|
21
|
-
:host {
|
|
22
|
-
display: flex;
|
|
23
|
-
flex-direction: column;
|
|
24
|
-
|
|
25
|
-
background-color: #fff;
|
|
26
|
-
|
|
27
|
-
width: var(--overlay-center-normal-width, 50%);
|
|
28
|
-
height: var(--overlay-center-normal-height, 50%);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
parameters-editor-builder {
|
|
32
|
-
flex: 1;
|
|
33
|
-
overflow-y: auto;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
span {
|
|
37
|
-
flex: 1;
|
|
38
|
-
|
|
39
|
-
display: flex;
|
|
40
|
-
align-items: center;
|
|
41
|
-
justify-content: center;
|
|
42
|
-
|
|
43
|
-
color: var(--primary-color);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.button-container {
|
|
47
|
-
display: flex;
|
|
48
|
-
margin-left: auto;
|
|
49
|
-
}
|
|
50
|
-
`
|
|
51
|
-
]
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
render() {
|
|
55
|
-
var props = this.props instanceof Array ? this.props : []
|
|
56
|
-
|
|
57
|
-
return html`
|
|
58
|
-
${props.length > 0
|
|
59
|
-
? html`
|
|
60
|
-
<parameters-editor-builder
|
|
61
|
-
.value=${this.value}
|
|
62
|
-
.props=${props}
|
|
63
|
-
.host=${this.host}
|
|
64
|
-
.context=${this.context}
|
|
65
|
-
@property-change=${this.onchange.bind(this)}
|
|
66
|
-
>
|
|
67
|
-
</parameters-editor-builder>
|
|
68
|
-
`
|
|
69
|
-
: html` <span><i18n-msg msgid="text.no properties to set"></i18n-msg></span> `}
|
|
70
|
-
|
|
71
|
-
<div class="button-container">
|
|
72
|
-
<mwc-button @click=${this.oncancel.bind(this)}>${i18next.t('button.cancel')}</mwc-button>
|
|
73
|
-
<mwc-button @click=${this.onconfirm.bind(this)}>${i18next.t('button.confirm')}</mwc-button>
|
|
74
|
-
</div>
|
|
75
|
-
`
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
onchange(e) {
|
|
79
|
-
e.stopPropagation()
|
|
80
|
-
|
|
81
|
-
/*
|
|
82
|
-
주의 : 이 팝업 템플릿은 layout 모듈에 의해서 render 되므로,
|
|
83
|
-
layout의 구성에 변화가 발생하면, 다시 render된다.
|
|
84
|
-
이 팝업이 떠 있는 상태에서, 또 다른 팝업이 뜨는 경우도 layout 구성의 변화를 야기한다. (overlay의 갯수의 증가)
|
|
85
|
-
이 경우 value, options, confirmCallback 등 클로져를 사용한 것들이 초기 바인딩된 값으로 다시 바인딩되게 되는데,
|
|
86
|
-
만약, 템플릿 내부에서 이들 속성의 레퍼런스가 변화했다면, 원래 상태로 되돌아가는 현상이 발생하게 된다.
|
|
87
|
-
따라서, 가급적 이들 속성의 레퍼런스를 변화시키지 않는 것이 좋다.
|
|
88
|
-
(이 팝업 클래스를 템플릿으로 사용한 곳의 코드를 참조하세요.)
|
|
89
|
-
=>
|
|
90
|
-
이런 이유로, Object.assign(...)을 사용하였다.
|
|
91
|
-
*/
|
|
92
|
-
if (!this.value) {
|
|
93
|
-
this.value = {}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
for (let key in this.value) {
|
|
97
|
-
delete this.value[key]
|
|
98
|
-
}
|
|
99
|
-
Object.assign(this.value, e.detail)
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
oncancel(e) {
|
|
103
|
-
history.back()
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
onconfirm(e) {
|
|
107
|
-
this.confirmCallback && this.confirmCallback(this.value)
|
|
108
|
-
history.back()
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
customElements.define('parameters-editor-popup', ParametersEditorPopup)
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import './parameters-editor-builder'
|
|
6
|
-
import './parameters-editor-popup'
|
|
7
|
-
|
|
8
|
-
import { css, html, LitElement } from 'lit'
|
|
9
|
-
|
|
10
|
-
import { i18next } from '@operato/i18n'
|
|
11
|
-
import { openPopup } from '@operato/layout'
|
|
12
|
-
|
|
13
|
-
export class ParametersEditor extends LitElement {
|
|
14
|
-
static get properties() {
|
|
15
|
-
return {
|
|
16
|
-
value: Object,
|
|
17
|
-
column: Object,
|
|
18
|
-
record: Object,
|
|
19
|
-
row: Number,
|
|
20
|
-
field: Object
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
static get styles() {
|
|
25
|
-
return [
|
|
26
|
-
css`
|
|
27
|
-
:host {
|
|
28
|
-
color: black;
|
|
29
|
-
|
|
30
|
-
overflow: hidden;
|
|
31
|
-
text-overflow: ellipsis;
|
|
32
|
-
}
|
|
33
|
-
`
|
|
34
|
-
]
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
render() {
|
|
38
|
-
const value = typeof this.value === 'object' ? JSON.stringify(this.value) : this.value
|
|
39
|
-
return html` ${value || ''} `
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
async firstUpdated() {
|
|
43
|
-
await this.updateComplete
|
|
44
|
-
|
|
45
|
-
this.shadowRoot.addEventListener('click', e => {
|
|
46
|
-
e.stopPropagation()
|
|
47
|
-
|
|
48
|
-
this.openSelector()
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
this.openSelector()
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
async openSelector() {
|
|
55
|
-
if (this.popup) {
|
|
56
|
-
delete this.popup
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
var { options } = this.column.record
|
|
60
|
-
|
|
61
|
-
if (typeof options === 'function') {
|
|
62
|
-
options = await options.call(this, this.value, this.column, this.record, this.row, this.field)
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const { name, help, spec, context, objectified = false } = options
|
|
66
|
-
|
|
67
|
-
const confirmCallback = newval => {
|
|
68
|
-
this.dispatchEvent(
|
|
69
|
-
new CustomEvent('field-change', {
|
|
70
|
-
bubbles: true,
|
|
71
|
-
composed: true,
|
|
72
|
-
detail: {
|
|
73
|
-
before: this.value,
|
|
74
|
-
after: !objectified ? JSON.stringify(newval) : newval,
|
|
75
|
-
record: this.record,
|
|
76
|
-
column: this.column,
|
|
77
|
-
row: this.row
|
|
78
|
-
}
|
|
79
|
-
})
|
|
80
|
-
)
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
try {
|
|
84
|
-
var value = !objectified && typeof this.value === 'string' ? JSON.parse(this.value) : this.value
|
|
85
|
-
} catch (e) {
|
|
86
|
-
var value = {}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/*
|
|
90
|
-
주의 : 이 팝업 템플릿은 layout 모듈에 의해서 render 되므로,
|
|
91
|
-
layout의 구성에 변화가 발생하면, 다시 render된다.
|
|
92
|
-
이 팝업이 떠 있는 상태에서, 또 다른 팝업이 뜨는 경우도 layout 구성의 변화를 야기한다. (overlay의 갯수의 증가)
|
|
93
|
-
이 경우 value, options, confirmCallback 등 클로져를 사용한 것들이 초기 바인딩된 값으로 다시 바인딩되게 되는데,
|
|
94
|
-
만약, 템플릿 내부에서 이들 속성의 레퍼런스가 변화했다면, 원래 상태로 되돌아가는 현상이 발생하게 된다.
|
|
95
|
-
따라서, 가급적 이들 속성의 레퍼런스를 변화시키지 않는 것이 좋다.
|
|
96
|
-
*/
|
|
97
|
-
var template = html`
|
|
98
|
-
<parameters-editor-popup
|
|
99
|
-
.value=${value}
|
|
100
|
-
.props=${spec}
|
|
101
|
-
.host=${this.record}
|
|
102
|
-
.context=${context}
|
|
103
|
-
.confirmCallback=${confirmCallback}
|
|
104
|
-
>
|
|
105
|
-
</parameters-editor-popup>
|
|
106
|
-
`
|
|
107
|
-
|
|
108
|
-
this.popup = openPopup(template, {
|
|
109
|
-
backdrop: true,
|
|
110
|
-
size: 'large',
|
|
111
|
-
title: `${name?.toUpperCase() || ''} ${i18next.t('field.params')}`,
|
|
112
|
-
help
|
|
113
|
-
})
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
window.customElements.define('parameters-editor', ParametersEditor)
|