@things-factory/menu-ui 8.0.0-alpha.8 → 8.0.0-beta.0

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 (59) hide show
  1. package/client/apptools/{favorite-tool.js → favorite-tool.ts} +24 -30
  2. package/client/{bootstrap.js → bootstrap.ts} +1 -1
  3. package/client/components/{child-menus-selector.js → child-menus-selector.ts} +51 -57
  4. package/client/components/{role-select-popup.js → role-select-popup.ts} +38 -48
  5. package/client/pages/{menu-list-page.js → menu-list-page.ts} +47 -37
  6. package/client/pages/{menu-management-detail.js → menu-management-detail.ts} +74 -65
  7. package/client/pages/{menu-management.js → menu-management.ts} +33 -41
  8. package/client/pages/{role-menus-management.js → role-menus-management.ts} +56 -62
  9. package/client/viewparts/menu-bar.ts +110 -0
  10. package/client/viewparts/menu-tile-list.ts +216 -0
  11. package/client/viewparts/{menu-tree-bar.js → menu-tree-bar.ts} +133 -139
  12. package/dist-client/apptools/favorite-tool.d.ts +28 -0
  13. package/dist-client/apptools/favorite-tool.js +139 -0
  14. package/dist-client/apptools/favorite-tool.js.map +1 -0
  15. package/dist-client/bootstrap.d.ts +4 -0
  16. package/dist-client/bootstrap.js +52 -0
  17. package/dist-client/bootstrap.js.map +1 -0
  18. package/dist-client/components/child-menus-selector.d.ts +1 -0
  19. package/dist-client/components/child-menus-selector.js +146 -0
  20. package/dist-client/components/child-menus-selector.js.map +1 -0
  21. package/dist-client/components/role-select-popup.d.ts +1 -0
  22. package/dist-client/components/role-select-popup.js +180 -0
  23. package/dist-client/components/role-select-popup.js.map +1 -0
  24. package/dist-client/index.d.ts +0 -0
  25. package/dist-client/index.js +2 -0
  26. package/dist-client/index.js.map +1 -0
  27. package/dist-client/pages/menu-list-page.d.ts +2 -0
  28. package/dist-client/pages/menu-list-page.js +204 -0
  29. package/dist-client/pages/menu-list-page.js.map +1 -0
  30. package/dist-client/pages/menu-management-detail.d.ts +2 -0
  31. package/dist-client/pages/menu-management-detail.js +376 -0
  32. package/dist-client/pages/menu-management-detail.js.map +1 -0
  33. package/dist-client/pages/menu-management.d.ts +3 -0
  34. package/dist-client/pages/menu-management.js +280 -0
  35. package/dist-client/pages/menu-management.js.map +1 -0
  36. package/dist-client/pages/role-menus-management.d.ts +4 -0
  37. package/dist-client/pages/role-menus-management.js +215 -0
  38. package/dist-client/pages/role-menus-management.js.map +1 -0
  39. package/dist-client/route.d.ts +1 -0
  40. package/dist-client/route.js +14 -0
  41. package/dist-client/route.js.map +1 -0
  42. package/dist-client/themes/menu-theme.css +31 -0
  43. package/dist-client/tsconfig.tsbuildinfo +1 -0
  44. package/dist-client/viewparts/menu-bar.d.ts +12 -0
  45. package/dist-client/viewparts/menu-bar.js +108 -0
  46. package/dist-client/viewparts/menu-bar.js.map +1 -0
  47. package/dist-client/viewparts/menu-tile-list.d.ts +13 -0
  48. package/dist-client/viewparts/menu-tile-list.js +234 -0
  49. package/dist-client/viewparts/menu-tile-list.js.map +1 -0
  50. package/dist-client/viewparts/menu-tree-bar.d.ts +28 -0
  51. package/dist-client/viewparts/menu-tree-bar.js +307 -0
  52. package/dist-client/viewparts/menu-tree-bar.js.map +1 -0
  53. package/dist-server/tsconfig.tsbuildinfo +1 -1
  54. package/package.json +21 -18
  55. package/things-factory.config.js +5 -14
  56. package/client/viewparts/menu-bar.js +0 -114
  57. package/client/viewparts/menu-tile-list.js +0 -222
  58. /package/client/{index.js → index.ts} +0 -0
  59. /package/client/{route.js → route.ts} +0 -0
@@ -1,45 +1,41 @@
1
1
  import '@material/web/icon/icon.js'
2
2
 
3
3
  import { LitElement, html, css } from 'lit'
4
+ import { customElement, property } from 'lit/decorators.js'
4
5
  import { connect } from 'pwa-helpers/connect-mixin.js'
5
6
  import gql from 'graphql-tag'
6
7
 
7
- import { store, client } from '@things-factory/shell'
8
- import { UPDATE_FAVORITES } from '@things-factory/fav-base'
8
+ import { store, client } from '@things-factory/shell/client'
9
+ import { UPDATE_FAVORITES } from '@things-factory/fav-base/client'
9
10
 
11
+ @customElement('favorite-tool')
10
12
  export class FavoriteTool extends connect(store)(LitElement) {
11
- static get properties() {
12
- return {
13
- favorites: Array,
14
- user: Object,
15
- page: String,
16
- resourceId: String,
17
- favored: Boolean,
18
- routingTypes: Object,
19
- blackList: Array
13
+ static styles = css`
14
+ :host {
15
+ display: inline-block;
16
+ vertical-align: middle;
17
+ line-height: 0;
20
18
  }
21
- }
22
19
 
23
- static get styles() {
24
- return css`
25
- :host {
26
- display: inline-block;
27
- vertical-align: middle;
28
- line-height: 0;
29
- }
30
-
31
- [favorable] {
32
- opacity: 0.5;
33
- }
34
- `
35
- }
20
+ [favorable] {
21
+ opacity: 0.5;
22
+ }
23
+ `
24
+
25
+ @property({ type: Array }) favorites: any
26
+ @property({ type: Object }) user: any
27
+ @property({ type: String }) page?: string
28
+ @property({ type: String }) resourceId?: string
29
+ @property({ type: Boolean }) favored: boolean = false
30
+ @property({ type: Array }) routingTypes: any[] = []
31
+ @property({ type: Array }) blackList: string[] = []
36
32
 
37
33
  render() {
38
- var renderable = (this.blackList || []).indexOf(this.page) == -1
34
+ var renderable = (this.blackList || []).indexOf(this.page!) == -1
39
35
 
40
36
  return renderable
41
37
  ? html`
42
- <md-icon @click=${this.onclick.bind(this)} ?favorable=${!this.favored}
38
+ <md-icon @click=${this.onClick.bind(this)} ?favorable=${!this.favored}
43
39
  >${this.favored ? 'star' : 'star_border'}</md-icon
44
40
  >
45
41
  `
@@ -62,7 +58,7 @@ export class FavoriteTool extends connect(store)(LitElement) {
62
58
  this.routingTypes = state.menu.routingTypes
63
59
  }
64
60
 
65
- onclick(event) {
61
+ onClick(event) {
66
62
  if (this.favored) {
67
63
  this.removeFavorite(this.getFullRouting())
68
64
  } else {
@@ -126,5 +122,3 @@ export class FavoriteTool extends connect(store)(LitElement) {
126
122
  return routingType ? `${this.page}/${this.resourceId}` : this.page
127
123
  }
128
124
  }
129
-
130
- customElements.define('favorite-tool', FavoriteTool)
@@ -40,7 +40,7 @@ export default function bootstrap() {
40
40
  }
41
41
 
42
42
  function appendRoleMenusManagementMorenda() {
43
- const useRoleByMenusManagementMenu = store.getState()?.menu?.useRoleByMenusManagementMenu || false
43
+ const useRoleByMenusManagementMenu = (store.getState() as any)?.menu?.useRoleByMenusManagementMenu || false
44
44
 
45
45
  if (useRoleByMenusManagementMenu) {
46
46
  store.dispatch({
@@ -2,65 +2,61 @@ import { i18next, localize } from '@operato/i18n'
2
2
  import { client } from '@operato/graphql'
3
3
  import gql from 'graphql-tag'
4
4
  import { css, html, LitElement } from 'lit'
5
+ import { customElement, property } from 'lit/decorators.js'
5
6
 
7
+ @customElement('child-menus-selector')
6
8
  class ChildMenusSelector extends localize(i18next)(LitElement) {
7
- static get styles() {
8
- return [
9
- css`
10
- :host {
11
- display: flex;
12
- flex-direction: column;
13
- border: 1px solid var(--md-sys-color-primary);
14
- font: normal 15px var(--theme-font);
15
- color: var(--md-sys-color-secondary);
16
- }
17
- div {
18
- margin: var(--spacing-medium);
19
- }
9
+ static styles = [
10
+ css`
11
+ :host {
12
+ display: flex;
13
+ flex-direction: column;
14
+ border: 1px solid var(--md-sys-color-primary);
15
+ font: normal 15px var(--theme-font);
16
+ color: var(--md-sys-color-secondary);
17
+ }
18
+ div {
19
+ margin: var(--spacing-medium);
20
+ }
21
+ ul {
22
+ flex: 1;
23
+ background-color: var(--md-sys-color-surface);
24
+ overflow: auto;
25
+ display: grid;
26
+ grid-template-columns: 1fr 1fr;
27
+ margin: 0;
28
+ padding: var(--spacing-medium);
29
+ list-style: none;
30
+ border: 1px dashed rgba(0, 0, 0, 0.1);
31
+ border-width: 1px 0;
32
+ }
33
+
34
+ input[type='checkbox'] {
35
+ display: inline;
36
+ }
37
+
38
+ li {
39
+ padding: var(--spacing-small);
40
+ }
41
+
42
+ #checkAll,
43
+ [for='checkAll'] {
44
+ margin-bottom: var(--spacing-medium);
45
+ padding-bottom: var(--spacing-small);
46
+ font-weight: bold;
47
+ }
48
+
49
+ @media screen and (max-width: 480px) {
20
50
  ul {
21
- flex: 1;
22
- background-color: var(--md-sys-color-surface);
23
- overflow: auto;
24
- display: grid;
25
- grid-template-columns: 1fr 1fr;
26
- margin: 0;
27
- padding: var(--spacing-medium);
28
- list-style: none;
29
- border: 1px dashed rgba(0, 0, 0, 0.1);
30
- border-width: 1px 0;
31
- }
32
-
33
- input[type='checkbox'] {
34
- display: inline;
35
- }
36
-
37
- li {
38
- padding: var(--spacing-small);
39
- }
40
-
41
- #checkAll,
42
- [for='checkAll'] {
43
- margin-bottom: var(--spacing-medium);
44
- padding-bottom: var(--spacing-small);
45
- font-weight: bold;
51
+ grid-template-columns: 1fr;
46
52
  }
53
+ }
54
+ `
55
+ ]
47
56
 
48
- @media screen and (max-width: 480px) {
49
- ul {
50
- grid-template-columns: 1fr;
51
- }
52
- }
53
- `
54
- ]
55
- }
56
-
57
- static get properties() {
58
- return {
59
- parentMenu: Object,
60
- roleMenus: Array,
61
- targetRole: Object
62
- }
63
- }
57
+ @property({ type: Object }) parentMenu: any
58
+ @property({ type: Array }) roleMenus: any[] = []
59
+ @property({ type: Object }) targetRole: any
64
60
 
65
61
  render() {
66
62
  const parentMenu = this.parentMenu || {}
@@ -101,7 +97,7 @@ class ChildMenusSelector extends localize(i18next)(LitElement) {
101
97
  async onCheckAll(e) {
102
98
  const checked = e.currentTarget.checked
103
99
 
104
- Array.from(this.menuList).forEach(checkbox => (checkbox.checked = checked))
100
+ Array.from(this.menuList).forEach(checkbox => ((checkbox as HTMLInputElement).checked = checked))
105
101
 
106
102
  const response = await client.mutate({
107
103
  mutation: gql`
@@ -146,5 +142,3 @@ class ChildMenusSelector extends localize(i18next)(LitElement) {
146
142
  document.dispatchEvent(new CustomEvent('notify', { detail: { message, option: { timer: 1000 } } }))
147
143
  }
148
144
  }
149
-
150
- customElements.define('child-menus-selector', ChildMenusSelector)
@@ -2,50 +2,50 @@ import { i18next, localize } from '@operato/i18n'
2
2
  import { client } from '@operato/graphql'
3
3
  import gql from 'graphql-tag'
4
4
  import { css, html, LitElement } from 'lit'
5
+ import { customElement, property, state, query } from 'lit/decorators.js'
5
6
  import { isMobileDevice } from '@operato/utils'
6
7
  import '@operato/data-grist'
7
8
  import { CommonHeaderStyles } from '@operato/styles'
9
+ import { DataGrist, FetchOption } from '@operato/data-grist'
8
10
 
11
+ @customElement('role-select-popup')
9
12
  class RoleSelectPopup extends localize(i18next)(LitElement) {
10
- static get styles() {
11
- return [
12
- CommonHeaderStyles,
13
- css`
14
- :host {
15
- display: flex;
16
- flex-direction: column;
17
- overflow: hidden;
18
- background-color: var(--md-sys-color-surface);
19
- }
13
+ static styles = [
14
+ CommonHeaderStyles,
15
+ css`
16
+ :host {
17
+ display: flex;
18
+ flex-direction: column;
19
+ overflow: hidden;
20
+ background-color: var(--md-sys-color-surface);
21
+ }
20
22
 
21
- .container {
22
- flex: 1;
23
- display: flex;
24
- overflow-y: auto;
25
- min-height: 20vh;
26
- }
23
+ .container {
24
+ flex: 1;
25
+ display: flex;
26
+ overflow-y: auto;
27
+ min-height: 20vh;
28
+ }
27
29
 
28
- .grist {
29
- display: flex;
30
- flex-direction: column;
31
- flex: 1;
32
- overflow-y: auto;
33
- }
30
+ .grist {
31
+ display: flex;
32
+ flex-direction: column;
33
+ flex: 1;
34
+ overflow-y: auto;
35
+ }
34
36
 
35
- ox-grist {
36
- overflow-y: hidden;
37
- flex: 1;
38
- }
39
- `
40
- ]
41
- }
37
+ ox-grist {
38
+ overflow-y: hidden;
39
+ flex: 1;
40
+ }
41
+ `
42
+ ]
42
43
 
43
- static get properties() {
44
- return {
45
- _searchFields: Array,
46
- config: Object
47
- }
48
- }
44
+ @property({ type: Array }) _searchFields: any[] = []
45
+ @property({ type: Object }) config: any
46
+
47
+ @query('ox-grist') dataGrist!: DataGrist
48
+ @query('search-form') searchForm!: HTMLFormElement
49
49
 
50
50
  render() {
51
51
  return html`
@@ -56,7 +56,7 @@ class RoleSelectPopup extends localize(i18next)(LitElement) {
56
56
  <ox-grist
57
57
  .mode=${isMobileDevice() ? 'LIST' : 'GRID'}
58
58
  .config=${this.config}
59
- .fetchHandler="${this.fetchHandler.bind(this)}"
59
+ .fetchHandler=${this.fetchHandler.bind(this)}
60
60
  ></ox-grist>
61
61
  </div>
62
62
  </div>
@@ -68,14 +68,6 @@ class RoleSelectPopup extends localize(i18next)(LitElement) {
68
68
  `
69
69
  }
70
70
 
71
- get searchForm() {
72
- return this.shadowRoot.querySelector('search-form')
73
- }
74
-
75
- get dataGrist() {
76
- return this.shadowRoot.querySelector('ox-grist')
77
- }
78
-
79
71
  firstUpdated() {
80
72
  this._searchFields = [
81
73
  {
@@ -131,8 +123,8 @@ class RoleSelectPopup extends localize(i18next)(LitElement) {
131
123
  }
132
124
  }
133
125
 
134
- async fetchHandler({ page, limit, sorters = [] }) {
135
- const filters = this.searchForm?.queryFilters || []
126
+ async fetchHandler({ page, limit, sorters = [] }: FetchOption) {
127
+ const filters = (this.searchForm as any)?.queryFilters || []
136
128
 
137
129
  const response = await client.query({
138
130
  query: gql`
@@ -175,5 +167,3 @@ class RoleSelectPopup extends localize(i18next)(LitElement) {
175
167
  document.dispatchEvent(new CustomEvent('notify', { detail: { message, option: { timer: 1000 } } }))
176
168
  }
177
169
  }
178
-
179
- window.customElements.define('role-select-popup', RoleSelectPopup)
@@ -3,46 +3,48 @@ import '../viewparts/menu-tile-list'
3
3
 
4
4
  import gql from 'graphql-tag'
5
5
  import { css, html } from 'lit'
6
+ import { customElement, property, state } from 'lit/decorators.js'
6
7
  import { connect } from 'pwa-helpers/connect-mixin.js'
7
8
 
8
- import { client, navigate, PageView, store } from '@things-factory/shell'
9
+ import { navigate, PageView, store } from '@operato/shell'
10
+ import { client } from '@operato/graphql'
9
11
  import { ScrollbarStyles } from '@operato/styles'
10
- import { pulltorefresh, swipe } from '@things-factory/utils'
12
+ import { pulltorefresh } from '@operato/pull-to-refresh'
13
+ import { swipe } from '@things-factory/utils/src/index.js'
11
14
 
15
+ @customElement('menu-list-page')
12
16
  class MenuListPage extends connect(store)(PageView) {
13
- static get styles() {
14
- return [
15
- ScrollbarStyles,
16
- css`
17
- :host {
18
- display: flex;
19
- flex-direction: column;
20
-
21
- overflow: hidden;
22
- }
17
+ static styles = [
18
+ ScrollbarStyles,
19
+ css`
20
+ :host {
21
+ display: flex;
22
+ flex-direction: column;
23
+
24
+ overflow: hidden;
25
+ }
23
26
 
24
- menu-bar {
25
- z-index: 1;
26
- }
27
+ menu-bar {
28
+ z-index: 1;
29
+ }
27
30
 
28
- menu-tile-list {
29
- flex: 1;
30
- overflow-y: auto;
31
- }
32
- `
33
- ]
34
- }
31
+ menu-tile-list {
32
+ flex: 1;
33
+ overflow-y: auto;
34
+ }
35
+ `
36
+ ]
35
37
 
36
- static get properties() {
37
- return {
38
- menuId: String,
39
- menus: Array,
40
- routingTypes: Object,
41
- favorites: Array,
42
- user: Object,
43
- showSpinner: Boolean
44
- }
45
- }
38
+ @property({ type: String }) menuId?: string
39
+ @property({ type: Array }) menus: any[] = []
40
+ @property({ type: Object }) routingTypes: any
41
+ @property({ type: Array }) favorites: any[] = []
42
+ @property({ type: Object }) user: any
43
+ @property({ type: Boolean }) showSpinner: boolean = false
44
+
45
+ @state() private page?: string
46
+
47
+ private getMenus: any
46
48
 
47
49
  render() {
48
50
  return html`
@@ -71,6 +73,11 @@ class MenuListPage extends connect(store)(PageView) {
71
73
  userMenus {
72
74
  id
73
75
  name
76
+ role {
77
+ id
78
+ name
79
+ description
80
+ }
74
81
  children {
75
82
  id
76
83
  name
@@ -80,6 +87,11 @@ class MenuListPage extends connect(store)(PageView) {
80
87
  resourceName
81
88
  resourceUrl
82
89
  template
90
+ role {
91
+ id
92
+ name
93
+ description
94
+ }
83
95
  }
84
96
  }
85
97
  }
@@ -115,10 +127,10 @@ class MenuListPage extends connect(store)(PageView) {
115
127
  }
116
128
 
117
129
  async firstUpdated() {
118
- var list = this.shadowRoot.querySelector('menu-tile-list')
130
+ var list = this.renderRoot.querySelector('menu-tile-list') as HTMLElement
119
131
 
120
132
  pulltorefresh({
121
- container: this.shadowRoot,
133
+ container: this.renderRoot,
122
134
  scrollable: list,
123
135
  refresh: () => {
124
136
  return this.refresh()
@@ -126,7 +138,7 @@ class MenuListPage extends connect(store)(PageView) {
126
138
  })
127
139
 
128
140
  swipe({
129
- container: this.shadowRoot.querySelector('menu-tile-list'),
141
+ container: this.renderRoot.querySelector('menu-tile-list'),
130
142
  animates: {
131
143
  dragging: async (d, opts) => {
132
144
  var currentIndex = Number(this.menuId)
@@ -186,5 +198,3 @@ class MenuListPage extends connect(store)(PageView) {
186
198
  this.refresh()
187
199
  }
188
200
  }
189
-
190
- window.customElements.define('menu-list-page', MenuListPage)
@@ -3,68 +3,68 @@ import '@operato/data-grist'
3
3
 
4
4
  import gql from 'graphql-tag'
5
5
  import { css, html, LitElement } from 'lit'
6
+ import { customElement, property, query } from 'lit/decorators.js'
6
7
 
7
- import { getEditor, getRenderer } from '@operato/data-grist'
8
+ import { DataGrist, FetchOption, getEditor, getRenderer } from '@operato/data-grist'
8
9
  import { i18next, localize } from '@operato/i18n'
9
10
  import { client } from '@operato/graphql'
10
11
  import { ScrollbarStyles } from '@operato/styles'
11
- import { gqlBuilder, isMobileDevice } from '@things-factory/utils'
12
+ import { isMobileDevice } from '@operato/utils'
13
+ import { gqlBuilder } from '@things-factory/utils'
12
14
 
13
15
  import { OxPrompt } from '@operato/popup/ox-prompt.js'
14
16
 
17
+ @customElement('menu-management-detail')
15
18
  class MenuManagementDetail extends localize(i18next)(LitElement) {
16
- static get styles() {
17
- return [
18
- ScrollbarStyles,
19
- css`
20
- :host {
21
- display: flex;
22
- flex-direction: column;
23
- overflow: hidden;
24
- background-color: var(--md-sys-color-surface);
25
- }
26
- search-form {
27
- overflow: visible;
28
- }
29
- .grist {
30
- display: flex;
31
- flex-direction: column;
32
- flex: 1;
33
- overflow-y: auto;
34
- }
35
- ox-grist {
36
- overflow-y: hidden;
37
- flex: 1;
38
- }
39
- .button-container {
40
- padding: 10px 0 12px 0;
41
- text-align: center;
42
- }
43
- .button-container > button {
44
- background-color: var(--button-background-color);
45
- border: var(--button-border);
46
- border-radius: var(--button-border-radius);
47
- margin: var(--button-margin);
48
- padding: var(--button-padding);
49
- color: var(--button-color);
50
- font: var(--button-font);
51
- text-transform: var(--button-text-transform);
52
- }
53
- .button-container > button:hover,
54
- .button-container > button:active {
55
- background-color: var(--button-background-focus-color);
56
- }
57
- `
58
- ]
59
- }
19
+ static styles = [
20
+ ScrollbarStyles,
21
+ css`
22
+ :host {
23
+ display: flex;
24
+ flex-direction: column;
25
+ overflow: hidden;
26
+ background-color: var(--md-sys-color-surface);
27
+ }
28
+ search-form {
29
+ overflow: visible;
30
+ }
31
+ .grist {
32
+ display: flex;
33
+ flex-direction: column;
34
+ flex: 1;
35
+ overflow-y: auto;
36
+ }
37
+ ox-grist {
38
+ overflow-y: hidden;
39
+ flex: 1;
40
+ }
41
+ .button-container {
42
+ padding: 10px 0 12px 0;
43
+ text-align: center;
44
+ }
45
+ .button-container > button {
46
+ background-color: var(--button-background-color);
47
+ border: var(--button-border);
48
+ border-radius: var(--button-border-radius);
49
+ margin: var(--button-margin);
50
+ padding: var(--button-padding);
51
+ color: var(--button-color);
52
+ font: var(--button-font);
53
+ text-transform: var(--button-text-transform);
54
+ }
55
+ .button-container > button:hover,
56
+ .button-container > button:active {
57
+ background-color: var(--button-background-focus-color);
58
+ }
59
+ `
60
+ ]
60
61
 
61
- static get properties() {
62
- return {
63
- menuId: String,
64
- searchFields: Object,
65
- config: Object
66
- }
67
- }
62
+ @property({ type: String }) menuId?: string
63
+ @property({ type: Object }) searchFields: any
64
+ @property({ type: Object }) config: any
65
+
66
+ @query('ox-grist') dataGrist!: DataGrist
67
+ @query('search-form') searchForm!: HTMLFormElement
68
68
 
69
69
  render() {
70
70
  return html`
@@ -85,14 +85,6 @@ class MenuManagementDetail extends localize(i18next)(LitElement) {
85
85
  `
86
86
  }
87
87
 
88
- get searchForm() {
89
- return this.shadowRoot.querySelector('search-form')
90
- }
91
-
92
- get dataGrist() {
93
- return this.shadowRoot.querySelector('ox-grist')
94
- }
95
-
96
88
  firstUpdated() {
97
89
  this.searchFields = [
98
90
  {
@@ -224,6 +216,20 @@ class MenuManagementDetail extends localize(i18next)(LitElement) {
224
216
  sortable: true,
225
217
  width: 80
226
218
  },
219
+ {
220
+ type: 'resource-object',
221
+ name: 'role',
222
+ label: true,
223
+ header: i18next.t('field.required role'),
224
+ record: {
225
+ editable: true,
226
+ options: {
227
+ title: i18next.t('title.lookup role'),
228
+ queryName: 'roles'
229
+ }
230
+ },
231
+ width: 200
232
+ },
227
233
  {
228
234
  type: 'datetime',
229
235
  name: 'updatedAt',
@@ -244,7 +250,7 @@ class MenuManagementDetail extends localize(i18next)(LitElement) {
244
250
  }
245
251
  }
246
252
 
247
- async fetchHandler({ page, limit, sorters = [{ name: 'rank' }, { name: 'name' }] }) {
253
+ async fetchHandler({ page, limit, sorters = [{ name: 'rank' }, { name: 'name' }] }: FetchOption) {
248
254
  const response = await client.query({
249
255
  query: gql`
250
256
  query {
@@ -264,6 +270,11 @@ class MenuManagementDetail extends localize(i18next)(LitElement) {
264
270
  resourceType
265
271
  resourceId
266
272
  hiddenFlag
273
+ role {
274
+ id
275
+ name
276
+ description
277
+ }
267
278
  updatedAt
268
279
  updater{
269
280
  id
@@ -343,7 +354,7 @@ class MenuManagementDetail extends localize(i18next)(LitElement) {
343
354
  let patches = this.dataGrist.dirtyRecords
344
355
  if (patches && patches.length) {
345
356
  patches = patches.map(menu => {
346
- let patchField = menu.id ? { id: menu.id } : {}
357
+ let patchField: any = menu.id ? { id: menu.id } : {}
347
358
  patchField = { ...patchField, routingType: menu.routingType, menuType: menu.menuType }
348
359
  const dirtyFields = menu.__dirtyfields__
349
360
  for (let key in dirtyFields) {
@@ -361,5 +372,3 @@ class MenuManagementDetail extends localize(i18next)(LitElement) {
361
372
  return patches
362
373
  }
363
374
  }
364
-
365
- customElements.define('menu-management-detail', MenuManagementDetail)