@things-factory/operato-tools 7.0.1-alpha.3 → 7.0.1-alpha.4
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/pages/generator/button-config-tab-mixin.js +288 -300
- package/client/pages/generator/column-config-tab-mixin.js +502 -499
- package/client/pages/generator/etc-config-tab-mixin.js +90 -93
- package/client/pages/generator/form-config-tab-mixin.js +143 -149
- package/client/pages/generator/graphql-config-tab-mixin.js +281 -277
- package/client/pages/generator/grid-config-tab-mixin.js +135 -147
- package/client/pages/generator/grid-emphasized-config-tab-mixin.js +256 -256
- package/client/pages/generator/menu-config-tab-mixin.js +94 -100
- package/client/pages/generator/meta-generator-page.js +179 -174
- package/client/pages/generator/search-config-tab-mixin.js +153 -161
- package/client/pages/generator/tab-config-tab-mixin.js +204 -204
- package/client/pages/main.js +1 -1
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { html, css } from 'lit
|
|
1
|
+
import { html, css } from 'lit'
|
|
2
2
|
import { merge } from 'lodash'
|
|
3
3
|
import gql from 'graphql-tag'
|
|
4
4
|
|
|
@@ -30,7 +30,15 @@ import { MetaCrypto } from '@things-factory/meta-ui/client/utils/meta-crypto'
|
|
|
30
30
|
* @author wryang
|
|
31
31
|
* @description 페이지 생성기 화면
|
|
32
32
|
*/
|
|
33
|
-
class MetaGeneratorPage extends MenuConfigTabMixin(
|
|
33
|
+
class MetaGeneratorPage extends MenuConfigTabMixin(
|
|
34
|
+
GraphQlConfigTabMixin(
|
|
35
|
+
GridConfigTabMixin(
|
|
36
|
+
ColumnConfigTabMixin(
|
|
37
|
+
ButtonConfigTabMixin(SearchConfigTabMixin(FormConfigTabMixin(TabConfigTabMixin(EtcConfigTabMixin(GridEmphasizedConfigTabMixin(localize(i18next)(PageView)))))))
|
|
38
|
+
)
|
|
39
|
+
)
|
|
40
|
+
)
|
|
41
|
+
) {
|
|
34
42
|
static get styles() {
|
|
35
43
|
return [
|
|
36
44
|
css`
|
|
@@ -53,14 +61,14 @@ class MetaGeneratorPage extends MenuConfigTabMixin(GraphQlConfigTabMixin(GridCon
|
|
|
53
61
|
padding-bottom: var(--grist-title-with-grid-padding);
|
|
54
62
|
border-bottom: var(--subtitle-border-bottom);
|
|
55
63
|
}
|
|
56
|
-
|
|
64
|
+
|
|
57
65
|
h2 mwc-icon {
|
|
58
66
|
vertical-align: middle;
|
|
59
67
|
margin: var(--grist-title-icon-margin);
|
|
60
68
|
font-size: var(--grist-title-icon-size);
|
|
61
69
|
color: var(--grist-title-icon-color);
|
|
62
70
|
}
|
|
63
|
-
|
|
71
|
+
|
|
64
72
|
.tabs {
|
|
65
73
|
display: flex;
|
|
66
74
|
}
|
|
@@ -80,7 +88,7 @@ class MetaGeneratorPage extends MenuConfigTabMixin(GraphQlConfigTabMixin(GridCon
|
|
|
80
88
|
box-shadow: 2px -2px 2px 0px rgba(0, 0, 0, 0.15);
|
|
81
89
|
opacity: 1;
|
|
82
90
|
font-weight: bold;
|
|
83
|
-
}
|
|
91
|
+
}
|
|
84
92
|
.content-container {
|
|
85
93
|
flex: 1;
|
|
86
94
|
display: flex;
|
|
@@ -93,8 +101,8 @@ class MetaGeneratorPage extends MenuConfigTabMixin(GraphQlConfigTabMixin(GridCon
|
|
|
93
101
|
overflow: auto;
|
|
94
102
|
}
|
|
95
103
|
.tab-contents {
|
|
96
|
-
display:flex;
|
|
97
|
-
flex:1;
|
|
104
|
+
display: flex;
|
|
105
|
+
flex: 1;
|
|
98
106
|
flex-direction: column;
|
|
99
107
|
overflow-x: overlay;
|
|
100
108
|
background-color: var(--main-section-background-color);
|
|
@@ -144,27 +152,27 @@ class MetaGeneratorPage extends MenuConfigTabMixin(GraphQlConfigTabMixin(GridCon
|
|
|
144
152
|
label {
|
|
145
153
|
display: flex;
|
|
146
154
|
flex-direction: column;
|
|
147
|
-
|
|
155
|
+
|
|
148
156
|
font: var(--label-font);
|
|
149
157
|
color: var(--label-color);
|
|
150
|
-
}
|
|
151
|
-
input[type=checkbox]{
|
|
152
|
-
min-width:25px
|
|
153
158
|
}
|
|
154
|
-
input[type=
|
|
155
|
-
min-width:25px
|
|
159
|
+
input[type='checkbox'] {
|
|
160
|
+
min-width: 25px;
|
|
161
|
+
}
|
|
162
|
+
input[type='radio'] {
|
|
163
|
+
min-width: 25px;
|
|
156
164
|
}
|
|
157
165
|
select {
|
|
158
166
|
flex: 1;
|
|
159
167
|
}
|
|
160
|
-
|
|
168
|
+
|
|
161
169
|
select {
|
|
162
170
|
border: 0;
|
|
163
171
|
border-bottom: var(--border-dark-color);
|
|
164
172
|
padding: var(--input-padding);
|
|
165
173
|
font: var(--input-font);
|
|
166
174
|
color: var(--primary-text-color);
|
|
167
|
-
|
|
175
|
+
|
|
168
176
|
max-height: 35px;
|
|
169
177
|
}
|
|
170
178
|
select:focus {
|
|
@@ -174,7 +182,8 @@ class MetaGeneratorPage extends MenuConfigTabMixin(GraphQlConfigTabMixin(GridCon
|
|
|
174
182
|
ox-grist {
|
|
175
183
|
overflow-y: auto;
|
|
176
184
|
flex: 1;
|
|
177
|
-
}
|
|
185
|
+
}
|
|
186
|
+
`
|
|
178
187
|
]
|
|
179
188
|
}
|
|
180
189
|
|
|
@@ -186,7 +195,7 @@ class MetaGeneratorPage extends MenuConfigTabMixin(GraphQlConfigTabMixin(GridCon
|
|
|
186
195
|
currentTabKey: String,
|
|
187
196
|
tabData: Object,
|
|
188
197
|
dataStorage: Object,
|
|
189
|
-
|
|
198
|
+
|
|
190
199
|
viewMenuData: Object,
|
|
191
200
|
|
|
192
201
|
afterSetFieldsConfig: Object,
|
|
@@ -204,7 +213,7 @@ class MetaGeneratorPage extends MenuConfigTabMixin(GraphQlConfigTabMixin(GridCon
|
|
|
204
213
|
viewButtonData: Array,
|
|
205
214
|
|
|
206
215
|
searchTabGridConfig: Object,
|
|
207
|
-
viewSearchData: Array
|
|
216
|
+
viewSearchData: Array
|
|
208
217
|
}
|
|
209
218
|
}
|
|
210
219
|
|
|
@@ -234,13 +243,13 @@ class MetaGeneratorPage extends MenuConfigTabMixin(GraphQlConfigTabMixin(GridCon
|
|
|
234
243
|
/**
|
|
235
244
|
* @description 화면 내 그리드 데이터 삭제
|
|
236
245
|
*************************************
|
|
237
|
-
* @param {Object} grist
|
|
238
|
-
* @param {Object} record
|
|
246
|
+
* @param {Object} grist
|
|
247
|
+
* @param {Object} record
|
|
239
248
|
*/
|
|
240
249
|
deleteRow(grist, record) {
|
|
241
|
-
let gristData = grist.dirtyData
|
|
242
|
-
gristData.records = gristData.records.filter(x => x.id != record.id)
|
|
243
|
-
grist.data = gristData
|
|
250
|
+
let gristData = grist.dirtyData
|
|
251
|
+
gristData.records = gristData.records.filter(x => x.id != record.id)
|
|
252
|
+
grist.data = gristData
|
|
244
253
|
}
|
|
245
254
|
|
|
246
255
|
/**
|
|
@@ -248,7 +257,7 @@ class MetaGeneratorPage extends MenuConfigTabMixin(GraphQlConfigTabMixin(GridCon
|
|
|
248
257
|
*******************************
|
|
249
258
|
*/
|
|
250
259
|
async save() {
|
|
251
|
-
if(store.getState().operatoTools.studioPermission == false) {
|
|
260
|
+
if (store.getState().operatoTools.studioPermission == false) {
|
|
252
261
|
document.dispatchEvent(
|
|
253
262
|
new CustomEvent('notify', {
|
|
254
263
|
detail: {
|
|
@@ -257,7 +266,7 @@ class MetaGeneratorPage extends MenuConfigTabMixin(GraphQlConfigTabMixin(GridCon
|
|
|
257
266
|
}
|
|
258
267
|
})
|
|
259
268
|
)
|
|
260
|
-
return
|
|
269
|
+
return
|
|
261
270
|
}
|
|
262
271
|
|
|
263
272
|
let response = await client.query({
|
|
@@ -269,34 +278,34 @@ class MetaGeneratorPage extends MenuConfigTabMixin(GraphQlConfigTabMixin(GridCon
|
|
|
269
278
|
variables: { id: this.menuId }
|
|
270
279
|
})
|
|
271
280
|
|
|
272
|
-
if(response.errors) {
|
|
273
|
-
return
|
|
281
|
+
if (response.errors) {
|
|
282
|
+
return
|
|
274
283
|
}
|
|
275
284
|
|
|
276
|
-
let tabResults = {}
|
|
277
|
-
let template = {}
|
|
285
|
+
let tabResults = {}
|
|
286
|
+
let template = {}
|
|
278
287
|
|
|
279
288
|
Object.keys(this.tabData).forEach(key => {
|
|
280
|
-
let convKey = this.convertFirstCharUpperCase(key)
|
|
281
|
-
tabResults[key] = this[`get${convKey}ConfigTabValues`]()
|
|
289
|
+
let convKey = this.convertFirstCharUpperCase(key)
|
|
290
|
+
tabResults[key] = this[`get${convKey}ConfigTabValues`]()
|
|
282
291
|
template = merge(template, tabResults[key])
|
|
283
292
|
})
|
|
284
293
|
|
|
285
|
-
template = JSON.stringify(template)
|
|
286
|
-
template = MetaCrypto.enc(template)
|
|
294
|
+
template = JSON.stringify(template)
|
|
295
|
+
template = MetaCrypto.enc(template)
|
|
287
296
|
|
|
288
|
-
let result = await MetaApi.updateMultiple('updateMultipleMenu', [{ id: this.menuId
|
|
297
|
+
let result = await MetaApi.updateMultiple('updateMultipleMenu', [{ id: this.menuId, template: template, cuFlag: 'M' }])
|
|
289
298
|
if (result) {
|
|
290
|
-
await this.initData()
|
|
299
|
+
await this.initData()
|
|
291
300
|
}
|
|
292
301
|
}
|
|
293
|
-
|
|
302
|
+
|
|
294
303
|
/**
|
|
295
304
|
* @description 기존 데이터 clear
|
|
296
305
|
*******************************
|
|
297
306
|
*/
|
|
298
|
-
|
|
299
|
-
this.setTabData()
|
|
307
|
+
clear() {
|
|
308
|
+
this.setTabData()
|
|
300
309
|
|
|
301
310
|
this.dataStorage = {
|
|
302
311
|
menu: {},
|
|
@@ -309,12 +318,12 @@ class MetaGeneratorPage extends MenuConfigTabMixin(GraphQlConfigTabMixin(GridCon
|
|
|
309
318
|
tab: [],
|
|
310
319
|
etc: {},
|
|
311
320
|
gridEmphasized: {}
|
|
312
|
-
}
|
|
321
|
+
}
|
|
313
322
|
|
|
314
323
|
Object.keys(this.tabData).forEach(key => {
|
|
315
|
-
let convKey = this.convertFirstCharUpperCase(key)
|
|
316
|
-
if(this[`set${convKey}ConfigTabValues`]) {
|
|
317
|
-
return this[`set${convKey}ConfigTabValues`](this.dataStorage[key])
|
|
324
|
+
let convKey = this.convertFirstCharUpperCase(key)
|
|
325
|
+
if (this[`set${convKey}ConfigTabValues`]) {
|
|
326
|
+
return this[`set${convKey}ConfigTabValues`](this.dataStorage[key])
|
|
318
327
|
}
|
|
319
328
|
})
|
|
320
329
|
}
|
|
@@ -324,8 +333,8 @@ class MetaGeneratorPage extends MenuConfigTabMixin(GraphQlConfigTabMixin(GridCon
|
|
|
324
333
|
*********************
|
|
325
334
|
*/
|
|
326
335
|
async refresh() {
|
|
327
|
-
this.clear()
|
|
328
|
-
await this.initData()
|
|
336
|
+
this.clear()
|
|
337
|
+
await this.initData()
|
|
329
338
|
}
|
|
330
339
|
|
|
331
340
|
/**
|
|
@@ -333,46 +342,46 @@ class MetaGeneratorPage extends MenuConfigTabMixin(GraphQlConfigTabMixin(GridCon
|
|
|
333
342
|
*********************************
|
|
334
343
|
*/
|
|
335
344
|
backToMenu() {
|
|
336
|
-
history.back()
|
|
345
|
+
history.back()
|
|
337
346
|
}
|
|
338
347
|
|
|
339
348
|
/**
|
|
340
349
|
* @description 메뉴 데이터 가져오기
|
|
341
350
|
********************************
|
|
342
|
-
* @returns
|
|
351
|
+
* @returns
|
|
343
352
|
*/
|
|
344
353
|
async initData() {
|
|
345
|
-
// 1. 파라미터에서 menuId 추출
|
|
346
|
-
let { menuId = '' } = this.lifecycle?.params ? this.lifecycle.params : {}
|
|
347
|
-
this.menuId = menuId
|
|
348
|
-
|
|
349
|
-
// 2. 메뉴 ID가 지정되지 않은 페이지 호출은 무시
|
|
350
|
-
if(!menuId || menuId == '') {
|
|
351
|
-
this.clear()
|
|
352
|
-
return
|
|
354
|
+
// 1. 파라미터에서 menuId 추출
|
|
355
|
+
let { menuId = '' } = this.lifecycle?.params ? this.lifecycle.params : {}
|
|
356
|
+
this.menuId = menuId
|
|
357
|
+
|
|
358
|
+
// 2. 메뉴 ID가 지정되지 않은 페이지 호출은 무시
|
|
359
|
+
if (!menuId || menuId == '') {
|
|
360
|
+
this.clear()
|
|
361
|
+
return
|
|
353
362
|
}
|
|
354
363
|
|
|
355
|
-
// 3. 메뉴 데이터 가져오기
|
|
364
|
+
// 3. 메뉴 데이터 가져오기
|
|
356
365
|
let selectFields = `
|
|
357
366
|
id
|
|
358
367
|
name
|
|
359
368
|
template
|
|
360
369
|
`
|
|
361
|
-
let response = await MetaApi.findOne('menu', menuId, selectFields)
|
|
370
|
+
let response = await MetaApi.findOne('menu', menuId, selectFields)
|
|
362
371
|
|
|
363
|
-
if(!response) {
|
|
364
|
-
return
|
|
372
|
+
if (!response) {
|
|
373
|
+
return
|
|
365
374
|
}
|
|
366
375
|
|
|
367
376
|
try {
|
|
368
|
-
JSON.parse(MetaCrypto.dec(response.template))
|
|
369
|
-
} catch(e) {
|
|
370
|
-
return
|
|
377
|
+
JSON.parse(MetaCrypto.dec(response.template))
|
|
378
|
+
} catch (e) {
|
|
379
|
+
return
|
|
371
380
|
}
|
|
372
381
|
|
|
373
|
-
// 4. 조회 값 셋팅
|
|
374
|
-
this.menuName = TermsUtil.tMenu(response.name)
|
|
375
|
-
this.metaTemplate = response.template ? JSON.parse(MetaCrypto.dec(response.template)) : {}
|
|
382
|
+
// 4. 조회 값 셋팅
|
|
383
|
+
this.menuName = TermsUtil.tMenu(response.name)
|
|
384
|
+
this.metaTemplate = response.template ? JSON.parse(MetaCrypto.dec(response.template)) : {}
|
|
376
385
|
let {
|
|
377
386
|
menu = {},
|
|
378
387
|
gql = {},
|
|
@@ -384,67 +393,71 @@ class MetaGeneratorPage extends MenuConfigTabMixin(GraphQlConfigTabMixin(GridCon
|
|
|
384
393
|
tab = [],
|
|
385
394
|
etc = {},
|
|
386
395
|
gridEmphasized = []
|
|
387
|
-
} = this.metaTemplate ? this.metaTemplate : {}
|
|
388
|
-
this.setTabData()
|
|
396
|
+
} = this.metaTemplate ? this.metaTemplate : {}
|
|
397
|
+
this.setTabData()
|
|
389
398
|
|
|
390
399
|
// 5. dataStorage 생성
|
|
391
400
|
this.dataStorage = {}
|
|
392
|
-
this.dataStorage.menu = menu
|
|
393
|
-
this.dataStorage.graphql = gql
|
|
394
|
-
this.dataStorage.grid = grid
|
|
395
|
-
this.dataStorage.form = form
|
|
396
|
-
this.dataStorage.tab = tab
|
|
397
|
-
this.dataStorage.etc = etc
|
|
398
|
-
this.dataStorage.gridEmphasized = gridEmphasized
|
|
401
|
+
this.dataStorage.menu = menu
|
|
402
|
+
this.dataStorage.graphql = gql
|
|
403
|
+
this.dataStorage.grid = grid
|
|
404
|
+
this.dataStorage.form = form
|
|
405
|
+
this.dataStorage.tab = tab
|
|
406
|
+
this.dataStorage.etc = etc
|
|
407
|
+
this.dataStorage.gridEmphasized = gridEmphasized
|
|
399
408
|
|
|
400
409
|
// 6. 정렬 필드에 rank 추가
|
|
401
|
-
(grid.option?.sorters || []).forEach((value, index) => {
|
|
402
|
-
value.rank = (
|
|
410
|
+
;(grid.option?.sorters || []).forEach((value, index) => {
|
|
411
|
+
value.rank = (index + 1) * 10
|
|
403
412
|
})
|
|
404
413
|
|
|
405
414
|
// 7. 정렬 필드, 리스트, 카드 대표, 상세 필드, 썸네일 필드, 누적 계산 등 설정
|
|
406
415
|
this.dataStorage.column = grid_column.map(x => {
|
|
407
|
-
// 정렬 필드 추가
|
|
408
|
-
let sortField = (grid.option?.sorters || []).filter(y => y.name == x.name)
|
|
409
|
-
if(sortField && sortField.length > 0) {
|
|
410
|
-
x.sort_rank = sortField[0].rank
|
|
411
|
-
x.sort_desc = sortField[0].desc ? sortField[0].desc : false
|
|
416
|
+
// 정렬 필드 추가
|
|
417
|
+
let sortField = (grid.option?.sorters || []).filter(y => y.name == x.name)
|
|
418
|
+
if (sortField && sortField.length > 0) {
|
|
419
|
+
x.sort_rank = sortField[0].rank
|
|
420
|
+
x.sort_desc = sortField[0].desc ? sortField[0].desc : false
|
|
412
421
|
} else {
|
|
413
|
-
x.sort_rank = 0
|
|
422
|
+
x.sort_rank = 0
|
|
414
423
|
}
|
|
415
424
|
|
|
416
|
-
// 리스트 / 카드 대표 필드 설정
|
|
417
|
-
x.rep_field = (grid.list?.fields || []).includes(x.name)
|
|
425
|
+
// 리스트 / 카드 대표 필드 설정
|
|
426
|
+
x.rep_field = (grid.list?.fields || []).includes(x.name)
|
|
418
427
|
|
|
419
|
-
// 리스트 / 카드 상세 필드 설정
|
|
420
|
-
x.detail_field = (grid.list?.details || []).includes(x.name)
|
|
428
|
+
// 리스트 / 카드 상세 필드 설정
|
|
429
|
+
x.detail_field = (grid.list?.details || []).includes(x.name)
|
|
421
430
|
|
|
422
|
-
// 썸네일 필드
|
|
423
|
-
x.thumbnail_field =
|
|
424
|
-
return x
|
|
425
|
-
})
|
|
431
|
+
// 썸네일 필드
|
|
432
|
+
x.thumbnail_field = grid.list?.thumbnail == x.name
|
|
433
|
+
return x
|
|
434
|
+
})
|
|
426
435
|
|
|
427
436
|
// 8. 검색 설정과 Gql 쿼리의 기본 검색값을 병합
|
|
428
|
-
search.push(
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
437
|
+
search.push(
|
|
438
|
+
...(gql.query?.filters || []).map(x => {
|
|
439
|
+
// GraphQL에 있는 숨겨진 검색 조건 추가
|
|
440
|
+
x.hidden = true
|
|
441
|
+
return x
|
|
442
|
+
})
|
|
443
|
+
)
|
|
444
|
+
this.dataStorage.search = search
|
|
434
445
|
|
|
435
446
|
// 9. 일반 버튼과 그리드 버튼을 병합
|
|
436
|
-
button.push(
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
447
|
+
button.push(
|
|
448
|
+
...(grid.button || []).map(x => {
|
|
449
|
+
x.type = `grid-${x.type}`
|
|
450
|
+
x.style = x.icon
|
|
451
|
+
return x
|
|
452
|
+
})
|
|
453
|
+
)
|
|
441
454
|
|
|
442
|
-
this.dataStorage.button = button
|
|
455
|
+
this.dataStorage.button = button
|
|
443
456
|
|
|
444
457
|
Object.keys(this.tabData).forEach(key => {
|
|
445
|
-
let convKey = this.convertFirstCharUpperCase(key)
|
|
446
|
-
if(this[`set${convKey}ConfigTabValues`]) {
|
|
447
|
-
return this[`set${convKey}ConfigTabValues`](this.dataStorage[key])
|
|
458
|
+
let convKey = this.convertFirstCharUpperCase(key)
|
|
459
|
+
if (this[`set${convKey}ConfigTabValues`]) {
|
|
460
|
+
return this[`set${convKey}ConfigTabValues`](this.dataStorage[key])
|
|
448
461
|
}
|
|
449
462
|
})
|
|
450
463
|
}
|
|
@@ -455,39 +468,39 @@ class MetaGeneratorPage extends MenuConfigTabMixin(GraphQlConfigTabMixin(GridCon
|
|
|
455
468
|
*/
|
|
456
469
|
async pageInitialized() {
|
|
457
470
|
// 탭에 데이터 설정
|
|
458
|
-
this.setTabData()
|
|
459
|
-
|
|
460
|
-
// 각 탭 별 config set 설정 호출
|
|
461
|
-
let keys = Object.keys(this.tabData)
|
|
462
|
-
for(let idx = 0
|
|
463
|
-
let key = this.convertFirstCharUpperCase(keys[idx])
|
|
464
|
-
if(this[`set${key}ConfigTabConfig`]) {
|
|
465
|
-
await this[`set${key}ConfigTabConfig`]()
|
|
471
|
+
this.setTabData()
|
|
472
|
+
|
|
473
|
+
// 각 탭 별 config set 설정 호출
|
|
474
|
+
let keys = Object.keys(this.tabData)
|
|
475
|
+
for (let idx = 0; idx < keys.length; idx++) {
|
|
476
|
+
let key = this.convertFirstCharUpperCase(keys[idx])
|
|
477
|
+
if (this[`set${key}ConfigTabConfig`]) {
|
|
478
|
+
await this[`set${key}ConfigTabConfig`]()
|
|
466
479
|
}
|
|
467
480
|
}
|
|
468
481
|
}
|
|
469
|
-
|
|
482
|
+
|
|
470
483
|
/**
|
|
471
484
|
* @override lifecycle
|
|
472
485
|
***********************
|
|
473
|
-
* @param {*} changes
|
|
474
|
-
* @param {*} lifecycle
|
|
475
|
-
* @param {*} before
|
|
486
|
+
* @param {*} changes
|
|
487
|
+
* @param {*} lifecycle
|
|
488
|
+
* @param {*} before
|
|
476
489
|
*/
|
|
477
490
|
async pageUpdated(changes, lifecycle, before) {
|
|
478
|
-
// 1. 페이지 활성화 시
|
|
491
|
+
// 1. 페이지 활성화 시
|
|
479
492
|
if (this.active === true) {
|
|
480
493
|
// 1.1 탭에 데이터 설정
|
|
481
|
-
this.setTabData()
|
|
482
|
-
// 1.2 메뉴 템플릿 정보 조회
|
|
483
|
-
await this.initData()
|
|
484
|
-
// 1.3 메뉴 구성 탭 정보 설정
|
|
485
|
-
this.setTabData()
|
|
494
|
+
this.setTabData()
|
|
495
|
+
// 1.2 메뉴 템플릿 정보 조회
|
|
496
|
+
await this.initData()
|
|
497
|
+
// 1.3 메뉴 구성 탭 정보 설정
|
|
498
|
+
this.setTabData()
|
|
486
499
|
|
|
487
|
-
|
|
500
|
+
// 2. 페이지 비활성화 시
|
|
488
501
|
} else {
|
|
489
|
-
|
|
490
|
-
|
|
502
|
+
this.clear()
|
|
503
|
+
this.remove()
|
|
491
504
|
}
|
|
492
505
|
}
|
|
493
506
|
|
|
@@ -518,11 +531,11 @@ class MetaGeneratorPage extends MenuConfigTabMixin(GraphQlConfigTabMixin(GridCon
|
|
|
518
531
|
* @returns {HTML}
|
|
519
532
|
*/
|
|
520
533
|
render() {
|
|
521
|
-
if (!this.currentTabKey) this.currentTabKey = 'menu'
|
|
522
|
-
this.setTabData()
|
|
534
|
+
if (!this.currentTabKey) this.currentTabKey = 'menu'
|
|
535
|
+
this.setTabData()
|
|
523
536
|
|
|
524
|
-
let tabKeys = Object.keys(this.tabData)
|
|
525
|
-
const currentTabKey = this.tabData[this.currentTabKey] ? this.currentTabKey : tabKeys[0]
|
|
537
|
+
let tabKeys = Object.keys(this.tabData)
|
|
538
|
+
const currentTabKey = this.tabData[this.currentTabKey] ? this.currentTabKey : tabKeys[0]
|
|
526
539
|
|
|
527
540
|
let renderHtml = html`
|
|
528
541
|
<h1>${this.menuName}</h1>
|
|
@@ -538,20 +551,16 @@ class MetaGeneratorPage extends MenuConfigTabMixin(GraphQlConfigTabMixin(GridCon
|
|
|
538
551
|
</div>
|
|
539
552
|
<div class="content-container">
|
|
540
553
|
${tabKeys.map(key => {
|
|
541
|
-
let displayStyle = 'display:none'
|
|
542
|
-
if(key == this.currentTabKey) {
|
|
554
|
+
let displayStyle = 'display:none'
|
|
555
|
+
if (key == this.currentTabKey) {
|
|
543
556
|
displayStyle = 'display:flex'
|
|
544
557
|
}
|
|
545
558
|
|
|
546
|
-
return html`
|
|
547
|
-
<div class='tab-contents' style="${ displayStyle }">
|
|
548
|
-
${this.getConfigTab(key)}
|
|
549
|
-
</div>
|
|
550
|
-
`
|
|
559
|
+
return html` <div class="tab-contents" style="${displayStyle}">${this.getConfigTab(key)}</div> `
|
|
551
560
|
})}
|
|
552
561
|
</div>
|
|
553
562
|
`
|
|
554
|
-
return renderHtml
|
|
563
|
+
return renderHtml
|
|
555
564
|
}
|
|
556
565
|
|
|
557
566
|
/**
|
|
@@ -559,10 +568,10 @@ class MetaGeneratorPage extends MenuConfigTabMixin(GraphQlConfigTabMixin(GridCon
|
|
|
559
568
|
********************************
|
|
560
569
|
*/
|
|
561
570
|
getConfigTab(key) {
|
|
562
|
-
let convKey = this.convertFirstCharUpperCase(key)
|
|
571
|
+
let convKey = this.convertFirstCharUpperCase(key)
|
|
563
572
|
|
|
564
|
-
if(this[`render${convKey}ConfigTab`]) {
|
|
565
|
-
return this[`render${convKey}ConfigTab`]()
|
|
573
|
+
if (this[`render${convKey}ConfigTab`]) {
|
|
574
|
+
return this[`render${convKey}ConfigTab`]()
|
|
566
575
|
}
|
|
567
576
|
|
|
568
577
|
return html``
|
|
@@ -574,8 +583,8 @@ class MetaGeneratorPage extends MenuConfigTabMixin(GraphQlConfigTabMixin(GridCon
|
|
|
574
583
|
* @param {String} word
|
|
575
584
|
*/
|
|
576
585
|
convertFirstCharUpperCase(word) {
|
|
577
|
-
let convWord = word.charAt(0).toUpperCase() + word.slice(1)
|
|
578
|
-
return convWord
|
|
586
|
+
let convWord = word.charAt(0).toUpperCase() + word.slice(1)
|
|
587
|
+
return convWord
|
|
579
588
|
}
|
|
580
589
|
|
|
581
590
|
/**
|
|
@@ -585,7 +594,7 @@ class MetaGeneratorPage extends MenuConfigTabMixin(GraphQlConfigTabMixin(GridCon
|
|
|
585
594
|
* @returns {HTML}
|
|
586
595
|
*/
|
|
587
596
|
getElementById(id) {
|
|
588
|
-
return this.shadowRoot.querySelector(`#${id}`)
|
|
597
|
+
return this.shadowRoot.querySelector(`#${id}`)
|
|
589
598
|
}
|
|
590
599
|
|
|
591
600
|
/**
|
|
@@ -595,39 +604,35 @@ class MetaGeneratorPage extends MenuConfigTabMixin(GraphQlConfigTabMixin(GridCon
|
|
|
595
604
|
* @returns {HTML}
|
|
596
605
|
*/
|
|
597
606
|
getElementValueById(id) {
|
|
598
|
-
let element = this.shadowRoot.querySelector(`#${id}`)
|
|
599
|
-
if(!element) return undefined
|
|
600
|
-
|
|
601
|
-
let elementValue = '';
|
|
602
|
-
if(element.tagName.toLowerCase() == 'select') {
|
|
603
|
-
if(!element.options || element.options.length == 0) return undefined;
|
|
604
|
-
elementValue = element.options[element.selectedIndex].value;
|
|
607
|
+
let element = this.shadowRoot.querySelector(`#${id}`)
|
|
608
|
+
if (!element) return undefined
|
|
605
609
|
|
|
610
|
+
let elementValue = ''
|
|
611
|
+
if (element.tagName.toLowerCase() == 'select') {
|
|
612
|
+
if (!element.options || element.options.length == 0) return undefined
|
|
613
|
+
elementValue = element.options[element.selectedIndex].value
|
|
606
614
|
} else if (element.tagName.toLowerCase() == 'ox-grist') {
|
|
607
|
-
if(!element.dirtyData) return undefined
|
|
608
|
-
if(!element.dirtyData.records) return undefined
|
|
609
|
-
if(element.dirtyData.records.length == 0) return undefined
|
|
610
|
-
return element.dirtyData.records
|
|
611
|
-
|
|
615
|
+
if (!element.dirtyData) return undefined
|
|
616
|
+
if (!element.dirtyData.records) return undefined
|
|
617
|
+
if (element.dirtyData.records.length == 0) return undefined
|
|
618
|
+
return element.dirtyData.records
|
|
612
619
|
} else if (element.tagName.toLowerCase() == 'ox-input-code') {
|
|
613
|
-
return element.value
|
|
614
|
-
|
|
620
|
+
return element.value
|
|
615
621
|
} else {
|
|
616
|
-
if(element.type.toLowerCase() == 'radio') {
|
|
617
|
-
let radioEle = this.shadowRoot.querySelector(`#${id}:checked`)
|
|
618
|
-
if(!radioEle) return undefined
|
|
619
|
-
return radioEle.value
|
|
620
|
-
|
|
622
|
+
if (element.type.toLowerCase() == 'radio') {
|
|
623
|
+
let radioEle = this.shadowRoot.querySelector(`#${id}:checked`)
|
|
624
|
+
if (!radioEle) return undefined
|
|
625
|
+
return radioEle.value
|
|
621
626
|
} else {
|
|
622
|
-
elementValue = element.value
|
|
627
|
+
elementValue = element.value
|
|
623
628
|
}
|
|
624
629
|
}
|
|
625
630
|
|
|
626
|
-
if(!elementValue || elementValue == '') {
|
|
627
|
-
return undefined
|
|
631
|
+
if (!elementValue || elementValue == '') {
|
|
632
|
+
return undefined
|
|
628
633
|
}
|
|
629
634
|
|
|
630
|
-
return elementValue
|
|
635
|
+
return elementValue
|
|
631
636
|
}
|
|
632
637
|
|
|
633
638
|
/**
|
|
@@ -637,13 +642,13 @@ class MetaGeneratorPage extends MenuConfigTabMixin(GraphQlConfigTabMixin(GridCon
|
|
|
637
642
|
* @returns {Array}
|
|
638
643
|
*/
|
|
639
644
|
sortRecordByRank(list) {
|
|
640
|
-
if(!list) {
|
|
641
|
-
return list
|
|
645
|
+
if (!list) {
|
|
646
|
+
return list
|
|
642
647
|
} else {
|
|
643
|
-
return this.sortRecordByField(list, 'rank')
|
|
648
|
+
return this.sortRecordByField(list, 'rank')
|
|
644
649
|
}
|
|
645
650
|
}
|
|
646
|
-
|
|
651
|
+
|
|
647
652
|
/**
|
|
648
653
|
* @description 랭킹으로 소팅 처리 후 리턴
|
|
649
654
|
************************************
|
|
@@ -653,10 +658,10 @@ class MetaGeneratorPage extends MenuConfigTabMixin(GraphQlConfigTabMixin(GridCon
|
|
|
653
658
|
*/
|
|
654
659
|
sortRecordByField(list, field) {
|
|
655
660
|
list.sort((a, b) => {
|
|
656
|
-
return a[field] - b[field]
|
|
657
|
-
})
|
|
658
|
-
return list
|
|
661
|
+
return a[field] - b[field]
|
|
662
|
+
})
|
|
663
|
+
return list
|
|
659
664
|
}
|
|
660
665
|
}
|
|
661
666
|
|
|
662
|
-
customElements.define('meta-generator-page', MetaGeneratorPage)
|
|
667
|
+
customElements.define('meta-generator-page', MetaGeneratorPage)
|