@quandis/qbo4.ui-bridge 4.0.1-CI-20240919-212538
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 +59 -0
- package/src/Program.d.ts +9 -0
- package/src/Program.js +9 -0
- package/src/Program.ts +10 -0
- package/src/qbo-badge.d.ts +32 -0
- package/src/qbo-badge.js +93 -0
- package/src/qbo-badge.js.map +1 -0
- package/src/qbo-badge.ts +79 -0
- package/src/qbo-breadcrumb.d.ts +23 -0
- package/src/qbo-breadcrumb.js +132 -0
- package/src/qbo-breadcrumb.ts +96 -0
- package/src/qbo-contact-name.d.ts +22 -0
- package/src/qbo-contact-name.js +139 -0
- package/src/qbo-contact-name.ts +97 -0
- package/src/qbo-contact.d.ts +21 -0
- package/src/qbo-contact.js +250 -0
- package/src/qbo-contact.ts +211 -0
- package/src/qbo-mainmenu.d.ts +41 -0
- package/src/qbo-mainmenu.js +314 -0
- package/src/qbo-mainmenu.ts +270 -0
- package/src/qbo-sidebar.d.ts +10 -0
- package/src/qbo-sidebar.js +65 -0
- package/src/qbo-sidebar.ts +41 -0
- package/src/qbo-ssn.d.ts +26 -0
- package/src/qbo-ssn.js +174 -0
- package/src/qbo-ssn.ts +132 -0
- package/src/styles.d.ts +3 -0
- package/src/styles.js +27 -0
- package/src/styles.ts +30 -0
- package/wwwroot/js/qbo4.ui-bridge.js +75902 -0
- package/wwwroot/js/qbo4.ui-bridge.min.js +432 -0
- package/wwwroot/js/qbo4.ui-bridge.min.js.LICENSE.txt +49 -0
- package/wwwroot/js/qbo4.ui-bridge.min.js.map +1 -0
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { html, LitElement } from 'lit';
|
|
2
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
3
|
+
import { IApiService } from '@quandis/qbo4.ui';
|
|
4
|
+
import { services } from '@quandis/qbo4.configuration';
|
|
5
|
+
import { RestApiService } from '@quandis/qbo4.ui';
|
|
6
|
+
import { elementDate } from '@quandis/qbo4.ui';
|
|
7
|
+
|
|
8
|
+
@customElement('qbo-contact')
|
|
9
|
+
export class QboContact extends LitElement {
|
|
10
|
+
|
|
11
|
+
@property({ type: String })
|
|
12
|
+
apiEndpoint = 'qbo';
|
|
13
|
+
|
|
14
|
+
@property({ type: String })
|
|
15
|
+
colFourClass: String | null = 'qbo-col-4';
|
|
16
|
+
|
|
17
|
+
@property({ type: String })
|
|
18
|
+
colSixClass: String | null = 'qbo-col-6';
|
|
19
|
+
|
|
20
|
+
@property({ type: String })
|
|
21
|
+
colThreeClass: String | null = 'qbo-col-3';
|
|
22
|
+
|
|
23
|
+
@property({ type: String })
|
|
24
|
+
colTwelveClass: String | null = 'qbo-col-12';
|
|
25
|
+
|
|
26
|
+
@property({ type: String })
|
|
27
|
+
contactId: String | null = null;
|
|
28
|
+
|
|
29
|
+
@property({ type: String })
|
|
30
|
+
contactLabel: String | null = 'Contact';
|
|
31
|
+
|
|
32
|
+
@property({ type: String })
|
|
33
|
+
contactName: String | null = 'Contact';
|
|
34
|
+
|
|
35
|
+
@property({ type: Boolean })
|
|
36
|
+
disabled = true;
|
|
37
|
+
|
|
38
|
+
@property({ type: String })
|
|
39
|
+
divSectionHeaderClass: String | null = 'qbo-header';
|
|
40
|
+
|
|
41
|
+
@property({ type: String })
|
|
42
|
+
formControlSmallClass: String | null = 'qbo-sm';
|
|
43
|
+
|
|
44
|
+
@property({ type: String })
|
|
45
|
+
formLabelSmallClass: String | null = 'qbo-sm';
|
|
46
|
+
|
|
47
|
+
@property({ type: String })
|
|
48
|
+
formSelectSmallClass: String | null = 'qbo-sm';
|
|
49
|
+
|
|
50
|
+
@property({ type: Boolean })
|
|
51
|
+
renderInHost = true;
|
|
52
|
+
|
|
53
|
+
@property({ type: Object })
|
|
54
|
+
jsonData: any | null = {};
|
|
55
|
+
|
|
56
|
+
createRenderRoot() {
|
|
57
|
+
return this.renderInHost ? this : super.createRenderRoot();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
async connectedCallback() {
|
|
61
|
+
super.connectedCallback();
|
|
62
|
+
|
|
63
|
+
const service: IApiService = services.container.isRegistered(this.apiEndpoint) ? services.container.resolve<IApiService>(this.apiEndpoint) : new RestApiService(this.apiEndpoint);
|
|
64
|
+
this.jsonData = await service.fetch(`contact/summary/${this.contactId}`);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
render() {
|
|
68
|
+
if (this.jsonData == undefined || this.jsonData.Root == undefined || (this.jsonData.Root.ContactItem == undefined && this.contactId != null)) return html`<p>Loading...</p>`;
|
|
69
|
+
|
|
70
|
+
return html`<slot>
|
|
71
|
+
<div class="${this.colSixClass}">
|
|
72
|
+
<label for="${this.contactName}" class="${this.formLabelSmallClass}">${this.contactLabel}</label>
|
|
73
|
+
<qbo-contact-name class="${this.formControlSmallClass}" name="${this.contactName}" .data="${this.jsonData.Root.ContactItem}"></qbo-contact-name>
|
|
74
|
+
</div>
|
|
75
|
+
<div class="${this.colSixClass}">
|
|
76
|
+
<label for="ContactTemplateID" class="${this.formLabelSmallClass}">Template</label>
|
|
77
|
+
<qbo-select ?disabled=${this.disabled} class="${this.formSelectSmallClass}" name="ContactTemplateID" apiEndpoint="api://qbo/contacttemplate/listwhere?appliesto=${this.jsonData.Root.ContactItem?.Object}" defaultValue="${this.jsonData.Root.ContactItem?.ContactTemplateID}"></qbo-select>
|
|
78
|
+
</div>
|
|
79
|
+
<div class="${this.colSixClass}">
|
|
80
|
+
<label for="Status" class="${this.formLabelSmallClass}">Status</label>
|
|
81
|
+
<qbo-select ?disabled=${this.disabled} class="${this.formSelectSmallClass}" name="Status" apiEndpoint="api://qbo/objectstatus/customlist?object=Contact&objectid=${this.jsonData.Root.ContactItem?.ContactTemplateID}" optionValue="ObjectStatus" defaultValue="${this.jsonData.Root.ContactItem?.Status}"></qbo-select>
|
|
82
|
+
</div>
|
|
83
|
+
<div class="${this.colSixClass}">
|
|
84
|
+
<label for="ContactType" class="${this.formLabelSmallClass}">Type</label>
|
|
85
|
+
<qbo-select ?disabled=${this.disabled} class="${this.formSelectSmallClass}" name="ContactType" apiEndpoint="api://qbo/objecttype/customlist?object=Contact&objectid=${this.jsonData.Root.ContactItem?.ContactTemplateID}" optionValue="ObjectType" defaultValue="${this.jsonData.Root.ContactItem?.ContactType}"></qbo-select>
|
|
86
|
+
</div>
|
|
87
|
+
<div class="${this.divSectionHeaderClass}">
|
|
88
|
+
<h5>Location</h5>
|
|
89
|
+
</div>
|
|
90
|
+
<div class="${this.colSixClass}">
|
|
91
|
+
<label for="Company" class="${this.formLabelSmallClass}">Company</label>
|
|
92
|
+
<input type="text" ?disabled=${this.disabled} class="${this.formControlSmallClass}" name="Company" value="${this.jsonData.Root.ContactItem?.Company}"/>
|
|
93
|
+
</div>
|
|
94
|
+
<div class="${this.colSixClass}">
|
|
95
|
+
<label for="Title" class="${this.formLabelSmallClass}">Title</label>
|
|
96
|
+
<input type="text" ?disabled=${this.disabled} class="${this.formControlSmallClass}" name="Title" value="${this.jsonData.Root.ContactItem?.Title}"/>
|
|
97
|
+
</div>
|
|
98
|
+
<div class="${this.colTwelveClass}">
|
|
99
|
+
<label for="Address" class="${this.formLabelSmallClass}">Address</label>
|
|
100
|
+
<textarea ?disabled=${this.disabled} class="${this.formControlSmallClass}" name="Address">${this.jsonData.Root.ContactItem?.Address}</textarea>
|
|
101
|
+
</div>
|
|
102
|
+
<div class="${this.colSixClass}">
|
|
103
|
+
<label for="City" class="${this.formLabelSmallClass}">City</label>
|
|
104
|
+
<input type="text" ?disabled=${this.disabled} class="${this.formControlSmallClass}" name="City" value="${this.jsonData.Root.ContactItem?.City}"/>
|
|
105
|
+
</div>
|
|
106
|
+
<div class="${this.colThreeClass}">
|
|
107
|
+
<label for="State" class="${this.formLabelSmallClass}">State</label>
|
|
108
|
+
<qbo-select ?disabled=${this.disabled} class="${this.formSelectSmallClass}" name="State" apiEndpoint="api://qbo/state/list" optionValue="State" defaultValue="${this.jsonData.Root.ContactItem?.State}"></qbo-select>
|
|
109
|
+
</div>
|
|
110
|
+
<div class="${this.colThreeClass}">
|
|
111
|
+
<label for="PostalCode" class="${this.formLabelSmallClass}">Postal Code</label>
|
|
112
|
+
<input type="text" ?disabled=${this.disabled} class="${this.formControlSmallClass}" name="PostalCode" pattern="\d{5}-?(\d{4})?" value="${this.jsonData.Root.ContactItem?.PostalCode}"/>
|
|
113
|
+
</div>
|
|
114
|
+
<div class="${this.colSixClass}">
|
|
115
|
+
<label for="Country" class="${this.formLabelSmallClass}">Country</label>
|
|
116
|
+
<input type="text" ?disabled=${this.disabled} class="${this.formControlSmallClass}" name="Country" value="${this.jsonData.Root.ContactItem?.Country}"/>
|
|
117
|
+
</div>
|
|
118
|
+
<div class="${this.colThreeClass}">
|
|
119
|
+
<label for="Latitude" class="${this.formLabelSmallClass}">Latitude</label>
|
|
120
|
+
<input type="number" ?disabled=${this.disabled} class="${this.formControlSmallClass}" name="Latitude" value="${this.jsonData.Root.ContactItem?.Latitude}"/>
|
|
121
|
+
</div>
|
|
122
|
+
<div class="${this.colThreeClass}">
|
|
123
|
+
<label for="Longitude" class="${this.formLabelSmallClass}">Longitude</label>
|
|
124
|
+
<input type="number" ?disabled=${this.disabled} class="${this.formControlSmallClass}" name="Longitude" value="${this.jsonData.Root.ContactItem?.Longitude}"/>
|
|
125
|
+
</div>
|
|
126
|
+
<div class="${this.divSectionHeaderClass}">
|
|
127
|
+
<h5>Identity</h5>
|
|
128
|
+
</div>
|
|
129
|
+
<div class="${this.colThreeClass}">
|
|
130
|
+
<label for="USSSN" class="${this.formLabelSmallClass}">SSN</label>
|
|
131
|
+
<qbo-ssn .data="${this.jsonData.Root.ContactItem}"></qbo-ssn>
|
|
132
|
+
</div>
|
|
133
|
+
<div class="${this.colThreeClass}">
|
|
134
|
+
<label for="TIN" class="${this.formLabelSmallClass}">TIN</label>
|
|
135
|
+
<input type="number" ?disabled=${this.disabled} class="${this.formControlSmallClass}" name="TIN" value="${this.jsonData.Root.ContactItem?.TIN}"/>
|
|
136
|
+
</div>
|
|
137
|
+
<div class="${this.colThreeClass}">
|
|
138
|
+
<label for="Nationality" class="${this.formLabelSmallClass}">Nationality</label>
|
|
139
|
+
<qbo-select ?disabled=${this.disabled} class="${this.formSelectSmallClass}" name="Nationality" apiEndpoint="api://qbo/objecttype/list?object=Contact.Nationality" optionValue="ObjectType" defaultValue="${this.jsonData.Root.ContactItem?.Nationality}"></qbo-select>
|
|
140
|
+
</div>
|
|
141
|
+
<div class="${this.colThreeClass}">
|
|
142
|
+
<label for="SpokenLanguage" class="${this.formLabelSmallClass}">Spoken Language</label>
|
|
143
|
+
<qbo-select ?disabled=${this.disabled} class="${this.formSelectSmallClass}" name="SpokenLanguage" apiEndpoint="api://qbo/objecttype/list?object=Contact.SpokenLanguage" optionValue="ObjectType" defaultValue="${this.jsonData.Root.ContactItem?.SpokenLanguage}"></qbo-select>
|
|
144
|
+
</div>
|
|
145
|
+
<div class="${this.colThreeClass}">
|
|
146
|
+
<label for="BirthDate" class="${this.formLabelSmallClass}">Birth Date</label>
|
|
147
|
+
<input type="date" ?disabled=${this.disabled} class="${this.formControlSmallClass}" name="BirthDate" value="${elementDate(this.jsonData.Root.ContactItem?.BirthDate)}"/>
|
|
148
|
+
</div>
|
|
149
|
+
<div class="${this.colThreeClass}">
|
|
150
|
+
<label for="DeathDate" class="${this.formLabelSmallClass}">Death Date</label>
|
|
151
|
+
<input type="date" ?disabled=${this.disabled} class="${this.formControlSmallClass}" name="DeathDate" value="${elementDate(this.jsonData.Root.ContactItem?.DeathDate)}"/>
|
|
152
|
+
</div>
|
|
153
|
+
<div class="${this.colThreeClass}">
|
|
154
|
+
<label for="ValidStart" class="${this.formLabelSmallClass}">Valid Start</label>
|
|
155
|
+
<input type="date" ?disabled=${this.disabled} class="${this.formControlSmallClass}" name="ValidStart" value="${elementDate(this.jsonData.Root.ContactItem?.ValidStart)}"/>
|
|
156
|
+
</div>
|
|
157
|
+
<div class="${this.colThreeClass}">
|
|
158
|
+
<label for="ValidEnd" class="${this.formLabelSmallClass}">Valid End</label>
|
|
159
|
+
<input type="date" ?disabled=${this.disabled} class="${this.formControlSmallClass}" name="ValidEnd" value="${elementDate(this.jsonData.Root.ContactItem?.ValidEnd)}"/>
|
|
160
|
+
</div>
|
|
161
|
+
<div class="${this.colSixClass}">
|
|
162
|
+
<label for="VerifiedSource" class="${this.formLabelSmallClass}">Verified Source</label>
|
|
163
|
+
<input type="text" ?disabled=${this.disabled} class="${this.formControlSmallClass}" name="VerifiedSource" value="${this.jsonData.Root.ContactItem?.VerifiedSource}"/>
|
|
164
|
+
</div>
|
|
165
|
+
<div class="${this.colThreeClass}">
|
|
166
|
+
<label for="VerifiedDate" class="${this.formLabelSmallClass}">Verified Date</label>
|
|
167
|
+
<input type="date" ?disabled=${this.disabled} class="${this.formControlSmallClass}" name="VerifiedDate" value="${elementDate(this.jsonData.Root.ContactItem?.VerifiedDate)}"/>
|
|
168
|
+
</div>
|
|
169
|
+
<div class="${this.colThreeClass}">
|
|
170
|
+
<label for="VerifiedConfidence" class="${this.formLabelSmallClass}">Verified Confidence</label>
|
|
171
|
+
<input type="number" ?disabled=${this.disabled} class="${this.formControlSmallClass}" name="VerifiedConfidence" value="${this.jsonData.Root.ContactItem?.VerifiedConfidence}"/>
|
|
172
|
+
</div>
|
|
173
|
+
<div class="${this.divSectionHeaderClass}">
|
|
174
|
+
<h5>SCRA</h5>
|
|
175
|
+
</div>
|
|
176
|
+
<div class="${this.colThreeClass}">
|
|
177
|
+
<label for="SCRAStatus" class="${this.formLabelSmallClass}">SCRA Status</label>
|
|
178
|
+
<qbo-select ?disabled=${this.disabled} class="${this.formSelectSmallClass}" name="SCRAStatus" apiEndpoint="api://qbo/objecttype/list?object=Contact.SCRAStatus" optionValue="ObjectType" defaultValue="${this.jsonData.Root.ContactItem?.SCRAStatus}"></qbo-select>
|
|
179
|
+
</div>
|
|
180
|
+
<div class="${this.colThreeClass}">
|
|
181
|
+
<label for="SCRAStatusAsOf" class="${this.formLabelSmallClass}">SCRA Status As Of</label>
|
|
182
|
+
<input type="date" ?disabled=${this.disabled} class="${this.formControlSmallClass}" name="SCRAStatusAsOf" value="${elementDate(this.jsonData.Root.ContactItem?.SCRAStatusAsOf)}"/>
|
|
183
|
+
</div>
|
|
184
|
+
<div class="${this.colThreeClass}">
|
|
185
|
+
<label for="SCRAStartDate" class="${this.formLabelSmallClass}">SCRA Start Date</label>
|
|
186
|
+
<input type="date" ?disabled=${this.disabled} class="${this.formControlSmallClass}" name="SCRAStartDate" value="${elementDate(this.jsonData.Root.ContactItem?.SCRAStartDate)}"/>
|
|
187
|
+
</div>
|
|
188
|
+
<div class="${this.colThreeClass}">
|
|
189
|
+
<label for="SCRADischargeDate" class="${this.formLabelSmallClass}">SCRA Discharge Date</label>
|
|
190
|
+
<input type="date" ?disabled=${this.disabled} class="${this.formControlSmallClass}" name="SCRADischargeDate" value="${elementDate(this.jsonData.Root.ContactItem?.SCRADischargeDate)}"/>
|
|
191
|
+
</div>
|
|
192
|
+
<div class="${this.colThreeClass}">
|
|
193
|
+
<label for="SCRAVerified" class="${this.formLabelSmallClass}">SCRA Verified</label>
|
|
194
|
+
<input type="text" ?disabled=${this.disabled} class="${this.formControlSmallClass}" name="SCRAVerified" value="${this.jsonData.Root.ContactItem?.SCRAVerified}"/>
|
|
195
|
+
</div>
|
|
196
|
+
<div class="${this.colThreeClass}">
|
|
197
|
+
<label for="SCRAVerifiedDate" class="${this.formLabelSmallClass}">SCRA Verified Date</label>
|
|
198
|
+
<input type="date" ?disabled=${this.disabled} class="${this.formControlSmallClass}" name="SCRAVerifiedDate" value="${elementDate(this.jsonData.Root.ContactItem?.SCRAVerifiedDate)}"/>
|
|
199
|
+
</div>
|
|
200
|
+
<div class="${this.colThreeClass}">
|
|
201
|
+
<label for="SCRASource" class="${this.formLabelSmallClass}">SCRA Source</label>
|
|
202
|
+
<input type="text" ?disabled=${this.disabled} class="${this.formControlSmallClass}" name="SCRASource" value="${this.jsonData.Root.ContactItem?.SCRASource}"/>
|
|
203
|
+
</div>
|
|
204
|
+
<div class="${this.colThreeClass}">
|
|
205
|
+
<label for="SCRAID" class="${this.formLabelSmallClass}">SCRA ID</label>
|
|
206
|
+
<input type="number" ?disabled=${this.disabled} class="${this.formControlSmallClass}" name="SCRAID" value="${this.jsonData.Root.ContactItem?.SCRAID}"/>
|
|
207
|
+
</div>
|
|
208
|
+
<qbo-form-edit .data="${this.jsonData.Root.ContactItem}"></qbo-form-edit>
|
|
209
|
+
</slot>`;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { LitElement, PropertyValues } from 'lit';
|
|
2
|
+
export declare class QboMainMenu extends LitElement {
|
|
3
|
+
ariaExpanded: string;
|
|
4
|
+
ariaLabel: string;
|
|
5
|
+
buttonType: string;
|
|
6
|
+
collapseToggle: string;
|
|
7
|
+
dblClickClass: string;
|
|
8
|
+
dropdownId: string;
|
|
9
|
+
dropdownToggle: string;
|
|
10
|
+
iconClass: string;
|
|
11
|
+
liLinkToggleClass: string;
|
|
12
|
+
liLinkClass: string;
|
|
13
|
+
liAMenuClass: string;
|
|
14
|
+
navClass: string;
|
|
15
|
+
popoverContainer: string;
|
|
16
|
+
popoverHtml: string;
|
|
17
|
+
popoverPlacement: string;
|
|
18
|
+
popoverToggle: string;
|
|
19
|
+
popoverTrigger: string;
|
|
20
|
+
spanMenuClass: string;
|
|
21
|
+
spanMenuValue: string;
|
|
22
|
+
ulMainMenuToggleClass: string;
|
|
23
|
+
ulSubMenuClass: string;
|
|
24
|
+
ulSubMenuToggleClass: string;
|
|
25
|
+
apiEndpoint: string;
|
|
26
|
+
renderInHost: boolean;
|
|
27
|
+
jsonData: any | null;
|
|
28
|
+
targetElement: Element | null;
|
|
29
|
+
createRenderRoot(): HTMLElement | DocumentFragment;
|
|
30
|
+
connectedCallback(): Promise<void>;
|
|
31
|
+
disconnectedCallback(): void;
|
|
32
|
+
handleResize: () => void;
|
|
33
|
+
updated(changedProperties: PropertyValues): void;
|
|
34
|
+
renderImage(image: any): import("lit-html").TemplateResult<1>;
|
|
35
|
+
renderMenu(json: any, isDropdown: any, isSubmenu: any): import("lit-html").TemplateResult<1>;
|
|
36
|
+
renderMenuDivider(): import("lit-html").TemplateResult<1>;
|
|
37
|
+
renderMenuDropdown(json: any, isSubmenu: any): import("lit-html").TemplateResult<1>;
|
|
38
|
+
renderMenuDropdownLink(url: any, text: any, icon: any): import("lit-html").TemplateResult<1>;
|
|
39
|
+
renderMenuLink(menu: any): import("lit-html").TemplateResult<1>;
|
|
40
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
41
|
+
}
|
|
@@ -0,0 +1,314 @@
|
|
|
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 { Popover } from 'bootstrap';
|
|
13
|
+
import { RestApiService, services } from '@quandis/qbo4.ui';
|
|
14
|
+
let QboMainMenu = class QboMainMenu extends LitElement {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments);
|
|
17
|
+
this.ariaExpanded = 'false';
|
|
18
|
+
this.ariaLabel = 'Toggle menu';
|
|
19
|
+
this.buttonType = 'button';
|
|
20
|
+
this.collapseToggle = 'collapse';
|
|
21
|
+
this.dblClickClass = 'qbo-doubleclick';
|
|
22
|
+
this.dropdownId = 'qboMainMenu';
|
|
23
|
+
this.dropdownToggle = 'dropdown';
|
|
24
|
+
this.iconClass = 'qbo-icon';
|
|
25
|
+
this.liLinkToggleClass = 'qbo-dropdown';
|
|
26
|
+
this.liLinkClass = 'qbo-nav-item';
|
|
27
|
+
this.liAMenuClass = 'qbo-dropdown-item';
|
|
28
|
+
this.navClass = 'qbo-mainmenu';
|
|
29
|
+
this.popoverContainer = 'body';
|
|
30
|
+
this.popoverHtml = 'false';
|
|
31
|
+
this.popoverPlacement = 'bottom';
|
|
32
|
+
this.popoverToggle = 'popover';
|
|
33
|
+
this.popoverTrigger = 'hover';
|
|
34
|
+
this.spanMenuClass = 'qbo-submenuexpand';
|
|
35
|
+
this.spanMenuValue = '>';
|
|
36
|
+
this.ulMainMenuToggleClass = 'qbo-dropdown-mainmenu';
|
|
37
|
+
this.ulSubMenuClass = 'submenu';
|
|
38
|
+
this.ulSubMenuToggleClass = 'dropdown-menu';
|
|
39
|
+
this.apiEndpoint = 'qbo';
|
|
40
|
+
this.renderInHost = true;
|
|
41
|
+
this.jsonData = {};
|
|
42
|
+
this.targetElement = null;
|
|
43
|
+
this.handleResize = () => {
|
|
44
|
+
if (window.innerWidth < 992) {
|
|
45
|
+
/* Collapse menu on small screens */
|
|
46
|
+
this.renderRoot.querySelectorAll(`button`).forEach(function (btn) {
|
|
47
|
+
if (btn != null && btn instanceof HTMLElement && btn.hasAttribute('aria-expanded') && btn.getAttribute('aria-expanded') == 'true')
|
|
48
|
+
btn.click();
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
/* Remove collapsed styling on large screens*/
|
|
53
|
+
this.renderRoot.querySelectorAll(`.${this.ulSubMenuToggleClass} .${this.ulSubMenuClass}`).forEach(function (ul) {
|
|
54
|
+
if (ul != null && ul instanceof HTMLElement && ul.hasAttribute('style'))
|
|
55
|
+
ul.removeAttribute('style');
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
createRenderRoot() {
|
|
61
|
+
return this.renderInHost ? this : super.createRenderRoot();
|
|
62
|
+
}
|
|
63
|
+
async connectedCallback() {
|
|
64
|
+
super.connectedCallback();
|
|
65
|
+
window.addEventListener('resize', this.handleResize);
|
|
66
|
+
const service = services.container.isRegistered(this.apiEndpoint) ? services.container.resolve(this.apiEndpoint) : new RestApiService(this.apiEndpoint);
|
|
67
|
+
this.jsonData = await service.fetch(`theme/mainmenu`);
|
|
68
|
+
}
|
|
69
|
+
disconnectedCallback() {
|
|
70
|
+
window.removeEventListener('resize', this.handleResize);
|
|
71
|
+
super.disconnectedCallback();
|
|
72
|
+
}
|
|
73
|
+
updated(changedProperties) {
|
|
74
|
+
super.updated(changedProperties);
|
|
75
|
+
if (changedProperties.get('jsonData') != undefined) {
|
|
76
|
+
/* Disable click */
|
|
77
|
+
this.renderRoot.querySelectorAll(`.${this.ulSubMenuToggleClass}`).forEach(ul => {
|
|
78
|
+
ul.addEventListener('click', function (e) {
|
|
79
|
+
e.stopPropagation();
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
/* Click for menu expansion on small screens */
|
|
83
|
+
const className = this.ulSubMenuClass;
|
|
84
|
+
this.renderRoot.querySelectorAll(`.${this.ulSubMenuToggleClass} a`).forEach(function (a) {
|
|
85
|
+
a.addEventListener('click', (e) => {
|
|
86
|
+
if (e.currentTarget != null && e.currentTarget instanceof HTMLElement && window.innerWidth < 992) {
|
|
87
|
+
const nextEl = e.currentTarget.nextElementSibling;
|
|
88
|
+
if (nextEl != null && nextEl instanceof HTMLElement && nextEl.classList.contains(className)) {
|
|
89
|
+
e.preventDefault();
|
|
90
|
+
nextEl.style.display = nextEl.style.display == 'block' ? 'none' : 'block';
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
/* Enable popovers */
|
|
96
|
+
this.renderRoot.querySelectorAll(`[data-bs-toggle="${this.popoverToggle}"]`).forEach(function (t) {
|
|
97
|
+
new Popover(t);
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
renderImage(image) {
|
|
102
|
+
if (image != null)
|
|
103
|
+
return html `<img src="${image}"/><span/>`;
|
|
104
|
+
else
|
|
105
|
+
return html ``;
|
|
106
|
+
}
|
|
107
|
+
renderMenu(json, isDropdown, isSubmenu) {
|
|
108
|
+
let result = html ``;
|
|
109
|
+
const jsonMenu = json != null && json.Menu != null ? json.Menu : json;
|
|
110
|
+
if (jsonMenu != null) {
|
|
111
|
+
if (jsonMenu.forEach) {
|
|
112
|
+
jsonMenu.forEach(mm => {
|
|
113
|
+
if (mm.Menu != null)
|
|
114
|
+
result = html `${result}${this.renderMenuDropdown(mm, isSubmenu)}`;
|
|
115
|
+
else if (mm.Type == "Divider")
|
|
116
|
+
result = html `${result}${this.renderMenuDivider()}`;
|
|
117
|
+
else if (isDropdown)
|
|
118
|
+
result = html `${result}${this.renderMenuDropdownLink(mm.URL, mm.Text, mm.Icon)}`;
|
|
119
|
+
else
|
|
120
|
+
result = html `${result}${this.renderMenuLink(mm)}`;
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
if (jsonMenu.Menu != null)
|
|
125
|
+
result = html `${result}${this.renderMenuDropdown(jsonMenu, isSubmenu)}`;
|
|
126
|
+
else if (jsonMenu.Type == "Divider")
|
|
127
|
+
result = html `${result}${this.renderMenuDivider()}`;
|
|
128
|
+
else if (isDropdown)
|
|
129
|
+
result = html `${result}${this.renderMenuDropdownLink(jsonMenu.URL, jsonMenu.Text, jsonMenu.Icon)}`;
|
|
130
|
+
else
|
|
131
|
+
result = html `${result}${this.renderMenuLink(jsonMenu)}`;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return html `${result}`;
|
|
135
|
+
}
|
|
136
|
+
renderMenuDivider() {
|
|
137
|
+
return html `<li><hr/></li>`;
|
|
138
|
+
}
|
|
139
|
+
renderMenuDropdown(json, isSubmenu) {
|
|
140
|
+
const i = (json.Icon != null && json.Icon != '') ? html `<i class="${json.Icon} ${this.iconClass}" />` : ``;
|
|
141
|
+
if (isSubmenu)
|
|
142
|
+
return html `<li>
|
|
143
|
+
<a class="${this.liAMenuClass}" href="${json.URL}">
|
|
144
|
+
${i}<span>${json.Text}</span>
|
|
145
|
+
<span class="${this.spanMenuClass}">${this.spanMenuValue}</span>
|
|
146
|
+
</a>
|
|
147
|
+
<ul class="${this.ulSubMenuClass} ${this.ulSubMenuToggleClass}">
|
|
148
|
+
${this.renderMenu(json.Menu, true, true)}
|
|
149
|
+
</ul>
|
|
150
|
+
</li>`;
|
|
151
|
+
else
|
|
152
|
+
return html `<li class="${this.liLinkClass} ${this.liLinkToggleClass}">
|
|
153
|
+
<a href="${json.URL}" data-bs-toggle="${this.dropdownToggle}">
|
|
154
|
+
${i}<span>${json.Text}</span>
|
|
155
|
+
</a>
|
|
156
|
+
<ul class="${this.ulSubMenuToggleClass} ${this.ulMainMenuToggleClass}">
|
|
157
|
+
${this.renderMenu(json.Menu, true, true)}
|
|
158
|
+
</ul>
|
|
159
|
+
</li>`;
|
|
160
|
+
}
|
|
161
|
+
renderMenuDropdownLink(url, text, icon) {
|
|
162
|
+
const i = (icon != null && icon != '') ? html `<i class="${icon} ${this.iconClass}" />` : ``;
|
|
163
|
+
return html `<li><a class="${this.liAMenuClass}" href="${url}">${i}${text}</a></li>`;
|
|
164
|
+
}
|
|
165
|
+
renderMenuLink(menu) {
|
|
166
|
+
const i = (menu.Icon != null && menu.Icon != '') ? html `<i class="${menu.Icon} ${this.iconClass}" />` : ``;
|
|
167
|
+
const title = menu.Title;
|
|
168
|
+
const content = menu.DataContent;
|
|
169
|
+
const toggle = menu.DataToggle != null ? menu.DataToggle : this.popoverToggle;
|
|
170
|
+
const container = menu.DataContainer != null ? menu.DataContainer : this.popoverContainer;
|
|
171
|
+
const placement = menu.DataPlacement != null ? menu.DataPlacement : this.popoverPlacement;
|
|
172
|
+
const trigger = menu.DataTrigger != null ? menu.DataTrigger : this.popoverTrigger;
|
|
173
|
+
const isHtml = menu.DataHtml != null ? menu.DataHtml : this.popoverHtml;
|
|
174
|
+
if (menu.DoubleClick != null)
|
|
175
|
+
return html `<li class="${this.liLinkClass}">
|
|
176
|
+
<a class="${this.dblClickClass}" title="${title}" data-bs-trigger="${trigger}" data-bs-placement="${placement}" data-bs-container="${container}" data-bs-content="${content}" data-bs-toggle="${toggle}" data-bs-html="${isHtml}" ondblclick="${menu.DoubleClick}">
|
|
177
|
+
${i}${menu.Text}
|
|
178
|
+
</a>
|
|
179
|
+
</li>`;
|
|
180
|
+
else
|
|
181
|
+
return html `<li class="${this.liLinkClass}">
|
|
182
|
+
<a title="${title}" data-bs-trigger="${trigger}" data-bs-placement="${placement}" data-bs-container="${container}" data-bs-content="${content}" data-bs-toggle="${toggle}" data-bs-html="${isHtml}" href="${menu.URL}">
|
|
183
|
+
${i}${menu.Text}
|
|
184
|
+
</a>
|
|
185
|
+
</li>`;
|
|
186
|
+
}
|
|
187
|
+
render() {
|
|
188
|
+
if (this.jsonData && this.jsonData.Root && this.jsonData.Root.MainMenu) {
|
|
189
|
+
return html `
|
|
190
|
+
<nav class="${this.navClass}">
|
|
191
|
+
<div>
|
|
192
|
+
<a href="#">
|
|
193
|
+
${this.renderImage(this.jsonData.Root.MainMenu.Image)}
|
|
194
|
+
${this.jsonData.Root.MainMenu.Label}
|
|
195
|
+
</a>
|
|
196
|
+
<button type="${this.buttonType}" data-bs-toggle="${this.collapseToggle}" data-bs-target="#${this.dropdownId}" aria-expanded="${this.ariaExpanded}" aria-label="${this.ariaLabel}">
|
|
197
|
+
<span/>
|
|
198
|
+
</button>
|
|
199
|
+
<div id="${this.dropdownId}">
|
|
200
|
+
<ul>
|
|
201
|
+
${this.renderMenu(this.jsonData.Root.MainMenu, false, false)}
|
|
202
|
+
</ul>
|
|
203
|
+
</div>
|
|
204
|
+
</div>
|
|
205
|
+
</nav>`;
|
|
206
|
+
}
|
|
207
|
+
else
|
|
208
|
+
return html ``;
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
__decorate([
|
|
212
|
+
property({ type: String }),
|
|
213
|
+
__metadata("design:type", Object)
|
|
214
|
+
], QboMainMenu.prototype, "ariaExpanded", void 0);
|
|
215
|
+
__decorate([
|
|
216
|
+
property({ type: String }),
|
|
217
|
+
__metadata("design:type", Object)
|
|
218
|
+
], QboMainMenu.prototype, "ariaLabel", void 0);
|
|
219
|
+
__decorate([
|
|
220
|
+
property({ type: String }),
|
|
221
|
+
__metadata("design:type", Object)
|
|
222
|
+
], QboMainMenu.prototype, "buttonType", void 0);
|
|
223
|
+
__decorate([
|
|
224
|
+
property({ type: String }),
|
|
225
|
+
__metadata("design:type", Object)
|
|
226
|
+
], QboMainMenu.prototype, "collapseToggle", void 0);
|
|
227
|
+
__decorate([
|
|
228
|
+
property({ type: String }),
|
|
229
|
+
__metadata("design:type", Object)
|
|
230
|
+
], QboMainMenu.prototype, "dblClickClass", void 0);
|
|
231
|
+
__decorate([
|
|
232
|
+
property({ type: String }),
|
|
233
|
+
__metadata("design:type", Object)
|
|
234
|
+
], QboMainMenu.prototype, "dropdownId", void 0);
|
|
235
|
+
__decorate([
|
|
236
|
+
property({ type: String }),
|
|
237
|
+
__metadata("design:type", Object)
|
|
238
|
+
], QboMainMenu.prototype, "dropdownToggle", void 0);
|
|
239
|
+
__decorate([
|
|
240
|
+
property({ type: String }),
|
|
241
|
+
__metadata("design:type", Object)
|
|
242
|
+
], QboMainMenu.prototype, "iconClass", void 0);
|
|
243
|
+
__decorate([
|
|
244
|
+
property({ type: String }),
|
|
245
|
+
__metadata("design:type", Object)
|
|
246
|
+
], QboMainMenu.prototype, "liLinkToggleClass", void 0);
|
|
247
|
+
__decorate([
|
|
248
|
+
property({ type: String }),
|
|
249
|
+
__metadata("design:type", Object)
|
|
250
|
+
], QboMainMenu.prototype, "liLinkClass", void 0);
|
|
251
|
+
__decorate([
|
|
252
|
+
property({ type: String }),
|
|
253
|
+
__metadata("design:type", Object)
|
|
254
|
+
], QboMainMenu.prototype, "liAMenuClass", void 0);
|
|
255
|
+
__decorate([
|
|
256
|
+
property({ type: String }),
|
|
257
|
+
__metadata("design:type", Object)
|
|
258
|
+
], QboMainMenu.prototype, "navClass", void 0);
|
|
259
|
+
__decorate([
|
|
260
|
+
property({ type: String }),
|
|
261
|
+
__metadata("design:type", Object)
|
|
262
|
+
], QboMainMenu.prototype, "popoverContainer", void 0);
|
|
263
|
+
__decorate([
|
|
264
|
+
property({ type: String }),
|
|
265
|
+
__metadata("design:type", Object)
|
|
266
|
+
], QboMainMenu.prototype, "popoverHtml", void 0);
|
|
267
|
+
__decorate([
|
|
268
|
+
property({ type: String }),
|
|
269
|
+
__metadata("design:type", Object)
|
|
270
|
+
], QboMainMenu.prototype, "popoverPlacement", void 0);
|
|
271
|
+
__decorate([
|
|
272
|
+
property({ type: String }),
|
|
273
|
+
__metadata("design:type", Object)
|
|
274
|
+
], QboMainMenu.prototype, "popoverToggle", void 0);
|
|
275
|
+
__decorate([
|
|
276
|
+
property({ type: String }),
|
|
277
|
+
__metadata("design:type", Object)
|
|
278
|
+
], QboMainMenu.prototype, "popoverTrigger", void 0);
|
|
279
|
+
__decorate([
|
|
280
|
+
property({ type: String }),
|
|
281
|
+
__metadata("design:type", Object)
|
|
282
|
+
], QboMainMenu.prototype, "spanMenuClass", void 0);
|
|
283
|
+
__decorate([
|
|
284
|
+
property({ type: String }),
|
|
285
|
+
__metadata("design:type", Object)
|
|
286
|
+
], QboMainMenu.prototype, "spanMenuValue", void 0);
|
|
287
|
+
__decorate([
|
|
288
|
+
property({ type: String }),
|
|
289
|
+
__metadata("design:type", Object)
|
|
290
|
+
], QboMainMenu.prototype, "ulMainMenuToggleClass", void 0);
|
|
291
|
+
__decorate([
|
|
292
|
+
property({ type: String }),
|
|
293
|
+
__metadata("design:type", Object)
|
|
294
|
+
], QboMainMenu.prototype, "ulSubMenuClass", void 0);
|
|
295
|
+
__decorate([
|
|
296
|
+
property({ type: String }),
|
|
297
|
+
__metadata("design:type", Object)
|
|
298
|
+
], QboMainMenu.prototype, "ulSubMenuToggleClass", void 0);
|
|
299
|
+
__decorate([
|
|
300
|
+
property({ type: String }),
|
|
301
|
+
__metadata("design:type", Object)
|
|
302
|
+
], QboMainMenu.prototype, "apiEndpoint", void 0);
|
|
303
|
+
__decorate([
|
|
304
|
+
property({ type: Boolean }),
|
|
305
|
+
__metadata("design:type", Object)
|
|
306
|
+
], QboMainMenu.prototype, "renderInHost", void 0);
|
|
307
|
+
__decorate([
|
|
308
|
+
property({ type: Object }),
|
|
309
|
+
__metadata("design:type", Object)
|
|
310
|
+
], QboMainMenu.prototype, "jsonData", void 0);
|
|
311
|
+
QboMainMenu = __decorate([
|
|
312
|
+
customElement('qbo-mainmenu')
|
|
313
|
+
], QboMainMenu);
|
|
314
|
+
export { QboMainMenu };
|