@acorex-platform/module-risk-management-client 0.0.37 → 0.0.46
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/fesm2022/acorex-platform-module-risk-management-client-contracts-entities-risk-likelihood-scale.mjs +361 -0
- package/fesm2022/acorex-platform-module-risk-management-client-contracts-entities-risk-likelihood-scale.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-risk-management-client-contracts-entities-risk-matrix.mjs +364 -0
- package/fesm2022/acorex-platform-module-risk-management-client-contracts-entities-risk-matrix.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-risk-management-client-contracts-entities-risk-rating-scale.mjs +388 -0
- package/fesm2022/acorex-platform-module-risk-management-client-contracts-entities-risk-rating-scale.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-risk-management-client-contracts-entities-risk-severity-scale.mjs +361 -0
- package/fesm2022/acorex-platform-module-risk-management-client-contracts-entities-risk-severity-scale.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-risk-management-client-contracts-entity-catalog-acorex-platform-module-risk-management-client-contracts-entity-catalog-D6WaBLYS.mjs +72 -0
- package/fesm2022/acorex-platform-module-risk-management-client-contracts-entity-catalog-acorex-platform-module-risk-management-client-contracts-entity-catalog-D6WaBLYS.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-risk-management-client-contracts-entity-catalog-risk-likelihood-scale.entity-CVdw2sfd.mjs +311 -0
- package/fesm2022/acorex-platform-module-risk-management-client-contracts-entity-catalog-risk-likelihood-scale.entity-CVdw2sfd.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-risk-management-client-contracts-entity-catalog-risk-matrix-cell.entity-b97tbRDA.mjs → acorex-platform-module-risk-management-client-contracts-entity-catalog-risk-matrix.entity-Chp-843O.mjs} +131 -115
- package/fesm2022/acorex-platform-module-risk-management-client-contracts-entity-catalog-risk-matrix.entity-Chp-843O.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-risk-management-client-contracts-entity-catalog-risk-rating-scale.entity-Cjg7aGMl.mjs +338 -0
- package/fesm2022/acorex-platform-module-risk-management-client-contracts-entity-catalog-risk-rating-scale.entity-Cjg7aGMl.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-risk-management-client-contracts-entity-catalog-risk-severity-scale.entity-Cgti6Xeo.mjs +311 -0
- package/fesm2022/acorex-platform-module-risk-management-client-contracts-entity-catalog-risk-severity-scale.entity-Cgti6Xeo.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-risk-management-client-contracts-entity-catalog.mjs +1 -1
- package/fesm2022/acorex-platform-module-risk-management-client-contracts.mjs +233 -49
- package/fesm2022/acorex-platform-module-risk-management-client-contracts.mjs.map +1 -1
- package/fesm2022/acorex-platform-module-risk-management-client-local-entities.mjs +4 -4
- package/fesm2022/acorex-platform-module-risk-management-client-local-entities.mjs.map +1 -1
- package/fesm2022/{acorex-platform-module-risk-management-client-preview-risk-matrix-cell.command-CTGIFUIa.mjs → acorex-platform-module-risk-management-client-preview-risk-matrix.command-gVKnE3c0.mjs} +14 -12
- package/fesm2022/acorex-platform-module-risk-management-client-preview-risk-matrix.command-gVKnE3c0.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-risk-management-client.mjs +439 -230
- package/fesm2022/acorex-platform-module-risk-management-client.mjs.map +1 -1
- package/package.json +13 -13
- package/types/acorex-platform-module-risk-management-client-contracts-entities-risk-likelihood-scale.d.ts +5 -0
- package/types/acorex-platform-module-risk-management-client-contracts-entities-risk-matrix.d.ts +5 -0
- package/types/acorex-platform-module-risk-management-client-contracts-entities-risk-rating-scale.d.ts +5 -0
- package/types/acorex-platform-module-risk-management-client-contracts-entities-risk-severity-scale.d.ts +5 -0
- package/types/acorex-platform-module-risk-management-client-contracts.d.ts +157 -65
- package/types/acorex-platform-module-risk-management-client.d.ts +77 -31
- package/fesm2022/acorex-platform-module-risk-management-client-contracts-entities-risk-likelihood.mjs +0 -222
- package/fesm2022/acorex-platform-module-risk-management-client-contracts-entities-risk-likelihood.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-risk-management-client-contracts-entities-risk-matrix-cell.mjs +0 -348
- package/fesm2022/acorex-platform-module-risk-management-client-contracts-entities-risk-matrix-cell.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-risk-management-client-contracts-entities-risk-rating.mjs +0 -227
- package/fesm2022/acorex-platform-module-risk-management-client-contracts-entities-risk-rating.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-risk-management-client-contracts-entities-risk-severity.mjs +0 -222
- package/fesm2022/acorex-platform-module-risk-management-client-contracts-entities-risk-severity.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-risk-management-client-contracts-entity-catalog-acorex-platform-module-risk-management-client-contracts-entity-catalog-Dc6Me3H6.mjs +0 -72
- package/fesm2022/acorex-platform-module-risk-management-client-contracts-entity-catalog-acorex-platform-module-risk-management-client-contracts-entity-catalog-Dc6Me3H6.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-risk-management-client-contracts-entity-catalog-risk-likelihood.entity-DzwLi3Ga.mjs +0 -172
- package/fesm2022/acorex-platform-module-risk-management-client-contracts-entity-catalog-risk-likelihood.entity-DzwLi3Ga.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-risk-management-client-contracts-entity-catalog-risk-matrix-cell.entity-b97tbRDA.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-risk-management-client-contracts-entity-catalog-risk-rating.entity-CreMsiCu.mjs +0 -177
- package/fesm2022/acorex-platform-module-risk-management-client-contracts-entity-catalog-risk-rating.entity-CreMsiCu.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-risk-management-client-contracts-entity-catalog-risk-severity.entity-bEyLH8dE.mjs +0 -172
- package/fesm2022/acorex-platform-module-risk-management-client-contracts-entity-catalog-risk-severity.entity-bEyLH8dE.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-risk-management-client-preview-risk-matrix-cell.command-CTGIFUIa.mjs.map +0 -1
- package/types/acorex-platform-module-risk-management-client-contracts-entities-risk-likelihood.d.ts +0 -5
- package/types/acorex-platform-module-risk-management-client-contracts-entities-risk-matrix-cell.d.ts +0 -5
- package/types/acorex-platform-module-risk-management-client-contracts-entities-risk-rating.d.ts +0 -5
- package/types/acorex-platform-module-risk-management-client-contracts-entities-risk-severity.d.ts +0 -5
|
@@ -2,25 +2,24 @@ import { AXPCommonMenuKeys, AXPCommonPermissionGroupKeys } from '@acorex-platfor
|
|
|
2
2
|
import { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
4
|
import { inject, Injectable, NgModule, input, output, signal, computed, effect, ChangeDetectionStrategy, ViewEncapsulation, Component } from '@angular/core';
|
|
5
|
-
import { RootConfig, AXPSafetyRiskPermissionKeys, AXMRiskManagementMenuKeys, RISK_CATALOG_SCOPE_HAZARD, RISK_CATALOG_SCOPE_PPE_ITEMS, RISK_MATRIX_AXIS_PROPERTIES, DEFAULT_RISK_MATRIX_AXIS_MAPPING, DEFAULT_RISK_MATRIX_ORIENTATION, RISK_MATRIX_ORIENTATION_TITLE_KEYS } from '@acorex-platform/module-risk-management-client/contracts';
|
|
5
|
+
import { RootConfig, AXPSafetyRiskPermissionKeys, AXMRiskManagementMenuKeys, RISK_CATALOG_SCOPE_HAZARD, RISK_CATALOG_SCOPE_PPE_ITEMS, RISK_MATRIX_AXIS_PROPERTIES, DEFAULT_RISK_MATRIX_AXIS_MAPPING, DEFAULT_RISK_MATRIX_ORIENTATION, RISK_MATRIX_ORIENTATION_TITLE_KEYS, resolveRiskLikelihoodLevelCodes, resolveRiskSeverityLevelCodes, resolveRiskRatingLevelCodes, sortRiskLikelihoodLevels, sortRiskSeverityLevels, sortRiskRatingLevels, toRiskMatrixSpreadsheetData, resolveRiskMatrixCells, pruneRiskMatrixCells, fromRiskMatrixSpreadsheetData } from '@acorex-platform/module-risk-management-client/contracts';
|
|
6
6
|
import { AXP_PERMISSION_DEFINITION_PROVIDER } from '@acorex-platform/framework-client/auth';
|
|
7
7
|
import { AXP_MENU_PROVIDER, resolveEntityRowDisplayText, resolveEntityRowDisplayTitle } from '@acorex-platform/framework-client/common';
|
|
8
|
-
import {
|
|
8
|
+
import { AXP_CATALOG_SCOPE_DEFINITION_PROVIDER, provideLazyProvider, ensureRuntimeSurfaceClass } from '@acorex-platform/framework-client/core';
|
|
9
9
|
import { AXP_WIDGETS_EDITOR_CATEGORY, AXPWidgetCoreModule, AXP_WIDGET_DEFINITION_PROVIDER, AXPColumnWidgetComponent, AXPValueWidgetComponent } from '@acorex-platform/framework-client/layout/widget-core';
|
|
10
10
|
import { provideCommandSetups } from '@acorex-platform/framework-client/runtime';
|
|
11
11
|
import { AXPWidgetGroupEnum } from '@acorex-platform/framework-shared/widget-core';
|
|
12
12
|
import { AXP_NAME_PROPERTY, AXP_DATA_PATH_PROPERTY, AXP_LABEL_PROPERTY, AXP_READONLY_PROPERTY, AXP_DISABLED_PROPERTY } from '@acorex-platform/framework-client/layout/widgets';
|
|
13
|
-
import * as
|
|
13
|
+
import * as i1 from '@acorex/core/translation';
|
|
14
14
|
import { AXTranslationService, AXTranslationModule } from '@acorex/core/translation';
|
|
15
15
|
import { extractValue, resolveToSurfaceClass, AXPWidgetsList } from '@acorex-platform/framework-shared/core';
|
|
16
16
|
import { AXPSpreadsheetComponent } from '@acorex-platform/framework-client/layout/components';
|
|
17
|
-
import
|
|
18
|
-
import { CommonModule } from '@angular/common';
|
|
19
|
-
import { isEmpty, defaultTo, get, isEqual } from 'lodash';
|
|
17
|
+
import { AsyncPipe } from '@angular/common';
|
|
20
18
|
import { AXPLayoutBuilderService } from '@acorex-platform/framework-client/layout/builder';
|
|
19
|
+
import { defaultTo, get, isEmpty, isEqual } from 'lodash';
|
|
21
20
|
import * as i1$1 from '@acorex/components/button';
|
|
22
21
|
import { AXButtonModule } from '@acorex/components/button';
|
|
23
|
-
import * as i2
|
|
22
|
+
import * as i2 from '@acorex/components/decorators';
|
|
24
23
|
import { AXDecoratorModule } from '@acorex/components/decorators';
|
|
25
24
|
import { AXFormatService } from '@acorex/core/format';
|
|
26
25
|
|
|
@@ -47,41 +46,41 @@ class AXMRiskManagementMenuProvider {
|
|
|
47
46
|
},
|
|
48
47
|
children: [
|
|
49
48
|
{
|
|
50
|
-
name: AXMRiskManagementMenuKeys.
|
|
51
|
-
text: entities.
|
|
52
|
-
icon: entities.
|
|
49
|
+
name: AXMRiskManagementMenuKeys.RiskMatrices,
|
|
50
|
+
text: entities.riskMatrix.titlePlural,
|
|
51
|
+
icon: entities.riskMatrix.icon,
|
|
53
52
|
priority: 1,
|
|
54
|
-
path: this.entityService.createPath(module.name, entities.
|
|
53
|
+
path: this.entityService.createPath(module.name, entities.riskMatrix.name),
|
|
55
54
|
policy: {
|
|
56
55
|
permissions: [keys.MaintainRisk],
|
|
57
56
|
},
|
|
58
57
|
},
|
|
59
58
|
{
|
|
60
|
-
name: AXMRiskManagementMenuKeys.
|
|
61
|
-
text: entities.
|
|
62
|
-
icon: entities.
|
|
59
|
+
name: AXMRiskManagementMenuKeys.RiskLikelihoodScales,
|
|
60
|
+
text: entities.riskLikelihoodScale.titlePlural,
|
|
61
|
+
icon: entities.riskLikelihoodScale.icon,
|
|
63
62
|
priority: 2,
|
|
64
|
-
path: this.entityService.createPath(module.name, entities.
|
|
63
|
+
path: this.entityService.createPath(module.name, entities.riskLikelihoodScale.name),
|
|
65
64
|
policy: {
|
|
66
65
|
permissions: [keys.Setup],
|
|
67
66
|
},
|
|
68
67
|
},
|
|
69
68
|
{
|
|
70
|
-
name: AXMRiskManagementMenuKeys.
|
|
71
|
-
text: entities.
|
|
72
|
-
icon: entities.
|
|
69
|
+
name: AXMRiskManagementMenuKeys.RiskSeverityScales,
|
|
70
|
+
text: entities.riskSeverityScale.titlePlural,
|
|
71
|
+
icon: entities.riskSeverityScale.icon,
|
|
73
72
|
priority: 3,
|
|
74
|
-
path: this.entityService.createPath(module.name, entities.
|
|
73
|
+
path: this.entityService.createPath(module.name, entities.riskSeverityScale.name),
|
|
75
74
|
policy: {
|
|
76
75
|
permissions: [keys.Setup],
|
|
77
76
|
},
|
|
78
77
|
},
|
|
79
78
|
{
|
|
80
|
-
name: AXMRiskManagementMenuKeys.
|
|
81
|
-
text: entities.
|
|
82
|
-
icon: entities.
|
|
79
|
+
name: AXMRiskManagementMenuKeys.RiskRatingScales,
|
|
80
|
+
text: entities.riskRatingScale.titlePlural,
|
|
81
|
+
icon: entities.riskRatingScale.icon,
|
|
83
82
|
priority: 4,
|
|
84
|
-
path: this.entityService.createPath(module.name, entities.
|
|
83
|
+
path: this.entityService.createPath(module.name, entities.riskRatingScale.name),
|
|
85
84
|
policy: {
|
|
86
85
|
permissions: [keys.Setup],
|
|
87
86
|
},
|
|
@@ -128,28 +127,10 @@ var permissionDefinition_provider = /*#__PURE__*/Object.freeze({
|
|
|
128
127
|
AXMRiskManagementPermissionDefinitionProvider: AXMRiskManagementPermissionDefinitionProvider
|
|
129
128
|
});
|
|
130
129
|
|
|
131
|
-
//#region ---- Imports ----
|
|
132
|
-
//#endregion
|
|
133
|
-
//#region ---- Manifest Definition ----
|
|
134
|
-
/**
|
|
135
|
-
* Risk Management module manifest.
|
|
136
|
-
*/
|
|
137
|
-
const RiskManagementManifest = {
|
|
138
|
-
name: RootConfig.module.name,
|
|
139
|
-
version: '1.0.0',
|
|
140
|
-
title: RootConfig.module.title,
|
|
141
|
-
icon: RootConfig.module.icon,
|
|
142
|
-
i18n: RootConfig.config.i18n,
|
|
143
|
-
type: 'domain',
|
|
144
|
-
domain: 'workplace-safety',
|
|
145
|
-
required: false,
|
|
146
|
-
};
|
|
147
|
-
//#endregion
|
|
148
|
-
|
|
149
130
|
//#endregion
|
|
150
131
|
//#region ---- Constants ----
|
|
151
|
-
const
|
|
152
|
-
const
|
|
132
|
+
const RISK_MATRIX = `${RootConfig.module.name}.${RootConfig.entities.riskMatrix.name}`;
|
|
133
|
+
const RISK_MATRIX_CATALOG_TARGETS = [RISK_MATRIX];
|
|
153
134
|
//#endregion
|
|
154
135
|
//#region ---- Provider ----
|
|
155
136
|
class AXMRiskManagementCatalogScopeDefinitionProvider {
|
|
@@ -159,7 +140,7 @@ class AXMRiskManagementCatalogScopeDefinitionProvider {
|
|
|
159
140
|
name: RISK_CATALOG_SCOPE_HAZARD,
|
|
160
141
|
title: '@risk-management:catalog-scopes.hazard.title',
|
|
161
142
|
description: '@risk-management:catalog-scopes.hazard.description',
|
|
162
|
-
targets: [...
|
|
143
|
+
targets: [...RISK_MATRIX_CATALOG_TARGETS],
|
|
163
144
|
icon: 'fa-light fa-triangle-exclamation',
|
|
164
145
|
cssClass: 'warning-lighter-surface',
|
|
165
146
|
order: 20,
|
|
@@ -168,7 +149,7 @@ class AXMRiskManagementCatalogScopeDefinitionProvider {
|
|
|
168
149
|
name: RISK_CATALOG_SCOPE_PPE_ITEMS,
|
|
169
150
|
title: '@risk-management:catalog-scopes.ppe-items.title',
|
|
170
151
|
description: '@risk-management:catalog-scopes.ppe-items.description',
|
|
171
|
-
targets: [...
|
|
152
|
+
targets: [...RISK_MATRIX_CATALOG_TARGETS],
|
|
172
153
|
icon: 'fa-light fa-helmet-safety',
|
|
173
154
|
cssClass: 'info-lighter-surface',
|
|
174
155
|
order: 21,
|
|
@@ -237,11 +218,6 @@ class AXMRiskManagementModule {
|
|
|
237
218
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMRiskManagementModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
238
219
|
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.0.8", ngImport: i0, type: AXMRiskManagementModule, imports: [AXPWidgetCoreModule] }); }
|
|
239
220
|
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMRiskManagementModule, providers: [
|
|
240
|
-
{
|
|
241
|
-
provide: AXP_MODULE_MANIFEST_PROVIDER,
|
|
242
|
-
useValue: RiskManagementManifest,
|
|
243
|
-
multi: true,
|
|
244
|
-
},
|
|
245
221
|
provideLazyProvider(AXP_PERMISSION_DEFINITION_PROVIDER, () => Promise.resolve().then(function () { return permissionDefinition_provider; }).then((m) => m.AXMRiskManagementPermissionDefinitionProvider)),
|
|
246
222
|
provideLazyProvider(AXP_MENU_PROVIDER, () => Promise.resolve().then(function () { return menu_provider; }).then((m) => m.AXMRiskManagementMenuProvider)),
|
|
247
223
|
{
|
|
@@ -256,8 +232,8 @@ class AXMRiskManagementModule {
|
|
|
256
232
|
},
|
|
257
233
|
provideCommandSetups([
|
|
258
234
|
{
|
|
259
|
-
key: `${RootConfig.module.name}.${RootConfig.entities.
|
|
260
|
-
command: () => import('./acorex-platform-module-risk-management-client-preview-risk-matrix
|
|
235
|
+
key: `${RootConfig.module.name}.${RootConfig.entities.riskMatrix.name}:Preview`,
|
|
236
|
+
command: () => import('./acorex-platform-module-risk-management-client-preview-risk-matrix.command-gVKnE3c0.mjs').then((c) => c.AXMPreviewRiskMatrixCommand),
|
|
261
237
|
},
|
|
262
238
|
]),
|
|
263
239
|
], imports: [AXPWidgetCoreModule] }); }
|
|
@@ -269,11 +245,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
269
245
|
AXPWidgetCoreModule,
|
|
270
246
|
],
|
|
271
247
|
providers: [
|
|
272
|
-
{
|
|
273
|
-
provide: AXP_MODULE_MANIFEST_PROVIDER,
|
|
274
|
-
useValue: RiskManagementManifest,
|
|
275
|
-
multi: true,
|
|
276
|
-
},
|
|
277
248
|
provideLazyProvider(AXP_PERMISSION_DEFINITION_PROVIDER, () => Promise.resolve().then(function () { return permissionDefinition_provider; }).then((m) => m.AXMRiskManagementPermissionDefinitionProvider)),
|
|
278
249
|
provideLazyProvider(AXP_MENU_PROVIDER, () => Promise.resolve().then(function () { return menu_provider; }).then((m) => m.AXMRiskManagementMenuProvider)),
|
|
279
250
|
{
|
|
@@ -288,17 +259,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
288
259
|
},
|
|
289
260
|
provideCommandSetups([
|
|
290
261
|
{
|
|
291
|
-
key: `${RootConfig.module.name}.${RootConfig.entities.
|
|
292
|
-
command: () => import('./acorex-platform-module-risk-management-client-preview-risk-matrix
|
|
262
|
+
key: `${RootConfig.module.name}.${RootConfig.entities.riskMatrix.name}:Preview`,
|
|
263
|
+
command: () => import('./acorex-platform-module-risk-management-client-preview-risk-matrix.command-gVKnE3c0.mjs').then((c) => c.AXMPreviewRiskMatrixCommand),
|
|
293
264
|
},
|
|
294
265
|
]),
|
|
295
266
|
],
|
|
296
267
|
}]
|
|
297
268
|
}] });
|
|
298
269
|
|
|
299
|
-
//#region
|
|
270
|
+
//#region ----- Imports -----
|
|
300
271
|
//#endregion
|
|
301
|
-
//#region
|
|
272
|
+
//#region ----- Helpers -----
|
|
302
273
|
function isRiskMatrixAxisProperty(value) {
|
|
303
274
|
return typeof value === 'string' && RISK_MATRIX_AXIS_PROPERTIES.includes(value);
|
|
304
275
|
}
|
|
@@ -395,54 +366,84 @@ function toCanonicalMatrixData(display, orientation) {
|
|
|
395
366
|
return canonical;
|
|
396
367
|
}
|
|
397
368
|
/**
|
|
398
|
-
* Reads selected axis
|
|
399
|
-
*
|
|
369
|
+
* Reads selected axis **level codes** from a risk-matrix record.
|
|
370
|
+
* Codes come from the selected scale snapshot (`*.scale.levels`), never from scale entity ids.
|
|
400
371
|
*/
|
|
401
|
-
function
|
|
372
|
+
function resolveRiskMatrixAxisCodes(data, axis) {
|
|
402
373
|
if (data == null || typeof data !== 'object') {
|
|
403
374
|
return [];
|
|
404
375
|
}
|
|
405
376
|
const record = data;
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
377
|
+
if (axis === 'likelihood') {
|
|
378
|
+
const scale = record['likelihoodScale'];
|
|
379
|
+
return resolveRiskLikelihoodLevelCodes(scale?.levels);
|
|
380
|
+
}
|
|
381
|
+
if (axis === 'severity') {
|
|
382
|
+
const scale = record['severityScale'];
|
|
383
|
+
return resolveRiskSeverityLevelCodes(scale?.levels);
|
|
384
|
+
}
|
|
385
|
+
const scale = record['ratingScale'];
|
|
386
|
+
return resolveRiskRatingLevelCodes(scale?.levels);
|
|
410
387
|
}
|
|
411
|
-
/**
|
|
412
|
-
function
|
|
413
|
-
const
|
|
414
|
-
|
|
415
|
-
.
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
}
|
|
419
|
-
return item != null ? String(item) : '';
|
|
420
|
-
})
|
|
421
|
-
.filter((id) => id.length > 0);
|
|
388
|
+
/** Resolves a lookup uuid that may be stored as a string or `{ id }` row. */
|
|
389
|
+
function resolveRiskMatrixScaleId(value) {
|
|
390
|
+
const candidate = extractValue(value, 'id') ?? value;
|
|
391
|
+
if (typeof candidate === 'string' && candidate.trim().length > 0) {
|
|
392
|
+
return candidate.trim();
|
|
393
|
+
}
|
|
394
|
+
return undefined;
|
|
422
395
|
}
|
|
423
396
|
/**
|
|
424
|
-
*
|
|
425
|
-
*
|
|
397
|
+
* Create mode may have the snapshot (`ratingScale.id`) before `ratingScaleId` is committed.
|
|
398
|
+
* Edit mode has both after GET join.
|
|
426
399
|
*/
|
|
427
|
-
function
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
400
|
+
function resolveRiskMatrixScaleIdFromRecord(data, idField, snapshotField) {
|
|
401
|
+
if (data == null || typeof data !== 'object') {
|
|
402
|
+
return undefined;
|
|
403
|
+
}
|
|
404
|
+
const record = data;
|
|
405
|
+
return resolveRiskMatrixScaleId(record[idField]) ?? resolveRiskMatrixScaleId(record[snapshotField]);
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* Widget-context scale id: path `getValue` first, then the full record snapshot.
|
|
409
|
+
*/
|
|
410
|
+
function resolveRiskMatrixWidgetScaleId(getValue, data, idField, snapshotField) {
|
|
411
|
+
return (resolveRiskMatrixScaleId(getValue(idField)) ??
|
|
412
|
+
resolveRiskMatrixScaleId(getValue(snapshotField)) ??
|
|
413
|
+
resolveRiskMatrixScaleIdFromRecord(data, idField, snapshotField));
|
|
414
|
+
}
|
|
415
|
+
function asNonEmptyLevelArray(value) {
|
|
416
|
+
if (!Array.isArray(value) || value.length === 0) {
|
|
417
|
+
return undefined;
|
|
418
|
+
}
|
|
419
|
+
return value;
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* Nested `levels` from a lookup expose snapshot (`likelihoodScale.levels`, …).
|
|
423
|
+
* Empty arrays are treated as missing so create-mode can still fetch by id.
|
|
424
|
+
*/
|
|
425
|
+
function resolveRiskMatrixScaleLevels(data, snapshotField, levelsFromPath) {
|
|
426
|
+
const fromPath = asNonEmptyLevelArray(levelsFromPath);
|
|
427
|
+
if (fromPath) {
|
|
428
|
+
return fromPath;
|
|
429
|
+
}
|
|
430
|
+
if (data == null || typeof data !== 'object') {
|
|
431
|
+
return undefined;
|
|
432
|
+
}
|
|
433
|
+
const snapshot = data[snapshotField];
|
|
434
|
+
const fromSnapshotRoot = asNonEmptyLevelArray(snapshot);
|
|
435
|
+
if (fromSnapshotRoot) {
|
|
436
|
+
return fromSnapshotRoot;
|
|
437
|
+
}
|
|
438
|
+
if (snapshot == null || typeof snapshot !== 'object') {
|
|
439
|
+
return undefined;
|
|
440
|
+
}
|
|
441
|
+
const record = snapshot;
|
|
442
|
+
return asNonEmptyLevelArray(record.levels) ?? asNonEmptyLevelArray(record.items);
|
|
443
|
+
}
|
|
444
|
+
/** Widget-context scale levels: nested path, then snapshot on the record. */
|
|
445
|
+
function resolveRiskMatrixWidgetScaleLevels(getValue, data, snapshotField) {
|
|
446
|
+
return resolveRiskMatrixScaleLevels(data, snapshotField, getValue(`${snapshotField}.levels`));
|
|
446
447
|
}
|
|
447
448
|
function validateRiskMatrixAxisMapping(mapping) {
|
|
448
449
|
const rowProperty = mapping.rowProperty;
|
|
@@ -504,22 +505,35 @@ function resolveRiskRatingBadgeColor(rating) {
|
|
|
504
505
|
|
|
505
506
|
//#region ---- Imports ----
|
|
506
507
|
//#endregion
|
|
508
|
+
//#region ---- Constants ----
|
|
509
|
+
const SCALE_AXIS_QUERY_FIELDS = [
|
|
510
|
+
'id',
|
|
511
|
+
'code',
|
|
512
|
+
'title',
|
|
513
|
+
'levels',
|
|
514
|
+
'levels.id',
|
|
515
|
+
'levels.code',
|
|
516
|
+
'levels.title',
|
|
517
|
+
'levels.score',
|
|
518
|
+
'levels.color',
|
|
519
|
+
'levels.order',
|
|
520
|
+
];
|
|
521
|
+
//#endregion
|
|
507
522
|
//#region ---- Component Definition ----
|
|
508
523
|
class AXMRiskManagementRiskMatrixComponent {
|
|
509
524
|
//#endregion
|
|
510
525
|
//#region ---- Lifecycle Methods ----
|
|
511
526
|
constructor() {
|
|
512
|
-
//#endregion
|
|
513
527
|
//#region ---- Services & Dependencies ----
|
|
514
528
|
this.entityService = inject(AXPEntityService);
|
|
515
|
-
this.
|
|
516
|
-
.withEntity(RootConfig.module.name, RootConfig.entities.
|
|
529
|
+
this.likelihoodScaleDataAccessor = this.entityService
|
|
530
|
+
.withEntity(RootConfig.module.name, RootConfig.entities.riskLikelihoodScale.name)
|
|
517
531
|
.data();
|
|
518
|
-
this.
|
|
519
|
-
.withEntity(RootConfig.module.name, RootConfig.entities.
|
|
532
|
+
this.severityScaleDataAccessor = this.entityService
|
|
533
|
+
.withEntity(RootConfig.module.name, RootConfig.entities.riskSeverityScale.name)
|
|
520
534
|
.data();
|
|
521
|
-
this.
|
|
522
|
-
.withEntity(RootConfig.module.name, RootConfig.entities.
|
|
535
|
+
this.riskRatingScaleDataAccessor = this.entityService
|
|
536
|
+
.withEntity(RootConfig.module.name, RootConfig.entities.riskRatingScale.name)
|
|
523
537
|
.data();
|
|
524
538
|
this.multiLanguageResolver = inject(AXTranslationService);
|
|
525
539
|
//#endregion
|
|
@@ -527,15 +541,24 @@ class AXMRiskManagementRiskMatrixComponent {
|
|
|
527
541
|
/** Axis mapping. Defaults to likelihood × severity → risk rating. */
|
|
528
542
|
this.axisMapping = input({}, /* @ts-ignore */
|
|
529
543
|
...(ngDevMode ? [{ debugName: "axisMapping" }] : /* istanbul ignore next */ []));
|
|
530
|
-
/** Selected
|
|
531
|
-
this.
|
|
532
|
-
...(ngDevMode ? [{ debugName: "
|
|
533
|
-
this.
|
|
534
|
-
...(ngDevMode ? [{ debugName: "
|
|
535
|
-
|
|
544
|
+
/** Selected scale ids from the parent matrix record. Axes load from that scale's levels. */
|
|
545
|
+
this.likelihoodScaleId = input(null, /* @ts-ignore */
|
|
546
|
+
...(ngDevMode ? [{ debugName: "likelihoodScaleId" }] : /* istanbul ignore next */ []));
|
|
547
|
+
this.severityScaleId = input(null, /* @ts-ignore */
|
|
548
|
+
...(ngDevMode ? [{ debugName: "severityScaleId" }] : /* istanbul ignore next */ []));
|
|
549
|
+
this.ratingScaleId = input(null, /* @ts-ignore */
|
|
550
|
+
...(ngDevMode ? [{ debugName: "ratingScaleId" }] : /* istanbul ignore next */ []));
|
|
551
|
+
/** Lookup expose snapshots — used in create before (or instead of) byKey. */
|
|
552
|
+
this.likelihoodScaleLevels = input(null, /* @ts-ignore */
|
|
553
|
+
...(ngDevMode ? [{ debugName: "likelihoodScaleLevels" }] : /* istanbul ignore next */ []));
|
|
554
|
+
this.severityScaleLevels = input(null, /* @ts-ignore */
|
|
555
|
+
...(ngDevMode ? [{ debugName: "severityScaleLevels" }] : /* istanbul ignore next */ []));
|
|
556
|
+
this.ratingScaleLevels = input(null, /* @ts-ignore */
|
|
557
|
+
...(ngDevMode ? [{ debugName: "ratingScaleLevels" }] : /* istanbul ignore next */ []));
|
|
558
|
+
/** Controls row/column layout only; persisted cells stay likelihood × severity. */
|
|
536
559
|
this.matrixOrientation = input(null, /* @ts-ignore */
|
|
537
560
|
...(ngDevMode ? [{ debugName: "matrixOrientation" }] : /* istanbul ignore next */ []));
|
|
538
|
-
/**
|
|
561
|
+
/** Spreadsheet data keyed by **level codes**: { [likelihoodCode]: { [severityCode]: ratingCode } } */
|
|
539
562
|
this.value = input({}, /* @ts-ignore */
|
|
540
563
|
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
541
564
|
this.readonly = input(false, /* @ts-ignore */
|
|
@@ -552,10 +575,8 @@ class AXMRiskManagementRiskMatrixComponent {
|
|
|
552
575
|
...(ngDevMode ? [{ debugName: "severityItems" }] : /* istanbul ignore next */ []));
|
|
553
576
|
this.depthItems = signal([], /* @ts-ignore */
|
|
554
577
|
...(ngDevMode ? [{ debugName: "depthItems" }] : /* istanbul ignore next */ []));
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
this.isLoading = signal(false, /* @ts-ignore */
|
|
558
|
-
...(ngDevMode ? [{ debugName: "isLoading" }] : /* istanbul ignore next */ []));
|
|
578
|
+
/** Drops overlapping create-mode loads so an earlier request cannot wipe later rating levels. */
|
|
579
|
+
this.loadAxesRequestId = 0;
|
|
559
580
|
//#endregion
|
|
560
581
|
//#region ---- Computed Properties ----
|
|
561
582
|
this.resolvedMatrixOrientation = computed(() => resolveRiskMatrixOrientation(this.matrixOrientation()), /* @ts-ignore */
|
|
@@ -564,6 +585,19 @@ class AXMRiskManagementRiskMatrixComponent {
|
|
|
564
585
|
...(ngDevMode ? [{ debugName: "resolvedAxisMapping" }] : /* istanbul ignore next */ []));
|
|
565
586
|
this.displayMatrix = computed(() => toDisplayMatrixData(this.value(), this.resolvedMatrixOrientation()), /* @ts-ignore */
|
|
566
587
|
...(ngDevMode ? [{ debugName: "displayMatrix" }] : /* istanbul ignore next */ []));
|
|
588
|
+
this.spreadsheetIdentity = computed(() => [
|
|
589
|
+
this.resolvedMatrixOrientation(),
|
|
590
|
+
this.likelihoodScaleId() ?? '',
|
|
591
|
+
this.severityScaleId() ?? '',
|
|
592
|
+
this.ratingScaleId() ?? '',
|
|
593
|
+
this.depthItems()
|
|
594
|
+
.map((item) => item.id)
|
|
595
|
+
.join(','),
|
|
596
|
+
].join('|'), /* @ts-ignore */
|
|
597
|
+
...(ngDevMode ? [{ debugName: "spreadsheetIdentity" }] : /* istanbul ignore next */ []));
|
|
598
|
+
/** Create mode: do not open empty cell editors before rating levels are loaded. */
|
|
599
|
+
this.cellSelectLocked = computed(() => !!this.ratingScaleId() && this.depthItems().length === 0, /* @ts-ignore */
|
|
600
|
+
...(ngDevMode ? [{ debugName: "cellSelectLocked" }] : /* istanbul ignore next */ []));
|
|
567
601
|
this.matrixTitleKey = computed(() => resolveRiskMatrixTitleKey(this.resolvedMatrixOrientation()), /* @ts-ignore */
|
|
568
602
|
...(ngDevMode ? [{ debugName: "matrixTitleKey" }] : /* istanbul ignore next */ []));
|
|
569
603
|
this.verticalTitles = computed(() => this.toSpreadsheetItems(this.resolvedRowItems()), /* @ts-ignore */
|
|
@@ -586,26 +620,25 @@ class AXMRiskManagementRiskMatrixComponent {
|
|
|
586
620
|
const horizontalTitles = this.horizontalTitles();
|
|
587
621
|
const ratingItems = this.depthItems();
|
|
588
622
|
const cellOptions = this.toSpreadsheetItems(ratingItems);
|
|
589
|
-
const selectBoxWidget = {
|
|
590
|
-
type: AXPWidgetsList.Editors.SelectBox,
|
|
591
|
-
options: {
|
|
592
|
-
valueField: 'id',
|
|
593
|
-
textField: 'title',
|
|
594
|
-
cssClassField: 'color',
|
|
595
|
-
dataSource: cellOptions.map((option, index) => ({
|
|
596
|
-
id: option.id,
|
|
597
|
-
title: option.title,
|
|
598
|
-
description: option.description,
|
|
599
|
-
color: ratingItems[index]?.color,
|
|
600
|
-
})),
|
|
601
|
-
},
|
|
602
|
-
};
|
|
603
623
|
return horizontalTitles.map((title) => ({
|
|
604
624
|
name: title.id,
|
|
605
625
|
title: title.title,
|
|
606
626
|
description: title.description,
|
|
607
627
|
path: title.id,
|
|
608
|
-
widget:
|
|
628
|
+
widget: {
|
|
629
|
+
type: AXPWidgetsList.Editors.SelectBox,
|
|
630
|
+
options: {
|
|
631
|
+
valueField: 'id',
|
|
632
|
+
textField: 'title',
|
|
633
|
+
cssClassField: 'color',
|
|
634
|
+
dataSource: cellOptions.map((option, index) => ({
|
|
635
|
+
id: option.id,
|
|
636
|
+
title: option.title,
|
|
637
|
+
description: option.description,
|
|
638
|
+
color: ratingItems[index]?.color,
|
|
639
|
+
})),
|
|
640
|
+
},
|
|
641
|
+
},
|
|
609
642
|
}));
|
|
610
643
|
}, /* @ts-ignore */
|
|
611
644
|
...(ngDevMode ? [{ debugName: "spreadsheetColumns" }] : /* istanbul ignore next */ []));
|
|
@@ -627,77 +660,164 @@ class AXMRiskManagementRiskMatrixComponent {
|
|
|
627
660
|
}, /* @ts-ignore */
|
|
628
661
|
...(ngDevMode ? [{ debugName: "spreadsheetRows" }] : /* istanbul ignore next */ []));
|
|
629
662
|
effect(() => {
|
|
630
|
-
const
|
|
631
|
-
const
|
|
632
|
-
|
|
663
|
+
const likelihoodScaleId = this.likelihoodScaleId();
|
|
664
|
+
const severityScaleId = this.severityScaleId();
|
|
665
|
+
const ratingScaleId = this.ratingScaleId();
|
|
666
|
+
const likelihoodScaleLevels = this.likelihoodScaleLevels();
|
|
667
|
+
const severityScaleLevels = this.severityScaleLevels();
|
|
668
|
+
const ratingScaleLevels = this.ratingScaleLevels();
|
|
669
|
+
void this.loadMatrixAxes(likelihoodScaleId, severityScaleId, ratingScaleId, likelihoodScaleLevels, severityScaleLevels, ratingScaleLevels);
|
|
633
670
|
});
|
|
634
671
|
}
|
|
635
672
|
//#endregion
|
|
636
673
|
//#region ---- Data Loading Methods ----
|
|
637
|
-
async loadMatrixAxes(
|
|
638
|
-
const
|
|
674
|
+
async loadMatrixAxes(likelihoodScaleId, severityScaleId, ratingScaleId, likelihoodScaleLevels, severityScaleLevels, ratingScaleLevels) {
|
|
675
|
+
const requestId = ++this.loadAxesRequestId;
|
|
676
|
+
const snapshotLikelihood = this.mapLikelihoodLevels(likelihoodScaleLevels);
|
|
677
|
+
const snapshotSeverity = this.mapSeverityLevels(severityScaleLevels);
|
|
678
|
+
const snapshotRating = this.mapRatingLevels(ratingScaleLevels);
|
|
679
|
+
const hasSnapshotAxes = snapshotLikelihood.length > 0 || snapshotSeverity.length > 0 || snapshotRating.length > 0;
|
|
680
|
+
if (!likelihoodScaleId && !severityScaleId && !ratingScaleId && !hasSnapshotAxes) {
|
|
681
|
+
this.likelihoodItems.set([]);
|
|
682
|
+
this.severityItems.set([]);
|
|
683
|
+
this.depthItems.set([]);
|
|
684
|
+
return;
|
|
685
|
+
}
|
|
686
|
+
if (snapshotLikelihood.length > 0) {
|
|
687
|
+
this.likelihoodItems.set(snapshotLikelihood);
|
|
688
|
+
}
|
|
689
|
+
if (snapshotSeverity.length > 0) {
|
|
690
|
+
this.severityItems.set(snapshotSeverity);
|
|
691
|
+
}
|
|
692
|
+
if (snapshotRating.length > 0) {
|
|
693
|
+
this.depthItems.set(snapshotRating);
|
|
694
|
+
}
|
|
695
|
+
if (!likelihoodScaleId && !severityScaleId && !ratingScaleId) {
|
|
696
|
+
return;
|
|
697
|
+
}
|
|
639
698
|
try {
|
|
640
|
-
if (isInitialLoad) {
|
|
641
|
-
this.isLoading.set(true);
|
|
642
|
-
}
|
|
643
|
-
const query = {
|
|
644
|
-
skip: 0,
|
|
645
|
-
take: 1000,
|
|
646
|
-
sort: [{ field: 'levelValue', dir: 'asc' }],
|
|
647
|
-
};
|
|
648
699
|
const [likelihoodResult, severityResult, depthResult] = await Promise.all([
|
|
649
|
-
this.queryAxisItems(
|
|
650
|
-
this.queryAxisItems(
|
|
651
|
-
this.queryAxisItems(
|
|
700
|
+
this.queryAxisItems(this.likelihoodScaleDataAccessor, likelihoodScaleId, (levels) => this.mapLikelihoodLevels(levels), likelihoodScaleLevels),
|
|
701
|
+
this.queryAxisItems(this.severityScaleDataAccessor, severityScaleId, (levels) => this.mapSeverityLevels(levels), severityScaleLevels),
|
|
702
|
+
this.queryAxisItems(this.riskRatingScaleDataAccessor, ratingScaleId, (levels) => this.mapRatingLevels(levels), ratingScaleLevels),
|
|
652
703
|
]);
|
|
653
|
-
this.
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
this.
|
|
704
|
+
if (requestId !== this.loadAxesRequestId) {
|
|
705
|
+
return;
|
|
706
|
+
}
|
|
707
|
+
this.applyAxisItems(this.likelihoodItems, likelihoodResult, snapshotLikelihood);
|
|
708
|
+
this.applyAxisItems(this.severityItems, severityResult, snapshotSeverity);
|
|
709
|
+
this.applyAxisItems(this.depthItems, depthResult, snapshotRating);
|
|
657
710
|
}
|
|
658
711
|
catch (error) {
|
|
712
|
+
if (requestId !== this.loadAxesRequestId) {
|
|
713
|
+
return;
|
|
714
|
+
}
|
|
659
715
|
console.error('Error loading risk matrix axes:', error);
|
|
660
|
-
this.
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
finally {
|
|
665
|
-
if (isInitialLoad) {
|
|
666
|
-
this.isLoading.set(false);
|
|
716
|
+
if (!hasSnapshotAxes && this.depthItems().length === 0) {
|
|
717
|
+
this.likelihoodItems.set([]);
|
|
718
|
+
this.severityItems.set([]);
|
|
719
|
+
this.depthItems.set([]);
|
|
667
720
|
}
|
|
668
721
|
}
|
|
669
722
|
}
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
723
|
+
applyAxisItems(target, fetched, snapshot) {
|
|
724
|
+
if (fetched.length > 0) {
|
|
725
|
+
target.set(fetched);
|
|
726
|
+
return;
|
|
727
|
+
}
|
|
728
|
+
if (snapshot.length > 0) {
|
|
729
|
+
target.set(snapshot);
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
async queryAxisItems(accessor, scaleId, mapLevels, snapshotLevels) {
|
|
733
|
+
const snapshot = mapLevels(snapshotLevels);
|
|
734
|
+
const scale = await this.loadScaleWithLevels(accessor, scaleId);
|
|
735
|
+
const fetched = mapLevels(this.readScaleLevels(scale));
|
|
736
|
+
return fetched.length > 0 ? fetched : snapshot;
|
|
737
|
+
}
|
|
738
|
+
readScaleLevels(scale) {
|
|
739
|
+
if (!scale || typeof scale !== 'object') {
|
|
740
|
+
return undefined;
|
|
741
|
+
}
|
|
742
|
+
const levels = scale.levels ?? scale.items;
|
|
743
|
+
return Array.isArray(levels) && levels.length > 0 ? levels : undefined;
|
|
744
|
+
}
|
|
745
|
+
mapLikelihoodLevels(levels) {
|
|
746
|
+
return this.mapAxisLevels(sortRiskLikelihoodLevels(levels));
|
|
747
|
+
}
|
|
748
|
+
mapSeverityLevels(levels) {
|
|
749
|
+
return this.mapAxisLevels(sortRiskSeverityLevels(levels));
|
|
750
|
+
}
|
|
751
|
+
mapRatingLevels(levels) {
|
|
752
|
+
return this.mapAxisLevels(sortRiskRatingLevels(levels), (level) => {
|
|
753
|
+
const color = ensureRuntimeSurfaceClass(resolveRiskRatingBadgeColor(level));
|
|
754
|
+
return color ? { color } : {};
|
|
685
755
|
});
|
|
686
|
-
|
|
687
|
-
|
|
756
|
+
}
|
|
757
|
+
mapAxisLevels(levels, extra) {
|
|
758
|
+
return levels
|
|
759
|
+
.map((level) => {
|
|
760
|
+
const id = this.toAxisLevelKey(level);
|
|
761
|
+
return {
|
|
762
|
+
id,
|
|
763
|
+
title: level.title,
|
|
764
|
+
...(extra?.(level) ?? {}),
|
|
765
|
+
};
|
|
766
|
+
})
|
|
767
|
+
.filter((item) => item.id.length > 0);
|
|
768
|
+
}
|
|
769
|
+
toAxisLevelKey(level) {
|
|
770
|
+
if (level == null) {
|
|
771
|
+
return '';
|
|
772
|
+
}
|
|
773
|
+
const code = level.code;
|
|
774
|
+
if (typeof code === 'string' && code.trim()) {
|
|
775
|
+
return code.trim();
|
|
688
776
|
}
|
|
689
|
-
|
|
690
|
-
|
|
777
|
+
if (typeof code === 'number' && Number.isFinite(code)) {
|
|
778
|
+
return String(code);
|
|
779
|
+
}
|
|
780
|
+
const id = level.id;
|
|
781
|
+
if (typeof id === 'string' && id.trim()) {
|
|
782
|
+
return id.trim();
|
|
783
|
+
}
|
|
784
|
+
if (typeof id === 'number' && Number.isFinite(id)) {
|
|
785
|
+
return String(id);
|
|
786
|
+
}
|
|
787
|
+
return '';
|
|
691
788
|
}
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
789
|
+
async loadScaleWithLevels(accessor, scaleId) {
|
|
790
|
+
if (!scaleId) {
|
|
791
|
+
return null;
|
|
792
|
+
}
|
|
793
|
+
const fromQuery = await this.queryScaleById(accessor, scaleId);
|
|
794
|
+
if (this.readScaleLevels(fromQuery)) {
|
|
795
|
+
return fromQuery;
|
|
796
|
+
}
|
|
797
|
+
try {
|
|
798
|
+
const fromByKey = (await accessor.byKey(scaleId)) ?? null;
|
|
799
|
+
return this.readScaleLevels(fromByKey) ? fromByKey : fromQuery ?? fromByKey;
|
|
800
|
+
}
|
|
801
|
+
catch {
|
|
802
|
+
return fromQuery;
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
async queryScaleById(accessor, scaleId) {
|
|
806
|
+
try {
|
|
807
|
+
const page = await accessor.query({
|
|
808
|
+
skip: 0,
|
|
809
|
+
take: 1,
|
|
810
|
+
fields: [...SCALE_AXIS_QUERY_FIELDS],
|
|
811
|
+
filter: {
|
|
812
|
+
field: 'id',
|
|
813
|
+
operator: { type: 'equal' },
|
|
814
|
+
value: scaleId,
|
|
815
|
+
},
|
|
816
|
+
});
|
|
817
|
+
return page?.items?.[0] ?? null;
|
|
818
|
+
}
|
|
819
|
+
catch {
|
|
820
|
+
return null;
|
|
701
821
|
}
|
|
702
822
|
}
|
|
703
823
|
//#endregion
|
|
@@ -735,14 +855,14 @@ class AXMRiskManagementRiskMatrixComponent {
|
|
|
735
855
|
this.cellChange.emit(event);
|
|
736
856
|
}
|
|
737
857
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMRiskManagementRiskMatrixComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
738
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: AXMRiskManagementRiskMatrixComponent, isStandalone: true, selector: "axm-risk-matrix", inputs: { axisMapping: { classPropertyName: "axisMapping", publicName: "axisMapping", isSignal: true, isRequired: false, transformFunction: null },
|
|
858
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: AXMRiskManagementRiskMatrixComponent, isStandalone: true, selector: "axm-risk-matrix", inputs: { axisMapping: { classPropertyName: "axisMapping", publicName: "axisMapping", isSignal: true, isRequired: false, transformFunction: null }, likelihoodScaleId: { classPropertyName: "likelihoodScaleId", publicName: "likelihoodScaleId", isSignal: true, isRequired: false, transformFunction: null }, severityScaleId: { classPropertyName: "severityScaleId", publicName: "severityScaleId", isSignal: true, isRequired: false, transformFunction: null }, ratingScaleId: { classPropertyName: "ratingScaleId", publicName: "ratingScaleId", isSignal: true, isRequired: false, transformFunction: null }, likelihoodScaleLevels: { classPropertyName: "likelihoodScaleLevels", publicName: "likelihoodScaleLevels", isSignal: true, isRequired: false, transformFunction: null }, severityScaleLevels: { classPropertyName: "severityScaleLevels", publicName: "severityScaleLevels", isSignal: true, isRequired: false, transformFunction: null }, ratingScaleLevels: { classPropertyName: "ratingScaleLevels", publicName: "ratingScaleLevels", isSignal: true, isRequired: false, transformFunction: null }, matrixOrientation: { classPropertyName: "matrixOrientation", publicName: "matrixOrientation", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange", cellChange: "cellChange" }, host: { classAttribute: "axm-risk-matrix" }, ngImport: i0, template: "<div class=\"__container\">\n <div class=\"__matrix-section\">\n @for (_ of [spreadsheetIdentity()]; track _) {\n <axp-spreadsheet\n [title]=\"(matrixTitleKey() | translate | async) ?? ''\"\n [columns]=\"spreadsheetColumns()\"\n [rowsInput]=\"spreadsheetRows()\"\n [rowMode]=\"'fixed'\"\n [readonly]=\"readonly() || cellSelectLocked()\"\n [allowRemoveRows]=\"false\"\n [rowTitlePath]=\"'_rowTitle'\"\n [rowDescriptionPath]=\"'_rowDescription'\"\n (cellChange)=\"handleCellChange($event)\"\n (spreadsheetChange)=\"handleSpreadsheetChange($event)\"\n ></axp-spreadsheet>\n }\n </div>\n</div>\n", styles: [".axm-risk-matrix{--axm-risk-matrix-line: rgb(var(--ax-sys-color-border-surface));display:block;height:100%;width:100%}.axm-risk-matrix .__container,.axm-risk-matrix .__matrix-section{display:flex;flex-direction:column}.axm-risk-matrix .axp-spreadsheet .__spreadsheet-container{border:1px solid var(--axm-risk-matrix-line)}.axm-risk-matrix .axp-spreadsheet .__table .__thead .__header-row .__corner-cell,.axm-risk-matrix .axp-spreadsheet .__table .__thead .__header-row .__column-header,.axm-risk-matrix .axp-spreadsheet .__table .__tbody .__row .__row-header{background-color:rgb(var(--ax-sys-color-lighter-surface));color:rgb(var(--ax-sys-color-on-lighter-surface))}.axm-risk-matrix .axp-spreadsheet .__table .__thead .__header-row .__corner-cell,.axm-risk-matrix .axp-spreadsheet .__table .__thead .__header-row .__column-header,.axm-risk-matrix .axp-spreadsheet .__table .__tbody .__row .__row-header,.axm-risk-matrix .axp-spreadsheet .__table .__tbody .__row .__cell{border:0;border-inline-end:1px solid var(--axm-risk-matrix-line);border-bottom:1px solid var(--axm-risk-matrix-line)}.axm-risk-matrix .axp-spreadsheet .__table .__thead .__header-row .__column-header:last-child,.axm-risk-matrix .axp-spreadsheet .__table .__tbody .__row .__cell:last-child{border-inline-end:0}.axm-risk-matrix .axp-spreadsheet .__table .__tbody tr.__row:last-of-type .__row-header,.axm-risk-matrix .axp-spreadsheet .__table .__tbody tr.__row:last-of-type .__cell{border-bottom:0}.axm-risk-matrix .axp-spreadsheet .__table .__tbody .__row .__cell:not(.__cell--editing){padding:0}.axm-risk-matrix .axp-spreadsheet .__table .__tbody .__row .__cell:not(.__cell--editing):before{z-index:1}.axm-risk-matrix .axp-spreadsheet .__table .__tbody .__row .__cell:not(.__cell--editing) .__cell-value{display:block;height:100%;min-height:100%;padding:0}.axm-risk-matrix .axp-spreadsheet .__table .__tbody .__row .__cell:not(.__cell--editing) .__cell-value>*{display:block;height:100%;min-height:100%}.axm-risk-matrix .axp-spreadsheet .__table .__tbody .__row .__cell:not(.__cell--editing) .__cell-value [class*=-surface],.axm-risk-matrix .axp-spreadsheet .__table .__tbody .__row .__cell:not(.__cell--editing) .__cell-value [class*=axp-hex-]{position:absolute;inset:0;z-index:0;display:flex;align-items:center;justify-content:center;width:auto;height:auto;margin:0;border-width:0;border-radius:0;padding:.5rem .75rem;font-size:.875rem;font-weight:500}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"], dependencies: [{ kind: "component", type: AXPSpreadsheetComponent, selector: "axp-spreadsheet", inputs: ["title", "columns", "rowMode", "rowsInput", "rowsModel", "readonly", "emptyCellPlaceholder", "rowTitlePath", "rowDescriptionPath", "allowAddRows", "allowRemoveRows", "allowAddColumns", "allowRemoveColumns", "showCellActions"], outputs: ["rowsModelChange", "cellChange", "rowChange", "columnChange", "columnsChange", "spreadsheetChange"] }, { kind: "ngmodule", type: AXTranslationModule }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "pipe", type: i1.AXTranslatorPipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
739
859
|
}
|
|
740
860
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMRiskManagementRiskMatrixComponent, decorators: [{
|
|
741
861
|
type: Component,
|
|
742
|
-
args: [{ selector: 'axm-risk-matrix', standalone: true, imports: [
|
|
862
|
+
args: [{ selector: 'axm-risk-matrix', standalone: true, imports: [AsyncPipe, AXPSpreadsheetComponent, AXTranslationModule], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
743
863
|
class: 'axm-risk-matrix',
|
|
744
|
-
}, template: "<div class=\"__container\">\n <div class=\"__matrix-section\">\n @
|
|
745
|
-
}], ctorParameters: () => [], propDecorators: { axisMapping: [{ type: i0.Input, args: [{ isSignal: true, alias: "axisMapping", required: false }] }],
|
|
864
|
+
}, template: "<div class=\"__container\">\n <div class=\"__matrix-section\">\n @for (_ of [spreadsheetIdentity()]; track _) {\n <axp-spreadsheet\n [title]=\"(matrixTitleKey() | translate | async) ?? ''\"\n [columns]=\"spreadsheetColumns()\"\n [rowsInput]=\"spreadsheetRows()\"\n [rowMode]=\"'fixed'\"\n [readonly]=\"readonly() || cellSelectLocked()\"\n [allowRemoveRows]=\"false\"\n [rowTitlePath]=\"'_rowTitle'\"\n [rowDescriptionPath]=\"'_rowDescription'\"\n (cellChange)=\"handleCellChange($event)\"\n (spreadsheetChange)=\"handleSpreadsheetChange($event)\"\n ></axp-spreadsheet>\n }\n </div>\n</div>\n", styles: [".axm-risk-matrix{--axm-risk-matrix-line: rgb(var(--ax-sys-color-border-surface));display:block;height:100%;width:100%}.axm-risk-matrix .__container,.axm-risk-matrix .__matrix-section{display:flex;flex-direction:column}.axm-risk-matrix .axp-spreadsheet .__spreadsheet-container{border:1px solid var(--axm-risk-matrix-line)}.axm-risk-matrix .axp-spreadsheet .__table .__thead .__header-row .__corner-cell,.axm-risk-matrix .axp-spreadsheet .__table .__thead .__header-row .__column-header,.axm-risk-matrix .axp-spreadsheet .__table .__tbody .__row .__row-header{background-color:rgb(var(--ax-sys-color-lighter-surface));color:rgb(var(--ax-sys-color-on-lighter-surface))}.axm-risk-matrix .axp-spreadsheet .__table .__thead .__header-row .__corner-cell,.axm-risk-matrix .axp-spreadsheet .__table .__thead .__header-row .__column-header,.axm-risk-matrix .axp-spreadsheet .__table .__tbody .__row .__row-header,.axm-risk-matrix .axp-spreadsheet .__table .__tbody .__row .__cell{border:0;border-inline-end:1px solid var(--axm-risk-matrix-line);border-bottom:1px solid var(--axm-risk-matrix-line)}.axm-risk-matrix .axp-spreadsheet .__table .__thead .__header-row .__column-header:last-child,.axm-risk-matrix .axp-spreadsheet .__table .__tbody .__row .__cell:last-child{border-inline-end:0}.axm-risk-matrix .axp-spreadsheet .__table .__tbody tr.__row:last-of-type .__row-header,.axm-risk-matrix .axp-spreadsheet .__table .__tbody tr.__row:last-of-type .__cell{border-bottom:0}.axm-risk-matrix .axp-spreadsheet .__table .__tbody .__row .__cell:not(.__cell--editing){padding:0}.axm-risk-matrix .axp-spreadsheet .__table .__tbody .__row .__cell:not(.__cell--editing):before{z-index:1}.axm-risk-matrix .axp-spreadsheet .__table .__tbody .__row .__cell:not(.__cell--editing) .__cell-value{display:block;height:100%;min-height:100%;padding:0}.axm-risk-matrix .axp-spreadsheet .__table .__tbody .__row .__cell:not(.__cell--editing) .__cell-value>*{display:block;height:100%;min-height:100%}.axm-risk-matrix .axp-spreadsheet .__table .__tbody .__row .__cell:not(.__cell--editing) .__cell-value [class*=-surface],.axm-risk-matrix .axp-spreadsheet .__table .__tbody .__row .__cell:not(.__cell--editing) .__cell-value [class*=axp-hex-]{position:absolute;inset:0;z-index:0;display:flex;align-items:center;justify-content:center;width:auto;height:auto;margin:0;border-width:0;border-radius:0;padding:.5rem .75rem;font-size:.875rem;font-weight:500}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"] }]
|
|
865
|
+
}], ctorParameters: () => [], propDecorators: { axisMapping: [{ type: i0.Input, args: [{ isSignal: true, alias: "axisMapping", required: false }] }], likelihoodScaleId: [{ type: i0.Input, args: [{ isSignal: true, alias: "likelihoodScaleId", required: false }] }], severityScaleId: [{ type: i0.Input, args: [{ isSignal: true, alias: "severityScaleId", required: false }] }], ratingScaleId: [{ type: i0.Input, args: [{ isSignal: true, alias: "ratingScaleId", required: false }] }], likelihoodScaleLevels: [{ type: i0.Input, args: [{ isSignal: true, alias: "likelihoodScaleLevels", required: false }] }], severityScaleLevels: [{ type: i0.Input, args: [{ isSignal: true, alias: "severityScaleLevels", required: false }] }], ratingScaleLevels: [{ type: i0.Input, args: [{ isSignal: true, alias: "ratingScaleLevels", required: false }] }], matrixOrientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "matrixOrientation", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], valueChange: [{ type: i0.Output, args: ["valueChange"] }], cellChange: [{ type: i0.Output, args: ["cellChange"] }] } });
|
|
746
866
|
|
|
747
867
|
//#region ---- Imports ----
|
|
748
868
|
//#endregion
|
|
@@ -759,7 +879,7 @@ class AXMRiskMatrixViewerService {
|
|
|
759
879
|
//#endregion
|
|
760
880
|
//#region ---- Public API ----
|
|
761
881
|
async open(options) {
|
|
762
|
-
const matrixPath = defaultTo(options.matrixPath, '
|
|
882
|
+
const matrixPath = defaultTo(options.matrixPath, 'cells');
|
|
763
883
|
const matrixValue = get(options.context, matrixPath);
|
|
764
884
|
if (isEmpty(matrixValue)) {
|
|
765
885
|
return;
|
|
@@ -804,7 +924,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
804
924
|
//#endregion
|
|
805
925
|
//#region ---- Viewer Open Helper ----
|
|
806
926
|
function buildRiskMatrixViewerOpenOptions(params) {
|
|
807
|
-
const matrixPath = params.matrixPath ?? '
|
|
927
|
+
const matrixPath = params.matrixPath ?? 'cells';
|
|
808
928
|
const title = params.data
|
|
809
929
|
? resolveEntityRowDisplayTitle({
|
|
810
930
|
data: params.data,
|
|
@@ -853,7 +973,7 @@ class AXMRiskMatrixWidgetColumnComponent extends AXPColumnWidgetComponent {
|
|
|
853
973
|
widgetOptions: { ...this.options },
|
|
854
974
|
formatService: this.formatService,
|
|
855
975
|
activeLang: this.translation.getActiveLang(),
|
|
856
|
-
fallbackTitleKey: '@risk-management:risk-
|
|
976
|
+
fallbackTitleKey: '@risk-management:risk-matrices.entities.risk-matrix.fields.cells.title',
|
|
857
977
|
});
|
|
858
978
|
}
|
|
859
979
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMRiskMatrixWidgetColumnComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
@@ -869,7 +989,7 @@ class AXMRiskMatrixWidgetColumnComponent extends AXPColumnWidgetComponent {
|
|
|
869
989
|
<span>-</span>
|
|
870
990
|
}
|
|
871
991
|
</div>
|
|
872
|
-
`, isInline: true, dependencies: [{ kind: "ngmodule", type: AXButtonModule }, { kind: "component", type: i1$1.AXButtonComponent, selector: "ax-button", inputs: ["disabled", "tabIndex", "color", "look", "text", "toggleable", "selected", "iconOnly", "type", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "loadingTextChange"] }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: i2
|
|
992
|
+
`, isInline: true, dependencies: [{ kind: "ngmodule", type: AXButtonModule }, { kind: "component", type: i1$1.AXButtonComponent, selector: "ax-button", inputs: ["disabled", "tabIndex", "color", "look", "text", "toggleable", "selected", "iconOnly", "type", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "loadingTextChange"] }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: i2.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
873
993
|
}
|
|
874
994
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMRiskMatrixWidgetColumnComponent, decorators: [{
|
|
875
995
|
type: Component,
|
|
@@ -928,27 +1048,63 @@ class AXMRiskMatrixWidgetEditComponent extends AXPValueWidgetComponent {
|
|
|
928
1048
|
return resolveRiskMatrixOrientation(get(this.contextService.data(), 'matrixOrientation'));
|
|
929
1049
|
}, /* @ts-ignore */
|
|
930
1050
|
...(ngDevMode ? [{ debugName: "matrixOrientation" }] : /* istanbul ignore next */ []));
|
|
931
|
-
this.
|
|
1051
|
+
this.likelihoodScaleId = computed(() => {
|
|
932
1052
|
this.contextService.changeEvent();
|
|
933
|
-
return
|
|
1053
|
+
return this.resolveScaleId('likelihoodScaleId', 'likelihoodScale');
|
|
934
1054
|
}, /* @ts-ignore */
|
|
935
|
-
...(ngDevMode ? [{ debugName: "
|
|
936
|
-
this.
|
|
1055
|
+
...(ngDevMode ? [{ debugName: "likelihoodScaleId" }] : /* istanbul ignore next */ []));
|
|
1056
|
+
this.severityScaleId = computed(() => {
|
|
937
1057
|
this.contextService.changeEvent();
|
|
938
|
-
return
|
|
1058
|
+
return this.resolveScaleId('severityScaleId', 'severityScale');
|
|
939
1059
|
}, /* @ts-ignore */
|
|
940
|
-
...(ngDevMode ? [{ debugName: "
|
|
1060
|
+
...(ngDevMode ? [{ debugName: "severityScaleId" }] : /* istanbul ignore next */ []));
|
|
1061
|
+
this.ratingScaleId = computed(() => {
|
|
1062
|
+
this.contextService.changeEvent();
|
|
1063
|
+
return this.resolveScaleId('ratingScaleId', 'ratingScale');
|
|
1064
|
+
}, /* @ts-ignore */
|
|
1065
|
+
...(ngDevMode ? [{ debugName: "ratingScaleId" }] : /* istanbul ignore next */ []));
|
|
1066
|
+
this.likelihoodScaleLevels = computed(() => {
|
|
1067
|
+
this.contextService.changeEvent();
|
|
1068
|
+
return this.resolveScaleLevels('likelihoodScale');
|
|
1069
|
+
}, /* @ts-ignore */
|
|
1070
|
+
...(ngDevMode ? [{ debugName: "likelihoodScaleLevels" }] : /* istanbul ignore next */ []));
|
|
1071
|
+
this.severityScaleLevels = computed(() => {
|
|
1072
|
+
this.contextService.changeEvent();
|
|
1073
|
+
return this.resolveScaleLevels('severityScale');
|
|
1074
|
+
}, /* @ts-ignore */
|
|
1075
|
+
...(ngDevMode ? [{ debugName: "severityScaleLevels" }] : /* istanbul ignore next */ []));
|
|
1076
|
+
this.ratingScaleLevels = computed(() => {
|
|
1077
|
+
this.contextService.changeEvent();
|
|
1078
|
+
return this.resolveScaleLevels('ratingScale');
|
|
1079
|
+
}, /* @ts-ignore */
|
|
1080
|
+
...(ngDevMode ? [{ debugName: "ratingScaleLevels" }] : /* istanbul ignore next */ []));
|
|
1081
|
+
this.likelihoodCodes = computed(() => {
|
|
1082
|
+
this.contextService.changeEvent();
|
|
1083
|
+
return resolveRiskMatrixAxisCodes(this.contextService.data(), 'likelihood');
|
|
1084
|
+
}, /* @ts-ignore */
|
|
1085
|
+
...(ngDevMode ? [{ debugName: "likelihoodCodes" }] : /* istanbul ignore next */ []));
|
|
1086
|
+
this.severityCodes = computed(() => {
|
|
1087
|
+
this.contextService.changeEvent();
|
|
1088
|
+
return resolveRiskMatrixAxisCodes(this.contextService.data(), 'severity');
|
|
1089
|
+
}, /* @ts-ignore */
|
|
1090
|
+
...(ngDevMode ? [{ debugName: "severityCodes" }] : /* istanbul ignore next */ []));
|
|
1091
|
+
this.ratingCodes = computed(() => {
|
|
1092
|
+
this.contextService.changeEvent();
|
|
1093
|
+
return resolveRiskMatrixAxisCodes(this.contextService.data(), 'rating');
|
|
1094
|
+
}, /* @ts-ignore */
|
|
1095
|
+
...(ngDevMode ? [{ debugName: "ratingCodes" }] : /* istanbul ignore next */ []));
|
|
941
1096
|
this.matrixValue = computed(() => {
|
|
942
|
-
return this.getValue()
|
|
1097
|
+
return toRiskMatrixSpreadsheetData(resolveRiskMatrixCells(this.getValue()));
|
|
943
1098
|
}, /* @ts-ignore */
|
|
944
1099
|
...(ngDevMode ? [{ debugName: "matrixValue" }] : /* istanbul ignore next */ []));
|
|
945
1100
|
effect(() => {
|
|
946
|
-
const
|
|
947
|
-
const
|
|
948
|
-
const
|
|
949
|
-
const
|
|
950
|
-
|
|
951
|
-
|
|
1101
|
+
const likelihoodCodes = this.likelihoodCodes();
|
|
1102
|
+
const severityCodes = this.severityCodes();
|
|
1103
|
+
const ratingCodes = this.ratingCodes();
|
|
1104
|
+
const cells = resolveRiskMatrixCells(this.getValue());
|
|
1105
|
+
const prunedCells = pruneRiskMatrixCells(cells, likelihoodCodes, severityCodes, ratingCodes);
|
|
1106
|
+
if (!isEqual(cells, prunedCells)) {
|
|
1107
|
+
this.setValue(prunedCells);
|
|
952
1108
|
}
|
|
953
1109
|
});
|
|
954
1110
|
}
|
|
@@ -956,21 +1112,33 @@ class AXMRiskMatrixWidgetEditComponent extends AXPValueWidgetComponent {
|
|
|
956
1112
|
//#region ---- Event Handlers ----
|
|
957
1113
|
handleValueChange(data) {
|
|
958
1114
|
if (data) {
|
|
959
|
-
this.setValue(data);
|
|
1115
|
+
this.setValue(fromRiskMatrixSpreadsheetData(data));
|
|
960
1116
|
}
|
|
961
1117
|
}
|
|
1118
|
+
//#endregion
|
|
1119
|
+
//#region ----- Scale bindings -----
|
|
1120
|
+
resolveScaleId(idField, snapshotField) {
|
|
1121
|
+
return resolveRiskMatrixWidgetScaleId((path) => this.contextService.getValue(path), this.contextService.data(), idField, snapshotField);
|
|
1122
|
+
}
|
|
1123
|
+
resolveScaleLevels(snapshotField) {
|
|
1124
|
+
return resolveRiskMatrixWidgetScaleLevels((path) => this.contextService.getValue(path), this.contextService.data(), snapshotField);
|
|
1125
|
+
}
|
|
962
1126
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMRiskMatrixWidgetEditComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
963
1127
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.8", type: AXMRiskMatrixWidgetEditComponent, isStandalone: true, selector: "axm-risk-matrix-widget-edit", host: { classAttribute: "block w-full" }, usesInheritance: true, ngImport: i0, template: `
|
|
964
1128
|
<axm-risk-matrix
|
|
965
1129
|
[axisMapping]="axisMapping()"
|
|
966
1130
|
[matrixOrientation]="matrixOrientation()"
|
|
967
|
-
[
|
|
968
|
-
[
|
|
1131
|
+
[likelihoodScaleId]="likelihoodScaleId()"
|
|
1132
|
+
[severityScaleId]="severityScaleId()"
|
|
1133
|
+
[ratingScaleId]="ratingScaleId()"
|
|
1134
|
+
[likelihoodScaleLevels]="likelihoodScaleLevels()"
|
|
1135
|
+
[severityScaleLevels]="severityScaleLevels()"
|
|
1136
|
+
[ratingScaleLevels]="ratingScaleLevels()"
|
|
969
1137
|
[value]="matrixValue()"
|
|
970
1138
|
[readonly]="readonly()"
|
|
971
1139
|
(valueChange)="handleValueChange($any($event))"
|
|
972
1140
|
></axm-risk-matrix>
|
|
973
|
-
`, isInline: true, dependencies: [{ kind: "component", type: AXMRiskManagementRiskMatrixComponent, selector: "axm-risk-matrix", inputs: ["axisMapping", "
|
|
1141
|
+
`, isInline: true, dependencies: [{ kind: "component", type: AXMRiskManagementRiskMatrixComponent, selector: "axm-risk-matrix", inputs: ["axisMapping", "likelihoodScaleId", "severityScaleId", "ratingScaleId", "likelihoodScaleLevels", "severityScaleLevels", "ratingScaleLevels", "matrixOrientation", "value", "readonly"], outputs: ["valueChange", "cellChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
974
1142
|
}
|
|
975
1143
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMRiskMatrixWidgetEditComponent, decorators: [{
|
|
976
1144
|
type: Component,
|
|
@@ -982,8 +1150,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
982
1150
|
<axm-risk-matrix
|
|
983
1151
|
[axisMapping]="axisMapping()"
|
|
984
1152
|
[matrixOrientation]="matrixOrientation()"
|
|
985
|
-
[
|
|
986
|
-
[
|
|
1153
|
+
[likelihoodScaleId]="likelihoodScaleId()"
|
|
1154
|
+
[severityScaleId]="severityScaleId()"
|
|
1155
|
+
[ratingScaleId]="ratingScaleId()"
|
|
1156
|
+
[likelihoodScaleLevels]="likelihoodScaleLevels()"
|
|
1157
|
+
[severityScaleLevels]="severityScaleLevels()"
|
|
1158
|
+
[ratingScaleLevels]="ratingScaleLevels()"
|
|
987
1159
|
[value]="matrixValue()"
|
|
988
1160
|
[readonly]="readonly()"
|
|
989
1161
|
(valueChange)="handleValueChange($any($event))"
|
|
@@ -1002,12 +1174,13 @@ var riskMatrixWidgetEdit_component = /*#__PURE__*/Object.freeze({
|
|
|
1002
1174
|
AXMRiskMatrixWidgetEditComponent: AXMRiskMatrixWidgetEditComponent
|
|
1003
1175
|
});
|
|
1004
1176
|
|
|
1177
|
+
//#region ----- Imports -----
|
|
1005
1178
|
//#endregion
|
|
1006
|
-
//#region
|
|
1179
|
+
//#region ----- Component -----
|
|
1007
1180
|
class AXMRiskMatrixWidgetViewComponent extends AXPValueWidgetComponent {
|
|
1008
1181
|
constructor() {
|
|
1009
1182
|
super(...arguments);
|
|
1010
|
-
//#region
|
|
1183
|
+
//#region ----- Computed Properties -----
|
|
1011
1184
|
this.axisMapping = computed(() => {
|
|
1012
1185
|
this.contextService.changeEvent();
|
|
1013
1186
|
const options = this.options();
|
|
@@ -1024,32 +1197,64 @@ class AXMRiskMatrixWidgetViewComponent extends AXPValueWidgetComponent {
|
|
|
1024
1197
|
return resolveRiskMatrixOrientation(get(this.contextService.data(), 'matrixOrientation'));
|
|
1025
1198
|
}, /* @ts-ignore */
|
|
1026
1199
|
...(ngDevMode ? [{ debugName: "matrixOrientation" }] : /* istanbul ignore next */ []));
|
|
1027
|
-
this.
|
|
1200
|
+
this.likelihoodScaleId = computed(() => {
|
|
1201
|
+
this.contextService.changeEvent();
|
|
1202
|
+
return this.resolveScaleId('likelihoodScaleId', 'likelihoodScale');
|
|
1203
|
+
}, /* @ts-ignore */
|
|
1204
|
+
...(ngDevMode ? [{ debugName: "likelihoodScaleId" }] : /* istanbul ignore next */ []));
|
|
1205
|
+
this.severityScaleId = computed(() => {
|
|
1206
|
+
this.contextService.changeEvent();
|
|
1207
|
+
return this.resolveScaleId('severityScaleId', 'severityScale');
|
|
1208
|
+
}, /* @ts-ignore */
|
|
1209
|
+
...(ngDevMode ? [{ debugName: "severityScaleId" }] : /* istanbul ignore next */ []));
|
|
1210
|
+
this.ratingScaleId = computed(() => {
|
|
1211
|
+
this.contextService.changeEvent();
|
|
1212
|
+
return this.resolveScaleId('ratingScaleId', 'ratingScale');
|
|
1213
|
+
}, /* @ts-ignore */
|
|
1214
|
+
...(ngDevMode ? [{ debugName: "ratingScaleId" }] : /* istanbul ignore next */ []));
|
|
1215
|
+
this.likelihoodScaleLevels = computed(() => {
|
|
1216
|
+
this.contextService.changeEvent();
|
|
1217
|
+
return this.resolveScaleLevels('likelihoodScale');
|
|
1218
|
+
}, /* @ts-ignore */
|
|
1219
|
+
...(ngDevMode ? [{ debugName: "likelihoodScaleLevels" }] : /* istanbul ignore next */ []));
|
|
1220
|
+
this.severityScaleLevels = computed(() => {
|
|
1028
1221
|
this.contextService.changeEvent();
|
|
1029
|
-
return
|
|
1222
|
+
return this.resolveScaleLevels('severityScale');
|
|
1030
1223
|
}, /* @ts-ignore */
|
|
1031
|
-
...(ngDevMode ? [{ debugName: "
|
|
1032
|
-
this.
|
|
1224
|
+
...(ngDevMode ? [{ debugName: "severityScaleLevels" }] : /* istanbul ignore next */ []));
|
|
1225
|
+
this.ratingScaleLevels = computed(() => {
|
|
1033
1226
|
this.contextService.changeEvent();
|
|
1034
|
-
return
|
|
1227
|
+
return this.resolveScaleLevels('ratingScale');
|
|
1035
1228
|
}, /* @ts-ignore */
|
|
1036
|
-
...(ngDevMode ? [{ debugName: "
|
|
1229
|
+
...(ngDevMode ? [{ debugName: "ratingScaleLevels" }] : /* istanbul ignore next */ []));
|
|
1037
1230
|
this.matrixValue = computed(() => {
|
|
1038
|
-
return this.getValue()
|
|
1231
|
+
return toRiskMatrixSpreadsheetData(resolveRiskMatrixCells(this.getValue()));
|
|
1039
1232
|
}, /* @ts-ignore */
|
|
1040
1233
|
...(ngDevMode ? [{ debugName: "matrixValue" }] : /* istanbul ignore next */ []));
|
|
1041
1234
|
}
|
|
1235
|
+
//#endregion
|
|
1236
|
+
//#region ----- Scale bindings -----
|
|
1237
|
+
resolveScaleId(idField, snapshotField) {
|
|
1238
|
+
return resolveRiskMatrixWidgetScaleId((path) => this.contextService.getValue(path), this.contextService.data(), idField, snapshotField);
|
|
1239
|
+
}
|
|
1240
|
+
resolveScaleLevels(snapshotField) {
|
|
1241
|
+
return resolveRiskMatrixWidgetScaleLevels((path) => this.contextService.getValue(path), this.contextService.data(), snapshotField);
|
|
1242
|
+
}
|
|
1042
1243
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMRiskMatrixWidgetViewComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1043
1244
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.8", type: AXMRiskMatrixWidgetViewComponent, isStandalone: true, selector: "axm-risk-matrix-widget-view", host: { classAttribute: "block w-full" }, usesInheritance: true, ngImport: i0, template: `
|
|
1044
1245
|
<axm-risk-matrix
|
|
1045
1246
|
[axisMapping]="axisMapping()"
|
|
1046
1247
|
[matrixOrientation]="matrixOrientation()"
|
|
1047
|
-
[
|
|
1048
|
-
[
|
|
1248
|
+
[likelihoodScaleId]="likelihoodScaleId()"
|
|
1249
|
+
[severityScaleId]="severityScaleId()"
|
|
1250
|
+
[ratingScaleId]="ratingScaleId()"
|
|
1251
|
+
[likelihoodScaleLevels]="likelihoodScaleLevels()"
|
|
1252
|
+
[severityScaleLevels]="severityScaleLevels()"
|
|
1253
|
+
[ratingScaleLevels]="ratingScaleLevels()"
|
|
1049
1254
|
[value]="matrixValue()"
|
|
1050
1255
|
[readonly]="true"
|
|
1051
1256
|
></axm-risk-matrix>
|
|
1052
|
-
`, isInline: true, dependencies: [{ kind: "component", type: AXMRiskManagementRiskMatrixComponent, selector: "axm-risk-matrix", inputs: ["axisMapping", "
|
|
1257
|
+
`, isInline: true, dependencies: [{ kind: "component", type: AXMRiskManagementRiskMatrixComponent, selector: "axm-risk-matrix", inputs: ["axisMapping", "likelihoodScaleId", "severityScaleId", "ratingScaleId", "likelihoodScaleLevels", "severityScaleLevels", "ratingScaleLevels", "matrixOrientation", "value", "readonly"], outputs: ["valueChange", "cellChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1053
1258
|
}
|
|
1054
1259
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMRiskMatrixWidgetViewComponent, decorators: [{
|
|
1055
1260
|
type: Component,
|
|
@@ -1061,8 +1266,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
1061
1266
|
<axm-risk-matrix
|
|
1062
1267
|
[axisMapping]="axisMapping()"
|
|
1063
1268
|
[matrixOrientation]="matrixOrientation()"
|
|
1064
|
-
[
|
|
1065
|
-
[
|
|
1269
|
+
[likelihoodScaleId]="likelihoodScaleId()"
|
|
1270
|
+
[severityScaleId]="severityScaleId()"
|
|
1271
|
+
[ratingScaleId]="ratingScaleId()"
|
|
1272
|
+
[likelihoodScaleLevels]="likelihoodScaleLevels()"
|
|
1273
|
+
[severityScaleLevels]="severityScaleLevels()"
|
|
1274
|
+
[ratingScaleLevels]="ratingScaleLevels()"
|
|
1066
1275
|
[value]="matrixValue()"
|
|
1067
1276
|
[readonly]="true"
|
|
1068
1277
|
></axm-risk-matrix>
|
|
@@ -1084,5 +1293,5 @@ var riskMatrixWidgetView_component = /*#__PURE__*/Object.freeze({
|
|
|
1084
1293
|
* Generated bundle index. Do not edit.
|
|
1085
1294
|
*/
|
|
1086
1295
|
|
|
1087
|
-
export { AXMRiskManagementMenuProvider, AXMRiskManagementModule, AXMRiskManagementPermissionDefinitionProvider, AXMRiskManagementRiskMatrixComponent, AXMRiskMatrixViewerService, AXMRiskMatrixWidgetColumnComponent, AXMRiskMatrixWidgetEditComponent, AXMRiskMatrixWidgetViewComponent, isRiskMatrixAxisProperty, isRiskMatrixOrientation,
|
|
1296
|
+
export { AXMRiskManagementMenuProvider, AXMRiskManagementModule, AXMRiskManagementPermissionDefinitionProvider, AXMRiskManagementRiskMatrixComponent, AXMRiskMatrixViewerService, AXMRiskMatrixWidgetColumnComponent, AXMRiskMatrixWidgetEditComponent, AXMRiskMatrixWidgetViewComponent, isRiskMatrixAxisProperty, isRiskMatrixOrientation, resolveRiskMatrixAxisCodes, resolveRiskMatrixAxisMapping, resolveRiskMatrixAxisMappingFromOrientation, resolveRiskMatrixOrientation, resolveRiskMatrixScaleId, resolveRiskMatrixScaleIdFromRecord, resolveRiskMatrixScaleLevels, resolveRiskMatrixTitleKey, resolveRiskMatrixWidgetScaleId, resolveRiskMatrixWidgetScaleLevels, toCanonicalMatrixData, toDisplayMatrixData, validateRiskMatrixAxisMapping };
|
|
1088
1297
|
//# sourceMappingURL=acorex-platform-module-risk-management-client.mjs.map
|