@things-factory/meta-ui 7.0.1-alpha.65 → 7.0.1-alpha.67

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.
@@ -27,15 +27,15 @@ class DynamicMenu extends localize(i18next)(PageView) {
27
27
  /**
28
28
  * @description 마스터 페이지 개인화 서비스 제공자
29
29
  ***************************
30
- * @type {Object}
31
- */
30
+ * @type {Object}
31
+ */
32
32
  masterPersonalConfigProvider: Object,
33
33
 
34
34
  /**
35
35
  * @description 디테일 페이지 개인화 서비스 제공자
36
36
  ***************************
37
- * @type {Object}
38
- */
37
+ * @type {Object}
38
+ */
39
39
  detailPersonalConfigProvider: Object
40
40
  }
41
41
  }
@@ -165,6 +165,12 @@ class DynamicMenu extends localize(i18next)(PageView) {
165
165
  name
166
166
  routing
167
167
  }
168
+ privilege {
169
+ privilege
170
+ category
171
+ owner
172
+ super
173
+ }
168
174
  `
169
175
 
170
176
  limit = 999999
@@ -207,6 +213,12 @@ class DynamicMenu extends localize(i18next)(PageView) {
207
213
  routing
208
214
  hiddenFlag
209
215
  iconPath
216
+ privilege {
217
+ privilege
218
+ category
219
+ owner
220
+ super
221
+ }
210
222
  `
211
223
  limit = 999999
212
224
  return await MetaApi.searchByPagination('dynamicMenus', filters, sorters, page, limit, selectFields)
@@ -248,10 +260,13 @@ class DynamicMenu extends localize(i18next)(PageView) {
248
260
  * 메뉴 Create / Update
249
261
  */
250
262
  async saveMenu() {
251
- let patches = MetaApi.patchesForUpdateMultiple(this.detailGrist)
263
+ var patches = this.detailGrist.dirtyRecords
252
264
 
253
265
  if (ValueUtil.isNotEmpty(patches)) {
254
- patches.forEach(patch => {
266
+ patches = patches.map(patch => {
267
+ const { creator, updater, createdAt, updatedAt, __dirty__, __dirtyfields__, __origin__, __seq__, __selected__, ...others } = patch
268
+
269
+ patch = others
255
270
  patch.menuType = patch.menuType || 'SCREEN'
256
271
 
257
272
  if (!patch.parentId) {
@@ -265,6 +280,10 @@ class DynamicMenu extends localize(i18next)(PageView) {
265
280
  if (patch.hiddenFlag === undefined || patch.hiddenFlag == null) {
266
281
  patch.hiddenFlag = false
267
282
  }
283
+
284
+ patch.cuFlag = __dirty__
285
+
286
+ return patch
268
287
  })
269
288
 
270
289
  let result = await MetaApi.updateMultiple('updateMultipleMenu', patches)
@@ -435,7 +454,18 @@ class DynamicMenu extends localize(i18next)(PageView) {
435
454
  MetaApi.getGristColumnConfig2('boolean', 'hiddenFlag', 'hidden', 'center', true, false, 55),
436
455
  MetaApi.getGristColumnConfig2('string', 'routing', 'routing', 'left', true, false, 135),
437
456
  MetaApi.getGristColumnConfig2('string', 'category', 'tag', 'left', true, false, 135),
438
- MetaApi.getGristColumnConfig2('string', 'resourceUrl', 'page_location', 'left', true, false, 350)
457
+ MetaApi.getGristColumnConfig2('string', 'resourceUrl', 'page_location', 'left', true, false, 350),
458
+ {
459
+ type: 'privilege',
460
+ name: 'privilege',
461
+ label: true,
462
+ header: i18next.t('field.required privilege'),
463
+ record: {
464
+ editable: true
465
+ },
466
+ sortable: true,
467
+ width: 200
468
+ }
439
469
  ]
440
470
  }
441
471
 
@@ -618,6 +648,17 @@ class DynamicMenu extends localize(i18next)(PageView) {
618
648
  }
619
649
  },
620
650
  width: 200
651
+ },
652
+ {
653
+ type: 'privilege',
654
+ name: 'privilege',
655
+ label: true,
656
+ header: i18next.t('field.required privilege'),
657
+ record: {
658
+ editable: true
659
+ },
660
+ sortable: true,
661
+ width: 200
621
662
  }
622
663
  /*{
623
664
  type: 'meta-code-selector',
@@ -1,6 +1,5 @@
1
1
  import '@material/web/icon/icon.js'
2
2
  import '@operato/data-grist/ox-record-creator.js'
3
- // import '@things-factory/personalization/dist-client/grid-preference-editor.js'
4
3
 
5
4
  import { css, html, render, nothing } from 'lit'
6
5
 
@@ -59,38 +58,6 @@ export class MetaUiUtil {
59
58
  * @returns {Object} 메뉴 메타 정보 (암호)
60
59
  */
61
60
  static async getMenuMetaData(menuRouting) {
62
- // var response = await client.query({
63
- // query: gql`
64
- // query ($id: String) {
65
- // metaUITemplateIsOverLimit(id: $id)
66
- // }
67
- // `,
68
- // variables: { id: null}
69
- // })
70
-
71
- // if (response.errors) {
72
- // return undefined;
73
- // }
74
-
75
- // const response = await client.query({
76
- // query: gql`
77
- // query ($routing: String) {
78
- // menus(routing: $routing) {
79
- // id
80
- // template
81
- // }
82
-
83
- // myGridPersonalize(menuId: $menuId) {
84
- // id
85
- // template
86
- // }
87
- // }
88
- // `,
89
- // variables: {
90
- // routing: menuRouting
91
- // }
92
- // })
93
-
94
61
  let filters = [{ name: 'routing', operator: 'eq', value: menuRouting }]
95
62
  let data = await ServiceUtil.searchByPagination('menus', filters, null, 0, 0, 'id,template')
96
63
  return data
@@ -940,32 +907,6 @@ export class MetaUiUtil {
940
907
  return columns
941
908
  }
942
909
 
943
- // 개인 그리드 컬럼 설정 가져오기
944
- // let personal = await MetaApi.getMyMenuGridPersnal(this.menuId)
945
- // let { template = {} } = personal
946
- // if (!template.master) {
947
- // // 설정이 없으면 그대로 리턴
948
- // return columns
949
- // }
950
-
951
- // let personCols = template.master
952
- // // 개인 컬럼만 보이기
953
- // columns = columns.map(x => {
954
- // // id는 제외
955
- // if (x.name == 'id') return x
956
- // x.hidden = !personCols.includes(x.name)
957
- // x.rank = personCols.indexOf(x.name)
958
- // if (x.rank == -1) {
959
- // x.rank = 99999
960
- // }
961
- // return x
962
- // })
963
-
964
- // // 개인 컬럼 순서 정렬
965
- // columns.sort((a, b) => {
966
- // return a.rank - b.rank
967
- // })
968
-
969
910
  return columns
970
911
  }
971
912
 
@@ -2060,31 +2001,6 @@ export class MetaUiUtil {
2060
2001
  ]
2061
2002
  }
2062
2003
 
2063
- /**
2064
- * @description 그리스트 개인화 스타일 리턴
2065
- *************************************
2066
- * @returns {Array} 그리스트 개인화 스타일 css
2067
- */
2068
- // static getGristPersonalizedStyles() {
2069
- // return [
2070
- // css`
2071
- // [slot='setting'] {
2072
- // --md-icon-size: 14px;
2073
- // width: 16px;
2074
- // height: 16px;
2075
- // background-color: rgba(var(--secondary-color-rgb), 0.6);
2076
- // border-radius: 0px 0px 7px 7px;
2077
- // color: var(--theme-white-color);
2078
- // cursor: pointer;
2079
- // }
2080
-
2081
- // [slot='setting']:hover {
2082
- // color: var(--primary-color);
2083
- // }
2084
- // `
2085
- // ]
2086
- // }
2087
-
2088
2004
  /**
2089
2005
  * @description 기본 그리스트 스타일 리턴
2090
2006
  ************************************
@@ -2114,7 +2030,6 @@ export class MetaUiUtil {
2114
2030
  `,
2115
2031
  ...MetaUiUtil.getGristEmphasizedStyles(),
2116
2032
  ...MetaUiUtil.getCustomButtonContainerStyles()
2117
- // ...MetaUiUtil.getGristPersonalizedStyles()
2118
2033
  ]
2119
2034
  }
2120
2035
 
@@ -2186,7 +2101,6 @@ export class MetaUiUtil {
2186
2101
  `,
2187
2102
  ...MetaUiUtil.getGristEmphasizedStyles(),
2188
2103
  ...MetaUiUtil.getCustomButtonContainerStyles()
2189
- // ...MetaUiUtil.getGristPersonalizedStyles()
2190
2104
  ]
2191
2105
  }
2192
2106
 
@@ -2258,7 +2172,6 @@ export class MetaUiUtil {
2258
2172
  `,
2259
2173
  ...MetaUiUtil.getGristEmphasizedStyles(),
2260
2174
  ...MetaUiUtil.getCustomButtonContainerStyles()
2261
- // ...MetaUiUtil.getGristPersonalizedStyles()
2262
2175
  ]
2263
2176
  }
2264
2177
 
@@ -2330,7 +2243,6 @@ export class MetaUiUtil {
2330
2243
  `,
2331
2244
  ...MetaUiUtil.getGristEmphasizedStyles(),
2332
2245
  ...MetaUiUtil.getCustomButtonContainerStyles()
2333
- // ...MetaUiUtil.getGristPersonalizedStyles()
2334
2246
  ]
2335
2247
  }
2336
2248
 
@@ -2369,7 +2281,6 @@ export class MetaUiUtil {
2369
2281
  `,
2370
2282
  ...MetaUiUtil.getGristEmphasizedStyles(),
2371
2283
  ...MetaUiUtil.getCustomButtonContainerStyles()
2372
- // ...MetaUiUtil.getGristPersonalizedStyles()
2373
2284
  ]
2374
2285
  }
2375
2286
 
@@ -3339,42 +3250,6 @@ export class MetaUiUtil {
3339
3250
  `
3340
3251
  }
3341
3252
 
3342
- /**
3343
- * @description 그리드 컬럼 개인화 팝업 버튼을 그린다.
3344
- **********************************************
3345
- * @param {Object} pageView 페이지 뷰
3346
- * @return {HTMLElement} 그리드 컬럼 개인화 팝업 버튼 HTML
3347
- */
3348
- // static getGridColumnPersonalizeButton(pageView) {
3349
- // if (pageView.gridMode != 'GRID') {
3350
- // return html``
3351
- // }
3352
-
3353
- // if (pageView.is_activity !== true) {
3354
- // return html`
3355
- // <md-icon
3356
- // slot="setting"
3357
- // @click=${e => {
3358
- // const page = pageView.lifecycle?.page
3359
-
3360
- // if (page) {
3361
- // let element = MetaApi.createCustomElement('grid-preference-editor', 'grid-preference-editor')
3362
- // element.target = e.currentTarget.closest('ox-grist')
3363
- // element.page = page
3364
-
3365
- // MetaApi.openPopupByElement(TermsUtil.tTitle('grid-column-personalize'), 'midium', element, false)
3366
- // } else {
3367
- // console.error('page is not found.')
3368
- // }
3369
- // }}
3370
- // >settings</md-icon
3371
- // >
3372
- // `
3373
- // } else {
3374
- // return html``
3375
- // }
3376
- // }
3377
-
3378
3253
  /**
3379
3254
  * @description 그리드 보기 옵션 버튼을 그린다.
3380
3255
  ****************************************
@@ -188,33 +188,6 @@ export class ServiceUtil {
188
188
  return menuItems != null ? ServiceUtil.arrangeMenuRoutes(menuItems) : null
189
189
  }
190
190
 
191
- /**
192
- * @description 현재 사용자, 메뉴에 해당 하는 그리드 개인화 정보 조회
193
- **********************************************************
194
- * @returns {Object} 그리드 개인화 오브젝트
195
- */
196
- // static async getMyMenuGridPersnal(menuId) {
197
- // try {
198
- // const response = await client.query({
199
- // query: gql`
200
- // query myGridPersonalize($menuId: String!) {
201
- // myGridPersonalize(menuId: $menuId) {
202
- // id
203
- // template
204
- // }
205
- // }
206
- // `,
207
- // variables: {
208
- // menuId
209
- // }
210
- // })
211
-
212
- // return response.data.myGridPersonalize
213
- // } catch (e) {
214
- // ServiceUtil.showGraphqlException(e)
215
- // }
216
- // }
217
-
218
191
  /**
219
192
  * @description 메뉴 틀에 맞게 재 배치
220
193
  **************************************
@@ -363,51 +336,61 @@ export class ServiceUtil {
363
336
  * @returns {Array} 메뉴 바에 표시될 메뉴 리스트
364
337
  */
365
338
  static async searchMyDynamicMenus() {
366
- let filters = [
367
- {
368
- name: 'hiddenFlag',
369
- operator: 'noteq',
370
- value: true
371
- },
372
- {
373
- // name: 'menuType', operator: 'in', value: ['HOME', 'MENU', 'GROUP', 'SCREEN', 'HIDDEN-PAGE']
374
- name: 'menuType',
375
- operator: 'in',
376
- value: ['HOME', 'MENU', 'GROUP']
377
- }
378
- ]
379
- // let sortings = [{ name: 'menuType' }, { name: 'rank' }];
380
- let sortings = [{ name: 'rank' }]
381
- let selectFields = `
382
- id
383
- parent {
384
- id
385
- name
386
- }
387
- children{
388
- id
389
- name
390
- description
391
- menuType
392
- category
393
- routingType
394
- routing
395
- resourceUrl
396
- iconPath
397
- hiddenFlag
398
- rank
339
+ const response = await client.query({
340
+ query: gql`
341
+ query MyMenus($sortings: [Sorting!], $filters: [Filter!]) {
342
+ myMenus(sortings: $sortings, filters: $filters) {
343
+ items {
344
+ id
345
+ parent {
346
+ id
347
+ name
348
+ }
349
+ children(permittedOnly: true) {
350
+ id
351
+ name
352
+ description
353
+ menuType
354
+ category
355
+ routingType
356
+ routing
357
+ resourceUrl
358
+ iconPath
359
+ hiddenFlag
360
+ rank
361
+ }
362
+ name
363
+ description
364
+ menuType
365
+ category
366
+ routingType
367
+ routing
368
+ resourceUrl
369
+ iconPath
370
+ }
371
+ total
372
+ }
373
+ }
374
+ `,
375
+ variables: {
376
+ filters: [
377
+ {
378
+ name: 'hiddenFlag',
379
+ operator: 'noteq',
380
+ value: true
381
+ },
382
+ {
383
+ // name: 'menuType', operator: 'in', value: ['HOME', 'MENU', 'GROUP', 'SCREEN', 'HIDDEN-PAGE']
384
+ name: 'menuType',
385
+ operator: 'in',
386
+ value: ['HOME', 'MENU', 'GROUP']
387
+ }
388
+ ],
389
+ sortings: [{ name: 'rank' }]
399
390
  }
400
- name
401
- description
402
- menuType
403
- category
404
- routingType
405
- routing
406
- resourceUrl
407
- iconPath
408
- `
409
- let data = await ServiceUtil.searchByPagination('menus', filters, sortings, 0, 0, selectFields)
410
- return data ? data.records : []
391
+ })
392
+
393
+ return response.data?.myMenus.items || []
411
394
  }
412
395
 
413
396
  /**
@@ -1,3 +1,4 @@
1
+ import { __rest } from "tslib";
1
2
  import '@material/web/icon/icon.js';
2
3
  import '@things-factory/form-ui';
3
4
  import { html } from 'lit';
@@ -21,14 +22,14 @@ class DynamicMenu extends localize(i18next)(PageView) {
21
22
  /**
22
23
  * @description 마스터 페이지 개인화 서비스 제공자
23
24
  ***************************
24
- * @type {Object}
25
- */
25
+ * @type {Object}
26
+ */
26
27
  masterPersonalConfigProvider: Object,
27
28
  /**
28
29
  * @description 디테일 페이지 개인화 서비스 제공자
29
30
  ***************************
30
- * @type {Object}
31
- */
31
+ * @type {Object}
32
+ */
32
33
  detailPersonalConfigProvider: Object
33
34
  };
34
35
  }
@@ -150,6 +151,12 @@ class DynamicMenu extends localize(i18next)(PageView) {
150
151
  name
151
152
  routing
152
153
  }
154
+ privilege {
155
+ privilege
156
+ category
157
+ owner
158
+ super
159
+ }
153
160
  `;
154
161
  limit = 999999;
155
162
  let fetchResult = await MetaApi.searchByPagination('dynamicMenus', filters, sorters, page, limit, selectFields);
@@ -185,6 +192,12 @@ class DynamicMenu extends localize(i18next)(PageView) {
185
192
  routing
186
193
  hiddenFlag
187
194
  iconPath
195
+ privilege {
196
+ privilege
197
+ category
198
+ owner
199
+ super
200
+ }
188
201
  `;
189
202
  limit = 999999;
190
203
  return await MetaApi.searchByPagination('dynamicMenus', filters, sorters, page, limit, selectFields);
@@ -220,9 +233,11 @@ class DynamicMenu extends localize(i18next)(PageView) {
220
233
  * 메뉴 Create / Update
221
234
  */
222
235
  async saveMenu() {
223
- let patches = MetaApi.patchesForUpdateMultiple(this.detailGrist);
236
+ var patches = this.detailGrist.dirtyRecords;
224
237
  if (ValueUtil.isNotEmpty(patches)) {
225
- patches.forEach(patch => {
238
+ patches = patches.map(patch => {
239
+ const { creator, updater, createdAt, updatedAt, __dirty__, __dirtyfields__, __origin__, __seq__, __selected__ } = patch, others = __rest(patch, ["creator", "updater", "createdAt", "updatedAt", "__dirty__", "__dirtyfields__", "__origin__", "__seq__", "__selected__"]);
240
+ patch = others;
226
241
  patch.menuType = patch.menuType || 'SCREEN';
227
242
  if (!patch.parentId) {
228
243
  patch.parent = { id: this.menuGroupId };
@@ -234,6 +249,8 @@ class DynamicMenu extends localize(i18next)(PageView) {
234
249
  if (patch.hiddenFlag === undefined || patch.hiddenFlag == null) {
235
250
  patch.hiddenFlag = false;
236
251
  }
252
+ patch.cuFlag = __dirty__;
253
+ return patch;
237
254
  });
238
255
  let result = await MetaApi.updateMultiple('updateMultipleMenu', patches);
239
256
  if (result) {
@@ -380,7 +397,18 @@ class DynamicMenu extends localize(i18next)(PageView) {
380
397
  MetaApi.getGristColumnConfig2('boolean', 'hiddenFlag', 'hidden', 'center', true, false, 55),
381
398
  MetaApi.getGristColumnConfig2('string', 'routing', 'routing', 'left', true, false, 135),
382
399
  MetaApi.getGristColumnConfig2('string', 'category', 'tag', 'left', true, false, 135),
383
- MetaApi.getGristColumnConfig2('string', 'resourceUrl', 'page_location', 'left', true, false, 350)
400
+ MetaApi.getGristColumnConfig2('string', 'resourceUrl', 'page_location', 'left', true, false, 350),
401
+ {
402
+ type: 'privilege',
403
+ name: 'privilege',
404
+ label: true,
405
+ header: i18next.t('field.required privilege'),
406
+ record: {
407
+ editable: true
408
+ },
409
+ sortable: true,
410
+ width: 200
411
+ }
384
412
  ]
385
413
  };
386
414
  // 메뉴 그리드 설정
@@ -546,6 +574,17 @@ class DynamicMenu extends localize(i18next)(PageView) {
546
574
  }
547
575
  },
548
576
  width: 200
577
+ },
578
+ {
579
+ type: 'privilege',
580
+ name: 'privilege',
581
+ label: true,
582
+ header: i18next.t('field.required privilege'),
583
+ record: {
584
+ editable: true
585
+ },
586
+ sortable: true,
587
+ width: 200
549
588
  }
550
589
  /*{
551
590
  type: 'meta-code-selector',