@things-factory/meta-ui 5.0.0 → 5.0.1
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/terms/config-terminology.js +108 -105
- package/package.json +3 -3
|
@@ -1,17 +1,15 @@
|
|
|
1
|
+
import gql from 'graphql-tag'
|
|
1
2
|
import { css, html } from 'lit-element'
|
|
2
3
|
|
|
3
|
-
import {
|
|
4
|
-
import { client, CustomAlert, PageView } from '@things-factory/shell'
|
|
4
|
+
import { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'
|
|
5
5
|
import { i18next, localize } from '@things-factory/i18n-base'
|
|
6
|
+
import { client, CustomAlert, PageView } from '@things-factory/shell'
|
|
6
7
|
import { isMobileDevice } from '@things-factory/utils'
|
|
7
8
|
|
|
8
|
-
import { TermsUtil } from './../../utils/terms-util'
|
|
9
9
|
import { MetaUtil } from '../../utils/meta-util'
|
|
10
|
-
|
|
11
|
-
import gql from 'graphql-tag'
|
|
10
|
+
import { TermsUtil } from '../../utils/terms-util'
|
|
12
11
|
|
|
13
12
|
class ConfigTerminology extends localize(i18next)(PageView) {
|
|
14
|
-
|
|
15
13
|
static get properties() {
|
|
16
14
|
return {
|
|
17
15
|
gridMode: String,
|
|
@@ -25,49 +23,57 @@ class ConfigTerminology extends localize(i18next)(PageView) {
|
|
|
25
23
|
CommonGristStyles,
|
|
26
24
|
ScrollbarStyles,
|
|
27
25
|
css`
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
26
|
+
:host {
|
|
27
|
+
display: flex;
|
|
28
|
+
flex-direction: column;
|
|
29
|
+
overflow-x: auto;
|
|
30
|
+
background-color: var(--main-section-background-color);
|
|
31
|
+
}
|
|
32
|
+
ox-grist {
|
|
33
|
+
overflow-y: auto;
|
|
34
|
+
flex: 1;
|
|
35
|
+
}
|
|
36
|
+
`
|
|
37
|
+
]
|
|
39
38
|
}
|
|
40
39
|
|
|
41
|
-
connectedCallback(){
|
|
42
|
-
if(super.connectedCallback){
|
|
43
|
-
super.connectedCallback()
|
|
40
|
+
connectedCallback() {
|
|
41
|
+
if (super.connectedCallback) {
|
|
42
|
+
super.connectedCallback()
|
|
44
43
|
}
|
|
45
44
|
}
|
|
46
45
|
|
|
47
|
-
// 화면
|
|
46
|
+
// 화면
|
|
48
47
|
render() {
|
|
49
48
|
return html`
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
49
|
+
<ox-grist
|
|
50
|
+
id="ox-grist"
|
|
51
|
+
.config=${this.gridConfig}
|
|
52
|
+
.mode=${this.gridMode}
|
|
53
|
+
auto-fetch
|
|
54
|
+
.fetchHandler=${this.fetchHandler.bind(this)}
|
|
55
|
+
>
|
|
56
|
+
<div slot="headroom">
|
|
57
|
+
<div id="filters">
|
|
58
|
+
<ox-filters-form autofocus></ox-filters-form>
|
|
59
|
+
</div>
|
|
60
|
+
<div id="sorters">
|
|
61
|
+
<mwc-icon
|
|
62
|
+
@click=${e => {
|
|
63
|
+
const target = e.currentTarget
|
|
64
|
+
this.renderRoot.querySelector('#sorter-control').open({
|
|
65
|
+
right: 0,
|
|
66
|
+
top: target.offsetTop + target.offsetHeight
|
|
67
|
+
})
|
|
68
|
+
}}
|
|
69
|
+
>sort</mwc-icon
|
|
70
|
+
>
|
|
71
|
+
<ox-popup id="sorter-control">
|
|
72
|
+
<ox-sorters-control> </ox-sorters-control>
|
|
73
|
+
</ox-popup>
|
|
69
74
|
</div>
|
|
70
|
-
</
|
|
75
|
+
</div>
|
|
76
|
+
</ox-grist>
|
|
71
77
|
`
|
|
72
78
|
}
|
|
73
79
|
|
|
@@ -89,14 +95,14 @@ class ConfigTerminology extends localize(i18next)(PageView) {
|
|
|
89
95
|
}
|
|
90
96
|
}
|
|
91
97
|
|
|
92
|
-
get grist(){
|
|
98
|
+
get grist() {
|
|
93
99
|
return this.shadowRoot.querySelector('ox-grist')
|
|
94
100
|
}
|
|
95
101
|
|
|
96
102
|
/**
|
|
97
|
-
* 조회
|
|
98
|
-
* @param {Object} param0
|
|
99
|
-
* @returns
|
|
103
|
+
* 조회
|
|
104
|
+
* @param {Object} param0
|
|
105
|
+
* @returns
|
|
100
106
|
*/
|
|
101
107
|
async fetchHandler({ page, limit, sorters = [], filters = [] }) {
|
|
102
108
|
const response = await client.query({
|
|
@@ -113,7 +119,8 @@ class ConfigTerminology extends localize(i18next)(PageView) {
|
|
|
113
119
|
}
|
|
114
120
|
total
|
|
115
121
|
}
|
|
116
|
-
}
|
|
122
|
+
}
|
|
123
|
+
`,
|
|
117
124
|
variables: {
|
|
118
125
|
filters: filters,
|
|
119
126
|
pagination: { page, limit },
|
|
@@ -122,25 +129,25 @@ class ConfigTerminology extends localize(i18next)(PageView) {
|
|
|
122
129
|
})
|
|
123
130
|
|
|
124
131
|
if (response.errors) {
|
|
125
|
-
return
|
|
132
|
+
return
|
|
126
133
|
}
|
|
127
134
|
|
|
128
135
|
return {
|
|
129
136
|
total: response.data.terminologies.total || 0,
|
|
130
137
|
records: response.data.terminologies.items || []
|
|
131
|
-
}
|
|
138
|
+
}
|
|
132
139
|
}
|
|
133
|
-
|
|
140
|
+
|
|
134
141
|
/**
|
|
135
142
|
* Create Update Multiple
|
|
136
143
|
*/
|
|
137
144
|
async save() {
|
|
138
145
|
const patches = this.getPatches()
|
|
139
146
|
if (patches && patches.length) {
|
|
140
|
-
const response = await this.mutationGql(patches)
|
|
147
|
+
const response = await this.mutationGql(patches)
|
|
141
148
|
if (!response.errors) this.grist.fetch()
|
|
142
149
|
} else {
|
|
143
|
-
// 그리드에서 선택 정보 없음
|
|
150
|
+
// 그리드에서 선택 정보 없음
|
|
144
151
|
CustomAlert({
|
|
145
152
|
title: TermsUtil.tText('nothing_changed'),
|
|
146
153
|
text: TermsUtil.tText('there_is_nothing_to_save')
|
|
@@ -149,15 +156,15 @@ class ConfigTerminology extends localize(i18next)(PageView) {
|
|
|
149
156
|
}
|
|
150
157
|
|
|
151
158
|
/**
|
|
152
|
-
* Delete
|
|
159
|
+
* Delete
|
|
153
160
|
*/
|
|
154
161
|
async delete() {
|
|
155
162
|
const patches = this.grist.selected.map(record => {
|
|
156
163
|
record.cuFlag = '-'
|
|
157
|
-
return record
|
|
164
|
+
return record
|
|
158
165
|
})
|
|
159
166
|
if (patches && patches.length > 0) {
|
|
160
|
-
// Question
|
|
167
|
+
// Question
|
|
161
168
|
const anwer = await CustomAlert({
|
|
162
169
|
type: 'warning',
|
|
163
170
|
title: TermsUtil.tButton('delete'),
|
|
@@ -168,10 +175,10 @@ class ConfigTerminology extends localize(i18next)(PageView) {
|
|
|
168
175
|
|
|
169
176
|
if (!anwer.value) return
|
|
170
177
|
|
|
171
|
-
const response = await this.mutationGql(patches)
|
|
178
|
+
const response = await this.mutationGql(patches)
|
|
172
179
|
if (!response.errors) this.grist.fetch()
|
|
173
180
|
} else {
|
|
174
|
-
// 그리드에서 선택 정보 없음
|
|
181
|
+
// 그리드에서 선택 정보 없음
|
|
175
182
|
CustomAlert({
|
|
176
183
|
title: TermsUtil.tText('nothing_selected'),
|
|
177
184
|
text: TermsUtil.tText('there_is_nothing_to_delete')
|
|
@@ -180,68 +187,65 @@ class ConfigTerminology extends localize(i18next)(PageView) {
|
|
|
180
187
|
}
|
|
181
188
|
|
|
182
189
|
async mutationGql(patches) {
|
|
183
|
-
for(let i = 0
|
|
184
|
-
let terminology = patches[i]
|
|
185
|
-
let mutationGql = ''
|
|
186
|
-
let variables = {}
|
|
187
|
-
|
|
188
|
-
if(terminology.cuFlag == '+') {
|
|
190
|
+
for (let i = 0; i < patches.length; i++) {
|
|
191
|
+
let terminology = patches[i]
|
|
192
|
+
let mutationGql = ''
|
|
193
|
+
let variables = {}
|
|
194
|
+
|
|
195
|
+
if (terminology.cuFlag == '+') {
|
|
189
196
|
mutationGql = gql`
|
|
190
|
-
mutation ($terminology: NewTerminology!){
|
|
191
|
-
createTerminology(terminology: $terminology){
|
|
197
|
+
mutation ($terminology: NewTerminology!) {
|
|
198
|
+
createTerminology(terminology: $terminology) {
|
|
192
199
|
id
|
|
193
200
|
}
|
|
194
201
|
}
|
|
195
202
|
`
|
|
196
|
-
delete terminology.cuFlag
|
|
197
|
-
variables.terminology = terminology
|
|
198
|
-
|
|
199
|
-
} else if (terminology.cuFlag == 'M'){
|
|
203
|
+
delete terminology.cuFlag
|
|
204
|
+
variables.terminology = terminology
|
|
205
|
+
} else if (terminology.cuFlag == 'M') {
|
|
200
206
|
mutationGql = gql`
|
|
201
207
|
mutation ($name: String!, $patch: TerminologyPatch!) {
|
|
202
|
-
updateTerminology(name: $name, patch: $patch){
|
|
208
|
+
updateTerminology(name: $name, patch: $patch) {
|
|
203
209
|
id
|
|
204
210
|
}
|
|
205
211
|
}
|
|
206
212
|
`
|
|
207
213
|
|
|
208
|
-
variables.name = terminology.orgName
|
|
209
|
-
|
|
210
|
-
delete terminology.cuFlag;
|
|
211
|
-
delete terminology.id;
|
|
212
|
-
delete terminology.orgName;
|
|
214
|
+
variables.name = terminology.orgName
|
|
213
215
|
|
|
214
|
-
|
|
216
|
+
delete terminology.cuFlag
|
|
217
|
+
delete terminology.id
|
|
218
|
+
delete terminology.orgName
|
|
215
219
|
|
|
216
|
-
|
|
220
|
+
variables.patch = terminology
|
|
221
|
+
} else if (terminology.cuFlag == '-') {
|
|
217
222
|
mutationGql = gql`
|
|
218
223
|
mutation ($name: String!) {
|
|
219
|
-
deleteTerminology(name: $name){
|
|
224
|
+
deleteTerminology(name: $name) {
|
|
220
225
|
id
|
|
221
226
|
}
|
|
222
227
|
}
|
|
223
228
|
`
|
|
224
229
|
|
|
225
|
-
variables.name = terminology.name
|
|
230
|
+
variables.name = terminology.name
|
|
226
231
|
}
|
|
227
|
-
|
|
232
|
+
|
|
228
233
|
const response = await client.query({
|
|
229
234
|
query: mutationGql,
|
|
230
235
|
context: {
|
|
231
|
-
|
|
236
|
+
hasUpload: true
|
|
232
237
|
},
|
|
233
238
|
variables: variables
|
|
234
239
|
})
|
|
235
240
|
|
|
236
|
-
if(response.errors) return response
|
|
241
|
+
if (response.errors) return response
|
|
237
242
|
}
|
|
238
243
|
|
|
239
|
-
return {}
|
|
244
|
+
return {}
|
|
240
245
|
}
|
|
241
246
|
|
|
242
|
-
|
|
243
247
|
/**
|
|
244
|
-
* 그리드 에서 변경, 추가 된 내용 가져오기
|
|
248
|
+
* 그리드 에서 변경, 추가 된 내용 가져오기
|
|
245
249
|
* @returns {Array}
|
|
246
250
|
*/
|
|
247
251
|
getPatches() {
|
|
@@ -257,8 +261,8 @@ class ConfigTerminology extends localize(i18next)(PageView) {
|
|
|
257
261
|
}
|
|
258
262
|
patchField.cuFlag = terms.__dirty__
|
|
259
263
|
|
|
260
|
-
if(patchField.cuFlag == 'M'){
|
|
261
|
-
if(dirtyFields.name){
|
|
264
|
+
if (patchField.cuFlag == 'M') {
|
|
265
|
+
if (dirtyFields.name) {
|
|
262
266
|
patchField.orgName = dirtyFields.name.before
|
|
263
267
|
} else {
|
|
264
268
|
patchField.orgName = terms.name
|
|
@@ -272,28 +276,27 @@ class ConfigTerminology extends localize(i18next)(PageView) {
|
|
|
272
276
|
return patches
|
|
273
277
|
}
|
|
274
278
|
|
|
275
|
-
|
|
276
279
|
/**
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
+
* LifeCycle
|
|
281
|
+
* 화면 레더링 설정
|
|
282
|
+
*/
|
|
280
283
|
async pageInitialized() {
|
|
281
|
-
this.gridMode = isMobileDevice()? 'LIST':
|
|
282
|
-
|
|
283
|
-
// 공통 코드 로케일 조회
|
|
284
|
-
let locales = await MetaUtil.getCodeSelectorData('LOCALE')
|
|
284
|
+
this.gridMode = isMobileDevice() ? 'LIST' : 'GRID'
|
|
285
|
+
|
|
286
|
+
// 공통 코드 로케일 조회
|
|
287
|
+
let locales = await MetaUtil.getCodeSelectorData('LOCALE')
|
|
285
288
|
|
|
286
|
-
// 공통 코드 카테고리 조회
|
|
287
|
-
let categories = await MetaUtil.getCodeSelectorData('TERMS_CATEGORY')
|
|
289
|
+
// 공통 코드 카테고리 조회
|
|
290
|
+
let categories = await MetaUtil.getCodeSelectorData('TERMS_CATEGORY')
|
|
288
291
|
|
|
289
|
-
// 그리드 설정
|
|
292
|
+
// 그리드 설정
|
|
290
293
|
this.gridConfig = {
|
|
291
294
|
rows: MetaUtil.getGristSelectableConfig(true),
|
|
292
295
|
pagination: MetaUtil.getGristPagination50Config(),
|
|
293
|
-
sorters:[{ name: 'updatedAt', desc: true }],
|
|
296
|
+
sorters: [{ name: 'updatedAt', desc: true }],
|
|
294
297
|
appendable: true,
|
|
295
298
|
columns: [
|
|
296
|
-
...
|
|
299
|
+
...MetaUtil.getGristGuttersDefaultConfig(true),
|
|
297
300
|
{
|
|
298
301
|
type: 'string',
|
|
299
302
|
name: 'id',
|
|
@@ -308,7 +311,7 @@ class ConfigTerminology extends localize(i18next)(PageView) {
|
|
|
308
311
|
sortable: true,
|
|
309
312
|
width: 100,
|
|
310
313
|
filter: {
|
|
311
|
-
operator:'eq'
|
|
314
|
+
operator: 'eq'
|
|
312
315
|
}
|
|
313
316
|
},
|
|
314
317
|
{
|
|
@@ -319,7 +322,7 @@ class ConfigTerminology extends localize(i18next)(PageView) {
|
|
|
319
322
|
sortable: true,
|
|
320
323
|
width: 100,
|
|
321
324
|
filter: {
|
|
322
|
-
operator:'eq'
|
|
325
|
+
operator: 'eq'
|
|
323
326
|
}
|
|
324
327
|
},
|
|
325
328
|
{
|
|
@@ -328,13 +331,13 @@ class ConfigTerminology extends localize(i18next)(PageView) {
|
|
|
328
331
|
header: TermsUtil.tLabel('name'),
|
|
329
332
|
record: {
|
|
330
333
|
editable: true,
|
|
331
|
-
mandatory: true,
|
|
334
|
+
mandatory: true,
|
|
332
335
|
align: 'left'
|
|
333
336
|
},
|
|
334
337
|
sortable: true,
|
|
335
338
|
width: 250,
|
|
336
339
|
filter: {
|
|
337
|
-
operator:'i_like'
|
|
340
|
+
operator: 'i_like'
|
|
338
341
|
}
|
|
339
342
|
},
|
|
340
343
|
{
|
|
@@ -343,13 +346,13 @@ class ConfigTerminology extends localize(i18next)(PageView) {
|
|
|
343
346
|
header: TermsUtil.tLabel('display'),
|
|
344
347
|
record: {
|
|
345
348
|
editable: true,
|
|
346
|
-
mandatory: true,
|
|
349
|
+
mandatory: true,
|
|
347
350
|
align: 'left'
|
|
348
351
|
},
|
|
349
352
|
sortable: true,
|
|
350
353
|
width: 250,
|
|
351
354
|
filter: {
|
|
352
|
-
operator:'i_like'
|
|
355
|
+
operator: 'i_like'
|
|
353
356
|
}
|
|
354
357
|
},
|
|
355
358
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/meta-ui",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.1",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"migration:create": "node ../../node_modules/typeorm/cli.js migration:create -d ./server/migrations"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@things-factory/shell": "^5.0.
|
|
27
|
+
"@things-factory/shell": "^5.0.1"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "47225f76058999bb8bb075ac960cfb24f058093f"
|
|
30
30
|
}
|