@operato/layout 0.3.21 → 0.3.27
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/CHANGELOG.md +50 -0
- package/dist/src/actions/layout.d.ts +89 -0
- package/dist/src/actions/layout.js +159 -0
- package/dist/src/actions/layout.js.map +1 -0
- package/dist/src/actions/snackbar.d.ts +22 -0
- package/dist/src/actions/snackbar.js +24 -0
- package/dist/src/actions/snackbar.js.map +1 -0
- package/dist/src/components/ox-floating-overlay.d.ts +2 -0
- package/dist/src/components/ox-floating-overlay.js +333 -0
- package/dist/src/components/ox-floating-overlay.js.map +1 -0
- package/dist/src/components/ox-resize-splitter.d.ts +13 -0
- package/dist/src/components/ox-resize-splitter.js +108 -0
- package/dist/src/components/ox-resize-splitter.js.map +1 -0
- package/dist/src/index.d.ts +8 -1
- package/dist/src/index.js +8 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/initializer.d.ts +2 -0
- package/dist/src/initializer.js +91 -0
- package/dist/src/initializer.js.map +1 -0
- package/dist/src/layouts/ox-aside-bar.d.ts +2 -0
- package/dist/src/layouts/ox-aside-bar.js +106 -0
- package/dist/src/layouts/ox-aside-bar.js.map +1 -0
- package/dist/src/layouts/ox-footer-bar.d.ts +2 -0
- package/dist/src/layouts/ox-footer-bar.js +107 -0
- package/dist/src/layouts/ox-footer-bar.js.map +1 -0
- package/dist/src/layouts/ox-header-bar.d.ts +2 -0
- package/dist/src/layouts/ox-header-bar.js +104 -0
- package/dist/src/layouts/ox-header-bar.js.map +1 -0
- package/dist/src/layouts/ox-nav-bar.d.ts +2 -0
- package/dist/src/layouts/ox-nav-bar.js +108 -0
- package/dist/src/layouts/ox-nav-bar.js.map +1 -0
- package/dist/src/layouts/ox-snack-bar.d.ts +2 -0
- package/dist/src/layouts/ox-snack-bar.js +119 -0
- package/dist/src/layouts/ox-snack-bar.js.map +1 -0
- package/dist/src/reducers/layout.d.ts +13 -0
- package/dist/src/reducers/layout.js +62 -0
- package/dist/src/reducers/layout.js.map +1 -0
- package/dist/src/reducers/snackbar.d.ts +18 -0
- package/dist/src/reducers/snackbar.js +30 -0
- package/dist/src/reducers/snackbar.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +14 -6
- package/src/actions/layout.ts +233 -0
- package/src/actions/snackbar.ts +60 -0
- package/src/components/ox-floating-overlay.ts +319 -0
- package/src/components/ox-resize-splitter.ts +126 -0
- package/src/index.ts +10 -1
- package/src/initializer.ts +113 -0
- package/src/layouts/ox-aside-bar.ts +106 -0
- package/src/layouts/ox-footer-bar.ts +106 -0
- package/src/layouts/ox-header-bar.ts +103 -0
- package/src/layouts/ox-nav-bar.ts +108 -0
- package/src/layouts/ox-snack-bar.ts +108 -0
- package/src/reducers/layout.ts +72 -0
- package/src/reducers/snackbar.ts +32 -0
- package/dist/src/ox-layout.d.ts +0 -45
- package/dist/src/ox-layout.js +0 -148
- package/dist/src/ox-layout.js.map +0 -1
- package/dist/src/ox-toolbar-style.d.ts +0 -4
- package/dist/src/ox-toolbar-style.js +0 -207
- package/dist/src/ox-toolbar-style.js.map +0 -1
- package/dist/src/ox-toolbar.d.ts +0 -4
- package/dist/src/ox-toolbar.js +0 -123
- package/dist/src/ox-toolbar.js.map +0 -1
- package/dist/stories/index.stories.d.ts +0 -33
- package/dist/stories/index.stories.js +0 -33
- package/dist/stories/index.stories.js.map +0 -1
- package/dist/test/ox-layout.test.d.ts +0 -1
- package/dist/test/ox-layout.test.js +0 -24
- package/dist/test/ox-layout.test.js.map +0 -1
- package/src/ox-layout.ts +0 -191
- package/src/ox-toolbar-style.ts +0 -208
- package/src/ox-toolbar.ts +0 -135
- package/stories/index.stories.ts +0 -52
- package/test/ox-layout.test.ts +0 -35
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import '@operato/help/ox-help-icon.js';
|
|
3
|
+
import '@material/mwc-icon';
|
|
4
|
+
import { css, html, LitElement } from 'lit';
|
|
5
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
6
|
+
import { ScrollbarStyles } from '@operato/styles';
|
|
7
|
+
let FloatingOverlay = class FloatingOverlay extends LitElement {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.backdrop = false;
|
|
11
|
+
this.title = '';
|
|
12
|
+
this.closable = false;
|
|
13
|
+
}
|
|
14
|
+
render() {
|
|
15
|
+
var direction = this.hovering == 'center' ? false : this.direction;
|
|
16
|
+
return html `
|
|
17
|
+
${Boolean(this.backdrop)
|
|
18
|
+
? html ` <div id="backdrop" ?hidden=${!this.backdrop} @click=${() => this.onClose(true)}></div> `
|
|
19
|
+
: html ``}
|
|
20
|
+
|
|
21
|
+
<div
|
|
22
|
+
overlayed
|
|
23
|
+
hovering=${this.hovering || 'center'}
|
|
24
|
+
direction=${direction}
|
|
25
|
+
size=${this.size || 'normal'}
|
|
26
|
+
@close-overlay=${() => this.onClose()}
|
|
27
|
+
@transitionstart=${(e) => {
|
|
28
|
+
/* to hide scrollbar during transition */
|
|
29
|
+
;
|
|
30
|
+
e.target.removeAttribute('settled');
|
|
31
|
+
}}
|
|
32
|
+
@transitionend=${(e) => {
|
|
33
|
+
;
|
|
34
|
+
e.target.setAttribute('settled', '');
|
|
35
|
+
}}
|
|
36
|
+
>
|
|
37
|
+
<div header>
|
|
38
|
+
<mwc-icon @click=${() => this.onClose()} ?closable=${this.closable} historyback>arrow_back</mwc-icon>
|
|
39
|
+
<slot name="header">
|
|
40
|
+
${this.title || this.closable
|
|
41
|
+
? html `
|
|
42
|
+
<h1>
|
|
43
|
+
${this.title || ''} ${this.help
|
|
44
|
+
? html ` <ox-help-icon .topic=${this.help}></ox-help-icon>`
|
|
45
|
+
: html ``}
|
|
46
|
+
</h1>
|
|
47
|
+
`
|
|
48
|
+
: html ``}</slot
|
|
49
|
+
>
|
|
50
|
+
<mwc-icon @click=${() => this.onClose()} ?closable=${this.closable} close>close</mwc-icon>
|
|
51
|
+
</div>
|
|
52
|
+
|
|
53
|
+
<div content>
|
|
54
|
+
<slot> </slot>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
`;
|
|
58
|
+
}
|
|
59
|
+
updated(changes) {
|
|
60
|
+
if (changes.has('templateProperties') && this.templateProperties) {
|
|
61
|
+
var template = this.firstElementChild;
|
|
62
|
+
if (template) {
|
|
63
|
+
for (let prop in this.templateProperties) {
|
|
64
|
+
//@ts-ignore
|
|
65
|
+
template[prop] = this.templateProperties[prop];
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
firstUpdated() {
|
|
71
|
+
requestAnimationFrame(() => {
|
|
72
|
+
var _a;
|
|
73
|
+
/* transition(animation) 효과를 위해 'opened' 속성을 변화시킨다. */
|
|
74
|
+
(_a = this.renderRoot.querySelector('[overlayed]')) === null || _a === void 0 ? void 0 : _a.setAttribute('opened', 'true');
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
disconnectedCallback() {
|
|
78
|
+
document.dispatchEvent(new CustomEvent('overlay-closed', {
|
|
79
|
+
detail: this.name
|
|
80
|
+
}));
|
|
81
|
+
super.disconnectedCallback();
|
|
82
|
+
}
|
|
83
|
+
onClose(escape) {
|
|
84
|
+
/* 현재 overlay state를 확인해서, 자신이 포함하고 있는 템플릿인 경우에 history.back() 한다. */
|
|
85
|
+
var state = history.state;
|
|
86
|
+
var overlay = (state || {}).overlay;
|
|
87
|
+
if (!overlay || overlay.name !== this.name) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
/* Backdrop click 경우는 escape 시도라고 정의한다. overlay 속성이 escapable이 아닌 경우에는 동작하지 않는다. */
|
|
91
|
+
if (escape && !overlay.escapable) {
|
|
92
|
+
return true;
|
|
93
|
+
}
|
|
94
|
+
history.back();
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
FloatingOverlay.styles = [
|
|
98
|
+
ScrollbarStyles,
|
|
99
|
+
css `
|
|
100
|
+
/* for layout style */
|
|
101
|
+
:host {
|
|
102
|
+
position: relative;
|
|
103
|
+
z-index: 1;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
:host([hovering='edge']) {
|
|
107
|
+
/* edge hovering 인 경우에는 상위 relative position 크기와 위치를 반영한다. */
|
|
108
|
+
position: initial;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
#backdrop {
|
|
112
|
+
position: fixed;
|
|
113
|
+
left: 0;
|
|
114
|
+
top: 0;
|
|
115
|
+
|
|
116
|
+
width: 100vw;
|
|
117
|
+
height: 100vh;
|
|
118
|
+
|
|
119
|
+
background-color: var(--overlay-background-color);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
[overlayed] {
|
|
123
|
+
position: absolute;
|
|
124
|
+
|
|
125
|
+
display: flex;
|
|
126
|
+
flex-direction: column;
|
|
127
|
+
overflow: hidden;
|
|
128
|
+
background: transparent;
|
|
129
|
+
pointer-events: none;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
[overlayed][hovering='center'] {
|
|
133
|
+
position: fixed;
|
|
134
|
+
|
|
135
|
+
left: 50%;
|
|
136
|
+
top: 50%;
|
|
137
|
+
transform: translate(-50%, -50%);
|
|
138
|
+
|
|
139
|
+
opacity: 0;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
[overlayed][hovering='center'][opened] {
|
|
143
|
+
opacity: 1;
|
|
144
|
+
transition: opacity 0.3s ease-in;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
[hovering='center'] {
|
|
148
|
+
width: var(--overlay-center-normal-width, 60%);
|
|
149
|
+
height: var(--overlay-center-normal-height, 60%);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
[hovering='center'][size='small'] {
|
|
153
|
+
width: var(--overlay-center-small-width, 40%);
|
|
154
|
+
height: var(--overlay-center-small-height, 40%);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
[hovering='center'][size='large'] {
|
|
158
|
+
width: var(--overlay-center-large-width, 100%);
|
|
159
|
+
height: var(--overlay-center-large-height, 100%);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
[header] {
|
|
163
|
+
--help-icon-color: #fff;
|
|
164
|
+
--help-icon-hover-color: #fff;
|
|
165
|
+
|
|
166
|
+
pointer-events: initial;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
[content] {
|
|
170
|
+
flex: 1;
|
|
171
|
+
|
|
172
|
+
overflow: hidden;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
::slotted(*) {
|
|
176
|
+
box-sizing: border-box;
|
|
177
|
+
pointer-events: initial;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
[hovering='center'] [content] ::slotted(*) {
|
|
181
|
+
width: 100%;
|
|
182
|
+
height: 100%;
|
|
183
|
+
}
|
|
184
|
+
[direction='up'],
|
|
185
|
+
[direction='down'] {
|
|
186
|
+
width: 100%;
|
|
187
|
+
|
|
188
|
+
max-height: 0;
|
|
189
|
+
transition: max-height 0.7s ease-in;
|
|
190
|
+
}
|
|
191
|
+
[direction='up'] {
|
|
192
|
+
bottom: 0;
|
|
193
|
+
}
|
|
194
|
+
[direction='down'] {
|
|
195
|
+
top: 0;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
[direction='up'][opened],
|
|
199
|
+
[direction='down'][opened] {
|
|
200
|
+
max-height: 100vh;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
[settled][direction='down'] [content],
|
|
204
|
+
[settled][direction='up'] [content] {
|
|
205
|
+
overflow-y: auto;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
[direction='left'],
|
|
209
|
+
[direction='right'] {
|
|
210
|
+
height: 100%;
|
|
211
|
+
|
|
212
|
+
max-width: 0;
|
|
213
|
+
transition: max-width 0.5s ease-in;
|
|
214
|
+
}
|
|
215
|
+
[direction='left'] {
|
|
216
|
+
right: 0;
|
|
217
|
+
}
|
|
218
|
+
[direction='right'] {
|
|
219
|
+
left: 0;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
[direction='left'][opened],
|
|
223
|
+
[direction='right'][opened] {
|
|
224
|
+
max-width: 100vw;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
[settled][direction='left'] [content],
|
|
228
|
+
[settled][direction='right'] [content] {
|
|
229
|
+
overflow-x: auto;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
@media screen and (max-width: 460px) {
|
|
233
|
+
[direction='up'],
|
|
234
|
+
[direction='down'] {
|
|
235
|
+
max-height: 100vh;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
[direction='left'],
|
|
239
|
+
[direction='right'] {
|
|
240
|
+
max-width: 100vw;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
`,
|
|
244
|
+
css `
|
|
245
|
+
/* for header style */
|
|
246
|
+
[header] {
|
|
247
|
+
display: flex;
|
|
248
|
+
flex-direction: row;
|
|
249
|
+
align-items: center;
|
|
250
|
+
|
|
251
|
+
background-color: var(--overlay-header-background-color);
|
|
252
|
+
color: var(--overlay-header-color);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
slot[name='header'] {
|
|
256
|
+
flex: 1;
|
|
257
|
+
|
|
258
|
+
display: flex;
|
|
259
|
+
flex-direction: row;
|
|
260
|
+
align-items: center;
|
|
261
|
+
justify-content: center;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
[name='header']::slotted(*) {
|
|
265
|
+
margin: 0 auto;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
[name='header'] > h1 {
|
|
269
|
+
text-transform: capitalize;
|
|
270
|
+
font: var(--overlay-header-font);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
[historyback] {
|
|
274
|
+
margin-left: 10px;
|
|
275
|
+
margin-right: auto;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
[close] {
|
|
279
|
+
margin-left: auto;
|
|
280
|
+
margin-right: 10px;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
[historyback],
|
|
284
|
+
[close] {
|
|
285
|
+
display: none;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
[closable][close] {
|
|
289
|
+
display: block;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
@media screen and (max-width: 460px) {
|
|
293
|
+
[closable][historyback] {
|
|
294
|
+
display: block;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
[closable][close] {
|
|
298
|
+
display: none;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
`
|
|
302
|
+
];
|
|
303
|
+
__decorate([
|
|
304
|
+
property({ type: Boolean })
|
|
305
|
+
], FloatingOverlay.prototype, "backdrop", void 0);
|
|
306
|
+
__decorate([
|
|
307
|
+
property({ type: String })
|
|
308
|
+
], FloatingOverlay.prototype, "direction", void 0);
|
|
309
|
+
__decorate([
|
|
310
|
+
property({ type: String, reflect: true })
|
|
311
|
+
], FloatingOverlay.prototype, "hovering", void 0);
|
|
312
|
+
__decorate([
|
|
313
|
+
property({ type: String })
|
|
314
|
+
], FloatingOverlay.prototype, "size", void 0);
|
|
315
|
+
__decorate([
|
|
316
|
+
property({ type: String })
|
|
317
|
+
], FloatingOverlay.prototype, "name", void 0);
|
|
318
|
+
__decorate([
|
|
319
|
+
property({ type: String })
|
|
320
|
+
], FloatingOverlay.prototype, "title", void 0);
|
|
321
|
+
__decorate([
|
|
322
|
+
property({ type: Boolean })
|
|
323
|
+
], FloatingOverlay.prototype, "closable", void 0);
|
|
324
|
+
__decorate([
|
|
325
|
+
property({ type: Object })
|
|
326
|
+
], FloatingOverlay.prototype, "templateProperties", void 0);
|
|
327
|
+
__decorate([
|
|
328
|
+
property({ type: Object })
|
|
329
|
+
], FloatingOverlay.prototype, "help", void 0);
|
|
330
|
+
FloatingOverlay = __decorate([
|
|
331
|
+
customElement('ox-floating-overlay')
|
|
332
|
+
], FloatingOverlay);
|
|
333
|
+
//# sourceMappingURL=ox-flo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,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAmB;AACjB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;iDAA0B;AAC1B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2DAAwB;AACvB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CAAU;AAxNjC,eAAe;IADpB,aAAa,CAAC,qBAAqB,CAAC;GAC/B,eAAe,CAqTpB","sourcesContent":["import '@operato/help/ox-help-icon.js'\nimport '@material/mwc-icon'\n\nimport { css, html, LitElement, PropertyValues } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { ScrollbarStyles } from '@operato/styles'\n\n@customElement('ox-floating-overlay')\nclass FloatingOverlay extends LitElement {\n static styles = [\n ScrollbarStyles,\n css`\n /* for layout style */\n :host {\n position: relative;\n z-index: 1;\n }\n\n :host([hovering='edge']) {\n /* edge hovering 인 경우에는 상위 relative position 크기와 위치를 반영한다. */\n position: initial;\n }\n\n #backdrop {\n position: fixed;\n left: 0;\n top: 0;\n\n width: 100vw;\n height: 100vh;\n\n background-color: var(--overlay-background-color);\n }\n\n [overlayed] {\n position: absolute;\n\n display: flex;\n flex-direction: column;\n overflow: hidden;\n background: transparent;\n pointer-events: none;\n }\n\n [overlayed][hovering='center'] {\n position: fixed;\n\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n\n opacity: 0;\n }\n\n [overlayed][hovering='center'][opened] {\n opacity: 1;\n transition: opacity 0.3s ease-in;\n }\n\n [hovering='center'] {\n width: var(--overlay-center-normal-width, 60%);\n height: var(--overlay-center-normal-height, 60%);\n }\n\n [hovering='center'][size='small'] {\n width: var(--overlay-center-small-width, 40%);\n height: var(--overlay-center-small-height, 40%);\n }\n\n [hovering='center'][size='large'] {\n width: var(--overlay-center-large-width, 100%);\n height: var(--overlay-center-large-height, 100%);\n }\n\n [header] {\n --help-icon-color: #fff;\n --help-icon-hover-color: #fff;\n\n pointer-events: initial;\n }\n\n [content] {\n flex: 1;\n\n overflow: hidden;\n }\n\n ::slotted(*) {\n box-sizing: border-box;\n pointer-events: initial;\n }\n\n [hovering='center'] [content] ::slotted(*) {\n width: 100%;\n height: 100%;\n }\n [direction='up'],\n [direction='down'] {\n width: 100%;\n\n max-height: 0;\n transition: max-height 0.7s ease-in;\n }\n [direction='up'] {\n bottom: 0;\n }\n [direction='down'] {\n top: 0;\n }\n\n [direction='up'][opened],\n [direction='down'][opened] {\n max-height: 100vh;\n }\n\n [settled][direction='down'] [content],\n [settled][direction='up'] [content] {\n overflow-y: auto;\n }\n\n [direction='left'],\n [direction='right'] {\n height: 100%;\n\n max-width: 0;\n transition: max-width 0.5s ease-in;\n }\n [direction='left'] {\n right: 0;\n }\n [direction='right'] {\n left: 0;\n }\n\n [direction='left'][opened],\n [direction='right'][opened] {\n max-width: 100vw;\n }\n\n [settled][direction='left'] [content],\n [settled][direction='right'] [content] {\n overflow-x: auto;\n }\n\n @media screen and (max-width: 460px) {\n [direction='up'],\n [direction='down'] {\n max-height: 100vh;\n }\n\n [direction='left'],\n [direction='right'] {\n max-width: 100vw;\n }\n }\n `,\n css`\n /* for header style */\n [header] {\n display: flex;\n flex-direction: row;\n align-items: center;\n\n background-color: var(--overlay-header-background-color);\n color: var(--overlay-header-color);\n }\n\n slot[name='header'] {\n flex: 1;\n\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: center;\n }\n\n [name='header']::slotted(*) {\n margin: 0 auto;\n }\n\n [name='header'] > h1 {\n text-transform: capitalize;\n font: var(--overlay-header-font);\n }\n\n [historyback] {\n margin-left: 10px;\n margin-right: auto;\n }\n\n [close] {\n margin-left: auto;\n margin-right: 10px;\n }\n\n [historyback],\n [close] {\n display: none;\n }\n\n [closable][close] {\n display: block;\n }\n\n @media screen and (max-width: 460px) {\n [closable][historyback] {\n display: block;\n }\n\n [closable][close] {\n display: none;\n }\n }\n `\n ]\n\n @property({ type: Boolean }) backdrop: boolean = false\n @property({ type: String }) direction?: 'up' | 'down' | 'left' | 'right'\n @property({ type: String, reflect: true }) hovering?: 'center' | 'edge'\n @property({ type: String }) size?: 'small' | 'normal' | 'large'\n @property({ type: String }) name?: string\n @property({ type: String }) title: string = ''\n @property({ type: Boolean }) closable: boolean = false\n @property({ type: Object }) templateProperties: any\n @property({ type: Object }) help: any\n\n render() {\n var direction = this.hovering == 'center' ? false : this.direction\n\n return html`\n ${Boolean(this.backdrop)\n ? html` <div id=\"backdrop\" ?hidden=${!this.backdrop} @click=${() => this.onClose(true)}></div> `\n : html``}\n\n <div\n overlayed\n hovering=${this.hovering || 'center'}\n direction=${direction}\n size=${this.size || 'normal'}\n @close-overlay=${() => this.onClose()}\n @transitionstart=${(e: Event) => {\n /* to hide scrollbar during transition */\n ;(e.target as HTMLElement).removeAttribute('settled')\n }}\n @transitionend=${(e: Event) => {\n ;(e.target as HTMLElement).setAttribute('settled', '')\n }}\n >\n <div header>\n <mwc-icon @click=${() => this.onClose()} ?closable=${this.closable} historyback>arrow_back</mwc-icon>\n <slot name=\"header\">\n ${this.title || this.closable\n ? html`\n <h1>\n ${this.title || ''} ${this.help\n ? html` <ox-help-icon .topic=${this.help}></ox-help-icon>`\n : html``}\n </h1>\n `\n : html``}</slot\n >\n <mwc-icon @click=${() => this.onClose()} ?closable=${this.closable} close>close</mwc-icon>\n </div>\n\n <div content>\n <slot> </slot>\n </div>\n </div>\n `\n }\n\n updated(changes: PropertyValues<this>) {\n if (changes.has('templateProperties') && this.templateProperties) {\n var template = this.firstElementChild\n if (template) {\n for (let prop in this.templateProperties) {\n //@ts-ignore\n template[prop] = this.templateProperties[prop]\n }\n }\n }\n }\n\n firstUpdated() {\n requestAnimationFrame(() => {\n /* transition(animation) 효과를 위해 'opened' 속성을 변화시킨다. */\n this.renderRoot.querySelector('[overlayed]')?.setAttribute('opened', 'true')\n })\n }\n\n disconnectedCallback() {\n document.dispatchEvent(\n new CustomEvent('overlay-closed', {\n detail: this.name\n })\n )\n\n super.disconnectedCallback()\n }\n\n onClose(escape?: boolean) {\n /* 현재 overlay state를 확인해서, 자신이 포함하고 있는 템플릿인 경우에 history.back() 한다. */\n\n var state = history.state\n var overlay = (state || {}).overlay\n\n if (!overlay || overlay.name !== this.name) {\n return\n }\n\n /* Backdrop click 경우는 escape 시도라고 정의한다. overlay 속성이 escapable이 아닌 경우에는 동작하지 않는다. */\n if (escape && !overlay.escapable) {\n return true\n }\n\n history.back()\n }\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
export declare class ResizeSplitter extends LitElement {
|
|
3
|
+
static _dragImage: HTMLImageElement;
|
|
4
|
+
static get dragImage(): HTMLImageElement;
|
|
5
|
+
static styles: import("lit").CSSResult;
|
|
6
|
+
private dragstart?;
|
|
7
|
+
connectedCallback(): void;
|
|
8
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
9
|
+
_throttled(delay: number, fn: (...args: any) => void): (...args: any) => void;
|
|
10
|
+
_onDragStart(e: DragEvent): void;
|
|
11
|
+
_onDrag(e: DragEvent): void;
|
|
12
|
+
_onDragEnd(e: DragEvent): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
var ResizeSplitter_1;
|
|
2
|
+
import { __decorate } from "tslib";
|
|
3
|
+
import { css, html, LitElement } from 'lit';
|
|
4
|
+
import { customElement } from 'lit/decorators.js';
|
|
5
|
+
let ResizeSplitter = ResizeSplitter_1 = class ResizeSplitter extends LitElement {
|
|
6
|
+
static get dragImage() {
|
|
7
|
+
if (!ResizeSplitter_1._dragImage) {
|
|
8
|
+
ResizeSplitter_1._dragImage = new Image();
|
|
9
|
+
ResizeSplitter_1._dragImage.src =
|
|
10
|
+
'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==';
|
|
11
|
+
}
|
|
12
|
+
return ResizeSplitter_1._dragImage;
|
|
13
|
+
}
|
|
14
|
+
connectedCallback() {
|
|
15
|
+
super.connectedCallback();
|
|
16
|
+
if (this.hasAttribute('vertical')) {
|
|
17
|
+
this.style.width = '3px';
|
|
18
|
+
this.style.height = '100%';
|
|
19
|
+
this.style.cursor = 'col-resize';
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
this.style.width = '100%';
|
|
23
|
+
this.style.height = '3px';
|
|
24
|
+
this.style.cursor = 'row-resize';
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
render() {
|
|
28
|
+
return html `
|
|
29
|
+
<div
|
|
30
|
+
draggable="true"
|
|
31
|
+
@dragstart=${(e) => this._onDragStart(e)}
|
|
32
|
+
@drag=${this._throttled(100, this._onDrag.bind(this))}
|
|
33
|
+
@dragend=${(e) => this._onDragEnd(e)}
|
|
34
|
+
></div>
|
|
35
|
+
`;
|
|
36
|
+
}
|
|
37
|
+
// TODO onDrag 이벤트가 계속 발생하므로 처리하는 성능 저하됨. 그래서 throttling 하도록 함
|
|
38
|
+
_throttled(delay, fn) {
|
|
39
|
+
let lastCall = 0;
|
|
40
|
+
return function (...args) {
|
|
41
|
+
const now = new Date().getTime();
|
|
42
|
+
if (now - lastCall < delay) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
lastCall = now;
|
|
46
|
+
return fn(...args);
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
_onDragStart(e) {
|
|
50
|
+
e.dataTransfer.setDragImage(ResizeSplitter_1.dragImage, 0, 0);
|
|
51
|
+
this.dragstart = {
|
|
52
|
+
x: e.clientX,
|
|
53
|
+
y: e.clientY
|
|
54
|
+
};
|
|
55
|
+
this.dispatchEvent(new CustomEvent('splitter-dragstart', {
|
|
56
|
+
bubbles: true,
|
|
57
|
+
composed: true
|
|
58
|
+
}));
|
|
59
|
+
e.stopPropagation();
|
|
60
|
+
}
|
|
61
|
+
_onDrag(e) {
|
|
62
|
+
if (e.clientX == 0) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
this.dispatchEvent(new CustomEvent('splitter-drag', {
|
|
66
|
+
bubbles: true,
|
|
67
|
+
composed: true,
|
|
68
|
+
detail: {
|
|
69
|
+
x: e.clientX - this.dragstart.x,
|
|
70
|
+
y: e.clientY - this.dragstart.y
|
|
71
|
+
}
|
|
72
|
+
}));
|
|
73
|
+
e.stopPropagation();
|
|
74
|
+
}
|
|
75
|
+
_onDragEnd(e) {
|
|
76
|
+
this.dispatchEvent(new CustomEvent('splitter-dragend', {
|
|
77
|
+
bubbles: true,
|
|
78
|
+
composed: true,
|
|
79
|
+
detail: {
|
|
80
|
+
x: e.clientX - this.dragstart.x,
|
|
81
|
+
y: e.clientY - this.dragstart.y
|
|
82
|
+
}
|
|
83
|
+
}));
|
|
84
|
+
e.stopPropagation();
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
ResizeSplitter.styles = css `
|
|
88
|
+
:host {
|
|
89
|
+
position: relative;
|
|
90
|
+
opacity: 0.7;
|
|
91
|
+
background-color: var(--splitter-background-color);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
:host(:hover) {
|
|
95
|
+
background-color: var(--splitter-hover-background-color);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
div {
|
|
99
|
+
position: absolute;
|
|
100
|
+
width: 100%;
|
|
101
|
+
height: 100%;
|
|
102
|
+
}
|
|
103
|
+
`;
|
|
104
|
+
ResizeSplitter = ResizeSplitter_1 = __decorate([
|
|
105
|
+
customElement('ox-resize-splitter')
|
|
106
|
+
], ResizeSplitter);
|
|
107
|
+
export { ResizeSplitter };
|
|
108
|
+
//# sourceMappingURL=ox-resize-splitter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ox-resize-splitter.js","sourceRoot":"","sources":["../../../src/components/ox-resize-splitter.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM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I;YACd,MAAM,EAAE;gBACN,CAAC,EAAE,CAAC,CAAC,OAAO,GAAG,IAAI,CAAC,SAAU,CAAC,CAAC;gBAChC,CAAC,EAAE,CAAC,CAAC,OAAO,GAAG,IAAI,CAAC,SAAU,CAAC,CAAC;aACjC;SACF,CAAC,CACH,CAAA;QAED,CAAC,CAAC,eAAe,EAAE,CAAA;IACrB,CAAC;CACF,CAAA;AA7GQ,qBAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;GAgBlB,CAAA;AA5BU,cAAc;IAD1B,aAAa,CAAC,oBAAoB,CAAC;GACvB,cAAc,CAyH1B;SAzHY,cAAc","sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { customElement } from 'lit/decorators.js'\n\n@customElement('ox-resize-splitter')\nexport class ResizeSplitter extends LitElement {\n static _dragImage: HTMLImageElement\n\n static get dragImage() {\n if (!ResizeSplitter._dragImage) {\n ResizeSplitter._dragImage = new Image()\n ResizeSplitter._dragImage.src =\n 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='\n }\n return ResizeSplitter._dragImage\n }\n\n static styles = css`\n :host {\n position: relative;\n opacity: 0.7;\n background-color: var(--splitter-background-color);\n }\n\n :host(:hover) {\n background-color: var(--splitter-hover-background-color);\n }\n\n div {\n position: absolute;\n width: 100%;\n height: 100%;\n }\n `\n\n private dragstart?: { x: number; y: number }\n\n connectedCallback() {\n super.connectedCallback()\n\n if (this.hasAttribute('vertical')) {\n this.style.width = '3px'\n this.style.height = '100%'\n this.style.cursor = 'col-resize'\n } else {\n this.style.width = '100%'\n this.style.height = '3px'\n this.style.cursor = 'row-resize'\n }\n }\n\n render() {\n return html`\n <div\n draggable=\"true\"\n @dragstart=${(e: DragEvent) => this._onDragStart(e)}\n @drag=${this._throttled(100, this._onDrag.bind(this))}\n @dragend=${(e: DragEvent) => this._onDragEnd(e)}\n ></div>\n `\n }\n\n // TODO onDrag 이벤트가 계속 발생하므로 처리하는 성능 저하됨. 그래서 throttling 하도록 함\n _throttled(delay: number, fn: (...args: any) => void) {\n let lastCall = 0\n return function (...args: any) {\n const now = new Date().getTime()\n if (now - lastCall < delay) {\n return\n }\n lastCall = now\n return fn(...args)\n }\n }\n\n _onDragStart(e: DragEvent) {\n e.dataTransfer!.setDragImage(ResizeSplitter.dragImage, 0, 0)\n\n this.dragstart = {\n x: e.clientX,\n y: e.clientY\n }\n\n this.dispatchEvent(\n new CustomEvent('splitter-dragstart', {\n bubbles: true,\n composed: true\n })\n )\n\n e.stopPropagation()\n }\n\n _onDrag(e: DragEvent) {\n if (e.clientX == 0) {\n return\n }\n\n this.dispatchEvent(\n new CustomEvent('splitter-drag', {\n bubbles: true,\n composed: true,\n detail: {\n x: e.clientX - this.dragstart!.x,\n y: e.clientY - this.dragstart!.y\n }\n })\n )\n\n e.stopPropagation()\n }\n\n _onDragEnd(e: DragEvent) {\n this.dispatchEvent(\n new CustomEvent('splitter-dragend', {\n bubbles: true,\n composed: true,\n detail: {\n x: e.clientX - this.dragstart!.x,\n y: e.clientY - this.dragstart!.y\n }\n })\n )\n\n e.stopPropagation()\n }\n}\n"]}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import './initializer';
|
|
2
|
+
export * from './layouts/ox-snack-bar.js';
|
|
3
|
+
export * from './layouts/ox-header-bar.js';
|
|
4
|
+
export * from './layouts/ox-nav-bar.js';
|
|
5
|
+
export * from './layouts/ox-aside-bar.js';
|
|
6
|
+
export * from './layouts/ox-footer-bar.js';
|
|
7
|
+
export * from './actions/layout';
|
|
8
|
+
export * from './actions/snackbar';
|
package/dist/src/index.js
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import './initializer';
|
|
2
|
+
export * from './layouts/ox-snack-bar.js';
|
|
3
|
+
export * from './layouts/ox-header-bar.js';
|
|
4
|
+
export * from './layouts/ox-nav-bar.js';
|
|
5
|
+
export * from './layouts/ox-aside-bar.js';
|
|
6
|
+
export * from './layouts/ox-footer-bar.js';
|
|
7
|
+
export * from './actions/layout';
|
|
8
|
+
export * from './actions/snackbar';
|
|
2
9
|
//# sourceMappingURL=index.js.map
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAA;AAEtB,cAAc,2BAA2B,CAAA;AACzC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,yBAAyB,CAAA;AACvC,cAAc,2BAA2B,CAAA;AACzC,cAAc,4BAA4B,CAAA;AAE1C,cAAc,kBAAkB,CAAA;AAChC,cAAc,oBAAoB,CAAA","sourcesContent":["import './initializer'\n\nexport * from './layouts/ox-snack-bar.js'\nexport * from './layouts/ox-header-bar.js'\nexport * from './layouts/ox-nav-bar.js'\nexport * from './layouts/ox-aside-bar.js'\nexport * from './layouts/ox-footer-bar.js'\n\nexport * from './actions/layout'\nexport * from './actions/snackbar'\n"]}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { REGISTER_NAVIGATION_CALLBACK, store } from '@operato/shell';
|
|
2
|
+
import { closeOverlay, openOverlay, openPopup, toggleOverlay, UPDATE_VIEWPART } from './actions/layout';
|
|
3
|
+
import { showSnackbar } from './actions/snackbar';
|
|
4
|
+
import layout from './reducers/layout';
|
|
5
|
+
import snackbar from './reducers/snackbar';
|
|
6
|
+
store.addReducers({
|
|
7
|
+
layout,
|
|
8
|
+
snackbar
|
|
9
|
+
});
|
|
10
|
+
document.addEventListener('open-overlay', event => {
|
|
11
|
+
const { name, options } = event.detail;
|
|
12
|
+
openOverlay(name, options);
|
|
13
|
+
});
|
|
14
|
+
document.addEventListener('close-overlay', event => {
|
|
15
|
+
const { name } = event.detail;
|
|
16
|
+
closeOverlay(name);
|
|
17
|
+
});
|
|
18
|
+
document.addEventListener('toggle-overlay', event => {
|
|
19
|
+
const { name, options } = event.detail;
|
|
20
|
+
toggleOverlay(name, options);
|
|
21
|
+
});
|
|
22
|
+
document.addEventListener('open-popup', event => {
|
|
23
|
+
const { template, options, callback } = event.detail;
|
|
24
|
+
var popup = openPopup(template, options);
|
|
25
|
+
if (popup && callback)
|
|
26
|
+
callback(popup);
|
|
27
|
+
});
|
|
28
|
+
document.addEventListener('notify', event => {
|
|
29
|
+
let { message, level, ex = '', option = {} } = event.detail;
|
|
30
|
+
switch (level) {
|
|
31
|
+
case 'error':
|
|
32
|
+
console.error(message, ex);
|
|
33
|
+
break;
|
|
34
|
+
case 'warn':
|
|
35
|
+
console.warn(message, ex);
|
|
36
|
+
break;
|
|
37
|
+
case 'info':
|
|
38
|
+
console.info(message);
|
|
39
|
+
break;
|
|
40
|
+
default:
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
store.dispatch(showSnackbar(level, {
|
|
44
|
+
message,
|
|
45
|
+
...option
|
|
46
|
+
}));
|
|
47
|
+
});
|
|
48
|
+
/* overlay handling */
|
|
49
|
+
var overlayStack = [];
|
|
50
|
+
function getLastSequence() {
|
|
51
|
+
return overlayStack.length > 0 ? overlayStack[overlayStack.length - 1].overlay.sequence : -1;
|
|
52
|
+
}
|
|
53
|
+
document.addEventListener('keydown', event => {
|
|
54
|
+
var _a, _b;
|
|
55
|
+
if (overlayStack.length > 0 && event.keyCode == 27 /* KEY_ESC */) {
|
|
56
|
+
((_b = (_a = history.state) === null || _a === void 0 ? void 0 : _a.overlay) === null || _b === void 0 ? void 0 : _b.escapable) && history.back();
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
const historyHandler = (location, event) => {
|
|
60
|
+
var navigated = event instanceof PopStateEvent;
|
|
61
|
+
var state = history.state;
|
|
62
|
+
var overlay = state === null || state === void 0 ? void 0 : state.overlay;
|
|
63
|
+
var sequence = (overlay === null || overlay === void 0 ? void 0 : overlay.sequence) || -1;
|
|
64
|
+
var lastSequence = getLastSequence();
|
|
65
|
+
if (overlayStack.length > 0 && sequence < lastSequence) {
|
|
66
|
+
/* overlay 관련 history가 아닌 경우. */
|
|
67
|
+
do {
|
|
68
|
+
let { overlay } = overlayStack.pop();
|
|
69
|
+
store.dispatch({
|
|
70
|
+
type: UPDATE_VIEWPART,
|
|
71
|
+
name: overlay.name,
|
|
72
|
+
override: { show: false }
|
|
73
|
+
});
|
|
74
|
+
lastSequence = getLastSequence();
|
|
75
|
+
} while (sequence < lastSequence);
|
|
76
|
+
}
|
|
77
|
+
if (!navigated && overlay) {
|
|
78
|
+
overlayStack.push({ ...state });
|
|
79
|
+
store.dispatch({
|
|
80
|
+
type: UPDATE_VIEWPART,
|
|
81
|
+
name: overlay.name,
|
|
82
|
+
override: { show: true }
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
store.dispatch({
|
|
87
|
+
type: REGISTER_NAVIGATION_CALLBACK,
|
|
88
|
+
callback: historyHandler
|
|
89
|
+
});
|
|
90
|
+
export default store;
|
|
91
|
+
//# sourceMappingURL=initializer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initializer.js","sourceRoot":"","sources":["../../src/initializer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAEpE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACvG,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,MAAM,MAAM,mBAAmB,CAAA;AACtC,OAAO,QAAQ,MAAM,qBAAqB,CAAA;AAE1C,KAAK,CAAC,WAAW,CAAC;IAChB,MAAM;IACN,QAAQ;CACT,CAAC,CAAA;AAEF,QAAQ,CAAC,gBAAgB,CAAC,c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,CAAC,IAAI,QAAQ,GAAG,YAAY,EAAE;QACtD,gCAAgC;QAChC,GAAG;YACD,IAAI,EAAE,OAAO,EAAE,GAAG,YAAY,CAAC,GAAG,EAAE,CAAA;YACpC,KAAK,CAAC,QAAQ,CAAC;gBACb,IAAI,EAAE,eAAe;gBACrB,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,QAAQ,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE;aAC1B,CAAC,CAAA;YAEF,YAAY,GAAG,eAAe,EAAE,CAAA;SACjC,QAAQ,QAAQ,GAAG,YAAY,EAAC;KAClC;IAED,IAAI,CAAC,SAAS,IAAI,OAAO,EAAE;QACzB,YAAY,CAAC,IAAI,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC,CAAA;QAE/B,KAAK,CAAC,QAAQ,CAAC;YACb,IAAI,EAAE,eAAe;YACrB,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,QAAQ,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;SACzB,CAAC,CAAA;KACH;AACH,CAAC,CAAA;AAED,KAAK,CAAC,QAAQ,CAAC;IACb,IAAI,EAAE,4BAA4B;IAClC,QAAQ,EAAE,cAAc;CACzB,CAAC,CAAA;AAEF,eAAe,KAAK,CAAA","sourcesContent":["import { REGISTER_NAVIGATION_CALLBACK, store } from '@operato/shell'\n\nimport { closeOverlay, openOverlay, openPopup, toggleOverlay, UPDATE_VIEWPART } from './actions/layout'\nimport { showSnackbar } from './actions/snackbar'\nimport layout from './reducers/layout'\nimport snackbar from './reducers/snackbar'\n\nstore.addReducers({\n layout,\n snackbar\n})\n\ndocument.addEventListener('open-overlay', event => {\n const { name, options } = (event as CustomEvent).detail\n openOverlay(name, options)\n})\n\ndocument.addEventListener('close-overlay', event => {\n const { name } = (event as CustomEvent).detail\n closeOverlay(name)\n})\n\ndocument.addEventListener('toggle-overlay', event => {\n const { name, options } = (event as CustomEvent).detail\n toggleOverlay(name, options)\n})\n\ndocument.addEventListener('open-popup', event => {\n const { template, options, callback } = (event as CustomEvent).detail\n var popup = openPopup(template, options)\n if (popup && callback) callback(popup)\n})\n\ndocument.addEventListener('notify', event => {\n let { message, level, ex = '', option = {} } = (event as CustomEvent).detail\n\n switch (level) {\n case 'error':\n console.error(message, ex)\n break\n case 'warn':\n console.warn(message, ex)\n break\n case 'info':\n console.info(message)\n break\n default:\n break\n }\n\n store.dispatch(\n showSnackbar(level, {\n message,\n ...(option as {\n action?: any\n timer?: number\n })\n }) as any\n )\n})\n\n/* overlay handling */\nvar overlayStack: any[] = []\nfunction getLastSequence() {\n return overlayStack.length > 0 ? overlayStack[overlayStack.length - 1].overlay.sequence : -1\n}\n\ndocument.addEventListener('keydown', event => {\n if (overlayStack.length > 0 && event.keyCode == 27 /* KEY_ESC */) {\n history.state?.overlay?.escapable && history.back()\n }\n})\n\nconst historyHandler = (location: string, event: Event) => {\n var navigated = event instanceof PopStateEvent\n\n var state = history.state\n var overlay = state?.overlay\n var sequence = overlay?.sequence || -1\n\n var lastSequence = getLastSequence()\n\n if (overlayStack.length > 0 && sequence < lastSequence) {\n /* overlay 관련 history가 아닌 경우. */\n do {\n let { overlay } = overlayStack.pop()\n store.dispatch({\n type: UPDATE_VIEWPART,\n name: overlay.name,\n override: { show: false }\n })\n\n lastSequence = getLastSequence()\n } while (sequence < lastSequence)\n }\n\n if (!navigated && overlay) {\n overlayStack.push({ ...state })\n\n store.dispatch({\n type: UPDATE_VIEWPART,\n name: overlay.name,\n override: { show: true }\n })\n }\n}\n\nstore.dispatch({\n type: REGISTER_NAVIGATION_CALLBACK,\n callback: historyHandler\n})\n\nexport default store\n"]}
|