@quandis/qbo4.ui 4.0.1-CI-20241027-142453 → 4.0.1-CI-20241029-174756
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/qboui.scss +103 -5
- package/src/qbo/Program.d.ts +2 -0
- package/src/qbo/Program.js +2 -0
- package/src/qbo/Program.ts +2 -0
- package/src/qbo/qbo-card.d.ts +21 -0
- package/src/qbo/qbo-card.js +118 -0
- package/src/qbo/qbo-card.ts +115 -0
- package/src/qbo/qbo-contextmenu.d.ts +3 -1
- package/src/qbo/qbo-contextmenu.js +19 -17
- package/src/qbo/qbo-contextmenu.ts +22 -19
- package/src/qbo/qbo-icon.d.ts +13 -5
- package/src/qbo/qbo-icon.js +146 -45
- package/src/qbo/qbo-icon.ts +153 -40
- package/src/qbo/qbo-menu.d.ts +18 -0
- package/src/qbo/qbo-menu.js +169 -0
- package/src/qbo/qbo-menu.ts +168 -0
- package/src/qbo/styles.js +3 -3
- package/src/qbo/styles.ts +3 -3
- package/wwwroot/css/qboui.css +311 -162
- package/wwwroot/css/qboui.css.map +1 -1
- package/wwwroot/css/qboui.min.css +3 -3
- package/wwwroot/default.html +146 -5
- package/wwwroot/images/qbo-icons.svg +7 -0
- package/wwwroot/js/esm/qbo4.ui.js +1271 -181
- package/wwwroot/js/esm/qbo4.ui.min.js +106 -53
- package/wwwroot/js/esm/qbo4.ui.min.js.LICENSE.txt +6 -0
- package/wwwroot/js/esm/qbo4.ui.min.js.map +1 -1
- package/wwwroot/js/qbo4.ui.js +1275 -181
- package/wwwroot/js/qbo4.ui.min.js +106 -53
- package/wwwroot/js/qbo4.ui.min.js.LICENSE.txt +6 -0
- package/wwwroot/js/qbo4.ui.min.js.map +1 -1
- package/wwwroot/menu.html +92 -0
- package/src/qbo/Icons.d.ts +0 -2
- package/src/qbo/Icons.js +0 -50
- package/src/qbo/Icons.ts +0 -57
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"author": "Quandis, Inc.",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"version": "4.0.1-CI-
|
|
6
|
+
"version": "4.0.1-CI-20241029-174756",
|
|
7
7
|
"workspaces": [
|
|
8
8
|
"code"
|
|
9
9
|
],
|
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"@fullhuman/postcss-purgecss": "^6.0.0",
|
|
46
46
|
"autoprefixer": "^10.4.20",
|
|
47
47
|
"clean-css": "^5.3.3",
|
|
48
|
+
"copy-webpack-plugin": "^12.0.2",
|
|
48
49
|
"eslint": "^9.13.0",
|
|
49
50
|
"glob": "^11.0.0",
|
|
50
51
|
"html-webpack-plugin": "^5.6.3",
|
package/scss/qboui.scss
CHANGED
|
@@ -5,16 +5,115 @@
|
|
|
5
5
|
@import "./navbar.scss";
|
|
6
6
|
@import "./sidebar.scss";
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
qbo-icon[type=button] {
|
|
9
|
+
@extend .btn;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
qbo-icon[type=toggle] {
|
|
13
|
+
@extend .btn;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
qbo-icon[selected] {
|
|
17
|
+
@extend .active;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
qbo-card, .qbo-card {
|
|
9
23
|
@extend .card;
|
|
24
|
+
@extend .col;
|
|
25
|
+
overflow-y: auto;
|
|
10
26
|
|
|
11
27
|
header {
|
|
12
28
|
@extend .card-header;
|
|
29
|
+
font-weight: bold;
|
|
30
|
+
font-size: 1.25rem;
|
|
31
|
+
cursor: pointer;
|
|
32
|
+
|
|
33
|
+
position: relative;
|
|
34
|
+
padding-left: 1.25rem;
|
|
35
|
+
background-repeat: no-repeat;
|
|
36
|
+
background-position: left center;
|
|
37
|
+
background-size: 1rem 1rem;
|
|
13
38
|
}
|
|
14
39
|
|
|
15
40
|
footer {
|
|
16
41
|
@extend .card-footer;
|
|
17
42
|
}
|
|
43
|
+
|
|
44
|
+
&.minimize {
|
|
45
|
+
> * {
|
|
46
|
+
display: none;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
header {
|
|
50
|
+
display: block;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&.normal {
|
|
55
|
+
> *.expanded {
|
|
56
|
+
display: none;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
qbo-card[display="maximize"] header {
|
|
62
|
+
background-image: url('/ui/images/qbo-icons.svg#i-arrow-down-circle');
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
qbo-card[display="minimize"] header {
|
|
66
|
+
background-image: url('/ui/images/qbo-icons.svg#i-arrow-right-circle');
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
qbo-card[display="normal"] header {
|
|
70
|
+
position: relative;
|
|
71
|
+
padding-left: 1.25rem;
|
|
72
|
+
background-image: url('/ui/images/qbo-icons.svg#i-arrow-down-right-circle');
|
|
73
|
+
background-repeat: no-repeat;
|
|
74
|
+
background-position: left center;
|
|
75
|
+
background-size: 1rem 1rem;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
qbo-card[columns="1"] {
|
|
79
|
+
@extend .col-1;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
qbo-card[columns="2"] {
|
|
83
|
+
@extend .col-2;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
qbo-card[columns="3"] {
|
|
87
|
+
@extend .col-3;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
qbo-card[columns="4"] {
|
|
91
|
+
@extend .col-4;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
qbo-card[columns="6"] {
|
|
95
|
+
@extend .col-6;
|
|
96
|
+
}
|
|
97
|
+
qbo-card[columns="7"] {
|
|
98
|
+
@extend .col-7;
|
|
99
|
+
}
|
|
100
|
+
qbo-card[columns="8"] {
|
|
101
|
+
@extend .col-8;
|
|
102
|
+
}
|
|
103
|
+
qbo-card[columns="9"] {
|
|
104
|
+
@extend .col-9;
|
|
105
|
+
}
|
|
106
|
+
qbo-card[columns="10"] {
|
|
107
|
+
@extend .col-10;
|
|
108
|
+
}
|
|
109
|
+
qbo-card[columns="11"] {
|
|
110
|
+
@extend .col-11;
|
|
111
|
+
}
|
|
112
|
+
qbo-card[columns="12"] {
|
|
113
|
+
@extend .col-12;
|
|
114
|
+
}
|
|
115
|
+
qbo-card[columns="auto"] {
|
|
116
|
+
@extend .col-auto;
|
|
18
117
|
}
|
|
19
118
|
|
|
20
119
|
.qbo-modal {
|
|
@@ -435,9 +534,9 @@ button.qbo-primary-dropdown {
|
|
|
435
534
|
div.qbo-input-group {
|
|
436
535
|
@extend .input-group;
|
|
437
536
|
}
|
|
537
|
+
|
|
438
538
|
span.qbo-input-group-text {
|
|
439
539
|
@extend .input-group-text;
|
|
440
|
-
|
|
441
540
|
margin-left: calc(var(--bs-border-width)* -1);
|
|
442
541
|
border-top-left-radius: 0;
|
|
443
542
|
border-bottom-left-radius: 0;
|
|
@@ -488,8 +587,8 @@ qbo-resize.vertical {
|
|
|
488
587
|
width: auto; /* Allow custom width */
|
|
489
588
|
}
|
|
490
589
|
|
|
491
|
-
qbo-
|
|
492
|
-
position:
|
|
590
|
+
qbo-menu[type="context"], .qbo-menu-context {
|
|
591
|
+
position: fixed;
|
|
493
592
|
|
|
494
593
|
> menu {
|
|
495
594
|
@extend .dropdown-menu;
|
|
@@ -516,4 +615,3 @@ tr.qbo-select-on {
|
|
|
516
615
|
li.qbo-select-on {
|
|
517
616
|
background-color: lightgray;
|
|
518
617
|
}
|
|
519
|
-
|
package/src/qbo/Program.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export * from './Validators.js';
|
|
|
17
17
|
export * from './DependencyValidator.js';
|
|
18
18
|
export * from './RestApiService.js';
|
|
19
19
|
export * from './qbo-api.js';
|
|
20
|
+
export * from './qbo-card.js';
|
|
20
21
|
export * from './qbo-contextmenu.js';
|
|
21
22
|
export * from './qbo-datalist.js';
|
|
22
23
|
export * from './qbo-docviewer.js';
|
|
@@ -25,6 +26,7 @@ export * from './qbo-form-edit.js';
|
|
|
25
26
|
export * from './qbo-form-element.js';
|
|
26
27
|
export * from './qbo-icon.js';
|
|
27
28
|
export * from './qbo-json.js';
|
|
29
|
+
export * from './qbo-menu.js';
|
|
28
30
|
export * from './qbo-microphone.js';
|
|
29
31
|
export * from './qbo-paginate.js';
|
|
30
32
|
export * from './qbo-popover.js';
|
package/src/qbo/Program.js
CHANGED
|
@@ -6,6 +6,7 @@ export * from './Validators.js';
|
|
|
6
6
|
export * from './DependencyValidator.js';
|
|
7
7
|
export * from './RestApiService.js';
|
|
8
8
|
export * from './qbo-api.js';
|
|
9
|
+
export * from './qbo-card.js';
|
|
9
10
|
export * from './qbo-contextmenu.js';
|
|
10
11
|
export * from './qbo-datalist.js';
|
|
11
12
|
export * from './qbo-docviewer.js';
|
|
@@ -14,6 +15,7 @@ export * from './qbo-form-edit.js';
|
|
|
14
15
|
export * from './qbo-form-element.js';
|
|
15
16
|
export * from './qbo-icon.js';
|
|
16
17
|
export * from './qbo-json.js';
|
|
18
|
+
export * from './qbo-menu.js';
|
|
17
19
|
export * from './qbo-microphone.js';
|
|
18
20
|
export * from './qbo-paginate.js';
|
|
19
21
|
export * from './qbo-popover.js';
|
package/src/qbo/Program.ts
CHANGED
|
@@ -23,6 +23,7 @@ export * from './Validators.js';
|
|
|
23
23
|
export * from './DependencyValidator.js';
|
|
24
24
|
export * from './RestApiService.js';
|
|
25
25
|
export * from './qbo-api.js';
|
|
26
|
+
export * from './qbo-card.js';
|
|
26
27
|
export * from './qbo-contextmenu.js';
|
|
27
28
|
export * from './qbo-datalist.js'
|
|
28
29
|
export * from './qbo-docviewer.js'
|
|
@@ -31,6 +32,7 @@ export * from './qbo-form-edit.js';
|
|
|
31
32
|
export * from './qbo-form-element.js';
|
|
32
33
|
export * from './qbo-icon.js';
|
|
33
34
|
export * from './qbo-json.js';
|
|
35
|
+
export * from './qbo-menu.js';
|
|
34
36
|
export * from './qbo-microphone.js'
|
|
35
37
|
export * from './qbo-paginate.js'
|
|
36
38
|
export * from './qbo-popover.js'
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { LitElement, TemplateResult } from "lit";
|
|
2
|
+
export type DisplayState = 'normal' | 'minimize' | 'maximize';
|
|
3
|
+
export declare class QboCard extends LitElement {
|
|
4
|
+
static styles: import("lit").CSSResult[];
|
|
5
|
+
display: DisplayState;
|
|
6
|
+
trigger: string;
|
|
7
|
+
renderInHost: boolean;
|
|
8
|
+
columns: number | undefined;
|
|
9
|
+
private hasExpandedContent;
|
|
10
|
+
connectedCallback(): void;
|
|
11
|
+
disconnectedCallback(): void;
|
|
12
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
13
|
+
minimize: (event: Event) => void;
|
|
14
|
+
normal: (event: Event) => void;
|
|
15
|
+
maximize: (event: Event) => void;
|
|
16
|
+
private handleClick;
|
|
17
|
+
shrink(): void;
|
|
18
|
+
grow(): void;
|
|
19
|
+
createRenderRoot(): HTMLElement | DocumentFragment;
|
|
20
|
+
render(): TemplateResult<1>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { LitElement, css, html } from "lit";
|
|
11
|
+
import { customElement, property } from "lit/decorators.js";
|
|
12
|
+
let QboCard = class QboCard extends LitElement {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
this.display = 'normal';
|
|
16
|
+
this.trigger = 'header';
|
|
17
|
+
this.renderInHost = true;
|
|
18
|
+
this.hasExpandedContent = false;
|
|
19
|
+
this.minimize = (event) => {
|
|
20
|
+
this.display = 'minimize';
|
|
21
|
+
};
|
|
22
|
+
this.normal = (event) => {
|
|
23
|
+
this.display = 'normal';
|
|
24
|
+
};
|
|
25
|
+
this.maximize = (event) => {
|
|
26
|
+
this.display = 'maximize';
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
static { this.styles = [
|
|
30
|
+
css ``
|
|
31
|
+
]; }
|
|
32
|
+
connectedCallback() {
|
|
33
|
+
super.connectedCallback();
|
|
34
|
+
this.addEventListener('click', this.handleClick);
|
|
35
|
+
document.addEventListener('qbo-card-minimize', this.minimize);
|
|
36
|
+
document.addEventListener('qbo-card-normal', this.normal);
|
|
37
|
+
document.addEventListener('qbo-card-maximize', this.maximize);
|
|
38
|
+
this.hasExpandedContent = (this.querySelector('.expanded') != null);
|
|
39
|
+
if (this.display === 'normal' && !this.hasExpandedContent)
|
|
40
|
+
this.display = 'maximize';
|
|
41
|
+
}
|
|
42
|
+
disconnectedCallback() {
|
|
43
|
+
this.removeEventListener('click', this.handleClick);
|
|
44
|
+
document.removeEventListener('qbo-card-minimize', this.minimize);
|
|
45
|
+
document.removeEventListener('qbo-card-normal', this.normal);
|
|
46
|
+
document.removeEventListener('qbo-card-maximize', this.maximize);
|
|
47
|
+
super.disconnectedCallback();
|
|
48
|
+
}
|
|
49
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
50
|
+
super.attributeChangedCallback(name, oldValue, newValue);
|
|
51
|
+
if (name === 'display') {
|
|
52
|
+
this.classList.remove('normal', 'minimize', 'maximize');
|
|
53
|
+
if (newValue) {
|
|
54
|
+
this.classList.add(newValue);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
// Handle click events on the header to toggle state
|
|
59
|
+
handleClick(event) {
|
|
60
|
+
const source = event.composedPath()[0];
|
|
61
|
+
const target = this.querySelector(this.trigger);
|
|
62
|
+
if (source === target) {
|
|
63
|
+
(event.ctrlKey) ? this.shrink() : this.grow();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
shrink() {
|
|
67
|
+
switch (this.display) {
|
|
68
|
+
case 'minimize':
|
|
69
|
+
this.display = 'maximize';
|
|
70
|
+
return;
|
|
71
|
+
case 'maximize':
|
|
72
|
+
this.display = this.hasExpandedContent ? 'normal' : 'minimize';
|
|
73
|
+
return;
|
|
74
|
+
default:
|
|
75
|
+
this.display = 'minimize';
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
grow() {
|
|
80
|
+
switch (this.display) {
|
|
81
|
+
case 'minimize':
|
|
82
|
+
this.display = this.hasExpandedContent ? 'normal' : 'maximize';
|
|
83
|
+
return;
|
|
84
|
+
case 'maximize':
|
|
85
|
+
this.display = 'minimize';
|
|
86
|
+
return;
|
|
87
|
+
default:
|
|
88
|
+
this.display = 'maximize';
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
createRenderRoot() {
|
|
93
|
+
return this.renderInHost ? this : super.createRenderRoot();
|
|
94
|
+
}
|
|
95
|
+
render() {
|
|
96
|
+
return html `<slot></slot>`;
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
__decorate([
|
|
100
|
+
property({ reflect: true }),
|
|
101
|
+
__metadata("design:type", String)
|
|
102
|
+
], QboCard.prototype, "display", void 0);
|
|
103
|
+
__decorate([
|
|
104
|
+
property(),
|
|
105
|
+
__metadata("design:type", String)
|
|
106
|
+
], QboCard.prototype, "trigger", void 0);
|
|
107
|
+
__decorate([
|
|
108
|
+
property(),
|
|
109
|
+
__metadata("design:type", Boolean)
|
|
110
|
+
], QboCard.prototype, "renderInHost", void 0);
|
|
111
|
+
__decorate([
|
|
112
|
+
property(),
|
|
113
|
+
__metadata("design:type", Object)
|
|
114
|
+
], QboCard.prototype, "columns", void 0);
|
|
115
|
+
QboCard = __decorate([
|
|
116
|
+
customElement('qbo-card')
|
|
117
|
+
], QboCard);
|
|
118
|
+
export { QboCard };
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { LitElement, TemplateResult, css, html } from "lit";
|
|
2
|
+
import { customElement, property, state } from "lit/decorators.js";
|
|
3
|
+
import { QboIcon } from "./qbo-icon.js";
|
|
4
|
+
|
|
5
|
+
export type DisplayState = 'normal' | 'minimize' | 'maximize';
|
|
6
|
+
|
|
7
|
+
@customElement('qbo-card')
|
|
8
|
+
export class QboCard extends LitElement {
|
|
9
|
+
|
|
10
|
+
static styles = [
|
|
11
|
+
css``
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
@property({ reflect: true })
|
|
15
|
+
display: DisplayState = 'normal';
|
|
16
|
+
|
|
17
|
+
@property()
|
|
18
|
+
trigger: string = 'header';
|
|
19
|
+
|
|
20
|
+
@property()
|
|
21
|
+
renderInHost: boolean = true;
|
|
22
|
+
|
|
23
|
+
@property()
|
|
24
|
+
columns: number | undefined;
|
|
25
|
+
|
|
26
|
+
private hasExpandedContent: boolean = false;
|
|
27
|
+
|
|
28
|
+
connectedCallback() {
|
|
29
|
+
super.connectedCallback();
|
|
30
|
+
|
|
31
|
+
this.addEventListener('click', this.handleClick);
|
|
32
|
+
document.addEventListener('qbo-card-minimize', this.minimize);
|
|
33
|
+
document.addEventListener('qbo-card-normal', this.normal);
|
|
34
|
+
document.addEventListener('qbo-card-maximize', this.maximize);
|
|
35
|
+
this.hasExpandedContent = (this.querySelector('.expanded') != null);
|
|
36
|
+
if (this.display === 'normal' && !this.hasExpandedContent)
|
|
37
|
+
this.display = 'maximize';
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
disconnectedCallback() {
|
|
41
|
+
this.removeEventListener('click', this.handleClick);
|
|
42
|
+
document.removeEventListener('qbo-card-minimize', this.minimize);
|
|
43
|
+
document.removeEventListener('qbo-card-normal', this.normal);
|
|
44
|
+
document.removeEventListener('qbo-card-maximize', this.maximize);
|
|
45
|
+
super.disconnectedCallback();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null) {
|
|
49
|
+
super.attributeChangedCallback(name, oldValue, newValue);
|
|
50
|
+
if (name === 'display') {
|
|
51
|
+
this.classList.remove('normal', 'minimize', 'maximize');
|
|
52
|
+
if (newValue) {
|
|
53
|
+
this.classList.add(newValue);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
minimize = (event: Event) => {
|
|
59
|
+
this.display = 'minimize';
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
normal = (event: Event) => {
|
|
63
|
+
this.display = 'normal';
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
maximize = (event: Event) => {
|
|
67
|
+
this.display = 'maximize';
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
// Handle click events on the header to toggle state
|
|
72
|
+
private handleClick(event: MouseEvent) {
|
|
73
|
+
const source = event.composedPath()[0];
|
|
74
|
+
const target = this.querySelector(this.trigger);
|
|
75
|
+
if (source === target) {
|
|
76
|
+
(event.ctrlKey) ? this.shrink() : this.grow();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
shrink() {
|
|
81
|
+
switch (this.display) {
|
|
82
|
+
case 'minimize':
|
|
83
|
+
this.display = 'maximize';
|
|
84
|
+
return;
|
|
85
|
+
case 'maximize':
|
|
86
|
+
this.display = this.hasExpandedContent ? 'normal' : 'minimize';
|
|
87
|
+
return;
|
|
88
|
+
default:
|
|
89
|
+
this.display = 'minimize';
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
grow() {
|
|
95
|
+
switch (this.display) {
|
|
96
|
+
case 'minimize':
|
|
97
|
+
this.display = this.hasExpandedContent ? 'normal' : 'maximize';
|
|
98
|
+
return;
|
|
99
|
+
case 'maximize':
|
|
100
|
+
this.display = 'minimize';
|
|
101
|
+
return;
|
|
102
|
+
default:
|
|
103
|
+
this.display = 'maximize';
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
createRenderRoot() {
|
|
109
|
+
return this.renderInHost ? this : super.createRenderRoot();
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
render() {
|
|
113
|
+
return html`<slot></slot>`;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
@@ -6,9 +6,11 @@ export declare class ContextMenu extends LitElement {
|
|
|
6
6
|
parent: HTMLElement | Document | null;
|
|
7
7
|
menu: HTMLElement | null | undefined;
|
|
8
8
|
connectedCallback(): void;
|
|
9
|
+
getContextTarget(): void;
|
|
9
10
|
disconnectedCallback(): void;
|
|
10
11
|
private _handleClickOutside;
|
|
11
|
-
private
|
|
12
|
+
private showContextMenu;
|
|
13
|
+
private _updateMenuPosition;
|
|
12
14
|
private _handleClose;
|
|
13
15
|
render(): import("lit-html").TemplateResult<1>;
|
|
14
16
|
}
|
|
@@ -7,30 +7,32 @@ 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 { LitElement, html
|
|
10
|
+
import { LitElement, html } from 'lit';
|
|
11
11
|
import { customElement, property, state } from 'lit/decorators.js';
|
|
12
12
|
import { qboui } from './styles.js';
|
|
13
13
|
let ContextMenu = class ContextMenu extends LitElement {
|
|
14
14
|
constructor() {
|
|
15
15
|
super(...arguments);
|
|
16
16
|
this._open = false;
|
|
17
|
-
//@state() private _x = 0;
|
|
18
|
-
//@state() private _y = 0;
|
|
19
17
|
this.target = '';
|
|
20
18
|
this.parent = null;
|
|
21
19
|
this.menu = null;
|
|
20
|
+
this.showContextMenu = (event) => {
|
|
21
|
+
event.preventDefault();
|
|
22
|
+
this._open = true;
|
|
23
|
+
this._updateMenuPosition(event);
|
|
24
|
+
};
|
|
22
25
|
}
|
|
23
26
|
static { this.styles = [
|
|
24
|
-
qboui
|
|
25
|
-
css `details { padding-left: 16px; }`
|
|
27
|
+
qboui
|
|
26
28
|
]; }
|
|
27
29
|
connectedCallback() {
|
|
28
30
|
super.connectedCallback();
|
|
31
|
+
this.getContextTarget();
|
|
32
|
+
document.addEventListener('click', this._handleClickOutside.bind(this));
|
|
33
|
+
}
|
|
34
|
+
getContextTarget() {
|
|
29
35
|
if (this.target) {
|
|
30
|
-
const rootNode = this.getRootNode();
|
|
31
|
-
if (rootNode instanceof Document || rootNode instanceof ShadowRoot) {
|
|
32
|
-
const targetElement = rootNode.querySelector(this.target);
|
|
33
|
-
}
|
|
34
36
|
this.parent = this.closest(this.target)
|
|
35
37
|
?? ((() => {
|
|
36
38
|
const rootNode = this.getRootNode();
|
|
@@ -41,13 +43,14 @@ let ContextMenu = class ContextMenu extends LitElement {
|
|
|
41
43
|
})())
|
|
42
44
|
?? document.querySelector(this.target)
|
|
43
45
|
?? document;
|
|
44
|
-
this.parent.addEventListener('contextmenu', this._handleContextMenu.bind(this));
|
|
45
46
|
}
|
|
46
|
-
|
|
47
|
+
else
|
|
48
|
+
this.parent = this.parentElement;
|
|
49
|
+
this.parent.addEventListener('contextmenu', this.showContextMenu);
|
|
47
50
|
}
|
|
48
51
|
disconnectedCallback() {
|
|
49
52
|
if (this.parent)
|
|
50
|
-
this.parent.removeEventListener('contextmenu', this.
|
|
53
|
+
this.parent.removeEventListener('contextmenu', this.showContextMenu);
|
|
51
54
|
document.removeEventListener('click', this._handleClickOutside.bind(this));
|
|
52
55
|
}
|
|
53
56
|
_handleClickOutside(event) {
|
|
@@ -55,10 +58,10 @@ let ContextMenu = class ContextMenu extends LitElement {
|
|
|
55
58
|
this._open = false;
|
|
56
59
|
}
|
|
57
60
|
}
|
|
58
|
-
|
|
61
|
+
async _updateMenuPosition(event) {
|
|
59
62
|
event.preventDefault();
|
|
60
|
-
|
|
61
|
-
|
|
63
|
+
this._open = true;
|
|
64
|
+
await this.updateComplete;
|
|
62
65
|
const viewportWidth = window.innerWidth;
|
|
63
66
|
const viewportHeight = window.innerHeight;
|
|
64
67
|
const menuWidth = this.offsetWidth || 0;
|
|
@@ -72,10 +75,9 @@ let ContextMenu = class ContextMenu extends LitElement {
|
|
|
72
75
|
if (y + menuHeight > viewportHeight) {
|
|
73
76
|
y = viewportHeight - menuHeight;
|
|
74
77
|
}
|
|
78
|
+
console.log(`mouse event: ${event.clientX} x ${event.clientY} ; ${x} x ${y}`);
|
|
75
79
|
this.style.left = x + 'px';
|
|
76
80
|
this.style.top = y + 'px';
|
|
77
|
-
this._open = true;
|
|
78
|
-
this.requestUpdate();
|
|
79
81
|
}
|
|
80
82
|
_handleClose() {
|
|
81
83
|
this._open = false;
|
|
@@ -5,13 +5,10 @@ import { qboui } from './styles.js';
|
|
|
5
5
|
@customElement('qbo-contextmenu')
|
|
6
6
|
export class ContextMenu extends LitElement {
|
|
7
7
|
static styles = [
|
|
8
|
-
qboui
|
|
9
|
-
css`details { padding-left: 16px; }`
|
|
8
|
+
qboui
|
|
10
9
|
];
|
|
11
10
|
|
|
12
11
|
@state() private _open = false;
|
|
13
|
-
//@state() private _x = 0;
|
|
14
|
-
//@state() private _y = 0;
|
|
15
12
|
|
|
16
13
|
@property({ type: String })
|
|
17
14
|
target = '';
|
|
@@ -22,12 +19,14 @@ export class ContextMenu extends LitElement {
|
|
|
22
19
|
|
|
23
20
|
connectedCallback() {
|
|
24
21
|
super.connectedCallback();
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
|
|
23
|
+
this.getContextTarget();
|
|
24
|
+
document.addEventListener('click', this._handleClickOutside.bind(this));
|
|
25
|
+
|
|
26
|
+
}
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
28
|
+
getContextTarget() {
|
|
29
|
+
if (this.target) {
|
|
31
30
|
this.parent = this.closest(this.target) as HTMLElement
|
|
32
31
|
?? (
|
|
33
32
|
(() => {
|
|
@@ -40,15 +39,14 @@ export class ContextMenu extends LitElement {
|
|
|
40
39
|
)
|
|
41
40
|
?? document.querySelector(this.target)
|
|
42
41
|
?? document;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
} else
|
|
43
|
+
this.parent = this.parentElement;
|
|
44
|
+
this.parent!.addEventListener('contextmenu', this.showContextMenu);
|
|
47
45
|
}
|
|
48
46
|
|
|
49
47
|
disconnectedCallback() {
|
|
50
48
|
if (this.parent)
|
|
51
|
-
this.parent.removeEventListener('contextmenu', this.
|
|
49
|
+
this.parent.removeEventListener('contextmenu', this.showContextMenu);
|
|
52
50
|
document.removeEventListener('click', this._handleClickOutside.bind(this));
|
|
53
51
|
}
|
|
54
52
|
|
|
@@ -58,10 +56,16 @@ export class ContextMenu extends LitElement {
|
|
|
58
56
|
}
|
|
59
57
|
}
|
|
60
58
|
|
|
61
|
-
private
|
|
59
|
+
private showContextMenu = (event: Event) => {
|
|
62
60
|
event.preventDefault();
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
this._open = true;
|
|
62
|
+
this._updateMenuPosition(event as MouseEvent);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
private async _updateMenuPosition(event: MouseEvent) {
|
|
66
|
+
event.preventDefault();
|
|
67
|
+
this._open = true;
|
|
68
|
+
await this.updateComplete;
|
|
65
69
|
|
|
66
70
|
const viewportWidth = window.innerWidth;
|
|
67
71
|
const viewportHeight = window.innerHeight;
|
|
@@ -80,11 +84,10 @@ export class ContextMenu extends LitElement {
|
|
|
80
84
|
if (y + menuHeight > viewportHeight) {
|
|
81
85
|
y = viewportHeight - menuHeight;
|
|
82
86
|
}
|
|
87
|
+
console.log(`mouse event: ${event.clientX} x ${event.clientY} ; ${x} x ${y}`)
|
|
83
88
|
|
|
84
89
|
this.style.left = x + 'px';
|
|
85
90
|
this.style.top = y + 'px';
|
|
86
|
-
this._open = true;
|
|
87
|
-
this.requestUpdate();
|
|
88
91
|
}
|
|
89
92
|
|
|
90
93
|
private _handleClose() {
|
package/src/qbo/qbo-icon.d.ts
CHANGED
|
@@ -1,19 +1,27 @@
|
|
|
1
1
|
import { LitElement, TemplateResult } from "lit";
|
|
2
2
|
export declare class QboIcon extends LitElement {
|
|
3
|
+
static map: Map<string, string>;
|
|
3
4
|
type: string;
|
|
5
|
+
sprite: string | undefined;
|
|
6
|
+
static get spriteUrl(): string;
|
|
4
7
|
icon: string | null;
|
|
5
|
-
height:
|
|
6
|
-
width:
|
|
8
|
+
height: string;
|
|
9
|
+
width: string;
|
|
7
10
|
viewbox: string;
|
|
8
11
|
fill: string;
|
|
9
12
|
backgroundColor: string | null;
|
|
10
|
-
unknown: string;
|
|
11
13
|
disabled: boolean;
|
|
12
14
|
renderInHost: boolean;
|
|
15
|
+
selected: boolean;
|
|
13
16
|
connectedCallback(): void;
|
|
17
|
+
disconnectedCallback(): void;
|
|
18
|
+
toggle(): void;
|
|
14
19
|
createRenderRoot(): HTMLElement | DocumentFragment;
|
|
15
|
-
|
|
20
|
+
updated(changedProperties: Map<string, any>): void;
|
|
21
|
+
private allIcons;
|
|
22
|
+
loadIcons(): Promise<string[] | undefined>;
|
|
23
|
+
renderStandard(component: any): TemplateResult<1>;
|
|
24
|
+
renderAll(component: any): Promise<TemplateResult<1>>;
|
|
16
25
|
renderIcon(component: QboIcon): TemplateResult<1>;
|
|
17
|
-
renderButton(component: any): TemplateResult<1>;
|
|
18
26
|
render(): TemplateResult<1>;
|
|
19
27
|
}
|