@things-factory/meta-ui 7.0.1-alpha.61 → 7.0.1-alpha.63

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 (40) hide show
  1. package/client/bootstrap.ts +0 -1
  2. package/client/pages/personalize/{personal-column-selector.js → personal-column-selector.ts} +111 -114
  3. package/client/utils/meta-api.js +12 -4
  4. package/client/utils/meta-ui-util.js +172 -42
  5. package/client/utils/service-util.js +93 -21
  6. package/dist-client/bootstrap.d.ts +0 -1
  7. package/dist-client/bootstrap.js +0 -1
  8. package/dist-client/bootstrap.js.map +1 -1
  9. package/dist-client/pages/personalize/personal-column-selector.d.ts +18 -26
  10. package/dist-client/pages/personalize/personal-column-selector.js +127 -124
  11. package/dist-client/pages/personalize/personal-column-selector.js.map +1 -1
  12. package/dist-client/tsconfig.tsbuildinfo +1 -1
  13. package/dist-client/utils/meta-api.d.ts +3 -3
  14. package/dist-client/utils/meta-api.js +3 -3
  15. package/dist-client/utils/meta-api.js.map +1 -1
  16. package/dist-client/utils/meta-ui-util.js +120 -30
  17. package/dist-client/utils/meta-ui-util.js.map +1 -1
  18. package/dist-client/utils/service-util.d.ts +1 -1
  19. package/dist-client/utils/service-util.js +58 -15
  20. package/dist-client/utils/service-util.js.map +1 -1
  21. package/dist-server/service/button-role/button-role-query.js +1 -1
  22. package/dist-server/service/button-role/button-role-query.js.map +1 -1
  23. package/dist-server/service/grid-personalize/grid-personalize-mutation.js +25 -1
  24. package/dist-server/service/grid-personalize/grid-personalize-mutation.js.map +1 -1
  25. package/dist-server/service/grid-personalize/grid-personalize-query.js +13 -12
  26. package/dist-server/service/grid-personalize/grid-personalize-query.js.map +1 -1
  27. package/dist-server/service/grid-personalize/grid-personalize-type.js +4 -4
  28. package/dist-server/service/grid-personalize/grid-personalize-type.js.map +1 -1
  29. package/dist-server/service/grid-personalize/grid-personalize.js +3 -3
  30. package/dist-server/service/grid-personalize/grid-personalize.js.map +1 -1
  31. package/dist-server/service/menu-button-auth/menu-button-auth-query.js +3 -3
  32. package/dist-server/service/menu-button-auth/menu-button-auth-query.js.map +1 -1
  33. package/dist-server/tsconfig.tsbuildinfo +1 -1
  34. package/package.json +3 -2
  35. package/server/service/button-role/button-role-query.ts +9 -4
  36. package/server/service/grid-personalize/grid-personalize-mutation.ts +37 -8
  37. package/server/service/grid-personalize/grid-personalize-query.ts +11 -12
  38. package/server/service/grid-personalize/grid-personalize-type.ts +5 -7
  39. package/server/service/grid-personalize/grid-personalize.ts +10 -7
  40. package/server/service/menu-button-auth/menu-button-auth-query.ts +31 -29
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/meta-ui",
3
- "version": "7.0.1-alpha.61",
3
+ "version": "7.0.1-alpha.63",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "dist-client/index.js",
6
6
  "things-factory": true,
@@ -43,10 +43,11 @@
43
43
  "@things-factory/env": "^7.0.1-alpha.55",
44
44
  "@things-factory/id-rule-base": "^7.0.1-alpha.61",
45
45
  "@things-factory/menu-base": "^7.0.1-alpha.60",
46
+ "@things-factory/personalization": "^7.0.1-alpha.63",
46
47
  "@things-factory/resource-base": "^7.0.1-alpha.60",
47
48
  "@things-factory/shell": "^7.0.1-alpha.55",
48
49
  "@things-factory/worklist": "^7.0.1-alpha.61",
49
50
  "moment-timezone": "^0.5.45"
50
51
  },
51
- "gitHead": "f1d7963b36feaf36c7d46e1f3b9360b66d74c535"
52
+ "gitHead": "79f8b01bf5a1c34de919c25ecbf5b57a83c88ebd"
52
53
  }
@@ -1,6 +1,11 @@
1
-
2
1
  import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'
3
- import { Domain, ListParam, convertListParams, getRepository, getQueryBuilderFromListParams } from '@things-factory/shell'
2
+ import {
3
+ Domain,
4
+ ListParam,
5
+ convertListParams,
6
+ getRepository,
7
+ getQueryBuilderFromListParams
8
+ } from '@things-factory/shell'
4
9
  import { User } from '@things-factory/auth-base'
5
10
  import { ButtonRole } from './button-role'
6
11
  import { ButtonRoleList } from './button-role-type'
@@ -11,7 +16,7 @@ export class ButtonRoleQuery {
11
16
  async buttonRole(@Arg('id') id: string, @Ctx() context: any): Promise<ButtonRole> {
12
17
  const { domain } = context.state
13
18
  return await getRepository(ButtonRole).findOne({
14
- where: { domain, id }
19
+ where: { domain: { id: domain.id }, id }
15
20
  })
16
21
  }
17
22
 
@@ -23,7 +28,7 @@ export class ButtonRoleQuery {
23
28
  domain,
24
29
  params,
25
30
  repository: await getRepository(ButtonRole),
26
- searchables: ['name','description']
31
+ searchables: ['name', 'description']
27
32
  })
28
33
 
29
34
  const [items, total] = await queryBuilder.getManyAndCount()
@@ -1,15 +1,17 @@
1
-
2
1
  import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'
3
2
  import { In } from 'typeorm'
4
3
  import { GridPersonalize } from './grid-personalize'
5
4
  import { NewGridPersonalize, GridPersonalizePatch } from './grid-personalize-type'
6
- import { getRepository } from '@things-factory/shell'
5
+ import { ScalarObject } from '@things-factory/shell'
7
6
 
8
7
  @Resolver(GridPersonalize)
9
8
  export class GridPersonalizeMutation {
10
9
  @Directive('@transaction')
11
10
  @Mutation(returns => GridPersonalize, { description: 'To create new Gridpersonalize' })
12
- async createGridpersonalize(@Arg('gridpersonalize') gridPersonalize: NewGridPersonalize, @Ctx() context: any): Promise<GridPersonalize> {
11
+ async createGridpersonalize(
12
+ @Arg('gridpersonalize') gridPersonalize: NewGridPersonalize,
13
+ @Ctx() context: any
14
+ ): Promise<GridPersonalize> {
13
15
  const { domain, user, tx } = context.state
14
16
 
15
17
  return await tx.getRepository(GridPersonalize).save({
@@ -20,6 +22,34 @@ export class GridPersonalizeMutation {
20
22
  })
21
23
  }
22
24
 
25
+ @Directive('@transaction')
26
+ @Mutation(returns => GridPersonalize, { description: 'To create or update my Gridpersonalize' })
27
+ async saveMyGridpersonalize(
28
+ @Arg('menuId') menuId: string,
29
+ @Arg('template', type => ScalarObject) template: { [key: string]: string[] },
30
+ @Ctx() context: any
31
+ ): Promise<GridPersonalize> {
32
+ const { domain, user, tx } = context.state
33
+
34
+ if (!menuId) {
35
+ throw 'menuId required.'
36
+ }
37
+
38
+ const gridpersonalize = await tx.getRepository(GridPersonalize).findOne({
39
+ where: { domain: { id: domain.id }, menu: { id: menuId }, user: { id: user.id } }
40
+ })
41
+
42
+ return await tx.getRepository(GridPersonalize).save({
43
+ ...gridpersonalize,
44
+ domain,
45
+ menu: { id: menuId },
46
+ user,
47
+ template,
48
+ creator: user,
49
+ updater: user
50
+ })
51
+ }
52
+
23
53
  @Directive('@transaction')
24
54
  @Mutation(returns => GridPersonalize, { description: 'To modify Gridpersonalize information' })
25
55
  async updateGridPersonalize(
@@ -71,7 +101,9 @@ export class GridPersonalizeMutation {
71
101
  if (_updateRecords.length > 0) {
72
102
  for (let i = 0; i < _updateRecords.length; i++) {
73
103
  const updRecord = _updateRecords[i]
74
- const gridpersonalize = await gridpersonalizeRepo.findOne({ where: { domain, id: updRecord.id } })
104
+ const gridpersonalize = await gridpersonalizeRepo.findOne({
105
+ where: { domain: { id: domain.id }, id: updRecord.id }
106
+ })
75
107
 
76
108
  const result = await gridpersonalizeRepo.save({
77
109
  ...gridpersonalize,
@@ -97,10 +129,7 @@ export class GridPersonalizeMutation {
97
129
 
98
130
  @Directive('@transaction')
99
131
  @Mutation(returns => Boolean, { description: 'To delete multiple gridpersonalizes' })
100
- async deleteGridPersonalizes(
101
- @Arg('ids', type => [String]) ids: string[],
102
- @Ctx() context: any
103
- ): Promise<boolean> {
132
+ async deleteGridPersonalizes(@Arg('ids', type => [String]) ids: string[], @Ctx() context: any): Promise<boolean> {
104
133
  const { domain, tx } = context.state
105
134
 
106
135
  await tx.getRepository(GridPersonalize).delete({
@@ -1,4 +1,3 @@
1
-
2
1
  import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'
3
2
  import { Domain, ListParam, convertListParams, getRepository } from '@things-factory/shell'
4
3
  import { User } from '@things-factory/auth-base'
@@ -8,22 +7,22 @@ import { GridPersonalizeList } from './grid-personalize-type'
8
7
 
9
8
  @Resolver(GridPersonalize)
10
9
  export class GridPersonalizeQuery {
11
- @Query(returns => GridPersonalize, { description: 'To fetch a Gridpersonalize' })
12
- async gridPersonalize(@Arg('id') id: string, @Ctx() context: any): Promise<GridPersonalize> {
10
+ @Query(returns => GridPersonalize, { nullable: true, description: `To fetch a Gridpersonalize` })
11
+ async gridPersonalize(@Arg('id') id: string, @Ctx() context: any): Promise<GridPersonalize | null> {
13
12
  const { domain } = context.state
14
13
  return await getRepository(GridPersonalize).findOne({
15
- where: { domain, id }
14
+ where: { domain: { id: domain.id }, id }
16
15
  })
17
16
  }
18
17
 
19
- @Query(returns => GridPersonalizeList, { description: 'To fetch a multiple Gridpersonalize template' })
20
- async gridPersonalizeTemplates(@Args() params: ListParam, @Ctx() context: any): Promise<GridPersonalizeList> {
21
- const { user } = context.state
22
- params.filters.push({ name: "user.id", operator: "eq", value: user.id });
23
- return await this.gridPersonalizes(params, context);
18
+ @Query(returns => GridPersonalize, { nullable: true, description: `To fetch a User's own Gridpersonalize` })
19
+ async myGridPersonalize(@Arg('menuId') menuId: string, @Ctx() context: any): Promise<GridPersonalize | null> {
20
+ const { domain, user } = context.state
21
+ return await getRepository(GridPersonalize).findOne({
22
+ where: { domain: { id: domain.id }, menu: { id: menuId }, user: { id: user.id } }
23
+ })
24
24
  }
25
25
 
26
-
27
26
  @Query(returns => GridPersonalizeList, { description: 'To fetch multiple Gridpersonalizes' })
28
27
  async gridPersonalizes(@Args() params: ListParam, @Ctx() context: any): Promise<GridPersonalizeList> {
29
28
  const { domain } = context.state
@@ -34,12 +33,12 @@ export class GridPersonalizeQuery {
34
33
  return { items, total }
35
34
  }
36
35
 
37
- @FieldResolver(type => Domain)
36
+ @FieldResolver(type => Menu)
38
37
  async menu(@Root() gridPersonalize: GridPersonalize): Promise<Menu> {
39
38
  return await getRepository(Menu).findOneBy({ id: gridPersonalize.menuId })
40
39
  }
41
40
 
42
- @FieldResolver(type => Domain)
41
+ @FieldResolver(type => User)
43
42
  async user(@Root() gridPersonalize: GridPersonalize): Promise<User> {
44
43
  return await getRepository(User).findOneBy({ id: gridPersonalize.userId })
45
44
  }
@@ -1,20 +1,18 @@
1
-
2
1
  import { ObjectType, Field, InputType, Int, ID, Float, registerEnumType } from 'type-graphql'
3
- import { ObjectRef } from '@things-factory/shell'
2
+ import { ObjectRef, ScalarObject } from '@things-factory/shell'
4
3
 
5
4
  import { GridPersonalize } from './grid-personalize'
6
5
 
7
6
  @InputType()
8
7
  export class NewGridPersonalize {
9
-
10
8
  @Field(type => ObjectRef)
11
9
  user: ObjectRef
12
10
 
13
11
  @Field(type => ObjectRef)
14
12
  menu: ObjectRef
15
13
 
16
- @Field({ nullable: false })
17
- template: string
14
+ @Field(type => ScalarObject, { nullable: false })
15
+ template: { [key: string]: string[] }
18
16
  }
19
17
 
20
18
  @InputType()
@@ -28,8 +26,8 @@ export class GridPersonalizePatch {
28
26
  @Field(type => ObjectRef, { nullable: true })
29
27
  menu?: ObjectRef
30
28
 
31
- @Field({ nullable: true })
32
- template?: string
29
+ @Field(type => ScalarObject, { nullable: true })
30
+ template?: { [key: string]: string[] }
33
31
 
34
32
  @Field()
35
33
  cuFlag: string
@@ -1,4 +1,3 @@
1
-
2
1
  import {
3
2
  CreateDateColumn,
4
3
  UpdateDateColumn,
@@ -12,12 +11,16 @@ import {
12
11
  } from 'typeorm'
13
12
  import { ObjectType, Field, Int, ID, Float, registerEnumType } from 'type-graphql'
14
13
 
15
- import { Domain } from '@things-factory/shell'
14
+ import { Domain, ScalarObject } from '@things-factory/shell'
16
15
  import { User } from '@things-factory/auth-base'
17
16
  import { Menu } from '@things-factory/menu-base'
18
17
 
19
18
  @Entity('grid_personalize')
20
- @Index('ix_gridpersonalize_0', (gridPersonalize: GridPersonalize) => [gridPersonalize.domain, gridPersonalize.user, gridPersonalize.menu], { unique: true })
19
+ @Index(
20
+ 'ix_gridpersonalize_0',
21
+ (gridPersonalize: GridPersonalize) => [gridPersonalize.domain, gridPersonalize.user, gridPersonalize.menu],
22
+ { unique: true }
23
+ )
21
24
  @ObjectType({ description: 'Entity for GridPersonalize' })
22
25
  export class GridPersonalize {
23
26
  @PrimaryGeneratedColumn('uuid')
@@ -38,16 +41,16 @@ export class GridPersonalize {
38
41
  @RelationId((gridPersonalize: GridPersonalize) => gridPersonalize.user)
39
42
  userId: string
40
43
 
41
- @ManyToOne(type => Menu, {createForeignKeyConstraints: false})
44
+ @ManyToOne(type => Menu, { createForeignKeyConstraints: false })
42
45
  @Field({ nullable: false })
43
46
  menu: Menu
44
47
 
45
48
  @RelationId((gridPersonalize: GridPersonalize) => gridPersonalize.menu)
46
49
  menuId: string
47
50
 
48
- @Column({ name: 'template', type: 'text', nullable: false })
49
- @Field({ nullable: false })
50
- template: string
51
+ @Column('simple-json', { nullable: true })
52
+ @Field(type => ScalarObject, { nullable: true })
53
+ template?: { [key: string]: string[] }
51
54
 
52
55
  @CreateDateColumn()
53
56
  @Field({ nullable: true })
@@ -1,7 +1,12 @@
1
-
2
1
  import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'
3
2
  import { IsNull, Not } from 'typeorm'
4
- import { Domain, ListParam, convertListParams, getRepository, getQueryBuilderFromListParams } from '@things-factory/shell'
3
+ import {
4
+ Domain,
5
+ ListParam,
6
+ convertListParams,
7
+ getRepository,
8
+ getQueryBuilderFromListParams
9
+ } from '@things-factory/shell'
5
10
  import { User } from '@things-factory/auth-base'
6
11
  import { MenuButtonAuth } from './menu-button-auth'
7
12
  import { MenuButtonAuthList } from './menu-button-auth-type'
@@ -14,7 +19,7 @@ export class MenuButtonAuthQuery {
14
19
  async menuButtonAuth(@Arg('id') id: string, @Ctx() context: any): Promise<MenuButtonAuth> {
15
20
  const { domain } = context.state
16
21
  return await getRepository(MenuButtonAuth).findOne({
17
- where: { domain, id }
22
+ where: { domain: { id: domain.id }, id }
18
23
  })
19
24
  }
20
25
 
@@ -36,14 +41,12 @@ export class MenuButtonAuthQuery {
36
41
  @Query(returns => MenuButtonAuthList, { description: 'To fetch a multiple RoleMenuButtonAuth' })
37
42
  async roleMenuButtonAuths(@Args() params: ListParam, @Ctx() context: any): Promise<MenuButtonAuthList> {
38
43
  const { domain } = context.state
39
- const roleId = params.filters.find(x=> x.name == 'roleId').value
40
- const parentMenuId = params.filters.some( x=> x.name == 'menuId')
41
- ? params.filters.find(x=> x.name == 'menuId').value
42
- : undefined
43
-
44
-
45
-
46
- // 기존 role 권한 조회
44
+ const roleId = params.filters.find(x => x.name == 'roleId').value
45
+ const parentMenuId = params.filters.some(x => x.name == 'menuId')
46
+ ? params.filters.find(x => x.name == 'menuId').value
47
+ : undefined
48
+
49
+ // 기존 role 권한 조회
47
50
  const queryBuilder = getQueryBuilderFromListParams({
48
51
  domain,
49
52
  params,
@@ -52,17 +55,17 @@ export class MenuButtonAuthQuery {
52
55
 
53
56
  const [items, total] = await queryBuilder.getManyAndCount()
54
57
 
55
- // 메뉴 리스트 조회
58
+ // 메뉴 리스트 조회
56
59
  let menuParams = {
57
- where: {
58
- domain: {
59
- id: domain.id
60
+ where: {
61
+ domain: {
62
+ id: domain.id
60
63
  }
61
64
  },
62
65
  order: { rank: 'ASC' }
63
66
  }
64
67
 
65
- if(parentMenuId){
68
+ if (parentMenuId) {
66
69
  menuParams.where['parent'] = {
67
70
  id: parentMenuId
68
71
  }
@@ -72,15 +75,15 @@ export class MenuButtonAuthQuery {
72
75
 
73
76
  const menus: Menu[] = await getRepository(Menu).find(menuParams)
74
77
 
75
- let results:MenuButtonAuth[] = []
76
-
77
- menus.forEach(menu =>{
78
+ let results: MenuButtonAuth[] = []
79
+
80
+ menus.forEach(menu => {
78
81
  let menuRole = {
79
82
  id: menu.id,
80
83
  menu: menu,
81
84
  menuId: menu.id,
82
85
  roleId: roleId,
83
- role: {id:roleId, name:'', description:'', domain: domain, domainId: domain.id},
86
+ role: { id: roleId, name: '', description: '', domain: domain, domainId: domain.id },
84
87
  domain: domain,
85
88
  domainId: domain.id,
86
89
  selectAuth: false,
@@ -89,21 +92,20 @@ export class MenuButtonAuthQuery {
89
92
  deleteAuth: false
90
93
  }
91
94
 
92
- if(items.some( x=> x.menuId == menu.id)){
93
- let menuAuth = items.find(x => x.menuId == menu.id);
95
+ if (items.some(x => x.menuId == menu.id)) {
96
+ let menuAuth = items.find(x => x.menuId == menu.id)
94
97
 
95
- menuRole.id = menuAuth.id;
96
- menuRole.selectAuth = menuAuth.selectAuth;
97
- menuRole.updateAuth = menuAuth.updateAuth;
98
- menuRole.createAuth = menuAuth.createAuth;
99
- menuRole.deleteAuth = menuAuth.deleteAuth;
98
+ menuRole.id = menuAuth.id
99
+ menuRole.selectAuth = menuAuth.selectAuth
100
+ menuRole.updateAuth = menuAuth.updateAuth
101
+ menuRole.createAuth = menuAuth.createAuth
102
+ menuRole.deleteAuth = menuAuth.deleteAuth
100
103
  }
101
104
 
102
105
  results.push(menuRole)
103
106
  })
104
107
 
105
-
106
- return { items: results, total:0 }
108
+ return { items: results, total: 0 }
107
109
  }
108
110
 
109
111
  @FieldResolver(type => ButtonRole)