@things-factory/apptool-ui 6.1.48 → 6.1.67
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/bootstrap.ts +34 -0
- package/client/index.ts +64 -0
- package/client/layout/app-busybar.ts +48 -0
- package/client/layout/app-mdibar.ts +132 -0
- package/client/layout/{app-toolbar.js → app-toolbar.ts} +62 -71
- package/client/mdibar-setting-let.ts +64 -0
- package/dist-client/bootstrap.d.ts +1 -0
- package/dist-client/bootstrap.js +32 -0
- package/dist-client/bootstrap.js.map +1 -0
- package/dist-client/index.d.ts +9 -0
- package/dist-client/index.js +51 -0
- package/dist-client/index.js.map +1 -0
- package/dist-client/layout/app-busybar.d.ts +1 -0
- package/dist-client/layout/app-busybar.js +53 -0
- package/dist-client/layout/app-busybar.js.map +1 -0
- package/dist-client/layout/app-mdibar.d.ts +1 -0
- package/dist-client/layout/app-mdibar.js +136 -0
- package/dist-client/layout/app-mdibar.js.map +1 -0
- package/dist-client/layout/app-toolbar.d.ts +1 -0
- package/dist-client/layout/app-toolbar.js +123 -0
- package/dist-client/layout/app-toolbar.js.map +1 -0
- package/dist-client/mdibar-setting-let.d.ts +13 -0
- package/dist-client/mdibar-setting-let.js +68 -0
- package/dist-client/mdibar-setting-let.js.map +1 -0
- package/dist-client/tsconfig.tsbuildinfo +1 -0
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +11 -8
- package/things-factory.config.js +1 -1
- package/translations/en.json +2 -2
- package/translations/ja.json +2 -2
- package/translations/ko.json +2 -2
- package/translations/ms.json +2 -2
- package/translations/zh.json +2 -2
- package/client/bootstrap.js +0 -26
- package/client/index.js +0 -0
- package/client/layout/app-busybar.js +0 -52
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// import './layout/app-toolbar'
|
|
2
|
+
// import './layout/app-busybar'
|
|
3
|
+
// import './mdibar-setting-let'
|
|
4
|
+
|
|
5
|
+
// import { html } from 'lit-html'
|
|
6
|
+
|
|
7
|
+
// import { appendViewpart, VIEWPART_POSITION } from '@operato/layout'
|
|
8
|
+
|
|
9
|
+
export default function bootstrap() {
|
|
10
|
+
// appendViewpart({
|
|
11
|
+
// name: 'apptoolbar',
|
|
12
|
+
// viewpart: {
|
|
13
|
+
// show: true,
|
|
14
|
+
// template: html` <app-toolbar></app-toolbar> `
|
|
15
|
+
// },
|
|
16
|
+
// position: VIEWPART_POSITION.HEADERBAR
|
|
17
|
+
// })
|
|
18
|
+
// appendViewpart({
|
|
19
|
+
// name: 'appbusybar',
|
|
20
|
+
// viewpart: {
|
|
21
|
+
// show: true,
|
|
22
|
+
// template: html` <app-busybar></app-busybar> `
|
|
23
|
+
// },
|
|
24
|
+
// position: VIEWPART_POSITION.HEADERBAR
|
|
25
|
+
// })
|
|
26
|
+
// appendViewpart({
|
|
27
|
+
// name: 'appmdibar',
|
|
28
|
+
// viewpart: {
|
|
29
|
+
// show: false,
|
|
30
|
+
// template: html` <app-mdibar></app-mdibar> `
|
|
31
|
+
// },
|
|
32
|
+
// position: VIEWPART_POSITION.HEADERBAR
|
|
33
|
+
// })
|
|
34
|
+
}
|
package/client/index.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import './layout/app-toolbar'
|
|
2
|
+
import './layout/app-busybar'
|
|
3
|
+
import './layout/app-mdibar'
|
|
4
|
+
import './mdibar-setting-let'
|
|
5
|
+
|
|
6
|
+
import { html } from 'lit-html'
|
|
7
|
+
|
|
8
|
+
import { store, clientSettingStore } from '@operato/shell'
|
|
9
|
+
import { appendViewpart, VIEWPART_POSITION } from '@operato/layout'
|
|
10
|
+
import { isMobileDevice } from '@operato/utils'
|
|
11
|
+
import { ADD_SETTING } from '@things-factory/setting-base'
|
|
12
|
+
|
|
13
|
+
export async function setupAppToolPart({
|
|
14
|
+
toolbar = true,
|
|
15
|
+
busybar = true,
|
|
16
|
+
mdibar = true
|
|
17
|
+
}: {
|
|
18
|
+
toolbar?: boolean
|
|
19
|
+
busybar?: boolean
|
|
20
|
+
mdibar?: boolean
|
|
21
|
+
}) {
|
|
22
|
+
if (toolbar) {
|
|
23
|
+
appendViewpart({
|
|
24
|
+
name: 'apptoolbar',
|
|
25
|
+
viewpart: {
|
|
26
|
+
show: true,
|
|
27
|
+
template: html` <app-toolbar></app-toolbar> `
|
|
28
|
+
},
|
|
29
|
+
position: VIEWPART_POSITION.HEADERBAR
|
|
30
|
+
})
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (busybar) {
|
|
34
|
+
appendViewpart({
|
|
35
|
+
name: 'appbusybar',
|
|
36
|
+
viewpart: {
|
|
37
|
+
show: true,
|
|
38
|
+
template: html` <app-busybar></app-busybar> `
|
|
39
|
+
},
|
|
40
|
+
position: VIEWPART_POSITION.HEADERBAR
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (mdibar && !isMobileDevice()) {
|
|
45
|
+
const show = ((await clientSettingStore.get('mdibar'))?.value || {}).show
|
|
46
|
+
|
|
47
|
+
appendViewpart({
|
|
48
|
+
name: 'appmdibar',
|
|
49
|
+
viewpart: {
|
|
50
|
+
show,
|
|
51
|
+
template: html` <app-mdibar></app-mdibar> `
|
|
52
|
+
},
|
|
53
|
+
position: VIEWPART_POSITION.HEADERBAR
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
store.dispatch({
|
|
57
|
+
type: ADD_SETTING,
|
|
58
|
+
setting: {
|
|
59
|
+
seq: 21,
|
|
60
|
+
template: html` <mdibar-setting-let></mdibar-setting-let> `
|
|
61
|
+
}
|
|
62
|
+
})
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import '@material/mwc-linear-progress'
|
|
2
|
+
|
|
3
|
+
import { css, html, LitElement } from 'lit'
|
|
4
|
+
import { customElement, property, state } from 'lit/decorators.js'
|
|
5
|
+
import { connect } from 'pwa-helpers/connect-mixin.js'
|
|
6
|
+
|
|
7
|
+
import { store } from '@operato/shell'
|
|
8
|
+
|
|
9
|
+
@customElement('app-busybar')
|
|
10
|
+
class AppBusyBar extends connect(store)(LitElement) {
|
|
11
|
+
static styles = [
|
|
12
|
+
css`
|
|
13
|
+
:host {
|
|
14
|
+
display: flex;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
mwc-linear-progress {
|
|
18
|
+
flex: 1;
|
|
19
|
+
height: 2px;
|
|
20
|
+
}
|
|
21
|
+
`
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
@state() private busy?: Boolean
|
|
25
|
+
@state() private lastState?: boolean
|
|
26
|
+
@state() private timeout?: any
|
|
27
|
+
|
|
28
|
+
render() {
|
|
29
|
+
return this.busy ? html`<mwc-linear-progress indeterminate></mwc-linear-progress>` : html``
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
stateChanged(state) {
|
|
33
|
+
if (!state.busy.busy) {
|
|
34
|
+
this.busy = false
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
this.lastState = state.busy.busy
|
|
38
|
+
|
|
39
|
+
if (!this.timeout) {
|
|
40
|
+
this.timeout = setTimeout(() => {
|
|
41
|
+
if (this.lastState) {
|
|
42
|
+
this.busy = true
|
|
43
|
+
}
|
|
44
|
+
delete this.timeout
|
|
45
|
+
}, 500)
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import '@material/mwc-icon'
|
|
2
|
+
|
|
3
|
+
import { css, html, LitElement } from 'lit'
|
|
4
|
+
import { customElement, state } from 'lit/decorators.js'
|
|
5
|
+
import { connect } from 'pwa-helpers/connect-mixin.js'
|
|
6
|
+
|
|
7
|
+
import { navigate, store, PageView } from '@operato/shell'
|
|
8
|
+
|
|
9
|
+
@customElement('app-mdibar')
|
|
10
|
+
class AppMDIBar extends connect(store)(LitElement) {
|
|
11
|
+
static styles = [
|
|
12
|
+
css`
|
|
13
|
+
:host {
|
|
14
|
+
display: flex;
|
|
15
|
+
background-color: var(--main-section-background-color);
|
|
16
|
+
color: var(--mdibar-color, rgba(0, 0, 0, 0.7));
|
|
17
|
+
font-size: var(--fontsize-small);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
div {
|
|
21
|
+
display: inline-block;
|
|
22
|
+
position: relative;
|
|
23
|
+
max-width: var(--mdibar-max-width, 120px);
|
|
24
|
+
padding: var(--mdibar-padding, 3px 22px 0 5px);
|
|
25
|
+
border-right: var(--border-dark-color);
|
|
26
|
+
border-bottom: var(--border-dark-color);
|
|
27
|
+
white-space: nowrap;
|
|
28
|
+
overflow: hidden;
|
|
29
|
+
text-overflow: ellipsis;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
mwc-icon {
|
|
33
|
+
position: absolute;
|
|
34
|
+
right: 2px;
|
|
35
|
+
top: 3px;
|
|
36
|
+
margin-left: var(--margin-narrow);
|
|
37
|
+
font-size: var(--mdibar-icon-size, 18px);
|
|
38
|
+
opacity: 0.5;
|
|
39
|
+
}
|
|
40
|
+
mwc-icon:hover {
|
|
41
|
+
opacity: 0.8;
|
|
42
|
+
color: var(--mdibar-hover-color, #cc3300);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
[active] {
|
|
46
|
+
background-color: var(--mdibar-background-color, #fff);
|
|
47
|
+
border-bottom: 1px solid var(--mdibar-background-color, #fff);
|
|
48
|
+
color: var(--primary-text-color);
|
|
49
|
+
font-weight: bold;
|
|
50
|
+
}
|
|
51
|
+
[home] {
|
|
52
|
+
padding: var(--mdibar-padding-home, 3px 5px 0 23px);
|
|
53
|
+
}
|
|
54
|
+
[home] mwc-icon {
|
|
55
|
+
left: 0;
|
|
56
|
+
}
|
|
57
|
+
`
|
|
58
|
+
]
|
|
59
|
+
|
|
60
|
+
@state() pages: PageView[] = []
|
|
61
|
+
@state() activePage!: PageView
|
|
62
|
+
@state() title: string = ''
|
|
63
|
+
|
|
64
|
+
render() {
|
|
65
|
+
const pages = this.pages || []
|
|
66
|
+
|
|
67
|
+
return html`
|
|
68
|
+
<div home><mwc-icon>home</mwc-icon></div>
|
|
69
|
+
|
|
70
|
+
${pages.map((page, idx) => {
|
|
71
|
+
const context = page.context as any
|
|
72
|
+
const title = context?.title || context?.search?.placeholder || ''
|
|
73
|
+
|
|
74
|
+
return html`
|
|
75
|
+
<div @click=${() => this.moveTo(page)} ?active=${this.activePage === page}>
|
|
76
|
+
${title}
|
|
77
|
+
<mwc-icon
|
|
78
|
+
@click=${(e: MouseEvent) => {
|
|
79
|
+
e.stopPropagation()
|
|
80
|
+
this.closePage(page, idx)
|
|
81
|
+
}}
|
|
82
|
+
>close</mwc-icon
|
|
83
|
+
>
|
|
84
|
+
</div>
|
|
85
|
+
`
|
|
86
|
+
})}
|
|
87
|
+
`
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
updated(changed) {
|
|
91
|
+
if (changed.has('activePage')) {
|
|
92
|
+
const page = this.activePage
|
|
93
|
+
|
|
94
|
+
if (!this.pages) {
|
|
95
|
+
this.pages = []
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (!this.pages.includes(page)) {
|
|
99
|
+
this.pages = [...this.pages, page]
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
stateChanged(state) {
|
|
105
|
+
const { context, activePage } = state.route || {}
|
|
106
|
+
this.activePage = activePage
|
|
107
|
+
|
|
108
|
+
/* refresh를 일으키기위한 property 변경을 위한 코드임. */
|
|
109
|
+
this.title = context.title || context.search?.placeholder
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
getHomeRoute() {
|
|
113
|
+
var base = document.querySelector('base')
|
|
114
|
+
return base?.getAttribute('href') || '/'
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
moveTo(page: PageView) {
|
|
118
|
+
navigate(page.getAttribute('data-page')!)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
closePage(page: PageView, idx: number) {
|
|
122
|
+
this.pages = [...this.pages.slice(0, idx), ...this.pages.slice(idx + 1)]
|
|
123
|
+
|
|
124
|
+
page.parentNode?.removeChild(page)
|
|
125
|
+
page.pageDispose()
|
|
126
|
+
|
|
127
|
+
if (this.activePage === page) {
|
|
128
|
+
const next = this.pages.length > 0 ? Math.max(0, idx - 1) : -1
|
|
129
|
+
navigate(next != -1 ? this.pages[next].getAttribute('data-page')! : this.getHomeRoute())
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
@@ -1,75 +1,73 @@
|
|
|
1
1
|
import '@material/mwc-icon'
|
|
2
2
|
|
|
3
|
-
import { css, html, LitElement } from 'lit'
|
|
3
|
+
import { css, html, LitElement, TemplateResult } from 'lit'
|
|
4
|
+
import { customElement, query, state } from 'lit/decorators.js'
|
|
4
5
|
import { connect } from 'pwa-helpers/connect-mixin.js'
|
|
5
6
|
|
|
6
7
|
import { TOOL_POSITION } from '@operato/layout'
|
|
7
|
-
import { navigate, store } from '@
|
|
8
|
+
import { navigate, store } from '@operato/shell'
|
|
8
9
|
|
|
10
|
+
@customElement('app-toolbar')
|
|
9
11
|
class AppToolbar extends connect(store)(LitElement) {
|
|
10
|
-
static
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
static styles = [
|
|
13
|
+
css`
|
|
14
|
+
:host {
|
|
15
|
+
display: flex;
|
|
16
|
+
height: var(--header-bar-height, 45px);
|
|
17
|
+
color: var(--header-bar-color);
|
|
18
|
+
background-color: var(--header-bar-background-color, white);
|
|
19
|
+
justify-content: space-between;
|
|
20
|
+
align-items: center;
|
|
21
|
+
padding: 0 5px;
|
|
22
|
+
|
|
23
|
+
text-transform: capitalize;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
:host > * {
|
|
27
|
+
margin: var(--header-bar-item-padding);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
[center] {
|
|
31
|
+
flex: 1;
|
|
32
|
+
flex-wrap: nowrap;
|
|
33
|
+
display: flex;
|
|
34
|
+
align-items: center;
|
|
35
|
+
overflow: hidden;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
[center] > * {
|
|
39
|
+
margin: auto;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
:host(.vline) {
|
|
43
|
+
display: block;
|
|
44
|
+
flex: none;
|
|
45
|
+
border-left: 1px solid rgba(255, 255, 255, 0.07);
|
|
46
|
+
border-right: 1px solid rgba(0, 0, 0, 0.1);
|
|
47
|
+
width: 0px;
|
|
48
|
+
height: 18px;
|
|
49
|
+
margin: 0 4px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
:host(label) {
|
|
53
|
+
margin-right: 5px;
|
|
54
|
+
color: #fff;
|
|
55
|
+
font-size: 20px;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
span.space {
|
|
59
|
+
width: 10px;
|
|
60
|
+
}
|
|
61
|
+
`
|
|
62
|
+
]
|
|
16
63
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
display: flex;
|
|
22
|
-
height: var(--header-bar-height, 45px);
|
|
23
|
-
color: var(--header-bar-color);
|
|
24
|
-
background-color: var(--header-bar-background-color, white);
|
|
25
|
-
justify-content: space-between;
|
|
26
|
-
align-items: center;
|
|
27
|
-
padding: 0 5px;
|
|
28
|
-
|
|
29
|
-
text-transform: capitalize;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
:host > * {
|
|
33
|
-
margin: var(--header-bar-item-padding);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
[center] {
|
|
37
|
-
flex: 1;
|
|
38
|
-
flex-wrap: nowrap;
|
|
39
|
-
display: flex;
|
|
40
|
-
align-items: center;
|
|
41
|
-
overflow: hidden;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
[center] > * {
|
|
45
|
-
margin: auto;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
:host(.vline) {
|
|
49
|
-
display: block;
|
|
50
|
-
flex: none;
|
|
51
|
-
border-left: 1px solid rgba(255, 255, 255, 0.07);
|
|
52
|
-
border-right: 1px solid rgba(0, 0, 0, 0.1);
|
|
53
|
-
width: 0px;
|
|
54
|
-
height: 18px;
|
|
55
|
-
margin: 0 4px;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
:host(label) {
|
|
59
|
-
margin-right: 5px;
|
|
60
|
-
color: #fff;
|
|
61
|
-
font-size: 20px;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
span.space {
|
|
65
|
-
width: 10px;
|
|
66
|
-
}
|
|
67
|
-
`
|
|
68
|
-
]
|
|
69
|
-
}
|
|
64
|
+
@state() _tools: { position: string; template: TemplateResult }[] = []
|
|
65
|
+
@state() _route: any
|
|
66
|
+
|
|
67
|
+
@query('[center]') center!: HTMLDivElement
|
|
70
68
|
|
|
71
69
|
render() {
|
|
72
|
-
var tools = this._tools || []
|
|
70
|
+
var tools = this._tools || ([] as { position: string; template: TemplateResult }[])
|
|
73
71
|
|
|
74
72
|
var frontEndTools = tools.filter(tool => tool.position == TOOL_POSITION.FRONT_END)
|
|
75
73
|
var frontTools = tools.filter(tool => tool.position == TOOL_POSITION.FRONT)
|
|
@@ -89,17 +87,12 @@ class AppToolbar extends connect(store)(LitElement) {
|
|
|
89
87
|
: frontEndTools.map(tool => html` ${tool.template} `)}
|
|
90
88
|
${frontTools.map(tool => html` ${tool.template} `)}
|
|
91
89
|
|
|
92
|
-
<div center>${centerTools.map(tool => html` ${tool.template} `)}</div>
|
|
90
|
+
<div center @mousewheel=${this.onWheelEvent}>${centerTools.map(tool => html` ${tool.template} `)}</div>
|
|
93
91
|
|
|
94
92
|
${rearTools.map(tool => html` ${tool.template} `)} ${rearEndTools.map(tool => html` ${tool.template} `)}
|
|
95
93
|
`
|
|
96
94
|
}
|
|
97
95
|
|
|
98
|
-
firstUpdated() {
|
|
99
|
-
const center = this.renderRoot.querySelector('[center]')
|
|
100
|
-
center.addEventListener('mousewheel', this.onWheelEvent.bind(this), false)
|
|
101
|
-
}
|
|
102
|
-
|
|
103
96
|
stateChanged(state) {
|
|
104
97
|
/* page의 변화를 감지하기 위해서 route의 변화를 체크한다. */
|
|
105
98
|
this._route = state.route
|
|
@@ -110,7 +103,7 @@ class AppToolbar extends connect(store)(LitElement) {
|
|
|
110
103
|
navigateToHome() {
|
|
111
104
|
var base = document.querySelector('base')
|
|
112
105
|
if (base) {
|
|
113
|
-
navigate(base.getAttribute('href'))
|
|
106
|
+
navigate(base.getAttribute('href') || '')
|
|
114
107
|
} else {
|
|
115
108
|
navigate('/')
|
|
116
109
|
}
|
|
@@ -124,5 +117,3 @@ class AppToolbar extends connect(store)(LitElement) {
|
|
|
124
117
|
e.preventDefault()
|
|
125
118
|
}
|
|
126
119
|
}
|
|
127
|
-
|
|
128
|
-
customElements.define('app-toolbar', AppToolbar)
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import '@material/mwc-formfield'
|
|
2
|
+
import '@material/mwc-checkbox'
|
|
3
|
+
import '@operato/i18n/ox-i18n.js'
|
|
4
|
+
|
|
5
|
+
import { css, html, LitElement } from 'lit'
|
|
6
|
+
import { customElement, property, state } from 'lit/decorators.js'
|
|
7
|
+
|
|
8
|
+
import { i18next, localize } from '@operato/i18n'
|
|
9
|
+
import { clientSettingStore } from '@operato/shell'
|
|
10
|
+
import { updateViewpart } from '@operato/layout'
|
|
11
|
+
|
|
12
|
+
@customElement('mdibar-setting-let')
|
|
13
|
+
export class MDIBarSettingLet extends localize(i18next)(LitElement) {
|
|
14
|
+
static styles = [
|
|
15
|
+
css`
|
|
16
|
+
label {
|
|
17
|
+
font: var(--label-font);
|
|
18
|
+
color: var(--label-color);
|
|
19
|
+
text-transform: var(--label-text-transform);
|
|
20
|
+
}
|
|
21
|
+
`
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
@property({ type: Boolean }) show: boolean = false
|
|
25
|
+
|
|
26
|
+
render() {
|
|
27
|
+
const checked = this.show === true
|
|
28
|
+
|
|
29
|
+
return html`
|
|
30
|
+
<setting-let>
|
|
31
|
+
<ox-i18n slot="title" msgid="title.mdibar setting"></ox-i18n>
|
|
32
|
+
|
|
33
|
+
<div slot="content">
|
|
34
|
+
<mwc-formfield label=${i18next.t('label.show')}>
|
|
35
|
+
<mwc-checkbox @change=${e => this.onChangeShowMDIBar(e)} ?checked=${checked}></mwc-checkbox>
|
|
36
|
+
</mwc-formfield>
|
|
37
|
+
</div>
|
|
38
|
+
</setting-let>
|
|
39
|
+
`
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async firstUpdated() {
|
|
43
|
+
this.show = ((await clientSettingStore.get('mdibar'))?.value || {}).show
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async onChangeShowMDIBar(e) {
|
|
47
|
+
const show = e.currentTarget.checked
|
|
48
|
+
|
|
49
|
+
try {
|
|
50
|
+
await clientSettingStore.put({
|
|
51
|
+
key: 'mdibar',
|
|
52
|
+
value: {
|
|
53
|
+
show
|
|
54
|
+
}
|
|
55
|
+
})
|
|
56
|
+
} catch (e) {
|
|
57
|
+
console.error(e)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
updateViewpart('appmdibar', {
|
|
61
|
+
show
|
|
62
|
+
})
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function bootstrap(): void;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// import './layout/app-toolbar'
|
|
2
|
+
// import './layout/app-busybar'
|
|
3
|
+
// import './mdibar-setting-let'
|
|
4
|
+
// import { html } from 'lit-html'
|
|
5
|
+
// import { appendViewpart, VIEWPART_POSITION } from '@operato/layout'
|
|
6
|
+
export default function bootstrap() {
|
|
7
|
+
// appendViewpart({
|
|
8
|
+
// name: 'apptoolbar',
|
|
9
|
+
// viewpart: {
|
|
10
|
+
// show: true,
|
|
11
|
+
// template: html` <app-toolbar></app-toolbar> `
|
|
12
|
+
// },
|
|
13
|
+
// position: VIEWPART_POSITION.HEADERBAR
|
|
14
|
+
// })
|
|
15
|
+
// appendViewpart({
|
|
16
|
+
// name: 'appbusybar',
|
|
17
|
+
// viewpart: {
|
|
18
|
+
// show: true,
|
|
19
|
+
// template: html` <app-busybar></app-busybar> `
|
|
20
|
+
// },
|
|
21
|
+
// position: VIEWPART_POSITION.HEADERBAR
|
|
22
|
+
// })
|
|
23
|
+
// appendViewpart({
|
|
24
|
+
// name: 'appmdibar',
|
|
25
|
+
// viewpart: {
|
|
26
|
+
// show: false,
|
|
27
|
+
// template: html` <app-mdibar></app-mdibar> `
|
|
28
|
+
// },
|
|
29
|
+
// position: VIEWPART_POSITION.HEADERBAR
|
|
30
|
+
// })
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=bootstrap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../client/bootstrap.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,gCAAgC;AAChC,gCAAgC;AAEhC,kCAAkC;AAElC,sEAAsE;AAEtE,MAAM,CAAC,OAAO,UAAU,SAAS;IAC/B,mBAAmB;IACnB,wBAAwB;IACxB,gBAAgB;IAChB,kBAAkB;IAClB,oDAAoD;IACpD,OAAO;IACP,0CAA0C;IAC1C,KAAK;IACL,mBAAmB;IACnB,wBAAwB;IACxB,gBAAgB;IAChB,kBAAkB;IAClB,oDAAoD;IACpD,OAAO;IACP,0CAA0C;IAC1C,KAAK;IACL,mBAAmB;IACnB,uBAAuB;IACvB,gBAAgB;IAChB,mBAAmB;IACnB,kDAAkD;IAClD,OAAO;IACP,0CAA0C;IAC1C,KAAK;AACP,CAAC","sourcesContent":["// import './layout/app-toolbar'\n// import './layout/app-busybar'\n// import './mdibar-setting-let'\n\n// import { html } from 'lit-html'\n\n// import { appendViewpart, VIEWPART_POSITION } from '@operato/layout'\n\nexport default function bootstrap() {\n // appendViewpart({\n // name: 'apptoolbar',\n // viewpart: {\n // show: true,\n // template: html` <app-toolbar></app-toolbar> `\n // },\n // position: VIEWPART_POSITION.HEADERBAR\n // })\n // appendViewpart({\n // name: 'appbusybar',\n // viewpart: {\n // show: true,\n // template: html` <app-busybar></app-busybar> `\n // },\n // position: VIEWPART_POSITION.HEADERBAR\n // })\n // appendViewpart({\n // name: 'appmdibar',\n // viewpart: {\n // show: false,\n // template: html` <app-mdibar></app-mdibar> `\n // },\n // position: VIEWPART_POSITION.HEADERBAR\n // })\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import './layout/app-toolbar';
|
|
2
|
+
import './layout/app-busybar';
|
|
3
|
+
import './layout/app-mdibar';
|
|
4
|
+
import './mdibar-setting-let';
|
|
5
|
+
export declare function setupAppToolPart({ toolbar, busybar, mdibar }: {
|
|
6
|
+
toolbar?: boolean;
|
|
7
|
+
busybar?: boolean;
|
|
8
|
+
mdibar?: boolean;
|
|
9
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import './layout/app-toolbar';
|
|
2
|
+
import './layout/app-busybar';
|
|
3
|
+
import './layout/app-mdibar';
|
|
4
|
+
import './mdibar-setting-let';
|
|
5
|
+
import { html } from 'lit-html';
|
|
6
|
+
import { store, clientSettingStore } from '@operato/shell';
|
|
7
|
+
import { appendViewpart, VIEWPART_POSITION } from '@operato/layout';
|
|
8
|
+
import { isMobileDevice } from '@operato/utils';
|
|
9
|
+
import { ADD_SETTING } from '@things-factory/setting-base';
|
|
10
|
+
export async function setupAppToolPart({ toolbar = true, busybar = true, mdibar = true }) {
|
|
11
|
+
var _a;
|
|
12
|
+
if (toolbar) {
|
|
13
|
+
appendViewpart({
|
|
14
|
+
name: 'apptoolbar',
|
|
15
|
+
viewpart: {
|
|
16
|
+
show: true,
|
|
17
|
+
template: html ` <app-toolbar></app-toolbar> `
|
|
18
|
+
},
|
|
19
|
+
position: VIEWPART_POSITION.HEADERBAR
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
if (busybar) {
|
|
23
|
+
appendViewpart({
|
|
24
|
+
name: 'appbusybar',
|
|
25
|
+
viewpart: {
|
|
26
|
+
show: true,
|
|
27
|
+
template: html ` <app-busybar></app-busybar> `
|
|
28
|
+
},
|
|
29
|
+
position: VIEWPART_POSITION.HEADERBAR
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
if (mdibar && !isMobileDevice()) {
|
|
33
|
+
const show = (((_a = (await clientSettingStore.get('mdibar'))) === null || _a === void 0 ? void 0 : _a.value) || {}).show;
|
|
34
|
+
appendViewpart({
|
|
35
|
+
name: 'appmdibar',
|
|
36
|
+
viewpart: {
|
|
37
|
+
show,
|
|
38
|
+
template: html ` <app-mdibar></app-mdibar> `
|
|
39
|
+
},
|
|
40
|
+
position: VIEWPART_POSITION.HEADERBAR
|
|
41
|
+
});
|
|
42
|
+
store.dispatch({
|
|
43
|
+
type: ADD_SETTING,
|
|
44
|
+
setting: {
|
|
45
|
+
seq: 21,
|
|
46
|
+
template: html ` <mdibar-setting-let></mdibar-setting-let> `
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../client/index.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAA;AAC7B,OAAO,sBAAsB,CAAA;AAC7B,OAAO,qBAAqB,CAAA;AAC5B,OAAO,sBAAsB,CAAA;AAE7B,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAE/B,OAAO,EAAE,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAC1D,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAE1D,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,EACrC,OAAO,GAAG,IAAI,EACd,OAAO,GAAG,IAAI,EACd,MAAM,GAAG,IAAI,EAKd;;IACC,IAAI,OAAO,EAAE;QACX,cAAc,CAAC;YACb,IAAI,EAAE,YAAY;YAClB,QAAQ,EAAE;gBACR,IAAI,EAAE,IAAI;gBACV,QAAQ,EAAE,IAAI,CAAA,+BAA+B;aAC9C;YACD,QAAQ,EAAE,iBAAiB,CAAC,SAAS;SACtC,CAAC,CAAA;KACH;IAED,IAAI,OAAO,EAAE;QACX,cAAc,CAAC;YACb,IAAI,EAAE,YAAY;YAClB,QAAQ,EAAE;gBACR,IAAI,EAAE,IAAI;gBACV,QAAQ,EAAE,IAAI,CAAA,+BAA+B;aAC9C;YACD,QAAQ,EAAE,iBAAiB,CAAC,SAAS;SACtC,CAAC,CAAA;KACH;IAED,IAAI,MAAM,IAAI,CAAC,cAAc,EAAE,EAAE;QAC/B,MAAM,IAAI,GAAG,CAAC,CAAA,MAAA,CAAC,MAAM,kBAAkB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,0CAAE,KAAK,KAAI,EAAE,CAAC,CAAC,IAAI,CAAA;QAEzE,cAAc,CAAC;YACb,IAAI,EAAE,WAAW;YACjB,QAAQ,EAAE;gBACR,IAAI;gBACJ,QAAQ,EAAE,IAAI,CAAA,6BAA6B;aAC5C;YACD,QAAQ,EAAE,iBAAiB,CAAC,SAAS;SACtC,CAAC,CAAA;QAEF,KAAK,CAAC,QAAQ,CAAC;YACb,IAAI,EAAE,WAAW;YACjB,OAAO,EAAE;gBACP,GAAG,EAAE,EAAE;gBACP,QAAQ,EAAE,IAAI,CAAA,6CAA6C;aAC5D;SACF,CAAC,CAAA;KACH;AACH,CAAC","sourcesContent":["import './layout/app-toolbar'\nimport './layout/app-busybar'\nimport './layout/app-mdibar'\nimport './mdibar-setting-let'\n\nimport { html } from 'lit-html'\n\nimport { store, clientSettingStore } from '@operato/shell'\nimport { appendViewpart, VIEWPART_POSITION } from '@operato/layout'\nimport { isMobileDevice } from '@operato/utils'\nimport { ADD_SETTING } from '@things-factory/setting-base'\n\nexport async function setupAppToolPart({\n toolbar = true,\n busybar = true,\n mdibar = true\n}: {\n toolbar?: boolean\n busybar?: boolean\n mdibar?: boolean\n}) {\n if (toolbar) {\n appendViewpart({\n name: 'apptoolbar',\n viewpart: {\n show: true,\n template: html` <app-toolbar></app-toolbar> `\n },\n position: VIEWPART_POSITION.HEADERBAR\n })\n }\n\n if (busybar) {\n appendViewpart({\n name: 'appbusybar',\n viewpart: {\n show: true,\n template: html` <app-busybar></app-busybar> `\n },\n position: VIEWPART_POSITION.HEADERBAR\n })\n }\n\n if (mdibar && !isMobileDevice()) {\n const show = ((await clientSettingStore.get('mdibar'))?.value || {}).show\n\n appendViewpart({\n name: 'appmdibar',\n viewpart: {\n show,\n template: html` <app-mdibar></app-mdibar> `\n },\n position: VIEWPART_POSITION.HEADERBAR\n })\n\n store.dispatch({\n type: ADD_SETTING,\n setting: {\n seq: 21,\n template: html` <mdibar-setting-let></mdibar-setting-let> `\n }\n })\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@material/mwc-linear-progress';
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import '@material/mwc-linear-progress';
|
|
3
|
+
import { css, html, LitElement } from 'lit';
|
|
4
|
+
import { customElement, state } from 'lit/decorators.js';
|
|
5
|
+
import { connect } from 'pwa-helpers/connect-mixin.js';
|
|
6
|
+
import { store } from '@operato/shell';
|
|
7
|
+
let AppBusyBar = class AppBusyBar extends connect(store)(LitElement) {
|
|
8
|
+
render() {
|
|
9
|
+
return this.busy ? html `<mwc-linear-progress indeterminate></mwc-linear-progress>` : html ``;
|
|
10
|
+
}
|
|
11
|
+
stateChanged(state) {
|
|
12
|
+
if (!state.busy.busy) {
|
|
13
|
+
this.busy = false;
|
|
14
|
+
}
|
|
15
|
+
this.lastState = state.busy.busy;
|
|
16
|
+
if (!this.timeout) {
|
|
17
|
+
this.timeout = setTimeout(() => {
|
|
18
|
+
if (this.lastState) {
|
|
19
|
+
this.busy = true;
|
|
20
|
+
}
|
|
21
|
+
delete this.timeout;
|
|
22
|
+
}, 500);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
AppBusyBar.styles = [
|
|
27
|
+
css `
|
|
28
|
+
:host {
|
|
29
|
+
display: flex;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
mwc-linear-progress {
|
|
33
|
+
flex: 1;
|
|
34
|
+
height: 2px;
|
|
35
|
+
}
|
|
36
|
+
`
|
|
37
|
+
];
|
|
38
|
+
__decorate([
|
|
39
|
+
state(),
|
|
40
|
+
__metadata("design:type", Boolean)
|
|
41
|
+
], AppBusyBar.prototype, "busy", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
state(),
|
|
44
|
+
__metadata("design:type", Boolean)
|
|
45
|
+
], AppBusyBar.prototype, "lastState", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
state(),
|
|
48
|
+
__metadata("design:type", Object)
|
|
49
|
+
], AppBusyBar.prototype, "timeout", void 0);
|
|
50
|
+
AppBusyBar = __decorate([
|
|
51
|
+
customElement('app-busybar')
|
|
52
|
+
], AppBusyBar);
|
|
53
|
+
//# sourceMappingURL=app-busybar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-busybar.js","sourceRoot":"","sources":["../../client/layout/app-busybar.ts"],"names":[],"mappings":";AAAA,OAAO,+BAA+B,CAAA;AAEtC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAY,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA;AAEtD,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAGtC,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,OAAO,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC;IAkBjD,MAAM;QACJ,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAA,2DAA2D,CAAC,CAAC,CAAC,IAAI,CAAA,EAAE,CAAA;IAC7F,CAAC;IAED,YAAY,CAAC,KAAK;QAChB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE;YACpB,IAAI,CAAC,IAAI,GAAG,KAAK,CAAA;SAClB;QAED,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAA;QAEhC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YACjB,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE;gBAC7B,IAAI,IAAI,CAAC,SAAS,EAAE;oBAClB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;iBACjB;gBACD,OAAO,IAAI,CAAC,OAAO,CAAA;YACrB,CAAC,EAAE,GAAG,CAAC,CAAA;SACR;IACH,CAAC;;AApCM,iBAAM,GAAG;IACd,GAAG,CAAA;;;;;;;;;KASF;CACF,CAAA;AAED;IAAC,KAAK,EAAE;8BAAgB,OAAO;wCAAA;AAC/B;IAAC,KAAK,EAAE;;6CAA4B;AACpC;IAAC,KAAK,EAAE;;2CAAsB;AAhB1B,UAAU;IADf,aAAa,CAAC,aAAa,CAAC;GACvB,UAAU,CAsCf","sourcesContent":["import '@material/mwc-linear-progress'\n\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\nimport { connect } from 'pwa-helpers/connect-mixin.js'\n\nimport { store } from '@operato/shell'\n\n@customElement('app-busybar')\nclass AppBusyBar extends connect(store)(LitElement) {\n static styles = [\n css`\n :host {\n display: flex;\n }\n\n mwc-linear-progress {\n flex: 1;\n height: 2px;\n }\n `\n ]\n\n @state() private busy?: Boolean\n @state() private lastState?: boolean\n @state() private timeout?: any\n\n render() {\n return this.busy ? html`<mwc-linear-progress indeterminate></mwc-linear-progress>` : html``\n }\n\n stateChanged(state) {\n if (!state.busy.busy) {\n this.busy = false\n }\n\n this.lastState = state.busy.busy\n\n if (!this.timeout) {\n this.timeout = setTimeout(() => {\n if (this.lastState) {\n this.busy = true\n }\n delete this.timeout\n }, 500)\n }\n }\n}\n"]}
|