@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,96 @@
|
|
|
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
|
+
import { container } from 'tsyringe';
|
|
13
|
+
import { substitute } from './qbo-json.js';
|
|
14
|
+
export class RestApiService {
|
|
15
|
+
constructor(apiEndpoint, headers = { 'Content-Type': 'application/json' }, method = null) {
|
|
16
|
+
this.apiEndpoint = apiEndpoint;
|
|
17
|
+
this.headers = headers;
|
|
18
|
+
this.method = method;
|
|
19
|
+
}
|
|
20
|
+
async fetch(relativePath, payload = null) {
|
|
21
|
+
const endpoint = substitute(new URL(relativePath ?? '', this.apiEndpoint).href, payload);
|
|
22
|
+
const method = this.method ?? (payload !== null ? 'POST' : 'GET');
|
|
23
|
+
const headers = new Headers(this.headers || {});
|
|
24
|
+
if (payload !== null && !headers.has('Content-Type')) {
|
|
25
|
+
headers.append('Content-Type', 'application/json');
|
|
26
|
+
}
|
|
27
|
+
const response = await fetch(endpoint, {
|
|
28
|
+
method: method,
|
|
29
|
+
headers: headers,
|
|
30
|
+
body: (method === 'POST' && payload) ? JSON.stringify(payload) : null
|
|
31
|
+
});
|
|
32
|
+
if (!response.ok) {
|
|
33
|
+
throw new Error(`API request failed with status ${response.status}`);
|
|
34
|
+
}
|
|
35
|
+
return response.json();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
let ApiServiceComponent = class ApiServiceComponent extends LitElement {
|
|
39
|
+
constructor() {
|
|
40
|
+
super(...arguments);
|
|
41
|
+
this.name = null;
|
|
42
|
+
this.apiEndpoint = null;
|
|
43
|
+
this.method = 'POST';
|
|
44
|
+
}
|
|
45
|
+
firstUpdated() {
|
|
46
|
+
const headers = {};
|
|
47
|
+
if (this.name == null)
|
|
48
|
+
console.error('qbo-api name is required.');
|
|
49
|
+
if (this.apiEndpoint == null)
|
|
50
|
+
console.error('qbo-api apiEndpoint is required.');
|
|
51
|
+
const headerElements = this.querySelectorAll('header');
|
|
52
|
+
headerElements.forEach(header => {
|
|
53
|
+
const name = header.getAttribute('name');
|
|
54
|
+
const value = header.textContent;
|
|
55
|
+
if (name && value) {
|
|
56
|
+
headers[name] = value;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
// Adjust for correct header naming convention, if necessary
|
|
60
|
+
if (headers['ContentType']) {
|
|
61
|
+
headers['Content-Type'] = headers['ContentType'];
|
|
62
|
+
delete headers['ContentType'];
|
|
63
|
+
}
|
|
64
|
+
container.registerInstance(this.name, new RestApiService(this.apiEndpoint, headers, this.method));
|
|
65
|
+
// Call the registerRestApi function with the extracted configuration
|
|
66
|
+
registerRestApi(this.name, this.apiEndpoint, headers, this.method);
|
|
67
|
+
}
|
|
68
|
+
render() {
|
|
69
|
+
// Render nothing, as this component is for configuration purposes only
|
|
70
|
+
return html ``;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
__decorate([
|
|
74
|
+
property({ type: String }),
|
|
75
|
+
__metadata("design:type", Object)
|
|
76
|
+
], ApiServiceComponent.prototype, "name", void 0);
|
|
77
|
+
__decorate([
|
|
78
|
+
property({ type: String }),
|
|
79
|
+
__metadata("design:type", Object)
|
|
80
|
+
], ApiServiceComponent.prototype, "apiEndpoint", void 0);
|
|
81
|
+
__decorate([
|
|
82
|
+
property({ type: String }),
|
|
83
|
+
__metadata("design:type", String)
|
|
84
|
+
], ApiServiceComponent.prototype, "method", void 0);
|
|
85
|
+
ApiServiceComponent = __decorate([
|
|
86
|
+
customElement('qbo-api')
|
|
87
|
+
], ApiServiceComponent);
|
|
88
|
+
export { ApiServiceComponent };
|
|
89
|
+
container.registerInstance('default', new RestApiService(document.querySelector('base[href]')?.getAttribute('href') || window.location.origin));
|
|
90
|
+
function registerRestApi(name, apiEndpoint, headers = { 'Content-Type': 'application/json' }, method) {
|
|
91
|
+
container.registerInstance(name, new RestApiService(apiEndpoint, headers, method));
|
|
92
|
+
}
|
|
93
|
+
function getApiService(name) {
|
|
94
|
+
return container.resolve(name);
|
|
95
|
+
}
|
|
96
|
+
export { registerRestApi, getApiService };
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { html, css, LitElement } from 'lit';
|
|
2
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
3
|
+
import { container, injectable, InjectionToken } from 'tsyringe';
|
|
4
|
+
import {substitute} from './qbo-json.js';
|
|
5
|
+
/**
|
|
6
|
+
* Defines a contract for form field validation.
|
|
7
|
+
* @remarks
|
|
8
|
+
* External classes may define custom validators by implementing this interface.
|
|
9
|
+
* Register the custom validator with the tsyringe DI container using {@link ValidateToken}.
|
|
10
|
+
*/
|
|
11
|
+
export interface IApiService {
|
|
12
|
+
fetch(relativePath: string | null, payload: Record<string, string> | null): Promise<any>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export class RestApiService implements IApiService {
|
|
16
|
+
|
|
17
|
+
private headers: HeadersInit;
|
|
18
|
+
private apiEndpoint: string;
|
|
19
|
+
private method: string | null;
|
|
20
|
+
|
|
21
|
+
constructor(apiEndpoint: string, headers: HeadersInit = { 'Content-Type': 'application/json' }, method: string | null = null) {
|
|
22
|
+
this.apiEndpoint = apiEndpoint;
|
|
23
|
+
this.headers = headers;
|
|
24
|
+
this.method = method;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
async fetch(relativePath: string | null, payload: Record<string, string> | null = null): Promise<any> {
|
|
28
|
+
const endpoint = substitute(new URL(relativePath ?? '', this.apiEndpoint).href, payload);
|
|
29
|
+
const method = this.method ?? (payload !== null ? 'POST' : 'GET');
|
|
30
|
+
const headers = new Headers(this.headers || {});
|
|
31
|
+
if (payload !== null && !headers.has('Content-Type')) {
|
|
32
|
+
headers.append('Content-Type', 'application/json');
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const response = await fetch(endpoint, {
|
|
36
|
+
method: method,
|
|
37
|
+
headers: headers,
|
|
38
|
+
body: (method === 'POST' && payload) ? JSON.stringify(payload) : null
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
if (!response.ok) {
|
|
42
|
+
throw new Error(`API request failed with status ${response.status}`);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return response.json();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
@customElement('qbo-api')
|
|
51
|
+
export class ApiServiceComponent extends LitElement {
|
|
52
|
+
@property({ type: String })
|
|
53
|
+
name: string | null = null;
|
|
54
|
+
|
|
55
|
+
@property({ type: String })
|
|
56
|
+
apiEndpoint: string | null = null;
|
|
57
|
+
|
|
58
|
+
@property({ type: String })
|
|
59
|
+
method: string = 'POST';
|
|
60
|
+
|
|
61
|
+
firstUpdated() {
|
|
62
|
+
const headers: HeadersInit = {};
|
|
63
|
+
|
|
64
|
+
if (this.name == null)
|
|
65
|
+
console.error('qbo-api name is required.');
|
|
66
|
+
if (this.apiEndpoint == null)
|
|
67
|
+
console.error('qbo-api apiEndpoint is required.');
|
|
68
|
+
|
|
69
|
+
const headerElements = this.querySelectorAll('header');
|
|
70
|
+
headerElements.forEach(header => {
|
|
71
|
+
const name = header.getAttribute('name');
|
|
72
|
+
const value = header.textContent;
|
|
73
|
+
if (name && value) {
|
|
74
|
+
headers[name] = value;
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
// Adjust for correct header naming convention, if necessary
|
|
79
|
+
if (headers['ContentType']) {
|
|
80
|
+
headers['Content-Type'] = headers['ContentType'];
|
|
81
|
+
delete headers['ContentType'];
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
container.registerInstance<IApiService>(this.name!, new RestApiService(this.apiEndpoint!, headers, this.method));
|
|
85
|
+
|
|
86
|
+
// Call the registerRestApi function with the extracted configuration
|
|
87
|
+
registerRestApi(this.name!, this.apiEndpoint!, headers, this.method);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
render() {
|
|
91
|
+
// Render nothing, as this component is for configuration purposes only
|
|
92
|
+
return html``;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
container.registerInstance<IApiService>('default', new RestApiService(document.querySelector('base[href]')?.getAttribute('href') || window.location.origin));
|
|
97
|
+
|
|
98
|
+
function registerRestApi(name: string, apiEndpoint: string, headers: HeadersInit = { 'Content-Type': 'application/json' }, method?: string | null) {
|
|
99
|
+
container.registerInstance<IApiService>(name, new RestApiService(apiEndpoint, headers, method));
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function getApiService(name: string) {
|
|
103
|
+
return container.resolve<IApiService>(name);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export { registerRestApi, getApiService }
|
|
@@ -0,0 +1,32 @@
|
|
|
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 QboBadge extends QboFetch {
|
|
9
|
+
loading: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* @description A CSS selector that identifies the parent element containing the badges.
|
|
12
|
+
*/
|
|
13
|
+
target: null;
|
|
14
|
+
values: string[];
|
|
15
|
+
targetElement: Element | null;
|
|
16
|
+
/**
|
|
17
|
+
* @description A CSS selector that identifies where to render the badge elements.
|
|
18
|
+
* These elements should have a data-badge attribute that contributes to the API call.
|
|
19
|
+
* @example <div data-badge="123"/>
|
|
20
|
+
*/
|
|
21
|
+
selector: string;
|
|
22
|
+
connectedCallback(): Promise<void>;
|
|
23
|
+
disconnectedCallback(): void;
|
|
24
|
+
getPayload(headers: {
|
|
25
|
+
[key: string]: string;
|
|
26
|
+
}): void;
|
|
27
|
+
getIds(): void;
|
|
28
|
+
fetchData(headers: {
|
|
29
|
+
[key: string]: string;
|
|
30
|
+
}, payload: Object | null): Promise<void>;
|
|
31
|
+
render(): void;
|
|
32
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
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 { customElement, property } from 'lit/decorators.js';
|
|
11
|
+
import { QboFetch } from './qbo-fetch.js';
|
|
12
|
+
/**
|
|
13
|
+
* Renders a <select> element with options populated from a JSON array.
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* This element is a thin wrapper around {@link QboFetch} that renders a <select> element with options populated from a JSON array.
|
|
17
|
+
*/
|
|
18
|
+
let QboBadge = class QboBadge extends QboFetch {
|
|
19
|
+
constructor() {
|
|
20
|
+
super(...arguments);
|
|
21
|
+
this.loading = false;
|
|
22
|
+
/**
|
|
23
|
+
* @description A CSS selector that identifies the parent element containing the badges.
|
|
24
|
+
*/
|
|
25
|
+
this.target = null;
|
|
26
|
+
this.values = [];
|
|
27
|
+
this.targetElement = null;
|
|
28
|
+
/**
|
|
29
|
+
* @description A CSS selector that identifies where to render the badge elements.
|
|
30
|
+
* These elements should have a data-badge attribute that contributes to the API call.
|
|
31
|
+
* @example <div data-badge="123"/>
|
|
32
|
+
*/
|
|
33
|
+
this.selector = '*[data-badge]';
|
|
34
|
+
}
|
|
35
|
+
async connectedCallback() {
|
|
36
|
+
this.targetElement = (this.target != null) ? this.closest(this.target) : this;
|
|
37
|
+
if (this.targetElement == null)
|
|
38
|
+
throw new Error(`Could not find target element ${this.target}`);
|
|
39
|
+
this.targetElement.addEventListener('qbo-updated', this.getIds.bind(this));
|
|
40
|
+
super.connectedCallback();
|
|
41
|
+
}
|
|
42
|
+
disconnectedCallback() {
|
|
43
|
+
this.targetElement?.removeEventListener('qbo-updated', this.getIds);
|
|
44
|
+
}
|
|
45
|
+
getPayload(headers) {
|
|
46
|
+
const payload = super.getPayload(headers) ?? {};
|
|
47
|
+
payload["idList"] = this.values.join(",");
|
|
48
|
+
}
|
|
49
|
+
;
|
|
50
|
+
getIds() {
|
|
51
|
+
console.log('reacting to target qbo-updated');
|
|
52
|
+
if (this.targetElement == null)
|
|
53
|
+
return;
|
|
54
|
+
const values = [];
|
|
55
|
+
const elements = this.targetElement.querySelectorAll(this.selector);
|
|
56
|
+
elements.forEach((element) => {
|
|
57
|
+
const dataBadgeValue = element.getAttribute('data-badge');
|
|
58
|
+
if (dataBadgeValue !== null) {
|
|
59
|
+
values.push(dataBadgeValue);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
this.values = values;
|
|
63
|
+
}
|
|
64
|
+
async fetchData(headers, payload) {
|
|
65
|
+
super.fetchData(headers, payload);
|
|
66
|
+
}
|
|
67
|
+
render() {
|
|
68
|
+
const elements = this.targetElement.querySelectorAll(this.selector);
|
|
69
|
+
elements.forEach((element) => {
|
|
70
|
+
element.innerHTML = element.getAttribute('data-badge') ?? '';
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
__decorate([
|
|
75
|
+
property({ type: Boolean }),
|
|
76
|
+
__metadata("design:type", Object)
|
|
77
|
+
], QboBadge.prototype, "loading", void 0);
|
|
78
|
+
__decorate([
|
|
79
|
+
property(),
|
|
80
|
+
__metadata("design:type", Object)
|
|
81
|
+
], QboBadge.prototype, "target", void 0);
|
|
82
|
+
__decorate([
|
|
83
|
+
property(),
|
|
84
|
+
__metadata("design:type", Array)
|
|
85
|
+
], QboBadge.prototype, "values", void 0);
|
|
86
|
+
__decorate([
|
|
87
|
+
property(),
|
|
88
|
+
__metadata("design:type", Object)
|
|
89
|
+
], QboBadge.prototype, "selector", void 0);
|
|
90
|
+
QboBadge = __decorate([
|
|
91
|
+
customElement('qbo-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
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-badge')
|
|
13
|
+
export class QboBadge extends QboFetch
|
|
14
|
+
{
|
|
15
|
+
@property({ type: Boolean })
|
|
16
|
+
loading = false;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @description A CSS selector that identifies the parent element containing the badges.
|
|
20
|
+
*/
|
|
21
|
+
@property()
|
|
22
|
+
target = null;
|
|
23
|
+
|
|
24
|
+
@property()
|
|
25
|
+
values: string[] = [];
|
|
26
|
+
|
|
27
|
+
targetElement: Element | null = null;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @description A CSS selector that identifies where to render the badge elements.
|
|
31
|
+
* These elements should have a data-badge attribute that contributes to the API call.
|
|
32
|
+
* @example <div data-badge="123"/>
|
|
33
|
+
*/
|
|
34
|
+
@property()
|
|
35
|
+
selector = '*[data-badge]';
|
|
36
|
+
|
|
37
|
+
async connectedCallback() {
|
|
38
|
+
this.targetElement = (this.target != null) ? this.closest(this.target) : this;
|
|
39
|
+
if (this.targetElement == null)
|
|
40
|
+
throw new Error(`Could not find target element ${this.target}`);
|
|
41
|
+
this.targetElement.addEventListener('qbo-updated', this.getIds.bind(this));
|
|
42
|
+
super.connectedCallback();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
disconnectedCallback() {
|
|
46
|
+
this.targetElement?.removeEventListener('qbo-updated', this.getIds);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
getPayload(headers: { [key: string]: string; }) {
|
|
50
|
+
const payload = super.getPayload(headers) ?? {};
|
|
51
|
+
payload["idList"] = this.values.join(",");
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
getIds() {
|
|
55
|
+
console.log('reacting to target qbo-updated');
|
|
56
|
+
if (this.targetElement == null)
|
|
57
|
+
return;
|
|
58
|
+
const values: string[] = [];
|
|
59
|
+
const elements = this.targetElement!.querySelectorAll(this.selector);
|
|
60
|
+
elements.forEach((element) => {
|
|
61
|
+
const dataBadgeValue = element.getAttribute('data-badge');
|
|
62
|
+
if (dataBadgeValue !== null) {
|
|
63
|
+
values.push(dataBadgeValue);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
this.values = values;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
async fetchData(headers: { [key: string]: string; }, payload: Object | null) {
|
|
70
|
+
|
|
71
|
+
super.fetchData(headers, payload)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
render() {
|
|
75
|
+
const elements = this.targetElement!.querySelectorAll(this.selector);
|
|
76
|
+
elements.forEach((element) => {
|
|
77
|
+
element.innerHTML = element.getAttribute('data-badge') ?? '';
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { QboFetch } from './qbo-fetch.js';
|
|
2
|
+
export declare class QboBreadcrumb extends QboFetch {
|
|
3
|
+
ariaCurrent: string;
|
|
4
|
+
ariaLabel: string;
|
|
5
|
+
containerClass: string;
|
|
6
|
+
liClass: string;
|
|
7
|
+
liActiveClass: string;
|
|
8
|
+
navClass: string;
|
|
9
|
+
ulClass: string;
|
|
10
|
+
apiEndpoint: URL;
|
|
11
|
+
display: null;
|
|
12
|
+
object: null;
|
|
13
|
+
objectId: null;
|
|
14
|
+
operation: null;
|
|
15
|
+
options: Array<{
|
|
16
|
+
[key: string]: string;
|
|
17
|
+
}> | null;
|
|
18
|
+
renderInHost: boolean;
|
|
19
|
+
createRenderRoot(): Element | ShadowRoot;
|
|
20
|
+
connectedCallback(): void;
|
|
21
|
+
renderItem(option: any): import("lit").TemplateResult<1>;
|
|
22
|
+
render(): import("lit").TemplateResult<1>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
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 } from './qbo-json.js';
|
|
13
|
+
import { QboFetch } from './qbo-fetch.js';
|
|
14
|
+
let QboBreadcrumb = class QboBreadcrumb extends QboFetch {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments);
|
|
17
|
+
this.ariaCurrent = 'page';
|
|
18
|
+
this.ariaLabel = 'breadcrumb';
|
|
19
|
+
this.containerClass = 'container-fluid';
|
|
20
|
+
this.liClass = 'breadcrumb-item';
|
|
21
|
+
this.liActiveClass = 'active';
|
|
22
|
+
this.navClass = 'breadcrumb bd-subnavbar py-2';
|
|
23
|
+
this.ulClass = 'breadcrumb';
|
|
24
|
+
this.apiEndpoint = new URL('config/breadcrumb', this.baseURI);
|
|
25
|
+
this.display = null;
|
|
26
|
+
this.object = null;
|
|
27
|
+
this.objectId = null;
|
|
28
|
+
this.operation = null;
|
|
29
|
+
this.options = [];
|
|
30
|
+
this.renderInHost = true;
|
|
31
|
+
}
|
|
32
|
+
createRenderRoot() {
|
|
33
|
+
return this.renderInHost ? this : super.createRenderRoot();
|
|
34
|
+
}
|
|
35
|
+
connectedCallback() {
|
|
36
|
+
let url = this.apiEndpoint.toString();
|
|
37
|
+
url = `${url}?Object=${this.object != null ? this.object : ''}`;
|
|
38
|
+
url = `${url}&ObjectID=${this.objectId != null ? this.objectId : ''}`;
|
|
39
|
+
url = `${url}&Operation=${this.operation != null ? this.operation : ''}`;
|
|
40
|
+
url = `${url}&Display=${this.display != null ? this.display : ''}`;
|
|
41
|
+
this.apiEndpoint = new URL(url, this.baseURI);
|
|
42
|
+
super.connectedCallback();
|
|
43
|
+
}
|
|
44
|
+
renderItem(option) {
|
|
45
|
+
const sequence = option["Sequence"];
|
|
46
|
+
const text = option["Text"];
|
|
47
|
+
const url = option["URL"];
|
|
48
|
+
if ((sequence == null || sequence == "" || sequence == "0") && url != null && url != "")
|
|
49
|
+
return html `<li class="${this.liClass} ${this.liActiveClass}" aria-current="${this.ariaCurrent}"><a href="${url}">${text}</a></li>`;
|
|
50
|
+
else if (sequence == null || sequence == "" || sequence == "0")
|
|
51
|
+
return html `<li class="${this.liClass} ${this.liActiveClass}" aria-current="${this.ariaCurrent}">${text}</li>`;
|
|
52
|
+
else if (url != null && url != "")
|
|
53
|
+
return html `<li class="${this.liClass}"><a href="${url}">${text}</a></li>`;
|
|
54
|
+
else
|
|
55
|
+
return html `<li class="${this.liClass}">${text}</li>`;
|
|
56
|
+
}
|
|
57
|
+
render() {
|
|
58
|
+
this.options = getArray(this.jsonData);
|
|
59
|
+
if (!this.options || this.options.length === 0)
|
|
60
|
+
return html ``;
|
|
61
|
+
return html `
|
|
62
|
+
<nav class="${this.navClass}">
|
|
63
|
+
<div class="${this.containerClass}">
|
|
64
|
+
<nav aria-label="${this.ariaLabel}">
|
|
65
|
+
<ul class="${this.ulClass}">
|
|
66
|
+
${this.options.sort((a, b) => (a.Sequence > b.Sequence ? -1 : 1)).map(option => this.renderItem(option))}
|
|
67
|
+
</ul>
|
|
68
|
+
</nav>
|
|
69
|
+
</div>
|
|
70
|
+
</nav>`;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
__decorate([
|
|
74
|
+
property({ type: String }),
|
|
75
|
+
__metadata("design:type", Object)
|
|
76
|
+
], QboBreadcrumb.prototype, "ariaCurrent", void 0);
|
|
77
|
+
__decorate([
|
|
78
|
+
property({ type: String }),
|
|
79
|
+
__metadata("design:type", Object)
|
|
80
|
+
], QboBreadcrumb.prototype, "ariaLabel", void 0);
|
|
81
|
+
__decorate([
|
|
82
|
+
property({ type: String }),
|
|
83
|
+
__metadata("design:type", Object)
|
|
84
|
+
], QboBreadcrumb.prototype, "containerClass", void 0);
|
|
85
|
+
__decorate([
|
|
86
|
+
property({ type: String }),
|
|
87
|
+
__metadata("design:type", Object)
|
|
88
|
+
], QboBreadcrumb.prototype, "liClass", void 0);
|
|
89
|
+
__decorate([
|
|
90
|
+
property({ type: String }),
|
|
91
|
+
__metadata("design:type", Object)
|
|
92
|
+
], QboBreadcrumb.prototype, "liActiveClass", void 0);
|
|
93
|
+
__decorate([
|
|
94
|
+
property({ type: String }),
|
|
95
|
+
__metadata("design:type", Object)
|
|
96
|
+
], QboBreadcrumb.prototype, "navClass", void 0);
|
|
97
|
+
__decorate([
|
|
98
|
+
property({ type: String }),
|
|
99
|
+
__metadata("design:type", Object)
|
|
100
|
+
], QboBreadcrumb.prototype, "ulClass", void 0);
|
|
101
|
+
__decorate([
|
|
102
|
+
property({ type: String }),
|
|
103
|
+
__metadata("design:type", Object)
|
|
104
|
+
], QboBreadcrumb.prototype, "apiEndpoint", void 0);
|
|
105
|
+
__decorate([
|
|
106
|
+
property({ type: String }),
|
|
107
|
+
__metadata("design:type", Object)
|
|
108
|
+
], QboBreadcrumb.prototype, "display", void 0);
|
|
109
|
+
__decorate([
|
|
110
|
+
property({ type: String }),
|
|
111
|
+
__metadata("design:type", Object)
|
|
112
|
+
], QboBreadcrumb.prototype, "object", void 0);
|
|
113
|
+
__decorate([
|
|
114
|
+
property({ type: String }),
|
|
115
|
+
__metadata("design:type", Object)
|
|
116
|
+
], QboBreadcrumb.prototype, "objectId", void 0);
|
|
117
|
+
__decorate([
|
|
118
|
+
property({ type: String }),
|
|
119
|
+
__metadata("design:type", Object)
|
|
120
|
+
], QboBreadcrumb.prototype, "operation", void 0);
|
|
121
|
+
__decorate([
|
|
122
|
+
property({ type: Array }),
|
|
123
|
+
__metadata("design:type", Object)
|
|
124
|
+
], QboBreadcrumb.prototype, "options", void 0);
|
|
125
|
+
__decorate([
|
|
126
|
+
property({ type: Boolean }),
|
|
127
|
+
__metadata("design:type", Object)
|
|
128
|
+
], QboBreadcrumb.prototype, "renderInHost", void 0);
|
|
129
|
+
QboBreadcrumb = __decorate([
|
|
130
|
+
customElement('qbo-breadcrumb')
|
|
131
|
+
], QboBreadcrumb);
|
|
132
|
+
export { QboBreadcrumb };
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { html, PropertyValues } 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
|
+
@customElement('qbo-breadcrumb')
|
|
7
|
+
export class QboBreadcrumb extends QboFetch {
|
|
8
|
+
|
|
9
|
+
@property({ type: String })
|
|
10
|
+
ariaCurrent = 'page';
|
|
11
|
+
|
|
12
|
+
@property({ type: String })
|
|
13
|
+
ariaLabel = 'breadcrumb';
|
|
14
|
+
|
|
15
|
+
@property({ type: String })
|
|
16
|
+
containerClass = 'container-fluid';
|
|
17
|
+
|
|
18
|
+
@property({ type: String })
|
|
19
|
+
liClass = 'breadcrumb-item';
|
|
20
|
+
|
|
21
|
+
@property({ type: String })
|
|
22
|
+
liActiveClass = 'active';
|
|
23
|
+
|
|
24
|
+
@property({ type: String })
|
|
25
|
+
navClass = 'breadcrumb bd-subnavbar py-2';
|
|
26
|
+
|
|
27
|
+
@property({ type: String })
|
|
28
|
+
ulClass = 'breadcrumb';
|
|
29
|
+
|
|
30
|
+
@property({ type: String })
|
|
31
|
+
apiEndpoint = new URL('config/breadcrumb', this.baseURI);
|
|
32
|
+
|
|
33
|
+
@property({ type: String })
|
|
34
|
+
display = null;
|
|
35
|
+
|
|
36
|
+
@property({ type: String })
|
|
37
|
+
object = null;
|
|
38
|
+
|
|
39
|
+
@property({ type: String })
|
|
40
|
+
objectId = null;
|
|
41
|
+
|
|
42
|
+
@property({ type: String })
|
|
43
|
+
operation = null;
|
|
44
|
+
|
|
45
|
+
@property({ type: Array })
|
|
46
|
+
options: Array<{ [key: string]: string }> | null = [];
|
|
47
|
+
|
|
48
|
+
@property({ type: Boolean })
|
|
49
|
+
renderInHost = true;
|
|
50
|
+
|
|
51
|
+
createRenderRoot() {
|
|
52
|
+
return this.renderInHost ? this : super.createRenderRoot();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
connectedCallback() {
|
|
56
|
+
let url = this.apiEndpoint.toString();
|
|
57
|
+
url = `${url}?Object=${this.object != null ? this.object : ''}`
|
|
58
|
+
url = `${url}&ObjectID=${this.objectId != null ? this.objectId : ''}`
|
|
59
|
+
url = `${url}&Operation=${this.operation != null ? this.operation : ''}`
|
|
60
|
+
url = `${url}&Display=${this.display != null ? this.display : ''}`
|
|
61
|
+
this.apiEndpoint = new URL(url, this.baseURI);
|
|
62
|
+
|
|
63
|
+
super.connectedCallback();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
renderItem(option) {
|
|
67
|
+
const sequence = option["Sequence"];
|
|
68
|
+
const text = option["Text"];
|
|
69
|
+
const url = option["URL"];
|
|
70
|
+
|
|
71
|
+
if ((sequence == null || sequence == "" || sequence == "0") && url != null && url != "")
|
|
72
|
+
return html`<li class="${this.liClass} ${this.liActiveClass}" aria-current="${this.ariaCurrent}"><a href="${url}">${text}</a></li>`;
|
|
73
|
+
else if (sequence == null || sequence == "" || sequence == "0")
|
|
74
|
+
return html`<li class="${this.liClass} ${this.liActiveClass}" aria-current="${this.ariaCurrent}">${text}</li>`;
|
|
75
|
+
else if (url != null && url != "")
|
|
76
|
+
return html`<li class="${this.liClass}"><a href="${url}">${text}</a></li>`;
|
|
77
|
+
else
|
|
78
|
+
return html`<li class="${this.liClass}">${text}</li>`;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
render() {
|
|
82
|
+
this.options = getArray(this.jsonData);
|
|
83
|
+
if (!this.options || this.options.length === 0) return html``;
|
|
84
|
+
|
|
85
|
+
return html`
|
|
86
|
+
<nav class="${this.navClass}">
|
|
87
|
+
<div class="${this.containerClass}">
|
|
88
|
+
<nav aria-label="${this.ariaLabel}">
|
|
89
|
+
<ul class="${this.ulClass}">
|
|
90
|
+
${this.options.sort((a, b) => (a.Sequence > b.Sequence ? -1 : 1)).map(option => this.renderItem(option))}
|
|
91
|
+
</ul>
|
|
92
|
+
</nav>
|
|
93
|
+
</div>
|
|
94
|
+
</nav>`;
|
|
95
|
+
}
|
|
96
|
+
}
|