@things-factory/lite-menu 6.2.77 → 6.2.79
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/client/actions/{lite-menu.js → lite-menu.ts} +2 -2
- package/client/{lite-menu-setting-let.js → lite-menu-setting-let.ts} +16 -22
- package/client/pages/{addon-menu-setting.js → addon-menu-setting.ts} +47 -71
- package/client/tsconfig.json +13 -0
- package/client/viewparts/{lite-menu-landscape.js → lite-menu-landscape.ts} +23 -25
- package/client/viewparts/{lite-menu-part.js → lite-menu-part.ts} +44 -49
- package/client/viewparts/{lite-menu-portrait.js → lite-menu-portrait.ts} +15 -19
- package/client/viewparts/{top-menu-bar.js → top-menu-bar.ts} +11 -14
- package/dist-client/actions/lite-menu.d.ts +7 -0
- package/dist-client/actions/lite-menu.js +114 -0
- package/dist-client/actions/lite-menu.js.map +1 -0
- package/dist-client/bootstrap.d.ts +4 -0
- package/dist-client/bootstrap.js +14 -0
- package/dist-client/bootstrap.js.map +1 -0
- package/dist-client/index.d.ts +4 -0
- package/dist-client/index.js +5 -0
- package/dist-client/index.js.map +1 -0
- package/dist-client/lite-menu-setting-let.d.ts +13 -0
- package/dist-client/lite-menu-setting-let.js +83 -0
- package/dist-client/lite-menu-setting-let.js.map +1 -0
- package/dist-client/pages/addon-menu-setting.d.ts +7 -0
- package/dist-client/pages/addon-menu-setting.js +480 -0
- package/dist-client/pages/addon-menu-setting.js.map +1 -0
- package/dist-client/reducers/lite-menu.d.ts +14 -0
- package/dist-client/reducers/lite-menu.js +60 -0
- package/dist-client/reducers/lite-menu.js.map +1 -0
- package/dist-client/route.d.ts +1 -0
- package/dist-client/route.js +8 -0
- package/dist-client/route.js.map +1 -0
- package/dist-client/tsconfig.tsbuildinfo +1 -0
- package/dist-client/viewparts/lite-menu-landscape-styles.d.ts +1 -0
- package/dist-client/viewparts/lite-menu-landscape-styles.js +149 -0
- package/dist-client/viewparts/lite-menu-landscape-styles.js.map +1 -0
- package/dist-client/viewparts/lite-menu-landscape.d.ts +20 -0
- package/dist-client/viewparts/lite-menu-landscape.js +103 -0
- package/dist-client/viewparts/lite-menu-landscape.js.map +1 -0
- package/dist-client/viewparts/lite-menu-part.d.ts +28 -0
- package/dist-client/viewparts/lite-menu-part.js +143 -0
- package/dist-client/viewparts/lite-menu-part.js.map +1 -0
- package/dist-client/viewparts/lite-menu-portrait-styles.d.ts +1 -0
- package/dist-client/viewparts/lite-menu-portrait-styles.js +147 -0
- package/dist-client/viewparts/lite-menu-portrait-styles.js.map +1 -0
- package/dist-client/viewparts/lite-menu-portrait.d.ts +12 -0
- package/dist-client/viewparts/lite-menu-portrait.js +89 -0
- package/dist-client/viewparts/lite-menu-portrait.js.map +1 -0
- package/dist-client/viewparts/top-menu-bar.d.ts +22 -0
- package/dist-client/viewparts/top-menu-bar.js +150 -0
- package/dist-client/viewparts/top-menu-bar.js.map +1 -0
- package/dist-server/index.js +0 -1
- package/dist-server/index.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +16 -13
- package/server/index.ts +0 -1
- package/server/tsconfig.json +10 -0
- package/things-factory.config.js +2 -2
- package/dist-server/migrations/index.js +0 -12
- package/dist-server/migrations/index.js.map +0 -1
- package/server/migrations/index.ts +0 -9
- package/tsconfig.json +0 -9
- /package/client/{bootstrap.js → bootstrap.ts} +0 -0
- /package/client/{index.js → index.ts} +0 -0
- /package/client/reducers/{lite-menu.js → lite-menu.ts} +0 -0
- /package/client/{route.js → route.ts} +0 -0
- /package/client/viewparts/{lite-menu-landscape-styles.js → lite-menu-landscape-styles.ts} +0 -0
- /package/client/viewparts/{lite-menu-portrait-styles.js → lite-menu-portrait-styles.ts} +0 -0
|
@@ -8,8 +8,8 @@ import { client } from '@operato/graphql'
|
|
|
8
8
|
import { appendViewpart, toggleOverlay, TOOL_POSITION, VIEWPART_POSITION } from '@operato/layout'
|
|
9
9
|
import { store, InheritedValueType } from '@operato/shell'
|
|
10
10
|
import { isMobileDevice } from '@operato/utils'
|
|
11
|
+
import { clientSettingStore } from '@operato/shell'
|
|
11
12
|
import { APPEND_APP_TOOL, REMOVE_APP_TOOL } from '@things-factory/apptool-base'
|
|
12
|
-
import { clientSettingStore } from '@things-factory/shell'
|
|
13
13
|
|
|
14
14
|
export const UPDATE_ADDON_MENUS = 'UPDATE_ADDON_MENUS'
|
|
15
15
|
export const UPDATE_MENU_TEMPLATE = 'UPDATE_MENU_TEMPLATE'
|
|
@@ -87,7 +87,7 @@ export function updateMenuTemplate(template) {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
export async function fetchAddonMenus() {
|
|
90
|
-
var applicationName = document.querySelector('meta[name="application-name"]')?.content
|
|
90
|
+
var applicationName = (document.querySelector('meta[name="application-name"]') as HTMLMetaElement)?.content
|
|
91
91
|
|
|
92
92
|
var liteMenus = (
|
|
93
93
|
await client.query({
|
|
@@ -3,30 +3,26 @@ import '@material/mwc-checkbox'
|
|
|
3
3
|
import '@operato/i18n/ox-i18n.js'
|
|
4
4
|
|
|
5
5
|
import { css, html, LitElement } from 'lit'
|
|
6
|
+
import { customElement, query, property, state } from 'lit/decorators.js'
|
|
6
7
|
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
8
|
+
import { clientSettingStore } from '@operato/shell'
|
|
9
|
+
import { i18next, localize } from '@operato/i18n'
|
|
9
10
|
|
|
10
11
|
import { setupMenuPart } from './actions/lite-menu'
|
|
11
12
|
|
|
13
|
+
@customElement('lite-menu-setting-let')
|
|
12
14
|
export class LiteMenuSettingLet extends localize(i18next)(LitElement) {
|
|
13
|
-
static
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
label
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
]
|
|
23
|
-
}
|
|
15
|
+
static styles = [
|
|
16
|
+
css`
|
|
17
|
+
label {
|
|
18
|
+
font: var(--label-font);
|
|
19
|
+
color: var(--label-color);
|
|
20
|
+
text-transform: var(--label-text-transform);
|
|
21
|
+
}
|
|
22
|
+
`
|
|
23
|
+
]
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
return {
|
|
27
|
-
hovering: Boolean
|
|
28
|
-
}
|
|
29
|
-
}
|
|
25
|
+
@property({ type: Boolean }) hovering?: boolean
|
|
30
26
|
|
|
31
27
|
render() {
|
|
32
28
|
const checked = this.hovering === true
|
|
@@ -40,7 +36,7 @@ export class LiteMenuSettingLet extends localize(i18next)(LitElement) {
|
|
|
40
36
|
<mwc-formfield label="hovering">
|
|
41
37
|
<mwc-checkbox
|
|
42
38
|
id="hovering"
|
|
43
|
-
@change=${e => this.
|
|
39
|
+
@change=${e => this.onChange(e)}
|
|
44
40
|
?checked=${checked}
|
|
45
41
|
?indeterminate=${indeterminate}
|
|
46
42
|
></mwc-checkbox>
|
|
@@ -54,7 +50,7 @@ export class LiteMenuSettingLet extends localize(i18next)(LitElement) {
|
|
|
54
50
|
this.hovering = ((await clientSettingStore.get('lite-menu'))?.value || {}).hovering
|
|
55
51
|
}
|
|
56
52
|
|
|
57
|
-
async
|
|
53
|
+
async onChange(e: Event) {
|
|
58
54
|
if (this.hovering === true) {
|
|
59
55
|
this.hovering = false
|
|
60
56
|
} else if (this.hovering === false) {
|
|
@@ -84,5 +80,3 @@ export class LiteMenuSettingLet extends localize(i18next)(LitElement) {
|
|
|
84
80
|
})
|
|
85
81
|
}
|
|
86
82
|
}
|
|
87
|
-
|
|
88
|
-
customElements.define('lite-menu-setting-let', LiteMenuSettingLet)
|
|
@@ -3,77 +3,76 @@ import '@operato/data-grist/ox-filters-form.js'
|
|
|
3
3
|
import '@operato/data-grist/ox-sorters-control.js'
|
|
4
4
|
import '@operato/data-grist/ox-record-creator.js'
|
|
5
5
|
import '@operato/popup/ox-popup.js'
|
|
6
|
+
import '@operato/context/ox-context-page-toolbar.js'
|
|
6
7
|
import '@material/mwc-icon'
|
|
7
8
|
|
|
8
9
|
import gql from 'graphql-tag'
|
|
9
10
|
import { css, html } from 'lit'
|
|
11
|
+
import { customElement, property, query, state } from 'lit/decorators.js'
|
|
10
12
|
import { connect } from 'pwa-helpers/connect-mixin.js'
|
|
11
13
|
|
|
12
|
-
import { getEditor, getRenderer } from '@operato/data-grist'
|
|
14
|
+
import { DataGrist, getEditor, getRenderer } from '@operato/data-grist'
|
|
13
15
|
import { client } from '@operato/graphql'
|
|
14
16
|
import { i18next, localize } from '@operato/i18n'
|
|
15
17
|
import { PageView, store } from '@operato/shell'
|
|
16
|
-
import {
|
|
18
|
+
import { ScrollbarStyles, CommonHeaderStyles } from '@operato/styles'
|
|
17
19
|
import { isMobileDevice } from '@operato/utils'
|
|
18
20
|
|
|
19
21
|
import { fetchAddonMenus } from '../actions/lite-menu'
|
|
20
22
|
|
|
21
|
-
const applicationName = document.querySelector('meta[name="application-name"]')?.content
|
|
23
|
+
const applicationName = (document.querySelector('meta[name="application-name"]') as HTMLMetaElement)?.content
|
|
22
24
|
|
|
25
|
+
@customElement('addon-menu-setting')
|
|
23
26
|
class AddonMenuSetting extends connect(store)(localize(i18next)(PageView)) {
|
|
24
|
-
static
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
css`
|
|
36
|
-
:host {
|
|
37
|
-
display: flex;
|
|
38
|
-
overflow-x: hidden;
|
|
39
|
-
flex-direction: column;
|
|
27
|
+
static styles = [
|
|
28
|
+
ScrollbarStyles,
|
|
29
|
+
CommonHeaderStyles,
|
|
30
|
+
css`
|
|
31
|
+
:host {
|
|
32
|
+
display: flex;
|
|
33
|
+
overflow-x: hidden;
|
|
34
|
+
flex-direction: column;
|
|
35
|
+
|
|
36
|
+
width: 100%;
|
|
37
|
+
}
|
|
40
38
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
39
|
+
ox-grist {
|
|
40
|
+
overflow-y: auto;
|
|
41
|
+
flex: 1;
|
|
42
|
+
}
|
|
43
|
+
`
|
|
44
|
+
]
|
|
46
45
|
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
@state() config: any
|
|
47
|
+
@state() mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'
|
|
48
|
+
@state() menus: any[] = []
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
}
|
|
50
|
+
@query('ox-grist') private grist!: DataGrist
|
|
52
51
|
|
|
53
52
|
get context() {
|
|
54
53
|
return {
|
|
55
54
|
title: i18next.t('text.addon-menu management'),
|
|
56
55
|
actions: [
|
|
57
56
|
{
|
|
58
|
-
title: i18next.t('button.
|
|
57
|
+
title: i18next.t('button.refresh'),
|
|
59
58
|
action: () => {
|
|
60
59
|
this.onReload()
|
|
61
60
|
},
|
|
62
|
-
|
|
61
|
+
icon: 'refresh'
|
|
63
62
|
},
|
|
64
63
|
{
|
|
65
64
|
title: i18next.t('button.delete'),
|
|
66
65
|
action: () => {
|
|
67
66
|
this.onDelete()
|
|
68
67
|
},
|
|
69
|
-
|
|
68
|
+
icon: 'delete'
|
|
70
69
|
},
|
|
71
70
|
{
|
|
72
71
|
title: i18next.t('button.save'),
|
|
73
72
|
action: () => {
|
|
74
73
|
this.onCommit()
|
|
75
74
|
},
|
|
76
|
-
|
|
75
|
+
icon: 'save'
|
|
77
76
|
}
|
|
78
77
|
],
|
|
79
78
|
exportable: {
|
|
@@ -82,39 +81,25 @@ class AddonMenuSetting extends connect(store)(localize(i18next)(PageView)) {
|
|
|
82
81
|
data: () => {
|
|
83
82
|
return this.grist.data
|
|
84
83
|
}
|
|
85
|
-
}
|
|
84
|
+
},
|
|
85
|
+
toolbar: false
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
render() {
|
|
90
90
|
return html`
|
|
91
91
|
<ox-grist .mode=${this.mode} .config=${this.config} .fetchHandler=${this.fetchHandler}>
|
|
92
|
-
<div slot="headroom">
|
|
93
|
-
<div
|
|
94
|
-
<
|
|
92
|
+
<div slot="headroom" class="header">
|
|
93
|
+
<div class="title">
|
|
94
|
+
<mwc-icon>summarize</mwc-icon>
|
|
95
|
+
${i18next.t('text.addon-menu management')}
|
|
95
96
|
</div>
|
|
96
97
|
|
|
97
|
-
<div
|
|
98
|
-
|
|
99
|
-
<mwc-icon
|
|
100
|
-
@click=${e => {
|
|
101
|
-
const target = e.currentTarget
|
|
102
|
-
this.renderRoot.querySelector('#sorter-control').open({
|
|
103
|
-
right: 0,
|
|
104
|
-
top: target.offsetTop + target.offsetHeight
|
|
105
|
-
})
|
|
106
|
-
}}
|
|
107
|
-
>expand_more</mwc-icon
|
|
108
|
-
>
|
|
109
|
-
<ox-popup id="sorter-control">
|
|
110
|
-
<ox-sorters-control> </ox-sorters-control>
|
|
111
|
-
</ox-popup>
|
|
98
|
+
<div class="filters">
|
|
99
|
+
<ox-filters-form autofocus without-search></ox-filters-form>
|
|
112
100
|
</div>
|
|
113
101
|
|
|
114
|
-
<
|
|
115
|
-
<mwc-icon @click=${() => (this.mode = 'GRID')} ?active=${this.mode == 'GRID'}>grid_on</mwc-icon>
|
|
116
|
-
<mwc-icon @click=${() => (this.mode = 'CARD')} ?active=${this.mode == 'CARD'}>apps</mwc-icon>
|
|
117
|
-
</div>
|
|
102
|
+
<ox-context-page-toolbar class="actions" .context=${this.context}> </ox-context-page-toolbar>
|
|
118
103
|
</div>
|
|
119
104
|
</ox-grist>
|
|
120
105
|
`
|
|
@@ -124,10 +109,6 @@ class AddonMenuSetting extends connect(store)(localize(i18next)(PageView)) {
|
|
|
124
109
|
this.menus = state.liteMenu?.menus
|
|
125
110
|
}
|
|
126
111
|
|
|
127
|
-
get grist() {
|
|
128
|
-
return this.shadowRoot.querySelector('ox-grist')
|
|
129
|
-
}
|
|
130
|
-
|
|
131
112
|
async onCommit() {
|
|
132
113
|
var grist = this.grist
|
|
133
114
|
|
|
@@ -249,16 +230,19 @@ class AddonMenuSetting extends connect(store)(localize(i18next)(PageView)) {
|
|
|
249
230
|
columns: [
|
|
250
231
|
{
|
|
251
232
|
type: 'gutter',
|
|
252
|
-
gutterName: 'dirty'
|
|
233
|
+
gutterName: 'dirty',
|
|
234
|
+
fixed: true
|
|
253
235
|
},
|
|
254
236
|
{
|
|
255
237
|
type: 'gutter',
|
|
256
|
-
gutterName: 'sequence'
|
|
238
|
+
gutterName: 'sequence',
|
|
239
|
+
fixed: true
|
|
257
240
|
},
|
|
258
241
|
{
|
|
259
242
|
type: 'gutter',
|
|
260
243
|
gutterName: 'row-selector',
|
|
261
|
-
multiple: true
|
|
244
|
+
multiple: true,
|
|
245
|
+
fixed: true
|
|
262
246
|
},
|
|
263
247
|
{
|
|
264
248
|
type: 'string',
|
|
@@ -269,6 +253,7 @@ class AddonMenuSetting extends connect(store)(localize(i18next)(PageView)) {
|
|
|
269
253
|
type: 'string',
|
|
270
254
|
name: 'name',
|
|
271
255
|
header: i18next.t('field.name'),
|
|
256
|
+
fixed: true,
|
|
272
257
|
record: {
|
|
273
258
|
editable: true
|
|
274
259
|
},
|
|
@@ -432,13 +417,6 @@ class AddonMenuSetting extends connect(store)(localize(i18next)(PageView)) {
|
|
|
432
417
|
pages: [20, 30, 50, 100, 200]
|
|
433
418
|
}
|
|
434
419
|
}
|
|
435
|
-
|
|
436
|
-
this.page = 1
|
|
437
|
-
this.limit = 50
|
|
438
|
-
|
|
439
|
-
await this.updateComplete
|
|
440
|
-
|
|
441
|
-
this.grist.fetch()
|
|
442
420
|
}
|
|
443
421
|
|
|
444
422
|
async pageUpdated(changes, lifecycle) {
|
|
@@ -518,5 +496,3 @@ class AddonMenuSetting extends connect(store)(localize(i18next)(PageView)) {
|
|
|
518
496
|
console.warn('not implemented yet.')
|
|
519
497
|
}
|
|
520
498
|
}
|
|
521
|
-
|
|
522
|
-
window.customElements.define('addon-menu-setting', AddonMenuSetting)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../tsconfig-base.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"experimentalDecorators": true,
|
|
5
|
+
"skipLibCheck": true,
|
|
6
|
+
"strict": true,
|
|
7
|
+
"declaration": true,
|
|
8
|
+
"module": "esnext",
|
|
9
|
+
"outDir": "../dist-client",
|
|
10
|
+
"baseUrl": "./"
|
|
11
|
+
},
|
|
12
|
+
"include": ["./**/*"]
|
|
13
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import '@material/mwc-icon'
|
|
2
2
|
|
|
3
3
|
import { html, LitElement } from 'lit'
|
|
4
|
+
import { customElement, property, query, state } from 'lit/decorators.js'
|
|
4
5
|
import { connect } from 'pwa-helpers'
|
|
5
6
|
|
|
6
7
|
import { navigate, store } from '@operato/shell'
|
|
@@ -8,25 +9,20 @@ import { ScrollbarStyles } from '@operato/styles'
|
|
|
8
9
|
|
|
9
10
|
import { LiteMenuLandscapeStyles } from './lite-menu-landscape-styles'
|
|
10
11
|
|
|
12
|
+
@customElement('lite-menu-landscape')
|
|
11
13
|
export class LiteMenuLandscape extends connect(store)(LitElement) {
|
|
12
|
-
static
|
|
13
|
-
return [ScrollbarStyles, LiteMenuLandscapeStyles]
|
|
14
|
-
}
|
|
14
|
+
static styles = [ScrollbarStyles, LiteMenuLandscapeStyles]
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
activeMenu: Object,
|
|
21
|
-
path: String
|
|
22
|
-
}
|
|
23
|
-
}
|
|
16
|
+
@property({ type: Array }) menus?: any[]
|
|
17
|
+
@property({ type: Object }) activeTopLevel: any
|
|
18
|
+
@property({ type: Object }) activeMenu: any
|
|
19
|
+
@property({ type: String }) path?: string
|
|
24
20
|
|
|
25
21
|
render() {
|
|
26
22
|
const { menus = [], activeTopLevel, activeMenu } = this
|
|
27
23
|
|
|
28
24
|
return html`
|
|
29
|
-
<div id="wrap">
|
|
25
|
+
<div id="wrap" @mousewheel=${this.onWheelEvent.bind(this)}>
|
|
30
26
|
<ul>
|
|
31
27
|
${menus.map(menu =>
|
|
32
28
|
menu.type == 'group'
|
|
@@ -59,15 +55,14 @@ export class LiteMenuLandscape extends connect(store)(LitElement) {
|
|
|
59
55
|
}
|
|
60
56
|
|
|
61
57
|
firstUpdated() {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
this.renderRoot.addEventListener('click', e => {
|
|
58
|
+
this.renderRoot.addEventListener('click', (e: Event) => {
|
|
59
|
+
//@ts-ignore
|
|
66
60
|
if (e.target.submenu) {
|
|
67
61
|
/* protect to act move to href. */
|
|
68
62
|
e.stopPropagation()
|
|
69
63
|
e.preventDefault()
|
|
70
64
|
|
|
65
|
+
//@ts-ignore
|
|
71
66
|
let menu = e.target.submenu
|
|
72
67
|
|
|
73
68
|
this.dispatchEvent(
|
|
@@ -81,26 +76,29 @@ export class LiteMenuLandscape extends connect(store)(LitElement) {
|
|
|
81
76
|
}
|
|
82
77
|
|
|
83
78
|
/* to respond even if current acting menu is selected */
|
|
84
|
-
let href = e.target.href
|
|
79
|
+
let href = (e.target as HTMLAnchorElement).href
|
|
85
80
|
href && location.href === href && navigate(href + '#force', true)
|
|
86
81
|
})
|
|
87
82
|
|
|
88
83
|
/* to hide scrollbar during transition */
|
|
89
84
|
this.renderRoot.addEventListener('transitionstart', e => {
|
|
90
|
-
e.target.removeAttribute('settled')
|
|
85
|
+
;(e.target as HTMLElement).removeAttribute('settled')
|
|
91
86
|
})
|
|
92
87
|
this.renderRoot.addEventListener('transitionend', e => {
|
|
93
|
-
e.target.setAttribute('settled', '')
|
|
88
|
+
;(e.target as HTMLElement).setAttribute('settled', '')
|
|
94
89
|
})
|
|
95
90
|
}
|
|
96
91
|
|
|
97
|
-
onWheelEvent(e) {
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
92
|
+
onWheelEvent(e: WheelEvent) {
|
|
93
|
+
const { target, deltaY, detail } = e
|
|
94
|
+
|
|
95
|
+
if (!(target instanceof HTMLElement)) {
|
|
96
|
+
return
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const delta = deltaY || -detail
|
|
100
|
+
target.scrollLeft -= (delta / Math.abs(delta)) * 10
|
|
101
101
|
|
|
102
102
|
e.preventDefault()
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
|
-
|
|
106
|
-
customElements.define('lite-menu-landscape', LiteMenuLandscape)
|
|
@@ -2,7 +2,8 @@ import '@material/mwc-icon'
|
|
|
2
2
|
import './lite-menu-portrait'
|
|
3
3
|
import './lite-menu-landscape'
|
|
4
4
|
|
|
5
|
-
import { css, html, LitElement } from 'lit'
|
|
5
|
+
import { css, html, LitElement, PropertyValues } from 'lit'
|
|
6
|
+
import { customElement, property, query, state } from 'lit/decorators.js'
|
|
6
7
|
import { connect } from 'pwa-helpers'
|
|
7
8
|
|
|
8
9
|
import { store } from '@operato/shell'
|
|
@@ -15,47 +16,43 @@ function isActiveMenu(menu, path) {
|
|
|
15
16
|
)
|
|
16
17
|
}
|
|
17
18
|
|
|
19
|
+
@customElement('lite-menu-part')
|
|
18
20
|
export class LiteMenuPart extends connect(store)(LitElement) {
|
|
19
|
-
static
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
21
|
+
static styles = [
|
|
22
|
+
ScrollbarStyles,
|
|
23
|
+
css`
|
|
24
|
+
:host {
|
|
25
|
+
display: flex;
|
|
26
|
+
overflow-y: auto;
|
|
27
|
+
flex-direction: column;
|
|
28
|
+
height: 100%;
|
|
29
|
+
min-width: 200px;
|
|
30
|
+
background-color: var(--theme-white-color);
|
|
31
|
+
}
|
|
31
32
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
`
|
|
57
|
-
]
|
|
58
|
-
}
|
|
33
|
+
:host([landscape]) {
|
|
34
|
+
overflow-x: auto;
|
|
35
|
+
flex-direction: row;
|
|
36
|
+
width: 100%;
|
|
37
|
+
min-height: 20px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
lite-menu-portrait,
|
|
41
|
+
lite-menu-landscape {
|
|
42
|
+
flex: 1;
|
|
43
|
+
}
|
|
44
|
+
`
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
@property({ type: String }) page?: string
|
|
48
|
+
@property({ type: String }) resourceId?: string
|
|
49
|
+
@property({ type: Array }) menus?: any[]
|
|
50
|
+
@property({ type: String }) orientation?: string
|
|
51
|
+
|
|
52
|
+
@state() slotTemplate: any
|
|
53
|
+
@state() _activeTopLevel: any
|
|
54
|
+
@state() _activeMenu: any
|
|
55
|
+
@state() _path?: string
|
|
59
56
|
|
|
60
57
|
render() {
|
|
61
58
|
return html`
|
|
@@ -78,29 +75,29 @@ export class LiteMenuPart extends connect(store)(LitElement) {
|
|
|
78
75
|
}
|
|
79
76
|
|
|
80
77
|
firstUpdated() {
|
|
81
|
-
this.renderRoot.addEventListener('active-toplevel', e => {
|
|
78
|
+
this.renderRoot.addEventListener('active-toplevel', (e: Event) => {
|
|
82
79
|
e.stopPropagation()
|
|
83
80
|
e.preventDefault()
|
|
84
81
|
|
|
85
|
-
this._activeTopLevel = e.detail
|
|
82
|
+
this._activeTopLevel = (e as CustomEvent).detail
|
|
86
83
|
})
|
|
87
84
|
}
|
|
88
85
|
|
|
89
|
-
updated(changes) {
|
|
86
|
+
updated(changes: PropertyValues<this>) {
|
|
90
87
|
if (changes.has('menus') || changes.has('page') || changes.has('resourceId')) {
|
|
91
|
-
this.
|
|
88
|
+
this.findActivePage()
|
|
92
89
|
}
|
|
93
90
|
|
|
94
91
|
if (changes.has('orientation')) {
|
|
95
92
|
if (this.orientation == 'portrait') {
|
|
96
93
|
this.removeAttribute('landscape')
|
|
97
94
|
} else {
|
|
98
|
-
this.setAttribute('landscape',
|
|
95
|
+
this.setAttribute('landscape', '')
|
|
99
96
|
}
|
|
100
97
|
}
|
|
101
98
|
|
|
102
99
|
if (changes.has('slotTemplate')) {
|
|
103
|
-
this.replaceChild(this.slotTemplate)
|
|
100
|
+
this.replaceChild(this.slotTemplate, this.renderRoot)
|
|
104
101
|
}
|
|
105
102
|
}
|
|
106
103
|
|
|
@@ -111,7 +108,7 @@ export class LiteMenuPart extends connect(store)(LitElement) {
|
|
|
111
108
|
this.slotTemplate = state.liteMenu.slotTemplate
|
|
112
109
|
}
|
|
113
110
|
|
|
114
|
-
|
|
111
|
+
private findActivePage() {
|
|
115
112
|
var path = this.resourceId ? `${this.page}/${this.resourceId}` : this.page
|
|
116
113
|
var menus = this.menus || []
|
|
117
114
|
var activeMenu
|
|
@@ -130,5 +127,3 @@ export class LiteMenuPart extends connect(store)(LitElement) {
|
|
|
130
127
|
this._activeMenu = activeMenu || this._activeTopLevel
|
|
131
128
|
}
|
|
132
129
|
}
|
|
133
|
-
|
|
134
|
-
customElements.define('lite-menu-part', LiteMenuPart)
|
|
@@ -1,27 +1,23 @@
|
|
|
1
1
|
import '@material/mwc-icon'
|
|
2
2
|
|
|
3
3
|
import { html, LitElement } from 'lit'
|
|
4
|
+
import { customElement, property, query, state } from 'lit/decorators.js'
|
|
4
5
|
|
|
5
6
|
import { navigate } from '@operato/shell'
|
|
6
7
|
import { ScrollbarStyles } from '@operato/styles'
|
|
7
8
|
|
|
8
9
|
import { LiteMenuPortraitStyles } from './lite-menu-portrait-styles'
|
|
9
10
|
|
|
11
|
+
@customElement('lite-menu-portrait')
|
|
10
12
|
export class LiteMenuPortrait extends LitElement {
|
|
11
|
-
static
|
|
12
|
-
return [ScrollbarStyles, LiteMenuPortraitStyles]
|
|
13
|
-
}
|
|
13
|
+
static styles = [ScrollbarStyles, LiteMenuPortraitStyles]
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
activeMenu: Object,
|
|
20
|
-
path: String
|
|
21
|
-
}
|
|
22
|
-
}
|
|
15
|
+
@property({ type: Array }) menus?: any[]
|
|
16
|
+
@property({ type: Object }) activeTopLevel: any
|
|
17
|
+
@property({ type: Object }) activeMenu: any
|
|
18
|
+
@property({ type: String }) path?: string
|
|
23
19
|
|
|
24
|
-
renderMenus(menus, activeTopLevel, activeMenu) {
|
|
20
|
+
renderMenus(menus, activeTopLevel, activeMenu?) {
|
|
25
21
|
return html`
|
|
26
22
|
<ul>
|
|
27
23
|
${menus.map(menu => {
|
|
@@ -52,10 +48,12 @@ export class LiteMenuPortrait extends LitElement {
|
|
|
52
48
|
}
|
|
53
49
|
|
|
54
50
|
firstUpdated() {
|
|
55
|
-
this.renderRoot.addEventListener('click', e => {
|
|
56
|
-
const menuElement = e.target
|
|
51
|
+
this.renderRoot.addEventListener('click', (e: Event) => {
|
|
52
|
+
const menuElement = (e.target as Element)!.closest('[menu]')
|
|
57
53
|
|
|
54
|
+
//@ts-ignore
|
|
58
55
|
if (menuElement?.menu) {
|
|
56
|
+
//@ts-ignore
|
|
59
57
|
let menu = menuElement.menu
|
|
60
58
|
|
|
61
59
|
if (!menu.path) {
|
|
@@ -73,18 +71,16 @@ export class LiteMenuPortrait extends LitElement {
|
|
|
73
71
|
}
|
|
74
72
|
|
|
75
73
|
/* to respond even if current acting menu is selected */
|
|
76
|
-
let href = e.target
|
|
74
|
+
let href = (e.target as HTMLAnchorElement)!.href
|
|
77
75
|
href && location.href === href && navigate(href + '#force', true)
|
|
78
76
|
})
|
|
79
77
|
|
|
80
78
|
/* to hide scrollbar during transition */
|
|
81
79
|
this.renderRoot.addEventListener('transitionstart', e => {
|
|
82
|
-
e.target.removeAttribute('settled')
|
|
80
|
+
;(e.target as Element).removeAttribute('settled')
|
|
83
81
|
})
|
|
84
82
|
this.renderRoot.addEventListener('transitionend', e => {
|
|
85
|
-
e.target.setAttribute('settled', '')
|
|
83
|
+
;(e.target as Element).setAttribute('settled', '')
|
|
86
84
|
})
|
|
87
85
|
}
|
|
88
86
|
}
|
|
89
|
-
|
|
90
|
-
customElements.define('lite-menu-portrait', LiteMenuPortrait)
|