@things-factory/shell 5.0.0-zeta.7 → 5.0.0
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/elements/oops-progress.js +2 -1
- package/client/index.js +1 -5
- package/client/route.js +1 -1
- package/client/store.js +6 -14
- package/dist-server/schema.js +4 -4
- package/dist-server/schema.js.map +1 -1
- package/dist-server/server-dev.js +35 -27
- package/dist-server/server-dev.js.map +1 -1
- package/dist-server/server.js +36 -23
- package/dist-server/server.js.map +1 -1
- package/dist-server/service/common-types/scalar-date.js.map +1 -1
- package/dist-server/service/directive-transaction/transaction.js +5 -2
- package/dist-server/service/directive-transaction/transaction.js.map +1 -1
- package/dist-server/utils/get-query-builder-from-list-params.js.map +1 -1
- package/package.json +54 -53
- package/server/schema.ts +4 -4
- package/server/server-dev.ts +38 -29
- package/server/server.ts +39 -24
- package/server/service/common-types/scalar-date.ts +1 -1
- package/server/service/directive-transaction/transaction.ts +4 -3
- package/server/utils/get-query-builder-from-list-params.ts +1 -1
- package/things-factory.config.js +0 -4
- package/client/app/app-style.js +0 -69
- package/client/app/app.js +0 -225
- package/client/app/pages/page-404.js +0 -59
- package/client/module-importer.import +0 -0
- package/db.test.sqlite +0 -0
package/client/app/app.js
DELETED
@@ -1,225 +0,0 @@
|
|
1
|
-
import '@operato/layout'
|
2
|
-
|
3
|
-
import { LitElement, html } from 'lit'
|
4
|
-
import { UPDATE_ACTIVE_PAGE, UPDATE_CONTEXT_PATH, UPDATE_MODULES, navigateWithSilence, store } from '@operato/shell'
|
5
|
-
|
6
|
-
import { AppStyle } from './app-style'
|
7
|
-
import { ScrollbarStyles } from '@operato/styles'
|
8
|
-
import { connect } from 'pwa-helpers/connect-mixin.js'
|
9
|
-
import { getPathInfo } from '@operato/utils'
|
10
|
-
import { installRouter } from 'pwa-helpers/router.js'
|
11
|
-
import throttle from 'lodash-es/throttle'
|
12
|
-
|
13
|
-
class ThingsApp extends connect(store)(LitElement) {
|
14
|
-
static get properties() {
|
15
|
-
return {
|
16
|
-
_contextPath: String,
|
17
|
-
_page: String,
|
18
|
-
_pages: Object,
|
19
|
-
_resourceId: String,
|
20
|
-
_params: Object,
|
21
|
-
_callbacks: Array,
|
22
|
-
_activePage: Object,
|
23
|
-
_context: Object,
|
24
|
-
_modules: Array
|
25
|
-
}
|
26
|
-
}
|
27
|
-
|
28
|
-
static get styles() {
|
29
|
-
return [ScrollbarStyles, AppStyle]
|
30
|
-
}
|
31
|
-
|
32
|
-
render() {
|
33
|
-
var params = this._params || {}
|
34
|
-
var fullbleed = (this._context && this._context.fullbleed) || (params.fullbleed && params.fullbleed == 'Y')
|
35
|
-
var widebleed = (this._context && this._context.widebleed) || (params.widebleed && params.widebleed == 'Y')
|
36
|
-
|
37
|
-
return html`
|
38
|
-
<ox-header-bar ?fullbleed=${fullbleed}></ox-header-bar>
|
39
|
-
|
40
|
-
<ox-nav-bar ?fullbleed=${fullbleed || widebleed}></ox-nav-bar>
|
41
|
-
|
42
|
-
<main></main>
|
43
|
-
|
44
|
-
<ox-aside-bar ?fullbleed=${fullbleed || widebleed}></ox-aside-bar>
|
45
|
-
|
46
|
-
<ox-footer-bar ?fullbleed=${fullbleed}></ox-footer-bar>
|
47
|
-
|
48
|
-
<ox-snack-bar></ox-snack-bar>
|
49
|
-
`
|
50
|
-
}
|
51
|
-
|
52
|
-
constructor() {
|
53
|
-
super()
|
54
|
-
}
|
55
|
-
|
56
|
-
connectedCallback() {
|
57
|
-
super.connectedCallback()
|
58
|
-
|
59
|
-
window.addEventListener('resize', () => this.resized())
|
60
|
-
|
61
|
-
/* 모듈 임포트를 동적으로 처리한다. */
|
62
|
-
import(
|
63
|
-
/* webpackPrefetch: true */
|
64
|
-
/* webpackPreload: true */
|
65
|
-
/* webpackChunkName: "modules" */
|
66
|
-
'../module-importer.import'
|
67
|
-
).then(module => {
|
68
|
-
var modules = module.modules
|
69
|
-
|
70
|
-
/* lifecycle - bootstrapping */
|
71
|
-
this.dispatchEvent(new Event('lifecycle-bootstrap-begin'))
|
72
|
-
modules.forEach((m, idx) => {
|
73
|
-
try {
|
74
|
-
m.bootstrap && m.bootstrap()
|
75
|
-
// console.info(`[${idx} BOOTSTRAPED - ${m.name}]`)
|
76
|
-
} catch (e) {
|
77
|
-
console.error(`[${idx} BOOTSTRAP ERROR -${m.name}]`, e)
|
78
|
-
}
|
79
|
-
})
|
80
|
-
this.dispatchEvent(new Event('lifecycle-bootstrap-finish'))
|
81
|
-
|
82
|
-
/* shouldUpdate를 활성화한다. */
|
83
|
-
this._moduleInitialized = true
|
84
|
-
|
85
|
-
/* modules를 store에 dispatch 함으로써, update를 invoke 시킨다. */
|
86
|
-
store.dispatch({
|
87
|
-
type: UPDATE_MODULES,
|
88
|
-
modules
|
89
|
-
})
|
90
|
-
|
91
|
-
installRouter((location, e) => {
|
92
|
-
var { contextPath } = getPathInfo(location.pathname)
|
93
|
-
|
94
|
-
if (this._contextPath !== contextPath) {
|
95
|
-
store.dispatch({
|
96
|
-
type: UPDATE_CONTEXT_PATH,
|
97
|
-
contextPath
|
98
|
-
})
|
99
|
-
}
|
100
|
-
|
101
|
-
store.dispatch(navigateWithSilence(location))
|
102
|
-
this._callbacks &&
|
103
|
-
this._callbacks.forEach(callback => {
|
104
|
-
try {
|
105
|
-
callback.call(this, location, e)
|
106
|
-
} catch (ex) {
|
107
|
-
console.error(ex)
|
108
|
-
}
|
109
|
-
})
|
110
|
-
})
|
111
|
-
})
|
112
|
-
|
113
|
-
this.setBase()
|
114
|
-
}
|
115
|
-
|
116
|
-
resized() {
|
117
|
-
if (!this._throttledResize) {
|
118
|
-
this._throttledResize = throttle(() => {
|
119
|
-
const aside = this.renderRoot.querySelector('ox-aside-bar').clientWidth
|
120
|
-
const nav = this.renderRoot.querySelector('ox-nav-bar').clientWidth
|
121
|
-
|
122
|
-
this.style.setProperty(
|
123
|
-
'--app-grid-template-columns',
|
124
|
-
`auto minmax(calc(100vw - ${aside}px - ${nav}px), 1fr) auto`
|
125
|
-
)
|
126
|
-
}, 100)
|
127
|
-
}
|
128
|
-
|
129
|
-
this._throttledResize()
|
130
|
-
}
|
131
|
-
|
132
|
-
routeToPage() {
|
133
|
-
let activePages = this.shadowRoot.querySelectorAll('main > .page[active]')
|
134
|
-
activePages.forEach(page => {
|
135
|
-
page.removeAttribute('active')
|
136
|
-
})
|
137
|
-
|
138
|
-
this._activePage = this.shadowRoot.querySelector(`main > .page[data-page=${this._page}]`)
|
139
|
-
|
140
|
-
if (!this._activePage) {
|
141
|
-
/* 해당 route에 연결된 page가 없는 경우에 main 섹션에 해당 element를 추가해준다. */
|
142
|
-
var tagname = this._pages[this._page]
|
143
|
-
if (tagname) {
|
144
|
-
var main = this.shadowRoot.querySelector('main')
|
145
|
-
|
146
|
-
var el = document.createElement(tagname)
|
147
|
-
el.setAttribute('class', 'page')
|
148
|
-
el.setAttribute('data-page', this._page)
|
149
|
-
|
150
|
-
main.appendChild(el)
|
151
|
-
|
152
|
-
this._activePage = el
|
153
|
-
}
|
154
|
-
}
|
155
|
-
|
156
|
-
if (this._activePage) {
|
157
|
-
this._activePage.setAttribute('active', true)
|
158
|
-
this._activePage.setAttribute('context-path', this._contextPath)
|
159
|
-
this._activePage.lifecycle = {
|
160
|
-
...(this._activePage.lifecycle || {}),
|
161
|
-
active: true,
|
162
|
-
params: this._params,
|
163
|
-
resourceId: this._resourceId,
|
164
|
-
page: this._page
|
165
|
-
}
|
166
|
-
}
|
167
|
-
|
168
|
-
store.dispatch({
|
169
|
-
type: UPDATE_ACTIVE_PAGE,
|
170
|
-
activePage: this._activePage
|
171
|
-
})
|
172
|
-
}
|
173
|
-
|
174
|
-
async updated(changedProps) {
|
175
|
-
if (changedProps.has('_modules')) {
|
176
|
-
this._readyPageList()
|
177
|
-
}
|
178
|
-
|
179
|
-
if (changedProps.has('_page') || changedProps.has('_resourceId') || changedProps.has('_params')) {
|
180
|
-
this.routeToPage()
|
181
|
-
}
|
182
|
-
|
183
|
-
if (changedProps.has('_contextPath')) {
|
184
|
-
this.setBase()
|
185
|
-
}
|
186
|
-
|
187
|
-
this.resized()
|
188
|
-
}
|
189
|
-
|
190
|
-
shouldUpdate() {
|
191
|
-
return this._moduleInitialized
|
192
|
-
}
|
193
|
-
|
194
|
-
stateChanged(state) {
|
195
|
-
this._page = state.route.page
|
196
|
-
this._params = state.route.params
|
197
|
-
this._resourceId = state.route.resourceId
|
198
|
-
this._callbacks = state.route.callbacks
|
199
|
-
this._context = state.route.context
|
200
|
-
this._modules = state.app.modules
|
201
|
-
this._contextPath = state.app.contextPath
|
202
|
-
}
|
203
|
-
|
204
|
-
_readyPageList() {
|
205
|
-
var reversedModules = [...this._modules].reverse()
|
206
|
-
this._pages = {}
|
207
|
-
|
208
|
-
/* 모듈 참조 순서 역순으로 page를 추가한다. (for overidable) */
|
209
|
-
reversedModules.forEach(m => {
|
210
|
-
m.routes &&
|
211
|
-
m.routes.forEach(route => {
|
212
|
-
if (!this._pages[route.page]) {
|
213
|
-
this._pages[route.page] = route.tagname
|
214
|
-
}
|
215
|
-
})
|
216
|
-
})
|
217
|
-
}
|
218
|
-
|
219
|
-
setBase() {
|
220
|
-
var base = document.querySelector('base')
|
221
|
-
base.setAttribute('href', this._contextPath ? `${this._contextPath}/` : '/')
|
222
|
-
}
|
223
|
-
}
|
224
|
-
|
225
|
-
window.customElements.define('things-app', ThingsApp)
|
@@ -1,59 +0,0 @@
|
|
1
|
-
import { css, html } from 'lit'
|
2
|
-
|
3
|
-
import { PageView } from '@operato/shell'
|
4
|
-
|
5
|
-
class Page404 extends PageView {
|
6
|
-
static get styles() {
|
7
|
-
return css`
|
8
|
-
:host {
|
9
|
-
display: block;
|
10
|
-
box-sizing: border-box;
|
11
|
-
|
12
|
-
background-color: var(--main-section-background-color);
|
13
|
-
--padding-wide: 15%;
|
14
|
-
}
|
15
|
-
section {
|
16
|
-
padding: var(--padding-wide) 0 0 0;
|
17
|
-
text-align: center;
|
18
|
-
color: var(--secondary-color);
|
19
|
-
}
|
20
|
-
mwc-icon {
|
21
|
-
--mdc-icon-size: 120px;
|
22
|
-
color: var(--status-danger-color);
|
23
|
-
text-shadow: 2px 2px 2px rgba(0, 0, 0, 0.1);
|
24
|
-
}
|
25
|
-
h2 {
|
26
|
-
margin: 0 auto;
|
27
|
-
font-size: 2.5em;
|
28
|
-
text-transform: capitalize;
|
29
|
-
}
|
30
|
-
@media only screen and (max-width: 460px) {
|
31
|
-
mwc-icon {
|
32
|
-
padding-top: 25%;
|
33
|
-
--mdc-icon-size: 90px;
|
34
|
-
}
|
35
|
-
h2 {
|
36
|
-
font-size: 2em;
|
37
|
-
}
|
38
|
-
}
|
39
|
-
`
|
40
|
-
}
|
41
|
-
|
42
|
-
get context() {
|
43
|
-
return {
|
44
|
-
title: 'Page Not Found'
|
45
|
-
}
|
46
|
-
}
|
47
|
-
|
48
|
-
render() {
|
49
|
-
return html`
|
50
|
-
<section>
|
51
|
-
<mwc-icon>error_outline</mwc-icon>
|
52
|
-
<h2>page not found!</h2>
|
53
|
-
The page you requested cannot be found.
|
54
|
-
</section>
|
55
|
-
`
|
56
|
-
}
|
57
|
-
}
|
58
|
-
|
59
|
-
customElements.define('page-404', Page404)
|
File without changes
|
package/db.test.sqlite
DELETED
Binary file
|