@acorex/platform 21.0.0-next.72 → 21.0.0-next.74
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/README.md +3 -0
- package/fesm2022/acorex-platform-auth.mjs +72 -58
- package/fesm2022/acorex-platform-auth.mjs.map +1 -1
- package/fesm2022/acorex-platform-common.mjs +414 -22
- package/fesm2022/acorex-platform-common.mjs.map +1 -1
- package/fesm2022/acorex-platform-contracts.mjs +38 -0
- package/fesm2022/acorex-platform-contracts.mjs.map +1 -0
- package/fesm2022/acorex-platform-core.mjs +23 -14
- package/fesm2022/acorex-platform-core.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-builder.mjs +5 -4
- package/fesm2022/acorex-platform-layout-builder.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-components.mjs +187 -9
- package/fesm2022/acorex-platform-layout-components.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-entity.mjs +81 -114
- package/fesm2022/acorex-platform-layout-entity.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-views.mjs +2 -1
- package/fesm2022/acorex-platform-layout-views.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-widget-core.mjs +11 -1
- package/fesm2022/acorex-platform-layout-widget-core.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-widgets.mjs +418 -239
- package/fesm2022/acorex-platform-layout-widgets.mjs.map +1 -1
- package/fesm2022/acorex-platform-themes-default.mjs +4 -4
- package/fesm2022/acorex-platform-themes-default.mjs.map +1 -1
- package/fesm2022/acorex-platform-themes-shared-settings.provider-BjuzSe0T.mjs.map +1 -1
- package/fesm2022/acorex-platform-themes-shared.mjs +3 -0
- package/fesm2022/acorex-platform-themes-shared.mjs.map +1 -1
- package/fesm2022/acorex-platform-workflow.mjs +57 -68
- package/fesm2022/acorex-platform-workflow.mjs.map +1 -1
- package/package.json +5 -1
- package/types/acorex-platform-auth.d.ts +29 -22
- package/types/acorex-platform-common.d.ts +89 -262
- package/types/acorex-platform-contracts.d.ts +940 -0
- package/types/acorex-platform-core.d.ts +8 -8
- package/types/acorex-platform-layout-builder.d.ts +2 -5
- package/types/acorex-platform-layout-components.d.ts +77 -7
- package/types/acorex-platform-layout-entity.d.ts +185 -175
- package/types/acorex-platform-layout-widget-core.d.ts +4 -26
- package/types/acorex-platform-layout-widgets.d.ts +55 -52
- package/types/acorex-platform-workflow.d.ts +3 -670
|
@@ -44,6 +44,16 @@ import { AXTextBoxModule } from '@acorex/components/text-box';
|
|
|
44
44
|
import * as i1$1 from '@angular/forms';
|
|
45
45
|
import { FormsModule } from '@angular/forms';
|
|
46
46
|
|
|
47
|
+
//#region ---- Datasource keys ----
|
|
48
|
+
/** Platform common datasource registry names. */
|
|
49
|
+
const AXPPlatformCommonDataSourceKeys = {
|
|
50
|
+
MenuItems: 'platform-menu-items',
|
|
51
|
+
};
|
|
52
|
+
//#endregion
|
|
53
|
+
|
|
54
|
+
//#region ---- Contracts barrel ----
|
|
55
|
+
//#endregion
|
|
56
|
+
|
|
47
57
|
//#region ---- Output kind & segment ----
|
|
48
58
|
/** Default structured retry count when `structuredRetries` is omitted on structured kinds. */
|
|
49
59
|
const AXP_AGENT_OUTPUT_CONTRACT_DEFAULT_STRUCTURED_RETRIES = 2;
|
|
@@ -2989,15 +2999,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
2989
2999
|
type: Injectable
|
|
2990
3000
|
}] });
|
|
2991
3001
|
|
|
2992
|
-
var AXPFileStorageStatus;
|
|
2993
|
-
(function (AXPFileStorageStatus) {
|
|
2994
|
-
AXPFileStorageStatus["Temporary"] = "temporary";
|
|
2995
|
-
AXPFileStorageStatus["Committed"] = "committed";
|
|
2996
|
-
AXPFileStorageStatus["PendingDeletion"] = "pendingDeletion";
|
|
2997
|
-
AXPFileStorageStatus["Archived"] = "archived";
|
|
2998
|
-
AXPFileStorageStatus["Error"] = "error";
|
|
2999
|
-
})(AXPFileStorageStatus || (AXPFileStorageStatus = {}));
|
|
3000
|
-
|
|
3001
3002
|
class AXPFileStorageEvaluatorScopeProvider {
|
|
3002
3003
|
constructor() {
|
|
3003
3004
|
this.fileStorageService = inject(AXPFileStorageService);
|
|
@@ -4121,10 +4122,6 @@ function flattenMenuItems(items, depth) {
|
|
|
4121
4122
|
}
|
|
4122
4123
|
//#endregion
|
|
4123
4124
|
//#region ---- Menu items data source ----
|
|
4124
|
-
/**
|
|
4125
|
-
* Registered menu items (raw tree flattened) for select widgets via dataSource name {@link MENU_ITEMS_DATASOURCE_NAME}.
|
|
4126
|
-
*/
|
|
4127
|
-
const MENU_ITEMS_DATASOURCE_NAME = 'platform-menu-items';
|
|
4128
4125
|
/**
|
|
4129
4126
|
* Data source definition for menu items from {@link AXPMenuProviderService#rawItems}.
|
|
4130
4127
|
*/
|
|
@@ -4139,7 +4136,7 @@ class AXPMenuItemsDataSourceDefinition {
|
|
|
4139
4136
|
async items() {
|
|
4140
4137
|
return [
|
|
4141
4138
|
{
|
|
4142
|
-
name:
|
|
4139
|
+
name: AXPPlatformCommonDataSourceKeys.MenuItems,
|
|
4143
4140
|
title: 'Menu items',
|
|
4144
4141
|
source: () => new AXDataSource({
|
|
4145
4142
|
key: 'id',
|
|
@@ -5347,6 +5344,133 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
5347
5344
|
args: [{ providedIn: 'root' }]
|
|
5348
5345
|
}] });
|
|
5349
5346
|
|
|
5347
|
+
//#region ---- Imports ----
|
|
5348
|
+
//#endregion
|
|
5349
|
+
//#region ---- Constants ----
|
|
5350
|
+
const INVALID_DISPLAY_TEXT = '[object Object]';
|
|
5351
|
+
const DEFAULT_ROW_TITLE_FALLBACK_PATHS = ['title', 'name', 'code'];
|
|
5352
|
+
/** Row path used when context carries a nested entity layout title. */
|
|
5353
|
+
const ENTITY_LAYOUT_SINGLE_TITLE_PATH = 'entity.layout.single.title';
|
|
5354
|
+
/** Widget option for a pre-evaluated or template entity row title (entity list column mappers). */
|
|
5355
|
+
const ENTITY_ROW_POPUP_TITLE_OPTION = 'popupTitle';
|
|
5356
|
+
/** Widget option alias for entity row title templates in view/edit forms. */
|
|
5357
|
+
const ENTITY_ROW_TITLE_TEMPLATE_OPTION = 'titleTemplate';
|
|
5358
|
+
//#endregion
|
|
5359
|
+
//#region ---- Value normalization ----
|
|
5360
|
+
/** Resolves a row field or format result to a plain display string for the active locale. */
|
|
5361
|
+
function resolveEntityRowDisplayText(value, activeLang) {
|
|
5362
|
+
if (value == null || value === '') {
|
|
5363
|
+
return '';
|
|
5364
|
+
}
|
|
5365
|
+
if (typeof value === 'string') {
|
|
5366
|
+
const text = value.trim();
|
|
5367
|
+
if (!text || text === INVALID_DISPLAY_TEXT || isUnresolvedEntityDisplayTemplate(text)) {
|
|
5368
|
+
return '';
|
|
5369
|
+
}
|
|
5370
|
+
return text;
|
|
5371
|
+
}
|
|
5372
|
+
if (typeof value === 'number' || typeof value === 'boolean') {
|
|
5373
|
+
return String(value);
|
|
5374
|
+
}
|
|
5375
|
+
if (typeof value === 'object' && !Array.isArray(value)) {
|
|
5376
|
+
const text = resolveMultiLanguageString(value, activeLang).trim();
|
|
5377
|
+
if (!text || text === INVALID_DISPLAY_TEXT || isUnresolvedEntityDisplayTemplate(text)) {
|
|
5378
|
+
return '';
|
|
5379
|
+
}
|
|
5380
|
+
return text;
|
|
5381
|
+
}
|
|
5382
|
+
return '';
|
|
5383
|
+
}
|
|
5384
|
+
//#endregion
|
|
5385
|
+
//#region ---- Row title resolution ----
|
|
5386
|
+
function readTitleTemplateFromWidgetOptions(widgetOptions) {
|
|
5387
|
+
if (!widgetOptions) {
|
|
5388
|
+
return undefined;
|
|
5389
|
+
}
|
|
5390
|
+
return widgetOptions[ENTITY_ROW_POPUP_TITLE_OPTION] ?? widgetOptions[ENTITY_ROW_TITLE_TEMPLATE_OPTION];
|
|
5391
|
+
}
|
|
5392
|
+
function resolveEntityRowDisplayTitleFromContext(data, widgetOptions, formatService, activeLang) {
|
|
5393
|
+
const titleTemplate = readTitleTemplateFromWidgetOptions(widgetOptions);
|
|
5394
|
+
const fromTemplateValue = resolveEntityRowDisplayText(titleTemplate, activeLang);
|
|
5395
|
+
if (fromTemplateValue) {
|
|
5396
|
+
return fromTemplateValue;
|
|
5397
|
+
}
|
|
5398
|
+
const fromEntityLayout = resolveEntityRowDisplayText(get(data, ENTITY_LAYOUT_SINGLE_TITLE_PATH), activeLang);
|
|
5399
|
+
if (fromEntityLayout) {
|
|
5400
|
+
return fromEntityLayout;
|
|
5401
|
+
}
|
|
5402
|
+
if (typeof titleTemplate === 'string' && titleTemplate.trim()) {
|
|
5403
|
+
const formatted = formatService.format(normalizeEntityDisplayTemplate(titleTemplate), 'string', data);
|
|
5404
|
+
const fromFormattedTemplate = resolveEntityRowDisplayText(formatted, activeLang);
|
|
5405
|
+
if (fromFormattedTemplate) {
|
|
5406
|
+
return fromFormattedTemplate;
|
|
5407
|
+
}
|
|
5408
|
+
}
|
|
5409
|
+
for (const path of DEFAULT_ROW_TITLE_FALLBACK_PATHS) {
|
|
5410
|
+
const fromField = resolveEntityRowDisplayText(get(data, path), activeLang);
|
|
5411
|
+
if (fromField) {
|
|
5412
|
+
return fromField;
|
|
5413
|
+
}
|
|
5414
|
+
}
|
|
5415
|
+
return '';
|
|
5416
|
+
}
|
|
5417
|
+
/**
|
|
5418
|
+
* Resolves an entity row title for list columns, view widgets, and edit widgets.
|
|
5419
|
+
* Uses entity metadata when provided, otherwise widget title templates and common field paths.
|
|
5420
|
+
*/
|
|
5421
|
+
function resolveEntityRowDisplayTitle(options) {
|
|
5422
|
+
const { data, activeLang, formatService, entity, widgetOptions } = options;
|
|
5423
|
+
if (!data) {
|
|
5424
|
+
return '';
|
|
5425
|
+
}
|
|
5426
|
+
if (entity) {
|
|
5427
|
+
const fromEntity = formatEntityRowDisplayTitle(entity, data, formatService, activeLang);
|
|
5428
|
+
if (fromEntity) {
|
|
5429
|
+
return fromEntity;
|
|
5430
|
+
}
|
|
5431
|
+
}
|
|
5432
|
+
return resolveEntityRowDisplayTitleFromContext(data, widgetOptions, formatService, activeLang);
|
|
5433
|
+
}
|
|
5434
|
+
/**
|
|
5435
|
+
* @deprecated Use {@link resolveEntityRowDisplayTitle} instead.
|
|
5436
|
+
*/
|
|
5437
|
+
function resolveEntityRowDisplayTitleFromColumnContext(rowData, columnOptions, formatService, activeLang) {
|
|
5438
|
+
return resolveEntityRowDisplayTitle({
|
|
5439
|
+
data: rowData,
|
|
5440
|
+
widgetOptions: columnOptions,
|
|
5441
|
+
formatService,
|
|
5442
|
+
activeLang,
|
|
5443
|
+
});
|
|
5444
|
+
}
|
|
5445
|
+
/**
|
|
5446
|
+
* Formats the entity row title for display using entity-driven templates and property paths.
|
|
5447
|
+
*/
|
|
5448
|
+
function formatEntityRowDisplayTitle(entity, rowData, formatService, activeLang) {
|
|
5449
|
+
if (!rowData) {
|
|
5450
|
+
return '';
|
|
5451
|
+
}
|
|
5452
|
+
const titleContext = buildEntitySearchTitleContext(entity ?? {});
|
|
5453
|
+
for (const path of titleContext.fallbackFields) {
|
|
5454
|
+
const fromField = resolveEntityRowDisplayText(get(rowData, path), activeLang);
|
|
5455
|
+
if (fromField) {
|
|
5456
|
+
return fromField;
|
|
5457
|
+
}
|
|
5458
|
+
}
|
|
5459
|
+
const templates = [
|
|
5460
|
+
resolveEntityRowTitleTemplate(entity),
|
|
5461
|
+
...titleContext.fallbackTemplates,
|
|
5462
|
+
].filter((template) => !!template?.trim());
|
|
5463
|
+
for (const template of templates) {
|
|
5464
|
+
const formatted = formatService.format(normalizeEntityDisplayTemplate(template), 'string', rowData);
|
|
5465
|
+
const fromTemplate = resolveEntityRowDisplayText(formatted, activeLang);
|
|
5466
|
+
if (fromTemplate) {
|
|
5467
|
+
return fromTemplate;
|
|
5468
|
+
}
|
|
5469
|
+
}
|
|
5470
|
+
return '';
|
|
5471
|
+
}
|
|
5472
|
+
//#endregion
|
|
5473
|
+
|
|
5350
5474
|
/**
|
|
5351
5475
|
* Shared utility for creating Entity:Create command options used in search command providers.
|
|
5352
5476
|
* Use with command: { name: 'Entity:Create', options: createEntityCommandOptions(...) }
|
|
@@ -6932,6 +7056,280 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
6932
7056
|
}]
|
|
6933
7057
|
}] });
|
|
6934
7058
|
|
|
7059
|
+
//#region ---- Types ----
|
|
7060
|
+
//#endregion
|
|
7061
|
+
//#region ---- Option normalization ----
|
|
7062
|
+
/**
|
|
7063
|
+
* Normalizes widget option values to a positive finite number
|
|
7064
|
+
* (plain number, numeric string, or editor object with `value` / `id`).
|
|
7065
|
+
*/
|
|
7066
|
+
function normalizePositiveNumberOption(value, fallback) {
|
|
7067
|
+
if (typeof value === 'number' && Number.isFinite(value) && value > 0) {
|
|
7068
|
+
return value;
|
|
7069
|
+
}
|
|
7070
|
+
if (typeof value === 'string') {
|
|
7071
|
+
const parsed = Number(value);
|
|
7072
|
+
if (Number.isFinite(parsed) && parsed > 0) {
|
|
7073
|
+
return parsed;
|
|
7074
|
+
}
|
|
7075
|
+
}
|
|
7076
|
+
if (value != null && typeof value === 'object') {
|
|
7077
|
+
const record = value;
|
|
7078
|
+
if ('value' in record) {
|
|
7079
|
+
return normalizePositiveNumberOption(record['value'], fallback);
|
|
7080
|
+
}
|
|
7081
|
+
if ('id' in record) {
|
|
7082
|
+
return normalizePositiveNumberOption(record['id'], fallback);
|
|
7083
|
+
}
|
|
7084
|
+
}
|
|
7085
|
+
return fallback;
|
|
7086
|
+
}
|
|
7087
|
+
//#endregion
|
|
7088
|
+
//#region ---- DOM measurement ----
|
|
7089
|
+
/**
|
|
7090
|
+
* Resolves the rendered graphic size from a container (canvas or SVG).
|
|
7091
|
+
*/
|
|
7092
|
+
function resolveGraphicElementSize(container, fallback) {
|
|
7093
|
+
const canvas = container.querySelector('canvas');
|
|
7094
|
+
if (canvas instanceof HTMLCanvasElement && canvas.width > 0) {
|
|
7095
|
+
return canvas.width;
|
|
7096
|
+
}
|
|
7097
|
+
const svg = container.querySelector('svg');
|
|
7098
|
+
if (svg instanceof SVGSVGElement) {
|
|
7099
|
+
const svgWidth = svg.width?.baseVal?.value;
|
|
7100
|
+
if (svgWidth > 0) {
|
|
7101
|
+
return svgWidth;
|
|
7102
|
+
}
|
|
7103
|
+
const widthAttr = svg.getAttribute('width');
|
|
7104
|
+
if (widthAttr) {
|
|
7105
|
+
const parsed = Number.parseFloat(widthAttr);
|
|
7106
|
+
if (Number.isFinite(parsed) && parsed > 0) {
|
|
7107
|
+
return parsed;
|
|
7108
|
+
}
|
|
7109
|
+
}
|
|
7110
|
+
}
|
|
7111
|
+
return normalizePositiveNumberOption(fallback, fallback);
|
|
7112
|
+
}
|
|
7113
|
+
//#endregion
|
|
7114
|
+
//#region ---- SVG helpers ----
|
|
7115
|
+
/**
|
|
7116
|
+
* Serializes an SVG element to a string, optionally prefixing the XML declaration.
|
|
7117
|
+
*/
|
|
7118
|
+
function serializeSvgElement(svg, includeXmlDeclaration = true) {
|
|
7119
|
+
const serializer = new XMLSerializer();
|
|
7120
|
+
let source = serializer.serializeToString(svg);
|
|
7121
|
+
if (includeXmlDeclaration && !source.match(/^<\?xml/)) {
|
|
7122
|
+
source = `<?xml version="1.0" standalone="no"?>\r\n${source}`;
|
|
7123
|
+
}
|
|
7124
|
+
return source;
|
|
7125
|
+
}
|
|
7126
|
+
//#endregion
|
|
7127
|
+
//#region ---- Graphic content resolution ----
|
|
7128
|
+
/**
|
|
7129
|
+
* Builds printable HTML body markup and CSS for an SVG or canvas inside a container.
|
|
7130
|
+
*/
|
|
7131
|
+
function resolveGraphicPrintContent(container, size, imageAlt = 'Graphic') {
|
|
7132
|
+
const svg = container.querySelector('svg');
|
|
7133
|
+
if (svg instanceof SVGSVGElement) {
|
|
7134
|
+
return {
|
|
7135
|
+
bodyMarkup: svg.outerHTML,
|
|
7136
|
+
styleRule: `svg { width: ${size}px !important; height: ${size}px !important; }`,
|
|
7137
|
+
};
|
|
7138
|
+
}
|
|
7139
|
+
const canvas = container.querySelector('canvas');
|
|
7140
|
+
if (canvas instanceof HTMLCanvasElement) {
|
|
7141
|
+
try {
|
|
7142
|
+
const dataUrl = canvas.toDataURL('image/png');
|
|
7143
|
+
if (!dataUrl.startsWith('data:image/png')) {
|
|
7144
|
+
return undefined;
|
|
7145
|
+
}
|
|
7146
|
+
return {
|
|
7147
|
+
bodyMarkup: `<img src="${dataUrl}" width="${size}" height="${size}" alt="${imageAlt}" />`,
|
|
7148
|
+
styleRule: `img { width: ${size}px !important; height: ${size}px !important; }`,
|
|
7149
|
+
};
|
|
7150
|
+
}
|
|
7151
|
+
catch {
|
|
7152
|
+
return undefined;
|
|
7153
|
+
}
|
|
7154
|
+
}
|
|
7155
|
+
return undefined;
|
|
7156
|
+
}
|
|
7157
|
+
//#endregion
|
|
7158
|
+
//#region ---- Browser download ----
|
|
7159
|
+
/**
|
|
7160
|
+
* Triggers a file download for the given blob via a temporary anchor element.
|
|
7161
|
+
*/
|
|
7162
|
+
function triggerBrowserDownload(blob, filename) {
|
|
7163
|
+
const link = document.createElement('a');
|
|
7164
|
+
const url = URL.createObjectURL(blob);
|
|
7165
|
+
link.href = url;
|
|
7166
|
+
link.download = filename;
|
|
7167
|
+
document.body.appendChild(link);
|
|
7168
|
+
link.click();
|
|
7169
|
+
document.body.removeChild(link);
|
|
7170
|
+
URL.revokeObjectURL(url);
|
|
7171
|
+
}
|
|
7172
|
+
//#endregion
|
|
7173
|
+
//#region ---- Print ----
|
|
7174
|
+
/**
|
|
7175
|
+
* Opens the system print dialog for an SVG or canvas graphic inside the given container.
|
|
7176
|
+
*/
|
|
7177
|
+
function printGraphicFromElement(container, options = {}) {
|
|
7178
|
+
const fallbackSize = options.fallbackSize ?? 200;
|
|
7179
|
+
const size = resolveGraphicElementSize(container, fallbackSize);
|
|
7180
|
+
const printContent = resolveGraphicPrintContent(container, size, options.imageAlt ?? 'Graphic');
|
|
7181
|
+
if (!printContent) {
|
|
7182
|
+
return;
|
|
7183
|
+
}
|
|
7184
|
+
const iframe = document.createElement('iframe');
|
|
7185
|
+
iframe.setAttribute('aria-hidden', 'true');
|
|
7186
|
+
iframe.style.cssText = `position:fixed;left:0;top:0;width:${size}px;height:${size}px;border:0;visibility:hidden;`;
|
|
7187
|
+
document.body.appendChild(iframe);
|
|
7188
|
+
const printWindow = iframe.contentWindow;
|
|
7189
|
+
const doc = printWindow?.document;
|
|
7190
|
+
if (!printWindow || !doc) {
|
|
7191
|
+
iframe.remove();
|
|
7192
|
+
return;
|
|
7193
|
+
}
|
|
7194
|
+
const title = options.title ?? 'Print';
|
|
7195
|
+
doc.open();
|
|
7196
|
+
doc.write(`<!DOCTYPE html>
|
|
7197
|
+
<html>
|
|
7198
|
+
<head>
|
|
7199
|
+
<title>${title}</title>
|
|
7200
|
+
<style>
|
|
7201
|
+
body {
|
|
7202
|
+
display: flex;
|
|
7203
|
+
align-items: center;
|
|
7204
|
+
justify-content: center;
|
|
7205
|
+
min-height: 100vh;
|
|
7206
|
+
margin: 0;
|
|
7207
|
+
}
|
|
7208
|
+
@media print {
|
|
7209
|
+
body {
|
|
7210
|
+
min-height: auto;
|
|
7211
|
+
}
|
|
7212
|
+
}
|
|
7213
|
+
${printContent.styleRule}
|
|
7214
|
+
</style>
|
|
7215
|
+
</head>
|
|
7216
|
+
<body>${printContent.bodyMarkup}</body>
|
|
7217
|
+
</html>`);
|
|
7218
|
+
doc.close();
|
|
7219
|
+
const cleanup = () => {
|
|
7220
|
+
iframe.remove();
|
|
7221
|
+
};
|
|
7222
|
+
const triggerPrint = () => {
|
|
7223
|
+
printWindow.focus();
|
|
7224
|
+
printWindow.print();
|
|
7225
|
+
printWindow.addEventListener('afterprint', cleanup, { once: true });
|
|
7226
|
+
window.setTimeout(cleanup, 1000);
|
|
7227
|
+
};
|
|
7228
|
+
const image = doc.querySelector('img');
|
|
7229
|
+
if (image && !image.complete) {
|
|
7230
|
+
image.addEventListener('load', triggerPrint, { once: true });
|
|
7231
|
+
image.addEventListener('error', cleanup, { once: true });
|
|
7232
|
+
return;
|
|
7233
|
+
}
|
|
7234
|
+
requestAnimationFrame(triggerPrint);
|
|
7235
|
+
}
|
|
7236
|
+
//#endregion
|
|
7237
|
+
//#region ---- Download ----
|
|
7238
|
+
/**
|
|
7239
|
+
* Downloads an SVG or canvas graphic from a container as SVG, PNG, or JPEG.
|
|
7240
|
+
*/
|
|
7241
|
+
function downloadGraphicFromElement(container, options) {
|
|
7242
|
+
const size = resolveGraphicElementSize(container, options.fallbackSize ?? 200);
|
|
7243
|
+
if (options.format === 'svg') {
|
|
7244
|
+
downloadSvgGraphic(container, options.filename);
|
|
7245
|
+
return;
|
|
7246
|
+
}
|
|
7247
|
+
const mime = options.format === 'png' ? 'image/png' : 'image/jpeg';
|
|
7248
|
+
downloadRasterGraphic(container, mime, options.filename, size);
|
|
7249
|
+
}
|
|
7250
|
+
function downloadSvgGraphic(container, filename) {
|
|
7251
|
+
const svg = container.querySelector('svg');
|
|
7252
|
+
if (!(svg instanceof SVGSVGElement)) {
|
|
7253
|
+
return;
|
|
7254
|
+
}
|
|
7255
|
+
const source = serializeSvgElement(svg);
|
|
7256
|
+
triggerBrowserDownload(new Blob([source], { type: 'image/svg+xml;charset=utf-8' }), filename);
|
|
7257
|
+
}
|
|
7258
|
+
function downloadRasterGraphic(container, mime, filename, size) {
|
|
7259
|
+
const canvas = container.querySelector('canvas');
|
|
7260
|
+
if (canvas instanceof HTMLCanvasElement) {
|
|
7261
|
+
const dataUrl = rasterizeCanvasToDataUrl(canvas, mime, size);
|
|
7262
|
+
if (dataUrl) {
|
|
7263
|
+
triggerBrowserDownload(dataUrlToBlob(dataUrl), filename);
|
|
7264
|
+
}
|
|
7265
|
+
return;
|
|
7266
|
+
}
|
|
7267
|
+
const svg = container.querySelector('svg');
|
|
7268
|
+
if (svg instanceof SVGSVGElement) {
|
|
7269
|
+
rasterizeSvgToDataUrl(svg, mime, size, (dataUrl) => {
|
|
7270
|
+
triggerBrowserDownload(dataUrlToBlob(dataUrl), filename);
|
|
7271
|
+
});
|
|
7272
|
+
}
|
|
7273
|
+
}
|
|
7274
|
+
function rasterizeCanvasToDataUrl(canvas, mime, size) {
|
|
7275
|
+
if (mime === 'image/png') {
|
|
7276
|
+
try {
|
|
7277
|
+
return canvas.toDataURL('image/png');
|
|
7278
|
+
}
|
|
7279
|
+
catch {
|
|
7280
|
+
return undefined;
|
|
7281
|
+
}
|
|
7282
|
+
}
|
|
7283
|
+
const outputCanvas = document.createElement('canvas');
|
|
7284
|
+
outputCanvas.width = size;
|
|
7285
|
+
outputCanvas.height = size;
|
|
7286
|
+
const ctx = outputCanvas.getContext('2d');
|
|
7287
|
+
if (!ctx) {
|
|
7288
|
+
return undefined;
|
|
7289
|
+
}
|
|
7290
|
+
ctx.fillStyle = '#ffffff';
|
|
7291
|
+
ctx.fillRect(0, 0, size, size);
|
|
7292
|
+
ctx.drawImage(canvas, 0, 0, size, size);
|
|
7293
|
+
try {
|
|
7294
|
+
return outputCanvas.toDataURL('image/jpeg');
|
|
7295
|
+
}
|
|
7296
|
+
catch {
|
|
7297
|
+
return undefined;
|
|
7298
|
+
}
|
|
7299
|
+
}
|
|
7300
|
+
function rasterizeSvgToDataUrl(svg, mime, size, onReady) {
|
|
7301
|
+
const source = serializeSvgElement(svg);
|
|
7302
|
+
const svgUrl = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(source)}`;
|
|
7303
|
+
const img = new Image();
|
|
7304
|
+
const canvas = document.createElement('canvas');
|
|
7305
|
+
canvas.width = size;
|
|
7306
|
+
canvas.height = size;
|
|
7307
|
+
const ctx = canvas.getContext('2d');
|
|
7308
|
+
if (!ctx) {
|
|
7309
|
+
return;
|
|
7310
|
+
}
|
|
7311
|
+
if (mime === 'image/jpeg') {
|
|
7312
|
+
ctx.fillStyle = '#ffffff';
|
|
7313
|
+
ctx.fillRect(0, 0, size, size);
|
|
7314
|
+
}
|
|
7315
|
+
img.onload = () => {
|
|
7316
|
+
ctx.drawImage(img, 0, 0, size, size);
|
|
7317
|
+
onReady(canvas.toDataURL(mime));
|
|
7318
|
+
};
|
|
7319
|
+
img.src = svgUrl;
|
|
7320
|
+
}
|
|
7321
|
+
function dataUrlToBlob(dataUrl) {
|
|
7322
|
+
const [header, data] = dataUrl.split(',');
|
|
7323
|
+
const mime = header.match(/:(.*?);/)?.[1] ?? 'application/octet-stream';
|
|
7324
|
+
const binary = atob(data);
|
|
7325
|
+
const bytes = new Uint8Array(binary.length);
|
|
7326
|
+
for (let index = 0; index < binary.length; index++) {
|
|
7327
|
+
bytes[index] = binary.charCodeAt(index);
|
|
7328
|
+
}
|
|
7329
|
+
return new Blob([bytes], { type: mime });
|
|
7330
|
+
}
|
|
7331
|
+
//#endregion
|
|
7332
|
+
|
|
6935
7333
|
class AXMOrgChartPrintPage extends AXBasePageComponent {
|
|
6936
7334
|
constructor() {
|
|
6937
7335
|
super(...arguments);
|
|
@@ -7138,13 +7536,7 @@ class AXPExportService {
|
|
|
7138
7536
|
});
|
|
7139
7537
|
}
|
|
7140
7538
|
download(blob, filename) {
|
|
7141
|
-
|
|
7142
|
-
link.href = URL.createObjectURL(blob);
|
|
7143
|
-
link.download = filename;
|
|
7144
|
-
document.body.appendChild(link);
|
|
7145
|
-
link.click();
|
|
7146
|
-
document.body.removeChild(link);
|
|
7147
|
-
URL.revokeObjectURL(link.href);
|
|
7539
|
+
triggerBrowserDownload(blob, filename);
|
|
7148
7540
|
}
|
|
7149
7541
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPExportService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
7150
7542
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPExportService, providedIn: 'root' }); }
|
|
@@ -7198,5 +7590,5 @@ class AXPVersioningService {
|
|
|
7198
7590
|
* Generated bundle index. Do not edit.
|
|
7199
7591
|
*/
|
|
7200
7592
|
|
|
7201
|
-
export { ALL_DEFAULT_OPERATORS, AXMWorkflowErrorHandler, AXPAppVersionService, AXPBackgroundOperationCompletionService, AXPBackgroundOperationEntityStoreService, AXPBackgroundOperationHandler, AXPBackgroundOperationNotificationService, AXPBackgroundOperationProvider, AXPBackgroundOperationRootConfig, AXPBackgroundOperationService, AXPBackgroundOperationSlotComponent, AXPCleanNestedFilters, AXPClipBoardService, AXPCommonModule, AXPCommonSettings, AXPCustomOperatorService, AXPCustomOperatorServiceImpl, AXPDataProvider, AXPDebugService, AXPDefaultMultiLanguageConfigService, AXPDialogConfirmAction, AXPEntityCommandScope, AXPEntityQueryType, AXPEntityType, AXPErrorHandlerRegistryService, AXPExportService, AXPFileActionsService, AXPFileStorageEvaluatorScopeProvider, AXPFileStorageService,
|
|
7593
|
+
export { ALL_DEFAULT_OPERATORS, AXMWorkflowErrorHandler, AXPAppVersionService, AXPBackgroundOperationCompletionService, AXPBackgroundOperationEntityStoreService, AXPBackgroundOperationHandler, AXPBackgroundOperationNotificationService, AXPBackgroundOperationProvider, AXPBackgroundOperationRootConfig, AXPBackgroundOperationService, AXPBackgroundOperationSlotComponent, AXPCleanNestedFilters, AXPClipBoardService, AXPCommonModule, AXPCommonSettings, AXPCustomOperatorService, AXPCustomOperatorServiceImpl, AXPDataProvider, AXPDebugService, AXPDefaultMultiLanguageConfigService, AXPDialogConfirmAction, AXPEntityCommandScope, AXPEntityQueryType, AXPEntityType, AXPErrorHandlerRegistryService, AXPExportService, AXPFileActionsService, AXPFileStorageEvaluatorScopeProvider, AXPFileStorageService, AXPFileTypeProviderService, AXPFilterOperatorMiddlewareService, AXPFilterOperatorMiddlewareServiceImpl, AXPFooterTextSlotComponent, AXPGlobalErrorHandler, AXPHomePageModule, AXPHomePageService, AXPKeyboardShortcutsHelpComponent, AXPKeyboardShortcutsHelpService, AXPLockService, AXPMenuItemsDataSourceDefinition, AXPMenuKeyboardShortcutService, AXPMenuMiddlewareRegistry, AXPMenuProviderService, AXPMenuRouteAccessService, AXPMenuRouteGuard, AXPMenuSearchDefinitionProvider, AXPMenuSearchProvider, AXPMenuService, AXPMenuVisibilityService, AXPNavBarSlotComponent, AXPNavigateWorkflow, AXPNotFoundCatchAllRoute, AXPNotFoundError, AXPOutputContractTranscriptSegmentService, AXPPlatformCommonDataSourceKeys, AXPPlatformDefaultConfigs, AXPRedirectEvent, AXPRefreshEvent, AXPRegionalCalendarService, AXPRegionalSetting, AXPRelationshipCardinality, AXPRelationshipKind, AXPReloadAction, AXPReloadEvent, AXPSearchCommandProvider, AXPSearchDefinitionActionBuilder, AXPSearchDefinitionBuilder, AXPSearchDefinitionProviderContext, AXPSearchDefinitionProviderService, AXPSearchService, AXPSettingDefaultValuesAggregatorService, AXPSettingDefinitionGroupBuilder, AXPSettingDefinitionProviderContext, AXPSettingDefinitionProviderService, AXPSettingDefinitionSectionBuilder, AXPSettingsEvaluatorScopeProvider, AXPSettingsService, AXPStatusDefinitionProviderService, AXPStatusProvider, AXPStickyDirective, AXPSystemStatusType, AXPSystemStatuses, AXPToastAction, AXPTokenDefinitionService, AXPTokenEvaluatorScopeProvider, AXPUnsavedChangesConfirmService, AXPUnsavedChangesPopstateService, AXPVersioningService, AXPWorkflowNavigateAction, AXPWorkflowRouterNavigateAction, AXP_AGENT_OUTPUT_CONTRACT_DEFAULT_STRUCTURED_RETRIES, AXP_APP_VERSION_PROVIDER, AXP_BACKGROUND_OPERATION_ENTITY_STORAGE, AXP_BACKGROUND_OPERATION_HANDLERS, AXP_BACKGROUND_OPERATION_PROVIDERS, AXP_FILE_ACTION_PROVIDER, AXP_FILE_TYPE_INFO_PROVIDER, AXP_HOME_PAGES, AXP_HOME_PAGE_DEFAULT_KEY, AXP_IN_APP_NOTIFICATION_SERVICE, AXP_LOCALE_MANAGEMENT_PORT, AXP_MENU_MIDDLEWARE, AXP_MENU_PROVIDER, AXP_NOT_FOUND_CATCH_ALL_ROUTE, AXP_NOT_FOUND_ROUTE, AXP_OUTPUT_CONTRACT_TRANSCRIPT_SEGMENT_PROVIDER, AXP_PLATFORM_CONFIG_TOKEN, AXP_PROTECTED_ROUTE_GUARDS, AXP_ROOT_CONFIG_TOKEN, AXP_SEARCH_DEFINITION_PROVIDER, AXP_SEARCH_PROVIDER, AXP_SETTING_DEFAULT_VALUES_PROVIDERS, AXP_SETTING_DEFINITION_PROVIDER, AXP_SETTING_VALUE_PROVIDER, AXP_STATUS_PROVIDERS, AXP_TOKEN_DEFINITION_PROVIDER, AXP_UNAUTHORIZED_ROUTE, AXVChangeType, BETWEEN_OPER, BOOLEAN_OPERATORS, CONTAINS_OPER, DATE_OPERATORS, DEFAULT_DATE_FILTER_PRESETS, DEFAULT_MULTILANGUAGE_FIELD_NAMES, ENDS_WITH_OPER, ENTITY_LAYOUT_SINGLE_TITLE_PATH, ENTITY_ROW_POPUP_TITLE_OPTION, ENTITY_ROW_TITLE_TEMPLATE_OPTION, ENVIRONMENT, EQ_OPER, GTE_OPER, GT_OPER, IN_OPER, IS_EMPTY_OPER, IS_NOT_EMPTY_OPER, LTE_OPER, LT_OPER, MULTILANGUAGE_CAPABLE_WIDGET_TYPES, NOT_CONTAINS_OPER, NOT_EQ_OPER, NUMBER_OPERATORS, STARTS_WITH_OPER, STRING_OPERATORS, UploadFromComputerActionProvider, applyDateFilterPreset, axpBackgroundOperationCapabilities, axpBackgroundOperationDisplayTime, axpBackgroundOperationEntityName, axpBackgroundOperationEstimateEndDate, axpBackgroundOperationFailurePolicy, axpBackgroundOperationFromEntityModel, axpBackgroundOperationRemainingMs, axpBackgroundOperationToEntityModel, axpBuildBackgroundOperation, axpCoerceBackgroundOperationDate, axpCreateBackgroundOperationId, axpFindMenuItemByRoute, axpIsActiveBackgroundOperationStatus, axpIsCompletedBackgroundOperationStatus, axpIsEntityDetailsPath, axpIsEntityDetailsViewRoute, axpIsEntityListPath, axpIsEntityListRoute, axpIsEntityRecordNotFound, axpMenuPathsMatch, axpNavigateAppPath, axpParseAppPath, axpRedirectToNotFound, axpRedirectToUnauthorized, axpReplaceEntityListRouteQueryParams, backgroundOperationEntityFactory, buildEntitySearchTitleContext, coerceAXPSettingRawValue, coerceAXPSettingRawValueByKind, configPlatform, createAllQueryView, createBackgroundOperationStore, createEntityCommandOptions, createEntityRowExpressionScope, createEntitySearchCommand, createMenuContext, createMenuMiddleware, createQueryView, createUnsavedChangesCanDeactivateGuard, downloadGraphicFromElement, evaluateEntityDisplayTemplate, findManualPresetIdByOperation, formatEntityRowDisplayTitle, getEntityInfo, getStatusInfo, getSystemStatus, inferSettingCoercionKind, isCardFieldBadgeDisplay, isMeaningfulEntityDisplayTitle, isUnresolvedEntityDisplayTemplate, normalizeEntityDisplayTemplate, normalizePositiveNumberOption, peelSettingValueKey, printGraphicFromElement, provideDynamicHomePage, provideMenuMiddleware, resolveCardFieldBadgeColor, resolveDateFilterPresets, resolveDefaultMasterListLayout, resolveEnabledMasterListLayouts, resolveEntityRowDisplayText, resolveEntityRowDisplayTitle, resolveEntityRowDisplayTitleFromColumnContext, resolveEntityRowTitleTemplate, resolveEntitySearchTitleFallback, resolveGraphicElementSize, resolveGraphicPrintContent, resolveQueryMatchingDisplayText, resolveSearchDisplayTemplate, resolveSearchableText, resolveStatusLook, sanitizeResolvedEntityDisplayTitle, searchInRecordValues, searchInSearchableValue, serializeSvgElement, shouldApplyDefaultMultiLanguageToEntityProperty, shouldApplyDefaultMultiLanguageToWidgetNode, shouldApplyDefaultMultiLanguageToWidgetProperty, systemStatusToDefinition, triggerBrowserDownload, withDefaultMultiLanguageOnWidgetNodeTree, withDefaultMultiLanguageOnWidgetProperty };
|
|
7202
7594
|
//# sourceMappingURL=acorex-platform-common.mjs.map
|