@acorex-platform/module-report-management-server 0.0.18 → 2.0.0-beta.1
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/contracts/src/commands.keys.d.ts +13 -0
- package/contracts/src/commands.keys.js +19 -0
- package/contracts/src/commands.keys.js.map +1 -0
- package/contracts/src/entities/index.d.ts +1 -0
- package/contracts/src/entities/index.js +1 -0
- package/contracts/src/entities/index.js.map +1 -1
- package/contracts/src/entities/report/index.d.ts +1 -1
- package/contracts/src/entities/report/index.js +1 -1
- package/contracts/src/entities/report/index.js.map +1 -1
- package/contracts/src/entities/report/report.entity.js +180 -12
- package/contracts/src/entities/report/report.entity.js.map +1 -1
- package/contracts/src/entities/report-category/index.d.ts +1 -1
- package/contracts/src/entities/report-category/index.js +0 -2
- package/contracts/src/entities/report-category/index.js.map +1 -1
- package/contracts/src/entities/report-category/report-category.entity.js +14 -1
- package/contracts/src/entities/report-category/report-category.entity.js.map +1 -1
- package/contracts/src/entities/report-generation-request/index.d.ts +1 -0
- package/contracts/src/entities/report-generation-request/index.js +5 -0
- package/contracts/src/entities/report-generation-request/index.js.map +1 -0
- package/contracts/src/entities/report-generation-request/report-generation-request.entity.d.ts +2 -0
- package/contracts/src/entities/report-generation-request/report-generation-request.entity.js +208 -0
- package/contracts/src/entities/report-generation-request/report-generation-request.entity.js.map +1 -0
- package/contracts/src/entity-catalog.d.ts +7 -0
- package/contracts/src/entity-catalog.js +22 -0
- package/contracts/src/entity-catalog.js.map +1 -0
- package/contracts/src/entity-entry.report-category.d.ts +1 -0
- package/contracts/src/entity-entry.report-category.js +6 -0
- package/contracts/src/entity-entry.report-category.js.map +1 -0
- package/contracts/src/entity-entry.report-generation-request.d.ts +1 -0
- package/contracts/src/entity-entry.report-generation-request.js +6 -0
- package/contracts/src/entity-entry.report-generation-request.js.map +1 -0
- package/contracts/src/entity-entry.report.d.ts +1 -0
- package/contracts/src/entity-entry.report.js +6 -0
- package/contracts/src/entity-entry.report.js.map +1 -0
- package/contracts/src/index.d.ts +18 -1
- package/contracts/src/index.js +18 -1
- package/contracts/src/index.js.map +1 -1
- package/contracts/src/manifest.d.ts +6 -0
- package/contracts/src/manifest.js +24 -0
- package/contracts/src/manifest.js.map +1 -0
- package/contracts/src/permission.keys.d.ts +30 -14
- package/contracts/src/permission.keys.js +28 -12
- package/contracts/src/permission.keys.js.map +1 -1
- package/contracts/src/query-cache-targets.d.ts +5 -0
- package/contracts/src/query-cache-targets.js +113 -0
- package/contracts/src/query-cache-targets.js.map +1 -0
- package/contracts/src/report-filter-form.util.d.ts +20 -0
- package/contracts/src/report-filter-form.util.js +121 -0
- package/contracts/src/report-filter-form.util.js.map +1 -0
- package/contracts/src/report-generation.types.d.ts +97 -0
- package/contracts/src/report-generation.types.js +14 -0
- package/contracts/src/report-generation.types.js.map +1 -0
- package/contracts/src/report-interchange.projection.d.ts +22 -0
- package/contracts/src/report-interchange.projection.js +171 -0
- package/contracts/src/report-interchange.projection.js.map +1 -0
- package/contracts/src/report-interchange.snapshot.d.ts +12 -0
- package/contracts/src/report-interchange.snapshot.js +34 -0
- package/contracts/src/report-interchange.snapshot.js.map +1 -0
- package/contracts/src/report-interchange.types.d.ts +38 -0
- package/contracts/src/report-interchange.types.js +4 -0
- package/contracts/src/report-interchange.types.js.map +1 -0
- package/contracts/src/report-layout-field-schema.d.ts +64 -0
- package/contracts/src/report-layout-field-schema.js +294 -0
- package/contracts/src/report-layout-field-schema.js.map +1 -0
- package/contracts/src/report-layout-form.util.d.ts +67 -0
- package/contracts/src/report-layout-form.util.js +578 -0
- package/contracts/src/report-layout-form.util.js.map +1 -0
- package/contracts/src/report-layout-json-sections.d.ts +15 -0
- package/contracts/src/report-layout-json-sections.js +38 -0
- package/contracts/src/report-layout-json-sections.js.map +1 -0
- package/contracts/src/report-layout-sections.mapper.d.ts +37 -0
- package/contracts/src/report-layout-sections.mapper.js +306 -0
- package/contracts/src/report-layout-sections.mapper.js.map +1 -0
- package/contracts/src/report-layout-starter.d.ts +15 -0
- package/contracts/src/report-layout-starter.js +93 -0
- package/contracts/src/report-layout-starter.js.map +1 -0
- package/contracts/src/report-layout.presets.d.ts +17 -0
- package/contracts/src/report-layout.presets.js +72 -0
- package/contracts/src/report-layout.presets.js.map +1 -0
- package/contracts/src/report-parameter-binding.util.d.ts +8 -0
- package/contracts/src/report-parameter-binding.util.js +29 -0
- package/contracts/src/report-parameter-binding.util.js.map +1 -0
- package/contracts/src/report.types.d.ts +125 -107
- package/contracts/src/report.types.js.map +1 -1
- package/contracts/src/root-config.d.ts +9 -2
- package/contracts/src/root-config.js +9 -2
- package/contracts/src/root-config.js.map +1 -1
- package/contracts/src/runtime.keys.d.ts +14 -0
- package/contracts/src/runtime.keys.js +20 -0
- package/contracts/src/runtime.keys.js.map +1 -0
- package/contracts/src/settings.keys.d.ts +11 -0
- package/contracts/src/settings.keys.js +17 -0
- package/contracts/src/settings.keys.js.map +1 -0
- package/package.json +9 -7
- package/server/src/index.d.ts +4 -4
- package/server/src/index.js +9 -8
- package/server/src/index.js.map +1 -1
- package/server/src/lib/entities/index.d.ts +1 -0
- package/server/src/lib/entities/index.js +5 -0
- package/server/src/lib/entities/index.js.map +1 -0
- package/server/src/lib/entities/report-management.entity-catalog.d.ts +1 -0
- package/server/src/lib/entities/report-management.entity-catalog.js +12 -0
- package/server/src/lib/entities/report-management.entity-catalog.js.map +1 -0
- package/server/src/lib/interchange/report-interchange-definition.service.d.ts +18 -0
- package/server/src/lib/interchange/report-interchange-definition.service.js +94 -0
- package/server/src/lib/interchange/report-interchange-definition.service.js.map +1 -0
- package/server/src/lib/interchange/report-interchange-export-data-source.d.ts +16 -0
- package/server/src/lib/interchange/report-interchange-export-data-source.js +72 -0
- package/server/src/lib/interchange/report-interchange-export-data-source.js.map +1 -0
- package/server/src/lib/interchange/report-interchange-export-query.util.d.ts +10 -0
- package/server/src/lib/interchange/report-interchange-export-query.util.js +22 -0
- package/server/src/lib/interchange/report-interchange-export-query.util.js.map +1 -0
- package/server/src/lib/interchange/report-interchange-export.command.d.ts +31 -0
- package/server/src/lib/interchange/report-interchange-export.command.js +268 -0
- package/server/src/lib/interchange/report-interchange-export.command.js.map +1 -0
- package/server/src/lib/report-browse.service.js +32 -13
- package/server/src/lib/report-browse.service.js.map +1 -1
- package/server/src/lib/report-browse.types.d.ts +27 -12
- package/server/src/lib/report-browse.types.js +0 -1
- package/server/src/lib/report-browse.types.js.map +1 -1
- package/server/src/lib/report-definition.seed-provider.d.ts +15 -0
- package/server/src/lib/report-definition.seed-provider.js +63 -0
- package/server/src/lib/report-definition.seed-provider.js.map +1 -0
- package/server/src/lib/report-generation/report-generation-create.command.d.ts +17 -0
- package/server/src/lib/report-generation/report-generation-create.command.js +177 -0
- package/server/src/lib/report-generation/report-generation-create.command.js.map +1 -0
- package/server/src/lib/report-generation/report-generation-enqueue.service.d.ts +21 -0
- package/server/src/lib/report-generation/report-generation-enqueue.service.js +58 -0
- package/server/src/lib/report-generation/report-generation-enqueue.service.js.map +1 -0
- package/server/src/lib/report-generation/report-generation-execute.command.d.ts +10 -0
- package/server/src/lib/report-generation/report-generation-execute.command.js +49 -0
- package/server/src/lib/report-generation/report-generation-execute.command.js.map +1 -0
- package/server/src/lib/report-generation/report-generation-execute.service.d.ts +23 -0
- package/server/src/lib/report-generation/report-generation-execute.service.js +226 -0
- package/server/src/lib/report-generation/report-generation-execute.service.js.map +1 -0
- package/server/src/lib/report-generation/report-generation-job-presentation.util.d.ts +8 -0
- package/server/src/lib/report-generation/report-generation-job-presentation.util.js +43 -0
- package/server/src/lib/report-generation/report-generation-job-presentation.util.js.map +1 -0
- package/server/src/lib/report-generation/report-generation-notify.service.d.ts +23 -0
- package/server/src/lib/report-generation/report-generation-notify.service.js +159 -0
- package/server/src/lib/report-generation/report-generation-notify.service.js.map +1 -0
- package/server/src/lib/report-generation/report-generation-policy.util.d.ts +39 -0
- package/server/src/lib/report-generation/report-generation-policy.util.js +95 -0
- package/server/src/lib/report-generation/report-generation-policy.util.js.map +1 -0
- package/server/src/lib/report-generation/report-generation-progress.util.d.ts +14 -0
- package/server/src/lib/report-generation/report-generation-progress.util.js +51 -0
- package/server/src/lib/report-generation/report-generation-progress.util.js.map +1 -0
- package/server/src/lib/report-generation/report-generation-release-inline-watch.command.d.ts +10 -0
- package/server/src/lib/report-generation/report-generation-release-inline-watch.command.js +55 -0
- package/server/src/lib/report-generation/report-generation-release-inline-watch.command.js.map +1 -0
- package/server/src/lib/report-generation/report-generation-runtime.handlers.d.ts +27 -0
- package/server/src/lib/report-generation/report-generation-runtime.handlers.js +136 -0
- package/server/src/lib/report-generation/report-generation-runtime.handlers.js.map +1 -0
- package/server/src/lib/report-generation/report-generation-settings.service.d.ts +12 -0
- package/server/src/lib/report-generation/report-generation-settings.service.js +49 -0
- package/server/src/lib/report-generation/report-generation-settings.service.js.map +1 -0
- package/server/src/lib/report-generation/report-generation.constants.d.ts +16 -0
- package/server/src/lib/report-generation/report-generation.constants.js +24 -0
- package/server/src/lib/report-generation/report-generation.constants.js.map +1 -0
- package/server/src/lib/report-generation/report-generation.store.d.ts +25 -0
- package/server/src/lib/report-generation/report-generation.store.js +145 -0
- package/server/src/lib/report-generation/report-generation.store.js.map +1 -0
- package/server/src/lib/report-generation/report-generation.util.d.ts +8 -0
- package/server/src/lib/report-generation/report-generation.util.js +131 -0
- package/server/src/lib/report-generation/report-generation.util.js.map +1 -0
- package/server/src/lib/report-management-runtime.handlers.d.ts +32 -0
- package/server/src/lib/report-management-runtime.handlers.js +78 -0
- package/server/src/lib/report-management-runtime.handlers.js.map +1 -0
- package/server/src/lib/report-management-server.module.js +55 -9
- package/server/src/lib/report-management-server.module.js.map +1 -1
- package/server/src/lib/report-management.controller.d.ts +1 -4
- package/server/src/lib/report-management.controller.js +2 -16
- package/server/src/lib/report-management.controller.js.map +1 -1
- package/server/src/lib/seed/index.d.ts +0 -19
- package/server/src/lib/seed/index.js +0 -21
- package/server/src/lib/seed/index.js.map +0 -1
- package/server/src/lib/seed/report-management-seed.provider.d.ts +0 -4
- package/server/src/lib/seed/report-management-seed.provider.js +0 -18
- package/server/src/lib/seed/report-management-seed.provider.js.map +0 -1
- package/server/src/lib/seed/report-management-seed.tokens.d.ts +0 -1
- package/server/src/lib/seed/report-management-seed.tokens.js +0 -7
- package/server/src/lib/seed/report-management-seed.tokens.js.map +0 -1
- package/server/src/lib/seed/report-management.seed-catalog.d.ts +0 -2
- package/server/src/lib/seed/report-management.seed-catalog.js +0 -10
- package/server/src/lib/seed/report-management.seed-catalog.js.map +0 -1
- package/server/src/lib/seed/samples/employee-report.mock.d.ts +0 -9
- package/server/src/lib/seed/samples/employee-report.mock.js +0 -322
- package/server/src/lib/seed/samples/employee-report.mock.js.map +0 -1
- package/server/src/lib/seed/samples/index.d.ts +0 -2
- package/server/src/lib/seed/samples/index.js +0 -6
- package/server/src/lib/seed/samples/index.js.map +0 -1
- package/server/src/lib/seed/samples/location-report.mock.d.ts +0 -9
- package/server/src/lib/seed/samples/location-report.mock.js +0 -339
- package/server/src/lib/seed/samples/location-report.mock.js.map +0 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { AXPReportLayoutPreset } from './report-layout.presets';
|
|
2
|
+
import type { AXPReportLayoutDefinition } from './report.types';
|
|
3
|
+
/** One stored JSON object on a report layout, shown as its own field. */
|
|
4
|
+
export interface ReportLayoutJsonSection {
|
|
5
|
+
name: 'layout' | 'dataSource' | 'actions' | 'export';
|
|
6
|
+
labelKey: 'layout' | 'data-source' | 'actions' | 'export';
|
|
7
|
+
value: unknown;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The definition stores each view as JSON objects, not as the few switches on the page.
|
|
11
|
+
* Returns only the objects that are actually present on the matching layout.
|
|
12
|
+
*/
|
|
13
|
+
export declare function reportLayoutJsonSections(report: {
|
|
14
|
+
layouts?: AXPReportLayoutDefinition[];
|
|
15
|
+
} | null | undefined, preset: AXPReportLayoutPreset): ReportLayoutJsonSection[];
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.reportLayoutJsonSections = reportLayoutJsonSections;
|
|
4
|
+
const report_layout_form_util_1 = require("./report-layout-form.util");
|
|
5
|
+
/**
|
|
6
|
+
* The definition stores each view as JSON objects, not as the few switches on the page.
|
|
7
|
+
* Returns only the objects that are actually present on the matching layout.
|
|
8
|
+
*/
|
|
9
|
+
function reportLayoutJsonSections(report, preset) {
|
|
10
|
+
var _a;
|
|
11
|
+
const current = ((_a = report === null || report === void 0 ? void 0 : report.layouts) !== null && _a !== void 0 ? _a : []).find((layout) => (0, report_layout_form_util_1.layoutMatchesPreset)(layout, preset));
|
|
12
|
+
if (!current) {
|
|
13
|
+
return [];
|
|
14
|
+
}
|
|
15
|
+
const sections = [];
|
|
16
|
+
pushSection(sections, 'layout', 'layout', current.layout);
|
|
17
|
+
pushSection(sections, 'dataSource', 'data-source', current.dataSource);
|
|
18
|
+
pushSection(sections, 'actions', 'actions', current.actions);
|
|
19
|
+
pushSection(sections, 'export', 'export', current.export);
|
|
20
|
+
return sections;
|
|
21
|
+
}
|
|
22
|
+
function pushSection(sections, name, labelKey, value) {
|
|
23
|
+
if (!hasJsonContent(value)) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
sections.push({ name, labelKey, value });
|
|
27
|
+
}
|
|
28
|
+
function hasJsonContent(value) {
|
|
29
|
+
if (Array.isArray(value)) {
|
|
30
|
+
return value.length > 0;
|
|
31
|
+
}
|
|
32
|
+
if (value != null && typeof value === 'object') {
|
|
33
|
+
return Object.keys(value).length > 0;
|
|
34
|
+
}
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
//# sourceMappingURL=report-layout-json-sections.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report-layout-json-sections.js","sourceRoot":"","sources":["../../../../../libs/modules/report-management/contracts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IAAI,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC/C,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;IACvC,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,YAAY"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type ReportLayoutFieldSchema } from './report-layout-field-schema';
|
|
2
|
+
import { reportLayoutJsonSections } from './report-layout-json-sections';
|
|
3
|
+
import type { AXPReportLayoutPreset } from './report-layout.presets';
|
|
4
|
+
import type { AXPReportLayoutDefinition } from './report.types';
|
|
5
|
+
/** The stored objects of one view, keyed by section name. This is what the page edits. */
|
|
6
|
+
export type ReportLayoutSectionsModel = Record<string, unknown>;
|
|
7
|
+
/**
|
|
8
|
+
* Copies the stored objects of one view for the editing page.
|
|
9
|
+
* The widgets write into this copy, so the loaded report definition is never touched.
|
|
10
|
+
* A view that is not stored yet starts from the keys it needs, so it can be defined from scratch.
|
|
11
|
+
*/
|
|
12
|
+
export declare function readReportLayoutSections(report: Parameters<typeof reportLayoutJsonSections>[0], preset: AXPReportLayoutPreset): ReportLayoutSectionsModel;
|
|
13
|
+
/**
|
|
14
|
+
* Maps every report filter to the field of the view's query that has the same name.
|
|
15
|
+
* Filters the view already maps are left as they are, so a choice made on the page always wins.
|
|
16
|
+
* Returns the given sections untouched when the view has no query or nothing needs mapping.
|
|
17
|
+
*/
|
|
18
|
+
export declare function autoMapReportLayoutInputs(sections: ReportLayoutSectionsModel, parameterKeys: readonly string[], columns: readonly string[]): ReportLayoutSectionsModel;
|
|
19
|
+
/**
|
|
20
|
+
* Editors for one view: every stored property, plus the keys the view needs that are not stored yet.
|
|
21
|
+
* The page and the cleaning below must use the same schema.
|
|
22
|
+
*/
|
|
23
|
+
export declare function reportLayoutFieldSchema(baseline: ReportLayoutSectionsModel, preset?: AXPReportLayoutPreset): ReportLayoutFieldSchema[];
|
|
24
|
+
/**
|
|
25
|
+
* Turns edited section values back into the shape the server stores.
|
|
26
|
+
* Only the properties the page can edit are normalised; every other stored key travels through as it was.
|
|
27
|
+
* `baseline` is the section copy the page started from. It decides which properties are editable.
|
|
28
|
+
*/
|
|
29
|
+
export declare function cleanReportLayoutSections(baseline: ReportLayoutSectionsModel, edited: ReportLayoutSectionsModel | null | undefined, preset?: AXPReportLayoutPreset): ReportLayoutSectionsModel;
|
|
30
|
+
/** True when the edited sections differ from the baseline once both are normalised. */
|
|
31
|
+
export declare function reportLayoutSectionsChanged(baseline: ReportLayoutSectionsModel, edited: ReportLayoutSectionsModel | null | undefined, preset?: AXPReportLayoutPreset): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Writes the edited sections onto the layout of this preset.
|
|
34
|
+
* A section is written when the view already stored it or the user entered something in it.
|
|
35
|
+
* The layout `type` and chart type stay the ones the tab stands for.
|
|
36
|
+
*/
|
|
37
|
+
export declare function applyReportLayoutSections(layouts: AXPReportLayoutDefinition[], preset: AXPReportLayoutPreset, baseline: ReportLayoutSectionsModel, edited: ReportLayoutSectionsModel | null | undefined): AXPReportLayoutDefinition[];
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readReportLayoutSections = readReportLayoutSections;
|
|
4
|
+
exports.autoMapReportLayoutInputs = autoMapReportLayoutInputs;
|
|
5
|
+
exports.reportLayoutFieldSchema = reportLayoutFieldSchema;
|
|
6
|
+
exports.cleanReportLayoutSections = cleanReportLayoutSections;
|
|
7
|
+
exports.reportLayoutSectionsChanged = reportLayoutSectionsChanged;
|
|
8
|
+
exports.applyReportLayoutSections = applyReportLayoutSections;
|
|
9
|
+
const report_layout_form_util_1 = require("./report-layout-form.util");
|
|
10
|
+
const report_layout_field_schema_1 = require("./report-layout-field-schema");
|
|
11
|
+
const report_layout_json_sections_1 = require("./report-layout-json-sections");
|
|
12
|
+
const report_layout_starter_1 = require("./report-layout-starter");
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region ---- Server to UI ----
|
|
15
|
+
/**
|
|
16
|
+
* Copies the stored objects of one view for the editing page.
|
|
17
|
+
* The widgets write into this copy, so the loaded report definition is never touched.
|
|
18
|
+
* A view that is not stored yet starts from the keys it needs, so it can be defined from scratch.
|
|
19
|
+
*/
|
|
20
|
+
function readReportLayoutSections(report, preset) {
|
|
21
|
+
const sections = {};
|
|
22
|
+
for (const section of (0, report_layout_json_sections_1.reportLayoutJsonSections)(report, preset)) {
|
|
23
|
+
sections[section.name] = cloneStoredJson(section.value);
|
|
24
|
+
}
|
|
25
|
+
return Object.keys(sections).length > 0 ? sections : (0, report_layout_starter_1.reportLayoutStarterValues)(preset);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Maps every report filter to the field of the view's query that has the same name.
|
|
29
|
+
* Filters the view already maps are left as they are, so a choice made on the page always wins.
|
|
30
|
+
* Returns the given sections untouched when the view has no query or nothing needs mapping.
|
|
31
|
+
*/
|
|
32
|
+
function autoMapReportLayoutInputs(sections, parameterKeys, columns) {
|
|
33
|
+
const dataSource = sections['dataSource'];
|
|
34
|
+
if (!isRecord(dataSource) || (0, report_layout_field_schema_1.reportLayoutQueryName)(sections) === '') {
|
|
35
|
+
return sections;
|
|
36
|
+
}
|
|
37
|
+
const stored = Array.isArray(dataSource['inputs']) ? dataSource['inputs'] : [];
|
|
38
|
+
const mapped = new Set(stored.filter(isRecord).map((row) => row['parameterKey']));
|
|
39
|
+
const available = new Set(columns);
|
|
40
|
+
const added = [...new Set(parameterKeys)]
|
|
41
|
+
.filter((key) => key !== '' && available.has(key) && !mapped.has(key))
|
|
42
|
+
.map((key) => ({ parameterKey: key, bindTo: key }));
|
|
43
|
+
if (added.length === 0) {
|
|
44
|
+
return sections;
|
|
45
|
+
}
|
|
46
|
+
return Object.assign(Object.assign({}, sections), { dataSource: Object.assign(Object.assign({}, dataSource), { inputs: [...stored, ...added] }) });
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Editors for one view: every stored property, plus the keys the view needs that are not stored yet.
|
|
50
|
+
* The page and the cleaning below must use the same schema.
|
|
51
|
+
*/
|
|
52
|
+
function reportLayoutFieldSchema(baseline, preset) {
|
|
53
|
+
return (0, report_layout_field_schema_1.inferReportLayoutFields)(preset ? addMissingKeys(baseline, (0, report_layout_starter_1.reportLayoutStarterShape)(preset)) : baseline);
|
|
54
|
+
}
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region ---- UI to server ----
|
|
57
|
+
/**
|
|
58
|
+
* Turns edited section values back into the shape the server stores.
|
|
59
|
+
* Only the properties the page can edit are normalised; every other stored key travels through as it was.
|
|
60
|
+
* `baseline` is the section copy the page started from. It decides which properties are editable.
|
|
61
|
+
*/
|
|
62
|
+
function cleanReportLayoutSections(baseline, edited, preset) {
|
|
63
|
+
const result = cloneStoredJson(edited !== null && edited !== void 0 ? edited : {});
|
|
64
|
+
for (const field of reportLayoutFieldSchema(baseline, preset)) {
|
|
65
|
+
cleanField(result, field);
|
|
66
|
+
}
|
|
67
|
+
return result;
|
|
68
|
+
}
|
|
69
|
+
/** True when the edited sections differ from the baseline once both are normalised. */
|
|
70
|
+
function reportLayoutSectionsChanged(baseline, edited, preset) {
|
|
71
|
+
return !sameJson(cleanReportLayoutSections(baseline, baseline, preset), cleanReportLayoutSections(baseline, edited, preset));
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Writes the edited sections onto the layout of this preset.
|
|
75
|
+
* A section is written when the view already stored it or the user entered something in it.
|
|
76
|
+
* The layout `type` and chart type stay the ones the tab stands for.
|
|
77
|
+
*/
|
|
78
|
+
function applyReportLayoutSections(layouts, preset, baseline, edited) {
|
|
79
|
+
const cleaned = cleanReportLayoutSections(baseline, edited, preset);
|
|
80
|
+
return layouts.map((layout) => {
|
|
81
|
+
if (!(0, report_layout_form_util_1.layoutMatchesPreset)(layout, preset)) {
|
|
82
|
+
return layout;
|
|
83
|
+
}
|
|
84
|
+
const next = Object.assign({}, layout);
|
|
85
|
+
if (isRecord(cleaned['layout'])) {
|
|
86
|
+
next.layout = fixedLayout(cleaned['layout'], layout, preset);
|
|
87
|
+
}
|
|
88
|
+
if (shouldWrite(baseline, cleaned, 'dataSource')) {
|
|
89
|
+
assignOrRemove(next, 'dataSource', usableDataSource(cleaned['dataSource']));
|
|
90
|
+
}
|
|
91
|
+
if (shouldWrite(baseline, cleaned, 'actions')) {
|
|
92
|
+
assignOrRemove(next, 'actions', cleaned['actions']);
|
|
93
|
+
}
|
|
94
|
+
if (shouldWrite(baseline, cleaned, 'export')) {
|
|
95
|
+
assignOrRemove(next, 'export', cleaned['export']);
|
|
96
|
+
}
|
|
97
|
+
return next;
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
function shouldWrite(baseline, cleaned, name) {
|
|
101
|
+
return name in baseline || hasContent(cleaned[name]);
|
|
102
|
+
}
|
|
103
|
+
/** The tab decides the layout type and chart type, so editing the sections cannot move the view elsewhere. */
|
|
104
|
+
function fixedLayout(edited, stored, preset) {
|
|
105
|
+
var _a;
|
|
106
|
+
const layout = Object.assign(Object.assign({}, edited), { type: stored.layout.type });
|
|
107
|
+
if (preset.layoutType === 'chart') {
|
|
108
|
+
layout['options'] = Object.assign(Object.assign({}, (isRecord(layout['options']) ? layout['options'] : {})), { chartType: (_a = preset.chartType) !== null && _a !== void 0 ? _a : 'bar' });
|
|
109
|
+
}
|
|
110
|
+
return layout;
|
|
111
|
+
}
|
|
112
|
+
/** A query data source without a query name is not a data source yet. */
|
|
113
|
+
function usableDataSource(value) {
|
|
114
|
+
if (!isRecord(value)) {
|
|
115
|
+
return undefined;
|
|
116
|
+
}
|
|
117
|
+
if (value['type'] === 'query' && typeof value['name'] !== 'string') {
|
|
118
|
+
return undefined;
|
|
119
|
+
}
|
|
120
|
+
return value;
|
|
121
|
+
}
|
|
122
|
+
//#endregion
|
|
123
|
+
//#region ---- Starter keys ----
|
|
124
|
+
/**
|
|
125
|
+
* Copy of the stored sections with the keys a view needs added where they are missing.
|
|
126
|
+
* Used for editor inference only. A record whose `type` differs from the starter's is left alone.
|
|
127
|
+
*/
|
|
128
|
+
function addMissingKeys(stored, shape) {
|
|
129
|
+
const result = cloneStoredJson(stored);
|
|
130
|
+
mergeShape(result, shape);
|
|
131
|
+
return result;
|
|
132
|
+
}
|
|
133
|
+
function mergeShape(target, shape) {
|
|
134
|
+
for (const [key, sample] of Object.entries(shape)) {
|
|
135
|
+
const current = target[key];
|
|
136
|
+
if (current == null) {
|
|
137
|
+
target[key] = cloneStoredJson(sample);
|
|
138
|
+
}
|
|
139
|
+
else if (isRecord(current) && isRecord(sample)) {
|
|
140
|
+
if (!hasOtherType(current, sample)) {
|
|
141
|
+
mergeShape(current, sample);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
else if (Array.isArray(current) && Array.isArray(sample)) {
|
|
145
|
+
mergeSampleItems(target, key, current, sample);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
function mergeSampleItems(target, key, current, sample) {
|
|
150
|
+
if (current.length === 0) {
|
|
151
|
+
target[key] = cloneStoredJson(sample);
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
if (current.every(isRecord) && sample.every(isRecord)) {
|
|
155
|
+
target[key] = [...current, ...cloneStoredJson(sample)];
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
function hasOtherType(current, sample) {
|
|
159
|
+
return typeof current['type'] === 'string' && typeof sample['type'] === 'string' && current['type'] !== sample['type'];
|
|
160
|
+
}
|
|
161
|
+
//#endregion
|
|
162
|
+
//#region ---- Field cleaning ----
|
|
163
|
+
function cleanField(container, field) {
|
|
164
|
+
const value = container[field.key];
|
|
165
|
+
switch (field.kind) {
|
|
166
|
+
case 'group':
|
|
167
|
+
cleanGroup(container, field, value);
|
|
168
|
+
return;
|
|
169
|
+
case 'list':
|
|
170
|
+
cleanList(container, field, value);
|
|
171
|
+
return;
|
|
172
|
+
case 'toggle':
|
|
173
|
+
assignOrDelete(container, field.key, typeof value === 'boolean' ? value : value == null ? undefined : Boolean(value));
|
|
174
|
+
return;
|
|
175
|
+
case 'number':
|
|
176
|
+
assignOrDelete(container, field.key, toNumber(value));
|
|
177
|
+
return;
|
|
178
|
+
case 'tags':
|
|
179
|
+
case 'column-list':
|
|
180
|
+
cleanTags(container, field.key, value);
|
|
181
|
+
return;
|
|
182
|
+
case 'locale-text':
|
|
183
|
+
cleanLocaleText(container, field.key, value);
|
|
184
|
+
return;
|
|
185
|
+
case 'json':
|
|
186
|
+
return;
|
|
187
|
+
default:
|
|
188
|
+
assignOrDelete(container, field.key, toText(value));
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
function cleanGroup(container, field, value) {
|
|
192
|
+
var _a;
|
|
193
|
+
if (!isRecord(value)) {
|
|
194
|
+
delete container[field.key];
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
for (const child of (_a = field.fields) !== null && _a !== void 0 ? _a : []) {
|
|
198
|
+
cleanField(value, child);
|
|
199
|
+
}
|
|
200
|
+
if (Object.keys(value).length === 0) {
|
|
201
|
+
delete container[field.key];
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
function cleanList(container, field, value) {
|
|
205
|
+
var _a;
|
|
206
|
+
if (!Array.isArray(value)) {
|
|
207
|
+
delete container[field.key];
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
const children = (_a = field.fields) !== null && _a !== void 0 ? _a : [];
|
|
211
|
+
const rowsHaveId = children.some((child) => child.key === 'id');
|
|
212
|
+
const rows = value.filter(isRecord);
|
|
213
|
+
for (const row of rows) {
|
|
214
|
+
for (const child of children) {
|
|
215
|
+
cleanField(row, child);
|
|
216
|
+
}
|
|
217
|
+
// The repeater stamps an `id` on every row it adds. Keep it only when the stored rows carry one.
|
|
218
|
+
if (!rowsHaveId) {
|
|
219
|
+
delete row['id'];
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
const kept = rows.filter((row) => Object.keys(row).length > 0);
|
|
223
|
+
assignOrDelete(container, field.key, kept.length > 0 ? kept : undefined);
|
|
224
|
+
}
|
|
225
|
+
function cleanTags(container, key, value) {
|
|
226
|
+
if (!Array.isArray(value)) {
|
|
227
|
+
delete container[key];
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
// A multi select may hand back its rows (`{ id }`). The server stores the bare values.
|
|
231
|
+
const bare = value.map((tag) => (isRecord(tag) && 'id' in tag ? tag['id'] : tag));
|
|
232
|
+
const tags = bare.filter((tag) => (typeof tag === 'string' ? tag.trim().length > 0 : tag != null));
|
|
233
|
+
assignOrDelete(container, key, tags.length > 0 ? tags : undefined);
|
|
234
|
+
}
|
|
235
|
+
function cleanLocaleText(container, key, value) {
|
|
236
|
+
if (isRecord(value)) {
|
|
237
|
+
const entries = Object.entries(value).filter(([, text]) => typeof text === 'string' && text.trim().length > 0);
|
|
238
|
+
assignOrDelete(container, key, entries.length > 0 ? Object.fromEntries(entries) : undefined);
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
assignOrDelete(container, key, toText(value));
|
|
242
|
+
}
|
|
243
|
+
//#endregion
|
|
244
|
+
//#region ---- Value helpers ----
|
|
245
|
+
/** A select widget may hand back its row (`{ id }`). The server stores the bare value. */
|
|
246
|
+
function toText(value) {
|
|
247
|
+
const raw = isRecord(value) && 'id' in value ? value['id'] : value;
|
|
248
|
+
if (raw == null) {
|
|
249
|
+
return undefined;
|
|
250
|
+
}
|
|
251
|
+
const text = typeof raw === 'string' ? raw : typeof raw === 'number' ? String(raw) : undefined;
|
|
252
|
+
return text != null && text.trim().length > 0 ? text : undefined;
|
|
253
|
+
}
|
|
254
|
+
function toNumber(value) {
|
|
255
|
+
if (typeof value === 'number') {
|
|
256
|
+
return Number.isFinite(value) ? value : undefined;
|
|
257
|
+
}
|
|
258
|
+
if (typeof value === 'string' && value.trim().length > 0) {
|
|
259
|
+
const parsed = Number(value);
|
|
260
|
+
return Number.isFinite(parsed) ? parsed : undefined;
|
|
261
|
+
}
|
|
262
|
+
return undefined;
|
|
263
|
+
}
|
|
264
|
+
function assignOrDelete(container, key, value) {
|
|
265
|
+
if (value === undefined) {
|
|
266
|
+
delete container[key];
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
container[key] = value;
|
|
270
|
+
}
|
|
271
|
+
function assignOrRemove(layout, key, value) {
|
|
272
|
+
if (hasContent(value)) {
|
|
273
|
+
layout[key] = value;
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
delete layout[key];
|
|
277
|
+
}
|
|
278
|
+
function hasContent(value) {
|
|
279
|
+
if (Array.isArray(value)) {
|
|
280
|
+
return value.length > 0;
|
|
281
|
+
}
|
|
282
|
+
return isRecord(value) && Object.keys(value).length > 0;
|
|
283
|
+
}
|
|
284
|
+
/** Report definitions are plain JSON, so a JSON round trip is a faithful deep copy. */
|
|
285
|
+
function cloneStoredJson(value) {
|
|
286
|
+
return value === undefined ? value : JSON.parse(JSON.stringify(value));
|
|
287
|
+
}
|
|
288
|
+
/** Deep equality for stored JSON. Key order does not matter, array order does. */
|
|
289
|
+
function sameJson(left, right) {
|
|
290
|
+
if (Array.isArray(left) || Array.isArray(right)) {
|
|
291
|
+
return (Array.isArray(left) &&
|
|
292
|
+
Array.isArray(right) &&
|
|
293
|
+
left.length === right.length &&
|
|
294
|
+
left.every((item, index) => sameJson(item, right[index])));
|
|
295
|
+
}
|
|
296
|
+
if (isRecord(left) && isRecord(right)) {
|
|
297
|
+
const keys = new Set([...Object.keys(left), ...Object.keys(right)]);
|
|
298
|
+
return [...keys].every((key) => sameJson(left[key], right[key]));
|
|
299
|
+
}
|
|
300
|
+
return left === right;
|
|
301
|
+
}
|
|
302
|
+
function isRecord(value) {
|
|
303
|
+
return value != null && typeof value === 'object' && !Array.isArray(value);
|
|
304
|
+
}
|
|
305
|
+
//#endregion
|
|
306
|
+
//# sourceMappingURL=report-layout-sections.mapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report-layout-sections.mapper.js","sourceRoot":"","sources":["../../../../../libs/modules/report-management/contracts/src/report-layout-sections.mapper.ts"],"names":[],"mappings":";;AAqBA,4DASC;AAOD,8DAmBC;AAMD,0DAKC;AAWD,8DAUC;AAGD,kEASC;AAOD,8DA0BC;AArID,uEAAgE;AAChE,6EAA4H;AAC5H,+EAAyE;AACzE,mEAA8F;AAS9F,YAAY;AAEZ,gCAAgC;AAEhC;;;;GAIG;AACH,SAAgB,wBAAwB,CACtC,MAAsD,EACtD,MAA6B;IAE7B,MAAM,QAAQ,GAA8B,EAAE,CAAC;IAC/C,KAAK,MAAM,OAAO,IAAI,IAAA,sDAAwB,EAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;QAC/D,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC1D,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAE,IAAA,iDAAyB,EAAC,MAAM,CAA+B,CAAC;AACxH,CAAC;AAED;;;;GAIG;AACH,SAAgB,yBAAyB,CACvC,QAAmC,EACnC,aAAgC,EAChC,OAA0B;IAE1B,MAAM,UAAU,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC;IAC1C,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,IAAA,kDAAqB,EAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC;QACpE,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAE,UAAU,CAAC,QAAQ,CAAe,CAAC,CAAC,CAAC,EAAE,CAAC;IAC9F,MAAM,MAAM,GAAG,IAAI,G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AC,CAAC,CAAC;IACnE,CAAC;IACD,OAAO,IAAI,KAAK,KAAK,CAAC;AACxB,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC7E,CAAC;AAED,YAAY"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { AXPReportLayoutPreset } from './report-layout.presets';
|
|
2
|
+
/** Stored objects of one view, keyed by section name. Same shape the layout page edits. */
|
|
3
|
+
type StarterSections = Record<string, unknown>;
|
|
4
|
+
/**
|
|
5
|
+
* The keys a view needs, with one sample value per key so the page can choose an editor for it.
|
|
6
|
+
* A list holds one sample row. The sample only gives the row its fields; it is never stored.
|
|
7
|
+
*/
|
|
8
|
+
export declare function reportLayoutStarterShape(preset: AXPReportLayoutPreset): StarterSections;
|
|
9
|
+
/**
|
|
10
|
+
* Values a view that is not stored yet starts with.
|
|
11
|
+
* Fixed keys (`type`, `chartType`) and switches that default to on are filled. Everything else is blank,
|
|
12
|
+
* lists are empty and `false` switches stay unset, so nothing is stored until the user enters it.
|
|
13
|
+
*/
|
|
14
|
+
export declare function reportLayoutStarterValues(preset: AXPReportLayoutPreset): StarterSections;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.reportLayoutStarterShape = reportLayoutStarterShape;
|
|
4
|
+
exports.reportLayoutStarterValues = reportLayoutStarterValues;
|
|
5
|
+
//#endregion
|
|
6
|
+
//#region ---- Starter shape ----
|
|
7
|
+
/** `inputs` maps report filters to fields of the query rows. It is one sample row, never stored as is. */
|
|
8
|
+
const QUERY_DATA_SOURCE = { type: 'query', name: '', description: '', inputs: [{ parameterKey: '', bindTo: '' }] };
|
|
9
|
+
const EXPORT_OPTIONS = {
|
|
10
|
+
fileNameTemplate: '',
|
|
11
|
+
pdf: { enabled: false },
|
|
12
|
+
excel: { enabled: false, sheetName: '' },
|
|
13
|
+
csv: { enabled: false },
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* The keys a view needs, with one sample value per key so the page can choose an editor for it.
|
|
17
|
+
* A list holds one sample row. The sample only gives the row its fields; it is never stored.
|
|
18
|
+
*/
|
|
19
|
+
function reportLayoutStarterShape(preset) {
|
|
20
|
+
var _a;
|
|
21
|
+
if (preset.layoutType === 'table') {
|
|
22
|
+
return {
|
|
23
|
+
layout: {
|
|
24
|
+
type: 'table',
|
|
25
|
+
columns: [{ field: '', title: '', visible: true, sortable: false, align: 'left' }],
|
|
26
|
+
options: { pagination: true, stickyHeader: true, stripedRows: true },
|
|
27
|
+
},
|
|
28
|
+
dataSource: Object.assign({}, QUERY_DATA_SOURCE),
|
|
29
|
+
export: cloneJson(EXPORT_OPTIONS),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
if (preset.layoutType === 'chart') {
|
|
33
|
+
return {
|
|
34
|
+
layout: {
|
|
35
|
+
type: 'chart',
|
|
36
|
+
options: {
|
|
37
|
+
chartType: (_a = preset.chartType) !== null && _a !== void 0 ? _a : 'bar',
|
|
38
|
+
dataMapping: { xField: '', yFields: [''], groupBy: '', seriesField: '', labelField: '' },
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
dataSource: Object.assign({}, QUERY_DATA_SOURCE),
|
|
42
|
+
export: cloneJson(EXPORT_OPTIONS),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
layout: {
|
|
47
|
+
type: 'pdf',
|
|
48
|
+
options: {
|
|
49
|
+
showDownloadButton: true,
|
|
50
|
+
showPrintButton: true,
|
|
51
|
+
showZoomControls: true,
|
|
52
|
+
showFullscreenButton: true,
|
|
53
|
+
defaultZoom: 100,
|
|
54
|
+
height: '',
|
|
55
|
+
},
|
|
56
|
+
header: { title: '', showDate: false },
|
|
57
|
+
footer: { showDate: false },
|
|
58
|
+
},
|
|
59
|
+
dataSource: Object.assign({}, QUERY_DATA_SOURCE),
|
|
60
|
+
export: cloneJson(EXPORT_OPTIONS),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region ---- Starter values ----
|
|
65
|
+
/**
|
|
66
|
+
* Values a view that is not stored yet starts with.
|
|
67
|
+
* Fixed keys (`type`, `chartType`) and switches that default to on are filled. Everything else is blank,
|
|
68
|
+
* lists are empty and `false` switches stay unset, so nothing is stored until the user enters it.
|
|
69
|
+
*/
|
|
70
|
+
function reportLayoutStarterValues(preset) {
|
|
71
|
+
return blankOut(reportLayoutStarterShape(preset));
|
|
72
|
+
}
|
|
73
|
+
function blankOut(value) {
|
|
74
|
+
if (Array.isArray(value)) {
|
|
75
|
+
return [];
|
|
76
|
+
}
|
|
77
|
+
if (value != null && typeof value === 'object') {
|
|
78
|
+
const result = {};
|
|
79
|
+
for (const [key, item] of Object.entries(value)) {
|
|
80
|
+
if (item === false) {
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
result[key] = blankOut(item);
|
|
84
|
+
}
|
|
85
|
+
return result;
|
|
86
|
+
}
|
|
87
|
+
return value;
|
|
88
|
+
}
|
|
89
|
+
function cloneJson(value) {
|
|
90
|
+
return JSON.parse(JSON.stringify(value));
|
|
91
|
+
}
|
|
92
|
+
//#endregion
|
|
93
|
+
//# sourceMappingURL=report-layout-starter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report-layout-starter.js","sourceRoot":"","sources":["../../../../../libs/modules/report-management/contracts/src/report-layout-starter.ts"],"names":[],"mappings":";;AAyBA,4DA0CC;AAWD,8DAEC;AAzED,YAAY;AAEZ,iCAAiC;AAEjC,0GAA0G;AAC1G,MAAM,iBAAiB,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,WAAW,EAAE,EAAE,E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AAS,SAAS,CAAI,KAAQ;IAC5B,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAM,CAAC;AAChD,CAAC;AAED,YAAY"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AXPReportChartOptions } from './report.types';
|
|
2
|
+
/**
|
|
3
|
+
* One viewer layout the definition page can turn on.
|
|
4
|
+
* Chart slots stay separate because the viewer tells them apart by chart type and icon.
|
|
5
|
+
*/
|
|
6
|
+
export interface AXPReportLayoutPreset {
|
|
7
|
+
key: 'table' | 'bar' | 'line' | 'doughnut' | 'pie' | 'pdf';
|
|
8
|
+
componentKey: string;
|
|
9
|
+
title: string;
|
|
10
|
+
description: string;
|
|
11
|
+
icon: string;
|
|
12
|
+
order: number;
|
|
13
|
+
layoutType: 'table' | 'chart' | 'pdf';
|
|
14
|
+
chartType?: AXPReportChartOptions['chartType'];
|
|
15
|
+
}
|
|
16
|
+
export declare const AXP_REPORT_LAYOUT_PRESETS: readonly AXPReportLayoutPreset[];
|
|
17
|
+
export declare function reportLayoutPresetByKey(key: string | undefined): AXPReportLayoutPreset | undefined;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AXP_REPORT_LAYOUT_PRESETS = void 0;
|
|
4
|
+
exports.reportLayoutPresetByKey = reportLayoutPresetByKey;
|
|
5
|
+
exports.AXP_REPORT_LAYOUT_PRESETS = [
|
|
6
|
+
{
|
|
7
|
+
key: 'table',
|
|
8
|
+
componentKey: 'report-definition-layout-table',
|
|
9
|
+
title: '@report-management:report-viewer.layouts.table.title',
|
|
10
|
+
description: '@report-management:reports.entities.report.layout-editor.page-description',
|
|
11
|
+
icon: 'fa-light fa-table',
|
|
12
|
+
order: 10,
|
|
13
|
+
layoutType: 'table',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
key: 'bar',
|
|
17
|
+
componentKey: 'report-definition-layout-bar',
|
|
18
|
+
title: '@report-management:report-viewer.layouts.bar-chart.title',
|
|
19
|
+
description: '@report-management:reports.entities.report.layout-editor.page-description',
|
|
20
|
+
icon: 'fa-light fa-chart-bar',
|
|
21
|
+
order: 20,
|
|
22
|
+
layoutType: 'chart',
|
|
23
|
+
chartType: 'bar',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
key: 'line',
|
|
27
|
+
componentKey: 'report-definition-layout-line',
|
|
28
|
+
title: '@report-management:report-viewer.layouts.line-chart.title',
|
|
29
|
+
description: '@report-management:reports.entities.report.layout-editor.page-description',
|
|
30
|
+
icon: 'fa-light fa-chart-line',
|
|
31
|
+
order: 30,
|
|
32
|
+
layoutType: 'chart',
|
|
33
|
+
chartType: 'line',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
key: 'doughnut',
|
|
37
|
+
componentKey: 'report-definition-layout-doughnut',
|
|
38
|
+
title: '@report-management:report-viewer.layouts.doughnut-chart.title',
|
|
39
|
+
description: '@report-management:reports.entities.report.layout-editor.page-description',
|
|
40
|
+
icon: 'fa-light fa-chart-pie',
|
|
41
|
+
order: 40,
|
|
42
|
+
layoutType: 'chart',
|
|
43
|
+
chartType: 'doughnut',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
key: 'pie',
|
|
47
|
+
componentKey: 'report-definition-layout-pie',
|
|
48
|
+
title: '@report-management:report-viewer.layouts.pie-chart.title',
|
|
49
|
+
description: '@report-management:reports.entities.report.layout-editor.page-description',
|
|
50
|
+
icon: 'fa-light fa-chart-pie',
|
|
51
|
+
order: 50,
|
|
52
|
+
layoutType: 'chart',
|
|
53
|
+
chartType: 'pie',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
key: 'pdf',
|
|
57
|
+
componentKey: 'report-definition-layout-pdf',
|
|
58
|
+
title: '@report-management:report-viewer.layouts.pdf.title',
|
|
59
|
+
description: '@report-management:reports.entities.report.layout-editor.page-description',
|
|
60
|
+
icon: 'fa-light fa-file-pdf',
|
|
61
|
+
order: 60,
|
|
62
|
+
layoutType: 'pdf',
|
|
63
|
+
},
|
|
64
|
+
];
|
|
65
|
+
function reportLayoutPresetByKey(key) {
|
|
66
|
+
if (!key) {
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
return exports.AXP_REPORT_LAYOUT_PRESETS.find((preset) => preset.key === key);
|
|
70
|
+
}
|
|
71
|
+
//#endregion
|
|
72
|
+
//# sourceMappingURL=report-layout.presets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report-layout.presets.js","sourceRoot":"","sources":["../../../../../libs/modules/report-management/contracts/src/report-layout.presets.ts"],"names":[],"mappings":";;;AAgFA,0DAKC;AAlEY,QAAA,yBAAyB,GAAqC;IACzE;QACE,GAAG,EAAE,OAAO;QACZ,YAAY,EAAE,gCAAgC;QAC9C,KAAK,EAAE,sDAAsD;QAC7D,WAAW,EAAE,2EAA2E;QACxF,IAAI,EAAE,mBAAmB;QACzB,KAAK,EAAE,EAAE;QACT,UAAU,EAAE,OAAO;KACpB;IACD;QACE,GAAG,EAAE,KAAK;QACV,YAAY,EAAE,8BAA8B;QAC5C,KAAK,EAAE,0DAA0D;QACjE,WAAW,EAAE,2EAA2E;QACxF,IAAI,EAAE,uBAAuB;QAC7B,KAAK,EAAE,EAAE;QACT,UAAU,EAAE,OAAO;QACnB,SAAS,EAAE,KAAK;KACjB;IACD;QACE,GAAG,EAAE,MAAM;QACX,YAAY,EAAE,+BAA+B;QAC7C,KAAK,EAAE,2DAA2D;QAClE,WAAW,EAAE,2EAA2E;QACxF,IAAI,EAAE,wBAAwB;QAC9B,KAAK,EAAE,EAAE;QACT,UAAU,EAAE,OAAO;QACnB,SAAS,EAAE,MAAM;KAClB;IACD;QACE,GAAG,EAAE,UAAU;QACf,YAAY,EAAE,mCAAmC;QACjD,KAAK,EAAE,+DAA+D;QACtE,WAAW,EAAE,2EAA2E;QACxF,IAAI,EAAE,uBAAuB;QAC7B,KAAK,EAAE,EAAE;QACT,UAAU,EAAE,OAAO;QACnB,SAAS,EAAE,UAAU;KACtB;IACD;QACE,GAAG,EAAE,KAAK;QACV,YAAY,EAAE,8BAA8B;QAC5C,KAAK,EAAE,0DAA0D;QACjE,WAAW,EAAE,2EAA2E;QACxF,IAAI,EAAE,uBAAuB;QAC7B,KAAK,EAAE,EAAE;QACT,UAAU,EAAE,OAAO;QACnB,SAAS,EAAE,KAAK;KACjB;IACD;QACE,GAAG,EAAE,KAAK;QACV,YAAY,EAAE,8BAA8B;QAC5C,KAAK,EAAE,oDAAoD;QAC3D,WAAW,EAAE,2EAA2E;QACxF,IAAI,EAAE,sBAAsB;QAC5B,KAAK,EAAE,EAAE;QACT,UAAU,EAAE,KAAK;KAClB;CACF,CAAC;AAEF,SAAgB,uBAAuB,CAAC,GAAuB;IAC7D,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,iCAAyB,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC;AACxE,CAAC;AAED,YAAY"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AXPFilterClause } from '@acorex-platform/framework-shared/core';
|
|
2
|
+
import type { AXPReportParameterBinding } from './report.types';
|
|
3
|
+
/**
|
|
4
|
+
* Applies the filter mapping of a view's data source to the conditions built from the report filters.
|
|
5
|
+
* A condition on a filter that the view maps to a query field runs on that field instead.
|
|
6
|
+
* Filters without a mapping keep their own name, which is the field of the query rows with the same name.
|
|
7
|
+
*/
|
|
8
|
+
export declare function applyReportParameterBindings(clause: AXPFilterClause, inputs: readonly AXPReportParameterBinding[] | null | undefined): AXPFilterClause;
|