@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,63 @@
|
|
|
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
|
+
import { html } from 'lit-html';
|
|
7
|
+
import { store, clientSettingStore } from '@operato/shell';
|
|
8
|
+
import { appendViewpart, VIEWPART_POSITION, VIEWPART_LEVEL } from '@operato/layout';
|
|
9
|
+
import { isMobileDevice } from '@operato/utils';
|
|
10
|
+
import { ADD_SETTING } from '@things-factory/setting-base';
|
|
11
|
+
export async function setupAppToolPart({ toolbar = true, busybar = true, mdibar = true, pageToolbar = false }) {
|
|
12
|
+
var _a;
|
|
13
|
+
if (toolbar) {
|
|
14
|
+
appendViewpart({
|
|
15
|
+
name: 'apptoolbar',
|
|
16
|
+
viewpart: {
|
|
17
|
+
show: true,
|
|
18
|
+
template: html ` <app-toolbar></app-toolbar> `
|
|
19
|
+
},
|
|
20
|
+
position: VIEWPART_POSITION.HEADERBAR
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
if (busybar) {
|
|
24
|
+
appendViewpart({
|
|
25
|
+
name: 'appbusybar',
|
|
26
|
+
viewpart: {
|
|
27
|
+
show: true,
|
|
28
|
+
template: html ` <app-busybar></app-busybar> `
|
|
29
|
+
},
|
|
30
|
+
position: VIEWPART_POSITION.HEADERBAR
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
if (mdibar && !isMobileDevice()) {
|
|
34
|
+
const show = (((_a = (await clientSettingStore.get('mdibar'))) === null || _a === void 0 ? void 0 : _a.value) || {}).show;
|
|
35
|
+
appendViewpart({
|
|
36
|
+
name: 'appmdibar',
|
|
37
|
+
viewpart: {
|
|
38
|
+
show,
|
|
39
|
+
level: VIEWPART_LEVEL.TOPMOST,
|
|
40
|
+
template: html ` <page-mdibar></page-mdibar> `
|
|
41
|
+
},
|
|
42
|
+
position: VIEWPART_POSITION.PAGE_HEADERBAR
|
|
43
|
+
});
|
|
44
|
+
store.dispatch({
|
|
45
|
+
type: ADD_SETTING,
|
|
46
|
+
setting: {
|
|
47
|
+
seq: 21,
|
|
48
|
+
template: html ` <mdibar-setting-let></mdibar-setting-let> `
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
if (pageToolbar) {
|
|
53
|
+
appendViewpart({
|
|
54
|
+
name: 'page-toolbar',
|
|
55
|
+
viewpart: {
|
|
56
|
+
show: true,
|
|
57
|
+
template: html ` <page-toolbar> </page-toolbar> `
|
|
58
|
+
},
|
|
59
|
+
position: VIEWPART_POSITION.PAGE_HEADERBAR
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
//# 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,sBAAsB,CAAA;AAC7B,OAAO,uBAAuB,CAAA;AAC9B,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,EAAiB,iBAAiB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAClG,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAE/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,EACb,WAAW,GAAG,KAAK,EAMpB;;IACC,IAAI,OAAO,EAAE;QACX,cAAc,CAAC;YACb,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import './layout/page-mdibar'\nimport './layout/page-toolbar'\nimport './mdibar-setting-let'\n\nimport { html } from 'lit-html'\n\nimport { store, clientSettingStore } from '@operato/shell'\nimport { appendViewpart, TOOL_POSITION, VIEWPART_POSITION, VIEWPART_LEVEL } from '@operato/layout'\nimport { isMobileDevice } from '@operato/utils'\nimport { APPEND_PAGE_TOOL } from '@things-factory/apptool-base'\nimport { ADD_SETTING } from '@things-factory/setting-base'\n\nexport async function setupAppToolPart({\n toolbar = true,\n busybar = true,\n mdibar = true,\n pageToolbar = false\n}: {\n toolbar?: boolean\n busybar?: boolean\n mdibar?: boolean\n pageToolbar?: 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 level: VIEWPART_LEVEL.TOPMOST,\n template: html` <page-mdibar></page-mdibar> `\n },\n position: VIEWPART_POSITION.PAGE_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 if (pageToolbar) {\n appendViewpart({\n name: 'page-toolbar',\n viewpart: {\n show: true,\n template: html` <page-toolbar> </page-toolbar> `\n },\n position: VIEWPART_POSITION.PAGE_HEADERBAR\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=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AK,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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@material/mwc-icon';
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import '@material/mwc-icon';
|
|
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 { navigate, store, PageView } from '@operato/shell';
|
|
7
|
+
let AppMDIBar = class AppMDIBar extends connect(store)(LitElement) {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.pages = [];
|
|
11
|
+
this.title = '';
|
|
12
|
+
}
|
|
13
|
+
render() {
|
|
14
|
+
const pages = this.pages || [];
|
|
15
|
+
return html `
|
|
16
|
+
<div home><mwc-icon>home</mwc-icon></div>
|
|
17
|
+
|
|
18
|
+
${pages.map((page, idx) => {
|
|
19
|
+
var _a;
|
|
20
|
+
const context = page.context;
|
|
21
|
+
const title = (context === null || context === void 0 ? void 0 : context.title) || ((_a = context === null || context === void 0 ? void 0 : context.search) === null || _a === void 0 ? void 0 : _a.placeholder) || '';
|
|
22
|
+
return html `
|
|
23
|
+
<div @click=${() => this.moveTo(page)} ?active=${this.activePage === page}>
|
|
24
|
+
${title}
|
|
25
|
+
<mwc-icon
|
|
26
|
+
@click=${(e) => {
|
|
27
|
+
e.stopPropagation();
|
|
28
|
+
this.closePage(page, idx);
|
|
29
|
+
}}
|
|
30
|
+
>close</mwc-icon
|
|
31
|
+
>
|
|
32
|
+
</div>
|
|
33
|
+
`;
|
|
34
|
+
})}
|
|
35
|
+
`;
|
|
36
|
+
}
|
|
37
|
+
updated(changed) {
|
|
38
|
+
if (changed.has('activePage')) {
|
|
39
|
+
const page = this.activePage;
|
|
40
|
+
if (!this.pages) {
|
|
41
|
+
this.pages = [];
|
|
42
|
+
}
|
|
43
|
+
if (!this.pages.includes(page)) {
|
|
44
|
+
this.pages = [...this.pages, page];
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
stateChanged(state) {
|
|
49
|
+
var _a;
|
|
50
|
+
const { context, activePage } = state.route || {};
|
|
51
|
+
this.activePage = activePage;
|
|
52
|
+
/* refresh를 일으키기위한 property 변경을 위한 코드임. */
|
|
53
|
+
this.title = context.title || ((_a = context.search) === null || _a === void 0 ? void 0 : _a.placeholder);
|
|
54
|
+
}
|
|
55
|
+
getHomeRoute() {
|
|
56
|
+
var base = document.querySelector('base');
|
|
57
|
+
return (base === null || base === void 0 ? void 0 : base.getAttribute('href')) || '/';
|
|
58
|
+
}
|
|
59
|
+
moveTo(page) {
|
|
60
|
+
navigate(page.getAttribute('data-page'));
|
|
61
|
+
}
|
|
62
|
+
closePage(page, idx) {
|
|
63
|
+
var _a;
|
|
64
|
+
this.pages = [...this.pages.slice(0, idx), ...this.pages.slice(idx + 1)];
|
|
65
|
+
(_a = page.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(page);
|
|
66
|
+
page.pageDispose();
|
|
67
|
+
if (this.activePage === page) {
|
|
68
|
+
const next = this.pages.length > 0 ? Math.max(0, idx - 1) : -1;
|
|
69
|
+
navigate(next != -1 ? this.pages[next].getAttribute('data-page') : this.getHomeRoute());
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
AppMDIBar.styles = [
|
|
74
|
+
css `
|
|
75
|
+
:host {
|
|
76
|
+
display: flex;
|
|
77
|
+
background-color: var(--main-section-background-color);
|
|
78
|
+
color: var(--mdibar-color, rgba(0, 0, 0, 0.7));
|
|
79
|
+
font-size: var(--fontsize-small);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
div {
|
|
83
|
+
display: inline-block;
|
|
84
|
+
position: relative;
|
|
85
|
+
max-width: var(--mdibar-max-width, 120px);
|
|
86
|
+
padding: var(--mdibar-padding, 3px 22px 0 5px);
|
|
87
|
+
border-right: var(--border-dark-color);
|
|
88
|
+
border-bottom: var(--border-dark-color);
|
|
89
|
+
white-space: nowrap;
|
|
90
|
+
overflow: hidden;
|
|
91
|
+
text-overflow: ellipsis;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
mwc-icon {
|
|
95
|
+
position: absolute;
|
|
96
|
+
right: 2px;
|
|
97
|
+
top: 3px;
|
|
98
|
+
margin-left: var(--margin-narrow);
|
|
99
|
+
font-size: var(--mdibar-icon-size, 18px);
|
|
100
|
+
opacity: 0.5;
|
|
101
|
+
}
|
|
102
|
+
mwc-icon:hover {
|
|
103
|
+
opacity: 0.8;
|
|
104
|
+
color: var(--mdibar-hover-color, #cc3300);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
[active] {
|
|
108
|
+
background-color: var(--mdibar-background-color, #fff);
|
|
109
|
+
border-bottom: 1px solid var(--mdibar-background-color, #fff);
|
|
110
|
+
color: var(--primary-text-color);
|
|
111
|
+
font-weight: bold;
|
|
112
|
+
}
|
|
113
|
+
[home] {
|
|
114
|
+
padding: var(--mdibar-padding-home, 3px 5px 0 23px);
|
|
115
|
+
}
|
|
116
|
+
[home] mwc-icon {
|
|
117
|
+
left: 0;
|
|
118
|
+
}
|
|
119
|
+
`
|
|
120
|
+
];
|
|
121
|
+
__decorate([
|
|
122
|
+
state(),
|
|
123
|
+
__metadata("design:type", Array)
|
|
124
|
+
], AppMDIBar.prototype, "pages", void 0);
|
|
125
|
+
__decorate([
|
|
126
|
+
state(),
|
|
127
|
+
__metadata("design:type", PageView)
|
|
128
|
+
], AppMDIBar.prototype, "activePage", void 0);
|
|
129
|
+
__decorate([
|
|
130
|
+
state(),
|
|
131
|
+
__metadata("design:type", String)
|
|
132
|
+
], AppMDIBar.prototype, "title", void 0);
|
|
133
|
+
AppMDIBar = __decorate([
|
|
134
|
+
customElement('app-mdibar')
|
|
135
|
+
], AppMDIBar);
|
|
136
|
+
//# sourceMappingURL=app-mdibar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-mdibar.js","sourceRoot":"","sources":["../../client/layout/app-mdibar.ts"],"names":[],"mappings":";AAAA,OAAO,oBAAoB,CAAA;AAE3B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA;AAEtD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAG1D,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,OAAO,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC;IAAlD;;QAkDW,UAAK,GAAe,EAAE,CAAA;QAEtB,UAAK,GAAW,EAAE,CAAA;IAsE7B,CAAC;IApEC,MAAM;QACJ,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE,CAAA;QAE9B,O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,CAAA;AAED;IAAC,KAAK,EAAE;;wCAAuB;AAC/B;IAAC,KAAK,EAAE;8BAAc,QAAQ;6CAAA;AAC9B;IAAC,KAAK,EAAE;;wCAAmB;AApDvB,SAAS;IADd,aAAa,CAAC,YAAY,CAAC;GACtB,SAAS,CA0Hd","sourcesContent":["import '@material/mwc-icon'\n\nimport { css, html, LitElement } from 'lit'\nimport { customElement, state } from 'lit/decorators.js'\nimport { connect } from 'pwa-helpers/connect-mixin.js'\n\nimport { navigate, store, PageView } from '@operato/shell'\n\n@customElement('app-mdibar')\nclass AppMDIBar extends connect(store)(LitElement) {\n static styles = [\n css`\n :host {\n display: flex;\n background-color: var(--main-section-background-color);\n color: var(--mdibar-color, rgba(0, 0, 0, 0.7));\n font-size: var(--fontsize-small);\n }\n\n div {\n display: inline-block;\n position: relative;\n max-width: var(--mdibar-max-width, 120px);\n padding: var(--mdibar-padding, 3px 22px 0 5px);\n border-right: var(--border-dark-color);\n border-bottom: var(--border-dark-color);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n mwc-icon {\n position: absolute;\n right: 2px;\n top: 3px;\n margin-left: var(--margin-narrow);\n font-size: var(--mdibar-icon-size, 18px);\n opacity: 0.5;\n }\n mwc-icon:hover {\n opacity: 0.8;\n color: var(--mdibar-hover-color, #cc3300);\n }\n\n [active] {\n background-color: var(--mdibar-background-color, #fff);\n border-bottom: 1px solid var(--mdibar-background-color, #fff);\n color: var(--primary-text-color);\n font-weight: bold;\n }\n [home] {\n padding: var(--mdibar-padding-home, 3px 5px 0 23px);\n }\n [home] mwc-icon {\n left: 0;\n }\n `\n ]\n\n @state() pages: PageView[] = []\n @state() activePage!: PageView\n @state() title: string = ''\n\n render() {\n const pages = this.pages || []\n\n return html`\n <div home><mwc-icon>home</mwc-icon></div>\n\n ${pages.map((page, idx) => {\n const context = page.context as any\n const title = context?.title || context?.search?.placeholder || ''\n\n return html`\n <div @click=${() => this.moveTo(page)} ?active=${this.activePage === page}>\n ${title}\n <mwc-icon\n @click=${(e: MouseEvent) => {\n e.stopPropagation()\n this.closePage(page, idx)\n }}\n >close</mwc-icon\n >\n </div>\n `\n })}\n `\n }\n\n updated(changed) {\n if (changed.has('activePage')) {\n const page = this.activePage\n\n if (!this.pages) {\n this.pages = []\n }\n\n if (!this.pages.includes(page)) {\n this.pages = [...this.pages, page]\n }\n }\n }\n\n stateChanged(state) {\n const { context, activePage } = state.route || {}\n this.activePage = activePage\n\n /* refresh를 일으키기위한 property 변경을 위한 코드임. */\n this.title = context.title || context.search?.placeholder\n }\n\n getHomeRoute() {\n var base = document.querySelector('base')\n return base?.getAttribute('href') || '/'\n }\n\n moveTo(page: PageView) {\n navigate(page.getAttribute('data-page')!)\n }\n\n closePage(page: PageView, idx: number) {\n this.pages = [...this.pages.slice(0, idx), ...this.pages.slice(idx + 1)]\n\n page.parentNode?.removeChild(page)\n page.pageDispose()\n\n if (this.activePage === page) {\n const next = this.pages.length > 0 ? Math.max(0, idx - 1) : -1\n navigate(next != -1 ? this.pages[next].getAttribute('data-page')! : this.getHomeRoute())\n }\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@material/mwc-icon';
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import '@material/mwc-icon';
|
|
3
|
+
import { css, html, LitElement } from 'lit';
|
|
4
|
+
import { customElement, query, state } from 'lit/decorators.js';
|
|
5
|
+
import { connect } from 'pwa-helpers/connect-mixin.js';
|
|
6
|
+
import { TOOL_POSITION } from '@operato/layout';
|
|
7
|
+
import { navigate, store } from '@operato/shell';
|
|
8
|
+
let AppToolbar = class AppToolbar extends connect(store)(LitElement) {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this._tools = [];
|
|
12
|
+
}
|
|
13
|
+
render() {
|
|
14
|
+
var tools = this._tools || [];
|
|
15
|
+
var frontEndTools = tools.filter(tool => tool.position == TOOL_POSITION.FRONT_END);
|
|
16
|
+
var frontTools = tools.filter(tool => tool.position == TOOL_POSITION.FRONT);
|
|
17
|
+
var centerTools = tools.filter(tool => tool.position == TOOL_POSITION.CENTER);
|
|
18
|
+
var rearTools = tools.filter(tool => tool.position == TOOL_POSITION.REAR);
|
|
19
|
+
var rearEndTools = tools.filter(tool => tool.position == TOOL_POSITION.REAR_END);
|
|
20
|
+
/* 현재 OVERLAY가 있으면, 뒤로가기 버튼이 보이고, 아니면, HOME 버튼이 보인다. */
|
|
21
|
+
var state = history.state;
|
|
22
|
+
var overlay = (state || {}).overlay;
|
|
23
|
+
return html `
|
|
24
|
+
${overlay
|
|
25
|
+
? html ` <mwc-icon @click=${e => history.back()}>arrow_back</mwc-icon> `
|
|
26
|
+
: frontEndTools.length == 0
|
|
27
|
+
? html ` <mwc-icon @click=${e => this.navigateToHome()}>home</mwc-icon> `
|
|
28
|
+
: frontEndTools.map(tool => html ` ${tool.template} `)}
|
|
29
|
+
${frontTools.map(tool => html ` ${tool.template} `)}
|
|
30
|
+
|
|
31
|
+
<div center @mousewheel=${this.onWheelEvent}>${centerTools.map(tool => html ` ${tool.template} `)}</div>
|
|
32
|
+
|
|
33
|
+
${rearTools.map(tool => html ` ${tool.template} `)} ${rearEndTools.map(tool => html ` ${tool.template} `)}
|
|
34
|
+
`;
|
|
35
|
+
}
|
|
36
|
+
stateChanged(state) {
|
|
37
|
+
/* page의 변화를 감지하기 위해서 route의 변화를 체크한다. */
|
|
38
|
+
this._route = state.route;
|
|
39
|
+
this._tools = state.apptool.tools;
|
|
40
|
+
}
|
|
41
|
+
navigateToHome() {
|
|
42
|
+
var base = document.querySelector('base');
|
|
43
|
+
if (base) {
|
|
44
|
+
navigate(base.getAttribute('href') || '');
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
navigate('/');
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
onWheelEvent(e) {
|
|
51
|
+
const center = e.currentTarget;
|
|
52
|
+
var delta = Math.max(-1, Math.min(1, e.wheelDelta || -e.detail));
|
|
53
|
+
center.scrollLeft -= delta * 10;
|
|
54
|
+
e.preventDefault();
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
AppToolbar.styles = [
|
|
58
|
+
css `
|
|
59
|
+
:host {
|
|
60
|
+
display: flex;
|
|
61
|
+
height: var(--header-bar-height, 45px);
|
|
62
|
+
color: var(--header-bar-color);
|
|
63
|
+
background-color: var(--header-bar-background-color, white);
|
|
64
|
+
justify-content: space-between;
|
|
65
|
+
align-items: center;
|
|
66
|
+
padding: 0 5px;
|
|
67
|
+
|
|
68
|
+
text-transform: capitalize;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
:host > * {
|
|
72
|
+
margin: var(--header-bar-item-padding);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
[center] {
|
|
76
|
+
flex: 1;
|
|
77
|
+
flex-wrap: nowrap;
|
|
78
|
+
display: flex;
|
|
79
|
+
align-items: center;
|
|
80
|
+
overflow: hidden;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
[center] > * {
|
|
84
|
+
margin: auto;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
:host(.vline) {
|
|
88
|
+
display: block;
|
|
89
|
+
flex: none;
|
|
90
|
+
border-left: 1px solid rgba(255, 255, 255, 0.07);
|
|
91
|
+
border-right: 1px solid rgba(0, 0, 0, 0.1);
|
|
92
|
+
width: 0px;
|
|
93
|
+
height: 18px;
|
|
94
|
+
margin: 0 4px;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
:host(label) {
|
|
98
|
+
margin-right: 5px;
|
|
99
|
+
color: #fff;
|
|
100
|
+
font-size: 20px;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
span.space {
|
|
104
|
+
width: 10px;
|
|
105
|
+
}
|
|
106
|
+
`
|
|
107
|
+
];
|
|
108
|
+
__decorate([
|
|
109
|
+
state(),
|
|
110
|
+
__metadata("design:type", Array)
|
|
111
|
+
], AppToolbar.prototype, "_tools", void 0);
|
|
112
|
+
__decorate([
|
|
113
|
+
state(),
|
|
114
|
+
__metadata("design:type", Object)
|
|
115
|
+
], AppToolbar.prototype, "_route", void 0);
|
|
116
|
+
__decorate([
|
|
117
|
+
query('[center]'),
|
|
118
|
+
__metadata("design:type", HTMLDivElement)
|
|
119
|
+
], AppToolbar.prototype, "center", void 0);
|
|
120
|
+
AppToolbar = __decorate([
|
|
121
|
+
customElement('app-toolbar')
|
|
122
|
+
], AppToolbar);
|
|
123
|
+
//# sourceMappingURL=app-toolbar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-toolbar.js","sourceRoot":"","sources":["../../client/layout/app-toolbar.ts"],"names":[],"mappings":";AAAA,OAAO,oBAAoB,CAAA;AAE3B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA;AAEtD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAGhD,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,OAAO,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC;IAAnD;;QAqDW,WAAM,GAAqD,EAAE,CAAA;IAuDxE,CAAC;IAlDC,MAAM;QACJ,IAAI,KAAK,GAAG,IAAI,CAAC,MAAM,IAAK,EAAuD,CAAA;QAEnF,IAAI,aAAa,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,IAAI,aAAa,CAAC,SAAS,CAAC,CAAA;QAClF,IAAI,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC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aAAa,CAAC;GACvB,UAAU,CA4Gf","sourcesContent":["import '@material/mwc-icon'\n\nimport { css, html, LitElement, TemplateResult } from 'lit'\nimport { customElement, query, state } from 'lit/decorators.js'\nimport { connect } from 'pwa-helpers/connect-mixin.js'\n\nimport { TOOL_POSITION } from '@operato/layout'\nimport { navigate, store } from '@operato/shell'\n\n@customElement('app-toolbar')\nclass AppToolbar extends connect(store)(LitElement) {\n static styles = [\n css`\n :host {\n display: flex;\n height: var(--header-bar-height, 45px);\n color: var(--header-bar-color);\n background-color: var(--header-bar-background-color, white);\n justify-content: space-between;\n align-items: center;\n padding: 0 5px;\n\n text-transform: capitalize;\n }\n\n :host > * {\n margin: var(--header-bar-item-padding);\n }\n\n [center] {\n flex: 1;\n flex-wrap: nowrap;\n display: flex;\n align-items: center;\n overflow: hidden;\n }\n\n [center] > * {\n margin: auto;\n }\n\n :host(.vline) {\n display: block;\n flex: none;\n border-left: 1px solid rgba(255, 255, 255, 0.07);\n border-right: 1px solid rgba(0, 0, 0, 0.1);\n width: 0px;\n height: 18px;\n margin: 0 4px;\n }\n\n :host(label) {\n margin-right: 5px;\n color: #fff;\n font-size: 20px;\n }\n\n span.space {\n width: 10px;\n }\n `\n ]\n\n @state() _tools: { position: string; template: TemplateResult }[] = []\n @state() _route: any\n\n @query('[center]') center!: HTMLDivElement\n\n render() {\n var tools = this._tools || ([] as { position: string; template: TemplateResult }[])\n\n var frontEndTools = tools.filter(tool => tool.position == TOOL_POSITION.FRONT_END)\n var frontTools = tools.filter(tool => tool.position == TOOL_POSITION.FRONT)\n var centerTools = tools.filter(tool => tool.position == TOOL_POSITION.CENTER)\n var rearTools = tools.filter(tool => tool.position == TOOL_POSITION.REAR)\n var rearEndTools = tools.filter(tool => tool.position == TOOL_POSITION.REAR_END)\n\n /* 현재 OVERLAY가 있으면, 뒤로가기 버튼이 보이고, 아니면, HOME 버튼이 보인다. */\n var state = history.state\n var overlay = (state || {}).overlay\n\n return html`\n ${overlay\n ? html` <mwc-icon @click=${e => history.back()}>arrow_back</mwc-icon> `\n : frontEndTools.length == 0\n ? html` <mwc-icon @click=${e => this.navigateToHome()}>home</mwc-icon> `\n : frontEndTools.map(tool => html` ${tool.template} `)}\n ${frontTools.map(tool => html` ${tool.template} `)}\n\n <div center @mousewheel=${this.onWheelEvent}>${centerTools.map(tool => html` ${tool.template} `)}</div>\n\n ${rearTools.map(tool => html` ${tool.template} `)} ${rearEndTools.map(tool => html` ${tool.template} `)}\n `\n }\n\n stateChanged(state) {\n /* page의 변화를 감지하기 위해서 route의 변화를 체크한다. */\n this._route = state.route\n\n this._tools = state.apptool.tools\n }\n\n navigateToHome() {\n var base = document.querySelector('base')\n if (base) {\n navigate(base.getAttribute('href') || '')\n } else {\n navigate('/')\n }\n }\n\n onWheelEvent(e) {\n const center = e.currentTarget\n var delta = Math.max(-1, Math.min(1, e.wheelDelta || -e.detail))\n center.scrollLeft -= delta * 10\n\n e.preventDefault()\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@material/mwc-icon';
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import '@material/mwc-icon';
|
|
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 { navigate, store, PageView } from '@operato/shell';
|
|
7
|
+
let PageMDIBar = class PageMDIBar extends connect(store)(LitElement) {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.pages = [];
|
|
11
|
+
this.title = '';
|
|
12
|
+
}
|
|
13
|
+
render() {
|
|
14
|
+
const pages = this.pages || [];
|
|
15
|
+
return html `
|
|
16
|
+
<div home><mwc-icon>home</mwc-icon></div>
|
|
17
|
+
|
|
18
|
+
${pages.map((page, idx) => {
|
|
19
|
+
var _a;
|
|
20
|
+
const context = page.context;
|
|
21
|
+
const title = (context === null || context === void 0 ? void 0 : context.title) || ((_a = context === null || context === void 0 ? void 0 : context.search) === null || _a === void 0 ? void 0 : _a.placeholder) || '';
|
|
22
|
+
return html `
|
|
23
|
+
<div @click=${() => this.moveTo(page)} ?active=${this.activePage === page}>
|
|
24
|
+
${title}
|
|
25
|
+
<mwc-icon
|
|
26
|
+
@click=${(e) => {
|
|
27
|
+
e.stopPropagation();
|
|
28
|
+
this.closePage(page, idx);
|
|
29
|
+
}}
|
|
30
|
+
>close</mwc-icon
|
|
31
|
+
>
|
|
32
|
+
</div>
|
|
33
|
+
`;
|
|
34
|
+
})}
|
|
35
|
+
`;
|
|
36
|
+
}
|
|
37
|
+
updated(changed) {
|
|
38
|
+
if (changed.has('activePage')) {
|
|
39
|
+
const page = this.activePage;
|
|
40
|
+
if (!this.pages) {
|
|
41
|
+
this.pages = [];
|
|
42
|
+
}
|
|
43
|
+
if (!this.pages.includes(page)) {
|
|
44
|
+
this.pages = [...this.pages, page];
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
stateChanged(state) {
|
|
49
|
+
var _a;
|
|
50
|
+
const { context, activePage } = state.route || {};
|
|
51
|
+
this.activePage = activePage;
|
|
52
|
+
/* refresh를 일으키기위한 property 변경을 위한 코드임. */
|
|
53
|
+
this.title = context.title || ((_a = context.search) === null || _a === void 0 ? void 0 : _a.placeholder);
|
|
54
|
+
}
|
|
55
|
+
getHomeRoute() {
|
|
56
|
+
var base = document.querySelector('base');
|
|
57
|
+
return (base === null || base === void 0 ? void 0 : base.getAttribute('href')) || '/';
|
|
58
|
+
}
|
|
59
|
+
moveTo(page) {
|
|
60
|
+
navigate(page.getAttribute('data-page'));
|
|
61
|
+
}
|
|
62
|
+
closePage(page, idx) {
|
|
63
|
+
var _a;
|
|
64
|
+
this.pages = [...this.pages.slice(0, idx), ...this.pages.slice(idx + 1)];
|
|
65
|
+
(_a = page.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(page);
|
|
66
|
+
page.pageDispose();
|
|
67
|
+
if (this.activePage === page) {
|
|
68
|
+
const next = this.pages.length > 0 ? Math.max(0, idx - 1) : -1;
|
|
69
|
+
navigate(next != -1 ? this.pages[next].getAttribute('data-page') : this.getHomeRoute());
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
PageMDIBar.styles = [
|
|
74
|
+
css `
|
|
75
|
+
:host {
|
|
76
|
+
display: flex;
|
|
77
|
+
background-color: var(--main-section-background-color);
|
|
78
|
+
color: var(--mdibar-color, rgba(0, 0, 0, 0.7));
|
|
79
|
+
font-size: var(--fontsize-small);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
div {
|
|
83
|
+
display: inline-block;
|
|
84
|
+
position: relative;
|
|
85
|
+
max-width: var(--mdibar-max-width, 120px);
|
|
86
|
+
padding: var(--mdibar-padding, 3px 22px 0 5px);
|
|
87
|
+
border-right: var(--border-dark-color);
|
|
88
|
+
border-bottom: var(--border-dark-color);
|
|
89
|
+
white-space: nowrap;
|
|
90
|
+
overflow: hidden;
|
|
91
|
+
text-overflow: ellipsis;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
mwc-icon {
|
|
95
|
+
position: absolute;
|
|
96
|
+
right: 2px;
|
|
97
|
+
top: 3px;
|
|
98
|
+
margin-left: var(--margin-narrow);
|
|
99
|
+
font-size: var(--mdibar-icon-size, 18px);
|
|
100
|
+
opacity: 0.5;
|
|
101
|
+
}
|
|
102
|
+
mwc-icon:hover {
|
|
103
|
+
opacity: 0.8;
|
|
104
|
+
color: var(--mdibar-hover-color, #cc3300);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
[active] {
|
|
108
|
+
background-color: var(--mdibar-background-color, #fff);
|
|
109
|
+
border-bottom: 1px solid var(--mdibar-background-color, #fff);
|
|
110
|
+
color: var(--primary-text-color);
|
|
111
|
+
font-weight: bold;
|
|
112
|
+
}
|
|
113
|
+
[home] {
|
|
114
|
+
padding: var(--mdibar-padding-home, 3px 5px 0 23px);
|
|
115
|
+
}
|
|
116
|
+
[home] mwc-icon {
|
|
117
|
+
left: 0;
|
|
118
|
+
}
|
|
119
|
+
`
|
|
120
|
+
];
|
|
121
|
+
__decorate([
|
|
122
|
+
state(),
|
|
123
|
+
__metadata("design:type", Array)
|
|
124
|
+
], PageMDIBar.prototype, "pages", void 0);
|
|
125
|
+
__decorate([
|
|
126
|
+
state(),
|
|
127
|
+
__metadata("design:type", PageView)
|
|
128
|
+
], PageMDIBar.prototype, "activePage", void 0);
|
|
129
|
+
__decorate([
|
|
130
|
+
state(),
|
|
131
|
+
__metadata("design:type", String)
|
|
132
|
+
], PageMDIBar.prototype, "title", void 0);
|
|
133
|
+
PageMDIBar = __decorate([
|
|
134
|
+
customElement('page-mdibar')
|
|
135
|
+
], PageMDIBar);
|
|
136
|
+
//# sourceMappingURL=page-mdibar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-mdibar.js","sourceRoot":"","sources":["../../client/layout/page-mdibar.ts"],"names":[],"mappings":";AAAA,OAAO,oBAAoB,CAAA;AAE3B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA;AAEtD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAG1D,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,OAAO,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC;IAAnD;;QAkDW,UAAK,GAAe,EAAE,CAAA;QAEtB,UAAK,GAAW,EAAE,CAAA;IAsE7B,CAAC;IApEC,MAAM;QACJ,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE,CAAA;QAE9B,OAAO,IAAI,CAAA;;;QAGP,KAAK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;yCAAuB;AAC/B;IAAC,KAAK,EAAE;8BAAc,QAAQ;8CAAA;AAC9B;IAAC,KAAK,EAAE;;yCAAmB;AApDvB,UAAU;IADf,aAAa,CAAC,aAAa,CAAC;GACvB,UAAU,CA0Hf","sourcesContent":["import '@material/mwc-icon'\n\nimport { css, html, LitElement } from 'lit'\nimport { customElement, state } from 'lit/decorators.js'\nimport { connect } from 'pwa-helpers/connect-mixin.js'\n\nimport { navigate, store, PageView } from '@operato/shell'\n\n@customElement('page-mdibar')\nclass PageMDIBar extends connect(store)(LitElement) {\n static styles = [\n css`\n :host {\n display: flex;\n background-color: var(--main-section-background-color);\n color: var(--mdibar-color, rgba(0, 0, 0, 0.7));\n font-size: var(--fontsize-small);\n }\n\n div {\n display: inline-block;\n position: relative;\n max-width: var(--mdibar-max-width, 120px);\n padding: var(--mdibar-padding, 3px 22px 0 5px);\n border-right: var(--border-dark-color);\n border-bottom: var(--border-dark-color);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n mwc-icon {\n position: absolute;\n right: 2px;\n top: 3px;\n margin-left: var(--margin-narrow);\n font-size: var(--mdibar-icon-size, 18px);\n opacity: 0.5;\n }\n mwc-icon:hover {\n opacity: 0.8;\n color: var(--mdibar-hover-color, #cc3300);\n }\n\n [active] {\n background-color: var(--mdibar-background-color, #fff);\n border-bottom: 1px solid var(--mdibar-background-color, #fff);\n color: var(--primary-text-color);\n font-weight: bold;\n }\n [home] {\n padding: var(--mdibar-padding-home, 3px 5px 0 23px);\n }\n [home] mwc-icon {\n left: 0;\n }\n `\n ]\n\n @state() pages: PageView[] = []\n @state() activePage!: PageView\n @state() title: string = ''\n\n render() {\n const pages = this.pages || []\n\n return html`\n <div home><mwc-icon>home</mwc-icon></div>\n\n ${pages.map((page, idx) => {\n const context = page.context as any\n const title = context?.title || context?.search?.placeholder || ''\n\n return html`\n <div @click=${() => this.moveTo(page)} ?active=${this.activePage === page}>\n ${title}\n <mwc-icon\n @click=${(e: MouseEvent) => {\n e.stopPropagation()\n this.closePage(page, idx)\n }}\n >close</mwc-icon\n >\n </div>\n `\n })}\n `\n }\n\n updated(changed) {\n if (changed.has('activePage')) {\n const page = this.activePage\n\n if (!this.pages) {\n this.pages = []\n }\n\n if (!this.pages.includes(page)) {\n this.pages = [...this.pages, page]\n }\n }\n }\n\n stateChanged(state) {\n const { context, activePage } = state.route || {}\n this.activePage = activePage\n\n /* refresh를 일으키기위한 property 변경을 위한 코드임. */\n this.title = context.title || context.search?.placeholder\n }\n\n getHomeRoute() {\n var base = document.querySelector('base')\n return base?.getAttribute('href') || '/'\n }\n\n moveTo(page: PageView) {\n navigate(page.getAttribute('data-page')!)\n }\n\n closePage(page: PageView, idx: number) {\n this.pages = [...this.pages.slice(0, idx), ...this.pages.slice(idx + 1)]\n\n page.parentNode?.removeChild(page)\n page.pageDispose()\n\n if (this.activePage === page) {\n const next = this.pages.length > 0 ? Math.max(0, idx - 1) : -1\n navigate(next != -1 ? this.pages[next].getAttribute('data-page')! : this.getHomeRoute())\n }\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@material/mwc-icon';
|