@things-factory/apptool-ui 6.1.66 → 6.1.68
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 +80 -0
- package/client/layout/app-busybar.ts +48 -0
- package/client/layout/{app-toolbar.js → app-toolbar.ts} +62 -71
- package/client/layout/page-mdibar.ts +132 -0
- package/client/layout/page-toolbar.ts +100 -0
- 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 +11 -0
- package/dist-client/index.js +63 -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/layout/page-mdibar.d.ts +1 -0
- package/dist-client/layout/page-mdibar.js +136 -0
- package/dist-client/layout/page-mdibar.js.map +1 -0
- package/dist-client/layout/page-toolbar.d.ts +1 -0
- package/dist-client/layout/page-toolbar.js +105 -0
- package/dist-client/layout/page-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/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` <page-mdibar></page-mdibar> `
|
|
31
|
+
// },
|
|
32
|
+
// position: VIEWPART_POSITION.HEADERBAR
|
|
33
|
+
// })
|
|
34
|
+
}
|
package/client/index.ts
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import './layout/app-toolbar'
|
|
2
|
+
import './layout/app-busybar'
|
|
3
|
+
import './layout/page-mdibar'
|
|
4
|
+
import './layout/page-toolbar'
|
|
5
|
+
import './mdibar-setting-let'
|
|
6
|
+
|
|
7
|
+
import { html } from 'lit-html'
|
|
8
|
+
|
|
9
|
+
import { store, clientSettingStore } from '@operato/shell'
|
|
10
|
+
import { appendViewpart, TOOL_POSITION, VIEWPART_POSITION, VIEWPART_LEVEL } from '@operato/layout'
|
|
11
|
+
import { isMobileDevice } from '@operato/utils'
|
|
12
|
+
import { APPEND_PAGE_TOOL } from '@things-factory/apptool-base'
|
|
13
|
+
import { ADD_SETTING } from '@things-factory/setting-base'
|
|
14
|
+
|
|
15
|
+
export async function setupAppToolPart({
|
|
16
|
+
toolbar = true,
|
|
17
|
+
busybar = true,
|
|
18
|
+
mdibar = true,
|
|
19
|
+
pageToolbar = false
|
|
20
|
+
}: {
|
|
21
|
+
toolbar?: boolean
|
|
22
|
+
busybar?: boolean
|
|
23
|
+
mdibar?: boolean
|
|
24
|
+
pageToolbar?: boolean
|
|
25
|
+
}) {
|
|
26
|
+
if (toolbar) {
|
|
27
|
+
appendViewpart({
|
|
28
|
+
name: 'apptoolbar',
|
|
29
|
+
viewpart: {
|
|
30
|
+
show: true,
|
|
31
|
+
template: html` <app-toolbar></app-toolbar> `
|
|
32
|
+
},
|
|
33
|
+
position: VIEWPART_POSITION.HEADERBAR
|
|
34
|
+
})
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (busybar) {
|
|
38
|
+
appendViewpart({
|
|
39
|
+
name: 'appbusybar',
|
|
40
|
+
viewpart: {
|
|
41
|
+
show: true,
|
|
42
|
+
template: html` <app-busybar></app-busybar> `
|
|
43
|
+
},
|
|
44
|
+
position: VIEWPART_POSITION.HEADERBAR
|
|
45
|
+
})
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (mdibar && !isMobileDevice()) {
|
|
49
|
+
const show = ((await clientSettingStore.get('mdibar'))?.value || {}).show
|
|
50
|
+
|
|
51
|
+
appendViewpart({
|
|
52
|
+
name: 'appmdibar',
|
|
53
|
+
viewpart: {
|
|
54
|
+
show,
|
|
55
|
+
level: VIEWPART_LEVEL.TOPMOST,
|
|
56
|
+
template: html` <page-mdibar></page-mdibar> `
|
|
57
|
+
},
|
|
58
|
+
position: VIEWPART_POSITION.PAGE_HEADERBAR
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
store.dispatch({
|
|
62
|
+
type: ADD_SETTING,
|
|
63
|
+
setting: {
|
|
64
|
+
seq: 21,
|
|
65
|
+
template: html` <mdibar-setting-let></mdibar-setting-let> `
|
|
66
|
+
}
|
|
67
|
+
})
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (pageToolbar) {
|
|
71
|
+
appendViewpart({
|
|
72
|
+
name: 'page-toolbar',
|
|
73
|
+
viewpart: {
|
|
74
|
+
show: true,
|
|
75
|
+
template: html` <page-toolbar> </page-toolbar> `
|
|
76
|
+
},
|
|
77
|
+
position: VIEWPART_POSITION.PAGE_HEADERBAR
|
|
78
|
+
})
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -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,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('page-mdibar')
|
|
10
|
+
class PageMDIBar 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
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import '@material/mwc-icon'
|
|
2
|
+
|
|
3
|
+
import { css, html, LitElement, TemplateResult } from 'lit'
|
|
4
|
+
import { customElement, query, state } from 'lit/decorators.js'
|
|
5
|
+
import { connect } from 'pwa-helpers/connect-mixin.js'
|
|
6
|
+
|
|
7
|
+
import { TOOL_POSITION } from '@operato/layout'
|
|
8
|
+
import { navigate, store } from '@operato/shell'
|
|
9
|
+
|
|
10
|
+
@customElement('page-toolbar')
|
|
11
|
+
class PageToolbar extends connect(store)(LitElement) {
|
|
12
|
+
static styles = [
|
|
13
|
+
css`
|
|
14
|
+
:host {
|
|
15
|
+
display: flex;
|
|
16
|
+
color: var(--page-header-bar-color);
|
|
17
|
+
background-color: var(--page-header-bar-background-color, white);
|
|
18
|
+
justify-content: space-between;
|
|
19
|
+
align-items: center;
|
|
20
|
+
padding: 0 5px;
|
|
21
|
+
|
|
22
|
+
text-transform: capitalize;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
:host > * {
|
|
26
|
+
margin: var(--page-header-bar-item-padding, 0);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
[center] {
|
|
30
|
+
flex: 1;
|
|
31
|
+
flex-wrap: nowrap;
|
|
32
|
+
display: flex;
|
|
33
|
+
align-items: center;
|
|
34
|
+
overflow: hidden;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
[center] > * {
|
|
38
|
+
margin: auto;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
:host(.vline) {
|
|
42
|
+
display: block;
|
|
43
|
+
flex: none;
|
|
44
|
+
border-left: 1px solid rgba(255, 255, 255, 0.07);
|
|
45
|
+
border-right: 1px solid rgba(0, 0, 0, 0.1);
|
|
46
|
+
width: 0px;
|
|
47
|
+
height: 18px;
|
|
48
|
+
margin: 0 4px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
:host(label) {
|
|
52
|
+
margin-right: 5px;
|
|
53
|
+
color: #fff;
|
|
54
|
+
font-size: 20px;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
span.space {
|
|
58
|
+
width: 10px;
|
|
59
|
+
}
|
|
60
|
+
`
|
|
61
|
+
]
|
|
62
|
+
|
|
63
|
+
@state() _tools: { position: string; template: TemplateResult }[] = []
|
|
64
|
+
@state() _route: any
|
|
65
|
+
|
|
66
|
+
@query('[center]') center!: HTMLDivElement
|
|
67
|
+
|
|
68
|
+
render() {
|
|
69
|
+
var tools = this._tools || ([] as { position: string; template: TemplateResult }[])
|
|
70
|
+
|
|
71
|
+
var frontEndTools = tools.filter(tool => tool.position == TOOL_POSITION.FRONT_END)
|
|
72
|
+
var frontTools = tools.filter(tool => tool.position == TOOL_POSITION.FRONT)
|
|
73
|
+
var centerTools = tools.filter(tool => tool.position == TOOL_POSITION.CENTER)
|
|
74
|
+
var rearTools = tools.filter(tool => tool.position == TOOL_POSITION.REAR)
|
|
75
|
+
var rearEndTools = tools.filter(tool => tool.position == TOOL_POSITION.REAR_END)
|
|
76
|
+
|
|
77
|
+
return html`
|
|
78
|
+
${frontEndTools.map(tool => html` ${tool.template} `)} ${frontTools.map(tool => html` ${tool.template} `)}
|
|
79
|
+
|
|
80
|
+
<div center @mousewheel=${this.onWheelEvent}>${centerTools.map(tool => html` ${tool.template} `)}</div>
|
|
81
|
+
|
|
82
|
+
${rearTools.map(tool => html` ${tool.template} `)} ${rearEndTools.map(tool => html` ${tool.template} `)}
|
|
83
|
+
`
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
stateChanged(state) {
|
|
87
|
+
/* page의 변화를 감지하기 위해서 route의 변화를 체크한다. */
|
|
88
|
+
this._route = state.route
|
|
89
|
+
|
|
90
|
+
this._tools = state.pagetool.tools
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
onWheelEvent(e) {
|
|
94
|
+
const center = e.currentTarget
|
|
95
|
+
var delta = Math.max(-1, Math.min(1, e.wheelDelta || -e.detail))
|
|
96
|
+
center.scrollLeft -= delta * 10
|
|
97
|
+
|
|
98
|
+
e.preventDefault()
|
|
99
|
+
}
|
|
100
|
+
}
|
|
@@ -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` <page-mdibar></page-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,oDAAoD;IACpD,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` <page-mdibar></page-mdibar> `\n // },\n // position: VIEWPART_POSITION.HEADERBAR\n // })\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import './layout/app-toolbar';
|
|
2
|
+
import './layout/app-busybar';
|
|
3
|
+
import './layout/page-mdibar';
|
|
4
|
+
import './layout/page-toolbar';
|
|
5
|
+
import './mdibar-setting-let';
|
|
6
|
+
export declare function setupAppToolPart({ toolbar, busybar, mdibar, pageToolbar }: {
|
|
7
|
+
toolbar?: boolean;
|
|
8
|
+
busybar?: boolean;
|
|
9
|
+
mdibar?: boolean;
|
|
10
|
+
pageToolbar?: boolean;
|
|
11
|
+
}): Promise<void>;
|