@operato/popup 1.0.0-beta.39 → 1.0.0-beta.41
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 +17 -0
- package/assets/images/no-image.png +0 -0
- package/dist/src/index.d.ts +5 -4
- package/dist/src/index.js +5 -4
- package/dist/src/index.js.map +1 -1
- package/dist/src/open-popup.d.ts +59 -0
- package/dist/src/open-popup.js +84 -0
- package/dist/src/open-popup.js.map +1 -0
- package/dist/src/ox-floating-overlay.d.ts +21 -0
- package/dist/src/ox-floating-overlay.js +349 -0
- package/dist/src/ox-floating-overlay.js.map +1 -0
- package/dist/src/ox-popup.js +4 -2
- package/dist/src/ox-popup.js.map +1 -1
- package/dist/stories/open-popup.stories.d.ts +46 -0
- package/dist/stories/open-popup.stories.js +51 -0
- package/dist/stories/open-popup.stories.js.map +1 -0
- package/dist/stories/ox-popup-list.stories.d.ts +18 -0
- package/dist/stories/ox-popup-list.stories.js +50 -0
- package/dist/stories/ox-popup-list.stories.js.map +1 -0
- package/dist/stories/ox-popup-menu.stories.d.ts +19 -0
- package/dist/stories/ox-popup-menu.stories.js +131 -0
- package/dist/stories/ox-popup-menu.stories.js.map +1 -0
- package/dist/stories/ox-popup.stories.d.ts +15 -0
- package/dist/stories/ox-popup.stories.js +32 -0
- package/dist/stories/ox-popup.stories.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -4
- package/src/index.ts +6 -4
- package/src/open-popup.ts +140 -0
- package/src/ox-floating-overlay.ts +330 -0
- package/src/ox-popup.ts +4 -2
- package/stories/open-popup.stories.ts +81 -0
- package/stories/ox-popup-list.stories.ts +65 -0
- package/stories/ox-popup-menu.stories.ts +145 -0
- package/stories/ox-popup.stories.ts +46 -0
- package/themes/app-theme.css +142 -0
- package/themes/input-theme.css +19 -0
- 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/stories/index.stories.ts +0 -52
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,23 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.0.0-beta.41](https://github.com/hatiolab/operato/compare/v1.0.0-beta.40...v1.0.0-beta.41) (2022-06-30)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @operato/popup
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [1.0.0-beta.40](https://github.com/hatiolab/operato/compare/v1.0.0-beta.39...v1.0.0-beta.40) (2022-06-29)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### :bug: Bug Fix
|
|
18
|
+
|
|
19
|
+
* [#43](https://github.com/hatiolab/operato/issues/43)-datasample ([14ab019](https://github.com/hatiolab/operato/commit/14ab0199311f340c784018b9fc78b70e57b09567))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
6
23
|
## [1.0.0-beta.39](https://github.com/hatiolab/operato/compare/v1.0.0-beta.38...v1.0.0-beta.39) (2022-06-22)
|
|
7
24
|
|
|
8
25
|
**Note:** Version bump only for package @operato/popup
|
|
Binary file
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export * from './ox-popup';
|
|
2
|
-
export * from './ox-popup-list';
|
|
3
|
-
export * from './ox-popup-menu';
|
|
4
|
-
export * from './ox-popup-menuitem';
|
|
1
|
+
export * from './ox-popup.js';
|
|
2
|
+
export * from './ox-popup-list.js';
|
|
3
|
+
export * from './ox-popup-menu.js';
|
|
4
|
+
export * from './ox-popup-menuitem.js';
|
|
5
|
+
export * from './open-popup.js';
|
package/dist/src/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export * from './ox-popup';
|
|
2
|
-
export * from './ox-popup-list';
|
|
3
|
-
export * from './ox-popup-menu';
|
|
4
|
-
export * from './ox-popup-menuitem';
|
|
1
|
+
export * from './ox-popup.js';
|
|
2
|
+
export * from './ox-popup-list.js';
|
|
3
|
+
export * from './ox-popup-menu.js';
|
|
4
|
+
export * from './ox-popup-menuitem.js';
|
|
5
|
+
export * from './open-popup.js';
|
|
5
6
|
//# 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,cAAc,eAAe,CAAA;AAC7B,cAAc,oBAAoB,CAAA;AAClC,cAAc,oBAAoB,CAAA;AAClC,cAAc,wBAAwB,CAAA;AAEtC,cAAc,iBAAiB,CAAA","sourcesContent":["export * from './ox-popup.js'\nexport * from './ox-popup-list.js'\nexport * from './ox-popup-menu.js'\nexport * from './ox-popup-menuitem.js'\n\nexport * from './open-popup.js'\n"]}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import './ox-floating-overlay.js';
|
|
2
|
+
import { TemplateResult } from 'lit';
|
|
3
|
+
/**
|
|
4
|
+
* Options for popup
|
|
5
|
+
*
|
|
6
|
+
* @typedef {Object} PopupOptions
|
|
7
|
+
* @property {String} [title] - popup title
|
|
8
|
+
* @property {'center' | 'next' | 'edge'} [hovering] - hovering position (default: 'center'). 'edge' : edge of the HEADERBAR, 'next' : next of the clicked position.
|
|
9
|
+
* @property {'large' | 'medium' | small'} [size] - popup size
|
|
10
|
+
* @property {Boolean} [closable] - set whether the close 'X' button is shown on top-right most position (default true)
|
|
11
|
+
* @property {Boolean} [escapable] - set whether the close popup with 'ESC' key (default true)
|
|
12
|
+
* @property {Boolean} [backdrop] - set whether to do background masking around the pop-up. If true, it becomes modal (default true)
|
|
13
|
+
*/
|
|
14
|
+
export declare type PopupOptions = {
|
|
15
|
+
title?: string;
|
|
16
|
+
hovering?: 'center' | 'next' | 'edge';
|
|
17
|
+
size?: 'large' | 'medium' | 'small';
|
|
18
|
+
closable?: boolean;
|
|
19
|
+
escapable?: boolean;
|
|
20
|
+
backdrop?: boolean;
|
|
21
|
+
help?: string;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Popup handle object that will be returned openPopup
|
|
25
|
+
*
|
|
26
|
+
* @typedef {Object} PopupHandle
|
|
27
|
+
* @property {String} [name] - popup instance name
|
|
28
|
+
* @property {Function} [close] - call this function to close the popup.
|
|
29
|
+
* @property {Boolean} [closed] - state telling whether the popup is closed or not.
|
|
30
|
+
* @property {Function} [onclosed] - set callback function on close. It will be called when the popup about to close.
|
|
31
|
+
*/
|
|
32
|
+
export declare type PopupHandle = {
|
|
33
|
+
name: string;
|
|
34
|
+
close: () => void;
|
|
35
|
+
closed: boolean;
|
|
36
|
+
onclosed?: () => void;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* replace default openPopup implementation
|
|
40
|
+
*
|
|
41
|
+
* @param {(template: TemplateResult, options: PopupOptions) => PopupHandle} implementation
|
|
42
|
+
*/
|
|
43
|
+
export declare function setOpenPopupImplementation(implementation: (template: TemplateResult, options: PopupOptions) => PopupHandle): void;
|
|
44
|
+
/**
|
|
45
|
+
* open popup out of operato application environment
|
|
46
|
+
*
|
|
47
|
+
* @param {*} template html template to be rendered inside the popup
|
|
48
|
+
* @param {PopupOptions} options
|
|
49
|
+
* @returns popup handle object. This object is used to close the popup.
|
|
50
|
+
*/
|
|
51
|
+
export declare const openPopup: (template: TemplateResult, options?: PopupOptions) => PopupHandle;
|
|
52
|
+
/**
|
|
53
|
+
* open popup out of operato application environment
|
|
54
|
+
*
|
|
55
|
+
* @param {*} template html template to be rendered inside the popup
|
|
56
|
+
* @param {PopupOptions} options
|
|
57
|
+
* @returns popup handle object. This object is used to close the popup.
|
|
58
|
+
*/
|
|
59
|
+
export declare const closePopup: (element: HTMLElement) => void;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import './ox-floating-overlay.js';
|
|
2
|
+
import { html, render } from 'lit';
|
|
3
|
+
/*
|
|
4
|
+
* popup handling
|
|
5
|
+
*
|
|
6
|
+
* popup은 overlay의 특별한 형태이다.
|
|
7
|
+
* popup은 open될 때, viewpart를 append 하며, close 될 때 viewpart를 remove 한다.
|
|
8
|
+
* - name: '$popup-${popupSequence}'
|
|
9
|
+
* - position: VIEWPART_POSITION_HEADERBAR
|
|
10
|
+
* - hovering: 'center' | 'next' | 'edge'
|
|
11
|
+
*/
|
|
12
|
+
var popupSequence = 0;
|
|
13
|
+
/**
|
|
14
|
+
* default openPopup implementation for operato application environment
|
|
15
|
+
*
|
|
16
|
+
* @param {*} template html template to be rendered inside the popup
|
|
17
|
+
* @param {PopupOptions} options
|
|
18
|
+
* @returns popup handle object. This object is used to close the popup.
|
|
19
|
+
*/
|
|
20
|
+
function defaultOpenPopup(template, options = {}) {
|
|
21
|
+
const { title, size = 'large', closable = false, escapable = false, help, hovering, backdrop } = options;
|
|
22
|
+
const name = `$popup-${popupSequence++}`;
|
|
23
|
+
render(html `
|
|
24
|
+
<ox-floating-overlay
|
|
25
|
+
id=${name}
|
|
26
|
+
name=${name}
|
|
27
|
+
.backdrop=${backdrop}
|
|
28
|
+
direction="down"
|
|
29
|
+
.hovering=${hovering}
|
|
30
|
+
.title=${title}
|
|
31
|
+
.help=${help}
|
|
32
|
+
.size=${size}
|
|
33
|
+
.closable=${closable}
|
|
34
|
+
.historical=${false}
|
|
35
|
+
>${template}</ox-floating-overlay
|
|
36
|
+
>
|
|
37
|
+
`, document.body);
|
|
38
|
+
requestAnimationFrame(() => {
|
|
39
|
+
dispatchEvent(new Event('resize'));
|
|
40
|
+
});
|
|
41
|
+
const popupHandle = {
|
|
42
|
+
name,
|
|
43
|
+
close: () => {
|
|
44
|
+
const popup = document.body.querySelector(`#${name}`);
|
|
45
|
+
popup === null || popup === void 0 ? void 0 : popup.close();
|
|
46
|
+
popupHandle.onclosed && popupHandle.onclosed();
|
|
47
|
+
},
|
|
48
|
+
closed: false
|
|
49
|
+
};
|
|
50
|
+
return popupHandle;
|
|
51
|
+
}
|
|
52
|
+
var openPopupImpl = defaultOpenPopup;
|
|
53
|
+
/**
|
|
54
|
+
* replace default openPopup implementation
|
|
55
|
+
*
|
|
56
|
+
* @param {(template: TemplateResult, options: PopupOptions) => PopupHandle} implementation
|
|
57
|
+
*/
|
|
58
|
+
export function setOpenPopupImplementation(implementation) {
|
|
59
|
+
openPopupImpl = implementation;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* open popup out of operato application environment
|
|
63
|
+
*
|
|
64
|
+
* @param {*} template html template to be rendered inside the popup
|
|
65
|
+
* @param {PopupOptions} options
|
|
66
|
+
* @returns popup handle object. This object is used to close the popup.
|
|
67
|
+
*/
|
|
68
|
+
export const openPopup = (template, options = {}) => {
|
|
69
|
+
return openPopupImpl(template, options);
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* open popup out of operato application environment
|
|
73
|
+
*
|
|
74
|
+
* @param {*} template html template to be rendered inside the popup
|
|
75
|
+
* @param {PopupOptions} options
|
|
76
|
+
* @returns popup handle object. This object is used to close the popup.
|
|
77
|
+
*/
|
|
78
|
+
export const closePopup = (element) => {
|
|
79
|
+
element.dispatchEvent(new CustomEvent('close-overlay', {
|
|
80
|
+
bubbles: true,
|
|
81
|
+
composed: true
|
|
82
|
+
}));
|
|
83
|
+
};
|
|
84
|
+
//# sourceMappingURL=open-popup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"open-popup.js","sourceRoot":"","sources":["../../src/open-popup.ts"],"names":[],"mappings":"AAAA,OAAO,0BAA0B,CAAA;AAEjC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAkB,MAAM,KAAK,CAAA;AAyClD;;;;;;;;GAQG;AACH,IAAI,aAAa,GAAG,CAAC,CAAA;AAErB;;;;;;GAMG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,CAAA;AACzC,CAAC,CAAA;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,OAAoB,EAAQ,EAAE;IACvD,OAAO,CAAC,aAAa,CACnB,IAAI,WAAW,CAAC,eAAe,EAAE;QAC/B,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,IAAI;KACf,CAAC,CACH,CAAA;AACH,CAAC,CAAA","sourcesContent":["import './ox-floating-overlay.js'\n\nimport { html, render, TemplateResult } from 'lit'\n\nimport { OxFloatingOverlay } from './ox-floating-overlay.js'\n\n/**\n * Options for popup\n *\n * @typedef {Object} PopupOptions\n * @property {String} [title] - popup title\n * @property {'center' | 'next' | 'edge'} [hovering] - hovering position (default: 'center'). 'edge' : edge of the HEADERBAR, 'next' : next of the clicked position.\n * @property {'large' | 'medium' | small'} [size] - popup size\n * @property {Boolean} [closable] - set whether the close 'X' button is shown on top-right most position (default true)\n * @property {Boolean} [escapable] - set whether the close popup with 'ESC' key (default true)\n * @property {Boolean} [backdrop] - set whether to do background masking around the pop-up. If true, it becomes modal (default true)\n */\nexport type PopupOptions = {\n title?: string\n hovering?: 'center' | 'next' | 'edge'\n size?: 'large' | 'medium' | 'small'\n closable?: boolean\n escapable?: boolean\n backdrop?: boolean\n help?: string\n}\n\n/**\n * Popup handle object that will be returned openPopup\n *\n * @typedef {Object} PopupHandle\n * @property {String} [name] - popup instance name\n * @property {Function} [close] - call this function to close the popup.\n * @property {Boolean} [closed] - state telling whether the popup is closed or not.\n * @property {Function} [onclosed] - set callback function on close. It will be called when the popup about to close.\n */\nexport type PopupHandle = {\n name: string\n close: () => void\n closed: boolean\n onclosed?: () => void\n}\n\n/*\n * popup handling\n *\n * popup은 overlay의 특별한 형태이다.\n * popup은 open될 때, viewpart를 append 하며, close 될 때 viewpart를 remove 한다.\n * - name: '$popup-${popupSequence}'\n * - position: VIEWPART_POSITION_HEADERBAR\n * - hovering: 'center' | 'next' | 'edge'\n */\nvar popupSequence = 0\n\n/**\n * default openPopup implementation for operato application environment\n *\n * @param {*} template html template to be rendered inside the popup\n * @param {PopupOptions} options\n * @returns popup handle object. This object is used to close the popup.\n */\nfunction defaultOpenPopup(template: TemplateResult, options: PopupOptions = {}): PopupHandle {\n const { title, size = 'large', closable = false, escapable = false, help, hovering, backdrop } = options\n const name = `$popup-${popupSequence++}`\n\n render(\n html`\n <ox-floating-overlay\n id=${name}\n name=${name}\n .backdrop=${backdrop}\n direction=\"down\"\n .hovering=${hovering}\n .title=${title}\n .help=${help}\n .size=${size}\n .closable=${closable}\n .historical=${false}\n >${template}</ox-floating-overlay\n >\n `,\n document.body\n )\n\n requestAnimationFrame(() => {\n dispatchEvent(new Event('resize'))\n })\n\n const popupHandle = {\n name,\n close: () => {\n const popup = document.body.querySelector(`#${name}`) as OxFloatingOverlay\n popup?.close()\n popupHandle.onclosed && popupHandle.onclosed()\n },\n closed: false\n } as PopupHandle\n\n return popupHandle\n}\n\nvar openPopupImpl: (template: TemplateResult, options: PopupOptions) => PopupHandle = defaultOpenPopup\n\n/**\n * replace default openPopup implementation\n *\n * @param {(template: TemplateResult, options: PopupOptions) => PopupHandle} implementation\n */\nexport function setOpenPopupImplementation(\n implementation: (template: TemplateResult, options: PopupOptions) => PopupHandle\n) {\n openPopupImpl = implementation\n}\n\n/**\n * open popup out of operato application environment\n *\n * @param {*} template html template to be rendered inside the popup\n * @param {PopupOptions} options\n * @returns popup handle object. This object is used to close the popup.\n */\nexport const openPopup = (template: TemplateResult, options: PopupOptions = {}): PopupHandle => {\n return openPopupImpl(template, options)\n}\n\n/**\n * open popup out of operato application environment\n *\n * @param {*} template html template to be rendered inside the popup\n * @param {PopupOptions} options\n * @returns popup handle object. This object is used to close the popup.\n */\nexport const closePopup = (element: HTMLElement): void => {\n element.dispatchEvent(\n new CustomEvent('close-overlay', {\n bubbles: true,\n composed: true\n })\n )\n}\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import '@material/mwc-icon';
|
|
2
|
+
import { LitElement, PropertyValues } from 'lit';
|
|
3
|
+
export declare class OxFloatingOverlay extends LitElement {
|
|
4
|
+
static styles: import("lit").CSSResult[];
|
|
5
|
+
backdrop?: boolean;
|
|
6
|
+
direction?: 'up' | 'down' | 'left' | 'right';
|
|
7
|
+
hovering?: 'center' | 'edge' | 'next';
|
|
8
|
+
size?: 'small' | 'medium' | 'large';
|
|
9
|
+
name?: string;
|
|
10
|
+
title: string;
|
|
11
|
+
closable?: boolean;
|
|
12
|
+
templateProperties: any;
|
|
13
|
+
help: any;
|
|
14
|
+
historical?: boolean;
|
|
15
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
16
|
+
updated(changes: PropertyValues<this>): void;
|
|
17
|
+
firstUpdated(): void;
|
|
18
|
+
disconnectedCallback(): void;
|
|
19
|
+
close(): void;
|
|
20
|
+
onClose(escape?: boolean): true | undefined;
|
|
21
|
+
}
|
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import '@material/mwc-icon';
|
|
3
|
+
import { css, html, LitElement } from 'lit';
|
|
4
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
5
|
+
import { ScrollbarStyles } from '@operato/styles';
|
|
6
|
+
let OxFloatingOverlay = class OxFloatingOverlay extends LitElement {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.backdrop = false;
|
|
10
|
+
this.title = '';
|
|
11
|
+
this.closable = false;
|
|
12
|
+
this.historical = 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 || 'medium'}
|
|
26
|
+
@close-overlay=${(e) => {
|
|
27
|
+
e.stopPropagation();
|
|
28
|
+
this.onClose();
|
|
29
|
+
}}
|
|
30
|
+
@transitionstart=${(e) => {
|
|
31
|
+
/* to hide scrollbar during transition */
|
|
32
|
+
;
|
|
33
|
+
e.target.removeAttribute('settled');
|
|
34
|
+
}}
|
|
35
|
+
@transitionend=${(e) => {
|
|
36
|
+
;
|
|
37
|
+
e.target.setAttribute('settled', '');
|
|
38
|
+
}}
|
|
39
|
+
>
|
|
40
|
+
<div header>
|
|
41
|
+
<mwc-icon @click=${() => this.onClose()} ?closable=${this.closable} historyback>arrow_back</mwc-icon>
|
|
42
|
+
<slot name="header">
|
|
43
|
+
${this.title || this.closable
|
|
44
|
+
? html `
|
|
45
|
+
<h1>
|
|
46
|
+
${this.title || ''} ${this.help
|
|
47
|
+
? html ` <ox-help-icon .topic=${this.help}></ox-help-icon>`
|
|
48
|
+
: html ``}
|
|
49
|
+
</h1>
|
|
50
|
+
`
|
|
51
|
+
: html ``}</slot
|
|
52
|
+
>
|
|
53
|
+
<mwc-icon @click=${() => this.onClose()} ?closable=${this.closable} close>close</mwc-icon>
|
|
54
|
+
</div>
|
|
55
|
+
|
|
56
|
+
<div content>
|
|
57
|
+
<slot> </slot>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
`;
|
|
61
|
+
}
|
|
62
|
+
updated(changes) {
|
|
63
|
+
if (changes.has('templateProperties') && this.templateProperties) {
|
|
64
|
+
var template = this.firstElementChild;
|
|
65
|
+
if (template) {
|
|
66
|
+
for (let prop in this.templateProperties) {
|
|
67
|
+
//@ts-ignore
|
|
68
|
+
template[prop] = this.templateProperties[prop];
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
firstUpdated() {
|
|
74
|
+
requestAnimationFrame(() => {
|
|
75
|
+
var _a;
|
|
76
|
+
/* transition(animation) 효과를 위해 'opened' 속성을 변화시킨다. */
|
|
77
|
+
(_a = this.renderRoot.querySelector('[overlayed]')) === null || _a === void 0 ? void 0 : _a.setAttribute('opened', 'true');
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
disconnectedCallback() {
|
|
81
|
+
document.dispatchEvent(new CustomEvent('overlay-closed', {
|
|
82
|
+
detail: this.name
|
|
83
|
+
}));
|
|
84
|
+
super.disconnectedCallback();
|
|
85
|
+
}
|
|
86
|
+
close() {
|
|
87
|
+
var _a;
|
|
88
|
+
(_a = this.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(this);
|
|
89
|
+
}
|
|
90
|
+
onClose(escape) {
|
|
91
|
+
/* 현재 overlay state를 확인해서, 자신이 포함하고 있는 템플릿인 경우에 history.back() 한다. */
|
|
92
|
+
if (this.historical) {
|
|
93
|
+
var state = history.state;
|
|
94
|
+
var overlay = (state || {}).overlay;
|
|
95
|
+
if (!overlay || overlay.name !== this.name) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
/* Backdrop click 경우는 escape 시도라고 정의한다. overlay 속성이 escapable이 아닌 경우에는 동작하지 않는다. */
|
|
99
|
+
if (escape && !overlay.escapable) {
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
history.back();
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
this.close();
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
OxFloatingOverlay.styles = [
|
|
110
|
+
ScrollbarStyles,
|
|
111
|
+
css `
|
|
112
|
+
/* for layout style */
|
|
113
|
+
:host {
|
|
114
|
+
position: relative;
|
|
115
|
+
z-index: 1;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
:host([hovering='edge']) {
|
|
119
|
+
/* edge hovering 인 경우에는 상위 relative position 크기와 위치를 반영한다. */
|
|
120
|
+
position: initial;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
#backdrop {
|
|
124
|
+
position: fixed;
|
|
125
|
+
left: 0;
|
|
126
|
+
top: 0;
|
|
127
|
+
|
|
128
|
+
width: 100vw;
|
|
129
|
+
height: 100vh;
|
|
130
|
+
|
|
131
|
+
background-color: var(--overlay-background-color);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
[overlayed] {
|
|
135
|
+
position: absolute;
|
|
136
|
+
|
|
137
|
+
display: flex;
|
|
138
|
+
flex-direction: column;
|
|
139
|
+
overflow: hidden;
|
|
140
|
+
background: transparent;
|
|
141
|
+
pointer-events: none;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
[overlayed][hovering='center'] {
|
|
145
|
+
position: fixed;
|
|
146
|
+
|
|
147
|
+
left: 50%;
|
|
148
|
+
top: 50%;
|
|
149
|
+
transform: translate(-50%, -50%);
|
|
150
|
+
|
|
151
|
+
opacity: 0;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
[overlayed][hovering='center'][opened] {
|
|
155
|
+
opacity: 1;
|
|
156
|
+
transition: opacity 0.3s ease-in;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
[hovering='center'] {
|
|
160
|
+
width: var(--overlay-center-normal-width, 60%);
|
|
161
|
+
height: var(--overlay-center-normal-height, 60%);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
[hovering='center'][size='small'] {
|
|
165
|
+
width: var(--overlay-center-small-width, 40%);
|
|
166
|
+
height: var(--overlay-center-small-height, 40%);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
[hovering='center'][size='large'] {
|
|
170
|
+
width: var(--overlay-center-large-width, 100%);
|
|
171
|
+
height: var(--overlay-center-large-height, 100%);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
[header] {
|
|
175
|
+
--help-icon-color: #fff;
|
|
176
|
+
--help-icon-hover-color: #fff;
|
|
177
|
+
|
|
178
|
+
pointer-events: initial;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
[content] {
|
|
182
|
+
flex: 1;
|
|
183
|
+
|
|
184
|
+
overflow: hidden;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
::slotted(*) {
|
|
188
|
+
box-sizing: border-box;
|
|
189
|
+
pointer-events: initial;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
[hovering='center'] [content] ::slotted(*) {
|
|
193
|
+
width: 100%;
|
|
194
|
+
height: 100%;
|
|
195
|
+
}
|
|
196
|
+
[direction='up'],
|
|
197
|
+
[direction='down'] {
|
|
198
|
+
width: 100%;
|
|
199
|
+
|
|
200
|
+
max-height: 0;
|
|
201
|
+
transition: max-height 0.7s ease-in;
|
|
202
|
+
}
|
|
203
|
+
[direction='up'] {
|
|
204
|
+
bottom: 0;
|
|
205
|
+
}
|
|
206
|
+
[direction='down'] {
|
|
207
|
+
top: 0;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
[direction='up'][opened],
|
|
211
|
+
[direction='down'][opened] {
|
|
212
|
+
max-height: 100vh;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
[settled][direction='down'] [content],
|
|
216
|
+
[settled][direction='up'] [content] {
|
|
217
|
+
overflow-y: auto;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
[direction='left'],
|
|
221
|
+
[direction='right'] {
|
|
222
|
+
height: 100%;
|
|
223
|
+
|
|
224
|
+
max-width: 0;
|
|
225
|
+
transition: max-width 0.5s ease-in;
|
|
226
|
+
}
|
|
227
|
+
[direction='left'] {
|
|
228
|
+
right: 0;
|
|
229
|
+
}
|
|
230
|
+
[direction='right'] {
|
|
231
|
+
left: 0;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
[direction='left'][opened],
|
|
235
|
+
[direction='right'][opened] {
|
|
236
|
+
max-width: 100vw;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
[settled][direction='left'] [content],
|
|
240
|
+
[settled][direction='right'] [content] {
|
|
241
|
+
overflow-x: auto;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
@media screen and (max-width: 460px) {
|
|
245
|
+
[direction='up'],
|
|
246
|
+
[direction='down'] {
|
|
247
|
+
max-height: 100vh;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
[direction='left'],
|
|
251
|
+
[direction='right'] {
|
|
252
|
+
max-width: 100vw;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
`,
|
|
256
|
+
css `
|
|
257
|
+
/* for header style */
|
|
258
|
+
[header] {
|
|
259
|
+
display: flex;
|
|
260
|
+
flex-direction: row;
|
|
261
|
+
align-items: center;
|
|
262
|
+
|
|
263
|
+
background-color: var(--overlay-header-background-color);
|
|
264
|
+
color: var(--overlay-header-color);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
slot[name='header'] {
|
|
268
|
+
flex: 1;
|
|
269
|
+
|
|
270
|
+
display: flex;
|
|
271
|
+
flex-direction: row;
|
|
272
|
+
align-items: center;
|
|
273
|
+
justify-content: center;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
[name='header']::slotted(*) {
|
|
277
|
+
margin: 0 auto;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
[name='header'] > h1 {
|
|
281
|
+
text-transform: capitalize;
|
|
282
|
+
font: var(--overlay-header-font);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
[historyback] {
|
|
286
|
+
margin-left: 10px;
|
|
287
|
+
margin-right: auto;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
[close] {
|
|
291
|
+
margin-left: auto;
|
|
292
|
+
margin-right: 10px;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
[historyback],
|
|
296
|
+
[close] {
|
|
297
|
+
display: none;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
[closable][close] {
|
|
301
|
+
display: block;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
@media screen and (max-width: 460px) {
|
|
305
|
+
[closable][historyback] {
|
|
306
|
+
display: block;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
[closable][close] {
|
|
310
|
+
display: none;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
`
|
|
314
|
+
];
|
|
315
|
+
__decorate([
|
|
316
|
+
property({ type: Boolean })
|
|
317
|
+
], OxFloatingOverlay.prototype, "backdrop", void 0);
|
|
318
|
+
__decorate([
|
|
319
|
+
property({ type: String })
|
|
320
|
+
], OxFloatingOverlay.prototype, "direction", void 0);
|
|
321
|
+
__decorate([
|
|
322
|
+
property({ type: String, reflect: true })
|
|
323
|
+
], OxFloatingOverlay.prototype, "hovering", void 0);
|
|
324
|
+
__decorate([
|
|
325
|
+
property({ type: String })
|
|
326
|
+
], OxFloatingOverlay.prototype, "size", void 0);
|
|
327
|
+
__decorate([
|
|
328
|
+
property({ type: String })
|
|
329
|
+
], OxFloatingOverlay.prototype, "name", void 0);
|
|
330
|
+
__decorate([
|
|
331
|
+
property({ type: String })
|
|
332
|
+
], OxFloatingOverlay.prototype, "title", void 0);
|
|
333
|
+
__decorate([
|
|
334
|
+
property({ type: Boolean })
|
|
335
|
+
], OxFloatingOverlay.prototype, "closable", void 0);
|
|
336
|
+
__decorate([
|
|
337
|
+
property({ type: Object })
|
|
338
|
+
], OxFloatingOverlay.prototype, "templateProperties", void 0);
|
|
339
|
+
__decorate([
|
|
340
|
+
property({ type: Object })
|
|
341
|
+
], OxFloatingOverlay.prototype, "help", void 0);
|
|
342
|
+
__decorate([
|
|
343
|
+
property({ type: Boolean })
|
|
344
|
+
], OxFloatingOverlay.prototype, "historical", void 0);
|
|
345
|
+
OxFloatingOverlay = __decorate([
|
|
346
|
+
customElement('ox-floating-overlay')
|
|
347
|
+
], OxFloatingOverlay);
|
|
348
|
+
export { OxFloatingOverlay };
|
|
349
|
+
//# sourceMappingURL=ox-floating-overlay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ox-floating-overlay.js","sourceRoot":"","sources":["../../src/ox-floating-overlay.ts"],"names":[],"mappings":";AAAA,OAAO,oBAAoB,CAAA;AAE3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;+CAAoC;AACnC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAAc;AACb;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDAAmB;AACjB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;mDAA2B;AAC3B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6DAAwB;AACvB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAAU;AACR;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;qDAA6B;AAzN9C,iBAAiB;IAD7B,aAAa,CAAC,qBAAqB,CAAC;GACxB,iBAAiB,CAiU7B;SAjUY,iBAAiB","sourcesContent":["import '@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')\nexport class OxFloatingOverlay 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' | 'next'\n @property({ type: String }) size?: 'small' | 'medium' | '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 @property({ type: Boolean }) historical?: boolean = false\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 || 'medium'}\n @close-overlay=${(e: Event) => {\n e.stopPropagation()\n this.onClose()\n }}\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 close() {\n this.parentElement?.removeChild(this)\n }\n\n onClose(escape?: boolean) {\n /* 현재 overlay state를 확인해서, 자신이 포함하고 있는 템플릿인 경우에 history.back() 한다. */\n\n if (this.historical) {\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 } else {\n this.close()\n }\n }\n}\n"]}
|
package/dist/src/ox-popup.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import {
|
|
2
|
+
import { css, html, LitElement } from 'lit';
|
|
3
|
+
import { render } from 'lit-html';
|
|
3
4
|
import { customElement, state } from 'lit/decorators.js';
|
|
4
5
|
import { ScrollbarStyles } from '@operato/styles';
|
|
5
|
-
import { render } from 'lit-html';
|
|
6
6
|
let OxPopup = class OxPopup extends LitElement {
|
|
7
7
|
constructor() {
|
|
8
8
|
super(...arguments);
|
|
@@ -158,6 +158,8 @@ OxPopup.styles = [
|
|
|
158
158
|
box-shadow: 2px 3px 10px 5px rgba(0, 0, 0, 0.15);
|
|
159
159
|
box-sizing: border-box;
|
|
160
160
|
min-width: fit-content;
|
|
161
|
+
line-height: initial;
|
|
162
|
+
text-align: initial;
|
|
161
163
|
}
|
|
162
164
|
|
|
163
165
|
:host([active]) {
|