@acorex-platform/module-workplacesafety-management-client 0.0.30 → 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
@@ -104,13 +104,6 @@ declare const AXMWorkplaceSafetyManagementPermissionKeys: {
104
104
  readonly Update: "SafetyRisk:Permission:MaintainSafety";
105
105
  readonly Delete: "SafetyRisk:Permission:MaintainSafety";
106
106
  };
107
- readonly HazardRiskPpeRule: {
108
- readonly Management: "SafetyRisk:Permission:MaintainSafety";
109
- readonly View: "SafetyRisk:Permission:MaintainSafety";
110
- readonly Create: "SafetyRisk:Permission:MaintainSafety";
111
- readonly Update: "SafetyRisk:Permission:MaintainSafety";
112
- readonly Delete: "SafetyRisk:Permission:MaintainSafety";
113
- };
114
107
  readonly ControlHierarchyLevels: {
115
108
  readonly Management: "SafetyRisk:Permission:Setup";
116
109
  };
@@ -223,13 +216,6 @@ declare const RootConfig: {
223
216
  titlePlural: string;
224
217
  icon: string;
225
218
  };
226
- hazardRiskPpeRule: {
227
- name: string;
228
- source: string;
229
- title: string;
230
- titlePlural: string;
231
- icon: string;
232
- };
233
219
  controlHierarchyLevels: {
234
220
  name: string;
235
221
  source: string;
@@ -511,6 +497,60 @@ interface AXMWorkplaceSafetyManagementSafetyPlanWorkStepEntityModel extends AXPE
511
497
  isArchived?: boolean;
512
498
  }
513
499
 
500
+ interface AXMWorkplaceSafetyManagementSafetyPlanSectionItemModel {
501
+ sectionTypeId: string;
502
+ sectionType?: AXMSectionTypeSnapshot;
503
+ /**
504
+ * Step Table only — selected Work Step (WorkStepType) that defines table columns.
505
+ * Persisted on the section items slot alongside row entity ids.
506
+ */
507
+ workStepTypeId?: string;
508
+ workStepType?: {
509
+ id: string;
510
+ title?: string;
511
+ code?: string;
512
+ };
513
+ itemIds?: string[];
514
+ items?: {
515
+ id: string;
516
+ title?: string;
517
+ code?: string;
518
+ }[];
519
+ }
520
+ /** Display options for section widgets (PPE layout, control-hierarchy viewType). Item ids stay on `items`. */
521
+ interface AXMSafetyPlanSectionWidgetOptions {
522
+ layout?: unknown;
523
+ viewType?: unknown;
524
+ showTitle?: boolean;
525
+ showViewTypeSelector?: boolean;
526
+ [key: string]: unknown;
527
+ }
528
+ interface AXMWorkplaceSafetyManagementSafetyPlanSectionEntityModel extends AXPEntityModel<string> {
529
+ /** Business code from identifier rule `safety-plan-section-code` (`SPS-{seq:4}`). */
530
+ code: string;
531
+ safetyPlanId: string;
532
+ safetyPlan?: {
533
+ id: string;
534
+ title?: string;
535
+ code?: string;
536
+ };
537
+ title: string;
538
+ description?: string;
539
+ /** Section line items managed via repeater (embedded value objects). */
540
+ items: AXMWorkplaceSafetyManagementSafetyPlanSectionItemModel[];
541
+ /**
542
+ * SafetyPlanTypeSection this row was created from.
543
+ * Stored as a snapshot link only — later type-section edits do not affect this plan.
544
+ */
545
+ sourceSafetyPlanTypeSectionId?: string;
546
+ /** List / display order within the plan. */
547
+ sortOrder?: number;
548
+ /** Widget display options (PPE layout, control-hierarchy view). Not used for Risk Matrix. */
549
+ widgetOptions?: AXMSafetyPlanSectionWidgetOptions;
550
+ /** Managed by the archive plugin (`isArchived`). */
551
+ isArchived?: boolean;
552
+ }
553
+
514
554
  /** One Step Table body row in the section builder. */
515
555
  interface AXMSafetyPlanStepTableRowBuilderPayload {
516
556
  cells: AXMStepTableCellValue[];
@@ -553,6 +593,8 @@ interface AXMSafetyPlanSectionBuilderSectionValue {
553
593
  workStepType?: AXMWorkStepTypeSnapshot;
554
594
  /** Columns loaded from the selected Work Step configuration. */
555
595
  columns?: AXMStepTableColumnDef[];
596
+ /** Widget display options (PPE layout, control-hierarchy view). */
597
+ widgetOptions?: AXMSafetyPlanSectionWidgetOptions;
556
598
  items: AXMSafetyPlanSectionBuilderItemValue[];
557
599
  }
558
600
  interface AXMSafetyPlanSectionBuilderValue {
@@ -571,7 +613,7 @@ interface AXMSectionTypeDerivedFilterDependency {
571
613
  kind: 'derivedFromParent';
572
614
  parentSectionTypeKey: AXMSectionTypeCode;
573
615
  /** Field path on the parent entity record used to resolve filter values. */
574
- resolveField: 'riskMatrixId' | 'controlMeasureIds';
616
+ resolveField: 'riskMatrixId';
575
617
  /** Field on the child lookup entity (typically `id`). */
576
618
  filterField: string;
577
619
  }
@@ -615,7 +657,6 @@ declare function resolveParentHazardRiskIds(sections: AXMSafetyPlanSectionBuilde
615
657
  */
616
658
  declare function clearDependentItemsOnParentChange(previous: AXMSafetyPlanSectionBuilderValue, next: AXMSafetyPlanSectionBuilderValue): AXMSafetyPlanSectionBuilderValue;
617
659
  declare function extractRiskMatrixIdsFromHazardRisks(records: Record<string, unknown>[]): string[];
618
- declare function extractControlMeasureIdsFromHazardRisks(records: Record<string, unknown>[]): string[];
619
660
  declare function resolveSafetyPlanSectionItemFilter(sectionTypeId: string, parentHazardIds: string[], parentHazardRiskIds?: string[]): Record<string, unknown> | null;
620
661
  declare function resolveSafetyPlanSectionItemFilterAsync(sectionTypeId: string, sections: AXMSafetyPlanSectionBuilderSectionValue[], sectionIndex: number, loadHazardRisks: AXMHazardRiskRecordLoader): Promise<Record<string, unknown> | null>;
621
662
  /** Clears item selection when section type changes in item dialog context. */
@@ -646,7 +687,12 @@ declare function buildSafetyPlanSectionItemLookupOptions(entityExpression: strin
646
687
  }): Record<string, unknown>;
647
688
  /** Lookup options with entity data-selector popup UI (`look: 'lookup'`). */
648
689
  declare function buildSafetyPlanSectionItemSelectorOptions(entityExpression: string, options?: Parameters<typeof buildSafetyPlanSectionItemLookupOptions>[1]): Record<string, unknown>;
649
- declare function resolveSafetyPlanSectionItemColumns(sectionTypeId: string): string[];
690
+ /** Selector column: string names are visible; `{ visible: false }` is queried for widget context only. */
691
+ type AXMSafetyPlanSectionItemColumn = string | {
692
+ name: string;
693
+ visible?: boolean;
694
+ };
695
+ declare function resolveSafetyPlanSectionItemColumns(sectionTypeId: string): AXMSafetyPlanSectionItemColumn[];
650
696
  declare function resolveSafetyPlanSectionItemEntityKey(sectionTypeId: string, sectionType?: AXMSectionTypeSnapshot): string | undefined;
651
697
  declare function mapSafetyPlanSectionSelectedItems(sectionTypeId: string, selectedItems: Array<Record<string, unknown>>): Array<{
652
698
  id: string;
@@ -662,11 +708,7 @@ declare const SAFETY_PLAN_SECTIONS_PAGE_COMPONENT_KEY = "safety-plan-sections-pa
662
708
  /** Section type row managed via repeater on Safety Plan Type Section. */
663
709
  interface AXMWorkplaceSafetyManagementSafetyPlanTypeSectionTypeItemModel {
664
710
  sectionTypeId: string;
665
- sectionType?: {
666
- id: string;
667
- title?: string;
668
- code?: string;
669
- };
711
+ sectionType?: AXMSectionTypeSnapshot;
670
712
  }
671
713
  interface AXMWorkplaceSafetyManagementSafetyPlanTypeSectionEntityModel extends AXPEntityModel<string> {
672
714
  safetyPlanTypeId: string;
@@ -692,11 +734,7 @@ interface AXMWorkplaceSafetyManagementSafetyPlanTypeSectionEntityModel extends A
692
734
  interface AXMSafetyPlanSectionStructureItem {
693
735
  id: string;
694
736
  sectionTypeId: string;
695
- sectionType?: {
696
- id: string;
697
- title?: string;
698
- code?: string;
699
- };
737
+ sectionType?: AXMSectionTypeSnapshot;
700
738
  title: string;
701
739
  description?: string;
702
740
  /** Links the plan section back to the type template it was created from. */
@@ -728,12 +766,28 @@ interface AXMSafetyPlanSectionStructureValidationContext {
728
766
  /** Section type ids that may appear more than once on a plan. */
729
767
  repeatableSectionTypeIds?: readonly string[];
730
768
  }
731
- type AXMSafetyPlanSectionStructureValidationIssueCode = 'REQUIRED_SECTION_MISSING' | 'SECTION_TYPE_NOT_ALLOWED' | 'DUPLICATE_NON_REPEATABLE_SECTION' | 'INVALID_TYPE_SECTION_TEMPLATE' | 'INVALID_SORT_ORDER';
769
+ type AXMSafetyPlanSectionStructureValidationIssueCode = 'REQUIRED_SECTION_MISSING' | 'SECTION_TYPE_NOT_ALLOWED' | 'INVALID_TYPE_SECTION_TEMPLATE' | 'INVALID_SORT_ORDER';
732
770
  interface AXMSafetyPlanSectionStructureValidationIssue {
733
771
  code: AXMSafetyPlanSectionStructureValidationIssueCode;
734
772
  messageKey: string;
735
773
  details?: Record<string, unknown>;
736
774
  }
775
+ /** Coerces a stored string or locale map into a single display string. */
776
+ declare function asSafetyPlanDisplayText(value: unknown): string;
777
+ declare function buildSectionTypeRelationSnapshot(sectionTypeId: string, snapshot?: {
778
+ title?: unknown;
779
+ code?: unknown;
780
+ description?: unknown;
781
+ isRepeatable?: unknown;
782
+ } | null): AXMSectionTypeSnapshot;
783
+ /**
784
+ * Title persisted on SafetyPlanSection. Never stores a bare UUID — the UI translate
785
+ * pipe treats unknown keys as empty, which made seeded section headers blank.
786
+ */
787
+ declare function resolveSafetyPlanSectionPersistedTitle(sectionTitle: unknown, sectionTypeId: string, snapshot?: {
788
+ title?: unknown;
789
+ code?: unknown;
790
+ } | null): string;
737
791
  /** True when a type-section row is marked as the plan-type default template. */
738
792
  declare function isSafetyPlanTypeSectionDefault(row: {
739
793
  isDefault?: unknown;
@@ -751,11 +805,11 @@ declare function buildSectionStructureFromTypeSections(typeSections: readonly AX
751
805
  createId?: () => string;
752
806
  }): AXMSafetyPlanSectionStructureValue;
753
807
  /**
754
- * Removes accidental duplicate plan sections.
755
- * Non-repeatable section types are kept once (first wins); repeatable types may appear more than once.
756
- * Reassigns contiguous 1-based `sortOrder` to preserve display order.
808
+ * Removes accidental ghost rows from double materialization of the same type-section
809
+ * source. Distinct sections of the same type are kept. Reassigns contiguous 1-based
810
+ * `sortOrder` to preserve display order.
757
811
  */
758
- declare function dedupeSafetyPlanSectionStructure<T extends AXMSafetyPlanSectionStructureValue | AXMSafetyPlanSectionBuilderValue>(structure: T, options?: {
812
+ declare function dedupeSafetyPlanSectionStructure<T extends AXMSafetyPlanSectionStructureValue | AXMSafetyPlanSectionBuilderValue>(structure: T, _options?: {
759
813
  repeatableSectionTypeIds?: readonly string[];
760
814
  }): T;
761
815
  declare function collectAllowedSectionTypeIds(typeSections: readonly AXMWorkplaceSafetyManagementSafetyPlanTypeSectionEntityModel[]): string[];
@@ -769,32 +823,9 @@ declare function validateSafetyPlanSectionStructure(structure: AXMSafetyPlanSect
769
823
  declare function toBuilderValueFromStructure(structure: AXMSafetyPlanSectionStructureValue): AXMSafetyPlanSectionBuilderValue;
770
824
 
771
825
  /**
772
- * Shared helpers for Safety Plan Section uniqueness (section type per plan).
826
+ * Shared helpers for Safety Plan Section type identity (repeatable vs one-off).
773
827
  * Leaf module — imports only other contract leaves (no client/server layers).
774
828
  */
775
- declare const SAFETY_PLAN_SECTION_DUPLICATE_SECTION_TYPE_MESSAGE_KEY = "@workplacesafety-management:safety-plan-sections.messages.duplicate-section-type";
776
- /** Stable API / middleware error code for duplicate section type in a plan. */
777
- declare const SAFETY_PLAN_SECTION_DUPLICATE_SECTION_TYPE_CODE = "SAFETY_PLAN_SECTION_DUPLICATE_SECTION_TYPE";
778
- interface AXMSafetyPlanSectionTypeIdentity {
779
- id?: string;
780
- sectionTypeId?: unknown;
781
- sectionType?: {
782
- id?: unknown;
783
- isRepeatable?: boolean;
784
- };
785
- }
786
- interface AXMSafetyPlanSectionTypeUniquenessOptions {
787
- /** Section ids to ignore (e.g. the row being edited). */
788
- excludeSectionId?: string;
789
- /**
790
- * Section type ids that may appear more than once in a plan.
791
- * Types not listed are treated as non-repeatable unless the section type
792
- * snapshot / built-in map marks them repeatable.
793
- */
794
- repeatableSectionTypeIds?: readonly string[];
795
- }
796
- /** Resolves the section type id from a plan section identity or nested snapshot. */
797
- declare function resolveSafetyPlanSectionTypeId(section: Pick<AXMSafetyPlanSectionTypeIdentity, 'sectionTypeId' | 'sectionType'>): string;
798
829
  /**
799
830
  * True when this section type may appear more than once in a Safety Plan.
800
831
  * Checks (in order): snapshot flag, explicit allow-list, built-in section type meta.
@@ -807,21 +838,6 @@ declare function isSafetyPlanSectionTypeRepeatable(sectionTypeId: string, option
807
838
  }): boolean;
808
839
  /** Built-in section type ids that are always treated as repeatable. */
809
840
  declare function collectBuiltInRepeatableSectionTypeIds(): string[];
810
- /**
811
- * Returns the first duplicate non-repeatable `sectionTypeId` in the list, or `null`
812
- * when all non-repeatable types are unique. Empty / missing section type ids are ignored.
813
- * Repeatable section types are allowed to appear more than once.
814
- */
815
- declare function findDuplicateSafetyPlanSectionTypeId(sections: readonly AXMSafetyPlanSectionTypeIdentity[], options?: AXMSafetyPlanSectionTypeUniquenessOptions): string | null;
816
- /**
817
- * True when `sectionTypeId` already appears on another section in the collection
818
- * and the type is not repeatable.
819
- */
820
- declare function safetyPlanSectionTypeAlreadyExists(sections: readonly AXMSafetyPlanSectionTypeIdentity[], sectionTypeId: string, options?: AXMSafetyPlanSectionTypeUniquenessOptions & {
821
- sectionType?: {
822
- isRepeatable?: boolean;
823
- };
824
- }): boolean;
825
841
 
826
842
  /** True when the section type is the Step Table host for SafetyPlanWorkStep rows. */
827
843
  declare function isStepTableSectionType(sectionTypeId: string | undefined, snapshot?: AXMSectionTypeSnapshot): boolean;
@@ -973,25 +989,6 @@ interface AXMWorkplaceSafetyManagementHazardRiskEntityModel extends AXPEntityMod
973
989
  status?: AXPSystemStatusType.Active | AXPSystemStatusType.Inactive;
974
990
  }
975
991
 
976
- interface AXMWorkplaceSafetyManagementHazardRiskPpeRuleEntityModel extends AXPEntityModel<string> {
977
- hazardRiskId: string;
978
- hazardRisk?: {
979
- id: string;
980
- title?: string;
981
- code?: string;
982
- };
983
- ppeItemId: string;
984
- ppeItem?: {
985
- id: string;
986
- title?: string;
987
- code?: string;
988
- };
989
- requirementType: AXMHazardPpeRuleRequirementType;
990
- conditionNote?: string;
991
- usageInstruction?: string;
992
- status?: AXPSystemStatusType.Active | AXPSystemStatusType.Inactive;
993
- }
994
-
995
992
  interface AXMWorkplaceSafetyManagementPpeItemEntityModel extends AXPEntityModel<string> {
996
993
  code: string;
997
994
  title: AXPMultiLanguageString;
@@ -1033,54 +1030,6 @@ interface AXMWorkplaceSafetyManagementSafetyPlanEntityModel extends AXPEntityMod
1033
1030
  sections?: AXMSafetyPlanSectionBuilderValue;
1034
1031
  }
1035
1032
 
1036
- interface AXMWorkplaceSafetyManagementSafetyPlanSectionItemModel {
1037
- sectionTypeId: string;
1038
- sectionType?: {
1039
- id: string;
1040
- title?: string;
1041
- code?: string;
1042
- };
1043
- /**
1044
- * Step Table only — selected Work Step (WorkStepType) that defines table columns.
1045
- * Persisted on the section items slot alongside row entity ids.
1046
- */
1047
- workStepTypeId?: string;
1048
- workStepType?: {
1049
- id: string;
1050
- title?: string;
1051
- code?: string;
1052
- };
1053
- itemIds?: string[];
1054
- items?: {
1055
- id: string;
1056
- title?: string;
1057
- code?: string;
1058
- }[];
1059
- }
1060
- interface AXMWorkplaceSafetyManagementSafetyPlanSectionEntityModel extends AXPEntityModel<string> {
1061
- /** Business code from identifier rule `safety-plan-section-code` (`SPS-{seq:4}`). */
1062
- code: string;
1063
- safetyPlanId: string;
1064
- safetyPlan?: {
1065
- id: string;
1066
- title?: string;
1067
- code?: string;
1068
- };
1069
- title: string;
1070
- description?: string;
1071
- /** Section line items managed via repeater (embedded value objects). */
1072
- items: AXMWorkplaceSafetyManagementSafetyPlanSectionItemModel[];
1073
- /**
1074
- * SafetyPlanTypeSection this row was created from.
1075
- * Stored as a snapshot link only — later type-section edits do not affect this plan.
1076
- */
1077
- sourceSafetyPlanTypeSectionId?: string;
1078
- /** List / display order within the plan. */
1079
- sortOrder?: number;
1080
- /** Managed by the archive plugin (`isArchived`). */
1081
- isArchived?: boolean;
1082
- }
1083
-
1084
1033
  interface AXMWorkplaceSafetyManagementSafetyPlanTypeEntityModel extends AXPEntityModel<string> {
1085
1034
  /** Business code from identifier rule `safety-plan-type-code` (`SPT-{seq:4}`). */
1086
1035
  code: string;
@@ -1107,5 +1056,5 @@ interface AXMWorkplaceSafetyManagementSafetyTemplateEntityModel extends AXPEntit
1107
1056
  }[];
1108
1057
  }
1109
1058
 
1110
- export { AXMHazardPpeRuleRequirementType, AXMHazardRegisterContextType, AXMWorkplaceSafetyManagementCommandKeys, AXMWorkplaceSafetyManagementMenuKeys, AXMWorkplaceSafetyManagementPermissionKeys, AXPSafetyRiskPermissionKeys, PARENT_HAZARD_IDS_CONTEXT_KEY, PARENT_HAZARD_RISK_IDS_CONTEXT_KEY, RISK_MANAGEMENT_HAZARD_CATALOG_SCOPE, RISK_MANAGEMENT_RISK_MATRIX_CELL_ENTITY, RISK_MANAGEMENT_RISK_RATING_ENTITY, RootConfig, SAFETY_PLAN_SECTIONS_PAGE_COMPONENT_KEY, SAFETY_PLAN_SECTION_DUPLICATE_SECTION_TYPE_CODE, SAFETY_PLAN_SECTION_DUPLICATE_SECTION_TYPE_MESSAGE_KEY, WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_BY_ID, WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS, WORKPLACE_SAFETY_BUILT_IN_WORK_STEP_TYPE_IDS, WORKPLACE_SAFETY_DOWNSTREAM_FROM_HAZARD, WORKPLACE_SAFETY_DOWNSTREAM_FROM_HAZARD_RISK, WORKPLACE_SAFETY_GHS_SYMBOL_OPTIONS, WORKPLACE_SAFETY_HAZARD_PPE_RULE_REQUIREMENT_TYPE_OPTIONS, WORKPLACE_SAFETY_SECTION_ITEM_LOOKUP_CLEAR_ON_SECTION_TYPE_TRIGGERS, WORKPLACE_SAFETY_SECTION_ITEM_LOOKUP_REFRESH_ON_SECTION_TYPE_EXPOSE_TRIGGERS, WORKPLACE_SAFETY_SECTION_ITEM_LOOKUP_SECTION_TYPE_TRIGGERS, WORKPLACE_SAFETY_SECTION_TYPE_DEPENDENCIES, WORKPLACE_SAFETY_SECTION_TYPE_DESCRIPTION_SYNC_TRIGGERS, WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_BY_CODE, WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_EXPRESSION, WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_EXPRESSION_SIBLING, WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_FALLBACK, WORKPLACE_SAFETY_SECTION_TYPE_LOOKUP_EXPOSE, WORKPLACE_SAFETY_SECTION_TYPE_LOOKUP_WIDGET_OPTIONS, WORKPLACE_SAFETY_SECTION_TYPE_TITLE_SYNC_TRIGGERS, WORKPLACE_SAFETY_TEMPLATE_TYPE_OPTIONS, buildSafetyPlanSectionItemLookupOptions, buildSafetyPlanSectionItemSelectorOptions, buildSectionStructureFromTypeSections, buildWorkStepContentFromType, clearDependentItemsOnParentChange, collectAllowedSectionTypeIds, collectBuiltInRepeatableSectionTypeIds, collectRequiredSourceTypeSectionIds, createEmptyStepTableCell, createEmptyStepTableRow, dedupeSafetyPlanSectionItemSelection, dedupeSafetyPlanSectionStructure, enrichSectionTypeSnapshot, extractControlMeasureIdsFromHazardRisks, extractRiskMatrixIdsFromHazardRisks, findDuplicateSafetyPlanSectionTypeId, getSectionTypeDependency, isPpeRuleSectionTypeId, isSafetyPlanSectionTypeRepeatable, isSafetyPlanTypeSectionDefault, isStepTableColumnMultiLookup, isStepTableSectionType, mapSafetyPlanSectionSelectedItems, normalizeStepTableColumns, normalizeStepTableRows, resolveEntityRefId, resolveParentHazardIds, resolveParentHazardRiskIds, resolveParentItemIds, resolveSafetyPlanSectionItemColumns, resolveSafetyPlanSectionItemEntityKey, resolveSafetyPlanSectionItemFilter, resolveSafetyPlanSectionItemFilterAsync, resolveSafetyPlanSectionTypeId, resolveSectionItemEntityName, resolveSectionTypeKey, resolveStepTableColumnLookupEntity, safetyPlanSectionTypeAlreadyExists, sectionTypeKeyFromSection, sortStepTableColumns, stepTableColumnKey, stepTableColumnTitle, toBuilderValueFromStructure, toWorkStepBuilderPayload, validateSafetyPlanSectionStructure, validateSafetyPlanTypeSectionTemplate };
1111
- export type { AXMBuiltInSectionTypeMeta, AXMControlHierarchyLevelItemModel, AXMHazardRiskRecordLoader, AXMHazardStatus, AXMSafetyPlanSectionBuilderItemValue, AXMSafetyPlanSectionBuilderSectionValue, AXMSafetyPlanSectionBuilderValue, AXMSafetyPlanSectionStructureItem, AXMSafetyPlanSectionStructureValidationContext, AXMSafetyPlanSectionStructureValidationIssue, AXMSafetyPlanSectionStructureValidationIssueCode, AXMSafetyPlanSectionStructureValue, AXMSafetyPlanSectionTypeIdentity, AXMSafetyPlanSectionTypeUniquenessOptions, AXMSafetyPlanStatus, AXMSafetyPlanStepTableRowBuilderPayload, AXMSafetyTemplateType, AXMSectionTypeCode, AXMSectionTypeDependency, AXMSectionTypeDerivedFilterDependency, AXMSectionTypeParentFilterDependency, AXMSectionTypeSnapshot, AXMStepTableCellRef, AXMStepTableCellValue, AXMStepTableColumnDef, AXMStepTableRow, AXMWorkStepTypeSnapshot, AXMWorkplaceSafetyManagementControlHierarchyLevelsEntityModel, AXMWorkplaceSafetyManagementControlMeasureEntityModel, AXMWorkplaceSafetyManagementHazardEntityModel, AXMWorkplaceSafetyManagementHazardPpeRuleEntityModel, AXMWorkplaceSafetyManagementHazardRegisterEntityModel, AXMWorkplaceSafetyManagementHazardRiskEntityModel, AXMWorkplaceSafetyManagementHazardRiskPpeRuleEntityModel, AXMWorkplaceSafetyManagementPpeItemEntityModel, AXMWorkplaceSafetyManagementSafetyPlanEntityModel, AXMWorkplaceSafetyManagementSafetyPlanSectionEntityModel, AXMWorkplaceSafetyManagementSafetyPlanSectionItemModel, AXMWorkplaceSafetyManagementSafetyPlanTypeEntityModel, AXMWorkplaceSafetyManagementSafetyPlanTypeSectionEntityModel, AXMWorkplaceSafetyManagementSafetyPlanTypeSectionTypeItemModel, AXMWorkplaceSafetyManagementSafetyPlanWorkStepEntityModel, AXMWorkplaceSafetyManagementSafetyTemplateEntityModel, AXMWorkplaceSafetyManagementSectionTypeEntityModel, AXMWorkplaceSafetyManagementWorkStepTypeEntityModel, WorkplaceSafetyGhsSymbolId };
1059
+ export { AXMHazardPpeRuleRequirementType, AXMHazardRegisterContextType, AXMWorkplaceSafetyManagementCommandKeys, AXMWorkplaceSafetyManagementMenuKeys, AXMWorkplaceSafetyManagementPermissionKeys, AXPSafetyRiskPermissionKeys, PARENT_HAZARD_IDS_CONTEXT_KEY, PARENT_HAZARD_RISK_IDS_CONTEXT_KEY, RISK_MANAGEMENT_HAZARD_CATALOG_SCOPE, RISK_MANAGEMENT_RISK_MATRIX_CELL_ENTITY, RISK_MANAGEMENT_RISK_RATING_ENTITY, RootConfig, SAFETY_PLAN_SECTIONS_PAGE_COMPONENT_KEY, WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_BY_ID, WORKPLACE_SAFETY_BUILT_IN_SECTION_TYPE_IDS, WORKPLACE_SAFETY_BUILT_IN_WORK_STEP_TYPE_IDS, WORKPLACE_SAFETY_DOWNSTREAM_FROM_HAZARD, WORKPLACE_SAFETY_DOWNSTREAM_FROM_HAZARD_RISK, WORKPLACE_SAFETY_GHS_SYMBOL_OPTIONS, WORKPLACE_SAFETY_HAZARD_PPE_RULE_REQUIREMENT_TYPE_OPTIONS, WORKPLACE_SAFETY_SECTION_ITEM_LOOKUP_CLEAR_ON_SECTION_TYPE_TRIGGERS, WORKPLACE_SAFETY_SECTION_ITEM_LOOKUP_REFRESH_ON_SECTION_TYPE_EXPOSE_TRIGGERS, WORKPLACE_SAFETY_SECTION_ITEM_LOOKUP_SECTION_TYPE_TRIGGERS, WORKPLACE_SAFETY_SECTION_TYPE_DEPENDENCIES, WORKPLACE_SAFETY_SECTION_TYPE_DESCRIPTION_SYNC_TRIGGERS, WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_BY_CODE, WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_EXPRESSION, WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_EXPRESSION_SIBLING, WORKPLACE_SAFETY_SECTION_TYPE_ENTITY_FALLBACK, WORKPLACE_SAFETY_SECTION_TYPE_LOOKUP_EXPOSE, WORKPLACE_SAFETY_SECTION_TYPE_LOOKUP_WIDGET_OPTIONS, WORKPLACE_SAFETY_SECTION_TYPE_TITLE_SYNC_TRIGGERS, WORKPLACE_SAFETY_TEMPLATE_TYPE_OPTIONS, asSafetyPlanDisplayText, buildSafetyPlanSectionItemLookupOptions, buildSafetyPlanSectionItemSelectorOptions, buildSectionStructureFromTypeSections, buildSectionTypeRelationSnapshot, buildWorkStepContentFromType, clearDependentItemsOnParentChange, collectAllowedSectionTypeIds, collectBuiltInRepeatableSectionTypeIds, collectRequiredSourceTypeSectionIds, createEmptyStepTableCell, createEmptyStepTableRow, dedupeSafetyPlanSectionItemSelection, dedupeSafetyPlanSectionStructure, enrichSectionTypeSnapshot, extractRiskMatrixIdsFromHazardRisks, getSectionTypeDependency, isPpeRuleSectionTypeId, isSafetyPlanSectionTypeRepeatable, isSafetyPlanTypeSectionDefault, isStepTableColumnMultiLookup, isStepTableSectionType, mapSafetyPlanSectionSelectedItems, normalizeStepTableColumns, normalizeStepTableRows, resolveEntityRefId, resolveParentHazardIds, resolveParentHazardRiskIds, resolveParentItemIds, resolveSafetyPlanSectionItemColumns, resolveSafetyPlanSectionItemEntityKey, resolveSafetyPlanSectionItemFilter, resolveSafetyPlanSectionItemFilterAsync, resolveSafetyPlanSectionPersistedTitle, resolveSectionItemEntityName, resolveSectionTypeKey, resolveStepTableColumnLookupEntity, sectionTypeKeyFromSection, sortStepTableColumns, stepTableColumnKey, stepTableColumnTitle, toBuilderValueFromStructure, toWorkStepBuilderPayload, validateSafetyPlanSectionStructure, validateSafetyPlanTypeSectionTemplate };
1060
+ export type { AXMBuiltInSectionTypeMeta, AXMControlHierarchyLevelItemModel, AXMHazardRiskRecordLoader, AXMHazardStatus, AXMSafetyPlanSectionBuilderItemValue, AXMSafetyPlanSectionBuilderSectionValue, AXMSafetyPlanSectionBuilderValue, AXMSafetyPlanSectionItemColumn, AXMSafetyPlanSectionStructureItem, AXMSafetyPlanSectionStructureValidationContext, AXMSafetyPlanSectionStructureValidationIssue, AXMSafetyPlanSectionStructureValidationIssueCode, AXMSafetyPlanSectionStructureValue, AXMSafetyPlanSectionWidgetOptions, AXMSafetyPlanStatus, AXMSafetyPlanStepTableRowBuilderPayload, AXMSafetyTemplateType, AXMSectionTypeCode, AXMSectionTypeDependency, AXMSectionTypeDerivedFilterDependency, AXMSectionTypeParentFilterDependency, AXMSectionTypeSnapshot, AXMStepTableCellRef, AXMStepTableCellValue, AXMStepTableColumnDef, AXMStepTableRow, AXMWorkStepTypeSnapshot, AXMWorkplaceSafetyManagementControlHierarchyLevelsEntityModel, AXMWorkplaceSafetyManagementControlMeasureEntityModel, AXMWorkplaceSafetyManagementHazardEntityModel, AXMWorkplaceSafetyManagementHazardPpeRuleEntityModel, AXMWorkplaceSafetyManagementHazardRegisterEntityModel, AXMWorkplaceSafetyManagementHazardRiskEntityModel, AXMWorkplaceSafetyManagementPpeItemEntityModel, AXMWorkplaceSafetyManagementSafetyPlanEntityModel, AXMWorkplaceSafetyManagementSafetyPlanSectionEntityModel, AXMWorkplaceSafetyManagementSafetyPlanSectionItemModel, AXMWorkplaceSafetyManagementSafetyPlanTypeEntityModel, AXMWorkplaceSafetyManagementSafetyPlanTypeSectionEntityModel, AXMWorkplaceSafetyManagementSafetyPlanTypeSectionTypeItemModel, AXMWorkplaceSafetyManagementSafetyPlanWorkStepEntityModel, AXMWorkplaceSafetyManagementSafetyTemplateEntityModel, AXMWorkplaceSafetyManagementSectionTypeEntityModel, AXMWorkplaceSafetyManagementWorkStepTypeEntityModel, WorkplaceSafetyGhsSymbolId };
@@ -1 +0,0 @@
1
- {"version":3,"file":"acorex-platform-module-workplacesafety-management-client-control-hierarchy-diagram-widget-view.component-C-qrrqOV.mjs","sources":["../../../../libs/modules/workplacesafety-management/client/src/lib/features/control-hierarchy-diagram/control-hierarchy-diagram.component.ts","../../../../libs/modules/workplacesafety-management/client/src/lib/features/control-hierarchy-diagram/control-hierarchy-diagram.component.html","../../../../libs/modules/workplacesafety-management/client/src/lib/features/control-hierarchy-diagram/control-hierarchy-diagram-widget-view.component.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXSelectBoxModule } from '@acorex/components/select-box';\nimport { AXTranslationModule } from '@acorex/core/translation';\nimport { AsyncPipe } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n computed,\n effect,\n inject,\n input,\n OnInit,\n output,\n signal,\n ViewEncapsulation,\n} from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { defaultTo, isEmpty, orderBy } from 'lodash';\n\nimport {\n type AXMControlHierarchyDiagramItem,\n type AXMControlHierarchyDiagramViewType,\n} from './control-hierarchy-diagram.types';\nimport { AXMControlHierarchyDiagramService } from './control-hierarchy-diagram.service';\n\n//#endregion\n\n//#region ---- Component ----\n\n@Component({\n selector: 'axm-control-hierarchy-diagram',\n templateUrl: './control-hierarchy-diagram.component.html',\n styleUrl: './control-hierarchy-diagram.component.css',\n host: {\n class: 'axm-control-hierarchy-diagram block w-full',\n },\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [AsyncPipe, FormsModule, AXSelectBoxModule, AXTranslationModule],\n})\nexport class AXMControlHierarchyDiagramComponent implements OnInit {\n //#region ---- Services & Dependencies ----\n\n protected readonly diagramService = inject(AXMControlHierarchyDiagramService);\n\n //#endregion\n\n //#region ---- Inputs / Outputs ----\n\n viewType = input<AXMControlHierarchyDiagramViewType>('horizontal');\n items = input<AXMControlHierarchyDiagramItem[] | null>(null);\n highlightLevelId = input<string | null>(null);\n showViewTypeSelector = input(true);\n showTitle = input(false);\n\n viewTypeChange = output<AXMControlHierarchyDiagramViewType>();\n\n //#endregion\n\n //#region ---- State ----\n\n protected readonly loading = signal(false);\n protected readonly loadedItems = signal<AXMControlHierarchyDiagramItem[]>([]);\n protected readonly selectedViewType = signal<AXMControlHierarchyDiagramViewType>('horizontal');\n\n protected readonly viewTypeOptions = computed(() => this.diagramService.getViewTypeOptions());\n\n protected readonly displayItems = computed(() => {\n const external = this.items();\n const items = external ?? this.loadedItems();\n return orderBy(items, ['order'], ['asc']);\n });\n\n protected readonly pyramidWidths = computed(() => {\n const count = this.displayItems().length;\n if (count <= 1) {\n return [100];\n }\n const step = 70 / (count - 1);\n return this.displayItems().map((_item, index) => 100 - index * step);\n });\n\n //#endregion\n\n //#region ---- Lifecycle ----\n\n ngOnInit(): void {\n this.selectedViewType.set(this.viewType());\n }\n\n constructor() {\n effect(() => {\n this.selectedViewType.set(this.viewType());\n });\n\n effect(() => {\n if (this.items() != null) {\n return;\n }\n void this.loadItems();\n });\n }\n\n //#endregion\n\n //#region ---- UI Handlers ----\n\n protected resolveTitle(item: AXMControlHierarchyDiagramItem): string {\n return this.diagramService.resolveText(item.title);\n }\n\n protected resolveDescription(item: AXMControlHierarchyDiagramItem): string {\n return defaultTo(this.diagramService.resolveText(item.description ?? ''), '');\n }\n\n protected resolveTextColor(item: AXMControlHierarchyDiagramItem): string {\n return this.diagramService.getContrastTextColor(item.color);\n }\n\n protected isHighlighted(item: AXMControlHierarchyDiagramItem): boolean {\n const highlightId = this.highlightLevelId();\n return !isEmpty(highlightId) && item.id === highlightId;\n }\n\n protected onViewTypeChanged(value: AXMControlHierarchyDiagramViewType | null): void {\n if (!value) {\n return;\n }\n this.selectedViewType.set(value);\n this.viewTypeChange.emit(value);\n }\n\n //#endregion\n\n //#region ---- Data Loading ----\n\n private async loadItems(): Promise<void> {\n this.loading.set(true);\n try {\n const levels = await this.diagramService.loadActiveLevels();\n this.loadedItems.set(levels);\n } finally {\n this.loading.set(false);\n }\n }\n\n //#endregion\n}\n\n//#endregion\n","@if (showViewTypeSelector()) {\n <div class=\"axm-control-hierarchy-diagram__header gap-4\">\n <ax-select-box\n class=\"axm-control-hierarchy-diagram__view-type\"\n [dataSource]=\"viewTypeOptions()\"\n [ngModel]=\"selectedViewType()\"\n (ngModelChange)=\"onViewTypeChanged($event)\"\n valueField=\"id\"\n textField=\"title\"\n />\n </div>\n}\n\n@if (loading()) {\n <div class=\"axm-control-hierarchy-diagram__loading\">\n {{ '@general:terms.interface.loading' | translate | async }}\n </div>\n} @else if (!displayItems().length) {\n <div class=\"axm-control-hierarchy-diagram__empty\">\n {{ '@general:terms.interface.no-data' | translate | async }}\n </div>\n} @else {\n <div\n class=\"axm-control-hierarchy-diagram__body\"\n [class.axm-control-hierarchy-diagram__body--offset-top]=\"!showViewTypeSelector()\"\n >\n @switch (selectedViewType()) {\n @case ('horizontal') {\n <div class=\"axm-control-hierarchy-diagram__horizontal flex flex-col gap-5\">\n <div class=\"axm-control-hierarchy-diagram__effectiveness-bar gap-4\">\n <span>{{ '@workplacesafety-management:control-measure-types.components.control-hierarchy-diagram.most-effective' | translate | async }}</span>\n <div class=\"axm-control-hierarchy-diagram__gradient\"></div>\n <span>{{ '@workplacesafety-management:control-measure-types.components.control-hierarchy-diagram.least-effective' | translate | async }}</span>\n </div>\n <div class=\"axm-control-hierarchy-diagram__cards gap-5!\">\n @for (item of displayItems(); track item.id; let index = $index) {\n <article\n class=\"axm-control-hierarchy-diagram__card\"\n [class.axm-control-hierarchy-diagram__card--highlighted]=\"isHighlighted(item)\"\n [style.border-top-color]=\"item.color\"\n >\n <header\n class=\"axm-control-hierarchy-diagram__card-header px-4 py-3\"\n [style.background]=\"item.color\"\n [style.color]=\"resolveTextColor(item)\"\n >\n ({{ item.order }}) {{ resolveTitle(item) }}\n </header>\n <p class=\"axm-control-hierarchy-diagram__card-body p-4\">\n {{ resolveDescription(item) }}\n </p>\n </article>\n }\n </div>\n </div>\n }\n @case ('vertical') {\n <div class=\"axm-control-hierarchy-diagram__vertical gap-5!\">\n <div class=\"axm-control-hierarchy-diagram__vertical-label axm-control-hierarchy-diagram__vertical-label--top\">\n {{ '@workplacesafety-management:control-measure-types.components.control-hierarchy-diagram.most-effective' | translate | async }}\n </div>\n <div class=\"axm-control-hierarchy-diagram__pyramid gap-2!\">\n @for (item of displayItems(); track item.id; let index = $index) {\n <div\n class=\"axm-control-hierarchy-diagram__pyramid-row\"\n [class.axm-control-hierarchy-diagram__pyramid-row--highlighted]=\"isHighlighted(item)\"\n [style.background]=\"item.color\"\n [style.color]=\"resolveTextColor(item)\"\n [style.width.%]=\"pyramidWidths()[index]\"\n >\n {{ resolveTitle(item) }}\n </div>\n }\n </div>\n <div class=\"axm-control-hierarchy-diagram__vertical-label axm-control-hierarchy-diagram__vertical-label--bottom\">\n {{ '@workplacesafety-management:control-measure-types.components.control-hierarchy-diagram.least-effective' | translate | async }}\n </div>\n </div>\n }\n @case ('horizontal-chevron') {\n <div class=\"axm-control-hierarchy-diagram__chevron gap-3!\">\n <div class=\"axm-control-hierarchy-diagram__chevron-effective\">\n {{ '@workplacesafety-management:control-measure-types.components.control-hierarchy-diagram.most-effective' | translate | async }}\n </div>\n <div class=\"axm-control-hierarchy-diagram__chevron-track\">\n @for (item of displayItems(); track item.id) {\n <div\n class=\"axm-control-hierarchy-diagram__chevron-segment\"\n [class.axm-control-hierarchy-diagram__chevron-segment--highlighted]=\"isHighlighted(item)\"\n [style.background]=\"item.color\"\n [style.color]=\"resolveTextColor(item)\"\n >\n {{ resolveTitle(item) }}\n </div>\n }\n </div>\n <div class=\"axm-control-hierarchy-diagram__chevron-effective axm-control-hierarchy-diagram__chevron-effective--end\">\n {{ '@workplacesafety-management:control-measure-types.components.control-hierarchy-diagram.least-effective' | translate | async }}\n </div>\n </div>\n }\n }\n </div>\n}\n","//#region ---- Imports ----\n\nimport { AXPBaseWidgetComponent } from '@acorex-platform/framework-client/layout/widget-core';\nimport { ChangeDetectionStrategy, Component, computed, inject } from '@angular/core';\nimport { defaultTo, get, isBoolean, isString } from 'lodash';\n\nimport { AXMControlHierarchyDiagramComponent } from './control-hierarchy-diagram.component';\nimport { AXMControlHierarchyDiagramService } from './control-hierarchy-diagram.service';\nimport {\n resolveControlHierarchyDiagramViewType,\n type AXMControlHierarchyDiagramViewType,\n} from './control-hierarchy-diagram.types';\nimport { type AXMControlHierarchyDiagramWidgetOptions } from './control-hierarchy-diagram-widget.config';\n\n//#endregion\n\n//#region ---- Widget View Component ----\n\n@Component({\n selector: 'axm-control-hierarchy-diagram-widget-view',\n template: `\n <axm-control-hierarchy-diagram\n [viewType]=\"initialViewType()\"\n [items]=\"diagramItems()\"\n [highlightLevelId]=\"highlightLevelId()\"\n [showViewTypeSelector]=\"showViewTypeSelector()\"\n [showTitle]=\"showTitle()\"\n />\n `,\n host: {\n class: 'block w-full',\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [AXMControlHierarchyDiagramComponent],\n})\nexport class AXMControlHierarchyDiagramWidgetViewComponent extends AXPBaseWidgetComponent<AXMControlHierarchyDiagramWidgetOptions> {\n //#region ---- Services & Dependencies ----\n\n private readonly diagramService = inject(AXMControlHierarchyDiagramService);\n\n //#endregion\n\n //#region ---- Computed Properties ----\n\n /** Designer/default initial layout only; runtime selection stays inside the diagram component. */\n protected initialViewType = computed<AXMControlHierarchyDiagramViewType>(() => {\n this.contextService.changeEvent();\n const fromContext = get(this.contextService.data(), 'hierarchyDiagramViewType');\n if (isString(fromContext) && fromContext.length > 0) {\n return resolveControlHierarchyDiagramViewType(fromContext);\n }\n return resolveControlHierarchyDiagramViewType(this.options()['viewType']);\n });\n\n /** Live repeater items from entity record context; null falls back to persisted levels query. */\n protected diagramItems = computed(() => {\n this.contextService.changeEvent();\n return this.diagramService.resolveDiagramItemsFromContext(\n this.contextService.data() as Record<string, unknown>,\n );\n });\n\n protected showViewTypeSelector = computed(() => this.resolveShowViewTypeSelector());\n\n protected showTitle = computed(() => this.options()['showTitle'] === true);\n\n protected highlightLevelId = computed<string | null>(() => this.resolveHighlightLevelId());\n\n //#endregion\n\n //#region ---- Utility Methods ----\n\n private resolveShowViewTypeSelector(): boolean {\n const options = this.options();\n if (isBoolean(options['showViewTypeSelector'])) {\n return options['showViewTypeSelector'];\n }\n return true;\n }\n\n private resolveHighlightLevelId(): string | null {\n const options = this.options();\n const fromOptions = options['highlightLevelId'];\n if (isString(fromOptions) && fromOptions.length > 0) {\n return fromOptions;\n }\n this.contextService.changeEvent();\n const fromContext = get(this.contextService.data(), 'id');\n return isString(fromContext) ? fromContext : defaultTo(fromContext != null ? String(fromContext) : null, null);\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;;;;;;;AAAA;AA0BA;AAEA;MAaa,mCAAmC,CAAA;;;IA8C9C,QAAQ,GAAA;QACN,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC5C;AAEA,IAAA,WAAA,GAAA;;AA/CmB,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,iCAAiC,CAAC;;;QAM7E,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAqC,YAAY;qFAAC;QAClE,IAAA,CAAA,KAAK,GAAG,KAAK,CAA0C,IAAI;kFAAC;QAC5D,IAAA,CAAA,gBAAgB,GAAG,KAAK,CAAgB,IAAI;6FAAC;QAC7C,IAAA,CAAA,oBAAoB,GAAG,KAAK,CAAC,IAAI;iGAAC;QAClC,IAAA,CAAA,SAAS,GAAG,KAAK,CAAC,KAAK;sFAAC;QAExB,IAAA,CAAA,cAAc,GAAG,MAAM,EAAsC;;;QAM1C,IAAA,CAAA,OAAO,GAAG,MAAM,CAAC,KAAK;oFAAC;QACvB,IAAA,CAAA,WAAW,GAAG,MAAM,CAAmC,EAAE;wFAAC;QAC1D,IAAA,CAAA,gBAAgB,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EAAA,sBAAA,EAAA,WAAA,CAAA,EAAA,OAAA,EAAA,CAAA,gBAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA,CAAA;;2FAElC,6CAA6C,EAAA,UAAA,EAAA,CAAA;kBAjBzD,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,2CAA2C;AACrD,oBAAA,QAAQ,EAAE;;;;;;;;AAQT,EAAA,CAAA;AACD,oBAAA,IAAI,EAAE;AACJ,wBAAA,KAAK,EAAE,cAAc;AACtB,qBAAA;oBACD,eAAe,EAAE,uBAAuB,CAAC,MAAM;oBAC/C,OAAO,EAAE,CAAC,mCAAmC,CAAC;AAC/C,iBAAA;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"acorex-platform-module-workplacesafety-management-client-control-hierarchy-diagram.service-BBhH7KP1.mjs","sources":["../../../../libs/modules/workplacesafety-management/client/src/lib/features/control-hierarchy-diagram/control-hierarchy-diagram.types.ts","../../../../libs/modules/workplacesafety-management/client/src/lib/features/control-hierarchy-diagram/control-hierarchy-diagram.service.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport type { AXPMultiLanguageString } from '@acorex-platform/framework-shared/core';\n\n//#endregion\n\n//#region ---- View types ----\n\nexport type AXMControlHierarchyDiagramViewType = 'vertical' | 'horizontal' | 'horizontal-chevron';\n\nexport type AXMControlHierarchyDiagramViewTypeOption =\n | AXMControlHierarchyDiagramViewType\n | { id: AXMControlHierarchyDiagramViewType; title?: string };\n\nexport function resolveControlHierarchyDiagramViewType(\n value: AXMControlHierarchyDiagramViewTypeOption | string | undefined,\n): AXMControlHierarchyDiagramViewType {\n if (!value) {\n return 'horizontal';\n }\n if (typeof value === 'string') {\n return value as AXMControlHierarchyDiagramViewType;\n }\n return value.id ?? 'horizontal';\n}\n\n//#endregion\n\n//#region ---- Repeater order ----\n\n/**\n * Repeater sequence is stored in the array (`AXPRepeaterWidgetEditComponent.onDrop` / `moveItemInArray`).\n * An optional persisted `order` on the row overrides the array index when present.\n */\nexport function resolveRepeaterItemOrder(item: { order?: number } | undefined, index: number): number {\n const explicit = item?.order;\n if (typeof explicit === 'number' && Number.isFinite(explicit)) {\n return explicit;\n }\n return index + 1;\n}\n\n//#endregion\n\n//#region ---- Diagram item ----\n\nexport interface AXMControlHierarchyDiagramItem {\n id: string;\n code: string;\n title: AXPMultiLanguageString;\n description?: AXPMultiLanguageString;\n /** 1-based position from repeater array order (or explicit row `order`). */\n order: number;\n color?: string;\n}\n\n//#endregion\n","//#region ---- Imports ----\n\nimport { AXTranslationService, resolveMultiLanguageString } from '@acorex/core/translation';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport { Injectable, inject } from '@angular/core';\nimport { defaultTo, get, orderBy } from 'lodash';\n\nimport { RootConfig } from '@acorex-platform/module-workplacesafety-management-client/contracts';\nimport {\n type AXMControlHierarchyLevelItemModel,\n type AXMWorkplaceSafetyManagementControlHierarchyLevelsEntityModel,\n} from '@acorex-platform/module-workplacesafety-management-client/contracts';\nimport {\n type AXMControlHierarchyDiagramItem,\n type AXMControlHierarchyDiagramViewType,\n resolveRepeaterItemOrder,\n} from './control-hierarchy-diagram.types';\n\n//#endregion\n\n//#region ---- Service ----\n\n@Injectable({ providedIn: 'root' })\nexport class AXMControlHierarchyDiagramService {\n //#region ---- Services & Dependencies ----\n\n private readonly entityService = inject(AXPEntityService);\n private readonly translationService = inject(AXTranslationService);\n\n //#endregion\n\n //#region ---- Public API ----\n\n async loadActiveLevels(): Promise<AXMControlHierarchyDiagramItem[]> {\n const result = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.controlHierarchyLevels.name)\n .data<string, AXMWorkplaceSafetyManagementControlHierarchyLevelsEntityModel>()\n .query({\n skip: 0,\n take: 100,\n sort: [{ field: 'code', dir: 'asc' }],\n });\n\n const records = defaultTo(result.items, []);\n const levels = records.flatMap((record) =>\n this.mapRepeaterItemsToDiagramItems(defaultTo(record.itemIds, []), record.id),\n );\n\n return orderBy(levels, ['order'], ['asc']);\n }\n\n mapRepeaterItemsToDiagramItems(\n itemIds: AXMControlHierarchyLevelItemModel[],\n recordId?: string | null,\n ): AXMControlHierarchyDiagramItem[] {\n return defaultTo(itemIds, []).map((item, index) => {\n const order = resolveRepeaterItemOrder(item, index);\n return {\n id: `${defaultTo(recordId, 'draft')}-${index}`,\n code: String(order),\n title: item.title,\n description: item.description,\n order,\n color: item.color,\n };\n });\n }\n\n resolveDiagramItemsFromContext(data: Record<string, unknown>): AXMControlHierarchyDiagramItem[] | null {\n if (!('itemIds' in data)) {\n return null;\n }\n\n return this.mapRepeaterItemsToDiagramItems(\n defaultTo(get(data, 'itemIds'), []) as AXMControlHierarchyLevelItemModel[],\n get(data, 'id') as string | undefined,\n );\n }\n\n resolveText(value: AXMControlHierarchyDiagramItem['title']): string {\n const locale = this.translationService.getActiveLang();\n return resolveMultiLanguageString(value, locale);\n }\n\n getContrastTextColor(color?: string): string {\n if (!color) {\n return 'rgb(var(--ax-sys-color-on-surface))';\n }\n const hex = color.replace('#', '');\n if (hex.length !== 6) {\n return 'rgb(var(--ax-sys-color-on-surface))';\n }\n const r = parseInt(hex.slice(0, 2), 16);\n const g = parseInt(hex.slice(2, 4), 16);\n const b = parseInt(hex.slice(4, 6), 16);\n const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;\n return luminance > 0.62 ? 'rgb(var(--ax-sys-color-on-light-surface))' : 'rgb(var(--ax-sys-color-on-dark-surface))';\n }\n\n getViewTypeOptions(): Array<{ id: AXMControlHierarchyDiagramViewType; title: string }> {\n return [\n {\n id: 'horizontal',\n title: '@workplacesafety-management:control-measure-types.components.control-hierarchy-diagram.view-types.horizontal',\n },\n {\n id: 'vertical',\n title: '@workplacesafety-management:control-measure-types.components.control-hierarchy-diagram.view-types.vertical',\n },\n {\n id: 'horizontal-chevron',\n title:\n '@workplacesafety-management:control-measure-types.components.control-hierarchy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AA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAjC,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,iCAAiC,cADpB,MAAM,EAAA,CAAA,CAAA;;2FACnB,iCAAiC,EAAA,UAAA,EAAA,CAAA;kBAD7C,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
@@ -1,42 +0,0 @@
1
- import { AXPStatusProvider, AXPSystemStatusType, systemStatusToDefinition } from '@acorex-platform/framework-shared/core';
2
-
3
- //#region ---- Imports ----
4
- //#endregion
5
- //#region ---- Hazard risk PPE rule status provider ----
6
- /**
7
- * Hazard risk PPE rule statuses: Active, Inactive (default Active).
8
- * Used by the status plugin (`workplacesafety-management.status.hazard-risk-ppe-rule`).
9
- */
10
- class AXMWorkplaceSafetyManagementHazardRiskPpeRuleStatusProvider extends AXPStatusProvider {
11
- constructor() {
12
- super(...arguments);
13
- this.key = 'workplacesafety-management.status.hazard-risk-ppe-rule';
14
- this.defaultStatus = AXPSystemStatusType.Active;
15
- this.statuses = [
16
- systemStatusToDefinition(AXPSystemStatusType.Active, {
17
- title: '@workplacesafety-management:hazard-risk-ppe-rules.entities.hazard-risk-ppe-rule.fields.status.options.active',
18
- generateView: true,
19
- }),
20
- systemStatusToDefinition(AXPSystemStatusType.Inactive, {
21
- title: '@workplacesafety-management:hazard-risk-ppe-rules.entities.hazard-risk-ppe-rule.fields.status.options.inactive',
22
- generateView: true,
23
- }),
24
- ];
25
- this.transitions = [
26
- {
27
- from: AXPSystemStatusType.Active,
28
- to: AXPSystemStatusType.Inactive,
29
- title: '@general:statuses.transitions.deactivate',
30
- },
31
- {
32
- from: AXPSystemStatusType.Inactive,
33
- to: AXPSystemStatusType.Active,
34
- title: '@general:statuses.transitions.activate',
35
- },
36
- ];
37
- }
38
- }
39
- //#endregion
40
-
41
- export { AXMWorkplaceSafetyManagementHazardRiskPpeRuleStatusProvider };
42
- //# sourceMappingURL=acorex-platform-module-workplacesafety-management-client-hazard-risk-ppe-rule-status.provider-DtqzcWh0.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"acorex-platform-module-workplacesafety-management-client-hazard-risk-ppe-rule-status.provider-DtqzcWh0.mjs","sources":["../../../../libs/modules/workplacesafety-management/client/src/lib/features/hazard-risk-ppe-rule-status.provider.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPStatusProvider, AXPStatusTransition, AXPSystemStatusType, systemStatusToDefinition } from '@acorex-platform/framework-shared/core';\n\n//#endregion\n\n//#region ---- Hazard risk PPE rule status provider ----\n\n/**\n * Hazard risk PPE rule statuses: Active, Inactive (default Active).\n * Used by the status plugin (`workplacesafety-management.status.hazard-risk-ppe-rule`).\n */\nexport class AXMWorkplaceSafetyManagementHazardRiskPpeRuleStatusProvider extends AXPStatusProvider {\n readonly key = 'workplacesafety-management.status.hazard-risk-ppe-rule';\n\n readonly defaultStatus = AXPSystemStatusType.Active;\n\n readonly statuses = [\n systemStatusToDefinition(AXPSystemStatusType.Active, {\n title: '@workplacesafety-management:hazard-risk-ppe-rules.entities.hazard-risk-ppe-rule.fields.status.options.active',\n generateView: true,\n }),\n systemStatusToDefinition(AXPSystemStatusType.Inactive, {\n title: '@workplacesafety-management:hazard-risk-ppe-rules.entities.hazard-risk-ppe-rule.fields.status.options.inactive',\n generateView: true,\n }),\n ];\n\n readonly transitions: AXPStatusTransition[] = [\n {\n from: AXPSystemStatusType.Active,\n to: AXPSystemStatusType.Inactive,\n title: '@general:statuses.transitions.deactivate',\n },\n {\n from: AXPSystemStatusType.Inactive,\n to: AXPSystemStatusType.Active,\n title: '@general:statuses.transitions.activate',\n },\n ];\n}\n\n//#endregion\n"],"names":[],"mappings":";;AAAA;AAIA;AAEA;AAEA;;;AAGG;AACG,MAAO,2DAA4D,SAAQ,iBAAiB,CAAA;AAAlG,IAAA,WAAA,GAAA;;QACW,IAAA,CAAA,GAAG,GAAG,wDAAwD;AAE9D,QAAA,IAAA,CAAA,aAAa,GAAG,mBAAmB,CAAC,MAAM;AAE1C,QAAA,IAAA,CAAA,QAAQ,GAAG;AAClB,YAAA,wBAAwB,CAAC,mBAAmB,CAAC,MAAM,EAAE;AACnD,gBAAA,KAAK,EAAE,8GAA8G;AACrH,gBAAA,YAAY,EAAE,IAAI;aACnB,CAAC;AACF,YAAA,wBAAwB,CAAC,mBAAmB,CAAC,QAAQ,EAAE;AACrD,gBAAA,KAAK,EAAE,gHAAgH;AACvH,gBAAA,YAAY,EAAE,IAAI;aACnB,CAAC;SACH;AAEQ,QAAA,IAAA,CAAA,WAAW,GAA0B;AAC5C,YAAA;gBACE,IAAI,EAAE,mBAAmB,CAAC,MAAM;gBAChC,EAAE,EAAE,mBAAmB,CAAC,QAAQ;AAChC,gBAAA,KAAK,EAAE,0CAA0C;AAClD,aAAA;AACD,YAAA;gBACE,IAAI,EAAE,mBAAmB,CAAC,QAAQ;gBAClC,EAAE,EAAE,mBAAmB,CAAC,MAAM;AAC9B,gBAAA,KAAK,EAAE,wCAAwC;AAChD,aAAA;SACF;IACH;AAAC;AAED;;;;"}