@things-factory/operato-tools 7.0.1-alpha.1 → 7.0.1-alpha.100

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/_index.html CHANGED
@@ -1,4 +1,4 @@
1
- <!DOCTYPE html>
1
+ <!doctype html>
2
2
  <html lang="en">
3
3
  <head>
4
4
  <meta charset="utf-8" />
@@ -51,6 +51,9 @@
51
51
  <!-- Performance tip: hint to the browser to start the handshake for the fonts site -->
52
52
  <link rel="preconnect" href="https://fonts.gstatic.com/" crossorigin />
53
53
  <link href="/node_modules/@material-design-icons/font/index.css" rel="stylesheet" />
54
+ <link href="/node_modules/material-symbols/index.css" rel="stylesheet" />
55
+ <link href="/node_modules/@fontsource/roboto/index.css" rel="stylesheet" />
56
+ <link rel="stylesheet" href="/theme.css" />
54
57
 
55
58
  <!-- Add any global styles for body, document, etc. -->
56
59
  <style>
@@ -75,7 +78,7 @@
75
78
  </script>
76
79
  </head>
77
80
 
78
- <body>
81
+ <body class="light">
79
82
  <things-app></things-app>
80
83
  <noscript> Please enable JavaScript to view this website. </noscript>
81
84
  <!-- Load webcomponents-loader.js to check and load any polyfills your browser needs -->
@@ -1,58 +1,68 @@
1
- import { html } from 'lit-element'
1
+ import { html } from 'lit'
2
2
 
3
3
  import { MetaApi } from '@things-factory/meta-ui/client/utils/meta-api'
4
4
  import { TermsUtil } from '@things-factory/meta-ui/client/utils/terms-util'
5
5
  import { getRenderer } from '@operato/data-grist'
6
6
 
7
- export const ButtonConfigTabMixin = (baseElement) => class extends baseElement {
7
+ /**
8
+ * @license
9
+ * Copyright © HatioLab Inc. All rights reserved.
10
+ * @author Shortstop shortstop@hatiolab.com
11
+ * @description 메뉴 상세 화면 - 버튼 설정 탭 믹스인
12
+ */
13
+ export const ButtonConfigTabMixin = baseElement =>
14
+ class extends baseElement {
8
15
 
16
+ /**
17
+ * @description 버튼 설정 탭 설정 값을 화면 오브젝트에 설정
18
+ *************************************************
19
+ * @param {Object} 버튼 설정 데이터
20
+ */
9
21
  setButtonConfigTabValues(data) {
10
22
  data?.forEach((column, index) => {
11
- let rank = index + 1;
12
- column.rank = rank * 10;
13
- column.id = rank;
23
+ let rank = index + 1
24
+ column.rank = rank * 10
25
+ column.id = rank
14
26
 
15
27
  if (column.logic && !column.logic.logic) {
16
- let logicString = JSON.stringify(column.logic, null, 2);
17
- column.logic = {};
18
- column.logic.logic = logicString;
28
+ let logicString = JSON.stringify(column.logic, null, 2)
29
+ column.logic = {}
30
+ column.logic.logic = logicString
19
31
  }
20
32
 
21
33
  if (column.style && Array.isArray(column.style)) {
22
- column.style = JSON.stringify(column.style, null, 2);
34
+ column.style = JSON.stringify(column.style, null, 2)
23
35
  }
24
36
  })
25
37
 
26
- this.viewButtonData = data;
27
- this.buttonTabGrist?.fetch();
38
+ this.viewButtonData = data
39
+ this.buttonTabGrist?.fetch()
28
40
  }
29
41
 
42
+ /**
43
+ * @description 버튼 설정 탭 설정 값 리턴
44
+ ************************************
45
+ * @return {Object} 버튼 설정 데이터 리턴
46
+ */
30
47
  getButtonConfigTabValues() {
31
- // 기본 return object
48
+ // 기본 return object
32
49
  let retObject = {
33
50
  button: [],
34
51
  grid: {
35
52
  button: []
36
53
  }
37
- };
54
+ }
38
55
 
39
- // grid 에서 데이터 가져오기
40
- let gridValue = this.getElementValueById('button-tab-grid');
56
+ // grid 에서 데이터 가져오기
57
+ let gridValue = this.getElementValueById('button-tab-grid')
41
58
 
42
- // rank 로 정렬
59
+ // rank 로 정렬
43
60
  this.sortRecordByRank(gridValue)?.forEach(x => {
44
- var {
45
- name = undefined,
46
- label = undefined,
47
- style = undefined,
48
- type = 'basic',
49
- logic = undefined,
50
- auth = undefined
51
- } = x;
61
+ var { name = undefined, label = undefined, style = undefined, type = 'basic', logic = undefined, auth = undefined } = x
52
62
 
53
- if (!name) return;
63
+ if (!name) return
54
64
 
55
- // 그리드, 일반 버튼 동일
65
+ // 그리드, 일반 버튼 동일
56
66
  let button = {
57
67
  name: name,
58
68
  type: type.replaceAll('grid-', ''),
@@ -60,49 +70,59 @@ export const ButtonConfigTabMixin = (baseElement) => class extends baseElement {
60
70
  auth: auth
61
71
  }
62
72
 
63
- // logic 이 있으면 반영
73
+ // logic 이 있으면 반영
64
74
  if (logic) {
65
75
  if (typeof logic === 'string') {
66
- logic = JSON.parse(logic);
76
+ logic = JSON.parse(logic)
67
77
  }
68
78
 
69
79
  if (logic.logic) {
70
- button.logic = JSON.parse(logic.logic);
80
+ button.logic = JSON.parse(logic.logic)
71
81
  }
72
82
  }
73
83
 
74
-
75
84
  // grid 버튼은 icon / 일반 버튼은 style
76
85
  if (type.startsWith('grid')) {
77
86
  if (style) {
78
- style = style.trim();
87
+ style = style.trim()
79
88
  if (style.startsWith('[')) {
80
- style = JSON.parse(style);
89
+ style = JSON.parse(style)
81
90
  }
82
- button.icon = style;
91
+ button.icon = style
83
92
  }
84
- retObject.grid.button.push(button);
93
+ retObject.grid.button.push(button)
85
94
  } else {
86
- if (style) button.style = style;
87
- retObject.button.push(button);
95
+ if (style) button.style = style
96
+ retObject.button.push(button)
88
97
  }
89
98
  })
90
99
 
91
- return retObject;
100
+ return retObject
92
101
  }
93
102
 
103
+ /**
104
+ * @description 렌더링
105
+ ***********************
106
+ */
94
107
  renderButtonConfigTab() {
95
108
  return html`
96
- <ox-grist auto-fetch id="button-tab-grid" .config=${this.buttonTabGridConfig} .mode='GRID'
97
- .fetchHandler=${this.fetchButtonConfigTabHandler.bind(this)}>
109
+ <ox-grist auto-fetch id="button-tab-grid" .config=${this.buttonTabGridConfig} .mode="GRID" .fetchHandler=${this.fetchButtonConfigTabHandler.bind(this)}>
98
110
  </ox-grist>
99
- `
111
+ `
100
112
  }
101
113
 
114
+ /**
115
+ * @description 버튼 탭 그리드 오브젝트 리턴
116
+ **************************************
117
+ */
102
118
  get buttonTabGrist() {
103
119
  return this.shadowRoot.querySelector('#button-tab-grid')
104
120
  }
105
121
 
122
+ /**
123
+ * @description 버튼 설정 탭 화면 관련 정보 추출
124
+ *****************************************
125
+ */
106
126
  async fetchButtonConfigTabHandler() {
107
127
  return {
108
128
  total: 0,
@@ -110,10 +130,11 @@ export const ButtonConfigTabMixin = (baseElement) => class extends baseElement {
110
130
  }
111
131
  }
112
132
 
113
-
114
-
133
+ /**
134
+ * @description 버튼 설정 탭 화면 관련 정보 설정
135
+ *****************************************
136
+ */
115
137
  setButtonConfigTabConfig() {
116
-
117
138
  // 그리드 설정
118
139
  this.buttonTabGridConfig = {
119
140
  rows: MetaApi.getGristSelectableConfig(true),
@@ -123,14 +144,16 @@ export const ButtonConfigTabMixin = (baseElement) => class extends baseElement {
123
144
  columns: [
124
145
  ...MetaApi.getGristGuttersConfig(false, false),
125
146
  {
126
- type: 'gutter', gutterName: 'button', icon: 'delete',
147
+ type: 'gutter',
148
+ gutterName: 'button',
149
+ icon: 'delete',
127
150
  handlers: {
128
151
  click: (_columns, _data, _column, record, _rowIndex) => {
129
152
  if (record.id) {
130
- this.deleteRow(this.buttonTabGrist, record);
153
+ this.deleteRow(this.buttonTabGrist, record)
131
154
  }
132
155
  }
133
- },
156
+ }
134
157
  },
135
158
  {
136
159
  type: 'string',
@@ -184,7 +207,7 @@ export const ButtonConfigTabMixin = (baseElement) => class extends baseElement {
184
207
  editable: false,
185
208
  mandatory: false,
186
209
  renderer: (value, column, record, rowIndex, field) => {
187
- let tLabel = record.label ? record.label : record.name;
210
+ let tLabel = record.label ? record.label : record.name
188
211
  return TermsUtil.tButton(tLabel)
189
212
  }
190
213
  }
@@ -225,11 +248,11 @@ export const ButtonConfigTabMixin = (baseElement) => class extends baseElement {
225
248
  editable: true,
226
249
  mandatory: true,
227
250
  options: [
228
- {value:'', display:''},
229
- {value:'R', display:'SELECT'},
230
- {value:'C', display:'CREATE'},
231
- {value:'U', display:'UPDATE'},
232
- {value:'D', display:'DELETE'}
251
+ { value: '', display: '' },
252
+ { value: 'R', display: 'SELECT' },
253
+ { value: 'C', display: 'CREATE' },
254
+ { value: 'U', display: 'UPDATE' },
255
+ { value: 'D', display: 'DELETE' }
233
256
  ]
234
257
  }
235
258
  },
@@ -246,87 +269,122 @@ export const ButtonConfigTabMixin = (baseElement) => class extends baseElement {
246
269
  renderer: (value, column, record, rowIndex, field) => {
247
270
  if (!record.logic) {
248
271
  if (record.type === 'basic') {
249
- delete record.logic;
272
+ delete record.logic
250
273
  } else if (record.type === 'custom') {
251
274
  let guide = {
252
- logic: JSON.stringify({
253
- open_popup: {
254
- "title": "menu.variables",
255
- "title_detail": "name",
256
- "type": "popup",
257
- "menu": "menu-routing",
258
- "tagname": "meta-grist-element",
259
- "location": "pages/meta-grist-element.js",
260
- "size": "large",
261
- "popup_field": "param_field",
262
- "parent_field": "id",
263
- "param": [
264
- "filter",
265
- "grist_one",
266
- "grist_selected",
267
- "grist_changed"
268
- ]
275
+ logic: JSON.stringify(
276
+ {
277
+ open_popup: {
278
+ title: 'menu.variables',
279
+ title_detail: 'name',
280
+ type: 'popup',
281
+ menu: 'menu-routing',
282
+ tagname: 'meta-grist-element',
283
+ location: 'pages/meta-grist-element.js',
284
+ size: 'large',
285
+ popup_field: 'param_field',
286
+ parent_field: 'id',
287
+ param: ['filter', 'grist_one', 'grist_selected', 'grist_changed']
288
+ },
289
+ graphql: {
290
+ "type": "graphql",
291
+ "graphql_type": "mutation",
292
+ "mutation_name": "updateDocTemplate",
293
+ "mutation_type": "id-data",
294
+ "id_field": "id",
295
+ "param_type": "DocTemplatePatch",
296
+ "param_name": "patch",
297
+ "return_fields": "id",
298
+ "param": ["grist_one"],
299
+ "data": {
300
+ "id": "$id",
301
+ "name": "$name",
302
+ "description": "$description",
303
+ "cuFlag": "M"
304
+ },
305
+ "after": "fetch"
306
+ },
307
+ call_scenario: {
308
+ type: 'scenario',
309
+ name: 'testScenario',
310
+ after: 'fetch',
311
+ param: ['filter', 'grist_all', 'grist_selected']
312
+ }
269
313
  },
270
- call_scenario: {
271
- "type": "scenario",
272
- "name": "testScenario",
273
- "after": "fetch",
274
- "param": [
275
- "filter",
276
- "grist_all",
277
- "grist_selected"
278
- ]
279
- }
280
- }, null, 2)
314
+ null,
315
+ 2
316
+ )
281
317
  }
282
- record.logic = guide;
318
+ record.logic = guide
283
319
  } else if (record.type === 'grid-basic') {
284
320
  let guide = {
285
321
  logic: '"record-view"'
286
322
  }
287
- record.logic = guide;
323
+ record.logic = guide
288
324
  } else if (record.type === 'grid-custom') {
289
325
  let guide = {
290
- logic: JSON.stringify({
291
- open_popup: {
292
- "title": "menu.variables",
293
- "title_detail": "name",
294
- "type": "popup",
295
- "menu": "menu-routing",
296
- "tagname": "meta-grist-element",
297
- "location": "pages/meta-grist-element.js",
298
- "size": "large",
299
- "popup_field": "param_field",
300
- "parent_field": "id",
326
+ logic: JSON.stringify(
327
+ {
328
+ open_popup: {
329
+ title: 'menu.variables',
330
+ title_detail: 'name',
331
+ type: 'popup',
332
+ menu: 'menu-routing',
333
+ tagname: 'meta-grist-element',
334
+ location: 'pages/meta-grist-element.js',
335
+ size: 'large',
336
+ popup_field: 'param_field',
337
+ parent_field: 'id'
338
+ },
339
+ open_form_popup: {
340
+ type: 'form',
341
+ title: 'title.detail',
342
+ title_detail: 'name',
343
+ size: 'large',
344
+ menu: 'operation-master'
345
+ },
346
+ graphql: {
347
+ "type": "graphql",
348
+ "graphql_type": "mutation",
349
+ "mutation_name": "updateDocTemplate",
350
+ "mutation_type": "id-data",
351
+ "id_field": "id",
352
+ "param_type": "DocTemplatePatch",
353
+ "param_name": "patch",
354
+ "return_fields": "id",
355
+ "param": ["grist_one"],
356
+ "data": {
357
+ "id": "$id",
358
+ "name": "$name",
359
+ "description": "$description",
360
+ "cuFlag": "M"
361
+ },
362
+ "after": "fetch"
363
+ },
364
+ call_scenario: {
365
+ type: 'scenario',
366
+ name: 'testScenario',
367
+ after: 'fetch'
368
+ }
301
369
  },
302
- open_form_popup: {
303
- "type": "form",
304
- "title": "title.detail",
305
- "title_detail": "name",
306
- "size": "large",
307
- "menu": "operation-master"
308
- },
309
- call_scenario: {
310
- "type": "scenario",
311
- "name": "testScenario",
312
- "after": "fetch"
313
- }
314
- }, null, 2)
370
+ null,
371
+ 2
372
+ )
315
373
  }
316
- record.logic = guide;
374
+ record.logic = guide
317
375
  } else {
318
- record.logic = undefined;
376
+ record.logic = undefined
319
377
  }
320
378
  } else {
321
379
  if (record.type === 'basic') {
322
- record.logic = undefined;
380
+ record.logic = undefined
323
381
  }
324
382
  }
325
383
  return getRenderer('json5')(value, column, record, rowIndex, field)
326
384
  },
327
385
  options: (value, column, record, row, field) => {
328
- var { name, help } = { name: TermsUtil.tLabel('logic'), help: '' };
329
- let spec = [{ label: 'script', name: 'logic', type: 'textarea' }];
386
+ var { name, help } = { name: TermsUtil.tLabel('logic'), help: '' }
387
+ let spec = [{ label: 'script', name: 'logic', type: 'textarea' }]
330
388
  const context = this.buttonTabGrist
331
389
  return { name, spec, help, context }
332
390
  }
@@ -335,5 +393,4 @@ export const ButtonConfigTabMixin = (baseElement) => class extends baseElement {
335
393
  ]
336
394
  }
337
395
  }
338
- }
339
-
396
+ }