@quandis/qbo4.ui 4.0.1-CI-20241116-001926 → 4.0.1-CI-20241118-225310
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 +1 -1
- package/scss/qbo.scss +10 -1
- package/src/qbo/Program.d.ts +0 -2
- package/src/qbo/Program.js +0 -17
- package/src/qbo/Program.ts +0 -17
- package/src/qbo/qbo-user-preferences.d.ts +3 -0
- package/src/qbo/qbo-user-preferences.js +33 -0
- package/src/qbo/qbo-user-preferences.ts +38 -0
- package/src/qbo/styles.js +2 -2
- package/src/qbo/styles.ts +2 -2
- package/wwwroot/css/qbo.css +10 -1
- package/wwwroot/css/qbo.css.map +1 -1
- package/wwwroot/css/qbo.min.css +1 -1
- package/wwwroot/css/qboui.css +10 -1
- package/wwwroot/css/qboui.css.map +1 -1
- package/wwwroot/css/qboui.min.css +1 -1
- package/wwwroot/images/qbo-icons.svg +101 -0
- package/wwwroot/js/esm/qbo4.ui.js +48 -27
- package/wwwroot/js/esm/qbo4.ui.min.js +7 -7
- package/wwwroot/js/esm/qbo4.ui.min.js.map +1 -1
- package/wwwroot/js/qbo4.ui.js +44 -24
- package/wwwroot/js/qbo4.ui.min.js +7 -7
- package/wwwroot/js/qbo4.ui.min.js.map +1 -1
package/package.json
CHANGED
package/scss/qbo.scss
CHANGED
|
@@ -170,6 +170,10 @@
|
|
|
170
170
|
overflow: auto;
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
+
.qbo-card-bottom {
|
|
174
|
+
margin-bottom: .5em;
|
|
175
|
+
}
|
|
176
|
+
|
|
173
177
|
.qbo-card-left {
|
|
174
178
|
margin-left: .5em;
|
|
175
179
|
}
|
|
@@ -178,6 +182,10 @@
|
|
|
178
182
|
margin-right: .5em;
|
|
179
183
|
}
|
|
180
184
|
|
|
185
|
+
.qbo-card-top {
|
|
186
|
+
margin-top: .5em;
|
|
187
|
+
}
|
|
188
|
+
|
|
181
189
|
svg {
|
|
182
190
|
height: 1rem;
|
|
183
191
|
width: 1rem;
|
|
@@ -436,7 +444,7 @@ nav {
|
|
|
436
444
|
|
|
437
445
|
> span {
|
|
438
446
|
font-weight: bold;
|
|
439
|
-
margin-top:
|
|
447
|
+
margin-top: 15px;
|
|
440
448
|
padding-inline-start: 10px;
|
|
441
449
|
}
|
|
442
450
|
|
|
@@ -640,6 +648,7 @@ div.qbo-row-subsequent {
|
|
|
640
648
|
h3.title {
|
|
641
649
|
margin-block-end: 0;
|
|
642
650
|
margin-block-start: .5em;
|
|
651
|
+
margin-bottom: .5em;
|
|
643
652
|
margin-left: .5em;
|
|
644
653
|
}
|
|
645
654
|
|
package/src/qbo/Program.d.ts
CHANGED
|
@@ -43,5 +43,3 @@ export declare function matches(source: any, match: any, wildCard?: string, igno
|
|
|
43
43
|
export declare function elementData(element: HTMLElement): Record<string, string>;
|
|
44
44
|
export declare function elementDate(date: string): string;
|
|
45
45
|
export declare function elementDateTime(date: string): string;
|
|
46
|
-
export declare function elementMoney(amount: string, currency?: string, locale?: string): string;
|
|
47
|
-
export declare function elementPercentage(value: string, decimals?: number, locale?: string): string;
|
package/src/qbo/Program.js
CHANGED
|
@@ -54,20 +54,3 @@ export function elementDateTime(date) {
|
|
|
54
54
|
return '';
|
|
55
55
|
return new Date(date).toLocaleString().replace(',', '');
|
|
56
56
|
}
|
|
57
|
-
export function elementMoney(amount, currency = 'USD', locale = 'en-US') {
|
|
58
|
-
if (!amount)
|
|
59
|
-
return '';
|
|
60
|
-
return new Intl.NumberFormat(locale, {
|
|
61
|
-
style: 'currency',
|
|
62
|
-
currency,
|
|
63
|
-
}).format(Number(amount));
|
|
64
|
-
}
|
|
65
|
-
export function elementPercentage(value, decimals = 2, locale = 'en-US') {
|
|
66
|
-
if (!value)
|
|
67
|
-
return '';
|
|
68
|
-
return new Intl.NumberFormat(locale, {
|
|
69
|
-
style: 'percent',
|
|
70
|
-
minimumFractionDigits: decimals,
|
|
71
|
-
maximumFractionDigits: decimals,
|
|
72
|
-
}).format(Number(value));
|
|
73
|
-
}
|
package/src/qbo/Program.ts
CHANGED
|
@@ -73,20 +73,3 @@ export function elementDateTime(date: string) {
|
|
|
73
73
|
if (!date || date.trim() == '') return '';
|
|
74
74
|
return new Date(date).toLocaleString().replace(',', '');
|
|
75
75
|
}
|
|
76
|
-
|
|
77
|
-
export function elementMoney(amount: string, currency: string = 'USD', locale: string = 'en-US'): string {
|
|
78
|
-
if (!amount) return '';
|
|
79
|
-
return new Intl.NumberFormat(locale, {
|
|
80
|
-
style: 'currency',
|
|
81
|
-
currency,
|
|
82
|
-
}).format(Number(amount));
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export function elementPercentage(value: string, decimals: number = 2, locale: string = 'en-US'): string {
|
|
86
|
-
if (!value) return '';
|
|
87
|
-
return new Intl.NumberFormat(locale, {
|
|
88
|
-
style: 'percent',
|
|
89
|
-
minimumFractionDigits: decimals,
|
|
90
|
-
maximumFractionDigits: decimals,
|
|
91
|
-
}).format(Number(value));
|
|
92
|
-
}
|
|
@@ -16,3 +16,6 @@ export declare function setUserPreference(preference: string, value: any, storag
|
|
|
16
16
|
export declare function getUserPreference(preference: string, storageKey?: string): any;
|
|
17
17
|
export declare function join(values: (string | null | undefined)[], separator?: string): string;
|
|
18
18
|
export declare function formatDate(dateString: string | Date | undefined | null, format?: string | null): string | null;
|
|
19
|
+
export declare function formatMoney(amount: string | number | undefined | null, currency?: string, locale?: string): string;
|
|
20
|
+
export declare function formatPercentage(value: string | number | undefined | null, decimals?: number, locale?: string): string;
|
|
21
|
+
export declare function timeRemaining(targetDate: string | Date | undefined | null, interval?: string): import("lit-html").TemplateResult<1> | null;
|
|
@@ -176,3 +176,36 @@ export function formatDate(dateString, format = null) {
|
|
|
176
176
|
const formattedDate = new Intl.DateTimeFormat(undefined, options).format(new Date(dateString));
|
|
177
177
|
return formattedDate;
|
|
178
178
|
}
|
|
179
|
+
export function formatMoney(amount, currency = 'USD', locale = 'en-US') {
|
|
180
|
+
if (!amount)
|
|
181
|
+
return '';
|
|
182
|
+
return new Intl.NumberFormat(locale, {
|
|
183
|
+
style: 'currency',
|
|
184
|
+
currency,
|
|
185
|
+
}).format(Number(amount));
|
|
186
|
+
}
|
|
187
|
+
export function formatPercentage(value, decimals = 2, locale = 'en-US') {
|
|
188
|
+
if (!value)
|
|
189
|
+
return '';
|
|
190
|
+
return new Intl.NumberFormat(locale, {
|
|
191
|
+
style: 'percent',
|
|
192
|
+
minimumFractionDigits: decimals,
|
|
193
|
+
maximumFractionDigits: decimals,
|
|
194
|
+
}).format(Number(value));
|
|
195
|
+
}
|
|
196
|
+
export function timeRemaining(targetDate, interval = 'months') {
|
|
197
|
+
if (targetDate == null || isNaN(new Date(targetDate).getTime()))
|
|
198
|
+
return null;
|
|
199
|
+
let years = new Date(targetDate).getFullYear() - new Date().getFullYear();
|
|
200
|
+
let months = new Date(targetDate).getMonth() - new Date().getMonth();
|
|
201
|
+
if (months < 0) {
|
|
202
|
+
years -= 1;
|
|
203
|
+
months = 12 + months;
|
|
204
|
+
}
|
|
205
|
+
if (years < 1 && months < 1)
|
|
206
|
+
return html ``;
|
|
207
|
+
else if (years < 1 && months > 0)
|
|
208
|
+
return html `${months} month${months > 1 ? 's' : ''}`;
|
|
209
|
+
else
|
|
210
|
+
return html `${years} year${years > 1 ? 's' : ''}, ${months} month${months != 1 ? 's' : ''} (${years * 12 + months})`;
|
|
211
|
+
}
|
|
@@ -165,3 +165,41 @@ export function formatDate(dateString: string | Date | undefined | null, format:
|
|
|
165
165
|
|
|
166
166
|
return formattedDate;
|
|
167
167
|
}
|
|
168
|
+
|
|
169
|
+
export function formatMoney(amount: string | number | undefined | null, currency: string = 'USD', locale: string = 'en-US'): string {
|
|
170
|
+
if (!amount) return '';
|
|
171
|
+
return new Intl.NumberFormat(locale, {
|
|
172
|
+
style: 'currency',
|
|
173
|
+
currency,
|
|
174
|
+
}).format(Number(amount));
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export function formatPercentage(value: string | number | undefined | null, decimals: number = 2, locale: string = 'en-US'): string {
|
|
178
|
+
if (!value) return '';
|
|
179
|
+
return new Intl.NumberFormat(locale, {
|
|
180
|
+
style: 'percent',
|
|
181
|
+
minimumFractionDigits: decimals,
|
|
182
|
+
maximumFractionDigits: decimals,
|
|
183
|
+
}).format(Number(value));
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export function timeRemaining(targetDate: string | Date | undefined | null, interval: string = 'months') {
|
|
187
|
+
|
|
188
|
+
if (targetDate == null || isNaN(new Date(targetDate).getTime()))
|
|
189
|
+
return null;
|
|
190
|
+
|
|
191
|
+
let years = new Date(targetDate).getFullYear() - new Date().getFullYear();
|
|
192
|
+
let months = new Date(targetDate).getMonth() - new Date().getMonth();
|
|
193
|
+
|
|
194
|
+
if (months < 0) {
|
|
195
|
+
years -= 1;
|
|
196
|
+
months = 12 + months;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
if (years < 1 && months < 1)
|
|
200
|
+
return html``;
|
|
201
|
+
else if (years < 1 && months > 0)
|
|
202
|
+
return html`${months} month${months > 1 ? 's' : ''}`;
|
|
203
|
+
else
|
|
204
|
+
return html`${years} year${years > 1 ? 's' : ''}, ${months} month${months != 1 ? 's' : ''} (${years * 12 + months})`;
|
|
205
|
+
}
|