@quandis/qbo4.ui 4.0.1-CI-20240403-131518
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 +52 -0
- package/readme.md +456 -0
- package/src/qbo/Program.d.ts +18 -0
- package/src/qbo/Program.js +18 -0
- package/src/qbo/Program.ts +19 -0
- package/src/qbo/qbo-api.d.ts +27 -0
- package/src/qbo/qbo-api.js +96 -0
- package/src/qbo/qbo-api.ts +106 -0
- package/src/qbo/qbo-badge.d.ts +32 -0
- package/src/qbo/qbo-badge.js +93 -0
- package/src/qbo/qbo-badge.js.map +1 -0
- package/src/qbo/qbo-badge.ts +80 -0
- package/src/qbo/qbo-breadcrumb.d.ts +23 -0
- package/src/qbo/qbo-breadcrumb.js +132 -0
- package/src/qbo/qbo-breadcrumb.ts +96 -0
- package/src/qbo/qbo-datalist.d.ts +22 -0
- package/src/qbo/qbo-datalist.js +126 -0
- package/src/qbo/qbo-datalist.ts +104 -0
- package/src/qbo/qbo-docviewer.d.ts +15 -0
- package/src/qbo/qbo-docviewer.js +55 -0
- package/src/qbo/qbo-docviewer.ts +39 -0
- package/src/qbo/qbo-fetch.d.ts +29 -0
- package/src/qbo/qbo-fetch.js +134 -0
- package/src/qbo/qbo-fetch.ts +127 -0
- package/src/qbo/qbo-json.d.ts +8 -0
- package/src/qbo/qbo-json.js +85 -0
- package/src/qbo/qbo-json.ts +92 -0
- package/src/qbo/qbo-link.d.ts +15 -0
- package/src/qbo/qbo-link.js +48 -0
- package/src/qbo/qbo-link.js.map +1 -0
- package/src/qbo/qbo-link.ts +34 -0
- package/src/qbo/qbo-logging.d.ts +13 -0
- package/src/qbo/qbo-logging.js +92 -0
- package/src/qbo/qbo-logging.ts +72 -0
- package/src/qbo/qbo-mainmenu.d.ts +41 -0
- package/src/qbo/qbo-mainmenu.js +307 -0
- package/src/qbo/qbo-mainmenu.ts +263 -0
- package/src/qbo/qbo-markdown.d.ts +9 -0
- package/src/qbo/qbo-markdown.js +33 -0
- package/src/qbo/qbo-markdown.js.map +1 -0
- package/src/qbo/qbo-markdown.ts +22 -0
- package/src/qbo/qbo-microphone.d.ts +31 -0
- package/src/qbo/qbo-microphone.js +149 -0
- package/src/qbo/qbo-microphone.js.map +1 -0
- package/src/qbo/qbo-microphone.ts +137 -0
- package/src/qbo/qbo-popover.d.ts +8 -0
- package/src/qbo/qbo-popover.js +41 -0
- package/src/qbo/qbo-popover.ts +26 -0
- package/src/qbo/qbo-popup-listener.d.ts +25 -0
- package/src/qbo/qbo-popup-listener.js +145 -0
- package/src/qbo/qbo-popup-listener.ts +129 -0
- package/src/qbo/qbo-popup.d.ts +19 -0
- package/src/qbo/qbo-popup.js +95 -0
- package/src/qbo/qbo-popup.ts +84 -0
- package/src/qbo/qbo-select.d.ts +22 -0
- package/src/qbo/qbo-select.js +87 -0
- package/src/qbo/qbo-select.ts +65 -0
- package/src/qbo/qbo-sidebar.d.ts +10 -0
- package/src/qbo/qbo-sidebar.js +65 -0
- package/src/qbo/qbo-sidebar.ts +41 -0
- package/src/qbo/qbo-table.d.ts +23 -0
- package/src/qbo/qbo-table.js +94 -0
- package/src/qbo/qbo-table.js.map +1 -0
- package/src/qbo/qbo-table.ts +80 -0
- package/src/qbo/qbo-validate.d.ts +20 -0
- package/src/qbo/qbo-validate.js +92 -0
- package/src/qbo/qbo-validate.js.map +1 -0
- package/src/qbo/qbo-validate.ts +77 -0
- package/src/qbo/qbo-validators.d.ts +37 -0
- package/src/qbo/qbo-validators.js +72 -0
- package/src/qbo/qbo-validators.ts +66 -0
- package/src/qbo/styles.d.ts +3 -0
- package/src/qbo/styles.js +27 -0
- package/src/qbo/styles.ts +30 -0
- package/src/qbo-code/qbo-code.d.ts +12 -0
- package/src/qbo-code/qbo-code.js +54 -0
- package/src/qbo-code/qbo-code.ts +40 -0
- package/src/qbo-flowchart/qbo-flowchart.d.ts +45 -0
- package/src/qbo-flowchart/qbo-flowchart.js +309 -0
- package/src/qbo-flowchart/qbo-flowchart.js.map +1 -0
- package/src/qbo-flowchart/qbo-flowchart.ts +320 -0
- package/src/qbo-flowchart/readme.md +2 -0
- package/wwwroot/js/qbo4.ui-code.js +37965 -0
- package/wwwroot/js/qbo4.ui-code.min.js +3 -0
- package/wwwroot/js/qbo4.ui-code.min.js.LICENSE.txt +32 -0
- package/wwwroot/js/qbo4.ui-code.min.js.map +1 -0
- package/wwwroot/js/qbo4.ui-flowchart.js +44909 -0
- package/wwwroot/js/qbo4.ui-flowchart.min.js +9 -0
- package/wwwroot/js/qbo4.ui-flowchart.min.js.LICENSE.txt +43 -0
- package/wwwroot/js/qbo4.ui-flowchart.min.js.map +1 -0
- package/wwwroot/js/qbo4.ui.js +18840 -0
- package/wwwroot/js/qbo4.ui.min.js +108 -0
- package/wwwroot/js/qbo4.ui.min.js.LICENSE.txt +53 -0
- package/wwwroot/js/qbo4.ui.min.js.map +1 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { QboFetch } from './qbo-fetch.js';
|
|
2
|
+
/**
|
|
3
|
+
* Renders a <select> element with options populated from a JSON array.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* This element is a thin wrapper around {@link QboFetch} that renders a <select> element with options populated from a JSON array.
|
|
7
|
+
*/
|
|
8
|
+
export declare class QboPopup extends QboFetch {
|
|
9
|
+
open: boolean;
|
|
10
|
+
loading: boolean;
|
|
11
|
+
renderInHost: boolean;
|
|
12
|
+
static styles: import("lit").CSSResult[];
|
|
13
|
+
connectedCallback(): Promise<void>;
|
|
14
|
+
toggle(): void;
|
|
15
|
+
show(): void;
|
|
16
|
+
hide(event: any): void;
|
|
17
|
+
handleOutsideClick(event: any): void;
|
|
18
|
+
render(): import("lit").TemplateResult<1>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
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 { html, css } from 'lit';
|
|
11
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
12
|
+
import { QboFetch } from './qbo-fetch.js';
|
|
13
|
+
import { unsafeHTML } from 'lit/directives/unsafe-html.js';
|
|
14
|
+
/**
|
|
15
|
+
* Renders a <select> element with options populated from a JSON array.
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* This element is a thin wrapper around {@link QboFetch} that renders a <select> element with options populated from a JSON array.
|
|
19
|
+
*/
|
|
20
|
+
let QboPopup = class QboPopup extends QboFetch {
|
|
21
|
+
constructor() {
|
|
22
|
+
super(...arguments);
|
|
23
|
+
this.open = false;
|
|
24
|
+
this.loading = false;
|
|
25
|
+
this.renderInHost = false;
|
|
26
|
+
}
|
|
27
|
+
// container: HTMLElement;
|
|
28
|
+
static { this.styles = [
|
|
29
|
+
css `
|
|
30
|
+
/* Add any custom styles here */
|
|
31
|
+
.foo { color: red; }
|
|
32
|
+
`
|
|
33
|
+
]; }
|
|
34
|
+
async connectedCallback() {
|
|
35
|
+
super.connectedCallback();
|
|
36
|
+
this.handleOutsideClick = this.handleOutsideClick.bind(this);
|
|
37
|
+
}
|
|
38
|
+
//updated(changedProperties) {
|
|
39
|
+
// super.updated(changedProperties);
|
|
40
|
+
// if (this.container != null)
|
|
41
|
+
// this.container.style.display = (changedProperties.has('show')) ? 'flex' : 'none';
|
|
42
|
+
//}
|
|
43
|
+
toggle() {
|
|
44
|
+
this.open = !this.open;
|
|
45
|
+
if (this.open)
|
|
46
|
+
document.addEventListener('click', this.handleOutsideClick);
|
|
47
|
+
else
|
|
48
|
+
document.removeEventListener('click', this.handleOutsideClick);
|
|
49
|
+
}
|
|
50
|
+
show() {
|
|
51
|
+
//if (this.container == null)
|
|
52
|
+
// this.container = this.shadowRoot.querySelector('.modal-container')
|
|
53
|
+
//this.container.style.display = 'flex';
|
|
54
|
+
this.open = true;
|
|
55
|
+
document.addEventListener('click', this.handleOutsideClick);
|
|
56
|
+
}
|
|
57
|
+
hide(event) {
|
|
58
|
+
if (event.target.closest('[data-dismiss="modal"]')) {
|
|
59
|
+
// this.togglePopup(false);
|
|
60
|
+
this.open = false;
|
|
61
|
+
document.removeEventListener('click', this.handleOutsideClick);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
handleOutsideClick(event) {
|
|
65
|
+
if (this.open && !this.contains(event.target)) {
|
|
66
|
+
// this.togglePopup(false);
|
|
67
|
+
this.open = false;
|
|
68
|
+
document.removeEventListener('click', this.handleOutsideClick);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
render() {
|
|
72
|
+
return html `
|
|
73
|
+
<slot name="button" @click="${this.toggle}">
|
|
74
|
+
<button class="btn">Popup</button>
|
|
75
|
+
</slot>
|
|
76
|
+
<slot name="content" @click="${this.hide}" style="display:${this.open ? 'flex' : 'none'}">${unsafeHTML(this.html)}</slot>
|
|
77
|
+
`;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
__decorate([
|
|
81
|
+
property({ type: Boolean }),
|
|
82
|
+
__metadata("design:type", Object)
|
|
83
|
+
], QboPopup.prototype, "open", void 0);
|
|
84
|
+
__decorate([
|
|
85
|
+
property({ type: Boolean }),
|
|
86
|
+
__metadata("design:type", Object)
|
|
87
|
+
], QboPopup.prototype, "loading", void 0);
|
|
88
|
+
__decorate([
|
|
89
|
+
property({ type: Boolean }),
|
|
90
|
+
__metadata("design:type", Object)
|
|
91
|
+
], QboPopup.prototype, "renderInHost", void 0);
|
|
92
|
+
QboPopup = __decorate([
|
|
93
|
+
customElement('qbo-popup')
|
|
94
|
+
], QboPopup);
|
|
95
|
+
export { QboPopup };
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { html, css } from 'lit';
|
|
2
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
3
|
+
import { QboFetch } from './qbo-fetch.js';
|
|
4
|
+
import { unsafeHTML } from 'lit/directives/unsafe-html.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Renders a <select> element with options populated from a JSON array.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* This element is a thin wrapper around {@link QboFetch} that renders a <select> element with options populated from a JSON array.
|
|
11
|
+
*/
|
|
12
|
+
@customElement('qbo-popup')
|
|
13
|
+
export class QboPopup extends QboFetch {
|
|
14
|
+
@property({ type: Boolean })
|
|
15
|
+
open = false;
|
|
16
|
+
|
|
17
|
+
@property({ type: Boolean })
|
|
18
|
+
loading = false;
|
|
19
|
+
|
|
20
|
+
@property({ type: Boolean })
|
|
21
|
+
renderInHost = false;
|
|
22
|
+
|
|
23
|
+
// container: HTMLElement;
|
|
24
|
+
|
|
25
|
+
static styles = [
|
|
26
|
+
css`
|
|
27
|
+
/* Add any custom styles here */
|
|
28
|
+
.foo { color: red; }
|
|
29
|
+
`
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
async connectedCallback() {
|
|
33
|
+
super.connectedCallback();
|
|
34
|
+
this.handleOutsideClick = this.handleOutsideClick.bind(this);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
//updated(changedProperties) {
|
|
38
|
+
// super.updated(changedProperties);
|
|
39
|
+
// if (this.container != null)
|
|
40
|
+
// this.container.style.display = (changedProperties.has('show')) ? 'flex' : 'none';
|
|
41
|
+
//}
|
|
42
|
+
|
|
43
|
+
toggle() {
|
|
44
|
+
this.open = !this.open;
|
|
45
|
+
if (this.open)
|
|
46
|
+
document.addEventListener('click', this.handleOutsideClick);
|
|
47
|
+
else
|
|
48
|
+
document.removeEventListener('click', this.handleOutsideClick);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
show() {
|
|
52
|
+
//if (this.container == null)
|
|
53
|
+
// this.container = this.shadowRoot.querySelector('.modal-container')
|
|
54
|
+
//this.container.style.display = 'flex';
|
|
55
|
+
this.open = true;
|
|
56
|
+
document.addEventListener('click', this.handleOutsideClick);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
hide(event) {
|
|
60
|
+
if (event.target.closest('[data-dismiss="modal"]')) {
|
|
61
|
+
// this.togglePopup(false);
|
|
62
|
+
this.open = false;
|
|
63
|
+
document.removeEventListener('click', this.handleOutsideClick);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
handleOutsideClick(event) {
|
|
68
|
+
if (this.open && !this.contains(event.target)) {
|
|
69
|
+
// this.togglePopup(false);
|
|
70
|
+
this.open = false;
|
|
71
|
+
document.removeEventListener('click', this.handleOutsideClick);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
render() {
|
|
77
|
+
return html`
|
|
78
|
+
<slot name="button" @click="${this.toggle}">
|
|
79
|
+
<button class="btn">Popup</button>
|
|
80
|
+
</slot>
|
|
81
|
+
<slot name="content" @click="${this.hide}" style="display:${this.open ? 'flex' : 'none'}">${unsafeHTML(this.html)}</slot>
|
|
82
|
+
`;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { QboFetch } from './qbo-fetch.js';
|
|
2
|
+
/**
|
|
3
|
+
* Renders a <select> element with options populated from a JSON array.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* This element is a thin wrapper around {@link QboFetch} that renders a <select> element with options populated from a JSON array.
|
|
7
|
+
*/
|
|
8
|
+
export declare class QboSelect extends QboFetch {
|
|
9
|
+
loading: boolean;
|
|
10
|
+
optionText: string | null;
|
|
11
|
+
optionValue: string | null;
|
|
12
|
+
defaultValue: null;
|
|
13
|
+
qboClass: null;
|
|
14
|
+
options: Array<{
|
|
15
|
+
[key: string]: string;
|
|
16
|
+
}> | null;
|
|
17
|
+
renderInHost: boolean;
|
|
18
|
+
static styles: import("lit").CSSResult[];
|
|
19
|
+
connectedCallback(): Promise<void>;
|
|
20
|
+
createRenderRoot(): Element | ShadowRoot;
|
|
21
|
+
render(): import("lit").TemplateResult<1>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
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 { html, css } from 'lit';
|
|
11
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
12
|
+
import { getArray } from './qbo-json.js';
|
|
13
|
+
import { QboFetch } from './qbo-fetch.js';
|
|
14
|
+
/**
|
|
15
|
+
* Renders a <select> element with options populated from a JSON array.
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* This element is a thin wrapper around {@link QboFetch} that renders a <select> element with options populated from a JSON array.
|
|
19
|
+
*/
|
|
20
|
+
let QboSelect = class QboSelect extends QboFetch {
|
|
21
|
+
constructor() {
|
|
22
|
+
super(...arguments);
|
|
23
|
+
this.loading = false;
|
|
24
|
+
this.optionText = null;
|
|
25
|
+
this.optionValue = null;
|
|
26
|
+
this.defaultValue = null;
|
|
27
|
+
this.qboClass = null;
|
|
28
|
+
this.options = [];
|
|
29
|
+
this.renderInHost = true;
|
|
30
|
+
}
|
|
31
|
+
static { this.styles = [
|
|
32
|
+
css `
|
|
33
|
+
/* Add any custom styles here */
|
|
34
|
+
.foo { color: red; }
|
|
35
|
+
`
|
|
36
|
+
]; }
|
|
37
|
+
async connectedCallback() {
|
|
38
|
+
this.optionText ??= this.optionValue;
|
|
39
|
+
super.connectedCallback();
|
|
40
|
+
}
|
|
41
|
+
createRenderRoot() {
|
|
42
|
+
return this.renderInHost ? this : super.createRenderRoot();
|
|
43
|
+
}
|
|
44
|
+
render() {
|
|
45
|
+
this.options = getArray(this.jsonData);
|
|
46
|
+
if (!this.options || this.options.length === 0)
|
|
47
|
+
return html `<p>Loading...</p>`;
|
|
48
|
+
this.optionValue ??= Object.keys(this.options[0])[0];
|
|
49
|
+
this.optionText ??= Object.keys(this.options[0])[1] ?? this.optionValue;
|
|
50
|
+
return html `
|
|
51
|
+
<select class=${this.qboClass}>
|
|
52
|
+
${this.options.map(option => html `<option value="${option[this.optionValue]}" ?selected="${option[this.optionValue] === this.defaultValue}">${option[this.optionText]}</option>`)}
|
|
53
|
+
</select>`;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
__decorate([
|
|
57
|
+
property({ type: Boolean }),
|
|
58
|
+
__metadata("design:type", Object)
|
|
59
|
+
], QboSelect.prototype, "loading", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
property({ type: String }),
|
|
62
|
+
__metadata("design:type", Object)
|
|
63
|
+
], QboSelect.prototype, "optionText", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
property({ type: String }),
|
|
66
|
+
__metadata("design:type", Object)
|
|
67
|
+
], QboSelect.prototype, "optionValue", void 0);
|
|
68
|
+
__decorate([
|
|
69
|
+
property({ type: String }),
|
|
70
|
+
__metadata("design:type", Object)
|
|
71
|
+
], QboSelect.prototype, "defaultValue", void 0);
|
|
72
|
+
__decorate([
|
|
73
|
+
property({ attribute: 'qbo-class' }),
|
|
74
|
+
__metadata("design:type", Object)
|
|
75
|
+
], QboSelect.prototype, "qboClass", void 0);
|
|
76
|
+
__decorate([
|
|
77
|
+
property({ type: Array }),
|
|
78
|
+
__metadata("design:type", Object)
|
|
79
|
+
], QboSelect.prototype, "options", void 0);
|
|
80
|
+
__decorate([
|
|
81
|
+
property({ type: Boolean }),
|
|
82
|
+
__metadata("design:type", Object)
|
|
83
|
+
], QboSelect.prototype, "renderInHost", void 0);
|
|
84
|
+
QboSelect = __decorate([
|
|
85
|
+
customElement('qbo-select')
|
|
86
|
+
], QboSelect);
|
|
87
|
+
export { QboSelect };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { html, css } from 'lit';
|
|
2
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
3
|
+
import { getArray } from './qbo-json.js';
|
|
4
|
+
import { QboFetch } from './qbo-fetch.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Renders a <select> element with options populated from a JSON array.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* This element is a thin wrapper around {@link QboFetch} that renders a <select> element with options populated from a JSON array.
|
|
11
|
+
*/
|
|
12
|
+
@customElement('qbo-select')
|
|
13
|
+
export class QboSelect extends QboFetch
|
|
14
|
+
{
|
|
15
|
+
@property({ type: Boolean })
|
|
16
|
+
loading = false;
|
|
17
|
+
|
|
18
|
+
@property({ type: String })
|
|
19
|
+
optionText: string | null = null;
|
|
20
|
+
|
|
21
|
+
@property({ type: String })
|
|
22
|
+
optionValue: string | null = null;
|
|
23
|
+
|
|
24
|
+
@property({ type: String })
|
|
25
|
+
defaultValue = null;
|
|
26
|
+
|
|
27
|
+
@property({ attribute: 'qbo-class' })
|
|
28
|
+
qboClass = null;
|
|
29
|
+
|
|
30
|
+
@property({ type: Array })
|
|
31
|
+
options: Array<{ [key: string]: string }> | null = [];
|
|
32
|
+
|
|
33
|
+
@property({ type: Boolean })
|
|
34
|
+
renderInHost = true;
|
|
35
|
+
|
|
36
|
+
static styles = [
|
|
37
|
+
css`
|
|
38
|
+
/* Add any custom styles here */
|
|
39
|
+
.foo { color: red; }
|
|
40
|
+
`
|
|
41
|
+
];
|
|
42
|
+
|
|
43
|
+
async connectedCallback() {
|
|
44
|
+
this.optionText ??= this.optionValue;
|
|
45
|
+
super.connectedCallback();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
createRenderRoot() {
|
|
49
|
+
return this.renderInHost ? this : super.createRenderRoot();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
render() {
|
|
53
|
+
this.options = getArray(this.jsonData);
|
|
54
|
+
if (!this.options || this.options.length === 0)
|
|
55
|
+
return html`<p>Loading...</p>`;
|
|
56
|
+
|
|
57
|
+
this.optionValue ??= Object.keys(this.options[0])[0];
|
|
58
|
+
this.optionText ??= Object.keys(this.options[0])[1] ?? this.optionValue;
|
|
59
|
+
|
|
60
|
+
return html`
|
|
61
|
+
<select class=${this.qboClass}>
|
|
62
|
+
${this.options.map(option => html`<option value="${option[this.optionValue!]}" ?selected="${option[this.optionValue!] === this.defaultValue}">${option[this.optionText!]}</option>`)}
|
|
63
|
+
</select>`;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { LitElement, PropertyValues } from 'lit';
|
|
2
|
+
export declare class QboSideBar extends LitElement {
|
|
3
|
+
collapseAttribute: string;
|
|
4
|
+
collapseSelector: string;
|
|
5
|
+
menuCollapsed: string;
|
|
6
|
+
menuExpanded: string;
|
|
7
|
+
menuShow: string;
|
|
8
|
+
updated(changedProperties: PropertyValues): void;
|
|
9
|
+
render(): import("lit").TemplateResult<1>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
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 { html, LitElement } from 'lit';
|
|
11
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
12
|
+
let QboSideBar = class QboSideBar extends LitElement {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
this.collapseAttribute = `aria-expanded`;
|
|
16
|
+
this.collapseSelector = `[data-qbo-toggle="collapse"]`;
|
|
17
|
+
this.menuCollapsed = `false`;
|
|
18
|
+
this.menuExpanded = `true`;
|
|
19
|
+
this.menuShow = `qbo-show`;
|
|
20
|
+
}
|
|
21
|
+
updated(changedProperties) {
|
|
22
|
+
/* Enable collapsing menus */
|
|
23
|
+
const root = this;
|
|
24
|
+
root.querySelectorAll(`${this.collapseSelector}`).forEach(function (btn) {
|
|
25
|
+
btn.addEventListener('click', (e) => {
|
|
26
|
+
const sibling = btn.nextElementSibling;
|
|
27
|
+
if (btn.getAttribute(root.collapseAttribute) == root.menuCollapsed) {
|
|
28
|
+
if (sibling instanceof HTMLElement)
|
|
29
|
+
sibling.classList.add(root.menuShow);
|
|
30
|
+
btn.setAttribute(root.collapseAttribute, root.menuExpanded);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
if (sibling instanceof HTMLElement)
|
|
34
|
+
sibling.classList.remove(root.menuShow);
|
|
35
|
+
btn.setAttribute(root.collapseAttribute, root.menuCollapsed);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
render() { return html `<slot></slot>`; }
|
|
41
|
+
};
|
|
42
|
+
__decorate([
|
|
43
|
+
property({ type: String }),
|
|
44
|
+
__metadata("design:type", Object)
|
|
45
|
+
], QboSideBar.prototype, "collapseAttribute", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
property({ type: String }),
|
|
48
|
+
__metadata("design:type", Object)
|
|
49
|
+
], QboSideBar.prototype, "collapseSelector", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
property({ type: String }),
|
|
52
|
+
__metadata("design:type", Object)
|
|
53
|
+
], QboSideBar.prototype, "menuCollapsed", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
property({ type: String }),
|
|
56
|
+
__metadata("design:type", Object)
|
|
57
|
+
], QboSideBar.prototype, "menuExpanded", void 0);
|
|
58
|
+
__decorate([
|
|
59
|
+
property({ type: String }),
|
|
60
|
+
__metadata("design:type", Object)
|
|
61
|
+
], QboSideBar.prototype, "menuShow", void 0);
|
|
62
|
+
QboSideBar = __decorate([
|
|
63
|
+
customElement('qbo-sidebar')
|
|
64
|
+
], QboSideBar);
|
|
65
|
+
export { QboSideBar };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { html, LitElement, PropertyValues } from 'lit';
|
|
2
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
3
|
+
|
|
4
|
+
@customElement('qbo-sidebar')
|
|
5
|
+
export class QboSideBar extends LitElement {
|
|
6
|
+
|
|
7
|
+
@property({ type: String })
|
|
8
|
+
collapseAttribute = `aria-expanded`;
|
|
9
|
+
|
|
10
|
+
@property({ type: String })
|
|
11
|
+
collapseSelector = `[data-qbo-toggle="collapse"]`;
|
|
12
|
+
|
|
13
|
+
@property({ type: String })
|
|
14
|
+
menuCollapsed = `false`;
|
|
15
|
+
|
|
16
|
+
@property({ type: String })
|
|
17
|
+
menuExpanded = `true`;
|
|
18
|
+
|
|
19
|
+
@property({ type: String })
|
|
20
|
+
menuShow = `qbo-show`;
|
|
21
|
+
|
|
22
|
+
updated(changedProperties: PropertyValues) {
|
|
23
|
+
/* Enable collapsing menus */
|
|
24
|
+
const root = this;
|
|
25
|
+
root.querySelectorAll(`${this.collapseSelector}`).forEach(function (btn) {
|
|
26
|
+
btn.addEventListener('click', (e) => {
|
|
27
|
+
const sibling = btn.nextElementSibling;
|
|
28
|
+
|
|
29
|
+
if (btn.getAttribute(root.collapseAttribute) == root.menuCollapsed) {
|
|
30
|
+
if (sibling instanceof HTMLElement) sibling.classList.add(root.menuShow);
|
|
31
|
+
btn.setAttribute(root.collapseAttribute, root.menuExpanded);
|
|
32
|
+
} else {
|
|
33
|
+
if (sibling instanceof HTMLElement) sibling.classList.remove(root.menuShow);
|
|
34
|
+
btn.setAttribute(root.collapseAttribute, root.menuCollapsed);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
render() { return html`<slot></slot>`; }
|
|
41
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { QboFetch } from './qbo-fetch.js';
|
|
2
|
+
/**
|
|
3
|
+
* Renders a <select> element with options populated from a JSON array.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* This element is a thin wrapper around {@link QboFetch} that renders a <table> element with options populated from a JSON array.
|
|
7
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/template#examples
|
|
8
|
+
*/
|
|
9
|
+
export declare class QboTable extends QboFetch {
|
|
10
|
+
loading: boolean;
|
|
11
|
+
renderInHost: boolean;
|
|
12
|
+
qboClass: string;
|
|
13
|
+
dataSelector: null;
|
|
14
|
+
options: Array<{
|
|
15
|
+
[key: string]: string;
|
|
16
|
+
}> | null;
|
|
17
|
+
connectedCallback(): Promise<void>;
|
|
18
|
+
createRenderRoot(): Element | ShadowRoot;
|
|
19
|
+
render(): import("lit").TemplateResult<1>;
|
|
20
|
+
loadData(): Array<{
|
|
21
|
+
[key: string]: string;
|
|
22
|
+
}> | null;
|
|
23
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
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 { html } from 'lit';
|
|
11
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
12
|
+
import { getArray, replicate } from './qbo-json.js';
|
|
13
|
+
import { QboFetch } from './qbo-fetch.js';
|
|
14
|
+
/**
|
|
15
|
+
* Renders a <select> element with options populated from a JSON array.
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* This element is a thin wrapper around {@link QboFetch} that renders a <table> element with options populated from a JSON array.
|
|
19
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/template#examples
|
|
20
|
+
*/
|
|
21
|
+
let QboTable = class QboTable extends QboFetch {
|
|
22
|
+
constructor() {
|
|
23
|
+
super(...arguments);
|
|
24
|
+
this.loading = false;
|
|
25
|
+
this.renderInHost = false;
|
|
26
|
+
this.qboClass = 'table table-striped table-hover';
|
|
27
|
+
this.dataSelector = null;
|
|
28
|
+
this.options = null;
|
|
29
|
+
}
|
|
30
|
+
async connectedCallback() {
|
|
31
|
+
super.connectedCallback();
|
|
32
|
+
}
|
|
33
|
+
/* @description Let related elements know that the content has changed by raising a content-changed event. */
|
|
34
|
+
//updated(changedProperties) {
|
|
35
|
+
// super.update(changedProperties);
|
|
36
|
+
// this.dispatchEvent(new CustomEvent('qbo-updated', { bubbles: true, composed: true }));
|
|
37
|
+
//}
|
|
38
|
+
createRenderRoot() {
|
|
39
|
+
return this.renderInHost ? this : super.createRenderRoot();
|
|
40
|
+
}
|
|
41
|
+
render() {
|
|
42
|
+
this.options = getArray(this.jsonData)
|
|
43
|
+
?? this.loadData()
|
|
44
|
+
?? [{ Loading: "..." }];
|
|
45
|
+
const body = this.querySelector('tbody');
|
|
46
|
+
const template = this.querySelector('template');
|
|
47
|
+
// If the user has specified a <template> for the body, replicate it for each item in the array.
|
|
48
|
+
replicate(this.querySelector('tbody'), this.querySelector('template'), this.options);
|
|
49
|
+
const keys = Object.keys(this.options[0]);
|
|
50
|
+
return html `<slot>
|
|
51
|
+
<table class=${this.qboClass}>
|
|
52
|
+
<thead>
|
|
53
|
+
${this.querySelector('*[slot=header]') != null ? html `<tr><th colspan="${keys.length}"><slot name="header"></slot></th></tr>` : null}
|
|
54
|
+
<tr>${keys.map(key => html `<th>${key}</th>`)}</tr>
|
|
55
|
+
</thead>
|
|
56
|
+
<tbody>${this.options.map((option, index) => html `<tr data-index="${index}">${keys.map(key => html `<td>${option[key]}</td>`)}</tr>`)}</tbody>
|
|
57
|
+
<tfoot><tr><td colspan="${keys.length}"><slot name="footer">${keys.length} rows rendered.</slot></td></tr></tfoot>
|
|
58
|
+
</table>
|
|
59
|
+
</slot>`;
|
|
60
|
+
}
|
|
61
|
+
loadData() {
|
|
62
|
+
if (this.dataSelector != null) {
|
|
63
|
+
const script = document.querySelector(this.dataSelector);
|
|
64
|
+
if (script != null) {
|
|
65
|
+
return getArray(script.text);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
__decorate([
|
|
72
|
+
property({ type: Boolean }),
|
|
73
|
+
__metadata("design:type", Object)
|
|
74
|
+
], QboTable.prototype, "loading", void 0);
|
|
75
|
+
__decorate([
|
|
76
|
+
property({ type: Boolean }),
|
|
77
|
+
__metadata("design:type", Object)
|
|
78
|
+
], QboTable.prototype, "renderInHost", void 0);
|
|
79
|
+
__decorate([
|
|
80
|
+
property({ attribute: 'qbo-class' }),
|
|
81
|
+
__metadata("design:type", Object)
|
|
82
|
+
], QboTable.prototype, "qboClass", void 0);
|
|
83
|
+
__decorate([
|
|
84
|
+
property(),
|
|
85
|
+
__metadata("design:type", Object)
|
|
86
|
+
], QboTable.prototype, "dataSelector", void 0);
|
|
87
|
+
__decorate([
|
|
88
|
+
property(),
|
|
89
|
+
__metadata("design:type", Object)
|
|
90
|
+
], QboTable.prototype, "options", void 0);
|
|
91
|
+
QboTable = __decorate([
|
|
92
|
+
customElement('qbo-table')
|
|
93
|
+
], QboTable);
|
|
94
|
+
export { QboTable };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qbo-select.js","sourceRoot":"","sources":["qbo-select.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C;;;;;IAKI;AAEG,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,QAAQ;IAAhC;;QAGH,YAAO,GAAG,KAAK,CAAC;QAGhB,eAAU,GAAkB,IAAI,CAAC;QAGjC,gBAAW,GAAkB,IAAI,CAAC;QAGlC,iBAAY,GAAG,IAAI,CAAC;QAGpB,aAAQ,GAAG,IAAI,CAAC;QAGhB,YAAO,GAA4C,EAAE,CAAC;QAGtD,iBAAY,GAAG,IAAI,CAAC;IA+BxB,CAAC;aA7BU,WAAM,GAAG;QACZ,GAAG,CAAA;;;SAGF;KACJ,AALY,CAKX;IAEF,KAAK,CAAC,iBAAiB;QACnB,IAAI,CAAC,UAAU,KAAK,IAAI,CAAC,WAAW,CAAC;QACrC,KAAK,CAAC,iBAAiB,EAAE,CAAC;IAC9B,CAAC;IAED,gBAAgB;QACZ,OAAO,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,gBAAgB,EAAE,CAAC;IAC/D,CAAC;IAED,MAAM;QACF,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACvC,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC;YAC1C,OAAO,IAAI,CAAA,mBAAmB,CAAC;QAEnC,IAAI,CAAC,WAAW,KAAK,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACrD,IAAI,CAAC,UAAU,KAAK,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,WAAW,CAAC;QAExE,OAAO,IAAI,CAAA;gCACa,IAAI,CAAC,QAAQ;sBACvB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAA,kBAAkB,MAAM,CAAC,IAAI,CAAC,WAAY,CAAC,gBAAgB,MAAM,CAAC,IAAI,CAAC,WAAY,CAAC,KAAK,IAAI,CAAC,YAAY,KAAK,MAAM,CAAC,IAAI,CAAC,UAAW,CAAC,WAAW,CAAC;0BAC9K,CAAC;IACvB,CAAC;;AAhDD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;0CACZ;AAGhB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CACM;AAGjC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CACO;AAGlC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CACP;AAGpB;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;2CACrB;AAGhB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;0CAC4B;AAGtD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;+CACR;AArBX,SAAS;IADrB,aAAa,CAAC,YAAY,CAAC;GACf,SAAS,CAoDrB"}
|