@operato/layout 1.0.0-beta.8 → 1.0.1

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.
@@ -1,333 +0,0 @@
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 || ''}&nbsp;${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-floating-overlay.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AE,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 || ''}&nbsp;${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"]}
@@ -1,319 +0,0 @@
1
- import '@operato/help/ox-help-icon.js'
2
- import '@material/mwc-icon'
3
-
4
- import { css, html, LitElement, PropertyValues } from 'lit'
5
- import { customElement, property } from 'lit/decorators.js'
6
-
7
- import { ScrollbarStyles } from '@operato/styles'
8
-
9
- @customElement('ox-floating-overlay')
10
- class FloatingOverlay extends LitElement {
11
- static styles = [
12
- ScrollbarStyles,
13
- css`
14
- /* for layout style */
15
- :host {
16
- position: relative;
17
- z-index: 1;
18
- }
19
-
20
- :host([hovering='edge']) {
21
- /* edge hovering 인 경우에는 상위 relative position 크기와 위치를 반영한다. */
22
- position: initial;
23
- }
24
-
25
- #backdrop {
26
- position: fixed;
27
- left: 0;
28
- top: 0;
29
-
30
- width: 100vw;
31
- height: 100vh;
32
-
33
- background-color: var(--overlay-background-color);
34
- }
35
-
36
- [overlayed] {
37
- position: absolute;
38
-
39
- display: flex;
40
- flex-direction: column;
41
- overflow: hidden;
42
- background: transparent;
43
- pointer-events: none;
44
- }
45
-
46
- [overlayed][hovering='center'] {
47
- position: fixed;
48
-
49
- left: 50%;
50
- top: 50%;
51
- transform: translate(-50%, -50%);
52
-
53
- opacity: 0;
54
- }
55
-
56
- [overlayed][hovering='center'][opened] {
57
- opacity: 1;
58
- transition: opacity 0.3s ease-in;
59
- }
60
-
61
- [hovering='center'] {
62
- width: var(--overlay-center-normal-width, 60%);
63
- height: var(--overlay-center-normal-height, 60%);
64
- }
65
-
66
- [hovering='center'][size='small'] {
67
- width: var(--overlay-center-small-width, 40%);
68
- height: var(--overlay-center-small-height, 40%);
69
- }
70
-
71
- [hovering='center'][size='large'] {
72
- width: var(--overlay-center-large-width, 100%);
73
- height: var(--overlay-center-large-height, 100%);
74
- }
75
-
76
- [header] {
77
- --help-icon-color: #fff;
78
- --help-icon-hover-color: #fff;
79
-
80
- pointer-events: initial;
81
- }
82
-
83
- [content] {
84
- flex: 1;
85
-
86
- overflow: hidden;
87
- }
88
-
89
- ::slotted(*) {
90
- box-sizing: border-box;
91
- pointer-events: initial;
92
- }
93
-
94
- [hovering='center'] [content] ::slotted(*) {
95
- width: 100%;
96
- height: 100%;
97
- }
98
- [direction='up'],
99
- [direction='down'] {
100
- width: 100%;
101
-
102
- max-height: 0;
103
- transition: max-height 0.7s ease-in;
104
- }
105
- [direction='up'] {
106
- bottom: 0;
107
- }
108
- [direction='down'] {
109
- top: 0;
110
- }
111
-
112
- [direction='up'][opened],
113
- [direction='down'][opened] {
114
- max-height: 100vh;
115
- }
116
-
117
- [settled][direction='down'] [content],
118
- [settled][direction='up'] [content] {
119
- overflow-y: auto;
120
- }
121
-
122
- [direction='left'],
123
- [direction='right'] {
124
- height: 100%;
125
-
126
- max-width: 0;
127
- transition: max-width 0.5s ease-in;
128
- }
129
- [direction='left'] {
130
- right: 0;
131
- }
132
- [direction='right'] {
133
- left: 0;
134
- }
135
-
136
- [direction='left'][opened],
137
- [direction='right'][opened] {
138
- max-width: 100vw;
139
- }
140
-
141
- [settled][direction='left'] [content],
142
- [settled][direction='right'] [content] {
143
- overflow-x: auto;
144
- }
145
-
146
- @media screen and (max-width: 460px) {
147
- [direction='up'],
148
- [direction='down'] {
149
- max-height: 100vh;
150
- }
151
-
152
- [direction='left'],
153
- [direction='right'] {
154
- max-width: 100vw;
155
- }
156
- }
157
- `,
158
- css`
159
- /* for header style */
160
- [header] {
161
- display: flex;
162
- flex-direction: row;
163
- align-items: center;
164
-
165
- background-color: var(--overlay-header-background-color);
166
- color: var(--overlay-header-color);
167
- }
168
-
169
- slot[name='header'] {
170
- flex: 1;
171
-
172
- display: flex;
173
- flex-direction: row;
174
- align-items: center;
175
- justify-content: center;
176
- }
177
-
178
- [name='header']::slotted(*) {
179
- margin: 0 auto;
180
- }
181
-
182
- [name='header'] > h1 {
183
- text-transform: capitalize;
184
- font: var(--overlay-header-font);
185
- }
186
-
187
- [historyback] {
188
- margin-left: 10px;
189
- margin-right: auto;
190
- }
191
-
192
- [close] {
193
- margin-left: auto;
194
- margin-right: 10px;
195
- }
196
-
197
- [historyback],
198
- [close] {
199
- display: none;
200
- }
201
-
202
- [closable][close] {
203
- display: block;
204
- }
205
-
206
- @media screen and (max-width: 460px) {
207
- [closable][historyback] {
208
- display: block;
209
- }
210
-
211
- [closable][close] {
212
- display: none;
213
- }
214
- }
215
- `
216
- ]
217
-
218
- @property({ type: Boolean }) backdrop: boolean = false
219
- @property({ type: String }) direction?: 'up' | 'down' | 'left' | 'right'
220
- @property({ type: String, reflect: true }) hovering?: 'center' | 'edge'
221
- @property({ type: String }) size?: 'small' | 'normal' | 'large'
222
- @property({ type: String }) name?: string
223
- @property({ type: String }) title: string = ''
224
- @property({ type: Boolean }) closable: boolean = false
225
- @property({ type: Object }) templateProperties: any
226
- @property({ type: Object }) help: any
227
-
228
- render() {
229
- var direction = this.hovering == 'center' ? false : this.direction
230
-
231
- return html`
232
- ${Boolean(this.backdrop)
233
- ? html` <div id="backdrop" ?hidden=${!this.backdrop} @click=${() => this.onClose(true)}></div> `
234
- : html``}
235
-
236
- <div
237
- overlayed
238
- hovering=${this.hovering || 'center'}
239
- direction=${direction}
240
- size=${this.size || 'normal'}
241
- @close-overlay=${() => this.onClose()}
242
- @transitionstart=${(e: Event) => {
243
- /* to hide scrollbar during transition */
244
- ;(e.target as HTMLElement).removeAttribute('settled')
245
- }}
246
- @transitionend=${(e: Event) => {
247
- ;(e.target as HTMLElement).setAttribute('settled', '')
248
- }}
249
- >
250
- <div header>
251
- <mwc-icon @click=${() => this.onClose()} ?closable=${this.closable} historyback>arrow_back</mwc-icon>
252
- <slot name="header">
253
- ${this.title || this.closable
254
- ? html`
255
- <h1>
256
- ${this.title || ''}&nbsp;${this.help
257
- ? html` <ox-help-icon .topic=${this.help}></ox-help-icon>`
258
- : html``}
259
- </h1>
260
- `
261
- : html``}</slot
262
- >
263
- <mwc-icon @click=${() => this.onClose()} ?closable=${this.closable} close>close</mwc-icon>
264
- </div>
265
-
266
- <div content>
267
- <slot> </slot>
268
- </div>
269
- </div>
270
- `
271
- }
272
-
273
- updated(changes: PropertyValues<this>) {
274
- if (changes.has('templateProperties') && this.templateProperties) {
275
- var template = this.firstElementChild
276
- if (template) {
277
- for (let prop in this.templateProperties) {
278
- //@ts-ignore
279
- template[prop] = this.templateProperties[prop]
280
- }
281
- }
282
- }
283
- }
284
-
285
- firstUpdated() {
286
- requestAnimationFrame(() => {
287
- /* transition(animation) 효과를 위해 'opened' 속성을 변화시킨다. */
288
- this.renderRoot.querySelector('[overlayed]')?.setAttribute('opened', 'true')
289
- })
290
- }
291
-
292
- disconnectedCallback() {
293
- document.dispatchEvent(
294
- new CustomEvent('overlay-closed', {
295
- detail: this.name
296
- })
297
- )
298
-
299
- super.disconnectedCallback()
300
- }
301
-
302
- onClose(escape?: boolean) {
303
- /* 현재 overlay state를 확인해서, 자신이 포함하고 있는 템플릿인 경우에 history.back() 한다. */
304
-
305
- var state = history.state
306
- var overlay = (state || {}).overlay
307
-
308
- if (!overlay || overlay.name !== this.name) {
309
- return
310
- }
311
-
312
- /* Backdrop click 경우는 escape 시도라고 정의한다. overlay 속성이 escapable이 아닌 경우에는 동작하지 않는다. */
313
- if (escape && !overlay.escapable) {
314
- return true
315
- }
316
-
317
- history.back()
318
- }
319
- }