@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.
@@ -1,307 +1,307 @@
1
- import { html } from 'lit-element'
1
+ import { html } from 'lit'
2
2
 
3
3
  import { TermsUtil } from '@things-factory/meta-ui/client/utils/terms-util'
4
4
  import { MetaApi } from '@things-factory/meta-ui/client/utils/meta-api'
5
5
 
6
+ export const GridEmphasizedConfigTabMixin = baseElement =>
7
+ class extends baseElement {
8
+ setGridEmphasizedConfigTabValues(data) {
9
+ // 1. 조회 데이터 설정
10
+ if (data) {
11
+ this.viewEmphasizedData = {
12
+ rowEmphasizedData: [],
13
+ columnEmphasizedData: []
14
+ }
6
15
 
7
- export const GridEmphasizedConfigTabMixin = (baseElement) => class extends baseElement {
8
-
9
- setGridEmphasizedConfigTabValues(data) {
10
- // 1. 조회 데이터 설정
11
- if (data) {
12
- this.viewEmphasizedData = {
13
- rowEmphasizedData: [],
14
- columnEmphasizedData: [],
15
- }
16
-
17
- let idx = 1;
18
- this.viewEmphasizedData.rowEmphasizedData
19
- = (data.row || []).map(x => {
16
+ let idx = 1
17
+ this.viewEmphasizedData.rowEmphasizedData = (data.row || []).map(x => {
20
18
  return {
21
19
  id: idx,
22
20
  rank: idx++,
23
21
  backgroundColor: x.backgroundColor || '',
24
22
  fontColor: x.fontColor || '',
25
- logic: x.logic || '',
26
- };
23
+ logic: x.logic || ''
24
+ }
27
25
  })
28
26
 
29
- idx = 1;
30
- let columnData = data.column || [];
31
- Object.keys(columnData).forEach(key => {
32
-
33
- let columnList = columnData[key] || [];
34
- let columnIdx = 1;
27
+ idx = 1
28
+ let columnData = data.column || []
29
+ Object.keys(columnData).forEach(key => {
30
+ let columnList = columnData[key] || []
31
+ let columnIdx = 1
35
32
 
36
- columnList.forEach(x=>{
37
- this.viewEmphasizedData.columnEmphasizedData.push({
38
- id: idx++,
39
- rank: columnIdx++,
40
- column: key,
41
- backgroundColor: x.backgroundColor || '',
42
- fontColor: x.fontColor || '',
43
- logic: x.logic || '',
33
+ columnList.forEach(x => {
34
+ this.viewEmphasizedData.columnEmphasizedData.push({
35
+ id: idx++,
36
+ rank: columnIdx++,
37
+ column: key,
38
+ backgroundColor: x.backgroundColor || '',
39
+ fontColor: x.fontColor || '',
40
+ logic: x.logic || ''
41
+ })
44
42
  })
45
43
  })
46
- })
47
-
48
44
 
49
- this.emphasizedConfigTabColumnEmphasizedGrist?.fetch();
50
- this.emphasizedConfigTabRowEmphasizedGrist?.fetch();
51
- } else {
52
- this.setGridEmphasizedConfigTabDefaultValues();
45
+ this.emphasizedConfigTabColumnEmphasizedGrist?.fetch()
46
+ this.emphasizedConfigTabRowEmphasizedGrist?.fetch()
47
+ } else {
48
+ this.setGridEmphasizedConfigTabDefaultValues()
49
+ }
53
50
  }
54
51
 
55
- }
56
-
57
- getGridEmphasizedConfigTabValues() {
58
- // 설정 데이터
59
- let rowGristData = this.getElementValueById('row-emphasized-grist');
60
- let columnGristData = this.getElementValueById('column-emphasized-grist');
52
+ getGridEmphasizedConfigTabValues() {
53
+ // 설정 데이터
54
+ let rowGristData = this.getElementValueById('row-emphasized-grist')
55
+ let columnGristData = this.getElementValueById('column-emphasized-grist')
61
56
 
62
- let rowEmphasized = [];
63
- this.sortRecordByRank(rowGristData)?.forEach(x=>{
64
- rowEmphasized.push({
65
- backgroundColor: x.backgroundColor,
66
- fontColor: x.fontColor,
67
- logic: x.logic
57
+ let rowEmphasized = []
58
+ this.sortRecordByRank(rowGristData)?.forEach(x => {
59
+ rowEmphasized.push({
60
+ backgroundColor: x.backgroundColor,
61
+ fontColor: x.fontColor,
62
+ logic: x.logic
63
+ })
68
64
  })
69
- })
70
65
 
71
- let columnEmphasized = {};
72
- this.sortRecordByRank(columnGristData)?.forEach(x=>{
73
- if(!columnEmphasized[x.column]){
74
- columnEmphasized[x.column] = [];
75
- }
66
+ let columnEmphasized = {}
67
+ this.sortRecordByRank(columnGristData)?.forEach(x => {
68
+ if (!columnEmphasized[x.column]) {
69
+ columnEmphasized[x.column] = []
70
+ }
76
71
 
77
- columnEmphasized[x.column].push({
78
- backgroundColor: x.backgroundColor,
79
- fontColor: x.fontColor,
80
- logic: x.logic
72
+ columnEmphasized[x.column].push({
73
+ backgroundColor: x.backgroundColor,
74
+ fontColor: x.fontColor,
75
+ logic: x.logic
76
+ })
81
77
  })
82
- })
83
-
84
- // 리턴 오브젝트로 가공
85
- let retObject = {
86
- gridEmphasized: {
87
- row: rowEmphasized || [],
88
- column: columnEmphasized || {}
89
- }
90
- };
91
-
92
- return retObject;
93
- }
94
78
 
95
- get emphasizedConfigTabRowEmphasizedGrist() {
96
- return this.shadowRoot.querySelector('#row-emphasized-grist')
97
- }
98
- get emphasizedConfigTabColumnEmphasizedGrist() {
99
- return this.shadowRoot.querySelector('#column-emphasized-grist')
100
- }
79
+ // 리턴 오브젝트로 가공
80
+ let retObject = {
81
+ gridEmphasized: {
82
+ row: rowEmphasized || [],
83
+ column: columnEmphasized || {}
84
+ }
85
+ }
101
86
 
87
+ return retObject
88
+ }
102
89
 
103
- setGridEmphasizedConfigTabConfig() {
90
+ get emphasizedConfigTabRowEmphasizedGrist() {
91
+ return this.shadowRoot.querySelector('#row-emphasized-grist')
92
+ }
93
+ get emphasizedConfigTabColumnEmphasizedGrist() {
94
+ return this.shadowRoot.querySelector('#column-emphasized-grist')
95
+ }
104
96
 
105
- // 1. 행 강조 그리드 설정
106
- this.rowEmphasizedConfig = {
107
- rows: MetaApi.getGristSelectableConfig(false),
108
- pagination: { infinite: true },
109
- appendable: true,
110
- columns: [
111
- ...MetaApi.getGristGuttersConfig(false, false),
112
- {
113
- type: 'gutter', gutterName: 'button', icon: 'delete',
114
- handlers: {
115
- click: (_columns, _data, _column, record, _rowIndex) => {
116
- if (record.id) {
117
- this.deleteRow(this.emphasizedConfigTabRowEmphasizedGrist, record);
97
+ setGridEmphasizedConfigTabConfig() {
98
+ // 1. 강조 그리드 설정
99
+ this.rowEmphasizedConfig = {
100
+ rows: MetaApi.getGristSelectableConfig(false),
101
+ pagination: { infinite: true },
102
+ appendable: true,
103
+ columns: [
104
+ ...MetaApi.getGristGuttersConfig(false, false),
105
+ {
106
+ type: 'gutter',
107
+ gutterName: 'button',
108
+ icon: 'delete',
109
+ handlers: {
110
+ click: (_columns, _data, _column, record, _rowIndex) => {
111
+ if (record.id) {
112
+ this.deleteRow(this.emphasizedConfigTabRowEmphasizedGrist, record)
113
+ }
118
114
  }
119
115
  }
120
116
  },
121
- },
122
- {
123
- type: 'string',
124
- name: 'id',
125
- hidden: true
126
- },
127
- {
128
- type: 'integer',
129
- name: 'rank',
130
- header: TermsUtil.tLabel('rank'),
131
- sortable: false,
132
- width: 55,
133
- record: {
134
- align: 'right',
135
- editable: true,
136
- mandatory: true
137
- }
138
- },
139
- {
140
- type: 'string',
141
- name: 'backgroundColor',
142
- header: TermsUtil.tLabel('background-color'),
143
- record: {
144
- align: 'left',
145
- editable: true,
146
- mandatory: true
117
+ {
118
+ type: 'string',
119
+ name: 'id',
120
+ hidden: true
147
121
  },
148
- width: 130
149
- },
150
- {
151
- type: 'string',
152
- name: 'fontColor',
153
- header: TermsUtil.tLabel('font-color'),
154
- record: {
155
- align: 'left',
156
- editable: true,
157
- mandatory: true
122
+ {
123
+ type: 'integer',
124
+ name: 'rank',
125
+ header: TermsUtil.tLabel('rank'),
126
+ sortable: false,
127
+ width: 55,
128
+ record: {
129
+ align: 'right',
130
+ editable: true,
131
+ mandatory: true
132
+ }
158
133
  },
159
- width: 130
160
- },
161
- {
162
- type: 'code-input',
163
- name: 'logic',
164
- header: TermsUtil.tLabel('logic'),
165
- record: {
166
- align: 'left',
167
- editable: true,
168
- mandatory: true
134
+ {
135
+ type: 'string',
136
+ name: 'backgroundColor',
137
+ header: TermsUtil.tLabel('background-color'),
138
+ record: {
139
+ align: 'left',
140
+ editable: true,
141
+ mandatory: true
142
+ },
143
+ width: 130
169
144
  },
170
- width: 850
171
- }
172
- ]
173
- };
145
+ {
146
+ type: 'string',
147
+ name: 'fontColor',
148
+ header: TermsUtil.tLabel('font-color'),
149
+ record: {
150
+ align: 'left',
151
+ editable: true,
152
+ mandatory: true
153
+ },
154
+ width: 130
155
+ },
156
+ {
157
+ type: 'code-input',
158
+ name: 'logic',
159
+ header: TermsUtil.tLabel('logic'),
160
+ record: {
161
+ align: 'left',
162
+ editable: true,
163
+ mandatory: true
164
+ },
165
+ width: 850
166
+ }
167
+ ]
168
+ }
174
169
 
175
- // 2. 컬럼 강조 그리드 설정
176
- this.columnEmphasizedConfig = {
177
- rows: MetaApi.getGristSelectableConfig(false),
178
- pagination: { infinite: true },
179
- appendable: true,
180
- columns: [
181
- ...MetaApi.getGristGuttersConfig(false, false),
182
- {
183
- type: 'gutter', gutterName: 'button', icon: 'delete',
184
- handlers: {
185
- click: (_columns, _data, _column, record, _rowIndex) => {
186
- if (record.id) {
187
- this.deleteRow(this.emphasizedConfigTabColumnEmphasizedGrist, record);
170
+ // 2. 컬럼 강조 그리드 설정
171
+ this.columnEmphasizedConfig = {
172
+ rows: MetaApi.getGristSelectableConfig(false),
173
+ pagination: { infinite: true },
174
+ appendable: true,
175
+ columns: [
176
+ ...MetaApi.getGristGuttersConfig(false, false),
177
+ {
178
+ type: 'gutter',
179
+ gutterName: 'button',
180
+ icon: 'delete',
181
+ handlers: {
182
+ click: (_columns, _data, _column, record, _rowIndex) => {
183
+ if (record.id) {
184
+ this.deleteRow(this.emphasizedConfigTabColumnEmphasizedGrist, record)
185
+ }
188
186
  }
189
187
  }
190
188
  },
191
- },
192
- {
193
- type: 'string',
194
- name: 'id',
195
- hidden: true
196
- },
197
- {
198
- type: 'integer',
199
- name: 'rank',
200
- header: TermsUtil.tLabel('rank'),
201
- sortable: false,
202
- width: 55,
203
- record: {
204
- align: 'right',
205
- editable: true,
206
- mandatory: true
207
- }
208
- },
209
- {
210
- type: 'string',
211
- name: 'column',
212
- header: TermsUtil.tLabel('column'),
213
- record: {
214
- align: 'left',
215
- editable: true,
216
- mandatory: true
189
+ {
190
+ type: 'string',
191
+ name: 'id',
192
+ hidden: true
217
193
  },
218
- width: 130
219
- },
220
- {
221
- type: 'string',
222
- name: 'backgroundColor',
223
- header: TermsUtil.tLabel('background-color'),
224
- record: {
225
- align: 'left',
226
- editable: true,
227
- mandatory: true
194
+ {
195
+ type: 'integer',
196
+ name: 'rank',
197
+ header: TermsUtil.tLabel('rank'),
198
+ sortable: false,
199
+ width: 55,
200
+ record: {
201
+ align: 'right',
202
+ editable: true,
203
+ mandatory: true
204
+ }
228
205
  },
229
- width: 130
230
- },
231
- {
232
- type: 'string',
233
- name: 'fontColor',
234
- header: TermsUtil.tLabel('font-color'),
235
- record: {
236
- align: 'left',
237
- editable: true,
238
- mandatory: true
206
+ {
207
+ type: 'string',
208
+ name: 'column',
209
+ header: TermsUtil.tLabel('column'),
210
+ record: {
211
+ align: 'left',
212
+ editable: true,
213
+ mandatory: true
214
+ },
215
+ width: 130
239
216
  },
240
- width: 130
241
- },
242
- {
243
- type: 'code-input',
244
- name: 'logic',
245
- header: TermsUtil.tLabel('logic'),
246
- record: {
247
- align: 'left',
248
- editable: true,
249
- mandatory: true
217
+ {
218
+ type: 'string',
219
+ name: 'backgroundColor',
220
+ header: TermsUtil.tLabel('background-color'),
221
+ record: {
222
+ align: 'left',
223
+ editable: true,
224
+ mandatory: true
225
+ },
226
+ width: 130
250
227
  },
251
- width: 725
252
- }
253
- ]
254
- };
255
- }
256
-
257
-
258
- setGridEmphasizedConfigTabDefaultValues() {
259
- if (!this.viewEmphasizedData) {
260
- this.viewEmphasizedData = {
261
- rowEmphasizedData: [],
262
- columnEmphasizedData: []
228
+ {
229
+ type: 'string',
230
+ name: 'fontColor',
231
+ header: TermsUtil.tLabel('font-color'),
232
+ record: {
233
+ align: 'left',
234
+ editable: true,
235
+ mandatory: true
236
+ },
237
+ width: 130
238
+ },
239
+ {
240
+ type: 'code-input',
241
+ name: 'logic',
242
+ header: TermsUtil.tLabel('logic'),
243
+ record: {
244
+ align: 'left',
245
+ editable: true,
246
+ mandatory: true
247
+ },
248
+ width: 725
249
+ }
250
+ ]
263
251
  }
264
252
  }
265
- }
266
253
 
254
+ setGridEmphasizedConfigTabDefaultValues() {
255
+ if (!this.viewEmphasizedData) {
256
+ this.viewEmphasizedData = {
257
+ rowEmphasizedData: [],
258
+ columnEmphasizedData: []
259
+ }
260
+ }
261
+ }
267
262
 
268
- // 화면
269
- renderGridEmphasizedConfigTab() {
270
- this.setGridEmphasizedConfigTabDefaultValues();
271
-
272
- let renderHtml = html`
273
- <div style='grid-template-rows: 50% 50%;display:grid;flex:1;'>
274
- <div field >
275
- <h2>
276
- <mwc-icon>list_alt</mwc-icon>${TermsUtil.tLabel('grid_row_emphasized_config')}
277
- </h2>
278
- <ox-grist id="row-emphasized-grist" .config=${this.rowEmphasizedConfig} .mode=${'GRID'} auto-fetch
279
- .fetchHandler=${this.fetchRowEmphasized.bind(this)}></ox-grist>
280
- </div>
281
- <div field >
282
- <h2>
283
- <mwc-icon>list_alt</mwc-icon>${TermsUtil.tLabel('grid_column_emphasized_config')}
284
- </h2>
285
- <ox-grist id="column-emphasized-grist" .config=${this.columnEmphasizedConfig} .mode=${'GRID'} auto-fetch
286
- .fetchHandler=${this.fetchColumnEmphasized.bind(this)}></ox-grist>
287
- </div>
288
- </div>
289
- `
290
- return renderHtml;
291
- }
263
+ // 화면
264
+ renderGridEmphasizedConfigTab() {
265
+ this.setGridEmphasizedConfigTabDefaultValues()
292
266
 
267
+ let renderHtml = html`
268
+ <div style="grid-template-rows: 50% 50%;display:grid;flex:1;">
269
+ <div field>
270
+ <h2><mwc-icon>list_alt</mwc-icon>${TermsUtil.tLabel('grid_row_emphasized_config')}</h2>
271
+ <ox-grist
272
+ id="row-emphasized-grist"
273
+ .config=${this.rowEmphasizedConfig}
274
+ .mode=${'GRID'}
275
+ auto-fetch
276
+ .fetchHandler=${this.fetchRowEmphasized.bind(this)}
277
+ ></ox-grist>
278
+ </div>
279
+ <div field>
280
+ <h2><mwc-icon>list_alt</mwc-icon>${TermsUtil.tLabel('grid_column_emphasized_config')}</h2>
281
+ <ox-grist
282
+ id="column-emphasized-grist"
283
+ .config=${this.columnEmphasizedConfig}
284
+ .mode=${'GRID'}
285
+ auto-fetch
286
+ .fetchHandler=${this.fetchColumnEmphasized.bind(this)}
287
+ ></ox-grist>
288
+ </div>
289
+ </div>
290
+ `
291
+ return renderHtml
292
+ }
293
293
 
294
- async fetchRowEmphasized() {
295
- return {
296
- records: this.viewEmphasizedData.rowEmphasizedData,
297
- total: 0
294
+ async fetchRowEmphasized() {
295
+ return {
296
+ records: this.viewEmphasizedData.rowEmphasizedData,
297
+ total: 0
298
+ }
298
299
  }
299
- }
300
300
 
301
- async fetchColumnEmphasized() {
302
- return {
303
- records: this.viewEmphasizedData.columnEmphasizedData,
304
- total: 0
301
+ async fetchColumnEmphasized() {
302
+ return {
303
+ records: this.viewEmphasizedData.columnEmphasizedData,
304
+ total: 0
305
+ }
305
306
  }
306
307
  }
307
- }