@harbortouch/skytab-analytics-report-utils 0.39.0 → 0.41.0
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/dist/{chunk-HRMMRGR7.js → chunk-7GHXVTY6.js} +10 -0
- package/dist/exporters/excel/index.d.cts +2 -2
- package/dist/exporters/excel/index.d.ts +2 -2
- package/dist/exporters/exportBuilder.cjs +55 -24
- package/dist/exporters/exportBuilder.d.cts +5 -5
- package/dist/exporters/exportBuilder.d.ts +5 -5
- package/dist/exporters/exportBuilder.js +46 -25
- package/dist/exporters/pdf/fonts/Lato-Bold.ttf +0 -0
- package/dist/exporters/pdf/fonts/Lato-Regular.ttf +0 -0
- package/dist/exporters/pdf/index.cjs +164 -70
- package/dist/exporters/pdf/index.d.cts +7 -5
- package/dist/exporters/pdf/index.d.ts +7 -5
- package/dist/exporters/pdf/index.js +158 -70
- package/dist/index.cjs +10 -0
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/{report-CDeQvFgd.d.cts → report-EBViO5sS.d.cts} +5 -1
- package/dist/{report-CDeQvFgd.d.ts → report-EBViO5sS.d.ts} +5 -1
- package/dist/{types-BPT5hjCR.d.ts → types-MalWTEdo.d.cts} +10 -1
- package/dist/{types-BPT5hjCR.d.cts → types-MalWTEdo.d.ts} +10 -1
- package/package.json +1 -1
|
@@ -744,7 +744,10 @@ var enUS = {
|
|
|
744
744
|
"common.report-section.rev-class-footer.non-sales-revenue": false,
|
|
745
745
|
"common.report-section.rev-class-footer.house-account": false,
|
|
746
746
|
"common.report-section.rev-class-footer.total-accountable": false,
|
|
747
|
+
"scheduled-reports.report-name": false,
|
|
747
748
|
"scheduled-reports.period": false,
|
|
749
|
+
"scheduled-reports.generated-at": false,
|
|
750
|
+
"scheduled-reports.generated-by": false,
|
|
748
751
|
"components.form.field.group-by": false,
|
|
749
752
|
"components.form.field.last-week": false,
|
|
750
753
|
"components.form.field.last-year": false,
|
|
@@ -1272,7 +1275,10 @@ var enUS2 = {
|
|
|
1272
1275
|
"common.report-section.rev-class-footer.non-sales-revenue": false,
|
|
1273
1276
|
"common.report-section.rev-class-footer.house-account": false,
|
|
1274
1277
|
"common.report-section.rev-class-footer.total-accountable": false,
|
|
1278
|
+
"scheduled-reports.report-name": false,
|
|
1275
1279
|
"scheduled-reports.period": false,
|
|
1280
|
+
"scheduled-reports.generated-at": false,
|
|
1281
|
+
"scheduled-reports.generated-by": false,
|
|
1276
1282
|
"components.form.field.group-by": false,
|
|
1277
1283
|
"components.form.field.last-week": false,
|
|
1278
1284
|
"components.form.field.last-year": false,
|
|
@@ -1800,7 +1806,10 @@ var enUS3 = {
|
|
|
1800
1806
|
"common.report-section.rev-class-footer.non-sales-revenue": "Non-Sales Revenue",
|
|
1801
1807
|
"common.report-section.rev-class-footer.house-account": "House Account",
|
|
1802
1808
|
"common.report-section.rev-class-footer.total-accountable": "Total Accountable",
|
|
1809
|
+
"scheduled-reports.report-name": "Report",
|
|
1803
1810
|
"scheduled-reports.period": "Period",
|
|
1811
|
+
"scheduled-reports.generated-at": "Generated at",
|
|
1812
|
+
"scheduled-reports.generated-by": "Generated by",
|
|
1804
1813
|
"components.form.field.group-by": "Group By",
|
|
1805
1814
|
"components.form.field.last-week": "Compare to Last Week",
|
|
1806
1815
|
"components.form.field.last-year": "Compare to Last Year",
|
|
@@ -1816,6 +1825,7 @@ var enUS3 = {
|
|
|
1816
1825
|
"analytics.field.daypart_id": "Day Parts",
|
|
1817
1826
|
"analytics.field.timeslot_id": "15 Mins",
|
|
1818
1827
|
"analytics.field.employee_id": "Employees",
|
|
1828
|
+
"analytics.field.employee_name": "Employee",
|
|
1819
1829
|
"analytics.field.payroll_id": "Payroll IDs",
|
|
1820
1830
|
"analytics.field.intraday_period_group": "Day Parts",
|
|
1821
1831
|
"analytics.field.item_id": "Item",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { a as ExportSection } from '../../types-MalWTEdo.cjs';
|
|
2
|
+
export { E as XlsxFilter, b as XlsxTable, c as XlsxTableColumn } from '../../types-MalWTEdo.cjs';
|
|
3
3
|
|
|
4
4
|
declare class ExcelExporter {
|
|
5
5
|
generate(content: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { a as ExportSection } from '../../types-MalWTEdo.js';
|
|
2
|
+
export { E as XlsxFilter, b as XlsxTable, c as XlsxTableColumn } from '../../types-MalWTEdo.js';
|
|
3
3
|
|
|
4
4
|
declare class ExcelExporter {
|
|
5
5
|
generate(content: {
|
|
@@ -516,7 +516,10 @@ var enUS = {
|
|
|
516
516
|
"common.report-section.rev-class-footer.non-sales-revenue": "Non-Sales Revenue",
|
|
517
517
|
"common.report-section.rev-class-footer.house-account": "House Account",
|
|
518
518
|
"common.report-section.rev-class-footer.total-accountable": "Total Accountable",
|
|
519
|
+
"scheduled-reports.report-name": "Report",
|
|
519
520
|
"scheduled-reports.period": "Period",
|
|
521
|
+
"scheduled-reports.generated-at": "Generated at",
|
|
522
|
+
"scheduled-reports.generated-by": "Generated by",
|
|
520
523
|
"components.form.field.group-by": "Group By",
|
|
521
524
|
"components.form.field.last-week": "Compare to Last Week",
|
|
522
525
|
"components.form.field.last-year": "Compare to Last Year",
|
|
@@ -532,6 +535,7 @@ var enUS = {
|
|
|
532
535
|
"analytics.field.daypart_id": "Day Parts",
|
|
533
536
|
"analytics.field.timeslot_id": "15 Mins",
|
|
534
537
|
"analytics.field.employee_id": "Employees",
|
|
538
|
+
"analytics.field.employee_name": "Employee",
|
|
535
539
|
"analytics.field.payroll_id": "Payroll IDs",
|
|
536
540
|
"analytics.field.intraday_period_group": "Day Parts",
|
|
537
541
|
"analytics.field.item_id": "Item",
|
|
@@ -1044,7 +1048,10 @@ var enUS2 = {
|
|
|
1044
1048
|
"common.report-section.rev-class-footer.non-sales-revenue": false,
|
|
1045
1049
|
"common.report-section.rev-class-footer.house-account": false,
|
|
1046
1050
|
"common.report-section.rev-class-footer.total-accountable": false,
|
|
1051
|
+
"scheduled-reports.report-name": false,
|
|
1047
1052
|
"scheduled-reports.period": false,
|
|
1053
|
+
"scheduled-reports.generated-at": false,
|
|
1054
|
+
"scheduled-reports.generated-by": false,
|
|
1048
1055
|
"components.form.field.group-by": false,
|
|
1049
1056
|
"components.form.field.last-week": false,
|
|
1050
1057
|
"components.form.field.last-year": false,
|
|
@@ -1572,7 +1579,10 @@ var enUS3 = {
|
|
|
1572
1579
|
"common.report-section.rev-class-footer.non-sales-revenue": false,
|
|
1573
1580
|
"common.report-section.rev-class-footer.house-account": false,
|
|
1574
1581
|
"common.report-section.rev-class-footer.total-accountable": false,
|
|
1582
|
+
"scheduled-reports.report-name": false,
|
|
1575
1583
|
"scheduled-reports.period": false,
|
|
1584
|
+
"scheduled-reports.generated-at": false,
|
|
1585
|
+
"scheduled-reports.generated-by": false,
|
|
1576
1586
|
"components.form.field.group-by": false,
|
|
1577
1587
|
"components.form.field.last-week": false,
|
|
1578
1588
|
"components.form.field.last-year": false,
|
|
@@ -3959,50 +3969,71 @@ var ExportBuilder = class {
|
|
|
3959
3969
|
}
|
|
3960
3970
|
return (0, import_date_fns.format)(date, "yyyy-MM-dd");
|
|
3961
3971
|
}
|
|
3962
|
-
|
|
3963
|
-
const
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
3972
|
+
buildReportMetadataFilters(parameters, name, meta) {
|
|
3973
|
+
const locationNames = this.locations.map((l) => l.name).join(", ");
|
|
3974
|
+
const period = `${this.formatMaybeDate(parameters.startDate)} - ${this.formatMaybeDate(parameters.endDate)}`;
|
|
3975
|
+
const filters = [
|
|
3976
|
+
{ label: this.translate("scheduled-reports.report-name"), value: name },
|
|
3977
|
+
{ label: this.translate("common.labels.locations"), value: locationNames },
|
|
3978
|
+
{ label: this.translate("scheduled-reports.period"), value: period }
|
|
3979
|
+
];
|
|
3968
3980
|
if (parameters.groupBy) {
|
|
3969
|
-
|
|
3970
|
-
this.translate("components.form.field.group-by"),
|
|
3971
|
-
this.translate(`analytics.field.${parameters.groupBy}`)
|
|
3972
|
-
|
|
3973
|
-
}
|
|
3974
|
-
const locationNames = this.locations.map((l) => l.name);
|
|
3975
|
-
if (locationNames.length > 0) {
|
|
3976
|
-
rows.push([this.translate("common.labels.locations"), locationNames.join(", ")]);
|
|
3981
|
+
filters.push({
|
|
3982
|
+
label: this.translate("components.form.field.group-by"),
|
|
3983
|
+
value: this.translate(`analytics.field.${parameters.groupBy}`)
|
|
3984
|
+
});
|
|
3977
3985
|
}
|
|
3978
3986
|
if (parameters.compareToLastWeek === true) {
|
|
3979
|
-
|
|
3987
|
+
filters.push({
|
|
3988
|
+
label: this.translate("components.form.field.last-week"),
|
|
3989
|
+
value: this.translate("common.labels.yes")
|
|
3990
|
+
});
|
|
3980
3991
|
}
|
|
3981
3992
|
if (parameters.compareToLastYear === true) {
|
|
3982
|
-
|
|
3993
|
+
filters.push({
|
|
3994
|
+
label: this.translate("components.form.field.last-year"),
|
|
3995
|
+
value: this.translate("common.labels.yes")
|
|
3996
|
+
});
|
|
3997
|
+
}
|
|
3998
|
+
if (meta.generatedAt) {
|
|
3999
|
+
const formatted = new Intl.DateTimeFormat(this.locale, {
|
|
4000
|
+
year: "numeric",
|
|
4001
|
+
month: "short",
|
|
4002
|
+
day: "numeric",
|
|
4003
|
+
hour: "numeric",
|
|
4004
|
+
minute: "2-digit",
|
|
4005
|
+
timeZoneName: "short"
|
|
4006
|
+
}).format(meta.generatedAt);
|
|
4007
|
+
filters.push({ label: this.translate("scheduled-reports.generated-at"), value: formatted });
|
|
4008
|
+
}
|
|
4009
|
+
if (meta.generatedBy.email) {
|
|
4010
|
+
filters.push({ label: this.translate("scheduled-reports.generated-by"), value: meta.generatedBy.email });
|
|
3983
4011
|
}
|
|
3984
|
-
return
|
|
4012
|
+
return filters.filter(({ value }) => value !== "");
|
|
3985
4013
|
}
|
|
3986
|
-
getContent(reportData, parameters, name) {
|
|
4014
|
+
getContent(reportData, parameters, name, metadata, appliedFilters) {
|
|
3987
4015
|
const rawConfig = this.getConfig();
|
|
3988
4016
|
if (!rawConfig) {
|
|
3989
4017
|
throw new Error("Missing report config");
|
|
3990
4018
|
}
|
|
4019
|
+
const metadataFilters = this.buildReportMetadataFilters(parameters, name, metadata);
|
|
4020
|
+
const resolvedAppliedFilters = appliedFilters ?? [];
|
|
3991
4021
|
let sections;
|
|
3992
4022
|
if (Array.isArray(rawConfig)) {
|
|
3993
4023
|
const sectionParameters = { ...parameters, cols: void 0 };
|
|
3994
|
-
sections =
|
|
3995
|
-
|
|
4024
|
+
sections = [
|
|
4025
|
+
{ title: name, filters: metadataFilters, appliedFilters: resolvedAppliedFilters },
|
|
4026
|
+
...rawConfig.map((config) => ({
|
|
3996
4027
|
title: this.getConfigSectionName(config),
|
|
3997
4028
|
...this.renderTableContent(config, reportData, sectionParameters)
|
|
3998
|
-
}
|
|
3999
|
-
|
|
4029
|
+
}))
|
|
4030
|
+
];
|
|
4000
4031
|
} else {
|
|
4001
|
-
const metadata = this.buildMetadata(parameters);
|
|
4002
4032
|
sections = [
|
|
4003
4033
|
{
|
|
4004
4034
|
title: name,
|
|
4005
|
-
filters:
|
|
4035
|
+
filters: metadataFilters,
|
|
4036
|
+
appliedFilters: resolvedAppliedFilters,
|
|
4006
4037
|
...this.renderTableContent(rawConfig, reportData, parameters)
|
|
4007
4038
|
}
|
|
4008
4039
|
];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as ReportType, A as AnalyticsField } from '../report-
|
|
2
|
-
import { E as ExportSection } from '../types-
|
|
1
|
+
import { R as ReportType, A as AnalyticsField } from '../report-EBViO5sS.cjs';
|
|
2
|
+
import { R as ReportMetadata, E as ExportFilter, a as ExportSection } from '../types-MalWTEdo.cjs';
|
|
3
3
|
|
|
4
4
|
type ReportDocumentSection = ExportSection;
|
|
5
5
|
interface ReportLocation {
|
|
@@ -45,8 +45,8 @@ declare class ExportBuilder {
|
|
|
45
45
|
private renderTableContent;
|
|
46
46
|
private getDataForConfig;
|
|
47
47
|
private formatMaybeDate;
|
|
48
|
-
private
|
|
49
|
-
getContent(reportData: ReportData, parameters: ReportParameters, name: string): ExportSection[];
|
|
48
|
+
private buildReportMetadataFilters;
|
|
49
|
+
getContent(reportData: ReportData, parameters: ReportParameters, name: string, metadata: ReportMetadata, appliedFilters?: ExportFilter[]): ExportSection[];
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
export { ExportBuilder, type ReportData, type ReportDocumentSection, type ReportLocation, type ReportParameters, type SingleReportData };
|
|
52
|
+
export { ExportBuilder, ExportFilter, type ReportData, type ReportDocumentSection, type ReportLocation, ReportMetadata, type ReportParameters, ReportType, type SingleReportData };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as ReportType, A as AnalyticsField } from '../report-
|
|
2
|
-
import { E as ExportSection } from '../types-
|
|
1
|
+
import { R as ReportType, A as AnalyticsField } from '../report-EBViO5sS.js';
|
|
2
|
+
import { R as ReportMetadata, E as ExportFilter, a as ExportSection } from '../types-MalWTEdo.js';
|
|
3
3
|
|
|
4
4
|
type ReportDocumentSection = ExportSection;
|
|
5
5
|
interface ReportLocation {
|
|
@@ -45,8 +45,8 @@ declare class ExportBuilder {
|
|
|
45
45
|
private renderTableContent;
|
|
46
46
|
private getDataForConfig;
|
|
47
47
|
private formatMaybeDate;
|
|
48
|
-
private
|
|
49
|
-
getContent(reportData: ReportData, parameters: ReportParameters, name: string): ExportSection[];
|
|
48
|
+
private buildReportMetadataFilters;
|
|
49
|
+
getContent(reportData: ReportData, parameters: ReportParameters, name: string, metadata: ReportMetadata, appliedFilters?: ExportFilter[]): ExportSection[];
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
export { ExportBuilder, type ReportData, type ReportDocumentSection, type ReportLocation, type ReportParameters, type SingleReportData };
|
|
52
|
+
export { ExportBuilder, ExportFilter, type ReportData, type ReportDocumentSection, type ReportLocation, ReportMetadata, type ReportParameters, ReportType, type SingleReportData };
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
getReportConfig,
|
|
8
8
|
getReportFormattingLocaleOptions,
|
|
9
9
|
resolveTranslate
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-7GHXVTY6.js";
|
|
11
11
|
|
|
12
12
|
// src/exporters/exportBuilder.ts
|
|
13
13
|
import { format, isValid, parseISO } from "date-fns";
|
|
@@ -158,50 +158,71 @@ var ExportBuilder = class {
|
|
|
158
158
|
}
|
|
159
159
|
return format(date, "yyyy-MM-dd");
|
|
160
160
|
}
|
|
161
|
-
|
|
162
|
-
const
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
161
|
+
buildReportMetadataFilters(parameters, name, meta) {
|
|
162
|
+
const locationNames = this.locations.map((l) => l.name).join(", ");
|
|
163
|
+
const period = `${this.formatMaybeDate(parameters.startDate)} - ${this.formatMaybeDate(parameters.endDate)}`;
|
|
164
|
+
const filters = [
|
|
165
|
+
{ label: this.translate("scheduled-reports.report-name"), value: name },
|
|
166
|
+
{ label: this.translate("common.labels.locations"), value: locationNames },
|
|
167
|
+
{ label: this.translate("scheduled-reports.period"), value: period }
|
|
168
|
+
];
|
|
167
169
|
if (parameters.groupBy) {
|
|
168
|
-
|
|
169
|
-
this.translate("components.form.field.group-by"),
|
|
170
|
-
this.translate(`analytics.field.${parameters.groupBy}`)
|
|
171
|
-
|
|
172
|
-
}
|
|
173
|
-
const locationNames = this.locations.map((l) => l.name);
|
|
174
|
-
if (locationNames.length > 0) {
|
|
175
|
-
rows.push([this.translate("common.labels.locations"), locationNames.join(", ")]);
|
|
170
|
+
filters.push({
|
|
171
|
+
label: this.translate("components.form.field.group-by"),
|
|
172
|
+
value: this.translate(`analytics.field.${parameters.groupBy}`)
|
|
173
|
+
});
|
|
176
174
|
}
|
|
177
175
|
if (parameters.compareToLastWeek === true) {
|
|
178
|
-
|
|
176
|
+
filters.push({
|
|
177
|
+
label: this.translate("components.form.field.last-week"),
|
|
178
|
+
value: this.translate("common.labels.yes")
|
|
179
|
+
});
|
|
179
180
|
}
|
|
180
181
|
if (parameters.compareToLastYear === true) {
|
|
181
|
-
|
|
182
|
+
filters.push({
|
|
183
|
+
label: this.translate("components.form.field.last-year"),
|
|
184
|
+
value: this.translate("common.labels.yes")
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
if (meta.generatedAt) {
|
|
188
|
+
const formatted = new Intl.DateTimeFormat(this.locale, {
|
|
189
|
+
year: "numeric",
|
|
190
|
+
month: "short",
|
|
191
|
+
day: "numeric",
|
|
192
|
+
hour: "numeric",
|
|
193
|
+
minute: "2-digit",
|
|
194
|
+
timeZoneName: "short"
|
|
195
|
+
}).format(meta.generatedAt);
|
|
196
|
+
filters.push({ label: this.translate("scheduled-reports.generated-at"), value: formatted });
|
|
182
197
|
}
|
|
183
|
-
|
|
198
|
+
if (meta.generatedBy.email) {
|
|
199
|
+
filters.push({ label: this.translate("scheduled-reports.generated-by"), value: meta.generatedBy.email });
|
|
200
|
+
}
|
|
201
|
+
return filters.filter(({ value }) => value !== "");
|
|
184
202
|
}
|
|
185
|
-
getContent(reportData, parameters, name) {
|
|
203
|
+
getContent(reportData, parameters, name, metadata, appliedFilters) {
|
|
186
204
|
const rawConfig = this.getConfig();
|
|
187
205
|
if (!rawConfig) {
|
|
188
206
|
throw new Error("Missing report config");
|
|
189
207
|
}
|
|
208
|
+
const metadataFilters = this.buildReportMetadataFilters(parameters, name, metadata);
|
|
209
|
+
const resolvedAppliedFilters = appliedFilters ?? [];
|
|
190
210
|
let sections;
|
|
191
211
|
if (Array.isArray(rawConfig)) {
|
|
192
212
|
const sectionParameters = { ...parameters, cols: void 0 };
|
|
193
|
-
sections =
|
|
194
|
-
|
|
213
|
+
sections = [
|
|
214
|
+
{ title: name, filters: metadataFilters, appliedFilters: resolvedAppliedFilters },
|
|
215
|
+
...rawConfig.map((config) => ({
|
|
195
216
|
title: this.getConfigSectionName(config),
|
|
196
217
|
...this.renderTableContent(config, reportData, sectionParameters)
|
|
197
|
-
}
|
|
198
|
-
|
|
218
|
+
}))
|
|
219
|
+
];
|
|
199
220
|
} else {
|
|
200
|
-
const metadata = this.buildMetadata(parameters);
|
|
201
221
|
sections = [
|
|
202
222
|
{
|
|
203
223
|
title: name,
|
|
204
|
-
filters:
|
|
224
|
+
filters: metadataFilters,
|
|
225
|
+
appliedFilters: resolvedAppliedFilters,
|
|
205
226
|
...this.renderTableContent(rawConfig, reportData, parameters)
|
|
206
227
|
}
|
|
207
228
|
];
|
|
Binary file
|
|
Binary file
|