@quandis/qbo4.ui 4.0.1-CI-20241107-011209 → 4.0.1-CI-20241108-002603
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/package.json +2 -1
- package/scss/qbo.scss +466 -24
- package/src/qbo/qbo-api.js +5 -7
- package/src/qbo/qbo-api.ts +2 -1
- package/src/qbo/qbo-card.js +5 -7
- package/src/qbo/qbo-card.ts +4 -2
- package/src/qbo/qbo-contextmenu.js +5 -7
- package/src/qbo/qbo-contextmenu.ts +3 -1
- package/src/qbo/qbo-datalist.js +5 -7
- package/src/qbo/qbo-datalist.ts +4 -2
- package/src/qbo/qbo-docviewer.js +5 -7
- package/src/qbo/qbo-docviewer.ts +3 -1
- package/src/qbo/qbo-fetch.js +4 -0
- package/src/qbo/qbo-fetch.ts +3 -0
- package/src/qbo/qbo-form-edit.js +5 -7
- package/src/qbo/qbo-form-edit.ts +3 -1
- package/src/qbo/qbo-form-element.js +7 -12
- package/src/qbo/qbo-form-element.ts +2 -1
- package/src/qbo/qbo-icon.js +7 -11
- package/src/qbo/qbo-icon.ts +3 -1
- package/src/qbo/qbo-menu.d.ts +17 -15
- package/src/qbo/qbo-menu.js +88 -115
- package/src/qbo/qbo-menu.ts +95 -120
- package/src/qbo/qbo-microphone.js +7 -11
- package/src/qbo/qbo-microphone.ts +3 -1
- package/src/qbo/qbo-paginate.js +5 -7
- package/src/qbo/qbo-paginate.ts +3 -1
- package/src/qbo/qbo-popover.d.ts +13 -17
- package/src/qbo/qbo-popover.js +67 -80
- package/src/qbo/qbo-popover.ts +82 -54
- package/src/qbo/qbo-popup-listener.js +5 -7
- package/src/qbo/qbo-popup-listener.ts +3 -1
- package/src/qbo/qbo-popup.js +5 -7
- package/src/qbo/qbo-popup.ts +3 -1
- package/src/qbo/qbo-resize.js +5 -7
- package/src/qbo/qbo-resize.ts +3 -2
- package/src/qbo/qbo-select.js +5 -7
- package/src/qbo/qbo-select.ts +3 -1
- package/src/qbo/qbo-selectable.js +5 -7
- package/src/qbo/qbo-selectable.ts +3 -1
- package/src/qbo/qbo-table.js +5 -7
- package/src/qbo/qbo-table.ts +2 -1
- package/src/qbo/qbo-user-preferences.js +5 -8
- package/src/qbo/qbo-user-preferences.ts +3 -1
- package/src/qbo/qbo-validate.js +5 -8
- package/src/qbo/qbo-validate.ts +3 -1
- package/src/qbo/styles.js +2 -2
- package/src/qbo/styles.ts +2 -2
- package/wwwroot/css/qbo.css +448 -21
- package/wwwroot/css/qbo.css.map +1 -1
- package/wwwroot/css/qbo.min.css +1 -1
- package/wwwroot/css/qboui.css +450 -21
- package/wwwroot/css/qboui.css.map +1 -1
- package/wwwroot/css/qboui.min.css +1 -1
- package/wwwroot/favicon.ico +0 -0
- package/wwwroot/images/qbo-logo-new.svg +25 -0
- package/wwwroot/js/esm/qbo4.ui.js +2672 -7986
- package/wwwroot/js/esm/qbo4.ui.min.js +35 -48
- package/wwwroot/js/esm/qbo4.ui.min.js.LICENSE.txt +0 -6
- package/wwwroot/js/esm/qbo4.ui.min.js.map +1 -1
- package/wwwroot/js/qbo4.ui.js +2679 -8047
- package/wwwroot/js/qbo4.ui.min.js +43 -56
- package/wwwroot/js/qbo4.ui.min.js.LICENSE.txt +0 -6
- package/wwwroot/js/qbo4.ui.min.js.map +1 -1
package/src/qbo/qbo-menu.ts
CHANGED
|
@@ -1,151 +1,126 @@
|
|
|
1
|
-
import { LitElement, html, css } from
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { LitElement, PropertyValues, html, css, PropertyValueMap } from "lit";
|
|
2
|
+
import { property, query, state } from "lit/decorators.js";
|
|
3
|
+
import { computePosition, Placement, shift, flip } from "@floating-ui/dom";
|
|
4
4
|
|
|
5
|
-
@customElement('qbo-menu')
|
|
6
5
|
export class QboMenu extends LitElement {
|
|
7
|
-
|
|
6
|
+
// Define the placement property with type `string`
|
|
8
7
|
@property({ type: String })
|
|
9
|
-
|
|
8
|
+
placement: Placement = "bottom-start";
|
|
10
9
|
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
// Internal state to control menu visibility
|
|
11
|
+
@state() private isOpen = false;
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
13
|
+
// Query to find the trigger button and menu container in the shadow DOM
|
|
14
|
+
@query("slot") private slotElement!: HTMLSlotElement;
|
|
15
|
+
@query('slot[name="menu"]') private menuSlotElement!: HTMLSlotElement;
|
|
18
16
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
border: none;
|
|
23
|
-
font-size: 1.5rem;
|
|
24
|
-
cursor: pointer;
|
|
25
|
-
text-align: left;
|
|
26
|
-
}
|
|
27
|
-
`];
|
|
17
|
+
private triggerButton!: HTMLElement;
|
|
18
|
+
private menuContainer!: HTMLElement;
|
|
19
|
+
private middleware = [flip(), shift()];
|
|
28
20
|
|
|
29
|
-
|
|
30
|
-
this.expanded = !this.expanded;
|
|
31
|
-
}
|
|
21
|
+
static styles = css``;
|
|
32
22
|
|
|
33
23
|
connectedCallback() {
|
|
34
24
|
super.connectedCallback();
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
document.addEventListener('click', this.hideContextMenu);
|
|
38
|
-
this.contextParent?.addEventListener('contextmenu', this.showContextMenu);
|
|
39
|
-
break;
|
|
40
|
-
case 'side':
|
|
41
|
-
this.renderRoot.addEventListener('click', this.toggleSideMenu);
|
|
42
|
-
break;
|
|
43
|
-
}
|
|
25
|
+
// document.addEventListener("click", this.handleOutsideClick.bind);
|
|
26
|
+
document.addEventListener("qbo-menu-open", this.handleMenuOpen.bind(this));
|
|
44
27
|
}
|
|
45
28
|
|
|
46
29
|
disconnectedCallback() {
|
|
47
30
|
super.disconnectedCallback();
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
document.removeEventListener('click', this.hideContextMenu);
|
|
52
|
-
break;
|
|
53
|
-
case 'side':
|
|
54
|
-
this.renderRoot.removeEventListener('click', this.toggleSideMenu);
|
|
55
|
-
break;
|
|
56
|
-
}
|
|
31
|
+
// document.removeEventListener("click", this.handleOutsideClick);
|
|
32
|
+
document.removeEventListener("qbo-menu-open", this.handleMenuOpen);
|
|
33
|
+
this.triggerButton.removeEventListener("click", this.toggleMenu);
|
|
57
34
|
}
|
|
58
35
|
|
|
59
|
-
|
|
60
|
-
@property({ type: String })
|
|
61
|
-
target = '';
|
|
62
|
-
|
|
63
|
-
xcreateRenderRoot() {
|
|
64
|
-
return this; // : super.createRenderRoot();
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
private showContextMenu = (event: Event) => {
|
|
36
|
+
handleMenuOpen = (event: Event) => {
|
|
68
37
|
event.preventDefault();
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
38
|
+
event.stopPropagation();
|
|
39
|
+
const customEvent = event as CustomEvent;
|
|
40
|
+
if (customEvent.detail.menu !== this && this.isOpen) {
|
|
41
|
+
this.closeMenu();
|
|
72
42
|
}
|
|
73
|
-
}
|
|
43
|
+
};
|
|
74
44
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
45
|
+
handleOutsideClick = (event: Event) => {
|
|
46
|
+
const customEvent = event as PointerEvent;
|
|
47
|
+
const target = customEvent.target as HTMLElement;
|
|
48
|
+
if (target !== this && !this.contains(target)) {
|
|
49
|
+
this.closeMenu();
|
|
78
50
|
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
firstUpdated(changes: PropertyValues) {
|
|
54
|
+
super.firstUpdated(changes);
|
|
55
|
+
|
|
56
|
+
this.triggerButton =
|
|
57
|
+
this.querySelector("*[data-trigger]") ||
|
|
58
|
+
(this.querySelector("button") as HTMLElement) ||
|
|
59
|
+
this.parentElement;
|
|
60
|
+
this.menuContainer =
|
|
61
|
+
this.querySelector("*[data-content]") ||
|
|
62
|
+
this.querySelector("aside") ||
|
|
63
|
+
(this.querySelector("menu") as HTMLElement);
|
|
64
|
+
|
|
65
|
+
if (this.triggerButton != null)
|
|
66
|
+
this.triggerButton.addEventListener("click", this.toggleMenu);
|
|
79
67
|
}
|
|
80
68
|
|
|
81
|
-
|
|
82
|
-
event.
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
get contextParent(): HTMLElement | Document | null {
|
|
110
|
-
if (this.target) {
|
|
111
|
-
return (
|
|
112
|
-
this.closest(this.target) as HTMLElement ||
|
|
113
|
-
(() => {
|
|
114
|
-
const rootNode = this.getRootNode();
|
|
115
|
-
if (rootNode instanceof ShadowRoot || rootNode instanceof Document) {
|
|
116
|
-
return rootNode.querySelector(this.target);
|
|
117
|
-
}
|
|
118
|
-
return null;
|
|
119
|
-
})() ||
|
|
120
|
-
document.querySelector(this.target) ||
|
|
121
|
-
document
|
|
122
|
-
);
|
|
123
|
-
} else {
|
|
124
|
-
return this.parentElement;
|
|
69
|
+
toggleMenu = (event: Event) => {
|
|
70
|
+
if (event.target instanceof HTMLElement
|
|
71
|
+
|| event.target instanceof SVGElement
|
|
72
|
+
|| event.target instanceof SVGUseElement) {
|
|
73
|
+
let toggleMenu = true;
|
|
74
|
+
let parent = event.target.parentElement;
|
|
75
|
+
while (toggleMenu && parent) {
|
|
76
|
+
if (parent instanceof HTMLElement && parent.tagName.toLowerCase() == 'aside')
|
|
77
|
+
toggleMenu = false;
|
|
78
|
+
else
|
|
79
|
+
parent = parent.parentElement;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (toggleMenu) {
|
|
83
|
+
this.isOpen = !this.isOpen;
|
|
84
|
+
this.menuContainer.classList.toggle("open", this.isOpen);
|
|
85
|
+
|
|
86
|
+
if (this.isOpen) {
|
|
87
|
+
this.updateMenuPosition();
|
|
88
|
+
document.dispatchEvent(
|
|
89
|
+
new CustomEvent("qbo-menu-open", {
|
|
90
|
+
bubbles: true,
|
|
91
|
+
composed: true,
|
|
92
|
+
detail: { menu: this },
|
|
93
|
+
})
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
125
97
|
}
|
|
126
|
-
}
|
|
98
|
+
};
|
|
127
99
|
|
|
128
|
-
|
|
129
|
-
|
|
100
|
+
closeMenu() {
|
|
101
|
+
this.isOpen = false;
|
|
102
|
+
this.menuContainer.classList.remove("open");
|
|
130
103
|
}
|
|
131
104
|
|
|
132
|
-
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
this.
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
105
|
+
private async updateMenuPosition() {
|
|
106
|
+
const { x, y } = await computePosition(
|
|
107
|
+
this.triggerButton,
|
|
108
|
+
this.menuContainer,
|
|
109
|
+
{
|
|
110
|
+
placement: this.placement as Placement | undefined,
|
|
111
|
+
middleware: this.middleware,
|
|
112
|
+
}
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
Object.assign(this.menuContainer.style, {
|
|
116
|
+
left: `${x}px`,
|
|
117
|
+
top: `${y}px`,
|
|
118
|
+
});
|
|
143
119
|
}
|
|
144
120
|
|
|
145
121
|
render() {
|
|
146
|
-
|
|
147
|
-
case 'side': return this.side();
|
|
148
|
-
case 'context': return this.context();
|
|
149
|
-
}
|
|
122
|
+
return html`<slot></slot>`;
|
|
150
123
|
}
|
|
151
124
|
}
|
|
125
|
+
|
|
126
|
+
if (!customElements.get("qbo-menu")) customElements.define("qbo-menu", QboMenu);
|
|
@@ -7,13 +7,12 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
|
-
var QboMicrophone_1;
|
|
11
10
|
import { html, LitElement } from 'lit';
|
|
12
|
-
import {
|
|
11
|
+
import { property } from 'lit/decorators.js';
|
|
13
12
|
/**
|
|
14
13
|
* Collect text input from the user.
|
|
15
14
|
*/
|
|
16
|
-
|
|
15
|
+
export class QboMicrophone extends LitElement {
|
|
17
16
|
constructor() {
|
|
18
17
|
super(...arguments);
|
|
19
18
|
this.renderInHost = true;
|
|
@@ -27,7 +26,6 @@ let QboMicrophone = class QboMicrophone extends LitElement {
|
|
|
27
26
|
this.target = null;
|
|
28
27
|
this.listening = false;
|
|
29
28
|
}
|
|
30
|
-
static { QboMicrophone_1 = this; }
|
|
31
29
|
static { this.activeInstance = null; }
|
|
32
30
|
connectedCallback() {
|
|
33
31
|
super.connectedCallback();
|
|
@@ -93,7 +91,7 @@ let QboMicrophone = class QboMicrophone extends LitElement {
|
|
|
93
91
|
}
|
|
94
92
|
start() {
|
|
95
93
|
this.listening = true;
|
|
96
|
-
|
|
94
|
+
QboMicrophone.activeInstance = this;
|
|
97
95
|
if (this.activeClass)
|
|
98
96
|
this.classList.add(this.activeClass);
|
|
99
97
|
console.log('listening');
|
|
@@ -101,7 +99,7 @@ let QboMicrophone = class QboMicrophone extends LitElement {
|
|
|
101
99
|
}
|
|
102
100
|
stop(e) {
|
|
103
101
|
this.listening = false;
|
|
104
|
-
|
|
102
|
+
QboMicrophone.activeInstance = null;
|
|
105
103
|
if (this.activeClass)
|
|
106
104
|
this.classList.remove(this.activeClass);
|
|
107
105
|
console.log('stopped listening');
|
|
@@ -114,7 +112,7 @@ let QboMicrophone = class QboMicrophone extends LitElement {
|
|
|
114
112
|
render() {
|
|
115
113
|
return html `<slot></slot>`;
|
|
116
114
|
}
|
|
117
|
-
}
|
|
115
|
+
}
|
|
118
116
|
__decorate([
|
|
119
117
|
property({ type: Boolean }),
|
|
120
118
|
__metadata("design:type", Object)
|
|
@@ -143,7 +141,5 @@ __decorate([
|
|
|
143
141
|
property({ type: String }),
|
|
144
142
|
__metadata("design:type", Object)
|
|
145
143
|
], QboMicrophone.prototype, "activeClass", void 0);
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
], QboMicrophone);
|
|
149
|
-
export { QboMicrophone };
|
|
144
|
+
if (!customElements.get('qbo-microphone'))
|
|
145
|
+
customElements.define('qbo-microphone', QboMicrophone);
|
|
@@ -11,7 +11,6 @@ declare global {
|
|
|
11
11
|
/**
|
|
12
12
|
* Collect text input from the user.
|
|
13
13
|
*/
|
|
14
|
-
@customElement('qbo-microphone')
|
|
15
14
|
export class QboMicrophone extends LitElement
|
|
16
15
|
{
|
|
17
16
|
static activeInstance: QboMicrophone | null = null;
|
|
@@ -135,3 +134,6 @@ export class QboMicrophone extends LitElement
|
|
|
135
134
|
return html`<slot></slot>`;
|
|
136
135
|
}
|
|
137
136
|
}
|
|
137
|
+
|
|
138
|
+
if (!customElements.get('qbo-microphone'))
|
|
139
|
+
customElements.define('qbo-microphone', QboMicrophone)
|
package/src/qbo/qbo-paginate.js
CHANGED
|
@@ -8,9 +8,9 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
10
|
import { html, css, LitElement } from 'lit';
|
|
11
|
-
import {
|
|
11
|
+
import { property } from 'lit/decorators.js';
|
|
12
12
|
import { qboui } from './styles.js';
|
|
13
|
-
|
|
13
|
+
export class QboPaginate extends LitElement {
|
|
14
14
|
constructor() {
|
|
15
15
|
super(...arguments);
|
|
16
16
|
this.display = 25;
|
|
@@ -104,7 +104,7 @@ let QboPaginate = class QboPaginate extends LitElement {
|
|
|
104
104
|
</ul>
|
|
105
105
|
</nav>`;
|
|
106
106
|
}
|
|
107
|
-
}
|
|
107
|
+
}
|
|
108
108
|
__decorate([
|
|
109
109
|
property({ type: Number }),
|
|
110
110
|
__metadata("design:type", Object)
|
|
@@ -133,7 +133,5 @@ __decorate([
|
|
|
133
133
|
property({ type: Boolean }),
|
|
134
134
|
__metadata("design:type", Object)
|
|
135
135
|
], QboPaginate.prototype, "editSize", void 0);
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
], QboPaginate);
|
|
139
|
-
export { QboPaginate };
|
|
136
|
+
if (!customElements.get('qbo-paginate'))
|
|
137
|
+
customElements.define('qbo-paginate', QboPaginate);
|
package/src/qbo/qbo-paginate.ts
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import { customElement, property } from 'lit/decorators.js';
|
|
3
3
|
import { qboui } from './styles.js';
|
|
4
4
|
|
|
5
|
-
@customElement('qbo-paginate')
|
|
6
5
|
export class QboPaginate extends LitElement {
|
|
7
6
|
@property({ type: Number })
|
|
8
7
|
display = 25;
|
|
@@ -120,3 +119,6 @@ export class QboPaginate extends LitElement {
|
|
|
120
119
|
}
|
|
121
120
|
|
|
122
121
|
}
|
|
122
|
+
|
|
123
|
+
if (!customElements.get('qbo-paginate'))
|
|
124
|
+
customElements.define('qbo-paginate', QboPaginate)
|
package/src/qbo/qbo-popover.d.ts
CHANGED
|
@@ -1,21 +1,17 @@
|
|
|
1
|
-
import { PropertyValues } from
|
|
2
|
-
import {
|
|
3
|
-
export declare class QboPopover extends
|
|
4
|
-
|
|
5
|
-
contentStyle: string;
|
|
6
|
-
containerAtt: string;
|
|
7
|
-
containerValue: string;
|
|
8
|
-
defaultContent: string;
|
|
9
|
-
htmlAtt: string;
|
|
10
|
-
htmlValue: string;
|
|
11
|
-
placementAtt: string;
|
|
12
|
-
placementValue: string;
|
|
1
|
+
import { LitElement, PropertyValues } from "lit";
|
|
2
|
+
import { Placement } from "@floating-ui/dom";
|
|
3
|
+
export declare class QboPopover extends LitElement {
|
|
4
|
+
placement: Placement;
|
|
13
5
|
selector: string;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
6
|
+
private isOpen;
|
|
7
|
+
private triggerElement;
|
|
8
|
+
private middleware;
|
|
9
|
+
private setPosition;
|
|
18
10
|
connectedCallback(): void;
|
|
19
|
-
|
|
11
|
+
disconnectedCallback(): void;
|
|
12
|
+
firstUpdated(changes: PropertyValues): void;
|
|
13
|
+
handleMenuOpen: (event: Event) => void;
|
|
14
|
+
toggleMenu: (event: Event) => void;
|
|
15
|
+
closeMenu(): void;
|
|
20
16
|
render(): import("lit-html").TemplateResult<1>;
|
|
21
17
|
}
|
package/src/qbo/qbo-popover.js
CHANGED
|
@@ -7,102 +7,89 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
|
-
import { html } from
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
let QboPopover = class QboPopover extends QboFormElement {
|
|
10
|
+
import { LitElement, html } from "lit";
|
|
11
|
+
import { property, state } from "lit/decorators.js";
|
|
12
|
+
import { computePosition, shift, flip } from "@floating-ui/dom";
|
|
13
|
+
export class QboPopover extends LitElement {
|
|
15
14
|
constructor() {
|
|
16
15
|
super(...arguments);
|
|
17
|
-
this.
|
|
18
|
-
this.
|
|
19
|
-
|
|
20
|
-
this.
|
|
21
|
-
this.
|
|
22
|
-
this.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
this.
|
|
29
|
-
|
|
16
|
+
this.placement = "bottom";
|
|
17
|
+
this.selector = '*[data-popover-trigger]';
|
|
18
|
+
// Internal state to control menu visibility
|
|
19
|
+
this.isOpen = false;
|
|
20
|
+
this.middleware = [flip(), shift()];
|
|
21
|
+
this.handleMenuOpen = (event) => {
|
|
22
|
+
event.preventDefault();
|
|
23
|
+
event.stopPropagation();
|
|
24
|
+
if (event.detail.menu !== this && this.isOpen)
|
|
25
|
+
this.closeMenu();
|
|
26
|
+
};
|
|
27
|
+
this.toggleMenu = (event) => {
|
|
28
|
+
this.isOpen = !this.isOpen;
|
|
29
|
+
this.classList.toggle("open", this.isOpen);
|
|
30
|
+
if (this.isOpen) {
|
|
31
|
+
this.setPosition();
|
|
32
|
+
document.dispatchEvent(new CustomEvent("qbo-popover-open", {
|
|
33
|
+
bubbles: true,
|
|
34
|
+
composed: true,
|
|
35
|
+
detail: { menu: this },
|
|
36
|
+
}));
|
|
37
|
+
}
|
|
38
|
+
};
|
|
30
39
|
}
|
|
31
|
-
|
|
32
|
-
|
|
40
|
+
async setPosition() {
|
|
41
|
+
const { x, y } = await computePosition(this.triggerElement, this, {
|
|
42
|
+
placement: this.placement,
|
|
43
|
+
middleware: this.middleware,
|
|
44
|
+
});
|
|
45
|
+
Object.assign(this.style, {
|
|
46
|
+
left: `${x}px`,
|
|
47
|
+
top: `${y}px`,
|
|
48
|
+
});
|
|
33
49
|
}
|
|
34
50
|
connectedCallback() {
|
|
35
51
|
super.connectedCallback();
|
|
36
|
-
|
|
37
|
-
this.setAttribute(this.placementAtt, this.placementValue);
|
|
38
|
-
this.setAttribute(this.containerAtt, this.containerValue);
|
|
39
|
-
this.setAttribute(this.htmlAtt, this.htmlValue);
|
|
52
|
+
document.addEventListener("qbo-popover-open", this.handleMenuOpen);
|
|
40
53
|
}
|
|
41
|
-
|
|
42
|
-
super.
|
|
43
|
-
|
|
44
|
-
if (
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
54
|
+
disconnectedCallback() {
|
|
55
|
+
super.disconnectedCallback();
|
|
56
|
+
document.removeEventListener("qbo-popover-open", this.handleMenuOpen);
|
|
57
|
+
if (this.triggerElement != null) {
|
|
58
|
+
this.triggerElement.removeEventListener("mouseover", this.toggleMenu);
|
|
59
|
+
this.triggerElement.removeEventListener("mouseout", this.toggleMenu);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
firstUpdated(changes) {
|
|
63
|
+
super.firstUpdated(changes);
|
|
64
|
+
this.triggerElement =
|
|
65
|
+
this.parentElement?.querySelector(this.selector) ||
|
|
66
|
+
this.shadowRoot?.querySelector(this.selector) ||
|
|
67
|
+
document.querySelector(this.selector) ||
|
|
68
|
+
this.parentElement;
|
|
69
|
+
if (this.triggerElement != null) {
|
|
70
|
+
this.triggerElement.addEventListener("mouseover", this.toggleMenu);
|
|
71
|
+
this.triggerElement.addEventListener("mouseout", this.toggleMenu);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
closeMenu() {
|
|
75
|
+
this.isOpen = false;
|
|
76
|
+
this.classList.remove("open");
|
|
48
77
|
}
|
|
49
78
|
render() {
|
|
50
79
|
return html `<slot></slot>`;
|
|
51
80
|
}
|
|
52
|
-
}
|
|
53
|
-
__decorate([
|
|
54
|
-
property({ type: String }),
|
|
55
|
-
__metadata("design:type", Object)
|
|
56
|
-
], QboPopover.prototype, "contentAtt", void 0);
|
|
57
|
-
__decorate([
|
|
58
|
-
property({ type: String }),
|
|
59
|
-
__metadata("design:type", Object)
|
|
60
|
-
], QboPopover.prototype, "contentStyle", void 0);
|
|
61
|
-
__decorate([
|
|
62
|
-
property({ type: String }),
|
|
63
|
-
__metadata("design:type", Object)
|
|
64
|
-
], QboPopover.prototype, "containerAtt", void 0);
|
|
65
|
-
__decorate([
|
|
66
|
-
property({ type: String }),
|
|
67
|
-
__metadata("design:type", Object)
|
|
68
|
-
], QboPopover.prototype, "containerValue", void 0);
|
|
69
|
-
__decorate([
|
|
70
|
-
property({ type: String }),
|
|
71
|
-
__metadata("design:type", Object)
|
|
72
|
-
], QboPopover.prototype, "defaultContent", void 0);
|
|
81
|
+
}
|
|
73
82
|
__decorate([
|
|
74
83
|
property({ type: String }),
|
|
75
|
-
__metadata("design:type",
|
|
76
|
-
], QboPopover.prototype, "
|
|
77
|
-
__decorate([
|
|
78
|
-
property({ type: String }),
|
|
79
|
-
__metadata("design:type", Object)
|
|
80
|
-
], QboPopover.prototype, "htmlValue", void 0);
|
|
81
|
-
__decorate([
|
|
82
|
-
property({ type: String }),
|
|
83
|
-
__metadata("design:type", Object)
|
|
84
|
-
], QboPopover.prototype, "placementAtt", void 0);
|
|
85
|
-
__decorate([
|
|
86
|
-
property({ type: String }),
|
|
87
|
-
__metadata("design:type", Object)
|
|
88
|
-
], QboPopover.prototype, "placementValue", void 0);
|
|
84
|
+
__metadata("design:type", String)
|
|
85
|
+
], QboPopover.prototype, "placement", void 0);
|
|
89
86
|
__decorate([
|
|
90
87
|
property({ type: String }),
|
|
91
88
|
__metadata("design:type", Object)
|
|
92
89
|
], QboPopover.prototype, "selector", void 0);
|
|
93
90
|
__decorate([
|
|
94
|
-
|
|
95
|
-
__metadata("design:type", Object)
|
|
96
|
-
], QboPopover.prototype, "toggleAtt", void 0);
|
|
97
|
-
__decorate([
|
|
98
|
-
property({ type: String }),
|
|
99
|
-
__metadata("design:type", Object)
|
|
100
|
-
], QboPopover.prototype, "toggleValue", void 0);
|
|
101
|
-
__decorate([
|
|
102
|
-
property({ type: Boolean }),
|
|
91
|
+
state(),
|
|
103
92
|
__metadata("design:type", Object)
|
|
104
|
-
], QboPopover.prototype, "
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
], QboPopover);
|
|
108
|
-
export { QboPopover };
|
|
93
|
+
], QboPopover.prototype, "isOpen", void 0);
|
|
94
|
+
if (!customElements.get('qbo-popover'))
|
|
95
|
+
customElements.define('qbo-popover', QboPopover);
|