@things-factory/meta-ui 7.0.1-alpha.24 → 7.0.1-alpha.29
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/actions/main.js +4 -3
- package/client/bootstrap.ts +10 -8
- package/client/component/popup/code-input-editor-popup.js +36 -45
- package/client/component/popup/file-upload-popup.js +8 -22
- package/client/component/popup/meta-object-selector-popup.js +110 -130
- package/client/component/popup/record-based-code-editor-popup.js +36 -45
- package/client/pages/activity/meta-activity-define-page.js +26 -25
- package/client/pages/entity/config-entity.js +14 -12
- package/client/pages/entity/main-menu-selector.js +7 -22
- package/client/pages/menu/dynamic-menu-template.js +1 -4
- package/client/pages/menu/dynamic-menu.js +8 -6
- package/client/pages/menu/export-menu-popup.js +5 -11
- package/client/pages/personalize/personal-column-selector.js +11 -17
- package/client/pages/terms/config-terminology.js +27 -25
- package/client/utils/meta-ui-util.js +50 -109
- package/client/viewparts/dynamic-menu-part.js +0 -1
- package/dist-client/actions/main.js +3 -3
- package/dist-client/actions/main.js.map +1 -1
- package/dist-client/bootstrap.d.ts +1 -0
- package/dist-client/bootstrap.js +9 -8
- package/dist-client/bootstrap.js.map +1 -1
- package/dist-client/component/popup/code-input-editor-popup.js +9 -17
- package/dist-client/component/popup/code-input-editor-popup.js.map +1 -1
- package/dist-client/component/popup/file-upload-popup.js +6 -21
- package/dist-client/component/popup/file-upload-popup.js.map +1 -1
- package/dist-client/component/popup/meta-object-selector-popup.js +24 -34
- package/dist-client/component/popup/meta-object-selector-popup.js.map +1 -1
- package/dist-client/component/popup/record-based-code-editor-popup.js +16 -25
- package/dist-client/component/popup/record-based-code-editor-popup.js.map +1 -1
- package/dist-client/pages/activity/meta-activity-define-page.js +11 -8
- package/dist-client/pages/activity/meta-activity-define-page.js.map +1 -1
- package/dist-client/pages/entity/config-entity.js +13 -12
- package/dist-client/pages/entity/config-entity.js.map +1 -1
- package/dist-client/pages/entity/main-menu-selector.js +6 -22
- package/dist-client/pages/entity/main-menu-selector.js.map +1 -1
- package/dist-client/pages/menu/dynamic-menu-template.js +1 -4
- package/dist-client/pages/menu/dynamic-menu-template.js.map +1 -1
- package/dist-client/pages/menu/dynamic-menu.js +7 -6
- package/dist-client/pages/menu/dynamic-menu.js.map +1 -1
- package/dist-client/pages/menu/export-menu-popup.js +4 -11
- package/dist-client/pages/menu/export-menu-popup.js.map +1 -1
- package/dist-client/pages/personalize/personal-column-selector.js +10 -17
- package/dist-client/pages/personalize/personal-column-selector.js.map +1 -1
- package/dist-client/pages/terms/config-terminology.js +13 -11
- package/dist-client/pages/terms/config-terminology.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-client/utils/meta-ui-util.js +47 -106
- package/dist-client/utils/meta-ui-util.js.map +1 -1
- package/dist-client/viewparts/dynamic-menu-part.js +0 -1
- package/dist-client/viewparts/dynamic-menu-part.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +10 -9
- package/translations/en.json +2 -12
- package/translations/ko.json +2 -12
- package/translations/ms.json +2 -12
- package/translations/zh.json +2 -12
- package/dist-server/constants/error-code.js +0 -6
- package/dist-server/constants/error-code.js.map +0 -1
- package/server/constants/error-code.ts +0 -2
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import '@material/web/icon/icon.js'
|
|
2
|
+
|
|
1
3
|
import { css, html, LitElement } from 'lit'
|
|
2
4
|
import { CommonGristStyles, ButtonContainerStyles } from '@operato/styles'
|
|
3
|
-
import { TermsUtil } from '../../utils/terms-util'
|
|
5
|
+
import { TermsUtil } from '../../utils/terms-util'
|
|
4
6
|
import { ValueUtil } from '../../utils/value-util'
|
|
5
7
|
import { ServiceUtil } from '../../utils/service-util'
|
|
6
8
|
import { MetaApi } from '../../utils/meta-api'
|
|
@@ -8,7 +10,6 @@ import { MetaUiUtil } from '../../utils/meta-ui-util'
|
|
|
8
10
|
import { isMobileDevice } from '@operato/utils'
|
|
9
11
|
import { closePopup } from '@operato/popup'
|
|
10
12
|
|
|
11
|
-
|
|
12
13
|
export class MetaObjectSelectorPopup extends LitElement {
|
|
13
14
|
static styles = [
|
|
14
15
|
CommonGristStyles,
|
|
@@ -27,25 +28,17 @@ export class MetaObjectSelectorPopup extends LitElement {
|
|
|
27
28
|
ox-grist {
|
|
28
29
|
flex: 1;
|
|
29
30
|
}
|
|
30
|
-
|
|
31
|
-
.button-container {
|
|
32
|
-
display: flex;
|
|
33
|
-
margin-left: auto;
|
|
34
|
-
}
|
|
35
31
|
`
|
|
36
32
|
]
|
|
37
33
|
|
|
38
34
|
async connectedCallback() {
|
|
39
|
-
|
|
40
35
|
// 숨김 검색 조건
|
|
41
|
-
this.search_hidden_fields = this.options.filters
|
|
42
|
-
? this.options.filters
|
|
43
|
-
: (this.basicArgs && this.basicArgs.filters ? this.basicArgs.filters : []);
|
|
36
|
+
this.search_hidden_fields = this.options.filters ? this.options.filters : this.basicArgs && this.basicArgs.filters ? this.basicArgs.filters : []
|
|
44
37
|
|
|
45
38
|
this.search_hidden_fields = this.search_hidden_fields.map(x => {
|
|
46
|
-
let {name, operator, value} = x
|
|
39
|
+
let { name, operator, value } = x
|
|
47
40
|
|
|
48
|
-
if(value.startsWith('::')) {
|
|
41
|
+
if (value.startsWith('::')) {
|
|
49
42
|
value = ValueUtil.getParams(this.record, ...value.substring(2).split('.'))
|
|
50
43
|
}
|
|
51
44
|
|
|
@@ -56,29 +49,27 @@ export class MetaObjectSelectorPopup extends LitElement {
|
|
|
56
49
|
}
|
|
57
50
|
})
|
|
58
51
|
|
|
52
|
+
// 기본 정렬
|
|
53
|
+
let sortFields = this.options.sorters ? this.options.sorters : this.basicArgs && this.basicArgs.sorters ? this.basicArgs.sorters : []
|
|
59
54
|
|
|
60
|
-
// 기본
|
|
61
|
-
let sortFields = this.options.sorters
|
|
62
|
-
? this.options.sorters
|
|
63
|
-
: (this.basicArgs && this.basicArgs.sorters ? this.basicArgs.sorters : []);
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
// 기본 검색 조건
|
|
55
|
+
// 기본 검색 조건
|
|
67
56
|
let filterFields = this.options.filterFields
|
|
68
|
-
|
|
69
|
-
|
|
57
|
+
? this.options.filterFields
|
|
58
|
+
: this.options.menu_template?.search && this.options.menu_template?.search.length > 0
|
|
59
|
+
? this.options.menu_template.search
|
|
60
|
+
: []
|
|
70
61
|
|
|
71
|
-
// 그리드 컬럼
|
|
72
|
-
let gridColumns = this.options.select
|
|
62
|
+
// 그리드 컬럼
|
|
63
|
+
let gridColumns = this.options.select
|
|
73
64
|
|
|
74
65
|
// 기본 검색 조건이 없으면 코드 (code-selector), 또는 이름 (object-selector)
|
|
75
|
-
if(!filterFields || filterFields.length == 0){
|
|
76
|
-
let defaultFilter = undefined
|
|
77
|
-
|
|
78
|
-
if(this.options.codeField) defaultFilter = this.options.codeField
|
|
79
|
-
if(this.options.nameField) defaultFilter = this.options.nameField
|
|
66
|
+
if (!filterFields || filterFields.length == 0) {
|
|
67
|
+
let defaultFilter = undefined
|
|
68
|
+
|
|
69
|
+
if (this.options.codeField) defaultFilter = this.options.codeField
|
|
70
|
+
if (this.options.nameField) defaultFilter = this.options.nameField
|
|
80
71
|
|
|
81
|
-
if(defaultFilter){
|
|
72
|
+
if (defaultFilter) {
|
|
82
73
|
filterFields.push({
|
|
83
74
|
name: defaultFilter,
|
|
84
75
|
operator: 'eq'
|
|
@@ -86,97 +77,96 @@ export class MetaObjectSelectorPopup extends LitElement {
|
|
|
86
77
|
}
|
|
87
78
|
}
|
|
88
79
|
|
|
89
|
-
let selectFields = [...MetaApi.getGristGuttersConfig(true, false)]
|
|
80
|
+
let selectFields = [...MetaApi.getGristGuttersConfig(true, false)]
|
|
90
81
|
|
|
91
|
-
if(gridColumns && gridColumns.length > 0){
|
|
92
|
-
for(let idx = 0
|
|
82
|
+
if (gridColumns && gridColumns.length > 0) {
|
|
83
|
+
for (let idx = 0; idx < gridColumns.length; idx++) {
|
|
93
84
|
let {
|
|
94
85
|
type = 'string',
|
|
95
86
|
name,
|
|
96
87
|
hidden = false,
|
|
97
|
-
record = { align: 'left'},
|
|
88
|
+
record = { align: 'left' },
|
|
98
89
|
header = undefined,
|
|
99
|
-
sortable= false,
|
|
100
|
-
width= 135,
|
|
90
|
+
sortable = false,
|
|
91
|
+
width = 135,
|
|
101
92
|
options = undefined,
|
|
102
93
|
select_opt = undefined,
|
|
103
94
|
object_opt = undefined
|
|
104
|
-
} = gridColumns[idx]
|
|
95
|
+
} = gridColumns[idx]
|
|
105
96
|
|
|
106
|
-
if(select_opt) options = select_opt
|
|
107
|
-
if(object_opt) options = object_opt
|
|
97
|
+
if (select_opt) options = select_opt
|
|
98
|
+
if (object_opt) options = object_opt
|
|
108
99
|
|
|
109
|
-
if(['resource-object','object'].includes(type)){
|
|
110
|
-
type = 'meta-object-selector'
|
|
111
|
-
} else if (['resource-code-selector'].includes(type)){
|
|
112
|
-
type = 'meta-code-selector'
|
|
100
|
+
if (['resource-object', 'object'].includes(type)) {
|
|
101
|
+
type = 'meta-object-selector'
|
|
102
|
+
} else if (['resource-code-selector'].includes(type)) {
|
|
103
|
+
type = 'meta-code-selector'
|
|
113
104
|
}
|
|
114
105
|
|
|
115
|
-
if(name == 'id'){
|
|
106
|
+
if (name == 'id') {
|
|
116
107
|
selectFields.push({
|
|
117
108
|
type: 'string',
|
|
118
109
|
name: name,
|
|
119
110
|
hidden: true
|
|
120
111
|
})
|
|
121
112
|
} else {
|
|
122
|
-
if(type == 'boolean-all'){
|
|
123
|
-
type = 'boolean'
|
|
113
|
+
if (type == 'boolean-all') {
|
|
114
|
+
type = 'boolean'
|
|
124
115
|
}
|
|
125
116
|
|
|
126
|
-
let columnConfig =
|
|
117
|
+
let columnConfig = MetaApi.getGristColumnConfig2(type, name, header ? header : name, record.align ? record.align : 'left', false, sortable, width)
|
|
127
118
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
options = await MetaUiUtil.getGristMetaObjectOptions(type, options);
|
|
119
|
+
if (type.startsWith('meta-') && object_opt && object_opt.menu) {
|
|
120
|
+
options = await MetaUiUtil.getGristMetaObjectOptions(type, options)
|
|
131
121
|
}
|
|
132
122
|
|
|
133
|
-
if (type === 'select'){
|
|
123
|
+
if (type === 'select') {
|
|
134
124
|
if (Array.isArray(options)) {
|
|
135
|
-
columnConfig.record.options = options
|
|
125
|
+
columnConfig.record.options = options
|
|
136
126
|
} else {
|
|
137
|
-
if (options.type === 'code') {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
127
|
+
if (options.type === 'code') {
|
|
128
|
+
// 공통 코드
|
|
129
|
+
columnConfig.record.options = await ServiceUtil.getCodeSelectorData(options.values ? options.values : options.name)
|
|
130
|
+
} else if (options.type === 'scenario') {
|
|
131
|
+
// 시나리오
|
|
132
|
+
columnConfig.record.options = await ServiceUtil.getCodeByScenario(options.name, options.args)
|
|
133
|
+
} else if (options.type === 'entity') {
|
|
134
|
+
// 엔티티
|
|
142
135
|
columnConfig.record.options = await ServiceUtil.getCodeByEntity(options.args)
|
|
143
136
|
}
|
|
144
137
|
}
|
|
145
138
|
} else if (type === 'meta-object-selector') {
|
|
146
139
|
// object-option
|
|
147
|
-
columnConfig.record.options = {...options}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
options.codes = await ServiceUtil.getCodeByEntity(options);
|
|
140
|
+
columnConfig.record.options = { ...options }
|
|
141
|
+
} else if (type == 'meta-code-selector') {
|
|
142
|
+
if (options.dispField) {
|
|
143
|
+
options.codes = await ServiceUtil.getCodeByEntity(options)
|
|
152
144
|
}
|
|
153
145
|
|
|
154
|
-
columnConfig.record.options = {...options}
|
|
146
|
+
columnConfig.record.options = { ...options }
|
|
155
147
|
}
|
|
156
148
|
|
|
149
|
+
columnConfig.hidden = hidden
|
|
157
150
|
|
|
158
|
-
columnConfig
|
|
159
|
-
|
|
160
|
-
selectFields.push(columnConfig);
|
|
151
|
+
selectFields.push(columnConfig)
|
|
161
152
|
}
|
|
162
153
|
}
|
|
163
154
|
} else {
|
|
164
|
-
selectFields.push(MetaApi.getGristColumnConfig2('string', this.options.codeField, this.options.codeField, 'left', false, true, 180))
|
|
155
|
+
selectFields.push(MetaApi.getGristColumnConfig2('string', this.options.codeField, this.options.codeField, 'left', false, true, 180))
|
|
165
156
|
|
|
166
|
-
if(this.options.dispField){
|
|
167
|
-
selectFields.push(MetaApi.getGristColumnConfig2('string', this.options.dispField, this.options.dispField, 'left', false, true, 300))
|
|
157
|
+
if (this.options.dispField) {
|
|
158
|
+
selectFields.push(MetaApi.getGristColumnConfig2('string', this.options.dispField, this.options.dispField, 'left', false, true, 300))
|
|
168
159
|
}
|
|
169
160
|
}
|
|
170
161
|
|
|
171
|
-
selectFields.forEach(x=>{
|
|
172
|
-
let filters = filterFields.filter(y => typeof y === 'string' ? x.name == y : x.name == y.name)
|
|
162
|
+
selectFields.forEach(x => {
|
|
163
|
+
let filters = filterFields.filter(y => (typeof y === 'string' ? x.name == y : x.name == y.name))
|
|
173
164
|
|
|
174
|
-
if(filters && filters.length > 0
|
|
175
|
-
x.filter = typeof filters[0] === 'string' ? 'search' : filters[0]
|
|
165
|
+
if (filters && filters.length > 0) {
|
|
166
|
+
x.filter = typeof filters[0] === 'string' ? 'search' : filters[0]
|
|
176
167
|
}
|
|
177
168
|
})
|
|
178
169
|
|
|
179
|
-
|
|
180
170
|
let gridConfig = {
|
|
181
171
|
rows: MetaApi.getGristSelectableConfig(false),
|
|
182
172
|
pagination: MetaApi.getGristPagination100Config(),
|
|
@@ -184,28 +174,27 @@ export class MetaObjectSelectorPopup extends LitElement {
|
|
|
184
174
|
sorters: [...sortFields]
|
|
185
175
|
}
|
|
186
176
|
|
|
187
|
-
gridConfig.rows.handlers = {
|
|
177
|
+
gridConfig.rows.handlers = {
|
|
188
178
|
click: 'select-row-toggle',
|
|
189
|
-
dblclick: (
|
|
179
|
+
dblclick: (columns, data, column, record, rowIndex, field) => {
|
|
190
180
|
this.selectRecord(record)
|
|
191
|
-
}
|
|
192
|
-
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
193
183
|
|
|
194
|
-
gridConfig.rows.appendable = false
|
|
184
|
+
gridConfig.rows.appendable = false
|
|
195
185
|
|
|
196
|
-
this.gridConfig = gridConfig
|
|
186
|
+
this.gridConfig = gridConfig
|
|
197
187
|
|
|
198
|
-
await super.connectedCallback()
|
|
188
|
+
await super.connectedCallback()
|
|
199
189
|
}
|
|
200
190
|
|
|
201
|
-
async firstUpdated(){
|
|
202
|
-
await super.firstUpdated()
|
|
191
|
+
async firstUpdated() {
|
|
192
|
+
await super.firstUpdated()
|
|
203
193
|
}
|
|
204
194
|
|
|
205
|
-
render(){
|
|
195
|
+
render() {
|
|
206
196
|
return html`
|
|
207
|
-
<ox-grist id="ox-grist" .config=${this.gridConfig} .mode=${isMobileDevice() ? 'LIST' : 'GRID'} auto-fetch
|
|
208
|
-
.fetchHandler=${this.fetchHandler.bind(this)}>
|
|
197
|
+
<ox-grist id="ox-grist" .config=${this.gridConfig} .mode=${isMobileDevice() ? 'LIST' : 'GRID'} auto-fetch .fetchHandler=${this.fetchHandler.bind(this)}>
|
|
209
198
|
<div slot="headroom">
|
|
210
199
|
<div id="filters">
|
|
211
200
|
<ox-filters-form></ox-filters-form>
|
|
@@ -213,102 +202,93 @@ export class MetaObjectSelectorPopup extends LitElement {
|
|
|
213
202
|
</div>
|
|
214
203
|
</ox-grist>
|
|
215
204
|
<div id="button-container" class="button-container">
|
|
216
|
-
<
|
|
217
|
-
|
|
218
|
-
</
|
|
219
|
-
<mwc-button raised label="${TermsUtil.tButton('cancel')}" style="margin-left:7px;margin-top:7px;"
|
|
220
|
-
@click=${this.clickCancel.bind(this)}>
|
|
221
|
-
</mwc-button>
|
|
222
|
-
<mwc-button raised label="${TermsUtil.tButton('select')}" style="margin-left:7px;margin-top:7px;"
|
|
223
|
-
@click=${this.clickSelect.bind(this)}>
|
|
224
|
-
</mwc-button>
|
|
205
|
+
<button @click=${this.clickEmpty.bind(this)}><md-icon>clear_box_outline_blank</md-icon>${TermsUtil.tButton('empty')}</button>
|
|
206
|
+
<button @click=${this.clickCancel.bind(this)}><md-icon>cancel</md-icon>${TermsUtil.tButton('cancel')}</button>
|
|
207
|
+
<button @click=${this.clickSelect.bind(this)}><md-icon>done</md-icon>${TermsUtil.tButton('select')}</button>
|
|
225
208
|
</div>
|
|
226
209
|
`
|
|
227
210
|
}
|
|
228
211
|
|
|
229
|
-
|
|
230
212
|
/**
|
|
231
213
|
* @description 그리드 리턴
|
|
232
214
|
**************************
|
|
233
215
|
* @returns {Object} 그리드
|
|
234
216
|
*/
|
|
235
|
-
|
|
217
|
+
get grist() {
|
|
236
218
|
return this.shadowRoot.querySelector('#ox-grist')
|
|
237
219
|
}
|
|
238
220
|
|
|
239
221
|
/**
|
|
240
|
-
* @description 컬럼 조회
|
|
222
|
+
* @description 컬럼 조회
|
|
241
223
|
***************************
|
|
242
|
-
* @returns
|
|
224
|
+
* @returns
|
|
243
225
|
*/
|
|
244
|
-
async fetchHandler({ page= 0, limit= 0, sorters= [], filters= [] }) {
|
|
226
|
+
async fetchHandler({ page = 0, limit = 0, sorters = [], filters = [] }) {
|
|
227
|
+
let resFilter = [...this.search_hidden_fields]
|
|
245
228
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
if(dupFilter && dupFilter.length > 0){
|
|
251
|
-
delete resFilter[x.name];
|
|
229
|
+
filters.forEach(x => {
|
|
230
|
+
let dupFilter = resFilter.filter(y => x.name == y.name)
|
|
231
|
+
if (dupFilter && dupFilter.length > 0) {
|
|
232
|
+
delete resFilter[x.name]
|
|
252
233
|
}
|
|
253
234
|
|
|
254
|
-
resFilter.push(x)
|
|
235
|
+
resFilter.push(x)
|
|
255
236
|
})
|
|
256
237
|
|
|
257
|
-
|
|
258
|
-
let queryAfterSetFields = ValueUtil.getParams((this.options.menu_template ? this.options.menu_template.gql||{} : {}), 'query', 'after_set_fields');
|
|
238
|
+
let queryAfterSetFields = ValueUtil.getParams(this.options.menu_template ? this.options.menu_template.gql || {} : {}, 'query', 'after_set_fields')
|
|
259
239
|
let selectSkipFields = Object.keys(queryAfterSetFields || {})
|
|
260
240
|
|
|
261
241
|
// 조회 컬럼 추출 후 조회
|
|
262
242
|
let selectFields = MetaApi.getSelectColumns(this.gridConfig.columns.filter(x => !selectSkipFields.includes(x.name)))
|
|
263
243
|
|
|
264
|
-
// 조회 실행
|
|
244
|
+
// 조회 실행
|
|
265
245
|
let result = await MetaApi.searchByPagination(this.options.queryName, resFilter, sorters, page, limit, selectFields)
|
|
266
246
|
|
|
267
|
-
return result
|
|
268
|
-
}
|
|
247
|
+
return result
|
|
248
|
+
}
|
|
269
249
|
|
|
270
250
|
/**
|
|
271
251
|
* @description 비우기
|
|
272
252
|
***************************
|
|
273
|
-
* @returns
|
|
253
|
+
* @returns
|
|
274
254
|
*/
|
|
275
|
-
async clickEmpty(e){
|
|
255
|
+
async clickEmpty(e) {
|
|
276
256
|
this.confirmCallback && this.confirmCallback(null)
|
|
277
257
|
closePopup(this)
|
|
278
258
|
}
|
|
279
259
|
/**
|
|
280
|
-
* @description 취소
|
|
260
|
+
* @description 취소
|
|
281
261
|
***************************
|
|
282
|
-
* @returns
|
|
262
|
+
* @returns
|
|
283
263
|
*/
|
|
284
|
-
async clickCancel(e){
|
|
264
|
+
async clickCancel(e) {
|
|
285
265
|
closePopup(this)
|
|
286
266
|
}
|
|
287
267
|
/**
|
|
288
|
-
* @description 선택
|
|
268
|
+
* @description 선택
|
|
289
269
|
***************************
|
|
290
|
-
* @returns
|
|
270
|
+
* @returns
|
|
291
271
|
*/
|
|
292
|
-
async clickSelect(e){
|
|
293
|
-
let selected = this.grist.selected
|
|
272
|
+
async clickSelect(e) {
|
|
273
|
+
let selected = this.grist.selected
|
|
294
274
|
|
|
295
|
-
if(!selected || selected.length == 0){
|
|
296
|
-
MetaApi.showToast('info', TermsUtil.tText('NOTHING_SELECTED'))
|
|
297
|
-
return
|
|
275
|
+
if (!selected || selected.length == 0) {
|
|
276
|
+
MetaApi.showToast('info', TermsUtil.tText('NOTHING_SELECTED'))
|
|
277
|
+
return
|
|
298
278
|
}
|
|
299
279
|
|
|
300
|
-
this.selectRecord(selected[0])
|
|
280
|
+
this.selectRecord(selected[0])
|
|
301
281
|
}
|
|
302
282
|
|
|
303
283
|
/**
|
|
304
|
-
* @description 확정
|
|
284
|
+
* @description 확정
|
|
305
285
|
***************************
|
|
306
|
-
* @param {*} record
|
|
286
|
+
* @param {*} record
|
|
307
287
|
*/
|
|
308
|
-
async selectRecord(record){
|
|
288
|
+
async selectRecord(record) {
|
|
309
289
|
this.confirmCallback && this.confirmCallback(record)
|
|
310
290
|
closePopup(this)
|
|
311
291
|
}
|
|
312
292
|
}
|
|
313
|
-
|
|
314
|
-
customElements.define('meta-object-selector-popup', MetaObjectSelectorPopup)
|
|
293
|
+
|
|
294
|
+
customElements.define('meta-object-selector-popup', MetaObjectSelectorPopup)
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import '@material/web/icon/icon.js'
|
|
2
|
+
|
|
1
3
|
import { css, html, LitElement } from 'lit'
|
|
2
4
|
import { CommonGristStyles, ButtonContainerStyles } from '@operato/styles'
|
|
3
|
-
import { TermsUtil } from '../../utils/terms-util'
|
|
4
|
-
import { MetaApi } from
|
|
5
|
-
import { ServiceUtil } from
|
|
5
|
+
import { TermsUtil } from '../../utils/terms-util'
|
|
6
|
+
import { MetaApi } from '../../utils/meta-api'
|
|
7
|
+
import { ServiceUtil } from '../../utils/service-util'
|
|
6
8
|
import '@operato/input/ox-input-code.js'
|
|
7
9
|
import { closePopup } from '@operato/popup'
|
|
8
10
|
|
|
@@ -25,15 +27,10 @@ export class RecordBasedCodeEditorPopup extends LitElement {
|
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
ox-input-code {
|
|
28
|
-
margin:10px;
|
|
30
|
+
margin: 10px;
|
|
29
31
|
overflow-y: auto;
|
|
30
32
|
flex: 1;
|
|
31
33
|
}
|
|
32
|
-
|
|
33
|
-
.button-container {
|
|
34
|
-
display: flex;
|
|
35
|
-
margin-left: auto;
|
|
36
|
-
}
|
|
37
34
|
`
|
|
38
35
|
]
|
|
39
36
|
|
|
@@ -61,52 +58,47 @@ export class RecordBasedCodeEditorPopup extends LitElement {
|
|
|
61
58
|
}
|
|
62
59
|
*/
|
|
63
60
|
async connectedCallback() {
|
|
64
|
-
this.value = this.record[this.config.value_field] ? this.record[this.config.value_field] : ''
|
|
61
|
+
this.value = this.record[this.config.value_field] ? this.record[this.config.value_field] : ''
|
|
65
62
|
|
|
66
|
-
if(typeof this.value === 'object') {
|
|
67
|
-
this.codeValue = JSON.stringify(this.value, 0, 2)
|
|
63
|
+
if (typeof this.value === 'object') {
|
|
64
|
+
this.codeValue = JSON.stringify(this.value, 0, 2)
|
|
68
65
|
} else {
|
|
69
|
-
this.codeValue = this.value
|
|
66
|
+
this.codeValue = this.value
|
|
70
67
|
}
|
|
71
68
|
|
|
72
|
-
await super.connectedCallback()
|
|
69
|
+
await super.connectedCallback()
|
|
73
70
|
}
|
|
74
71
|
|
|
75
72
|
async firstUpdated() {
|
|
76
|
-
await super.firstUpdated()
|
|
73
|
+
await super.firstUpdated()
|
|
77
74
|
}
|
|
78
75
|
|
|
79
76
|
render() {
|
|
80
|
-
let addSaveBtn = this.config.save_action ? true : false
|
|
77
|
+
let addSaveBtn = this.config.save_action ? true : false
|
|
81
78
|
|
|
82
|
-
if(addSaveBtn) {
|
|
79
|
+
if (addSaveBtn) {
|
|
83
80
|
return html`
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
<
|
|
87
|
-
@click=${this.clickCancel.bind(this)}>
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
</mwc-button>
|
|
92
|
-
</div>
|
|
93
|
-
`
|
|
81
|
+
<ox-input-code mode="javascript" value=${this.codeValue} tab-size="2" tab-as-space="true"></ox-input-code>
|
|
82
|
+
|
|
83
|
+
<div id="button-container" class="button-container">
|
|
84
|
+
<button @click=${this.clickCancel.bind(this)}><md-icon>cancel</md-icon>${TermsUtil.tButton('cancel')}</button>
|
|
85
|
+
<button @click=${this.clickSave.bind(this)}><md-icon>save</md-icon>${TermsUtil.tButton('save')}</button>
|
|
86
|
+
</div>
|
|
87
|
+
`
|
|
94
88
|
} else {
|
|
95
89
|
return html`
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
</div>
|
|
102
|
-
`
|
|
90
|
+
<ox-input-code mode="javascript" value=${this.codeValue} tab-size="2" tab-as-space="true"></ox-input-code>
|
|
91
|
+
<div id="button-container" class="button-container">
|
|
92
|
+
<button @click=${this.clickCancel.bind(this)}><md-icon>cancel</md-icon>${TermsUtil.tButton('cancel')}</button>
|
|
93
|
+
</div>
|
|
94
|
+
`
|
|
103
95
|
}
|
|
104
96
|
}
|
|
105
97
|
|
|
106
98
|
/**
|
|
107
99
|
* @description 코드편집기 엘리먼트
|
|
108
100
|
***************************
|
|
109
|
-
* @returns
|
|
101
|
+
* @returns
|
|
110
102
|
*/
|
|
111
103
|
get codeEditor() {
|
|
112
104
|
return this.shadowRoot.querySelector('ox-input-code')
|
|
@@ -115,32 +107,31 @@ export class RecordBasedCodeEditorPopup extends LitElement {
|
|
|
115
107
|
/**
|
|
116
108
|
* @description 저장
|
|
117
109
|
***************************
|
|
118
|
-
* @returns
|
|
110
|
+
* @returns
|
|
119
111
|
*/
|
|
120
112
|
async clickSave(e) {
|
|
121
|
-
if(this.codeValue === this.codeEditor.value) {
|
|
122
|
-
MetaApi.showToast('info', TermsUtil.tText('NOTHING_CHANGED'))
|
|
113
|
+
if (this.codeValue === this.codeEditor.value) {
|
|
114
|
+
MetaApi.showToast('info', TermsUtil.tText('NOTHING_CHANGED'))
|
|
123
115
|
} else {
|
|
124
116
|
let saveAction = this.config.save_action
|
|
125
117
|
let saveFuncName = saveAction.func_name
|
|
126
|
-
let patch = { id
|
|
118
|
+
let patch = { id: this.record.id, cuFlag: 'M' }
|
|
127
119
|
patch[this.config.value_field] = this.codeEditor.value
|
|
128
120
|
let response = await ServiceUtil.updateOne(saveFuncName, this.record.id, patch)
|
|
129
|
-
if(response) {
|
|
121
|
+
if (response) {
|
|
130
122
|
closePopup(this)
|
|
131
123
|
}
|
|
132
124
|
}
|
|
133
125
|
}
|
|
134
126
|
|
|
135
|
-
|
|
136
127
|
/**
|
|
137
|
-
* @description 취소
|
|
128
|
+
* @description 취소
|
|
138
129
|
***************************
|
|
139
|
-
* @returns
|
|
130
|
+
* @returns
|
|
140
131
|
*/
|
|
141
132
|
async clickCancel(e) {
|
|
142
133
|
closePopup(this)
|
|
143
134
|
}
|
|
144
135
|
}
|
|
145
|
-
|
|
146
|
-
customElements.define('record-based-code-editor-popup', RecordBasedCodeEditorPopup)
|
|
136
|
+
|
|
137
|
+
customElements.define('record-based-code-editor-popup', RecordBasedCodeEditorPopup)
|