@quandis/qbo4.ui 4.0.1-CI-20241107-011209 → 4.0.1-CI-20241108-204652
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 +456 -92
- 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-popover.d.ts +13 -17
- package/src/qbo/qbo-popover.js +64 -75
- package/src/qbo/qbo-popover.ts +78 -52
- package/src/qbo/styles.js +2 -2
- package/src/qbo/styles.ts +2 -2
- package/wwwroot/css/qbo.css +436 -90
- package/wwwroot/css/qbo.css.map +1 -1
- package/wwwroot/css/qbo.min.css +1 -1
- package/wwwroot/css/qboui.css +438 -90
- 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 +2586 -7857
- 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 +2593 -7918
- 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-popover.js
CHANGED
|
@@ -7,44 +7,73 @@ 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 { customElement, property } from
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
let QboPopover = class QboPopover extends QboFormElement {
|
|
10
|
+
import { LitElement, html } from "lit";
|
|
11
|
+
import { customElement, property, state } from "lit/decorators.js";
|
|
12
|
+
import { computePosition, shift, flip } from "@floating-ui/dom";
|
|
13
|
+
let QboPopover = 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>`;
|
|
@@ -52,56 +81,16 @@ let QboPopover = class QboPopover extends QboFormElement {
|
|
|
52
81
|
};
|
|
53
82
|
__decorate([
|
|
54
83
|
property({ type: String }),
|
|
55
|
-
__metadata("design:type",
|
|
56
|
-
], QboPopover.prototype, "
|
|
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);
|
|
73
|
-
__decorate([
|
|
74
|
-
property({ type: String }),
|
|
75
|
-
__metadata("design:type", Object)
|
|
76
|
-
], QboPopover.prototype, "htmlAtt", void 0);
|
|
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, "
|
|
93
|
+
], QboPopover.prototype, "isOpen", void 0);
|
|
105
94
|
QboPopover = __decorate([
|
|
106
95
|
customElement('qbo-popover')
|
|
107
96
|
], QboPopover);
|
package/src/qbo/qbo-popover.ts
CHANGED
|
@@ -1,71 +1,97 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { customElement, property } from
|
|
3
|
-
import {
|
|
4
|
-
import { QboFormElement } from './qbo-form-element.js';
|
|
1
|
+
import { LitElement, PropertyValues, html } from "lit";
|
|
2
|
+
import { customElement, property, state } from "lit/decorators.js";
|
|
3
|
+
import { computePosition, Placement, shift, flip } from "@floating-ui/dom";
|
|
5
4
|
|
|
6
5
|
@customElement('qbo-popover')
|
|
7
|
-
export class QboPopover extends
|
|
6
|
+
export class QboPopover extends LitElement {
|
|
8
7
|
|
|
9
8
|
@property({ type: String })
|
|
10
|
-
|
|
9
|
+
placement: Placement = "bottom";
|
|
11
10
|
|
|
12
11
|
@property({ type: String })
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
12
|
+
selector = '*[data-popover-trigger]';
|
|
13
|
+
|
|
14
|
+
// Internal state to control menu visibility
|
|
15
|
+
@state() private isOpen = false;
|
|
16
|
+
|
|
17
|
+
private triggerElement!: HTMLElement;
|
|
18
|
+
private middleware = [flip(), shift()];
|
|
19
|
+
|
|
20
|
+
private async setPosition() {
|
|
21
|
+
const { x, y } = await computePosition(
|
|
22
|
+
this.triggerElement,
|
|
23
|
+
this,
|
|
24
|
+
{
|
|
25
|
+
placement: this.placement as Placement | undefined,
|
|
26
|
+
middleware: this.middleware,
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
Object.assign(
|
|
31
|
+
this.style, {
|
|
32
|
+
left: `${x}px`,
|
|
33
|
+
top: `${y}px`,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
35
36
|
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
connectedCallback() {
|
|
38
|
+
super.connectedCallback();
|
|
38
39
|
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
document.addEventListener("qbo-popover-open", this.handleMenuOpen);
|
|
41
|
+
}
|
|
41
42
|
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
disconnectedCallback() {
|
|
44
|
+
super.disconnectedCallback();
|
|
44
45
|
|
|
45
|
-
|
|
46
|
-
renderInHost = true;
|
|
46
|
+
document.removeEventListener("qbo-popover-open", this.handleMenuOpen);
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
if (this.triggerElement != null) {
|
|
49
|
+
this.triggerElement.removeEventListener("mouseover", this.toggleMenu);
|
|
50
|
+
this.triggerElement.removeEventListener("mouseout", this.toggleMenu);
|
|
51
|
+
}
|
|
50
52
|
}
|
|
51
53
|
|
|
52
|
-
|
|
53
|
-
super.
|
|
54
|
-
|
|
55
|
-
this.setAttribute(this.toggleAtt, this.toggleValue);
|
|
56
|
-
this.setAttribute(this.placementAtt, this.placementValue);
|
|
57
|
-
this.setAttribute(this.containerAtt, this.containerValue);
|
|
58
|
-
this.setAttribute(this.htmlAtt, this.htmlValue);
|
|
59
|
-
}
|
|
54
|
+
firstUpdated(changes: PropertyValues) {
|
|
55
|
+
super.firstUpdated(changes);
|
|
60
56
|
|
|
61
|
-
|
|
62
|
-
|
|
57
|
+
this.triggerElement =
|
|
58
|
+
this.parentElement?.querySelector(this.selector) ||
|
|
59
|
+
this.shadowRoot?.querySelector(this.selector) ||
|
|
60
|
+
document.querySelector(this.selector) ||
|
|
61
|
+
this.parentElement as HTMLElement;
|
|
63
62
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
if (this.triggerElement != null) {
|
|
64
|
+
this.triggerElement.addEventListener("mouseover", this.toggleMenu);
|
|
65
|
+
this.triggerElement.addEventListener("mouseout", this.toggleMenu);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
67
68
|
|
|
68
|
-
|
|
69
|
+
handleMenuOpen = (event: Event) => {
|
|
70
|
+
event.preventDefault();
|
|
71
|
+
event.stopPropagation();
|
|
72
|
+
|
|
73
|
+
if ((event as CustomEvent).detail.menu !== this && this.isOpen) this.closeMenu();
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
toggleMenu = (event: Event) => {
|
|
77
|
+
this.isOpen = !this.isOpen;
|
|
78
|
+
this.classList.toggle("open", this.isOpen);
|
|
79
|
+
|
|
80
|
+
if (this.isOpen) {
|
|
81
|
+
this.setPosition();
|
|
82
|
+
document.dispatchEvent(
|
|
83
|
+
new CustomEvent("qbo-popover-open", {
|
|
84
|
+
bubbles: true,
|
|
85
|
+
composed: true,
|
|
86
|
+
detail: { menu: this },
|
|
87
|
+
})
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
closeMenu() {
|
|
93
|
+
this.isOpen = false;
|
|
94
|
+
this.classList.remove("open");
|
|
69
95
|
}
|
|
70
96
|
|
|
71
97
|
render() {
|