@things-factory/meta-ui 8.0.0 → 9.0.0-beta.3

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.
Files changed (115) hide show
  1. package/dist-client/tsconfig.tsbuildinfo +1 -1
  2. package/dist-client/utils/service-util.d.ts +2 -2
  3. package/dist-client/utils/service-util.js +4 -4
  4. package/dist-client/utils/service-util.js.map +1 -1
  5. package/dist-server/tsconfig.tsbuildinfo +1 -1
  6. package/package.json +24 -24
  7. package/client/bootstrap.ts +0 -170
  8. package/client/component/filter/filter-form-meta-code-select.ts +0 -102
  9. package/client/component/filter/filter-form-meta-object-select.ts +0 -107
  10. package/client/component/filter/filter-grist-meta-code-select.ts +0 -97
  11. package/client/component/filter/filter-grist-meta-object-select.ts +0 -102
  12. package/client/component/grist/editor/grist-editor-code-input.js +0 -96
  13. package/client/component/grist/editor/grist-editor-meta-code-selector.js +0 -157
  14. package/client/component/grist/editor/grist-editor-meta-object-selector.js +0 -122
  15. package/client/component/grist/renderer/grist-renderer-code-input.js +0 -20
  16. package/client/component/grist/renderer/grist-renderer-meta-code-selector.js +0 -28
  17. package/client/component/grist/renderer/grist-renderer-meta-object-selector.js +0 -25
  18. package/client/component/popup/code-input-editor-popup.js +0 -111
  19. package/client/component/popup/file-upload-popup.js +0 -129
  20. package/client/component/popup/meta-object-selector-popup.ts +0 -356
  21. package/client/component/popup/record-based-code-editor-popup.ts +0 -141
  22. package/client/dynamic-menus.ts +0 -38
  23. package/client/index.ts +0 -18
  24. package/client/load-components.ts +0 -17
  25. package/client/mixin/meta-base-mixin.js +0 -323
  26. package/client/mixin/meta-basic-grist-mixin.js +0 -283
  27. package/client/mixin/meta-button-mixin.js +0 -116
  28. package/client/mixin/meta-form-mixin.js +0 -435
  29. package/client/mixin/meta-grist-tab-mixin.js +0 -335
  30. package/client/mixin/meta-main-tab-mixin.js +0 -267
  31. package/client/mixin/meta-master-detail-mixin.js +0 -395
  32. package/client/mixin/meta-service-mixin.js +0 -306
  33. package/client/mixin/meta-tab-detail-mixin.js +0 -283
  34. package/client/mixin/meta-tab-mixin.js +0 -190
  35. package/client/pages/activity/meta-activity-define-page.js +0 -422
  36. package/client/pages/activity/meta-activity-list-page.js +0 -262
  37. package/client/pages/activity/meta-activity-viewer-element.js +0 -35
  38. package/client/pages/activity/meta-activity-writer-element.js +0 -48
  39. package/client/pages/activity/meta-activiy-mixin.js +0 -79
  40. package/client/pages/button-role/button-role-detail.js +0 -50
  41. package/client/pages/button-role/button-role-page.js +0 -25
  42. package/client/pages/doc-number/doc-number-page.js +0 -24
  43. package/client/pages/doc-number/next-doc-number-popup.js +0 -25
  44. package/client/pages/entity/config-entity.js +0 -955
  45. package/client/pages/entity/main-menu-selector.js +0 -245
  46. package/client/pages/history/history-copy-list-popup.js +0 -145
  47. package/client/pages/history/history-json-list-popup.js +0 -159
  48. package/client/pages/menu/dynamic-menu-template.js +0 -92
  49. package/client/pages/menu/dynamic-menu.ts +0 -744
  50. package/client/pages/menu/export-menu-popup.js +0 -468
  51. package/client/pages/meta-form-element.js +0 -9
  52. package/client/pages/meta-grist-element.js +0 -12
  53. package/client/pages/meta-grist-page.js +0 -16
  54. package/client/pages/meta-grist-tab-element.js +0 -16
  55. package/client/pages/meta-grist-tab-page.js +0 -16
  56. package/client/pages/meta-main-tab-element.js +0 -12
  57. package/client/pages/meta-main-tab-page.js +0 -16
  58. package/client/pages/meta-master-detail-element.js +0 -12
  59. package/client/pages/meta-master-detail-page.js +0 -16
  60. package/client/pages/meta-tab-detail-element.js +0 -12
  61. package/client/pages/meta-tab-detail-page.js +0 -16
  62. package/client/pages/meta-tab-element.js +0 -15
  63. package/client/pages/printer-device/printer-device-page.js +0 -24
  64. package/client/pages/template/doc-template-page.js +0 -24
  65. package/client/pages/template/template-file-page.js +0 -24
  66. package/client/pages/terms/config-terminology.js +0 -214
  67. package/client/pages/work-code/work-code-detail-popup.js +0 -16
  68. package/client/pages/work-code/work-code-page.js +0 -23
  69. package/client/route.ts +0 -36
  70. package/client/tsconfig.json +0 -13
  71. package/client/utils/grist-default-value.js +0 -36
  72. package/client/utils/meta-api.js +0 -811
  73. package/client/utils/meta-crypto.js +0 -52
  74. package/client/utils/meta-ui-util.js +0 -3304
  75. package/client/utils/rest-service-util.js +0 -328
  76. package/client/utils/service-util.js +0 -1327
  77. package/client/utils/terms-util.ts +0 -119
  78. package/client/utils/ui-util.js +0 -338
  79. package/client/utils/value-util.js +0 -234
  80. package/server/activity/CommonActivity.ts +0 -68
  81. package/server/index.ts +0 -3
  82. package/server/routes.ts +0 -61
  83. package/server/service/button-role/button-role-mutation.ts +0 -105
  84. package/server/service/button-role/button-role-query.ts +0 -53
  85. package/server/service/button-role/button-role-type.ts +0 -39
  86. package/server/service/button-role/button-role.ts +0 -61
  87. package/server/service/button-role/index.ts +0 -7
  88. package/server/service/dynamic-menu/dynamic-menu-query.ts +0 -270
  89. package/server/service/dynamic-menu/dynamic-menu-type.ts +0 -74
  90. package/server/service/dynamic-menu/index.ts +0 -3
  91. package/server/service/entity-event-subscriber/entity-event-subscriber.ts +0 -80
  92. package/server/service/entity-event-subscriber/index.ts +0 -3
  93. package/server/service/index.ts +0 -41
  94. package/server/service/menu-button-auth/index.ts +0 -7
  95. package/server/service/menu-button-auth/menu-button-auth-mutation.ts +0 -133
  96. package/server/service/menu-button-auth/menu-button-auth-query.ts +0 -138
  97. package/server/service/menu-button-auth/menu-button-auth-type.ts +0 -63
  98. package/server/service/menu-button-auth/menu-button-auth.ts +0 -92
  99. package/server/service/meta-activity/index.ts +0 -5
  100. package/server/service/meta-activity/meta-activity-mutation.ts +0 -191
  101. package/server/service/meta-activity/meta-activity-query.ts +0 -43
  102. package/server/service/meta-activity/meta-activity-type.ts +0 -56
  103. package/server/service/set-translations/index.ts +0 -3
  104. package/server/service/set-translations/set-translation-resolver.ts +0 -63
  105. package/server/service/work-code/index.ts +0 -6
  106. package/server/service/work-code/work-code-mutation.ts +0 -147
  107. package/server/service/work-code/work-code-query.ts +0 -67
  108. package/server/service/work-code/work-code-type.ts +0 -60
  109. package/server/service/work-code/work-code.ts +0 -83
  110. package/server/service/work-code-detail/index.ts +0 -6
  111. package/server/service/work-code-detail/work-code-detail-mutation.ts +0 -149
  112. package/server/service/work-code-detail/work-code-detail-query.ts +0 -59
  113. package/server/service/work-code-detail/work-code-detail-type.ts +0 -50
  114. package/server/service/work-code-detail/work-code-detail.ts +0 -82
  115. package/server/tsconfig.json +0 -9
@@ -1,119 +0,0 @@
1
- import { i18next } from '@operato/i18n'
2
-
3
- /**
4
- * @license
5
- * Copyright © HatioLab Inc. All rights reserved.
6
- * @author Shortstop <shortstop@hatiolab.com>
7
- * @description 용어 처리 유틸리티
8
- */
9
- export class TermsUtil {
10
- /**
11
- * @description 라벨 (필드) labelName을 다국어 변환하여 리턴
12
- ***********************************************
13
- * @param {String} labelName
14
- * @param {Object} params
15
- * @returns 번역된 라벨 (필드) 명
16
- */
17
- static tLabel(labelName: string, params?: any) {
18
- let labelValue = TermsUtil.translate('label', labelName, params)
19
- return labelValue ? labelValue : TermsUtil.translate('field', labelName, params, labelName)
20
- }
21
-
22
- /**
23
- * @description 필드 fieldName을 다국어 변환하여 리턴
24
- ***********************************************
25
- * @param {String} fieldName
26
- * @param {Object} params
27
- * @returns 번역된 필드 명
28
- */
29
- static tField(fieldName: string, params?: any) {
30
- let fieldValue = TermsUtil.translate('field', fieldName, params)
31
- return fieldValue ? fieldValue : TermsUtil.translate('field', fieldName, params, fieldName)
32
- }
33
-
34
- /**
35
- * @description 버튼 buttonName을 다국어 변환하여 리턴
36
- ***********************************************
37
- * @param {String} buttonName
38
- * @returns 번역된 버튼 명
39
- */
40
- static tButton(buttonName: string) {
41
- return TermsUtil.translate('button', buttonName, null, buttonName)
42
- }
43
-
44
- /**
45
- * @description 타이틀 titleName을 다국어 변환하여 리턴
46
- ***********************************************
47
- * @param {String} titleName
48
- * @param {Object} params
49
- * @returns 번역된 타이틀 명
50
- */
51
- static tTitle(titleName: string, params?: any) {
52
- let titleValue = TermsUtil.translate('title', titleName, params)
53
- return titleValue ? titleValue : TermsUtil.translate('menu', titleName, params, titleName)
54
- }
55
-
56
- /**
57
- * @description 메뉴 menuName을 다국어 변환하여 리턴
58
- ***********************************************
59
- * @param {String} menuName
60
- * @returns 번역된 메뉴 명
61
- */
62
- static tMenu(menuName: string) {
63
- let menuValue = TermsUtil.translate('menu', menuName, null)
64
- return menuValue ? menuValue : TermsUtil.translate('title', menuName, null, menuName)
65
- }
66
-
67
- /**
68
- * @description 텍스트 textName을 다국어 변환하여 리턴
69
- ***********************************************
70
- * @param {String} textName
71
- * @param {Object} params
72
- * @returns 번역된 텍스트 값
73
- */
74
- static tText(textName: string, params?: any) {
75
- return TermsUtil.translate('text', textName, params, textName)
76
- }
77
-
78
- /**
79
- * @description 에러 errorName을 다국어 변환하여 리턴
80
- ***********************************************
81
- * @param {String} errorName
82
- * @param {Object} params
83
- * @returns 번역된 에러 메시지
84
- */
85
- static tError(errorName: string, params?: any) {
86
- return TermsUtil.translate('error', errorName, params, errorName)
87
- }
88
-
89
- /**
90
- * @description termKey로 다국어 변환하여 parameters로 파라미터 처리하여 리턴, 변환값이 없다면 defaultValue 리턴, defaultValue가 없다면 null 리턴
91
- ***********************************************
92
- * @param {String} termCategory 용어 카테고리 (label, field, title, menu, button, text, error, ...)
93
- * @param {String} termName 용어 이름
94
- * @param {Object} parameters 용어 이름에 파라미터가 있는 경우 파라미터 치환 처리할 오브젝트 데이터 {key1 : value1, key2 : value2} 형식 ...
95
- * @param {String} defaultValue
96
- * @returns termKey 다국어 변환 값
97
- */
98
- static translate(termCategory: string, termName: string, parameters?: any, defaultValue?: string): string {
99
- return i18next.t(`${termCategory}.${termName}`, {
100
- ...parameters,
101
- defaultValue: defaultValue || termName
102
- }) as string
103
- }
104
-
105
- /**
106
- * @description termKey로 다국어 변환하여 parameters로 파라미터 처리하여 리턴, 변환값이 없다면 defaultValue 리턴, defaultValue가 없다면 null 리턴
107
- ***********************************************
108
- * @param {String} termKey 용어 키 : {용어 카테고리}'.'{용어 이름}
109
- * @param {Object} parameters 용어 이름에 파라미터가 있는 경우 파라미터 치환 처리할 오브젝트 데이터 {key1 : value1, key2 : value2} 형식 ...
110
- * @param {String} defaultValue
111
- * @returns termKey 다국어 변환 값
112
- */
113
- static t(termKey: string, parameters: any, defaultValue: string): string {
114
- return i18next.t(termKey, {
115
- ...parameters,
116
- defaultValue: defaultValue || termKey
117
- }) as string
118
- }
119
- }
@@ -1,338 +0,0 @@
1
- import { store, CustomAlert, navigate } from '@things-factory/shell'
2
-
3
- import { openPopup } from '@operato/layout'
4
- import { closePopup } from '@operato/popup'
5
- import { isMobileDevice } from '@operato/utils'
6
- import { getEditor } from '@operato/data-grist'
7
-
8
- import { TermsUtil } from './terms-util'
9
- import { ValueUtil } from './value-util'
10
-
11
- /**
12
- * @license
13
- * Copyright © HatioLab Inc. All rights reserved.
14
- * @author Shortstop <shortstop@hatiolab.com>
15
- * @description UI 관련 유틸리티 함수 정의
16
- */
17
- export class UiUtil {
18
- /**
19
- * @description 현재 디바이스가 모바일 장비인지 체크
20
- **************************************
21
- * @returns {Boolean} 모바일 장비 여부
22
- */
23
- static isMobileEnv() {
24
- return isMobileDevice()
25
- }
26
-
27
- /**
28
- * @description 현재 로케일 정보 리턴
29
- **************************************
30
- * @returns {String} 현재 브라우저의 로케일 정보
31
- */
32
- static currentLocale() {
33
- let cookie = document.cookie
34
- cookie = cookie.substring(cookie.indexOf('i18next'))
35
- if (cookie.indexOf(';') > -1) {
36
- cookie = cookie.substring(0, cookie.indexOf(';'))
37
- }
38
- cookie = cookie.replace('i18next=', '')
39
- if (cookie == 'ko') return 'ko-KR'
40
- else return cookie
41
- }
42
-
43
- /**
44
- * @description 최종 애플리케이션 모듈 정보 리턴
45
- *****************************************
46
- * @returns {Object} 최종 애플리케이션 모듈
47
- */
48
- static getApplicationModuleInfo() {
49
- let modules = store.getState().app.modules
50
- return modules[modules.length - 1]
51
- }
52
-
53
- /**
54
- * @description 현재 액티브 된 화면의 라우팅 정보
55
- **************************************
56
- * @returns {String} 현재 액티브 된 화면의 라우팅 정보
57
- */
58
- static currentRouting() {
59
- return store.getState().route.page
60
- }
61
-
62
- /**
63
- * @description popup 닫기
64
- ************************
65
- * @param {HTML} popup
66
- */
67
- static closePopupBy(popup) {
68
- closePopup(popup)
69
- }
70
-
71
- /**
72
- * @description 오픈하고자 하는 엘리먼트를 받아 팝업 오픈
73
- *************************************************
74
- * @param {String} popupTitle 팝업 타이틀
75
- * @param {String} popupSize 팝업 사이즈 ex) 'large', 'medium', 'small'
76
- * @param {HTMLElement} element 팝업에 표시할 엘리먼트
77
- * @param {Boolean} backdrop 백드롭 여부
78
- * @param {String} help help 파일 경로
79
- * @returns {Object} popup
80
- */
81
- static openPopupByElement(popupTitle, popupSize, element, backdrop, help = '') {
82
- if (popupSize === 'full') {
83
- element.style.height = '95dvh'
84
- }
85
-
86
- return openPopup(element, {
87
- backdrop: true,
88
- hovering: popupSize === 'full' ? 'edge' : 'center',
89
- size: popupSize === 'full' ? 'large' : popupSize,
90
- title: popupTitle,
91
- backdrop: backdrop,
92
- help: help
93
- })
94
- }
95
-
96
- /**
97
- * @description popupConfig에 포함된 element 정보를 이용해 팝업을 연다
98
- **************************************************************
99
- * @param {String} title 팝업 타이틀
100
- * @param {Object} popupConfig 팝업 구성을 위한 설정 정보 ex) { module: '', location: '', tagname: '', size : '', popup_field: '', parent_field: ''}
101
- * @param {Object} paramData 팝업에 넘겨 줄 파라미터
102
- * @param {Function} popupCloseCallback 팝업 닫을 때 실행되기 위한 콜백 함수
103
- */
104
- static async openDynamicPopup(title, popupConfig, paramData, popupCloseCallback) {
105
- // 부모 필드
106
- let parentValue = ValueUtil.isNotEmpty(popupConfig.parent_field)
107
- ? ValueUtil.getParams(paramData, ...popupConfig.parent_field.split('.'))
108
- : undefined
109
-
110
- // 팝업 엘리먼트 생성
111
- let htmlText = `<${popupConfig.tagname} route_name='${popupConfig.menu}' parent_id='${parentValue}' is_popup=true></${popupConfig.tagname}>`
112
- let htmlElements = UiUtil.htmlToElement(htmlText)
113
- htmlElements.config = popupConfig
114
-
115
- // 파라미터 설정
116
- if (ValueUtil.isNotEmpty(popupConfig.popup_field)) {
117
- htmlElements[popupConfig.popup_field] = paramData
118
- }
119
-
120
- // 팝업 오픈
121
- let popup = UiUtil.openPopupByElement(title, popupConfig.size, htmlElements, true, popupConfig.help)
122
-
123
- // 팝업 클로즈 핸들러
124
- if (popupCloseCallback) {
125
- popup.onclosed = popupCloseCallback
126
- }
127
- }
128
-
129
- /**
130
- * @description tagname, routing으로 커스텀 엘리먼트 생성
131
- ****************************************************
132
- * @param {String} tagname 팝업에 포함할 태그 명
133
- * @param {String} routing 라우팅
134
- * @returns {HTMLElement} 커스텀 엘리먼트
135
- */
136
- static createCustomElement(tagname, routing) {
137
- let htmlStr = `<${tagname} route_name='${routing}'></${tagname}>`
138
- return UiUtil.htmlToElement(htmlStr)
139
- }
140
-
141
- /**
142
- * @description HTML 문자열을 elements로 변환
143
- **************************************
144
- * @param {String} htmlString html 문자열
145
- * @returns {HTMLElement} 커스텀 엘리먼트
146
- */
147
- static htmlToElement(htmlString) {
148
- var template = document.createElement('template')
149
- template.innerHTML = htmlString
150
- var elements = template.content.childNodes
151
- var element = elements[0]
152
- template.content.removeChild(element)
153
- return element
154
- }
155
-
156
- /**
157
- * @description 페이지 이동
158
- **************************************
159
- * @param {String} url 페이지 URL (route 값)
160
- * @param {Object} params 페이지 파라미터, null 가능
161
- */
162
- static pageNavigate(url, params) {
163
- let paramStr = params ? '?' : ''
164
-
165
- if (params) {
166
- paramStr += 'pass=' + JSON.stringify(params)
167
- }
168
-
169
- navigate(`${url}${paramStr}`)
170
- }
171
-
172
- /**
173
- * @description store의 정보 추출
174
- ****************************************************
175
- * @param {String} accessor1 스토어 액세서 1, 빈 값 가능
176
- * @param {String} accessor2 스토어 액세서 2, 빈 값 가능
177
- * @param {String} accessor3 스토어 액세서 3, 빈 값 가능
178
- * @returns {Object} store 정보
179
- */
180
- static getStore(accessor1, accessor2, accessor3) {
181
- let store = store.getState()
182
-
183
- if (accessor1 && accessor2 && accessor3) {
184
- return store[accessor1][accessor2][accessor3]
185
- } else if (accessor1 && accessor2) {
186
- return store[accessor1][accessor2]
187
- } else if (accessor1) {
188
- return store[accessor1]
189
- } else {
190
- return store
191
- }
192
- }
193
-
194
- /**
195
- * @description 커스텀 이벤트 전파
196
- *************************************
197
- * @param {String} eventName 이벤트 이름
198
- * @param {Object} eventDetail 이벤트 상세 정보
199
- */
200
- static fireCustomEvent(eventName, eventDetail) {
201
- document.dispatchEvent(
202
- new CustomEvent(eventName, {
203
- detail: eventDetail
204
- })
205
- )
206
- }
207
-
208
- /**
209
- * @description 토스트 메시지 표시
210
- *************************************
211
- * @param {String} type 토스트 타입
212
- * @param {String} message 메시지
213
- */
214
- static showToast(type, message) {
215
- document.dispatchEvent(
216
- new CustomEvent('notify', {
217
- detail: { type, message }
218
- })
219
- )
220
- }
221
-
222
- /**
223
- * @description Alert 메시지 창 표시
224
- *************************************
225
- * @param {String} titleCode Alert 제목 표시를 위한 용어 이름, 예) title.confirm
226
- * @param {String} textCode Alert 텍스트 표시를 위한 용어 이름 예) text.are_you_sure
227
- * @param {String} type Alert 창 유형 - info, error, warning ...
228
- * @param {String} confirmButtonCode 확인 버튼 표시를 위한 용어 이름 예) confirm
229
- * @param {String} [cancelButtonCode] 취소 버튼 표시를 위한 용어 이름 예) cancel
230
- * @returns {Object} Alert 팝업
231
- */
232
- static async showAlertPopup(titleCode, textCode, type, confirmButtonCode, cancelButtonCode) {
233
- let popupTitle = TermsUtil.t(titleCode) || titleCode
234
- let popupText = TermsUtil.t(textCode) || textCode
235
- let alert = { title: popupTitle, text: popupText }
236
-
237
- if (type) {
238
- alert['type'] = type
239
- }
240
-
241
- if (confirmButtonCode) {
242
- alert['confirmButton'] = TermsUtil.tButton(confirmButtonCode)
243
- }
244
-
245
- if (cancelButtonCode) {
246
- alert['cancelButton'] = TermsUtil.tButton(cancelButtonCode)
247
- }
248
-
249
- return await CustomAlert(alert)
250
- }
251
-
252
- /**
253
- * @description 필터 폼 내의 에디터들이 가지고 있는 값을 키-값 형태로 추출
254
- *******************************************************
255
- * @param {Object} filterForm 그리드 필터 폼
256
- * @returns {Object} 필터 폼 내의 에디터들이 가지고 있는 값을 키-값 형태로 추출
257
- */
258
- static getFilterFormData(filterForm) {
259
- let formValues = {}
260
-
261
- if (ValueUtil.isNotEmpty(filterForm)) {
262
- let filters = filterForm.filters()
263
-
264
- if (ValueUtil.isNotEmpty(filters)) {
265
- filters.forEach(f => {
266
- if (ValueUtil.isNotEmpty(f.value)) {
267
- item[f.name] = f.value ? f.value : null
268
- }
269
- })
270
- }
271
- }
272
-
273
- return formValues
274
- }
275
-
276
- /**
277
- * @description name으로 필터 폼 내 에디터를 찾아 값을 셋팅
278
- *****************************************************
279
- * @param {Object} filterForm 그리스트 필터 폼
280
- * @param {String} name 그리스트 필터 폼 내 에디터의 이름
281
- * @param {Object} value 설정할 값
282
- */
283
- static setSearchFormEditorValue(filterForm, name, value) {
284
- if (ValueUtil.isNotEmpty(filterForm)) {
285
- let editor = filterForm.renderRoot?.querySelector(`[name='${name}']`)
286
-
287
- if (ValueUtil.isNotEmpty(editor)) {
288
- editor.value = value
289
- }
290
- }
291
- }
292
-
293
- /**
294
- * @description 파라미터를 기준으로 유형에 맞는 에디터를 생성한다.
295
- ******************************************************
296
- * @param {String} editorType 에디터 유형
297
- * @param {Object} column 컬럼 Object
298
- * @param {Object} record 레코드 Object
299
- * @param {Number} rowIndex 추가할 열 Index
300
- * @returns {HTMLElement} HTML 에디터
301
- */
302
- static createEditorHtml(editorType, column, record, rowIndex) {
303
- return getEditor(editorType)('', column, record, rowIndex, {})
304
- }
305
-
306
- /**
307
- * @description 에디터에 값을 설정한다.
308
- *********************************
309
- * @param {Object} editor 에디터
310
- * @param {String} newValue 설정할 값
311
- */
312
- static setValueToEditor(editor, newValue) {
313
- let input = UiUtil.getLeafInput(editor)
314
- input.value = newValue
315
- }
316
-
317
- /**
318
- * @description 엘리먼트 내 최 하단 Input Element를 추출
319
- ************************************************
320
- * @param {Object} editor 에디터
321
- * @returns {HTMLElement} 엘리먼트 내 최 하단 Input Element
322
- */
323
- static getLeafInput(editor) {
324
- let editorType = editor.getType()
325
-
326
- if (editorType == 'code-editor') {
327
- return editor.renderRoot.querySelector('ox-input-code')
328
- } else if (editorType == 'textarea') {
329
- return editor.renderRoot.querySelector('textarea')
330
- } else if (editorType == 'select-combo') {
331
- return editor.renderRoot.querySelector('ox-select').firstElementChild
332
- } else if (editorType == 'barcode') {
333
- return editor.renderRoot.querySelector('ox-input-barcode').renderRoot.querySelector('input')
334
- } else {
335
- return editor.renderRoot.firstElementChild.editor
336
- }
337
- }
338
- }
@@ -1,234 +0,0 @@
1
- import isEqual from 'lodash-es/isEqual'
2
-
3
- import { TermsUtil } from './terms-util'
4
-
5
- /**
6
- * @license
7
- * Copyright © HatioLab Inc. All rights reserved.
8
- * @author Shortstop <shortstop@hatiolab.com>
9
- * @description 데이터 핸들링 관련 유틸리티 함수 정의
10
- */
11
- export class ValueUtil {
12
- /**
13
- * @description object, string, number, array 빈 값 여부 검사
14
- **********************************************************
15
- * @param {Object} value
16
- * @returns {Boolean}
17
- */
18
- static isEmpty(value) {
19
- if (value === undefined) {
20
- return true
21
- } else if (value === null) {
22
- return true
23
- } else if (typeof value === 'boolean') {
24
- return false
25
- } else if (typeof value === 'string' || typeof value === 'number') {
26
- if (value == '') return true
27
- } else if (Array.isArray(value)) {
28
- if (value.length == 0) return true
29
- } else if (typeof value === 'object') {
30
- if (Object.keys(value).length == 0) return true
31
- }
32
-
33
- return false
34
- }
35
-
36
- /**
37
- * @description object, string, number, array 빈 값이 아닌지 여부 검사
38
- *****************************************************************
39
- * @param {Object} value
40
- * @returns {Boolean}
41
- */
42
- static isNotEmpty(value) {
43
- return !ValueUtil.isEmpty(value)
44
- }
45
-
46
- /**
47
- * @description 두 객체가 동일한지 비교
48
- **********************************
49
- * @param {*} data1
50
- * @param {*} data2
51
- * @returns
52
- */
53
- static isEquals(data1, data2) {
54
- return isEqual(data1, data2)
55
- }
56
-
57
- /**
58
- * @description 값을 정수로 변환
59
- **********************************
60
- * @param {*} value
61
- * @param {*} defaultValue
62
- * @returns
63
- */
64
- static toInteger(value, defaultValue) {
65
- return ValueUtil.isEmpty(value) ? (defaultValue ? defaultValue : 0) : parseInt(value)
66
- }
67
-
68
- /**
69
- * @description 값을 Boolean으로 변환
70
- **********************************
71
- * @param {String} value
72
- * @returns
73
- */
74
- static toBoolean(value) {
75
- return ValueUtil.isEmpty(value) ? false : value == 'true' || value == 't' || value == 'TRUE' || value == 'T' || value == 'on' || value == 'ON'
76
- }
77
-
78
- /**
79
- * @description config, data의 key 값을 비교해 결과를 리턴한다.
80
- * 값에 * 는 체크하지 않는다.
81
- ****************************************
82
- * @param {Object} config
83
- * @param {Object} data
84
- * @param {String || Array} keys
85
- * @returns
86
- */
87
- static compareObjectValues(config, data, keys) {
88
- let isEquals = true
89
-
90
- keys.forEach(key => {
91
- let compareValue = config[key]
92
-
93
- if (compareValue === '*') {
94
- return
95
- }
96
-
97
- let recordValue = data[key] || ''
98
-
99
- if (ValueUtil.isEmpty(compareValue)) {
100
- if (ValueUtil.isNotEmpty(recordValue)) {
101
- isEquals = false
102
- }
103
- } else {
104
- if (compareValue != recordValue) {
105
- isEquals = false
106
- }
107
- }
108
-
109
- if (!isEquals) {
110
- return
111
- }
112
- })
113
-
114
- return isEquals
115
- }
116
-
117
- /**
118
- * @description dataObject 에서 key 값을 찾아 isTransMsg 옵션을 적용해 retObjct에 반영한다.
119
- **********************************************************************************
120
- * @param {Object} retObj
121
- * @param {Object} dataObj
122
- * @param {String} key
123
- * @param {Boolean} isTransMsg
124
- * @returns
125
- */
126
- static setParams(retObj, dataObj, key, isTransMsg) {
127
- let value = ValueUtil.getParams(dataObj, key)
128
-
129
- if (ValueUtil.isNotEmpty(value)) {
130
- retObj[key] = isTransMsg === true ? TermsUtil.t(value) : value
131
- }
132
-
133
- return retObj
134
- }
135
-
136
- /**
137
- * @description data에서 key(Array)를 찾아 리턴
138
- ********************************************
139
- * @param {Object} data
140
- * @param {...String} keys
141
- * @returns
142
- */
143
- static getParams(data, ...keys) {
144
- // probably same as followings
145
- // return lodash.get(data, keys.join('.'))
146
-
147
- // keys 파라미터가 없으면 return
148
- if (arguments.length <= 1) {
149
- return undefined
150
- }
151
-
152
- let key = keys[0]
153
- // data 에 key가 없으면 return
154
- if (ValueUtil.isEmpty(data[key])) {
155
- return undefined
156
- }
157
-
158
- let paramData = data[key]
159
- if (keys.length > 1) {
160
- // 현재 이후에 키가 더 있으면 재귀 호출
161
- return ValueUtil.getParams(paramData, ...keys.slice(1))
162
- } else {
163
- return paramData
164
- }
165
- }
166
-
167
- /**
168
- * @description sourceList에 존재하는 오브젝트의 keys 필드들을 targetList로 복사
169
- ***********************************************************************
170
- * @param {Array} sourceList
171
- * @param {Array} targetList
172
- * @param {...String} keys
173
- * @returns {Array} 복사한 객체 리스트
174
- */
175
- static populateArray(sourceList, targetList, ...keys) {
176
- targetList = targetList || []
177
- keys = keys || Object.keys(sourceList)
178
-
179
- if (ValueUtil.isNotEmpty(keys)) {
180
- targetList = sourceList.map((source, index) => {
181
- let target = targetList.length > index ? targetList[index] : {}
182
- return ValueUtil.populateObject(source, target, keys)
183
- })
184
- }
185
-
186
- return targetList
187
- }
188
-
189
- /**
190
- * @description source에 존재하는 keys 필드들을 target으로 복사
191
- ********************************************************
192
- * @param {Object} source
193
- * @param {Object} target
194
- * @param {...String} keys
195
- * @returns {Object} 복사한 객체
196
- */
197
- static populateObject(source, target, ...keys) {
198
- target = target || {}
199
- keys = keys || Object.keys(source)
200
-
201
- if (ValueUtil.isNotEmpty(keys)) {
202
- keys.forEach(key => {
203
- target[key] = source[key]
204
- })
205
- }
206
-
207
- return target
208
- }
209
-
210
- /**
211
- * @description source에 존재하는 keys 필드들을 target으로 복사
212
- ********************************************************
213
- * @param {Object} sourceObj
214
- * @param {Object} targetObj
215
- * @returns {Object} 복사한 객체
216
- */
217
- static replaceVariableObject(sourceObj, targetObj) {
218
- let objKeys = Object.keys(sourceObj)
219
- let targetKeys = Object.keys(targetObj)
220
-
221
- objKeys.forEach(key => {
222
- let value = sourceObj[key]
223
-
224
- if (typeof value == 'string' && value.startsWith('$')) {
225
- let valueFieldName = value.replace('$', '')
226
- if (targetKeys.includes(valueFieldName)) {
227
- sourceObj[key] = targetObj[valueFieldName]
228
- }
229
- }
230
- })
231
-
232
- return sourceObj
233
- }
234
- }