@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.
Files changed (57) hide show
  1. package/dist-client/apptools/favorite-tool.d.ts +28 -0
  2. package/dist-client/apptools/favorite-tool.js +139 -0
  3. package/dist-client/apptools/favorite-tool.js.map +1 -0
  4. package/dist-client/bootstrap.d.ts +4 -0
  5. package/dist-client/bootstrap.js +52 -0
  6. package/dist-client/bootstrap.js.map +1 -0
  7. package/dist-client/components/child-menus-selector.d.ts +1 -0
  8. package/dist-client/components/child-menus-selector.js +146 -0
  9. package/dist-client/components/child-menus-selector.js.map +1 -0
  10. package/dist-client/components/role-select-popup.d.ts +1 -0
  11. package/dist-client/components/role-select-popup.js +180 -0
  12. package/dist-client/components/role-select-popup.js.map +1 -0
  13. package/dist-client/index.js +2 -0
  14. package/dist-client/index.js.map +1 -0
  15. package/dist-client/pages/menu-list-page.d.ts +2 -0
  16. package/dist-client/pages/menu-list-page.js +204 -0
  17. package/dist-client/pages/menu-list-page.js.map +1 -0
  18. package/dist-client/pages/menu-management-detail.d.ts +2 -0
  19. package/dist-client/pages/menu-management-detail.js +376 -0
  20. package/dist-client/pages/menu-management-detail.js.map +1 -0
  21. package/dist-client/pages/menu-management.d.ts +3 -0
  22. package/dist-client/pages/menu-management.js +280 -0
  23. package/dist-client/pages/menu-management.js.map +1 -0
  24. package/dist-client/pages/role-menus-management.d.ts +4 -0
  25. package/dist-client/pages/role-menus-management.js +215 -0
  26. package/dist-client/pages/role-menus-management.js.map +1 -0
  27. package/dist-client/route.d.ts +1 -0
  28. package/dist-client/route.js +14 -0
  29. package/dist-client/route.js.map +1 -0
  30. package/dist-client/tsconfig.tsbuildinfo +1 -0
  31. package/dist-client/viewparts/menu-bar.d.ts +12 -0
  32. package/dist-client/viewparts/menu-bar.js +108 -0
  33. package/dist-client/viewparts/menu-bar.js.map +1 -0
  34. package/dist-client/viewparts/menu-tile-list.d.ts +13 -0
  35. package/dist-client/viewparts/menu-tile-list.js +234 -0
  36. package/dist-client/viewparts/menu-tile-list.js.map +1 -0
  37. package/dist-client/viewparts/menu-tree-bar.d.ts +28 -0
  38. package/dist-client/viewparts/menu-tree-bar.js +307 -0
  39. package/dist-client/viewparts/menu-tree-bar.js.map +1 -0
  40. package/dist-server/tsconfig.tsbuildinfo +1 -1
  41. package/package.json +21 -18
  42. package/things-factory.config.js +5 -14
  43. package/client/apptools/favorite-tool.js +0 -130
  44. package/client/bootstrap.js +0 -57
  45. package/client/components/child-menus-selector.js +0 -150
  46. package/client/components/role-select-popup.js +0 -179
  47. package/client/pages/menu-list-page.js +0 -200
  48. package/client/pages/menu-management-detail.js +0 -384
  49. package/client/pages/menu-management.js +0 -294
  50. package/client/pages/role-menus-management.js +0 -215
  51. package/client/route.js +0 -15
  52. package/client/viewparts/menu-bar.js +0 -114
  53. package/client/viewparts/menu-tile-list.js +0 -222
  54. package/client/viewparts/menu-tree-bar.js +0 -295
  55. package/server/index.ts +0 -0
  56. /package/{client/index.js → dist-client/index.d.ts} +0 -0
  57. /package/{client → dist-client}/themes/menu-theme.css +0 -0
@@ -1,295 +0,0 @@
1
- import '@material/web/icon/icon.js'
2
-
3
- import gql from 'graphql-tag'
4
- import { css, html, LitElement } from 'lit'
5
- import { connect } from 'pwa-helpers/connect-mixin.js'
6
-
7
- import { client, store } from '@things-factory/shell'
8
- import { ScrollbarStyles } from '@operato/styles'
9
-
10
- export default class MenuTreeBar extends connect(store)(LitElement) {
11
- static get styles() {
12
- return [
13
- ScrollbarStyles,
14
- css`
15
- :host {
16
- display: flex;
17
- flex-direction: column;
18
- min-width: 200px;
19
- }
20
- [domain] {
21
- background: var(--menu-domain-background-color);
22
- background: linear-gradient(180deg, var(--md-sys-color-secondary) 0%, var(--md-sys-color-primary) 120%);
23
- padding: var(--menu-domain-padding);
24
- border-bottom: 1px solid var(--md-sys-color-primary);
25
- }
26
- [domain] md-icon {
27
- margin-right: -8px;
28
- font-size: 12px;
29
- color: var(--menu-domain-icon-color);
30
- }
31
- [domain] * {
32
- vertical-align: middle;
33
- }
34
- [domain] span {
35
- padding-left: 7px;
36
- font: var(--menu-domain-font);
37
- color: var(--menu-domain-color);
38
- }
39
- [domain] select {
40
- background-color: transparent;
41
- width: -webkit-fill-available;
42
- max-width: 175px;
43
- border: none;
44
-
45
- font: var(--menu-domain-font);
46
- color: var(--menu-domain-color);
47
- }
48
- select:focus {
49
- outline: 0;
50
- }
51
-
52
- ul {
53
- list-style: none;
54
- margin: 0;
55
- padding: 0;
56
- }
57
-
58
- ul[toplevel] {
59
- overflow: auto;
60
- }
61
-
62
- li {
63
- border-bottom: var(--menu-tree-toplevel-border-bottom);
64
- }
65
-
66
- [grouplevel] li {
67
- border-bottom: var(--menu-tree-grouplevel-border-bottom);
68
- }
69
-
70
- li span,
71
- li a {
72
- display: block;
73
- text-decoration: none;
74
- position: relative;
75
- }
76
-
77
- [menutype] {
78
- position: absolute;
79
- font-size: 1.2em;
80
- right: 0;
81
- bottom: 50%;
82
- transform: translate(-5px, 50%);
83
- }
84
-
85
- [favorite] {
86
- color: var(--menu-tree-favorite-color, tomato);
87
- }
88
-
89
- [groupmenu] > span {
90
- padding: 9px 9px 7px 10px;
91
- font: var(--menu-tree-toplevel-font);
92
- color: var(--menu-tree-toplevel-color);
93
- }
94
-
95
- a {
96
- background-color: rgba(0, 0, 0, 0.4);
97
- padding: 7px 7px 6px 15px;
98
- font: var(--menu-tree-grouplevel-font);
99
- color: var(--menu-tree-grouplevel-color);
100
- }
101
-
102
- [groupmenu] > span::before {
103
- content: '';
104
- display: inline-block;
105
- width: var(--menu-tree-toplevel-icon-size);
106
- height: var(--menu-tree-toplevel-icon-size);
107
- border: var(--menu-tree-toplevel-icon-border);
108
- border-radius: 50%;
109
- margin-right: 5px;
110
- }
111
-
112
- a span::before {
113
- content: '-';
114
- margin-right: 4px;
115
- }
116
-
117
- [expanded] > span {
118
- font-weight: bold;
119
- color: var(--menu-tree-focus-color);
120
- }
121
-
122
- [grouplevel] {
123
- overflow-y: hidden;
124
- max-height: 0;
125
-
126
- transition-property: all;
127
- transition-duration: 0.7s;
128
- }
129
-
130
- [expanded] > [grouplevel] {
131
- overflow-y: auto;
132
- max-height: 500px;
133
- }
134
-
135
- li[active] a {
136
- color: var(--menu-tree-focus-color);
137
- font-weight: bold;
138
- border-left: var(--menu-tree-grouplevel-active-border-left);
139
- background-color: rgba(0, 0, 0, 0.6);
140
- padding-left: 12px;
141
- }
142
- `
143
- ]
144
- }
145
-
146
- static get properties() {
147
- return {
148
- menuId: String,
149
- menus: Array,
150
- favorites: Array,
151
- routingTypes: Object,
152
- page: Object,
153
- user: Object,
154
- contextPath: String,
155
- domains: Array,
156
- domain: Object
157
- }
158
- }
159
-
160
- render() {
161
- var domains = this.domains || []
162
- var domain = this.domain || {}
163
- const currentRouting = decodeURIComponent(
164
- location.pathname.substr(this.contextPath ? this.contextPath.length + 1 : 1)
165
- )
166
-
167
- return html`
168
- <div domain>
169
- <md-icon>beenhere</md-icon>
170
- ${domains.length <= 1
171
- ? html` <span>${domain.name}</span> `
172
- : html`
173
- <select
174
- .value=${domain.subdomain}
175
- @change=${e => (window.location.pathname = `/auth/checkin/${e.target.value}`)}
176
- >
177
- ${domains.map(
178
- d => html`
179
- <option .value=${d.subdomain} ?selected=${d.subdomain == domain.subdomain}>${d.name}</option>
180
- `
181
- )}
182
- </select>
183
- `}
184
- </div>
185
-
186
- <ul toplevel>
187
- ${(this.menus || []).map(
188
- menu => html`
189
- <li groupmenu>
190
- <span
191
- @click=${e => {
192
- e.target.parentElement.toggleAttribute('expanded')
193
- this.renderRoot
194
- .querySelectorAll('[expanded]')
195
- .forEach(element => element !== e.target.parentElement && element.removeAttribute('expanded'))
196
- }}
197
- >${menu.name}</span
198
- >
199
-
200
- <ul grouplevel>
201
- ${menu.children.map(subMenu => {
202
- const routing = this._getFullRouting(subMenu)
203
- const favorite = this.favorites.includes(routing)
204
- const { icon } = this.routingTypes[subMenu.routingType] || {}
205
- const typeIcon = icon ? icon : favorite ? 'star' : null
206
-
207
- return html`
208
- <li ?active=${routing === currentRouting}>
209
- <a href=${routing}>
210
- <span>${subMenu.name}</span>
211
- ${typeIcon ? html` <md-icon menutype ?favorite=${favorite}>${typeIcon}</md-icon> ` : html``}</a
212
- >
213
- </li>
214
- `
215
- })}
216
- </ul>
217
- </li>
218
- `
219
- )}
220
- </ul>
221
- `
222
- }
223
-
224
- async updated(changes) {
225
- if (changes.has('user')) {
226
- this.menus = await this.getMenus()
227
- }
228
-
229
- await this.updateComplete
230
-
231
- var active = this.shadowRoot.querySelector('[active]')
232
- if (active) {
233
- active.parentElement.parentElement.setAttribute('expanded', '')
234
- }
235
- }
236
-
237
- stateChanged(state) {
238
- this.contextPath = state.app.contextPath
239
- this.routingTypes = state.menu.routingTypes
240
- this.menuId = state.route.resourceId
241
- this.page = state.route.page
242
- this.user = state.auth.user
243
- this.domains = state.app.domains
244
- this.domain = state.app.domain
245
- this.getMenus =
246
- state.menu.provider && typeof state.menu.provider === 'function' ? state.menu.provider : this.getMenus
247
- this.favorites = state.favorite.favorites
248
- }
249
-
250
- _getFullRouting(menu) {
251
- var { routingType, resourceUrl, titleField, name, resourceType, resourceId } = menu
252
- if (routingType.toUpperCase() === 'STATIC') {
253
- if (resourceType?.toUpperCase() === 'BOARD') {
254
- return `${resourceUrl || 'board-viewer'}/${resourceId}?title=${name}`
255
- }
256
- return resourceUrl
257
- }
258
-
259
- var { page } = this.routingTypes[routingType]
260
- return titleField ? `${page}/${menu[titleField]}` : `${page}/${name}`
261
- }
262
-
263
- _onClickRefresh(e) {
264
- this.dispatchEvent(new CustomEvent('refresh'))
265
- }
266
-
267
- async getMenus() {
268
- const response = await client.query({
269
- query: gql`
270
- query {
271
- userMenus {
272
- id
273
- name
274
- children {
275
- id
276
- name
277
- routingType
278
- idField
279
- titleField
280
- resourceType
281
- resourceId
282
- resourceName
283
- resourceUrl
284
- template
285
- }
286
- }
287
- }
288
- `
289
- })
290
-
291
- return response.data.userMenus
292
- }
293
- }
294
-
295
- window.customElements.define('menu-tree-bar', MenuTreeBar)
package/server/index.ts DELETED
File without changes
File without changes
File without changes