@quandis/qbo4.ui 4.0.1-CI-20241027-142453 → 4.0.1-CI-20241029-174756
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -1
- package/scss/qboui.scss +103 -5
- package/src/qbo/Program.d.ts +2 -0
- package/src/qbo/Program.js +2 -0
- package/src/qbo/Program.ts +2 -0
- package/src/qbo/qbo-card.d.ts +21 -0
- package/src/qbo/qbo-card.js +118 -0
- package/src/qbo/qbo-card.ts +115 -0
- package/src/qbo/qbo-contextmenu.d.ts +3 -1
- package/src/qbo/qbo-contextmenu.js +19 -17
- package/src/qbo/qbo-contextmenu.ts +22 -19
- package/src/qbo/qbo-icon.d.ts +13 -5
- package/src/qbo/qbo-icon.js +146 -45
- package/src/qbo/qbo-icon.ts +153 -40
- package/src/qbo/qbo-menu.d.ts +18 -0
- package/src/qbo/qbo-menu.js +169 -0
- package/src/qbo/qbo-menu.ts +168 -0
- package/src/qbo/styles.js +3 -3
- package/src/qbo/styles.ts +3 -3
- package/wwwroot/css/qboui.css +311 -162
- package/wwwroot/css/qboui.css.map +1 -1
- package/wwwroot/css/qboui.min.css +3 -3
- package/wwwroot/default.html +146 -5
- package/wwwroot/images/qbo-icons.svg +7 -0
- package/wwwroot/js/esm/qbo4.ui.js +1271 -181
- package/wwwroot/js/esm/qbo4.ui.min.js +106 -53
- package/wwwroot/js/esm/qbo4.ui.min.js.LICENSE.txt +6 -0
- package/wwwroot/js/esm/qbo4.ui.min.js.map +1 -1
- package/wwwroot/js/qbo4.ui.js +1275 -181
- package/wwwroot/js/qbo4.ui.min.js +106 -53
- package/wwwroot/js/qbo4.ui.min.js.LICENSE.txt +6 -0
- package/wwwroot/js/qbo4.ui.min.js.map +1 -1
- package/wwwroot/menu.html +92 -0
- package/src/qbo/Icons.d.ts +0 -2
- package/src/qbo/Icons.js +0 -50
- package/src/qbo/Icons.ts +0 -57
package/src/qbo/qbo-icon.js
CHANGED
|
@@ -7,72 +7,169 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
|
-
|
|
10
|
+
var QboIcon_1;
|
|
11
|
+
import { LitElement, html } from "lit";
|
|
11
12
|
import { customElement, property } from "lit/decorators.js";
|
|
12
|
-
import {
|
|
13
|
+
import { until } from "lit/directives/until.js";
|
|
14
|
+
const iconMap = new Map();
|
|
15
|
+
// qbo modules
|
|
16
|
+
iconMap.set('accounting', 'currency-dollar');
|
|
17
|
+
iconMap.set('collection', 'tag');
|
|
18
|
+
iconMap.set('document', 'file-earmark');
|
|
19
|
+
iconMap.set('export', 'database-down');
|
|
20
|
+
iconMap.set('import', 'database-up');
|
|
21
|
+
iconMap.set('message', 'envelope');
|
|
22
|
+
iconMap.set('process', 'building-gear');
|
|
23
|
+
iconMap.set('score', 'file-spreadsheet');
|
|
24
|
+
iconMap.set('task', 'list-check');
|
|
25
|
+
iconMap.set('workflow', 'diagram-2');
|
|
26
|
+
iconMap.set('security', 'lock');
|
|
27
|
+
// generic icons
|
|
28
|
+
iconMap.set('refresh', 'arrow-repeat');
|
|
29
|
+
iconMap.set('cut', 'scissors');
|
|
30
|
+
iconMap.set('copy', 'copy');
|
|
31
|
+
iconMap.set('paste', 'clipboard');
|
|
32
|
+
iconMap.set('delete', 'trash');
|
|
33
|
+
iconMap.set('up', 'arrow-up-circle');
|
|
34
|
+
iconMap.set('down', 'arrow-down-circle');
|
|
35
|
+
iconMap.set('left', 'arrow-left-circle');
|
|
36
|
+
iconMap.set('right', 'arrow-right-circle');
|
|
37
|
+
iconMap.set('copy', 'trash');
|
|
38
|
+
iconMap.set('maximize', 'arrow-down-circle');
|
|
39
|
+
iconMap.set('minimize', 'arrow-right-circle');
|
|
40
|
+
iconMap.set('normal', 'arrow-down-right-circle');
|
|
41
|
+
iconMap.set('upload', 'upload');
|
|
42
|
+
iconMap.set('download', 'download');
|
|
43
|
+
iconMap.set('folder', 'folder2');
|
|
44
|
+
iconMap.set('folder-open', 'folder2-open');
|
|
45
|
+
iconMap.set('pdf', 'filetype-pdf');
|
|
46
|
+
iconMap.set('audio', 'headphones');
|
|
47
|
+
iconMap.set('video', 'camera-video');
|
|
48
|
+
iconMap.set('headset', 'headphones');
|
|
49
|
+
iconMap.set('warning', 'exclamation-triangle');
|
|
13
50
|
// Renders an SVG icon based on the type attribute.
|
|
14
51
|
let QboIcon = class QboIcon extends LitElement {
|
|
15
52
|
constructor() {
|
|
16
53
|
super(...arguments);
|
|
17
54
|
this.type = 'icon';
|
|
18
55
|
this.icon = null;
|
|
19
|
-
this.height =
|
|
20
|
-
this.width =
|
|
21
|
-
this.viewbox = '0 0
|
|
56
|
+
this.height = '1rem';
|
|
57
|
+
this.width = '1rem';
|
|
58
|
+
this.viewbox = '0 0 1em 1em';
|
|
22
59
|
this.fill = 'currentColor';
|
|
23
60
|
this.backgroundColor = null;
|
|
24
|
-
this.unknown = 'warning';
|
|
25
61
|
this.disabled = false;
|
|
26
62
|
this.renderInHost = true;
|
|
63
|
+
this.selected = false;
|
|
64
|
+
this.allIcons = undefined;
|
|
65
|
+
}
|
|
66
|
+
static { QboIcon_1 = this; }
|
|
67
|
+
static { this.map = iconMap; }
|
|
68
|
+
// = '/ui/images/icons.svg';
|
|
69
|
+
// Getter to retrieve the `qbo4-basepath` meta tag value
|
|
70
|
+
static get spriteUrl() {
|
|
71
|
+
const metaTag = document.querySelector('meta[name="qbo4-basepath"]');
|
|
72
|
+
const basePath = metaTag?.getAttribute('value') || '';
|
|
73
|
+
return `${basePath}/ui/images/qbo-icons.svg`;
|
|
27
74
|
}
|
|
28
75
|
connectedCallback() {
|
|
29
76
|
this.type ??= 'icon';
|
|
30
77
|
super.connectedCallback();
|
|
78
|
+
if (this.type === 'toggle') {
|
|
79
|
+
this.addEventListener('click', this.toggle);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
disconnectedCallback() {
|
|
83
|
+
super.disconnectedCallback();
|
|
84
|
+
this.removeEventListener('click', this.toggle);
|
|
85
|
+
}
|
|
86
|
+
toggle() {
|
|
87
|
+
this.selected = !this.selected;
|
|
88
|
+
this.dispatchEvent(new CustomEvent(this.selected ? 'selected' : 'delected', { bubbles: true, composed: true }));
|
|
31
89
|
}
|
|
32
90
|
createRenderRoot() {
|
|
33
91
|
return this.renderInHost ? this : super.createRenderRoot();
|
|
34
92
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
93
|
+
updated(changedProperties) {
|
|
94
|
+
super.updated(changedProperties);
|
|
95
|
+
if (changedProperties.has('selected') && this.type === 'toggle') {
|
|
96
|
+
this.setAttribute('aria-pressed', this.selected ? 'true' : 'false');
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
async loadIcons() {
|
|
100
|
+
if (this.allIcons)
|
|
101
|
+
return this.allIcons;
|
|
102
|
+
try {
|
|
103
|
+
// Adjust this path to point to the correct location of bootstrap-icons.svg
|
|
104
|
+
const response = await fetch(this.sprite ?? QboIcon_1.spriteUrl);
|
|
105
|
+
const svgText = await response.text();
|
|
106
|
+
// Parse the SVG file
|
|
107
|
+
const parser = new DOMParser();
|
|
108
|
+
const svgDoc = parser.parseFromString(svgText, 'image/svg+xml');
|
|
109
|
+
// Find all `<symbol>` elements and extract their `id` attributes
|
|
110
|
+
const symbols = svgDoc.querySelectorAll('symbol');
|
|
111
|
+
this.allIcons = Array.from(symbols).map(symbol => symbol.id);
|
|
112
|
+
}
|
|
113
|
+
catch (error) {
|
|
114
|
+
console.error('Error loading icons:', error);
|
|
115
|
+
}
|
|
116
|
+
return this.allIcons;
|
|
117
|
+
}
|
|
118
|
+
renderStandard(component) {
|
|
119
|
+
return html `<div class="row">
|
|
120
|
+
${Array.from(iconMap.keys()).map(k => html `<div class="col-3">
|
|
121
|
+
<li class="list-unstyled">
|
|
122
|
+
<qbo-icon
|
|
123
|
+
.height=${component.height}
|
|
124
|
+
.width=${component.width}
|
|
125
|
+
.viewbox=${component.viewbox}
|
|
126
|
+
icon="${k}"
|
|
127
|
+
.fill=${component.fill}
|
|
128
|
+
.backgroundColor=${component.backgroundColor}>
|
|
129
|
+
</qbo-icon> ${k}
|
|
130
|
+
</li>
|
|
131
|
+
</div>`)}`;
|
|
132
|
+
}
|
|
133
|
+
async renderAll(component) {
|
|
134
|
+
await component.loadIcons();
|
|
135
|
+
if (this.allIcons === undefined)
|
|
136
|
+
return html `No icons found`;
|
|
137
|
+
return html `
|
|
138
|
+
<div class="row">
|
|
139
|
+
${this.allIcons.map(k => html `
|
|
140
|
+
<div class="col-md-4">
|
|
141
|
+
<li class="list-unstyled">
|
|
142
|
+
<qbo-icon
|
|
143
|
+
.height=${component.height}
|
|
144
|
+
.width=${component.width}
|
|
145
|
+
.viewbox=${component.viewbox}
|
|
146
|
+
icon="${k}"
|
|
147
|
+
.fill=${component.fill}
|
|
148
|
+
.backgroundColor=${component.backgroundColor}>
|
|
149
|
+
</qbo-icon> ${k}
|
|
150
|
+
</li>
|
|
151
|
+
</div>
|
|
152
|
+
`)}
|
|
53
153
|
</div>`;
|
|
54
154
|
}
|
|
55
155
|
renderIcon(component) {
|
|
56
|
-
if (component.icon == null) {
|
|
156
|
+
if (component.icon == null || component.icon === undefined) {
|
|
57
157
|
console.warn('qbo-icon: icon attribute is required');
|
|
58
|
-
component.icon =
|
|
59
|
-
}
|
|
60
|
-
if (!iconMap.has(component.icon)) {
|
|
61
|
-
console.warn(`qbo-icon: icon attribute is not valid. Valid values are: ${Array.from(iconMap.keys()).join(' ')}`);
|
|
62
|
-
component.icon = component.unknown;
|
|
158
|
+
component.icon = 'warning';
|
|
63
159
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
: svg ``}${iconMap.get(component.icon)}</svg>`;
|
|
67
|
-
}
|
|
68
|
-
renderButton(component) {
|
|
69
|
-
return html `<button type="button" ?disabled=${component.disabled}>${component.renderIcon(component)}</button>`;
|
|
160
|
+
const id = iconMap.has(component.icon) ? iconMap.get(component.icon) : component.icon;
|
|
161
|
+
return html `<svg width="${component.width}" height="${component.width}" fill="${component.fill}" ?class=${component.getAttribute('class')}><use href="${component.sprite ?? QboIcon_1.spriteUrl}#${id}"></use></svg>`;
|
|
70
162
|
}
|
|
163
|
+
//renderButton(component: any) {
|
|
164
|
+
// return html`<button type="button" ?disabled=${component.disabled}>${component.renderIcon(component)}</button>`;
|
|
165
|
+
//}
|
|
71
166
|
render() {
|
|
72
167
|
switch (this.type) {
|
|
73
168
|
case 'icon': return this.renderIcon(this);
|
|
74
|
-
case 'button': return this.
|
|
75
|
-
case '
|
|
169
|
+
case 'button': return this.renderIcon(this);
|
|
170
|
+
case 'toggle': return this.renderIcon(this);
|
|
171
|
+
case 'standard': return this.renderStandard(this);
|
|
172
|
+
case 'all': return html `${until(this.renderAll(this), html `Loading...`)}`;
|
|
76
173
|
default: return this.renderIcon(this);
|
|
77
174
|
}
|
|
78
175
|
}
|
|
@@ -81,17 +178,21 @@ __decorate([
|
|
|
81
178
|
property(),
|
|
82
179
|
__metadata("design:type", String)
|
|
83
180
|
], QboIcon.prototype, "type", void 0);
|
|
181
|
+
__decorate([
|
|
182
|
+
property(),
|
|
183
|
+
__metadata("design:type", Object)
|
|
184
|
+
], QboIcon.prototype, "sprite", void 0);
|
|
84
185
|
__decorate([
|
|
85
186
|
property(),
|
|
86
187
|
__metadata("design:type", Object)
|
|
87
188
|
], QboIcon.prototype, "icon", void 0);
|
|
88
189
|
__decorate([
|
|
89
190
|
property(),
|
|
90
|
-
__metadata("design:type",
|
|
191
|
+
__metadata("design:type", String)
|
|
91
192
|
], QboIcon.prototype, "height", void 0);
|
|
92
193
|
__decorate([
|
|
93
194
|
property(),
|
|
94
|
-
__metadata("design:type",
|
|
195
|
+
__metadata("design:type", String)
|
|
95
196
|
], QboIcon.prototype, "width", void 0);
|
|
96
197
|
__decorate([
|
|
97
198
|
property(),
|
|
@@ -105,10 +206,6 @@ __decorate([
|
|
|
105
206
|
property(),
|
|
106
207
|
__metadata("design:type", Object)
|
|
107
208
|
], QboIcon.prototype, "backgroundColor", void 0);
|
|
108
|
-
__decorate([
|
|
109
|
-
property(),
|
|
110
|
-
__metadata("design:type", String)
|
|
111
|
-
], QboIcon.prototype, "unknown", void 0);
|
|
112
209
|
__decorate([
|
|
113
210
|
property(),
|
|
114
211
|
__metadata("design:type", Boolean)
|
|
@@ -117,7 +214,11 @@ __decorate([
|
|
|
117
214
|
property({ type: Boolean, reflect: true }),
|
|
118
215
|
__metadata("design:type", Object)
|
|
119
216
|
], QboIcon.prototype, "renderInHost", void 0);
|
|
120
|
-
|
|
217
|
+
__decorate([
|
|
218
|
+
property({ type: Boolean, reflect: true }),
|
|
219
|
+
__metadata("design:type", Boolean)
|
|
220
|
+
], QboIcon.prototype, "selected", void 0);
|
|
221
|
+
QboIcon = QboIcon_1 = __decorate([
|
|
121
222
|
customElement('qbo-icon')
|
|
122
223
|
], QboIcon);
|
|
123
224
|
export { QboIcon };
|
package/src/qbo/qbo-icon.ts
CHANGED
|
@@ -1,25 +1,79 @@
|
|
|
1
|
-
import { LitElement, TemplateResult, html,
|
|
1
|
+
import { LitElement, TemplateResult, html, css } from "lit";
|
|
2
2
|
import { customElement, property } from "lit/decorators.js";
|
|
3
|
-
import {
|
|
3
|
+
import { until } from "lit/directives/until.js";
|
|
4
|
+
|
|
5
|
+
const iconMap: Map<string, string> = new Map();
|
|
6
|
+
// qbo modules
|
|
7
|
+
iconMap.set('accounting', 'currency-dollar');
|
|
8
|
+
iconMap.set('collection', 'tag');
|
|
9
|
+
iconMap.set('document', 'file-earmark');
|
|
10
|
+
iconMap.set('export', 'database-down');
|
|
11
|
+
iconMap.set('import', 'database-up');
|
|
12
|
+
iconMap.set('message', 'envelope');
|
|
13
|
+
iconMap.set('process', 'building-gear');
|
|
14
|
+
iconMap.set('score', 'file-spreadsheet');
|
|
15
|
+
iconMap.set('task', 'list-check');
|
|
16
|
+
iconMap.set('workflow', 'diagram-2');
|
|
17
|
+
iconMap.set('security', 'lock');
|
|
18
|
+
|
|
19
|
+
// generic icons
|
|
20
|
+
iconMap.set('refresh', 'arrow-repeat');
|
|
21
|
+
iconMap.set('cut', 'scissors');
|
|
22
|
+
iconMap.set('copy', 'copy');
|
|
23
|
+
iconMap.set('paste', 'clipboard');
|
|
24
|
+
iconMap.set('delete', 'trash');
|
|
25
|
+
|
|
26
|
+
iconMap.set('up', 'arrow-up-circle');
|
|
27
|
+
iconMap.set('down', 'arrow-down-circle');
|
|
28
|
+
iconMap.set('left', 'arrow-left-circle');
|
|
29
|
+
iconMap.set('right', 'arrow-right-circle');
|
|
30
|
+
iconMap.set('copy', 'trash');
|
|
31
|
+
iconMap.set('maximize', 'arrow-down-circle');
|
|
32
|
+
iconMap.set('minimize', 'arrow-right-circle');
|
|
33
|
+
iconMap.set('normal', 'arrow-down-right-circle');
|
|
34
|
+
|
|
35
|
+
iconMap.set('upload', 'upload');
|
|
36
|
+
iconMap.set('download', 'download');
|
|
37
|
+
iconMap.set('folder', 'folder2');
|
|
38
|
+
iconMap.set('folder-open', 'folder2-open');
|
|
39
|
+
iconMap.set('pdf', 'filetype-pdf');
|
|
40
|
+
iconMap.set('audio', 'headphones');
|
|
41
|
+
iconMap.set('video', 'camera-video');
|
|
42
|
+
iconMap.set('headset', 'headphones');
|
|
43
|
+
iconMap.set('warning', 'exclamation-triangle');
|
|
44
|
+
|
|
4
45
|
|
|
5
46
|
// Renders an SVG icon based on the type attribute.
|
|
6
47
|
@customElement('qbo-icon')
|
|
7
48
|
export class QboIcon extends LitElement {
|
|
8
49
|
|
|
50
|
+
static map: Map<string, string> = iconMap;
|
|
51
|
+
|
|
9
52
|
@property()
|
|
10
53
|
type: string = 'icon';
|
|
11
54
|
|
|
55
|
+
@property()
|
|
56
|
+
sprite: string | undefined;
|
|
57
|
+
|
|
58
|
+
// = '/ui/images/icons.svg';
|
|
59
|
+
// Getter to retrieve the `qbo4-basepath` meta tag value
|
|
60
|
+
static get spriteUrl(): string {
|
|
61
|
+
const metaTag = document.querySelector('meta[name="qbo4-basepath"]');
|
|
62
|
+
const basePath = metaTag?.getAttribute('value') || '';
|
|
63
|
+
return `${basePath}/ui/images/qbo-icons.svg`;
|
|
64
|
+
}
|
|
65
|
+
|
|
12
66
|
@property()
|
|
13
67
|
icon: string | null = null;
|
|
14
68
|
|
|
15
69
|
@property()
|
|
16
|
-
height:
|
|
70
|
+
height: string = '1rem';
|
|
17
71
|
|
|
18
72
|
@property()
|
|
19
|
-
width:
|
|
73
|
+
width: string = '1rem';
|
|
20
74
|
|
|
21
75
|
@property()
|
|
22
|
-
viewbox: string = '0 0
|
|
76
|
+
viewbox: string = '0 0 1em 1em';
|
|
23
77
|
|
|
24
78
|
@property()
|
|
25
79
|
fill: string = 'currentColor';
|
|
@@ -27,69 +81,128 @@ export class QboIcon extends LitElement {
|
|
|
27
81
|
@property()
|
|
28
82
|
backgroundColor: string | null = null;
|
|
29
83
|
|
|
30
|
-
@property()
|
|
31
|
-
unknown: string = 'warning';
|
|
32
|
-
|
|
33
84
|
@property()
|
|
34
85
|
disabled: boolean = false;
|
|
35
86
|
|
|
36
87
|
@property({ type: Boolean, reflect: true })
|
|
37
88
|
renderInHost = true;
|
|
38
89
|
|
|
90
|
+
@property({ type: Boolean, reflect: true })
|
|
91
|
+
selected: boolean = false;
|
|
39
92
|
|
|
40
93
|
connectedCallback() {
|
|
41
94
|
this.type ??= 'icon';
|
|
42
95
|
super.connectedCallback();
|
|
96
|
+
if (this.type === 'toggle') {
|
|
97
|
+
this.addEventListener('click', this.toggle);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
disconnectedCallback() {
|
|
102
|
+
super.disconnectedCallback();
|
|
103
|
+
this.removeEventListener('click', this.toggle);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
toggle() {
|
|
108
|
+
this.selected = !this.selected;
|
|
109
|
+
this.dispatchEvent(new CustomEvent(this.selected ? 'selected' : 'delected', { bubbles: true, composed: true }))
|
|
43
110
|
}
|
|
44
111
|
|
|
45
112
|
createRenderRoot() {
|
|
46
113
|
return this.renderInHost ? this : super.createRenderRoot();
|
|
47
114
|
}
|
|
48
115
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
116
|
+
updated(changedProperties: Map<string, any>) {
|
|
117
|
+
super.updated(changedProperties);
|
|
118
|
+
|
|
119
|
+
if (changedProperties.has('selected') && this.type === 'toggle') {
|
|
120
|
+
this.setAttribute('aria-pressed', this.selected ? 'true' : 'false');
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
private allIcons: string[] | undefined = undefined;
|
|
125
|
+
|
|
126
|
+
async loadIcons() {
|
|
127
|
+
if (this.allIcons) return this.allIcons;
|
|
128
|
+
try {
|
|
129
|
+
// Adjust this path to point to the correct location of bootstrap-icons.svg
|
|
130
|
+
const response = await fetch(this.sprite ?? QboIcon.spriteUrl);
|
|
131
|
+
const svgText = await response.text();
|
|
132
|
+
|
|
133
|
+
// Parse the SVG file
|
|
134
|
+
const parser = new DOMParser();
|
|
135
|
+
const svgDoc = parser.parseFromString(svgText, 'image/svg+xml');
|
|
136
|
+
|
|
137
|
+
// Find all `<symbol>` elements and extract their `id` attributes
|
|
138
|
+
const symbols = svgDoc.querySelectorAll('symbol');
|
|
139
|
+
this.allIcons = Array.from(symbols).map(symbol => symbol.id);
|
|
140
|
+
} catch (error) {
|
|
141
|
+
console.error('Error loading icons:', error);
|
|
142
|
+
}
|
|
143
|
+
return this.allIcons;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
renderStandard(component: any) {
|
|
147
|
+
return html`<div class="row">
|
|
148
|
+
${Array.from(iconMap.keys()).map(k => html`<div class="col-3">
|
|
149
|
+
<li class="list-unstyled">
|
|
150
|
+
<qbo-icon
|
|
151
|
+
.height=${component.height}
|
|
152
|
+
.width=${component.width}
|
|
153
|
+
.viewbox=${component.viewbox}
|
|
154
|
+
icon="${k}"
|
|
155
|
+
.fill=${component.fill}
|
|
156
|
+
.backgroundColor=${component.backgroundColor}>
|
|
157
|
+
</qbo-icon> ${k}
|
|
158
|
+
</li>
|
|
159
|
+
</div>`)}`;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
async renderAll(component: any) {
|
|
163
|
+
await component.loadIcons();
|
|
164
|
+
if (this.allIcons === undefined)
|
|
165
|
+
return html`No icons found`;
|
|
166
|
+
|
|
167
|
+
return html`
|
|
168
|
+
<div class="row">
|
|
169
|
+
${this.allIcons.map(k => html`
|
|
170
|
+
<div class="col-md-4">
|
|
171
|
+
<li class="list-unstyled">
|
|
172
|
+
<qbo-icon
|
|
173
|
+
.height=${component.height}
|
|
174
|
+
.width=${component.width}
|
|
175
|
+
.viewbox=${component.viewbox}
|
|
176
|
+
icon="${k}"
|
|
177
|
+
.fill=${component.fill}
|
|
178
|
+
.backgroundColor=${component.backgroundColor}>
|
|
179
|
+
</qbo-icon> ${k}
|
|
180
|
+
</li>
|
|
181
|
+
</div>
|
|
182
|
+
`)}
|
|
67
183
|
</div>`;
|
|
68
184
|
}
|
|
69
185
|
|
|
70
186
|
renderIcon(component: QboIcon) {
|
|
71
|
-
if (component.icon == null) {
|
|
187
|
+
if (component.icon == null || component.icon === undefined) {
|
|
72
188
|
console.warn('qbo-icon: icon attribute is required');
|
|
73
|
-
component.icon =
|
|
74
|
-
}
|
|
75
|
-
if (!iconMap.has(component.icon!)) {
|
|
76
|
-
console.warn(`qbo-icon: icon attribute is not valid. Valid values are: ${Array.from(iconMap.keys()).join(' ')}`);
|
|
77
|
-
component.icon = component.unknown;
|
|
189
|
+
component.icon = 'warning';
|
|
78
190
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
: svg``}${iconMap.get(component.icon!)}</svg>`;
|
|
191
|
+
const id: string | undefined = iconMap.has(component.icon) ? iconMap.get(component.icon) : component.icon;
|
|
192
|
+
return html`<svg width="${component.width}" height="${component.width}" fill="${component.fill}" ?class=${component.getAttribute('class')}><use href="${component.sprite ?? QboIcon.spriteUrl}#${id}"></use></svg>`
|
|
82
193
|
}
|
|
83
194
|
|
|
84
|
-
renderButton(component: any) {
|
|
85
|
-
|
|
86
|
-
}
|
|
195
|
+
//renderButton(component: any) {
|
|
196
|
+
// return html`<button type="button" ?disabled=${component.disabled}>${component.renderIcon(component)}</button>`;
|
|
197
|
+
//}
|
|
87
198
|
|
|
88
199
|
render() {
|
|
89
200
|
switch (this.type) {
|
|
90
201
|
case 'icon': return this.renderIcon(this);
|
|
91
|
-
case 'button': return this.
|
|
92
|
-
case '
|
|
202
|
+
case 'button': return this.renderIcon(this);
|
|
203
|
+
case 'toggle': return this.renderIcon(this);
|
|
204
|
+
case 'standard': return this.renderStandard(this);
|
|
205
|
+
case 'all': return html`${until(this.renderAll(this), html`Loading...`)}`;
|
|
93
206
|
default: return this.renderIcon(this);
|
|
94
207
|
}
|
|
95
208
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
export declare class QboMenu extends LitElement {
|
|
3
|
+
type: string;
|
|
4
|
+
expanded: boolean;
|
|
5
|
+
static styles: import("lit").CSSResult[];
|
|
6
|
+
private toggleSidebar;
|
|
7
|
+
connectedCallback(): void;
|
|
8
|
+
disconnectedCallback(): void;
|
|
9
|
+
target: string;
|
|
10
|
+
private showContextMenu;
|
|
11
|
+
private hideContextMenu;
|
|
12
|
+
private positionContextMenu;
|
|
13
|
+
get contextParent(): HTMLElement | Document | null;
|
|
14
|
+
context(): import("lit-html").TemplateResult<1>;
|
|
15
|
+
side(): import("lit-html").TemplateResult<1>;
|
|
16
|
+
render(): import("lit-html").TemplateResult<1> | undefined;
|
|
17
|
+
xrender(): import("lit-html").TemplateResult<1>;
|
|
18
|
+
}
|