@things-factory/apptool-ui 8.0.0-beta.1 → 8.0.0-beta.4
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/package.json +4 -4
- package/client/index.ts +0 -80
- package/client/layout/app-busybar.ts +0 -54
- package/client/layout/app-toolbar.ts +0 -116
- package/client/layout/page-mdibar.ts +0 -357
- package/client/layout/page-toolbar.ts +0 -101
- package/client/mdibar-setting-let.ts +0 -68
- package/server/index.ts +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/apptool-ui",
|
|
3
|
-
"version": "8.0.0-beta.
|
|
3
|
+
"version": "8.0.0-beta.4",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "dist-client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@material/web": "^2.0.0",
|
|
31
31
|
"@operato/layout": "^8.0.0-beta",
|
|
32
|
-
"@things-factory/apptool-base": "^8.0.0-beta.
|
|
33
|
-
"@things-factory/setting-base": "^8.0.0-beta.
|
|
32
|
+
"@things-factory/apptool-base": "^8.0.0-beta.4",
|
|
33
|
+
"@things-factory/setting-base": "^8.0.0-beta.4"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "d83d12ed4ba07177dff1dac26e37be347d156b43"
|
|
36
36
|
}
|
package/client/index.ts
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
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, VIEWPART_POSITION, VIEWPART_LEVEL } from '@operato/layout'
|
|
11
|
-
import { isMobileDevice } from '@operato/utils'
|
|
12
|
-
|
|
13
|
-
import { ADD_SETTING } from '@things-factory/setting-base/dist-client'
|
|
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
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import '@material/web/progress/linear-progress.js'
|
|
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: block;
|
|
15
|
-
position: relative;
|
|
16
|
-
|
|
17
|
-
--md-linear-progress-track-color: var(--md-sys-color-on-primary);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
md-linear-progress {
|
|
21
|
-
position: absolute;
|
|
22
|
-
bottom: 0;
|
|
23
|
-
width: 100%;
|
|
24
|
-
overflow: hidden;
|
|
25
|
-
}
|
|
26
|
-
`
|
|
27
|
-
]
|
|
28
|
-
|
|
29
|
-
@state() private busy?: Boolean
|
|
30
|
-
@state() private lastState?: boolean
|
|
31
|
-
@state() private timeout?: any
|
|
32
|
-
|
|
33
|
-
render() {
|
|
34
|
-
return this.busy ? html`<md-linear-progress indeterminate></md-linear-progress>` : html``
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
stateChanged(state) {
|
|
38
|
-
if (!state.busy.busy) {
|
|
39
|
-
this.busy = false
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
this.lastState = state.busy.busy
|
|
43
|
-
|
|
44
|
-
if (!this.timeout) {
|
|
45
|
-
this.timeout = setTimeout(() => {
|
|
46
|
-
if (this.lastState) {
|
|
47
|
-
this.busy = true
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
this.timeout = null
|
|
51
|
-
}, 500)
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import '@material/web/icon/icon.js'
|
|
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('app-toolbar')
|
|
11
|
-
class AppToolbar extends connect(store)(LitElement) {
|
|
12
|
-
static styles = [
|
|
13
|
-
css`
|
|
14
|
-
:host {
|
|
15
|
-
display: flex;
|
|
16
|
-
height: var(--header-bar-height, 42px);
|
|
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
|
-
gap: 10px;
|
|
23
|
-
|
|
24
|
-
text-transform: capitalize;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
[center] {
|
|
28
|
-
flex: 1;
|
|
29
|
-
flex-wrap: nowrap;
|
|
30
|
-
display: flex;
|
|
31
|
-
align-items: center;
|
|
32
|
-
overflow: hidden;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
[center] > * {
|
|
36
|
-
margin: auto;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
:host(.vline) {
|
|
40
|
-
display: block;
|
|
41
|
-
flex: none;
|
|
42
|
-
border-left: 1px solid rgba(255, 255, 255, 0.07);
|
|
43
|
-
border-right: 1px solid rgba(0, 0, 0, 0.1);
|
|
44
|
-
width: 0px;
|
|
45
|
-
height: 18px;
|
|
46
|
-
margin: 0 4px;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
:host(label) {
|
|
50
|
-
margin-right: 5px;
|
|
51
|
-
color: #fff;
|
|
52
|
-
font-size: 20px;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
span.space {
|
|
56
|
-
width: 10px;
|
|
57
|
-
}
|
|
58
|
-
`
|
|
59
|
-
]
|
|
60
|
-
|
|
61
|
-
@state() _tools: { position: string; template: TemplateResult }[] = []
|
|
62
|
-
@state() _route: any
|
|
63
|
-
|
|
64
|
-
@query('[center]') center!: HTMLDivElement
|
|
65
|
-
|
|
66
|
-
render() {
|
|
67
|
-
var tools = this._tools || ([] as { position: string; template: TemplateResult }[])
|
|
68
|
-
|
|
69
|
-
var frontEndTools = tools.filter(tool => tool.position == TOOL_POSITION.FRONT_END)
|
|
70
|
-
var frontTools = tools.filter(tool => tool.position == TOOL_POSITION.FRONT)
|
|
71
|
-
var centerTools = tools.filter(tool => tool.position == TOOL_POSITION.CENTER)
|
|
72
|
-
var rearTools = tools.filter(tool => tool.position == TOOL_POSITION.REAR)
|
|
73
|
-
var rearEndTools = tools.filter(tool => tool.position == TOOL_POSITION.REAR_END)
|
|
74
|
-
|
|
75
|
-
/* 현재 OVERLAY가 있으면, 뒤로가기 버튼이 보이고, 아니면, HOME 버튼이 보인다. */
|
|
76
|
-
var state = history.state
|
|
77
|
-
var overlay = (state || {}).overlay
|
|
78
|
-
|
|
79
|
-
return html`
|
|
80
|
-
${overlay
|
|
81
|
-
? html` <md-icon @click=${e => history.back()}>arrow_back</md-icon> `
|
|
82
|
-
: frontEndTools.length == 0
|
|
83
|
-
? html` <md-icon @click=${e => this.navigateToHome()}>home</md-icon> `
|
|
84
|
-
: frontEndTools.map(tool => html` ${tool.template} `)}
|
|
85
|
-
${frontTools.map(tool => html` ${tool.template} `)}
|
|
86
|
-
|
|
87
|
-
<div center @mousewheel=${this.onWheelEvent}>${centerTools.map(tool => html` ${tool.template} `)}</div>
|
|
88
|
-
|
|
89
|
-
${rearTools.map(tool => html` ${tool.template} `)} ${rearEndTools.map(tool => html` ${tool.template} `)}
|
|
90
|
-
`
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
stateChanged(state) {
|
|
94
|
-
/* page의 변화를 감지하기 위해서 route의 변화를 체크한다. */
|
|
95
|
-
this._route = state.route
|
|
96
|
-
|
|
97
|
-
this._tools = state.apptool.tools
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
navigateToHome() {
|
|
101
|
-
var base = document.querySelector('base')
|
|
102
|
-
if (base) {
|
|
103
|
-
navigate(base.getAttribute('href') || '')
|
|
104
|
-
} else {
|
|
105
|
-
navigate('/')
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
onWheelEvent(e) {
|
|
110
|
-
const center = e.currentTarget
|
|
111
|
-
var delta = Math.max(-1, Math.min(1, e.wheelDelta || -e.detail))
|
|
112
|
-
center.scrollLeft -= delta * 10
|
|
113
|
-
|
|
114
|
-
e.preventDefault()
|
|
115
|
-
}
|
|
116
|
-
}
|
|
@@ -1,357 +0,0 @@
|
|
|
1
|
-
import '@material/web/icon/icon.js'
|
|
2
|
-
import '@operato/popup/ox-popup-menu.js'
|
|
3
|
-
|
|
4
|
-
import { css, html, nothing, LitElement } from 'lit'
|
|
5
|
-
import { customElement, query, state } from 'lit/decorators.js'
|
|
6
|
-
import { connect } from 'pwa-helpers/connect-mixin.js'
|
|
7
|
-
|
|
8
|
-
import { navigate, store, PageView } from '@operato/shell'
|
|
9
|
-
import { i18next, localize } from '@operato/i18n'
|
|
10
|
-
import { OxPopupMenu } from '@operato/popup/ox-popup-menu.js'
|
|
11
|
-
|
|
12
|
-
@customElement('page-mdibar')
|
|
13
|
-
export class PageMDIBar extends connect(store)(localize(i18next)(LitElement)) {
|
|
14
|
-
static styles = [
|
|
15
|
-
css`
|
|
16
|
-
:host {
|
|
17
|
-
display: flex;
|
|
18
|
-
background-color: var(--md-sys-color-secondary-container);
|
|
19
|
-
color: var(--md-sys-color-on-secondary-container);
|
|
20
|
-
font-size: var(--fontsize-small);
|
|
21
|
-
overflow: hidden;
|
|
22
|
-
align-items: stretch;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
div {
|
|
26
|
-
box-sizing: border-box;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
div[routes] {
|
|
30
|
-
flex: 1;
|
|
31
|
-
|
|
32
|
-
display: flex;
|
|
33
|
-
overflow: hidden;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
div[route] {
|
|
37
|
-
display: inline-block;
|
|
38
|
-
position: relative;
|
|
39
|
-
min-width: var(--mdibar-min-width, 100px);
|
|
40
|
-
max-width: var(--mdibar-max-width, 150px);
|
|
41
|
-
padding: var(--mdibar-padding, 3px 22px 1px 7px);
|
|
42
|
-
border-right: var(--border-dim-color);
|
|
43
|
-
border-top: var(--border-dim-color);
|
|
44
|
-
border-bottom: var(--border-dim-color);
|
|
45
|
-
white-space: nowrap;
|
|
46
|
-
overflow: hidden;
|
|
47
|
-
text-overflow: ellipsis;
|
|
48
|
-
text-transform: capitalize;
|
|
49
|
-
cursor: pointer;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
div[arrows] {
|
|
53
|
-
display: flex;
|
|
54
|
-
border: var(--border-dim-color);
|
|
55
|
-
align-items: center;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
div[arrows] * {
|
|
59
|
-
opacity: 0.8;
|
|
60
|
-
font-size: var(--mdibar-icon-size, 24px);
|
|
61
|
-
flex: 1;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
md-icon {
|
|
65
|
-
--md-icon-size: var(--mdibar-icon-size, 18px);
|
|
66
|
-
opacity: 0.5;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
md-icon:hover {
|
|
70
|
-
opacity: 0.8;
|
|
71
|
-
color: var(--md-sys-color-secondary);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
div[arrows] md-icon[disabled] {
|
|
75
|
-
opacity: 0.2;
|
|
76
|
-
color: unset;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
div[route] md-icon {
|
|
80
|
-
position: absolute;
|
|
81
|
-
right: 2px;
|
|
82
|
-
margin-left: var(--spacing-small);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
div[route][active] {
|
|
86
|
-
background-color: var(--md-sys-color-background);
|
|
87
|
-
border-bottom: 1px solid var(--md-sys-color-background);
|
|
88
|
-
color: var(--md-sys-color-on-background);
|
|
89
|
-
font-weight: bold;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
div[route][home] {
|
|
93
|
-
padding: var(--mdibar-padding-home, 3px 5px 0 23px);
|
|
94
|
-
overflow: visible;
|
|
95
|
-
min-width: unset;
|
|
96
|
-
max-width: unset;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
div[route][home] md-icon {
|
|
100
|
-
left: 0;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
div[route][rest] {
|
|
104
|
-
flex: 1;
|
|
105
|
-
min-width: unset;
|
|
106
|
-
max-width: unset;
|
|
107
|
-
border-right: unset;
|
|
108
|
-
}
|
|
109
|
-
`
|
|
110
|
-
]
|
|
111
|
-
|
|
112
|
-
@state() routes: { page?: PageView; url: string }[] = [{ url: this.getHomeRoute() }]
|
|
113
|
-
@state() activePage?: PageView
|
|
114
|
-
@state() pagename?: string
|
|
115
|
-
@state() params?: any
|
|
116
|
-
@state() resourceId?: string
|
|
117
|
-
@state() title: string = ''
|
|
118
|
-
|
|
119
|
-
@query('[routes]') scroller!: HTMLDivElement
|
|
120
|
-
@query('#context-menu') contextMenu!: HTMLDivElement
|
|
121
|
-
|
|
122
|
-
private contextMenuTargetIndex?: number
|
|
123
|
-
private contextMenuTargetRoute?: { page?: PageView; url: string }
|
|
124
|
-
|
|
125
|
-
render() {
|
|
126
|
-
const home = this.routes[0]
|
|
127
|
-
const routes = this.routes.slice(1)
|
|
128
|
-
|
|
129
|
-
return html`
|
|
130
|
-
<div
|
|
131
|
-
home
|
|
132
|
-
route
|
|
133
|
-
?active=${this.activePage === home.page}
|
|
134
|
-
@click=${() => this.moveToHome()}
|
|
135
|
-
@contextmenu=${(e: MouseEvent) => {
|
|
136
|
-
e.preventDefault()
|
|
137
|
-
e.stopPropagation()
|
|
138
|
-
|
|
139
|
-
delete this.contextMenuTargetRoute
|
|
140
|
-
delete this.contextMenuTargetIndex
|
|
141
|
-
|
|
142
|
-
this.openContextMenu(e)
|
|
143
|
-
}}
|
|
144
|
-
>
|
|
145
|
-
<md-icon>home</md-icon>​
|
|
146
|
-
</div>
|
|
147
|
-
|
|
148
|
-
<div
|
|
149
|
-
routes
|
|
150
|
-
@mousewheel=${this.onWheelEvent.bind(this)}
|
|
151
|
-
@contextmenu=${(e: MouseEvent) => {
|
|
152
|
-
e.preventDefault()
|
|
153
|
-
e.stopPropagation()
|
|
154
|
-
|
|
155
|
-
delete this.contextMenuTargetRoute
|
|
156
|
-
delete this.contextMenuTargetIndex
|
|
157
|
-
|
|
158
|
-
this.openContextMenu(e)
|
|
159
|
-
}}
|
|
160
|
-
>
|
|
161
|
-
${routes.map((route, idx) => {
|
|
162
|
-
const context = route.page?.context as any
|
|
163
|
-
const title = context?.title || context?.search?.placeholder || ''
|
|
164
|
-
|
|
165
|
-
return html`
|
|
166
|
-
<div
|
|
167
|
-
@contextmenu=${(e: MouseEvent) => {
|
|
168
|
-
e.preventDefault()
|
|
169
|
-
e.stopPropagation()
|
|
170
|
-
|
|
171
|
-
this.contextMenuTargetRoute = route
|
|
172
|
-
this.contextMenuTargetIndex = idx
|
|
173
|
-
|
|
174
|
-
this.openContextMenu(e)
|
|
175
|
-
}}
|
|
176
|
-
@click=${() => this.moveTo(route)}
|
|
177
|
-
?active=${this.activePage === route.page}
|
|
178
|
-
route
|
|
179
|
-
>
|
|
180
|
-
${typeof title == 'object' ? title.text : title}
|
|
181
|
-
<md-icon
|
|
182
|
-
@click=${(e: MouseEvent) => {
|
|
183
|
-
e.stopPropagation()
|
|
184
|
-
this.closePage(route, idx + 1)
|
|
185
|
-
}}
|
|
186
|
-
>close</md-icon
|
|
187
|
-
>
|
|
188
|
-
</div>
|
|
189
|
-
`
|
|
190
|
-
})}
|
|
191
|
-
<div rest route></div>
|
|
192
|
-
</div>
|
|
193
|
-
|
|
194
|
-
<div arrows>
|
|
195
|
-
<md-icon ?disabled=${!this.scroller || this.scroller.scrollLeft <= 0} @click=${() => this.onScrollByArrow(1)}
|
|
196
|
-
>arrow_left</md-icon
|
|
197
|
-
>
|
|
198
|
-
<md-icon
|
|
199
|
-
?disabled=${!this.scroller ||
|
|
200
|
-
this.scroller.scrollWidth <= this.scroller.offsetWidth + this.scroller.scrollLeft}
|
|
201
|
-
@click=${() => this.onScrollByArrow(-1)}
|
|
202
|
-
>arrow_right</md-icon
|
|
203
|
-
>
|
|
204
|
-
</div>
|
|
205
|
-
`
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
updated(changed) {
|
|
209
|
-
if (
|
|
210
|
-
changed.has('activePage') ||
|
|
211
|
-
(!changed.has('pagename') && (changed.has('resourceId') || changed.has('params')))
|
|
212
|
-
) {
|
|
213
|
-
if (!this.activePage) {
|
|
214
|
-
return
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
const page = this.activePage
|
|
218
|
-
|
|
219
|
-
if (location.pathname == this.getHomeRoute()) {
|
|
220
|
-
this.routes[0].page = page
|
|
221
|
-
return
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
var route = this.routes.find(route => route.page === page)
|
|
225
|
-
if (!route) {
|
|
226
|
-
this.routes = [...this.routes, { page, url: location.href }]
|
|
227
|
-
} else {
|
|
228
|
-
route.url = location.href
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
stateChanged(state) {
|
|
234
|
-
const { page, context, activePage, resourceId, params } = state.route || {}
|
|
235
|
-
this.activePage = activePage
|
|
236
|
-
this.pagename = page
|
|
237
|
-
this.resourceId = resourceId
|
|
238
|
-
this.params = params
|
|
239
|
-
|
|
240
|
-
/* refresh를 일으키기위한 property 변경을 위한 코드임. */
|
|
241
|
-
this.title = context.title || context.search?.placeholder
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
onScrollByArrow(delta: number) {
|
|
245
|
-
this.scroller.scrollLeft -= delta * 10
|
|
246
|
-
|
|
247
|
-
this.requestUpdate()
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
onWheelEvent(e: Event) {
|
|
251
|
-
const target = e.currentTarget as HTMLDivElement
|
|
252
|
-
|
|
253
|
-
var delta = Math.max(-1, Math.min(1, (e as WheelEvent).deltaY || -(e as WheelEvent).detail))
|
|
254
|
-
target.scrollLeft -= delta * 10
|
|
255
|
-
|
|
256
|
-
this.requestUpdate()
|
|
257
|
-
|
|
258
|
-
e.preventDefault()
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
getHomeRoute() {
|
|
262
|
-
var base = document.querySelector('base')
|
|
263
|
-
return base?.getAttribute('href') || '/'
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
moveTo(route: { page?: PageView; url: string }) {
|
|
267
|
-
console.log('route', route)
|
|
268
|
-
navigate(route.url)
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
moveToHome() {
|
|
272
|
-
navigate(this.getHomeRoute())
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
closePage(route: { page?: PageView; url: string }, idx: number) {
|
|
276
|
-
this.routes = [...this.routes.slice(0, idx), ...this.routes.slice(idx + 1)]
|
|
277
|
-
const page = route.page!
|
|
278
|
-
|
|
279
|
-
page.parentNode?.removeChild(page)
|
|
280
|
-
page.pageDispose()
|
|
281
|
-
|
|
282
|
-
if (this.activePage === page) {
|
|
283
|
-
const next = this.routes.length > 0 ? Math.max(0, idx - 1) : -1
|
|
284
|
-
navigate(next != -1 ? this.routes[next].url : this.getHomeRoute())
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
closeAllPage() {
|
|
289
|
-
this.routes.slice(1).forEach((route, idx) => {
|
|
290
|
-
const page = route.page!
|
|
291
|
-
|
|
292
|
-
page.parentNode?.removeChild(page)
|
|
293
|
-
page.pageDispose()
|
|
294
|
-
})
|
|
295
|
-
|
|
296
|
-
this.routes = [this.routes[0]]
|
|
297
|
-
|
|
298
|
-
navigate(this.routes[0].url)
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
closeOtherPages(route: { page?: PageView; url: string }, idx: number) {
|
|
302
|
-
this.routes.slice(1).forEach((route, idx) => {
|
|
303
|
-
if (route === route) {
|
|
304
|
-
return
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
const page = route.page!
|
|
308
|
-
|
|
309
|
-
page.parentNode?.removeChild(page)
|
|
310
|
-
page.pageDispose()
|
|
311
|
-
})
|
|
312
|
-
|
|
313
|
-
this.routes = [this.routes[0], route]
|
|
314
|
-
|
|
315
|
-
navigate(route.url)
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
openContextMenu(e: MouseEvent) {
|
|
319
|
-
OxPopupMenu.open({
|
|
320
|
-
template: html`
|
|
321
|
-
${this.contextMenuTargetRoute
|
|
322
|
-
? html`
|
|
323
|
-
<ox-popup-menuitem
|
|
324
|
-
label="close"
|
|
325
|
-
@select=${(e: Event) => {
|
|
326
|
-
this.closePage(this.contextMenuTargetRoute!, this.contextMenuTargetIndex!)
|
|
327
|
-
}}
|
|
328
|
-
>
|
|
329
|
-
<md-icon slot="icon">close</md-icon>
|
|
330
|
-
</ox-popup-menuitem>
|
|
331
|
-
|
|
332
|
-
<ox-popup-menuitem
|
|
333
|
-
label="close others"
|
|
334
|
-
@select=${(e: Event) => {
|
|
335
|
-
this.closeOtherPages(this.contextMenuTargetRoute!, this.contextMenuTargetIndex!)
|
|
336
|
-
}}
|
|
337
|
-
>
|
|
338
|
-
<md-icon slot="icon">cancel</md-icon>
|
|
339
|
-
</ox-popup-menuitem>
|
|
340
|
-
`
|
|
341
|
-
: nothing}
|
|
342
|
-
|
|
343
|
-
<ox-popup-menuitem
|
|
344
|
-
label="close all"
|
|
345
|
-
@select=${(e: Event) => {
|
|
346
|
-
this.closeAllPage()
|
|
347
|
-
}}
|
|
348
|
-
>
|
|
349
|
-
<md-icon slot="icon">disabled_by_default</md-icon>
|
|
350
|
-
</ox-popup-menuitem>
|
|
351
|
-
`,
|
|
352
|
-
top: e.clientY,
|
|
353
|
-
left: e.clientX,
|
|
354
|
-
parent: document.body
|
|
355
|
-
})
|
|
356
|
-
}
|
|
357
|
-
}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { css, html, LitElement, TemplateResult } from 'lit'
|
|
2
|
-
import { customElement, query, state } from 'lit/decorators.js'
|
|
3
|
-
import { connect } from 'pwa-helpers/connect-mixin.js'
|
|
4
|
-
|
|
5
|
-
import { TOOL_POSITION } from '@operato/layout'
|
|
6
|
-
import { store } from '@operato/shell'
|
|
7
|
-
|
|
8
|
-
@customElement('page-toolbar')
|
|
9
|
-
class PageToolbar extends connect(store)(LitElement) {
|
|
10
|
-
static styles = [
|
|
11
|
-
css`
|
|
12
|
-
:host {
|
|
13
|
-
display: flex;
|
|
14
|
-
color: var(--page-header-bar-color, var(--md-sys-color-on-surface));
|
|
15
|
-
background-color: var(--page-header-bar-background-color, var(--md-sys-color-surface-container));
|
|
16
|
-
justify-content: space-between;
|
|
17
|
-
align-items: center;
|
|
18
|
-
padding: 0 5px;
|
|
19
|
-
|
|
20
|
-
text-transform: capitalize;
|
|
21
|
-
|
|
22
|
-
--ox-input-search-background-color: var(--md-sys-color-on-primary);
|
|
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
|
-
flex: 1;
|
|
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
|
-
]
|
|
63
|
-
|
|
64
|
-
@state() _tools: { position: string; template: TemplateResult }[] = []
|
|
65
|
-
@state() _route: any
|
|
66
|
-
|
|
67
|
-
@query('[center]') center!: HTMLDivElement
|
|
68
|
-
|
|
69
|
-
render() {
|
|
70
|
-
var tools = this._tools || ([] as { position: string; template: TemplateResult }[])
|
|
71
|
-
|
|
72
|
-
var frontEndTools = tools.filter(tool => tool.position == TOOL_POSITION.FRONT_END)
|
|
73
|
-
var frontTools = tools.filter(tool => tool.position == TOOL_POSITION.FRONT)
|
|
74
|
-
var centerTools = tools.filter(tool => tool.position == TOOL_POSITION.CENTER)
|
|
75
|
-
var rearTools = tools.filter(tool => tool.position == TOOL_POSITION.REAR)
|
|
76
|
-
var rearEndTools = tools.filter(tool => tool.position == TOOL_POSITION.REAR_END)
|
|
77
|
-
|
|
78
|
-
return html`
|
|
79
|
-
${frontEndTools.map(tool => html` ${tool.template} `)} ${frontTools.map(tool => html` ${tool.template} `)}
|
|
80
|
-
|
|
81
|
-
<div center @mousewheel=${this.onWheelEvent}>${centerTools.map(tool => html` ${tool.template} `)}</div>
|
|
82
|
-
|
|
83
|
-
${rearTools.map(tool => html` ${tool.template} `)} ${rearEndTools.map(tool => html` ${tool.template} `)}
|
|
84
|
-
`
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
stateChanged(state) {
|
|
88
|
-
/* page의 변화를 감지하기 위해서 route의 변화를 체크한다. */
|
|
89
|
-
this._route = state.route
|
|
90
|
-
|
|
91
|
-
this._tools = state.pagetool.tools
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
onWheelEvent(e) {
|
|
95
|
-
const center = e.currentTarget
|
|
96
|
-
var delta = Math.max(-1, Math.min(1, e.wheelDelta || -e.detail))
|
|
97
|
-
center.scrollLeft -= delta * 10
|
|
98
|
-
|
|
99
|
-
e.preventDefault()
|
|
100
|
-
}
|
|
101
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import '@operato/i18n/ox-i18n.js'
|
|
2
|
-
import '@material/web/checkbox/checkbox.js'
|
|
3
|
-
|
|
4
|
-
import { css, html, LitElement } from 'lit'
|
|
5
|
-
import { customElement, property, state } from 'lit/decorators.js'
|
|
6
|
-
|
|
7
|
-
import { i18next, localize } from '@operato/i18n'
|
|
8
|
-
import { clientSettingStore } from '@operato/shell'
|
|
9
|
-
import { updateViewpart } from '@operato/layout'
|
|
10
|
-
|
|
11
|
-
@customElement('mdibar-setting-let')
|
|
12
|
-
export class MDIBarSettingLet extends localize(i18next)(LitElement) {
|
|
13
|
-
static styles = [
|
|
14
|
-
css`
|
|
15
|
-
label {
|
|
16
|
-
display: flex;
|
|
17
|
-
gap: 10px;
|
|
18
|
-
align-items: center;
|
|
19
|
-
|
|
20
|
-
font: var(--label-font);
|
|
21
|
-
color: var(--md-sys-color-on-primary-container);
|
|
22
|
-
text-transform: var(--label-text-transform);
|
|
23
|
-
}
|
|
24
|
-
`
|
|
25
|
-
]
|
|
26
|
-
|
|
27
|
-
@property({ type: Boolean }) show: boolean = false
|
|
28
|
-
|
|
29
|
-
render() {
|
|
30
|
-
const checked = this.show === true
|
|
31
|
-
|
|
32
|
-
return html`
|
|
33
|
-
<setting-let>
|
|
34
|
-
<ox-i18n slot="title" msgid="title.mdibar setting"></ox-i18n>
|
|
35
|
-
|
|
36
|
-
<div slot="content">
|
|
37
|
-
<label>
|
|
38
|
-
<md-checkbox @change=${e => this.onChangeShowMDIBar(e)} ?checked=${checked}></md-checkbox>
|
|
39
|
-
${i18next.t('label.show')}
|
|
40
|
-
</label>
|
|
41
|
-
</div>
|
|
42
|
-
</setting-let>
|
|
43
|
-
`
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
async firstUpdated() {
|
|
47
|
-
this.show = ((await clientSettingStore.get('mdibar'))?.value || {}).show
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
async onChangeShowMDIBar(e) {
|
|
51
|
-
const show = e.currentTarget.checked
|
|
52
|
-
|
|
53
|
-
try {
|
|
54
|
-
await clientSettingStore.put({
|
|
55
|
-
key: 'mdibar',
|
|
56
|
-
value: {
|
|
57
|
-
show
|
|
58
|
-
}
|
|
59
|
-
})
|
|
60
|
-
} catch (e) {
|
|
61
|
-
console.error(e)
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
updateViewpart('appmdibar', {
|
|
65
|
-
show
|
|
66
|
-
})
|
|
67
|
-
}
|
|
68
|
-
}
|
package/server/index.ts
DELETED
|
File without changes
|