@acorex-platform/module-workplacesafety-management-client 0.0.28 → 0.0.32

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.
Files changed (37) hide show
  1. package/fesm2022/acorex-platform-module-workplacesafety-management-client-acorex-platform-module-workplacesafety-management-client-isnVDChu.mjs +549 -0
  2. package/fesm2022/acorex-platform-module-workplacesafety-management-client-acorex-platform-module-workplacesafety-management-client-isnVDChu.mjs.map +1 -0
  3. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts.mjs +739 -806
  4. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts.mjs.map +1 -1
  5. package/fesm2022/acorex-platform-module-workplacesafety-management-client-control-hierarchy-diagram-widget-view.component-CZFCMX6R.mjs +93 -0
  6. package/fesm2022/acorex-platform-module-workplacesafety-management-client-control-hierarchy-diagram-widget-view.component-CZFCMX6R.mjs.map +1 -0
  7. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-control-hierarchy-diagram-widget-view.component-C-qrrqOV.mjs → acorex-platform-module-workplacesafety-management-client-control-hierarchy-diagram.component-D7hofHR0.mjs} +8 -93
  8. package/fesm2022/acorex-platform-module-workplacesafety-management-client-control-hierarchy-diagram.component-D7hofHR0.mjs.map +1 -0
  9. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-control-hierarchy-diagram.service-BBhH7KP1.mjs → acorex-platform-module-workplacesafety-management-client-control-hierarchy-diagram.service-tMrUDnCb.mjs} +48 -1
  10. package/fesm2022/acorex-platform-module-workplacesafety-management-client-control-hierarchy-diagram.service-tMrUDnCb.mjs.map +1 -0
  11. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-index-kF37zgd4.mjs → acorex-platform-module-workplacesafety-management-client-index-yxxC7i6A.mjs} +391 -92
  12. package/fesm2022/acorex-platform-module-workplacesafety-management-client-index-yxxC7i6A.mjs.map +1 -0
  13. package/fesm2022/acorex-platform-module-workplacesafety-management-client-ppe-item-viewer-widget-column.component-D2Mmow12.mjs +42 -0
  14. package/fesm2022/acorex-platform-module-workplacesafety-management-client-ppe-item-viewer-widget-column.component-D2Mmow12.mjs.map +1 -0
  15. package/fesm2022/acorex-platform-module-workplacesafety-management-client-ppe-item-viewer-widget-edit.component-CQtVhCgw.mjs +101 -0
  16. package/fesm2022/acorex-platform-module-workplacesafety-management-client-ppe-item-viewer-widget-edit.component-CQtVhCgw.mjs.map +1 -0
  17. package/fesm2022/acorex-platform-module-workplacesafety-management-client-ppe-item-viewer.service-YS8FHiRu.mjs +221 -0
  18. package/fesm2022/acorex-platform-module-workplacesafety-management-client-ppe-item-viewer.service-YS8FHiRu.mjs.map +1 -0
  19. package/fesm2022/acorex-platform-module-workplacesafety-management-client-ppe-item-viewer.util-2Kl3_3sg.mjs +61 -0
  20. package/fesm2022/acorex-platform-module-workplacesafety-management-client-ppe-item-viewer.util-2Kl3_3sg.mjs.map +1 -0
  21. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-preview-control-hierarchy-diagram.command-C2X3VpEt.mjs → acorex-platform-module-workplacesafety-management-client-preview-control-hierarchy-diagram.command-Dd9xdo_y.mjs} +3 -7
  22. package/fesm2022/acorex-platform-module-workplacesafety-management-client-preview-control-hierarchy-diagram.command-Dd9xdo_y.mjs.map +1 -0
  23. package/fesm2022/acorex-platform-module-workplacesafety-management-client-safety-plan-preview-modal.component-C7IojUT9.mjs +557 -0
  24. package/fesm2022/acorex-platform-module-workplacesafety-management-client-safety-plan-preview-modal.component-C7IojUT9.mjs.map +1 -0
  25. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-save-safety-plan-sections.command-BJsg3pHZ.mjs → acorex-platform-module-workplacesafety-management-client-save-safety-plan-sections.command-BlPzzCc2.mjs} +13 -25
  26. package/fesm2022/acorex-platform-module-workplacesafety-management-client-save-safety-plan-sections.command-BlPzzCc2.mjs.map +1 -0
  27. package/fesm2022/acorex-platform-module-workplacesafety-management-client.mjs +1 -460
  28. package/fesm2022/acorex-platform-module-workplacesafety-management-client.mjs.map +1 -1
  29. package/package.json +2 -2
  30. package/types/acorex-platform-module-workplacesafety-management-client-contracts.d.ts +89 -140
  31. package/fesm2022/acorex-platform-module-workplacesafety-management-client-control-hierarchy-diagram-widget-view.component-C-qrrqOV.mjs.map +0 -1
  32. package/fesm2022/acorex-platform-module-workplacesafety-management-client-control-hierarchy-diagram.service-BBhH7KP1.mjs.map +0 -1
  33. package/fesm2022/acorex-platform-module-workplacesafety-management-client-hazard-risk-ppe-rule-status.provider-DtqzcWh0.mjs +0 -42
  34. package/fesm2022/acorex-platform-module-workplacesafety-management-client-hazard-risk-ppe-rule-status.provider-DtqzcWh0.mjs.map +0 -1
  35. package/fesm2022/acorex-platform-module-workplacesafety-management-client-index-kF37zgd4.mjs.map +0 -1
  36. package/fesm2022/acorex-platform-module-workplacesafety-management-client-preview-control-hierarchy-diagram.command-C2X3VpEt.mjs.map +0 -1
  37. package/fesm2022/acorex-platform-module-workplacesafety-management-client-save-safety-plan-sections.command-BJsg3pHZ.mjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-platform-module-workplacesafety-management-client-ppe-item-viewer-widget-edit.component-CQtVhCgw.mjs","sources":["../../../../libs/modules/workplacesafety-management/client/src/lib/features/ppe-item-viewer/ppe-item-viewer-widget-edit.component.ts","../../../../libs/modules/workplacesafety-management/client/src/lib/features/ppe-item-viewer/ppe-item-viewer-widget-edit.component.html"],"sourcesContent":["//#region ----- Imports -----\n\nimport { AXFormModule } from '@acorex/components/form';\nimport { AXLabelModule } from '@acorex/components/label';\nimport { AXValidationModule } from '@acorex/core/validation';\nimport { AXPValueWidgetComponent } from '@acorex-platform/framework-client/layout/widget-core';\nimport { ChangeDetectionStrategy, Component, computed, effect, inject, signal, ViewEncapsulation } from '@angular/core';\n\nimport { AXMPpeItemViewerComponent } from './ppe-item-viewer.component';\nimport type { AXMPpeItemViewerDisplayItem, AXMPpeItemViewerLayout, AXMPpeItemViewerWidgetOptions } from './ppe-item-viewer.types';\nimport { AXMPpeItemViewerService } from './ppe-item-viewer.service';\nimport { extractPpeItemIds, resolvePpeItemViewerLayout } from './ppe-item-viewer.util';\n\n//#endregion\n\n//#region ----- Component -----\n\n@Component({\n selector: 'axm-ppe-item-viewer-widget-edit',\n templateUrl: './ppe-item-viewer-widget-edit.component.html',\n styleUrl: './ppe-item-viewer-widget-edit.component.css',\n host: {\n class: 'axm-ppe-item-viewer-widget block w-full',\n },\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [AXFormModule, AXLabelModule, AXValidationModule, AXMPpeItemViewerComponent],\n})\nexport class AXMPpeItemViewerWidgetEditComponent extends AXPValueWidgetComponent<\n string[] | null,\n AXMPpeItemViewerWidgetOptions\n> {\n //#region ----- Services & Dependencies -----\n\n private readonly ppeItemViewerService = inject(AXMPpeItemViewerService);\n\n //#endregion\n\n //#region ----- State Signals -----\n\n protected readonly loading = signal(false);\n protected readonly items = signal<AXMPpeItemViewerDisplayItem[]>([]);\n\n //#endregion\n\n //#region ----- Computed Properties -----\n\n protected readonly layout = computed<AXMPpeItemViewerLayout>(() =>\n resolvePpeItemViewerLayout(this.options()['layout']),\n );\n\n protected readonly disabled = computed<boolean>(() => this.options()['disabled'] === true);\n\n protected readonly selectedIds = computed(() => extractPpeItemIds(this.getValue()));\n\n protected readonly fieldLabel = computed<string>(() => {\n const label = this.options()['label'];\n return typeof label === 'string' ? label : '';\n });\n\n //#endregion\n\n //#region ----- Lifecycle -----\n\n private readonly loadConfiguredItems = effect((onCleanup) => {\n const ids = extractPpeItemIds(this.options()['ppeItems']);\n let cancelled = false;\n onCleanup(() => {\n cancelled = true;\n });\n void this.refreshItems(ids, () => cancelled);\n });\n\n //#endregion\n\n //#region ----- Event Handlers -----\n\n protected isReadonly(): boolean {\n return this.options()['readonly'] === true || this.mode === 'view' || this.mode === 'print';\n }\n\n protected onSelectedIdsChange(ids: string[]): void {\n if (this.disabled() || this.isReadonly()) {\n return;\n }\n this.setValue(ids.length > 0 ? ids : null);\n }\n\n //#endregion\n\n //#region ----- Data Loading -----\n\n private async refreshItems(ids: string[], isCancelled: () => boolean): Promise<void> {\n if (ids.length === 0) {\n this.items.set([]);\n this.loading.set(false);\n return;\n }\n\n this.beginHydration();\n this.loading.set(true);\n try {\n const loaded = await this.ppeItemViewerService.loadDisplayItems(ids);\n if (!isCancelled()) {\n this.items.set(loaded);\n }\n } catch {\n if (!isCancelled()) {\n this.items.set([]);\n }\n } finally {\n if (!isCancelled()) {\n this.loading.set(false);\n }\n this.endHydration();\n }\n }\n\n //#endregion\n}\n\n//#endregion\n","<ax-form-field class=\"flex flex-col gap-1 w-full\">\n @if (fieldLabel()) {\n <!-- ----- Optional field label when the host does not already wrap the widget ----- -->\n <ax-label class=\"font-semibold text-sm\" [required]=\"hasRequiredValidation()\">{{ fieldLabel() }}</ax-label>\n }\n <axm-ppe-item-viewer\n [items]=\"items()\"\n [layout]=\"layout()\"\n [selectedIds]=\"selectedIds()\"\n [loading]=\"loading()\"\n [disabled]=\"disabled()\"\n [readonly]=\"isReadonly()\"\n (selectedIdsChange)=\"onSelectedIdsChange($event)\"\n />\n @for (validation of validationRules(); track $index) {\n <ax-validation-rule\n [rule]=\"validation.rule\"\n [message]=\"$safeNavigationMigration(validation.options?.message)\"\n [options]=\"validation.options\"\n ></ax-validation-rule>\n }\n</ax-form-field>\n"],"names":[],"mappings":";;;;;;;;;;;AAAA;AAaA;AAEA;AAaM,MAAO,mCAAoC,SAAQ,uBAGxD,CAAA;AAdD,IAAA,WAAA,GAAA;;;AAiBmB,QAAA,IAAA,CAAA,oBAAoB,GAAG,MAAM,CAAC,uBAAuB,CAAC;;;QAMpD,IAAA,CAAA,OAAO,GAAG,MAAM,CAAC,KAAK;oFAAC;QACvB,IAAA,CAAA,KAAK,GAAG,MAAM,CAAgC,EAAE;kFAAC;;;AAMjD,QAAA,IAAA,CAAA,MAAM,GAAG,QAAQ,CAAyB,MAC3D,0BAA0B,CAAC,IAAI,C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AAA,EAAA,IAAA,EDIY,YAAY,qRAAE,aAAa,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,CAAA,gBAAA,EAAA,QAAA,EAAA,UAAA,EAAA,MAAA,EAAA,CAAA,UAAA,EAAA,KAAA,CAAA,EAAA,OAAA,EAAA,CAAA,gBAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAAE,kBAAkB,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAE,yBAAyB,EAAA,QAAA,EAAA,qBAAA,EAAA,MAAA,EAAA,CAAA,OAAA,EAAA,QAAA,EAAA,aAAA,EAAA,SAAA,EAAA,UAAA,EAAA,UAAA,EAAA,aAAA,CAAA,EAAA,OAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,aAAA,EAAA,EAAA,CAAA,iBAAA,CAAA,IAAA,EAAA,CAAA,CAAA;;2FAEzE,mCAAmC,EAAA,UAAA,EAAA,CAAA;kBAX/C,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,iCAAiC,EAAA,IAAA,EAGrC;AACJ,wBAAA,KAAK,EAAE,yCAAyC;AACjD,qBAAA,EAAA,aAAA,EACc,iBAAiB,CAAC,IAAI,EAAA,eAAA,EACpB,uBAAuB,CAAC,MAAM,EAAA,OAAA,EACtC,CAAC,YAAY,EAAE,aAAa,EAAE,kBAAkB,EAAE,yBAAyB,CAAC,EAAA,QAAA,EAAA,+0BAAA,EAAA,MAAA,EAAA,CAAA,8GAAA,CAAA,EAAA;;;;;"}
@@ -0,0 +1,221 @@
1
+ import * as i1$2 from '@acorex/components/loading';
2
+ import { AXLoadingModule } from '@acorex/components/loading';
3
+ import * as i1$3 from '@acorex/core/translation';
4
+ import { AXTranslationModule, AXTranslationService } from '@acorex/core/translation';
5
+ import { AsyncPipe } from '@angular/common';
6
+ import * as i0 from '@angular/core';
7
+ import { input, output, computed, ViewEncapsulation, ChangeDetectionStrategy, Component, inject, Injectable } from '@angular/core';
8
+ import * as i1 from '@acorex/components/check-box';
9
+ import { AXCheckBoxModule } from '@acorex/components/check-box';
10
+ import * as i2 from '@acorex/components/decorators';
11
+ import { AXDecoratorModule } from '@acorex/components/decorators';
12
+ import * as i1$1 from '@angular/forms';
13
+ import { FormsModule } from '@angular/forms';
14
+ import { p as ppeItemViewerStandardText, a as resolvePpeItemViewerLook } from './acorex-platform-module-workplacesafety-management-client-ppe-item-viewer.util-2Kl3_3sg.mjs';
15
+ import { resolveMultiLanguageString } from '@acorex-platform/framework-shared/core';
16
+ import { AXPFileStorageService, isStoredImageFileId, resolveStoredImageDisplayUrl } from '@acorex-platform/framework-client/common';
17
+ import { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';
18
+ import { RootConfig } from '@acorex-platform/module-workplacesafety-management-client/contracts';
19
+
20
+ //#endregion
21
+ //#region ----- Component -----
22
+ class AXMPpeItemCardComponent {
23
+ constructor() {
24
+ //#region ----- Inputs -----
25
+ this.item = input.required(/* @ts-ignore */
26
+ ...(ngDevMode ? [{ debugName: "item" }] : /* istanbul ignore next */ []));
27
+ this.look = input('card', /* @ts-ignore */
28
+ ...(ngDevMode ? [{ debugName: "look" }] : /* istanbul ignore next */ []));
29
+ this.selected = input(false, /* @ts-ignore */
30
+ ...(ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []));
31
+ this.disabled = input(false, /* @ts-ignore */
32
+ ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
33
+ this.readonly = input(false, /* @ts-ignore */
34
+ ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
35
+ this.showControl = input(true, /* @ts-ignore */
36
+ ...(ngDevMode ? [{ debugName: "showControl" }] : /* istanbul ignore next */ []));
37
+ //#endregion
38
+ //#region ----- Outputs -----
39
+ this.selectedChange = output();
40
+ //#endregion
41
+ //#region ----- Computed Properties -----
42
+ this.interactive = computed(() => this.showControl() && !this.disabled() && !this.readonly(), /* @ts-ignore */
43
+ ...(ngDevMode ? [{ debugName: "interactive" }] : /* istanbul ignore next */ []));
44
+ this.standardText = computed(() => ppeItemViewerStandardText(this.item()), /* @ts-ignore */
45
+ ...(ngDevMode ? [{ debugName: "standardText" }] : /* istanbul ignore next */ []));
46
+ }
47
+ //#endregion
48
+ //#region ----- Event Handlers -----
49
+ onActivate() {
50
+ if (!this.interactive()) {
51
+ return;
52
+ }
53
+ this.selectedChange.emit(!this.selected());
54
+ }
55
+ onCheckChanged(event) {
56
+ if (!event.isUserInteraction || !this.interactive()) {
57
+ return;
58
+ }
59
+ this.selectedChange.emit(Boolean(event.value));
60
+ }
61
+ onControlClick(event) {
62
+ event.stopPropagation();
63
+ }
64
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMPpeItemCardComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
65
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: AXMPpeItemCardComponent, isStandalone: true, selector: "axm-ppe-item-card", inputs: { item: { classPropertyName: "item", publicName: "item", isSignal: true, isRequired: true, transformFunction: null }, look: { classPropertyName: "look", publicName: "look", isSignal: true, isRequired: false, transformFunction: null }, selected: { classPropertyName: "selected", publicName: "selected", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, showControl: { classPropertyName: "showControl", publicName: "showControl", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectedChange: "selectedChange" }, host: { properties: { "class.axm-ppe-item-card--list": "look() === \"list\"", "class.axm-ppe-item-card--card": "look() === \"card\"", "class.axm-ppe-item-card--selected": "selected()", "class.axm-ppe-item-card--interactive": "interactive()", "class.axm-ppe-item-card--disabled": "disabled()" }, classAttribute: "axm-ppe-item-card" }, ngImport: i0, template: "<div class=\"axm-ppe-item-card__body\" (click)=\"onActivate()\">\n <!-- ----- PPE icon ----- -->\n @if (item().imageUrl) {\n <div class=\"axm-ppe-item-card__icon\">\n <img [src]=\"item().imageUrl\" [alt]=\"item().title\" />\n </div>\n }\n <!-- ----- Fallback icon when the PPE item has no image ----- -->\n @else {\n <div class=\"axm-ppe-item-card__icon axm-ppe-item-card__icon--fallback\">\n <ax-icon icon=\"fa-light fa-helmet-safety\"></ax-icon>\n </div>\n }\n\n <div class=\"axm-ppe-item-card__content\">\n <span class=\"axm-ppe-item-card__title\">{{ item().title }}</span>\n <!--->\n <!-- ----- Standard / code when present ----- -->\n @if (standardText()) {\n <span class=\"axm-ppe-item-card__code\">{{ standardText() }}</span>\n }\n </div>\n\n <!-- ----- Selection checkbox ----- -->\n @if (showControl()) {\n <div class=\"axm-ppe-item-card__control\" (click)=\"onControlClick($event)\">\n <ax-check-box\n [ngModel]=\"selected()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n (onValueChanged)=\"onCheckChanged($event)\"\n ></ax-check-box>\n </div>\n }\n</div>\n", styles: ["@layer properties;.axm-ppe-item-card{display:block;width:100%}.axm-ppe-item-card .axm-ppe-item-card__body{display:flex;width:100%}.axm-ppe-item-card .axm-ppe-item-card__icon{display:flex;flex-shrink:0;align-items:center;justify-content:center;overflow:hidden;border-radius:var(--radius-lg, .5rem);border-style:var(--tw-border-style);border-width:1px;background-color:var(--color-lighter);color:var(--color-on-lighter);border-color:var(--color-border-lighter);border-color:rgba(var(--ax-sys-color-surface))}.axm-ppe-item-card .axm-ppe-item-card__icon img{height:100%;width:100%;object-fit:contain}.axm-ppe-item-card .axm-ppe-item-card__icon--fallback{color:rgba(var(--ax-sys-color-text-default))}@supports (color: color-mix(in lab,red,red)){.axm-ppe-item-card .axm-ppe-item-card__icon--fallback{color:color-mix(in oklab,rgba(var(--ax-sys-color-text-default)) 80%,transparent)}}.axm-ppe-item-card .axm-ppe-item-card__content{display:flex;min-width:0px;flex-direction:column}.axm-ppe-item-card .axm-ppe-item-card__title{font-size:var(--text-sm, .875rem);line-height:var(--tw-leading, var(--text-sm--line-height, calc(1.25 / .875)));--tw-font-weight: var(--font-weight-semibold, 600);font-weight:var(--font-weight-semibold, 600)}.axm-ppe-item-card .axm-ppe-item-card__code{font-size:var(--text-xs, .75rem);line-height:var(--tw-leading, var(--text-xs--line-height, calc(1 / .75)));color:rgba(var(--ax-sys-color-text-default))}@supports (color: color-mix(in lab,red,red)){.axm-ppe-item-card .axm-ppe-item-card__code{color:color-mix(in oklab,rgba(var(--ax-sys-color-text-default)) 80%,transparent)}}.axm-ppe-item-card .axm-ppe-item-card__control{display:flex;flex-shrink:0;align-items:center}.axm-ppe-item-card.axm-ppe-item-card--card .axm-ppe-item-card__body{height:100%;flex-direction:column;align-items:center;gap:calc(var(--spacing, .25rem) * 2);border-radius:var(--radius-lg, .5rem);border-style:var(--tw-border-style);border-width:1px;background-color:var(--color-lighter);color:var(--color-on-lighter);border-color:var(--color-border-lighter);border-color:rgba(var(--ax-sys-color-surface));padding:calc(var(--spacing, .25rem) * 3);text-align:center}.axm-ppe-item-card.axm-ppe-item-card--card .axm-ppe-item-card__icon{width:calc(var(--spacing, .25rem) * 16);height:calc(var(--spacing, .25rem) * 16)}.axm-ppe-item-card.axm-ppe-item-card--card .axm-ppe-item-card__icon--fallback{font-size:var(--text-2xl, 1.5rem);line-height:var(--tw-leading, var(--text-2xl--line-height, calc(2 / 1.5)))}.axm-ppe-item-card.axm-ppe-item-card--card .axm-ppe-item-card__content{width:100%;align-items:center;gap:calc(var(--spacing, .25rem) * .5)}.axm-ppe-item-card.axm-ppe-item-card--card .axm-ppe-item-card__control{justify-content:center}.axm-ppe-item-card.axm-ppe-item-card--list .axm-ppe-item-card__body{flex-direction:row;align-items:center;gap:calc(var(--spacing, .25rem) * 3);padding-block:calc(var(--spacing, .25rem) * 2)}.axm-ppe-item-card.axm-ppe-item-card--list .axm-ppe-item-card__icon{width:calc(var(--spacing, .25rem) * 10);height:calc(var(--spacing, .25rem) * 10)}.axm-ppe-item-card.axm-ppe-item-card--list .axm-ppe-item-card__content{flex:1;gap:calc(var(--spacing, .25rem) * .5)}.axm-ppe-item-card.axm-ppe-item-card--list .axm-ppe-item-card__control{order:-9999}.axm-ppe-item-card.axm-ppe-item-card--selected.axm-ppe-item-card--card .axm-ppe-item-card__body{border-color:rgba(var(--ax-sys-color-primary-surface))}.axm-ppe-item-card.axm-ppe-item-card--interactive .axm-ppe-item-card__body{cursor:pointer}.axm-ppe-item-card.axm-ppe-item-card--disabled{opacity:60%}@property --tw-border-style{syntax: \"*\"; inherits: false; initial-value: solid;}@property --tw-font-weight{syntax: \"*\"; inherits: false;}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style: solid;--tw-font-weight: initial}}}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"], dependencies: [{ kind: "ngmodule", type: AXCheckBoxModule }, { kind: "component", type: i1.AXCheckBoxComponent, selector: "ax-check-box", inputs: ["disabled", "tabIndex", "readonly", "color", "value", "name", "id", "isLoading", "indeterminate"], outputs: ["onBlur", "onFocus", "valueChange", "onValueChanged"] }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: i2.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
66
+ }
67
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMPpeItemCardComponent, decorators: [{
68
+ type: Component,
69
+ args: [{ selector: 'axm-ppe-item-card', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [AXCheckBoxModule, AXDecoratorModule, FormsModule], host: {
70
+ class: 'axm-ppe-item-card',
71
+ '[class.axm-ppe-item-card--list]': 'look() === "list"',
72
+ '[class.axm-ppe-item-card--card]': 'look() === "card"',
73
+ '[class.axm-ppe-item-card--selected]': 'selected()',
74
+ '[class.axm-ppe-item-card--interactive]': 'interactive()',
75
+ '[class.axm-ppe-item-card--disabled]': 'disabled()',
76
+ }, template: "<div class=\"axm-ppe-item-card__body\" (click)=\"onActivate()\">\n <!-- ----- PPE icon ----- -->\n @if (item().imageUrl) {\n <div class=\"axm-ppe-item-card__icon\">\n <img [src]=\"item().imageUrl\" [alt]=\"item().title\" />\n </div>\n }\n <!-- ----- Fallback icon when the PPE item has no image ----- -->\n @else {\n <div class=\"axm-ppe-item-card__icon axm-ppe-item-card__icon--fallback\">\n <ax-icon icon=\"fa-light fa-helmet-safety\"></ax-icon>\n </div>\n }\n\n <div class=\"axm-ppe-item-card__content\">\n <span class=\"axm-ppe-item-card__title\">{{ item().title }}</span>\n <!--->\n <!-- ----- Standard / code when present ----- -->\n @if (standardText()) {\n <span class=\"axm-ppe-item-card__code\">{{ standardText() }}</span>\n }\n </div>\n\n <!-- ----- Selection checkbox ----- -->\n @if (showControl()) {\n <div class=\"axm-ppe-item-card__control\" (click)=\"onControlClick($event)\">\n <ax-check-box\n [ngModel]=\"selected()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n (onValueChanged)=\"onCheckChanged($event)\"\n ></ax-check-box>\n </div>\n }\n</div>\n", styles: ["@layer properties;.axm-ppe-item-card{display:block;width:100%}.axm-ppe-item-card .axm-ppe-item-card__body{display:flex;width:100%}.axm-ppe-item-card .axm-ppe-item-card__icon{display:flex;flex-shrink:0;align-items:center;justify-content:center;overflow:hidden;border-radius:var(--radius-lg, .5rem);border-style:var(--tw-border-style);border-width:1px;background-color:var(--color-lighter);color:var(--color-on-lighter);border-color:var(--color-border-lighter);border-color:rgba(var(--ax-sys-color-surface))}.axm-ppe-item-card .axm-ppe-item-card__icon img{height:100%;width:100%;object-fit:contain}.axm-ppe-item-card .axm-ppe-item-card__icon--fallback{color:rgba(var(--ax-sys-color-text-default))}@supports (color: color-mix(in lab,red,red)){.axm-ppe-item-card .axm-ppe-item-card__icon--fallback{color:color-mix(in oklab,rgba(var(--ax-sys-color-text-default)) 80%,transparent)}}.axm-ppe-item-card .axm-ppe-item-card__content{display:flex;min-width:0px;flex-direction:column}.axm-ppe-item-card .axm-ppe-item-card__title{font-size:var(--text-sm, .875rem);line-height:var(--tw-leading, var(--text-sm--line-height, calc(1.25 / .875)));--tw-font-weight: var(--font-weight-semibold, 600);font-weight:var(--font-weight-semibold, 600)}.axm-ppe-item-card .axm-ppe-item-card__code{font-size:var(--text-xs, .75rem);line-height:var(--tw-leading, var(--text-xs--line-height, calc(1 / .75)));color:rgba(var(--ax-sys-color-text-default))}@supports (color: color-mix(in lab,red,red)){.axm-ppe-item-card .axm-ppe-item-card__code{color:color-mix(in oklab,rgba(var(--ax-sys-color-text-default)) 80%,transparent)}}.axm-ppe-item-card .axm-ppe-item-card__control{display:flex;flex-shrink:0;align-items:center}.axm-ppe-item-card.axm-ppe-item-card--card .axm-ppe-item-card__body{height:100%;flex-direction:column;align-items:center;gap:calc(var(--spacing, .25rem) * 2);border-radius:var(--radius-lg, .5rem);border-style:var(--tw-border-style);border-width:1px;background-color:var(--color-lighter);color:var(--color-on-lighter);border-color:var(--color-border-lighter);border-color:rgba(var(--ax-sys-color-surface));padding:calc(var(--spacing, .25rem) * 3);text-align:center}.axm-ppe-item-card.axm-ppe-item-card--card .axm-ppe-item-card__icon{width:calc(var(--spacing, .25rem) * 16);height:calc(var(--spacing, .25rem) * 16)}.axm-ppe-item-card.axm-ppe-item-card--card .axm-ppe-item-card__icon--fallback{font-size:var(--text-2xl, 1.5rem);line-height:var(--tw-leading, var(--text-2xl--line-height, calc(2 / 1.5)))}.axm-ppe-item-card.axm-ppe-item-card--card .axm-ppe-item-card__content{width:100%;align-items:center;gap:calc(var(--spacing, .25rem) * .5)}.axm-ppe-item-card.axm-ppe-item-card--card .axm-ppe-item-card__control{justify-content:center}.axm-ppe-item-card.axm-ppe-item-card--list .axm-ppe-item-card__body{flex-direction:row;align-items:center;gap:calc(var(--spacing, .25rem) * 3);padding-block:calc(var(--spacing, .25rem) * 2)}.axm-ppe-item-card.axm-ppe-item-card--list .axm-ppe-item-card__icon{width:calc(var(--spacing, .25rem) * 10);height:calc(var(--spacing, .25rem) * 10)}.axm-ppe-item-card.axm-ppe-item-card--list .axm-ppe-item-card__content{flex:1;gap:calc(var(--spacing, .25rem) * .5)}.axm-ppe-item-card.axm-ppe-item-card--list .axm-ppe-item-card__control{order:-9999}.axm-ppe-item-card.axm-ppe-item-card--selected.axm-ppe-item-card--card .axm-ppe-item-card__body{border-color:rgba(var(--ax-sys-color-primary-surface))}.axm-ppe-item-card.axm-ppe-item-card--interactive .axm-ppe-item-card__body{cursor:pointer}.axm-ppe-item-card.axm-ppe-item-card--disabled{opacity:60%}@property --tw-border-style{syntax: \"*\"; inherits: false; initial-value: solid;}@property --tw-font-weight{syntax: \"*\"; inherits: false;}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style: solid;--tw-font-weight: initial}}}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"] }]
77
+ }], propDecorators: { item: [{ type: i0.Input, args: [{ isSignal: true, alias: "item", required: true }] }], look: [{ type: i0.Input, args: [{ isSignal: true, alias: "look", required: false }] }], selected: [{ type: i0.Input, args: [{ isSignal: true, alias: "selected", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], showControl: [{ type: i0.Input, args: [{ isSignal: true, alias: "showControl", required: false }] }], selectedChange: [{ type: i0.Output, args: ["selectedChange"] }] } });
78
+
79
+ //#region ----- Imports -----
80
+ //#endregion
81
+ //#region ----- Component -----
82
+ class AXMPpeItemViewerComponent {
83
+ constructor() {
84
+ //#region ----- Inputs -----
85
+ this.items = input([], /* @ts-ignore */
86
+ ...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
87
+ this.layout = input('horizontal', /* @ts-ignore */
88
+ ...(ngDevMode ? [{ debugName: "layout" }] : /* istanbul ignore next */ []));
89
+ this.selectedIds = input([], /* @ts-ignore */
90
+ ...(ngDevMode ? [{ debugName: "selectedIds" }] : /* istanbul ignore next */ []));
91
+ this.loading = input(false, /* @ts-ignore */
92
+ ...(ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []));
93
+ this.disabled = input(false, /* @ts-ignore */
94
+ ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
95
+ this.readonly = input(false, /* @ts-ignore */
96
+ ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
97
+ this.showControl = input(true, /* @ts-ignore */
98
+ ...(ngDevMode ? [{ debugName: "showControl" }] : /* istanbul ignore next */ []));
99
+ //#endregion
100
+ //#region ----- Outputs -----
101
+ this.selectedIdsChange = output();
102
+ //#endregion
103
+ //#region ----- Computed Properties -----
104
+ this.look = computed(() => resolvePpeItemViewerLook(this.layout()), /* @ts-ignore */
105
+ ...(ngDevMode ? [{ debugName: "look" }] : /* istanbul ignore next */ []));
106
+ this.selectedIdSet = computed(() => new Set(this.selectedIds()), /* @ts-ignore */
107
+ ...(ngDevMode ? [{ debugName: "selectedIdSet" }] : /* istanbul ignore next */ []));
108
+ }
109
+ //#endregion
110
+ //#region ----- Event Handlers -----
111
+ isSelected(itemId) {
112
+ return this.selectedIdSet().has(itemId);
113
+ }
114
+ onItemSelectedChange(itemId, selected) {
115
+ if (this.disabled() || this.readonly()) {
116
+ return;
117
+ }
118
+ const next = this.items()
119
+ .map((item) => item.id)
120
+ .filter((id) => (id === itemId ? selected : this.selectedIdSet().has(id)));
121
+ this.selectedIdsChange.emit(next);
122
+ }
123
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMPpeItemViewerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
124
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: AXMPpeItemViewerComponent, isStandalone: true, selector: "axm-ppe-item-viewer", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null }, selectedIds: { classPropertyName: "selectedIds", publicName: "selectedIds", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, showControl: { classPropertyName: "showControl", publicName: "showControl", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectedIdsChange: "selectedIdsChange" }, host: { classAttribute: "axm-ppe-item-viewer block w-full" }, ngImport: i0, template: "@if (loading()) {\n <!-- ----- Loading indicator while configured PPE items are fetched ----- -->\n <ax-loading></ax-loading>\n}\n<!-- ----- Empty state when no PPE items are configured ----- -->\n@else if (items().length === 0) {\n <p class=\"axm-ppe-item-viewer__empty\">\n {{ '@workplacesafety-management:ppe-items.components.ppe-item-viewer.empty' | translate | async }}\n </p>\n}\n<!-- ----- PPE items in card grid or checklist list ----- -->\n@else {\n <div\n class=\"axm-ppe-item-viewer__items\"\n [class.axm-ppe-item-viewer__items--card]=\"look() === 'card'\"\n [class.axm-ppe-item-viewer__items--list]=\"look() === 'list'\"\n >\n @for (item of items(); track item.id) {\n <axm-ppe-item-card\n [item]=\"item\"\n [look]=\"look()\"\n [selected]=\"isSelected(item.id)\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [showControl]=\"showControl()\"\n (selectedChange)=\"onItemSelectedChange(item.id, $event)\"\n />\n }\n </div>\n}\n", styles: ["@layer properties;.axm-ppe-item-viewer{width:100%}.axm-ppe-item-viewer .axm-ppe-item-viewer__empty{margin:0;font-size:var(--text-sm, .875rem);line-height:var(--tw-leading, var(--text-sm--line-height, calc(1.25 / .875)));color:rgba(var(--ax-sys-color-text-default))}@supports (color: color-mix(in lab,red,red)){.axm-ppe-item-viewer .axm-ppe-item-viewer__empty{color:color-mix(in oklab,rgba(var(--ax-sys-color-text-default)) 80%,transparent)}}.axm-ppe-item-viewer .axm-ppe-item-viewer__items--card{display:grid;grid-template-columns:repeat(auto-fill,minmax(9.5rem,1fr));width:100%;gap:calc(var(--spacing, .25rem) * 3)}.axm-ppe-item-viewer .axm-ppe-item-viewer__items--list{display:flex;width:100%;flex-direction:column}.axm-ppe-item-viewer .axm-ppe-item-viewer__items--list>*+*{border-top-style:var(--tw-border-style);border-top-width:1px;border-color:rgba(var(--ax-sys-color-surface))}@property --tw-border-style{syntax: \"*\"; inherits: false; initial-value: solid;}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style: solid}}}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"], dependencies: [{ kind: "ngmodule", type: AXLoadingModule }, { kind: "component", type: i1$2.AXLoadingComponent, selector: "ax-loading", inputs: ["visible", "type", "context"], outputs: ["visibleChange"] }, { kind: "ngmodule", type: AXTranslationModule }, { kind: "component", type: AXMPpeItemCardComponent, selector: "axm-ppe-item-card", inputs: ["item", "look", "selected", "disabled", "readonly", "showControl"], outputs: ["selectedChange"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "pipe", type: i1$3.AXTranslatorPipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
125
+ }
126
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMPpeItemViewerComponent, decorators: [{
127
+ type: Component,
128
+ args: [{ selector: 'axm-ppe-item-viewer', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [AsyncPipe, AXLoadingModule, AXTranslationModule, AXMPpeItemCardComponent], host: {
129
+ class: 'axm-ppe-item-viewer block w-full',
130
+ }, template: "@if (loading()) {\n <!-- ----- Loading indicator while configured PPE items are fetched ----- -->\n <ax-loading></ax-loading>\n}\n<!-- ----- Empty state when no PPE items are configured ----- -->\n@else if (items().length === 0) {\n <p class=\"axm-ppe-item-viewer__empty\">\n {{ '@workplacesafety-management:ppe-items.components.ppe-item-viewer.empty' | translate | async }}\n </p>\n}\n<!-- ----- PPE items in card grid or checklist list ----- -->\n@else {\n <div\n class=\"axm-ppe-item-viewer__items\"\n [class.axm-ppe-item-viewer__items--card]=\"look() === 'card'\"\n [class.axm-ppe-item-viewer__items--list]=\"look() === 'list'\"\n >\n @for (item of items(); track item.id) {\n <axm-ppe-item-card\n [item]=\"item\"\n [look]=\"look()\"\n [selected]=\"isSelected(item.id)\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [showControl]=\"showControl()\"\n (selectedChange)=\"onItemSelectedChange(item.id, $event)\"\n />\n }\n </div>\n}\n", styles: ["@layer properties;.axm-ppe-item-viewer{width:100%}.axm-ppe-item-viewer .axm-ppe-item-viewer__empty{margin:0;font-size:var(--text-sm, .875rem);line-height:var(--tw-leading, var(--text-sm--line-height, calc(1.25 / .875)));color:rgba(var(--ax-sys-color-text-default))}@supports (color: color-mix(in lab,red,red)){.axm-ppe-item-viewer .axm-ppe-item-viewer__empty{color:color-mix(in oklab,rgba(var(--ax-sys-color-text-default)) 80%,transparent)}}.axm-ppe-item-viewer .axm-ppe-item-viewer__items--card{display:grid;grid-template-columns:repeat(auto-fill,minmax(9.5rem,1fr));width:100%;gap:calc(var(--spacing, .25rem) * 3)}.axm-ppe-item-viewer .axm-ppe-item-viewer__items--list{display:flex;width:100%;flex-direction:column}.axm-ppe-item-viewer .axm-ppe-item-viewer__items--list>*+*{border-top-style:var(--tw-border-style);border-top-width:1px;border-color:rgba(var(--ax-sys-color-surface))}@property --tw-border-style{syntax: \"*\"; inherits: false; initial-value: solid;}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style: solid}}}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"] }]
131
+ }], propDecorators: { items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }], layout: [{ type: i0.Input, args: [{ isSignal: true, alias: "layout", required: false }] }], selectedIds: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedIds", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], showControl: [{ type: i0.Input, args: [{ isSignal: true, alias: "showControl", required: false }] }], selectedIdsChange: [{ type: i0.Output, args: ["selectedIdsChange"] }] } });
132
+
133
+ //#region ----- Imports -----
134
+ //#endregion
135
+ //#region ----- Service -----
136
+ class AXMPpeItemViewerService {
137
+ constructor() {
138
+ //#region ----- Services & Dependencies -----
139
+ this.entityService = inject(AXPEntityService);
140
+ this.translationService = inject(AXTranslationService);
141
+ this.fileStorage = inject(AXPFileStorageService, { optional: true });
142
+ }
143
+ //#endregion
144
+ //#region ----- Public API -----
145
+ async loadDisplayItems(ids) {
146
+ if (ids.length === 0) {
147
+ return [];
148
+ }
149
+ const records = await this.queryByIds(ids);
150
+ const byId = new Map(records.map((row) => [row.id, row]));
151
+ const locale = this.translationService.getActiveLang() ?? 'en-US';
152
+ return ids
153
+ .map((id) => byId.get(id))
154
+ .filter((row) => row != null)
155
+ .map((row) => this.toDisplayItem(row, locale));
156
+ }
157
+ //#endregion
158
+ //#region ----- Data Loading -----
159
+ async queryByIds(ids) {
160
+ const dataAccessor = this.entityService
161
+ .withEntity(RootConfig.module.name, RootConfig.entities.ppeItem.name)
162
+ .data();
163
+ try {
164
+ const result = await dataAccessor.query({
165
+ skip: 0,
166
+ take: Math.max(ids.length, 100),
167
+ filter: ids.length === 1
168
+ ? { field: 'id', operator: { type: 'equal' }, value: ids[0] }
169
+ : { field: 'id', operator: { type: 'in' }, value: ids },
170
+ });
171
+ return result?.items ?? [];
172
+ }
173
+ catch {
174
+ const loaded = [];
175
+ for (const id of ids) {
176
+ try {
177
+ const row = await dataAccessor.byKey(id);
178
+ if (row) {
179
+ loaded.push(row);
180
+ }
181
+ }
182
+ catch {
183
+ /* skip missing rows */
184
+ }
185
+ }
186
+ return loaded;
187
+ }
188
+ }
189
+ toDisplayItem(row, locale) {
190
+ const title = resolveMultiLanguageString(row.title, locale);
191
+ const code = typeof row.code === 'string' ? row.code.trim() : '';
192
+ const serialNumber = typeof row.serialNumber === 'string' ? row.serialNumber.trim() : '';
193
+ return {
194
+ id: row.id,
195
+ title,
196
+ code: code.length > 0 ? code : undefined,
197
+ serialNumber: serialNumber.length > 0 ? serialNumber : undefined,
198
+ imageUrl: this.resolveIconUrl(row.icon),
199
+ };
200
+ }
201
+ resolveIconUrl(icon) {
202
+ const trimmed = icon?.trim();
203
+ if (!trimmed) {
204
+ return null;
205
+ }
206
+ if (this.fileStorage && isStoredImageFileId(trimmed)) {
207
+ const displayUrl = resolveStoredImageDisplayUrl(trimmed, (fileId) => this.fileStorage.getDownloadUrl(fileId));
208
+ return displayUrl || null;
209
+ }
210
+ return resolveStoredImageDisplayUrl(trimmed, () => '') || null;
211
+ }
212
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMPpeItemViewerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
213
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMPpeItemViewerService, providedIn: 'root' }); }
214
+ }
215
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMPpeItemViewerService, decorators: [{
216
+ type: Injectable,
217
+ args: [{ providedIn: 'root' }]
218
+ }] });
219
+
220
+ export { AXMPpeItemViewerService as A, AXMPpeItemViewerComponent as a };
221
+ //# sourceMappingURL=acorex-platform-module-workplacesafety-management-client-ppe-item-viewer.service-YS8FHiRu.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-platform-module-workplacesafety-management-client-ppe-item-viewer.service-YS8FHiRu.mjs","sources":["../../../../libs/modules/workplacesafety-management/client/src/lib/features/ppe-item-viewer/ppe-item-card.component.ts","../../../../libs/modules/workplacesafety-management/client/src/lib/features/ppe-item-viewer/ppe-item-card.component.html","../../../../libs/modules/workplacesafety-management/client/src/lib/features/ppe-item-viewer/ppe-item-viewer.component.ts","../../../../libs/modules/workplacesafety-management/client/src/lib/features/ppe-item-viewer/ppe-item-viewer.component.html","../../../../libs/modules/workplacesafety-management/client/src/lib/features/ppe-item-viewer/ppe-item-viewer.service.ts"],"sourcesContent":["//#region ----- Imports -----\n\nimport { AXValueChangedEvent } from '@acorex/cdk/common';\nimport { AXCheckBoxModule } from '@acorex/components/check-box';\nimport { AXDecoratorModule } from '@acorex/components/decorators';\nimport { ChangeDetectionStrategy, Component, computed, input, output, ViewEncapsulation } from '@angular/core';\nimport { FormsModule } from '@angular/forms';\n\nimport type { AXMPpeItemViewerDisplayItem, AXMPpeItemViewerLook } from './ppe-item-viewer.types';\nimport { ppeItemViewerStandardText } from './ppe-item-viewer.util';\n\n//#endregion\n\n//#region ----- Component -----\n\n@Component({\n selector: 'axm-ppe-item-card',\n templateUrl: './ppe-item-card.component.html',\n styleUrl: './ppe-item-card.component.css',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n imports: [AXCheckBoxModule, AXDecoratorModule, FormsModule],\n host: {\n class: 'axm-ppe-item-card',\n '[class.axm-ppe-item-card--list]': 'look() === \"list\"',\n '[class.axm-ppe-item-card--card]': 'look() === \"card\"',\n '[class.axm-ppe-item-card--selected]': 'selected()',\n '[class.axm-ppe-item-card--interactive]': 'interactive()',\n '[class.axm-ppe-item-card--disabled]': 'disabled()',\n },\n})\nexport class AXMPpeItemCardComponent {\n //#region ----- Inputs -----\n\n readonly item = input.required<AXMPpeItemViewerDisplayItem>();\n readonly look = input<AXMPpeItemViewerLook>('card');\n readonly selected = input(false);\n readonly disabled = input(false);\n readonly readonly = input(false);\n readonly showControl = input(true);\n\n //#endregion\n\n //#region ----- Outputs -----\n\n readonly selectedChange = output<boolean>();\n\n //#endregion\n\n //#region ----- Computed Properties -----\n\n protected readonly interactive = computed(\n () => this.showControl() && !this.disabled() && !this.readonly(),\n );\n\n protected readonly standardText = computed(() => ppeItemViewerStandardText(this.item()));\n\n //#endregion\n\n //#region ----- Event Handlers -----\n\n protected onActivate(): void {\n if (!this.interactive()) {\n return;\n }\n this.selectedChange.emit(!this.selected());\n }\n\n protected onCheckChanged(event: AXValueChangedEvent<boolean>): void {\n if (!event.isUserInteraction || !this.interactive()) {\n return;\n }\n this.selectedChange.emit(Boolean(event.value));\n }\n\n protected onControlClick(event: Event): void {\n event.stopPropagation();\n }\n\n //#endregion\n}\n\n//#endregion\n","<div class=\"axm-ppe-item-card__body\" (click)=\"onActivate()\">\n <!-- ----- PPE icon ----- -->\n @if (item().imageUrl) {\n <div class=\"axm-ppe-item-card__icon\">\n <img [src]=\"item().imageUrl\" [alt]=\"item().title\" />\n </div>\n }\n <!-- ----- Fallback icon when the PPE item has no image ----- -->\n @else {\n <div class=\"axm-ppe-item-card__icon axm-ppe-item-card__icon--fallback\">\n <ax-icon icon=\"fa-light fa-helmet-safety\"></ax-icon>\n </div>\n }\n\n <div class=\"axm-ppe-item-card__content\">\n <span class=\"axm-ppe-item-card__title\">{{ item().title }}</span>\n <!--->\n <!-- ----- Standard / code when present ----- -->\n @if (standardText()) {\n <span class=\"axm-ppe-item-card__code\">{{ standardText() }}</span>\n }\n </div>\n\n <!-- ----- Selection checkbox ----- -->\n @if (showControl()) {\n <div class=\"axm-ppe-item-card__control\" (click)=\"onControlClick($event)\">\n <ax-check-box\n [ngModel]=\"selected()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n (onValueChanged)=\"onCheckChanged($event)\"\n ></ax-check-box>\n </div>\n }\n</div>\n","//#region ----- Imports -----\n\nimport { AXLoadingModule } from '@acorex/components/loading';\nimport { AXTranslationModule } from '@acorex/core/translation';\nimport { AsyncPipe } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, computed, input, output, ViewEncapsulation } from '@angular/core';\n\nimport { AXMPpeItemCardComponent } from './ppe-item-card.component';\nimport type {\n AXMPpeItemViewerDisplayItem,\n AXMPpeItemViewerLayout,\n AXMPpeItemViewerLook,\n} from './ppe-item-viewer.types';\nimport { resolvePpeItemViewerLook } from './ppe-item-viewer.util';\n\n//#endregion\n\n//#region ----- Component -----\n\n@Component({\n selector: 'axm-ppe-item-viewer',\n templateUrl: './ppe-item-viewer.component.html',\n styleUrl: './ppe-item-viewer.component.css',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n imports: [AsyncPipe, AXLoadingModule, AXTranslationModule, AXMPpeItemCardComponent],\n host: {\n class: 'axm-ppe-item-viewer block w-full',\n },\n})\nexport class AXMPpeItemViewerComponent {\n //#region ----- Inputs -----\n\n readonly items = input<AXMPpeItemViewerDisplayItem[]>([]);\n readonly layout = input<AXMPpeItemViewerLayout>('horizontal');\n readonly selectedIds = input<readonly string[]>([]);\n readonly loading = input(false);\n readonly disabled = input(false);\n readonly readonly = input(false);\n readonly showControl = input(true);\n\n //#endregion\n\n //#region ----- Outputs -----\n\n readonly selectedIdsChange = output<string[]>();\n\n //#endregion\n\n //#region ----- Computed Properties -----\n\n protected readonly look = computed<AXMPpeItemViewerLook>(() =>\n resolvePpeItemViewerLook(this.layout()),\n );\n\n protected readonly selectedIdSet = computed(() => new Set(this.selectedIds()));\n\n //#endregion\n\n //#region ----- Event Handlers -----\n\n protected isSelected(itemId: string): boolean {\n return this.selectedIdSet().has(itemId);\n }\n\n protected onItemSelectedChange(itemId: string, selected: boolean): void {\n if (this.disabled() || this.readonly()) {\n return;\n }\n const next = this.items()\n .map((item) => item.id)\n .filter((id) => (id === itemId ? selected : this.selectedIdSet().has(id)));\n this.selectedIdsChange.emit(next);\n }\n\n //#endregion\n}\n\n//#endregion\n","@if (loading()) {\n <!-- ----- Loading indicator while configured PPE items are fetched ----- -->\n <ax-loading></ax-loading>\n}\n<!-- ----- Empty state when no PPE items are configured ----- -->\n@else if (items().length === 0) {\n <p class=\"axm-ppe-item-viewer__empty\">\n {{ '@workplacesafety-management:ppe-items.components.ppe-item-viewer.empty' | translate | async }}\n </p>\n}\n<!-- ----- PPE items in card grid or checklist list ----- -->\n@else {\n <div\n class=\"axm-ppe-item-viewer__items\"\n [class.axm-ppe-item-viewer__items--card]=\"look() === 'card'\"\n [class.axm-ppe-item-viewer__items--list]=\"look() === 'list'\"\n >\n @for (item of items(); track item.id) {\n <axm-ppe-item-card\n [item]=\"item\"\n [look]=\"look()\"\n [selected]=\"isSelected(item.id)\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [showControl]=\"showControl()\"\n (selectedChange)=\"onItemSelectedChange(item.id, $event)\"\n />\n }\n </div>\n}\n","//#region ----- Imports -----\n\nimport { resolveMultiLanguageString } from '@acorex-platform/framework-shared/core';\nimport { AXPFileStorageService, isStoredImageFileId, resolveStoredImageDisplayUrl } from '@acorex-platform/framework-client/common';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { Injectable, inject } from '@angular/core';\n\nimport { RootConfig, type AXMWorkplaceSafetyManagementPpeItemEntityModel } from '@acorex-platform/module-workplacesafety-management-client/contracts';\n\nimport type { AXMPpeItemViewerDisplayItem } from './ppe-item-viewer.types';\n\n//#endregion\n\n//#region ----- Service -----\n\n@Injectable({ providedIn: 'root' })\nexport class AXMPpeItemViewerService {\n //#region ----- Services & Dependencies -----\n\n private readonly entityService = inject(AXPEntityService);\n private readonly translationService = inject(AXTranslationService);\n private readonly fileStorage = inject(AXPFileStorageService, { optional: true });\n\n //#endregion\n\n //#region ----- Public API -----\n\n async loadDisplayItems(ids: string[]): Promise<AXMPpeItemViewerDisplayItem[]> {\n if (ids.length === 0) {\n return [];\n }\n\n const records = await this.queryByIds(ids);\n const byId = new Map(records.map((row) => [row.id, row]));\n const locale = this.translationService.getActiveLang() ?? 'en-US';\n\n return ids\n .map((id) => byId.get(id))\n .filter((row): row is AXMWorkplaceSafetyManagementPpeItemEntityModel => row != null)\n .map((row) => this.toDisplayItem(row, locale));\n }\n\n //#endregion\n\n //#region ----- Data Loading -----\n\n private async queryByIds(ids: string[]): Promise<AXMWorkplaceSafetyManagementPpeItemEntityModel[]> {\n const dataAccessor = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.ppeItem.name)\n .data<string, AXMWorkplaceSafetyManagementPpeItemEntityModel>();\n\n try {\n const result = await dataAccessor.query({\n skip: 0,\n take: Math.max(ids.length, 100),\n filter:\n ids.length === 1\n ? { field: 'id', operator: { type: 'equal' }, value: ids[0] }\n : { field: 'id', operator: { type: 'in' }, value: ids },\n });\n return result?.items ?? [];\n } catch {\n const loaded: AXMWorkplaceSafetyManagementPpeItemEntityModel[] = [];\n for (const id of ids) {\n try {\n const row = await dataAccessor.byKey(id);\n if (row) {\n loaded.push(row);\n }\n } catch {\n /* skip missing rows */\n }\n }\n return loaded;\n }\n }\n\n private toDisplayItem(\n row: AXMWorkplaceSafetyManagementPpeItemEntityModel,\n locale: string,\n ): AXMPpeItemViewerDisplayItem {\n const title = resolveMultiLanguageString(row.title, locale);\n const code = typeof row.code === 'string' ? row.code.trim() : '';\n const serialNumber = typeof row.serialNumber === 'string' ? row.serialNumber.trim() : '';\n return {\n id: row.id,\n title,\n code: code.length > 0 ? code : undefined,\n serialNumber: serialNumber.length > 0 ? serialNumber : undefined,\n imageUrl: this.resolveIconUrl(row.icon),\n };\n }\n\n private resolveIconUrl(icon: string | undefined): string | null {\n const trimmed = icon?.trim();\n if (!trimmed) {\n return null;\n }\n if (this.fileStorage && isStoredImageFileId(trimmed)) {\n const displayUrl = resolveStoredImageDisplayUrl(trimmed, (fileId) =>\n this.fileStorage!.getDownloadUrl(fileId),\n );\n return displayUrl || null;\n }\n return resolveStoredImageDisplayUrl(trimmed, () => '') || null;\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":["i3","i2"],"mappings":";;;;;;;;;;;;;;;;;;;AAWA;AAEA;MAkBa,uBAAuB,CAAA;AAhBpC,IAAA,WAAA,GAAA;;QAmBW,IAAA,CAAA,IAAI,GAAG,KAAK,CAAC,QAAQ;iFAA+B;QACpD,IAAA,CAAA,IAAI,GAAG,KAAK,CAAuB,MAAM;iFAAC;QAC1C,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAC,KAAK;qFAAC;QACvB,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAC,KAAK;qFAAC;QACvB,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAC,KAAK;qFAAC;QACvB,IAAA,CAAA,WAAW,GAAG,KAAK,CAAC,IAAI;wFAAC;;;QAMzB,IAAA,CAAA,cAAc,GAAG,MAAM,EAAW;;;QAMxB,IAAA,CAAA,WAAW,GAAG,QAAQ,CAC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#region ----- Lookup id extraction -----
4
+ function extractLookupId(value) {
5
+ if (typeof value === 'string') {
6
+ const trimmed = value.trim();
7
+ return trimmed.length > 0 ? trimmed : null;
8
+ }
9
+ if (value && typeof value === 'object' && !Array.isArray(value)) {
10
+ const id = value.id;
11
+ if (typeof id === 'string' && id.trim().length > 0) {
12
+ return id.trim();
13
+ }
14
+ }
15
+ return null;
16
+ }
17
+ /**
18
+ * Normalizes widget config or bound answer values to PPE item ids.
19
+ * Lookup multiple may persist `string[]` or `{ id }[]`.
20
+ */
21
+ function extractPpeItemIds(value) {
22
+ if (value == null) {
23
+ return [];
24
+ }
25
+ if (Array.isArray(value)) {
26
+ const ids = [];
27
+ const seen = new Set();
28
+ for (const entry of value) {
29
+ const id = extractLookupId(entry);
30
+ if (id && !seen.has(id)) {
31
+ seen.add(id);
32
+ ids.push(id);
33
+ }
34
+ }
35
+ return ids;
36
+ }
37
+ const single = extractLookupId(value);
38
+ return single ? [single] : [];
39
+ }
40
+ //#endregion
41
+ //#region ----- Layout -----
42
+ function resolvePpeItemViewerLayout(value) {
43
+ const raw = typeof value === 'string' ? value : value?.id;
44
+ return raw === 'vertical' ? 'vertical' : 'horizontal';
45
+ }
46
+ /** Horizontal layout is a card grid; vertical layout is a checklist-style list. */
47
+ function resolvePpeItemViewerLook(value) {
48
+ return resolvePpeItemViewerLayout(value) === 'vertical' ? 'list' : 'card';
49
+ }
50
+ function ppeItemViewerStandardText(item) {
51
+ const code = item.code?.trim() ?? '';
52
+ const serial = item.serialNumber?.trim() ?? '';
53
+ if (code && serial && serial !== code) {
54
+ return `${code} · ${serial}`;
55
+ }
56
+ return code || serial;
57
+ }
58
+ //#endregion
59
+
60
+ export { resolvePpeItemViewerLook as a, extractPpeItemIds as e, ppeItemViewerStandardText as p, resolvePpeItemViewerLayout as r };
61
+ //# sourceMappingURL=acorex-platform-module-workplacesafety-management-client-ppe-item-viewer.util-2Kl3_3sg.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-platform-module-workplacesafety-management-client-ppe-item-viewer.util-2Kl3_3sg.mjs","sources":["../../../../libs/modules/workplacesafety-management/client/src/lib/features/ppe-item-viewer/ppe-item-viewer.util.ts"],"sourcesContent":["//#region ----- Imports -----\n\nimport type {\n AXMPpeItemViewerDisplayItem,\n AXMPpeItemViewerLayout,\n AXMPpeItemViewerLayoutOption,\n AXMPpeItemViewerLook,\n} from './ppe-item-viewer.types';\n\n//#endregion\n\n//#region ----- Lookup id extraction -----\n\nfunction extractLookupId(value: unknown): string | null {\n if (typeof value === 'string') {\n const trimmed = value.trim();\n return trimmed.length > 0 ? trimmed : null;\n }\n if (value && typeof value === 'object' && !Array.isArray(value)) {\n const id = (value as { id?: unknown }).id;\n if (typeof id === 'string' && id.trim().length > 0) {\n return id.trim();\n }\n }\n return null;\n}\n\n/**\n * Normalizes widget config or bound answer values to PPE item ids.\n * Lookup multiple may persist `string[]` or `{ id }[]`.\n */\nexport function extractPpeItemIds(value: unknown): string[] {\n if (value == null) {\n return [];\n }\n if (Array.isArray(value)) {\n const ids: string[] = [];\n const seen = new Set<string>();\n for (const entry of value) {\n const id = extractLookupId(entry);\n if (id && !seen.has(id)) {\n seen.add(id);\n ids.push(id);\n }\n }\n return ids;\n }\n const single = extractLookupId(value);\n return single ? [single] : [];\n}\n\n//#endregion\n\n//#region ----- Layout -----\n\nexport function resolvePpeItemViewerLayout(\n value: AXMPpeItemViewerLayoutOption | string | undefined,\n): AXMPpeItemViewerLayout {\n const raw = typeof value === 'string' ? value : value?.id;\n return raw === 'vertical' ? 'vertical' : 'horizontal';\n}\n\n/** Horizontal layout is a card grid; vertical layout is a checklist-style list. */\nexport function resolvePpeItemViewerLook(\n value: AXMPpeItemViewerLayoutOption | string | undefined,\n): AXMPpeItemViewerLook {\n return resolvePpeItemViewerLayout(value) === 'vertical' ? 'list' : 'card';\n}\n\nexport function ppeItemViewerStandardText(item: AXMPpeItemViewerDisplayItem): string {\n const code = item.code?.trim() ?? '';\n const serial = item.serialNumber?.trim() ?? '';\n if (code && serial && serial !== code) {\n return `${code} · ${serial}`;\n }\n return code || serial;\n}\n\n//#endregion\n"],"names":[],"mappings":"AAAA;AASA;AAEA;AAEA,SAAS,eAAe,CAAC,KAAc,EAAA;AACrC,IAAA,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;AAC7B,QAAA,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE;AAC5B,QAAA,OAAO,OAAO,CAAC,MAAM,GAAG,CAAC,GAAG,OAAO,GAAG,IAAI;IAC5C;AACA,IAAA,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;AAC/D,QAAA,MAAM,EAAE,GAAI,KAA0B,CAAC,EAAE;AACzC,QAAA,IAAI,OAAO,EAAE,KAAK,QAAQ,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE;AAClD,YAAA,OAAO,EAAE,CAAC,IAAI,EAAE;QAClB;IACF;AACA,IAAA,OAAO,IAAI;AACb;AAEA;;;AAGG;AACG,SAAU,iBAAiB,CAAC,KAAc,EAAA;AAC9C,IAAA,IAAI,KAAK,IAAI,IAAI,EAAE;AACjB,QAAA,OAAO,EAAE;IACX;AACA,IAAA,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACxB,MAAM,GAAG,GAAa,EAAE;AACxB,QAAA,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU;AAC9B,QAAA,KAAK,MAAM,KAAK,IAAI,KAAK,EAAE;AACzB,YAAA,MAAM,EAAE,GAAG,eAAe,CAAC,KAAK,CAAC;YACjC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE;AACvB,gBAAA,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;AACZ,gBAAA,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YACd;QACF;AACA,QAAA,OAAO,GAAG;IACZ;AACA,IAAA,MAAM,MAAM,GAAG,eAAe,CAAC,KAAK,CAAC;IACrC,OAAO,MAAM,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE;AAC/B;AAEA;AAEA;AAEM,SAAU,0BAA0B,CACxC,KAAwD,EAAA;AAExD,IAAA,MAAM,GAAG,GAAG,OAAO,KAAK,KAAK,QAAQ,GAAG,KAAK,GAAG,KAAK,EAAE,EAAE;IACzD,OAAO,GAAG,KAAK,UAAU,GAAG,UAAU,GAAG,YAAY;AACvD;AAEA;AACM,SAAU,wBAAwB,CACtC,KAAwD,EAAA;AAExD,IAAA,OAAO,0BAA0B,CAAC,KAAK,CAAC,KAAK,UAAU,GAAG,MAAM,GAAG,MAAM;AAC3E;AAEM,SAAU,yBAAyB,CAAC,IAAiC,EAAA;IACzE,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE;IACpC,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE;IAC9C,IAAI,IAAI,IAAI,MAAM,IAAI,MAAM,KAAK,IAAI,EAAE;AACrC,QAAA,OAAO,CAAA,EAAG,IAAI,CAAA,GAAA,EAAM,MAAM,EAAE;IAC9B;IACA,OAAO,IAAI,IAAI,MAAM;AACvB;AAEA;;;;"}
@@ -5,7 +5,7 @@ import { inject, Injectable } from '@angular/core';
5
5
  import { get, defaultTo, isString } from 'lodash';
6
6
  import { AXPWidgetsList } from '@acorex-platform/framework-shared/core';
7
7
  import { AXPLayoutBuilderService } from '@acorex-platform/framework-client/layout/builder';
8
- import { A as AXMControlHierarchyDiagramService } from './acorex-platform-module-workplacesafety-management-client-control-hierarchy-diagram.service-BBhH7KP1.mjs';
8
+ import { A as AXMControlHierarchyDiagramService } from './acorex-platform-module-workplacesafety-management-client-control-hierarchy-diagram.service-tMrUDnCb.mjs';
9
9
 
10
10
  //#region ---- Imports ----
11
11
  //#endregion
@@ -30,7 +30,7 @@ class AXMControlHierarchyDiagramViewerService {
30
30
  title: get(options.context, 'title'),
31
31
  hierarchyDiagram: null,
32
32
  };
33
- const ref = await this.layoutBuilder
33
+ await this.layoutBuilder
34
34
  .create()
35
35
  .dialog((dialog) => {
36
36
  dialog
@@ -71,13 +71,9 @@ class AXMControlHierarchyDiagramViewerService {
71
71
  });
72
72
  });
73
73
  });
74
- })
75
- .setActions((actions) => {
76
- actions.cancel('@general:actions.close.title');
77
74
  });
78
75
  })
79
76
  .show();
80
- ref.close();
81
77
  }
82
78
  //#endregion
83
79
  //#region ---- Utility Methods ----
@@ -172,4 +168,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
172
168
  }] });
173
169
 
174
170
  export { AXMPreviewControlHierarchyDiagramCommand };
175
- //# sourceMappingURL=acorex-platform-module-workplacesafety-management-client-preview-control-hierarchy-diagram.command-C2X3VpEt.mjs.map
171
+ //# sourceMappingURL=acorex-platform-module-workplacesafety-management-client-preview-control-hierarchy-diagram.command-Dd9xdo_y.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-platform-module-workplacesafety-management-client-preview-control-hierarchy-diagram.command-Dd9xdo_y.mjs","sources":["../../../../libs/modules/workplacesafety-management/client/src/lib/features/control-hierarchy-diagram/control-hierarchy-diagram-viewer.service.ts","../../../../libs/modules/workplacesafety-management/client/src/lib/features/control-hierarchy-diagram/commands/preview-control-hierarchy-diagram.command.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { resolveEntityRowDisplayText } from '@acorex-platform/framework-client/common';\nimport { AXPWidgetsList } from '@acorex-platform/framework-shared/core';\nimport { AXPLayoutBuilderService } from '@acorex-platform/framework-client/layout/builder';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { inject, Injectable } from '@angular/core';\nimport { defaultTo, get } from 'lodash';\n\nimport { AXMControlHierarchyDiagramService } from './control-hierarchy-diagram.service';\n\n//#endregion\n\n//#region ---- Types ----\n\nexport interface AXMControlHierarchyDiagramViewerOpenOptions {\n context: Record<string, unknown>;\n title?: string;\n}\n\n//#endregion\n\n//#region ---- Control Hierarchy Diagram Viewer Service ----\n\n/**\n * Opens a read-only control hierarchy diagram preview dialog from form or record context.\n */\n@Injectable({ providedIn: 'root' })\nexport class AXMControlHierarchyDiagramViewerService {\n //#region ---- Services & Dependencies ----\n\n private readonly layoutBuilder = inject(AXPLayoutBuilderService);\n private readonly diagramService = inject(AXMControlHierarchyDiagramService);\n private readonly translation = inject(AXTranslationService);\n\n //#endregion\n\n //#region ---- Public API ----\n\n async open(options: AXMControlHierarchyDiagramViewerOpenOptions): Promise<void> {\n const context = {\n hierarchyDiagramViewType: defaultTo(get(options.context, 'hierarchyDiagramViewType'), 'horizontal'),\n itemIds: defaultTo(get(options.context, 'itemIds'), []),\n id: get(options.context, 'id'),\n title: get(options.context, 'title'),\n hierarchyDiagram: null,\n };\n\n await this.layoutBuilder\n .create()\n .dialog((dialog) => {\n dialog\n .setTitle(this.resolveDialogTitle(options.title))\n .setSize('lg')\n .setCloseButton(true)\n .setContext(context)\n .content((layout) => {\n layout.flex((flex) => {\n flex.setDirection('column');\n flex.formField(\n '@workplacesafety-management:control-measure-types.components.control-hierarchy-diagram.fields.view-type.title',\n (field) => {\n field.path('hierarchyDiagramViewType').selectBox({\n valueField: 'id',\n textField: 'title',\n dataSource: this.diagramService.getViewTypeOptions(),\n });\n },\n );\n flex.formField('', (field) => {\n field\n .path('hierarchyDiagram')\n .setShowLabel(false)\n .mode('view')\n .customWidget(AXPWidgetsList.Editors.ControlHierarchyDiagram, {\n showLabel: false,\n showTitle: false,\n showViewTypeSelector: false,\n viewType: '{{ context.eval(\"hierarchyDiagramViewType\") ?? \"horizontal\" }}',\n triggers: [\n {\n event: \"{{ events.context('hierarchyDiagramViewType') }}\",\n action: '{{ widget.refresh() }}',\n },\n {\n event: \"{{ events.context('itemIds') }}\",\n action: '{{ widget.refresh() }}',\n },\n ],\n });\n });\n });\n });\n })\n .show();\n }\n\n //#endregion\n\n //#region ---- Utility Methods ----\n\n private resolveDialogTitle(title: string | undefined): string {\n const resolved = resolveEntityRowDisplayText(title, this.translation.getActiveLang() ?? 'en-US');\n return resolved || 'Hierarchy Diagram';\n }\n\n //#endregion\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXTranslationService, resolveMultiLanguageString } from '@acorex/core/translation';\nimport { resolveEntityRowDisplayText } from '@acorex-platform/framework-client/common';\nimport { AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\n\nimport { Injectable, inject } from '@angular/core';\nimport { defaultTo, get, isString } from 'lodash';\n\nimport { AXMControlHierarchyDiagramViewerService } from '../control-hierarchy-diagram-viewer.service';\n\n//#endregion\n\n//#region ---- Command Types ----\n\nexport interface AXMPreviewControlHierarchyDiagramCommandInput {\n title?: string;\n itemIds?: unknown;\n hierarchyDiagramViewType?: string;\n id?: string;\n data?: Record<string, unknown>;\n options?: Partial<AXMPreviewControlHierarchyDiagramCommandInput>;\n}\n\n//#endregion\n\n//#region ---- Command ----\n\n@Injectable()\nexport class AXMPreviewControlHierarchyDiagramCommand\n implements AXPCommand<AXMPreviewControlHierarchyDiagramCommandInput, void>\n{\n //#region ---- Services & Dependencies ----\n\n private readonly translationService = inject(AXTranslationService);\n private readonly diagramViewer = inject(AXMControlHierarchyDiagramViewerService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(input: AXMPreviewControlHierarchyDiagramCommandInput): AXPCommandExecuteResultPromise<void> {\n try {\n const context = this.resolveContext(input);\n const dialogTitle = await this.resolveDialogTitle(input, context);\n\n await this.diagramViewer.open({\n context,\n title: dialogTitle,\n });\n\n return {\n success: true,\n kind: 'object',\n data: undefined,\n metadata: { refresh: false },\n };\n } catch {\n return {\n success: false,\n message: {\n text: await this.translationService.translateAsync('@general:messages.generic.error.description'),\n },\n };\n }\n }\n\n //#endregion\n\n //#region ---- Utility Methods ----\n\n private resolveContext(input: AXMPreviewControlHierarchyDiagramCommandInput): Record<string, unknown> {\n const ctxData = input.data;\n if (ctxData) {\n return {\n itemIds: defaultTo(get(ctxData, 'itemIds'), []),\n hierarchyDiagramViewType: defaultTo(get(ctxData, 'hierarchyDiagramViewType'), 'horizontal'),\n id: get(ctxData, 'id'),\n title: get(ctxData, 'title'),\n };\n }\n\n const ctxOpts = defaultTo(input.options, {});\n\n return {\n itemIds: defaultTo(get(input, 'itemIds'), defaultTo(get(ctxOpts, 'itemIds'), [])),\n hierarchyDiagramViewType: defaultTo(\n get(input, 'hierarchyDiagramViewType'),\n defaultTo(get(ctxOpts, 'hierarchyDiagramViewType'), 'horizontal'),\n ),\n id: defaultTo(get(input, 'id'), get(ctxOpts, 'id')),\n title: defaultTo(get(input, 'title'), get(ctxOpts, 'title')),\n };\n }\n\n private async resolveDialogTitle(\n input: AXMPreviewControlHierarchyDiagramCommandInput,\n context: Record<string, unknown>,\n ): Promise<string> {\n const previewLabel =\n (await this.translationService.translateAsync('@general:actions.preview.title')) || 'Preview';\n const locale = this.translationService.getActiveLang?.() ?? 'en-US';\n\n const explicitTitle = defaultTo(input.title, get(input, 'options.title'));\n if (isString(explicitTitle) && explicitTitle.trim().length > 0) {\n return `${previewLabel}: ${resolveMultiLanguageString(explicitTitle, locale).trim()}`;\n }\n\n const contextTitle = get(context, 'title');\n if (contextTitle != null) {\n const recordTitle = resolveEntityRowDisplayText(contextTitle, locale).trim();\n if (recordTitle.length > 0) {\n return `${previewLabel}: ${recordTitle}`;\n }\n }\n\n const diagramTitle =\n (await this.translationService.translateAsync(\n '@workplacesafety-management:control-measure-types.components.control-hierarchy-diagram.title',\n )) || 'Hierarchy Diagram';\n\n return `${previewLabel}: ${diagramTitle}`;\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;;;AAAA;AAoBA;AAEA;AAEA;;AAEG;MAEU,uCAAuC,CAAA;AADpD,IAAA,WAAA,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