@things-factory/menu-ui 8.0.5 → 9.0.0-beta.12
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/dist-client/apptools/favorite-tool.d.ts +28 -0
- package/dist-client/apptools/favorite-tool.js +139 -0
- package/dist-client/apptools/favorite-tool.js.map +1 -0
- package/dist-client/bootstrap.d.ts +4 -0
- package/dist-client/bootstrap.js +52 -0
- package/dist-client/bootstrap.js.map +1 -0
- package/dist-client/components/child-menus-selector.d.ts +1 -0
- package/dist-client/components/child-menus-selector.js +146 -0
- package/dist-client/components/child-menus-selector.js.map +1 -0
- package/dist-client/components/role-select-popup.d.ts +1 -0
- package/dist-client/components/role-select-popup.js +180 -0
- package/dist-client/components/role-select-popup.js.map +1 -0
- package/dist-client/index.js +2 -0
- package/dist-client/index.js.map +1 -0
- package/dist-client/pages/menu-list-page.d.ts +2 -0
- package/dist-client/pages/menu-list-page.js +204 -0
- package/dist-client/pages/menu-list-page.js.map +1 -0
- package/dist-client/pages/menu-management-detail.d.ts +2 -0
- package/dist-client/pages/menu-management-detail.js +376 -0
- package/dist-client/pages/menu-management-detail.js.map +1 -0
- package/dist-client/pages/menu-management.d.ts +3 -0
- package/dist-client/pages/menu-management.js +280 -0
- package/dist-client/pages/menu-management.js.map +1 -0
- package/dist-client/pages/role-menus-management.d.ts +4 -0
- package/dist-client/pages/role-menus-management.js +215 -0
- package/dist-client/pages/role-menus-management.js.map +1 -0
- package/dist-client/route.d.ts +1 -0
- package/dist-client/route.js +14 -0
- package/dist-client/route.js.map +1 -0
- package/dist-client/tsconfig.tsbuildinfo +1 -0
- package/dist-client/viewparts/menu-bar.d.ts +12 -0
- package/dist-client/viewparts/menu-bar.js +108 -0
- package/dist-client/viewparts/menu-bar.js.map +1 -0
- package/dist-client/viewparts/menu-tile-list.d.ts +13 -0
- package/dist-client/viewparts/menu-tile-list.js +234 -0
- package/dist-client/viewparts/menu-tile-list.js.map +1 -0
- package/dist-client/viewparts/menu-tree-bar.d.ts +28 -0
- package/dist-client/viewparts/menu-tree-bar.js +307 -0
- package/dist-client/viewparts/menu-tree-bar.js.map +1 -0
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +21 -18
- package/things-factory.config.js +5 -14
- package/client/apptools/favorite-tool.js +0 -130
- package/client/bootstrap.js +0 -57
- package/client/components/child-menus-selector.js +0 -150
- package/client/components/role-select-popup.js +0 -179
- package/client/pages/menu-list-page.js +0 -200
- package/client/pages/menu-management-detail.js +0 -384
- package/client/pages/menu-management.js +0 -294
- package/client/pages/role-menus-management.js +0 -215
- package/client/route.js +0 -15
- package/client/viewparts/menu-bar.js +0 -114
- package/client/viewparts/menu-tile-list.js +0 -222
- package/client/viewparts/menu-tree-bar.js +0 -295
- package/server/index.ts +0 -0
- /package/{client/index.js → dist-client/index.d.ts} +0 -0
- /package/{client → dist-client}/themes/menu-theme.css +0 -0
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
import { i18next, localize } from '@operato/i18n'
|
|
2
|
-
import { client } from '@operato/graphql'
|
|
3
|
-
import gql from 'graphql-tag'
|
|
4
|
-
import { css, html, LitElement } from 'lit'
|
|
5
|
-
import { isMobileDevice } from '@operato/utils'
|
|
6
|
-
import '@operato/data-grist'
|
|
7
|
-
import { CommonHeaderStyles } from '@operato/styles'
|
|
8
|
-
|
|
9
|
-
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
|
-
}
|
|
20
|
-
|
|
21
|
-
.container {
|
|
22
|
-
flex: 1;
|
|
23
|
-
display: flex;
|
|
24
|
-
overflow-y: auto;
|
|
25
|
-
min-height: 20vh;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.grist {
|
|
29
|
-
display: flex;
|
|
30
|
-
flex-direction: column;
|
|
31
|
-
flex: 1;
|
|
32
|
-
overflow-y: auto;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
ox-grist {
|
|
36
|
-
overflow-y: hidden;
|
|
37
|
-
flex: 1;
|
|
38
|
-
}
|
|
39
|
-
`
|
|
40
|
-
]
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
static get properties() {
|
|
44
|
-
return {
|
|
45
|
-
_searchFields: Array,
|
|
46
|
-
config: Object
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
render() {
|
|
51
|
-
return html`
|
|
52
|
-
<search-form .fields=${this._searchFields} @submit=${async () => this.dataGrist.fetch()}></search-form>
|
|
53
|
-
|
|
54
|
-
<div class="container">
|
|
55
|
-
<div class="grist">
|
|
56
|
-
<ox-grist
|
|
57
|
-
.mode=${isMobileDevice() ? 'LIST' : 'GRID'}
|
|
58
|
-
.config=${this.config}
|
|
59
|
-
.fetchHandler="${this.fetchHandler.bind(this)}"
|
|
60
|
-
></ox-grist>
|
|
61
|
-
</div>
|
|
62
|
-
</div>
|
|
63
|
-
|
|
64
|
-
<div class="footer">
|
|
65
|
-
<div filler></div>
|
|
66
|
-
<button @click=${this._selectRole.bind(this)} label=${i18next.t('button.select')} done></button>
|
|
67
|
-
</div>
|
|
68
|
-
`
|
|
69
|
-
}
|
|
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
|
-
firstUpdated() {
|
|
80
|
-
this._searchFields = [
|
|
81
|
-
{
|
|
82
|
-
name: 'name',
|
|
83
|
-
type: 'text',
|
|
84
|
-
props: {
|
|
85
|
-
placeholder: i18next.t('field.name'),
|
|
86
|
-
searchOper: 'i_like'
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
name: 'description',
|
|
91
|
-
type: 'text',
|
|
92
|
-
props: {
|
|
93
|
-
placeholder: i18next.t('field.description'),
|
|
94
|
-
searchOper: 'i_like'
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
]
|
|
98
|
-
|
|
99
|
-
this.config = {
|
|
100
|
-
rows: {
|
|
101
|
-
appendable: false
|
|
102
|
-
},
|
|
103
|
-
columns: [
|
|
104
|
-
{ type: 'gutter', gutterName: 'sequence' },
|
|
105
|
-
{ type: 'gutter', gutterName: 'row-selector', multiple: false },
|
|
106
|
-
{
|
|
107
|
-
type: 'string',
|
|
108
|
-
name: 'name',
|
|
109
|
-
header: i18next.t('field.name'),
|
|
110
|
-
record: {
|
|
111
|
-
editable: false
|
|
112
|
-
},
|
|
113
|
-
width: 200
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
type: 'string',
|
|
117
|
-
name: 'description',
|
|
118
|
-
header: i18next.t('field.description'),
|
|
119
|
-
record: {
|
|
120
|
-
editable: true
|
|
121
|
-
},
|
|
122
|
-
width: 250
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
type: 'datetime',
|
|
126
|
-
name: 'updatedAt',
|
|
127
|
-
header: i18next.t('field.updated_at'),
|
|
128
|
-
width: 180
|
|
129
|
-
}
|
|
130
|
-
]
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
async fetchHandler({ page, limit, sorters = [] }) {
|
|
135
|
-
const filters = this.searchForm?.queryFilters || []
|
|
136
|
-
|
|
137
|
-
const response = await client.query({
|
|
138
|
-
query: gql`
|
|
139
|
-
query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
|
|
140
|
-
roles(filters: $filters, pagination: $pagination, sortings: $sortings) {
|
|
141
|
-
items {
|
|
142
|
-
id
|
|
143
|
-
name
|
|
144
|
-
description
|
|
145
|
-
updatedAt
|
|
146
|
-
}
|
|
147
|
-
total
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
`,
|
|
151
|
-
variables: {
|
|
152
|
-
filters,
|
|
153
|
-
pagination: { page, limit },
|
|
154
|
-
sortings: sorters
|
|
155
|
-
}
|
|
156
|
-
})
|
|
157
|
-
|
|
158
|
-
return {
|
|
159
|
-
total: response.data.roles.total || 0,
|
|
160
|
-
records: response.data.roles.items || []
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
_selectRole() {
|
|
165
|
-
const selectedRole = this.dataGrist.selected[0]
|
|
166
|
-
if (selectedRole) {
|
|
167
|
-
this.dispatchEvent(new CustomEvent('selected', { detail: this.dataGrist.selected[0] }))
|
|
168
|
-
history.back()
|
|
169
|
-
} else {
|
|
170
|
-
this.showToast(i18next.t('text.target_is_not_selected'))
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
showToast(message) {
|
|
175
|
-
document.dispatchEvent(new CustomEvent('notify', { detail: { message, option: { timer: 1000 } } }))
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
window.customElements.define('role-select-popup', RoleSelectPopup)
|
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
import '../viewparts/menu-bar'
|
|
2
|
-
import '../viewparts/menu-tile-list'
|
|
3
|
-
|
|
4
|
-
import gql from 'graphql-tag'
|
|
5
|
-
import { css, html } from 'lit'
|
|
6
|
-
import { connect } from 'pwa-helpers/connect-mixin.js'
|
|
7
|
-
|
|
8
|
-
import { client, navigate, PageView, store } from '@things-factory/shell'
|
|
9
|
-
import { ScrollbarStyles } from '@operato/styles'
|
|
10
|
-
import { pulltorefresh, swipe } from '@things-factory/utils'
|
|
11
|
-
|
|
12
|
-
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
|
-
}
|
|
23
|
-
|
|
24
|
-
menu-bar {
|
|
25
|
-
z-index: 1;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
menu-tile-list {
|
|
29
|
-
flex: 1;
|
|
30
|
-
overflow-y: auto;
|
|
31
|
-
}
|
|
32
|
-
`
|
|
33
|
-
]
|
|
34
|
-
}
|
|
35
|
-
|
|
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
|
-
}
|
|
46
|
-
|
|
47
|
-
render() {
|
|
48
|
-
return html`
|
|
49
|
-
<menu-bar .menus=${this.menus} .menuId=${this.menuId}></menu-bar>
|
|
50
|
-
|
|
51
|
-
<menu-tile-list
|
|
52
|
-
.menus=${this.menus}
|
|
53
|
-
.routingTypes=${this.routingTypes}
|
|
54
|
-
.menuId=${this.menuId}
|
|
55
|
-
.favorites=${this.favorites}
|
|
56
|
-
.showSpinner=${this.showSpinner}
|
|
57
|
-
></menu-tile-list>
|
|
58
|
-
`
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
get context() {
|
|
62
|
-
return {
|
|
63
|
-
title: 'Menu'
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
async fetchMenus() {
|
|
68
|
-
const response = await client.query({
|
|
69
|
-
query: gql`
|
|
70
|
-
query {
|
|
71
|
-
userMenus {
|
|
72
|
-
id
|
|
73
|
-
name
|
|
74
|
-
role {
|
|
75
|
-
id
|
|
76
|
-
name
|
|
77
|
-
description
|
|
78
|
-
}
|
|
79
|
-
children {
|
|
80
|
-
id
|
|
81
|
-
name
|
|
82
|
-
routingType
|
|
83
|
-
idField
|
|
84
|
-
titleField
|
|
85
|
-
resourceName
|
|
86
|
-
resourceUrl
|
|
87
|
-
template
|
|
88
|
-
role {
|
|
89
|
-
id
|
|
90
|
-
name
|
|
91
|
-
description
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
`
|
|
97
|
-
})
|
|
98
|
-
|
|
99
|
-
return response.data.userMenus
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
async updated(changes) {
|
|
103
|
-
if (changes.has('user')) {
|
|
104
|
-
if (this.user && this.user.email) {
|
|
105
|
-
this.refresh()
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
stateChanged(state) {
|
|
111
|
-
this.page = state.route.page
|
|
112
|
-
this.routingTypes = state.menu.routingTypes
|
|
113
|
-
this.menuId = state.route.resourceId
|
|
114
|
-
this.favorites = state.favorite.favorites
|
|
115
|
-
this.user = state.auth.user
|
|
116
|
-
|
|
117
|
-
var provider = state.menu.provider
|
|
118
|
-
this.getMenus = typeof provider === 'function' ? provider.bind(this) : this.fetchMenus
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
async refresh() {
|
|
122
|
-
this.showSpinner = true
|
|
123
|
-
this.menus = await this.getMenus()
|
|
124
|
-
this.showSpinner = false
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
async firstUpdated() {
|
|
128
|
-
var list = this.shadowRoot.querySelector('menu-tile-list')
|
|
129
|
-
|
|
130
|
-
pulltorefresh({
|
|
131
|
-
container: this.shadowRoot,
|
|
132
|
-
scrollable: list,
|
|
133
|
-
refresh: () => {
|
|
134
|
-
return this.refresh()
|
|
135
|
-
}
|
|
136
|
-
})
|
|
137
|
-
|
|
138
|
-
swipe({
|
|
139
|
-
container: this.shadowRoot.querySelector('menu-tile-list'),
|
|
140
|
-
animates: {
|
|
141
|
-
dragging: async (d, opts) => {
|
|
142
|
-
var currentIndex = Number(this.menuId)
|
|
143
|
-
var isHome = this.menuId === '' || this.menuId === undefined
|
|
144
|
-
|
|
145
|
-
if ((d > 0 && isHome) || (d < 0 && currentIndex >= this.menus.length - 1)) {
|
|
146
|
-
/* TODO blocked gesture */
|
|
147
|
-
return false
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
list.style.transform = `translate3d(${d}px, 0, 0)`
|
|
151
|
-
},
|
|
152
|
-
aborting: async opts => {
|
|
153
|
-
list.style.transition = 'transform 0.3s'
|
|
154
|
-
list.style.transform = `translate3d(0, 0, 0)`
|
|
155
|
-
|
|
156
|
-
setTimeout(() => {
|
|
157
|
-
list.style.transition = ''
|
|
158
|
-
}, 300)
|
|
159
|
-
},
|
|
160
|
-
swiping: async (d, opts) => {
|
|
161
|
-
var currentIndex = Number(this.menuId)
|
|
162
|
-
var isHome = this.menuId === '' || this.menuId === undefined
|
|
163
|
-
|
|
164
|
-
if ((d > 0 && isHome) || (d < 0 && currentIndex >= this.menus.length - 1)) {
|
|
165
|
-
list.style.transform = `translate3d(0, 0, 0)`
|
|
166
|
-
|
|
167
|
-
return
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
list.style.transition = 'transform 0.3s'
|
|
171
|
-
list.style.transform = `translate3d(${d < 0 ? '-100%' : '100%'}, 0, 0)`
|
|
172
|
-
|
|
173
|
-
setTimeout(() => {
|
|
174
|
-
if (isHome) {
|
|
175
|
-
navigate(`${this.page}/0`)
|
|
176
|
-
} else if (d > 0 && currentIndex == 0) {
|
|
177
|
-
navigate(`${this.page}`)
|
|
178
|
-
} else {
|
|
179
|
-
navigate(`${this.page}/${currentIndex + (d < 0 ? 1 : -1)}`)
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
list.style.transition = ''
|
|
183
|
-
list.style.transform = `translate3d(${d < 0 ? '100%' : '-100%'}, 0, 0)`
|
|
184
|
-
|
|
185
|
-
requestAnimationFrame(() => {
|
|
186
|
-
list.style.transition = 'transform 0.3s'
|
|
187
|
-
list.style.transform = `translate3d(0, 0, 0)`
|
|
188
|
-
})
|
|
189
|
-
}, 300)
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
})
|
|
193
|
-
|
|
194
|
-
await this.updateComplete
|
|
195
|
-
|
|
196
|
-
this.refresh()
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
window.customElements.define('menu-list-page', MenuListPage)
|