@acorex-platform/module-workplacesafety-management-client 0.0.33 → 0.0.38

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 (102) hide show
  1. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-acorex-platform-module-workplacesafety-management-client-mzaaZ6T3.mjs → acorex-platform-module-workplacesafety-management-client-acorex-platform-module-workplacesafety-management-client-Ds0Fkspp.mjs} +20 -12
  2. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-acorex-platform-module-workplacesafety-management-client-mzaaZ6T3.mjs.map → acorex-platform-module-workplacesafety-management-client-acorex-platform-module-workplacesafety-management-client-Ds0Fkspp.mjs.map} +1 -1
  3. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-control-hierarchy-levels.mjs.map +1 -1
  4. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-control-measure.mjs.map +1 -1
  5. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-hazard-ppe-rule.mjs +1 -1
  6. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-hazard-ppe-rule.mjs.map +1 -1
  7. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-hazard-register.mjs.map +1 -1
  8. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-hazard-risk.mjs.map +1 -1
  9. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-hazard.mjs +71 -88
  10. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-hazard.mjs.map +1 -1
  11. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-ppe-item.mjs.map +1 -1
  12. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-plan-section.mjs +35 -1
  13. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-plan-section.mjs.map +1 -1
  14. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-plan-type-section.mjs +35 -1
  15. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-plan-type-section.mjs.map +1 -1
  16. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-plan-type.mjs.map +1 -1
  17. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-plan-work-step.mjs.map +1 -1
  18. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-plan.mjs +70 -11
  19. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-plan.mjs.map +1 -1
  20. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-template.mjs +3 -3
  21. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-safety-template.mjs.map +1 -1
  22. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-section-type.mjs.map +1 -1
  23. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-work-step-type.mjs +35 -1
  24. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entities-work-step-type.mjs.map +1 -1
  25. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-CeTmhod5.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-BI4TLvSE.mjs} +16 -16
  26. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-CeTmhod5.mjs.map → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-BI4TLvSE.mjs.map} +1 -1
  27. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-control-hierarchy-levels.entity-Dae2kkZe.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-control-hierarchy-levels.entity-COlCNnyK.mjs} +2 -2
  28. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-control-hierarchy-levels.entity-Dae2kkZe.mjs.map → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-control-hierarchy-levels.entity-COlCNnyK.mjs.map} +1 -1
  29. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-control-measure.entity-CpNcN6Pf.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-control-measure.entity-BrXGzqZU.mjs} +2 -2
  30. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-control-measure.entity-CpNcN6Pf.mjs.map → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-control-measure.entity-BrXGzqZU.mjs.map} +1 -1
  31. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard-ppe-rule.entity-BcsAnO9h.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard-ppe-rule.entity-DHJus7OP.mjs} +3 -3
  32. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard-ppe-rule.entity-DHJus7OP.mjs.map +1 -0
  33. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard-register.entity-C9wGZ3hB.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard-register.entity-CogjoDox.mjs} +2 -2
  34. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard-register.entity-C9wGZ3hB.mjs.map → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard-register.entity-CogjoDox.mjs.map} +1 -1
  35. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard-risk.entity-AUr2GVLU.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard-risk.entity-9UWHmIXV.mjs} +2 -2
  36. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard-risk.entity-AUr2GVLU.mjs.map → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard-risk.entity-9UWHmIXV.mjs.map} +1 -1
  37. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard.entity-J6fveZKA.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard.entity-CNPbxULL.mjs} +12 -29
  38. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard.entity-CNPbxULL.mjs.map +1 -0
  39. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-ppe-item.entity-3fQPlBBf.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-ppe-item.entity-D5iOBl3P.mjs} +2 -2
  40. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-ppe-item.entity-3fQPlBBf.mjs.map → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-ppe-item.entity-D5iOBl3P.mjs.map} +1 -1
  41. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-section-dependency-BRGcQo7H.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-section-dependency-TdIMIkM7.mjs} +37 -3
  42. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-section-dependency-TdIMIkM7.mjs.map +1 -0
  43. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-section.entity-BPx-3rYX.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-section.entity-DJAI-7lB.mjs} +3 -3
  44. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-section.entity-BPx-3rYX.mjs.map → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-section.entity-DJAI-7lB.mjs.map} +1 -1
  45. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-type-section.entity-_nG09ZpE.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-type-section.entity-BGZ1VAW3.mjs} +3 -3
  46. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-type-section.entity-_nG09ZpE.mjs.map → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-type-section.entity-BGZ1VAW3.mjs.map} +1 -1
  47. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-type.entity-CIH7W9R7.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-type.entity-B6NYL4xi.mjs} +2 -2
  48. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-type.entity-CIH7W9R7.mjs.map → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-type.entity-B6NYL4xi.mjs.map} +1 -1
  49. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-work-step.entity-DmFYsBhI.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-work-step.entity-BlCbf5qP.mjs} +2 -2
  50. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-work-step.entity-DmFYsBhI.mjs.map → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-work-step.entity-BlCbf5qP.mjs.map} +1 -1
  51. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan.entity-CUDh_ZfQ.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan.entity-BSUR9jqs.mjs} +72 -13
  52. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan.entity-BSUR9jqs.mjs.map +1 -0
  53. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-template.entity-BxNUXvae.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-template.entity-CIHy_hLh.mjs} +5 -5
  54. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-template.entity-CIHy_hLh.mjs.map +1 -0
  55. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-section-type.entity-73MUyaIk.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-section-type.entity-Cs4nIHou.mjs} +2 -2
  56. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-section-type.entity-73MUyaIk.mjs.map → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-section-type.entity-Cs4nIHou.mjs.map} +1 -1
  57. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-work-step-type.entity-Ujxum2GY.mjs → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-work-step-type.entity-CJFWDOoh.mjs} +3 -3
  58. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-work-step-type.entity-Ujxum2GY.mjs.map → acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-work-step-type.entity-CJFWDOoh.mjs.map} +1 -1
  59. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog.mjs +1 -1
  60. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts.mjs +38 -3
  61. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts.mjs.map +1 -1
  62. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-control-hierarchy-diagram-widget-view.component-CnTEwf_l.mjs → acorex-platform-module-workplacesafety-management-client-control-hierarchy-diagram-widget-view.component-eDWG-sJ7.mjs} +2 -2
  63. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-control-hierarchy-diagram-widget-view.component-CnTEwf_l.mjs.map → acorex-platform-module-workplacesafety-management-client-control-hierarchy-diagram-widget-view.component-eDWG-sJ7.mjs.map} +1 -1
  64. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-control-hierarchy-diagram.component-BI9VkzNw.mjs → acorex-platform-module-workplacesafety-management-client-control-hierarchy-diagram.component-CfxHwZtH.mjs} +3 -3
  65. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-control-hierarchy-diagram.component-BI9VkzNw.mjs.map → acorex-platform-module-workplacesafety-management-client-control-hierarchy-diagram.component-CfxHwZtH.mjs.map} +1 -1
  66. package/fesm2022/acorex-platform-module-workplacesafety-management-client-control-hierarchy-diagram.service-tMrUDnCb.mjs.map +1 -1
  67. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-hazard-ppe-rule-status.provider-o4bAwYcq.mjs → acorex-platform-module-workplacesafety-management-client-hazard-ppe-rule-status.provider-6ZWaO5DG.mjs} +3 -3
  68. package/fesm2022/acorex-platform-module-workplacesafety-management-client-hazard-ppe-rule-status.provider-6ZWaO5DG.mjs.map +1 -0
  69. package/fesm2022/acorex-platform-module-workplacesafety-management-client-hazard-risk-status.provider-B6IkRYbW.mjs.map +1 -1
  70. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-index-LxP1eZLY.mjs → acorex-platform-module-workplacesafety-management-client-index-gbDgxqrV.mjs} +316 -375
  71. package/fesm2022/acorex-platform-module-workplacesafety-management-client-index-gbDgxqrV.mjs.map +1 -0
  72. package/fesm2022/acorex-platform-module-workplacesafety-management-client-local-entities.mjs.map +1 -1
  73. package/fesm2022/acorex-platform-module-workplacesafety-management-client-ppe-item-viewer-widget-column.component-D2Mmow12.mjs.map +1 -1
  74. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-ppe-item-viewer-widget-edit.component-CQtVhCgw.mjs → acorex-platform-module-workplacesafety-management-client-ppe-item-viewer-widget-edit.component-BqHXrGn9.mjs} +2 -2
  75. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-ppe-item-viewer-widget-edit.component-CQtVhCgw.mjs.map → acorex-platform-module-workplacesafety-management-client-ppe-item-viewer-widget-edit.component-BqHXrGn9.mjs.map} +1 -1
  76. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-ppe-item-viewer.service-YS8FHiRu.mjs → acorex-platform-module-workplacesafety-management-client-ppe-item-viewer.service-BxcGph1I.mjs} +3 -3
  77. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-ppe-item-viewer.service-YS8FHiRu.mjs.map → acorex-platform-module-workplacesafety-management-client-ppe-item-viewer.service-BxcGph1I.mjs.map} +1 -1
  78. package/fesm2022/acorex-platform-module-workplacesafety-management-client-ppe-item-viewer.util-2Kl3_3sg.mjs.map +1 -1
  79. package/fesm2022/acorex-platform-module-workplacesafety-management-client-preview-control-hierarchy-diagram.command-Dd9xdo_y.mjs.map +1 -1
  80. package/fesm2022/acorex-platform-module-workplacesafety-management-client-preview-safety-plan.command-BU95c4xb.mjs +254 -0
  81. package/fesm2022/acorex-platform-module-workplacesafety-management-client-preview-safety-plan.command-BU95c4xb.mjs.map +1 -0
  82. package/fesm2022/acorex-platform-module-workplacesafety-management-client-publish-safety-plan.command-Ci-zcrmO.mjs.map +1 -1
  83. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-safety-plan-preview-modal.component-6i0RkG3L.mjs → acorex-platform-module-workplacesafety-management-client-safety-plan-preview-modal.component-CQ2xB7Va.mjs} +10 -10
  84. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-safety-plan-preview-modal.component-6i0RkG3L.mjs.map → acorex-platform-module-workplacesafety-management-client-safety-plan-preview-modal.component-CQ2xB7Va.mjs.map} +1 -1
  85. package/fesm2022/acorex-platform-module-workplacesafety-management-client-safety-plan-preview.service-DJP41MuL.mjs +36 -0
  86. package/fesm2022/acorex-platform-module-workplacesafety-management-client-safety-plan-preview.service-DJP41MuL.mjs.map +1 -0
  87. package/fesm2022/acorex-platform-module-workplacesafety-management-client-safety-plan-section-builder.types-LaN1NIgc.mjs +204 -0
  88. package/fesm2022/acorex-platform-module-workplacesafety-management-client-safety-plan-section-builder.types-LaN1NIgc.mjs.map +1 -0
  89. package/fesm2022/acorex-platform-module-workplacesafety-management-client-safety-plan-status.provider-BpWx3gIf.mjs.map +1 -1
  90. package/fesm2022/{acorex-platform-module-workplacesafety-management-client-save-safety-plan-sections.command-BlPzzCc2.mjs → acorex-platform-module-workplacesafety-management-client-save-safety-plan-sections.command-CLj3y_JD.mjs} +4 -209
  91. package/fesm2022/acorex-platform-module-workplacesafety-management-client-save-safety-plan-sections.command-CLj3y_JD.mjs.map +1 -0
  92. package/fesm2022/acorex-platform-module-workplacesafety-management-client.mjs +1 -1
  93. package/package.json +2 -2
  94. package/types/acorex-platform-module-workplacesafety-management-client-contracts.d.ts +26 -3
  95. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard-ppe-rule.entity-BcsAnO9h.mjs.map +0 -1
  96. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-hazard.entity-J6fveZKA.mjs.map +0 -1
  97. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan-section-dependency-BRGcQo7H.mjs.map +0 -1
  98. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-plan.entity-CUDh_ZfQ.mjs.map +0 -1
  99. package/fesm2022/acorex-platform-module-workplacesafety-management-client-contracts-entity-catalog-safety-template.entity-BxNUXvae.mjs.map +0 -1
  100. package/fesm2022/acorex-platform-module-workplacesafety-management-client-hazard-ppe-rule-status.provider-o4bAwYcq.mjs.map +0 -1
  101. package/fesm2022/acorex-platform-module-workplacesafety-management-client-index-LxP1eZLY.mjs.map +0 -1
  102. package/fesm2022/acorex-platform-module-workplacesafety-management-client-save-safety-plan-sections.command-BlPzzCc2.mjs.map +0 -1
@@ -0,0 +1,204 @@
1
+ import { AXPDataGenerator } from '@acorex-platform/framework-client/core';
2
+ import { resolveEntityRefId, enrichSectionTypeSnapshot, isStepTableSectionType, normalizeStepTableColumns, normalizeStepTableRows, stepTableColumnTitle } from '@acorex-platform/module-workplacesafety-management-client/contracts';
3
+
4
+ function createSafetyPlanSectionBuilderDefaultValue() {
5
+ return { sections: [] };
6
+ }
7
+ function normalizeSafetyPlanSectionBuilderValue(value) {
8
+ if (!value || !Array.isArray(value.sections)) {
9
+ return createSafetyPlanSectionBuilderDefaultValue();
10
+ }
11
+ return {
12
+ sections: value.sections.map((section, index) => normalizeSection(section, index)),
13
+ };
14
+ }
15
+ function safetyPlanSectionsToBuilderValue(rows) {
16
+ const ordered = [...rows].sort((a, b) => (a.sortOrder ?? 0) - (b.sortOrder ?? 0) || String(a.code ?? '').localeCompare(String(b.code ?? '')));
17
+ return {
18
+ sections: ordered.map((row, index) => {
19
+ const legacyItem = row.items?.[0];
20
+ const sectionTypeId = resolveEntityRefId(legacyItem?.sectionTypeId) ??
21
+ resolveEntityRefId(legacyItem?.sectionType) ??
22
+ '';
23
+ const workStepTypeId = resolveEntityRefId(legacyItem?.workStepTypeId) ??
24
+ resolveEntityRefId(legacyItem?.workStepType) ??
25
+ undefined;
26
+ return {
27
+ id: row.id,
28
+ sectionTypeId,
29
+ sectionType: enrichSectionTypeSnapshot(sectionTypeId, legacyItem?.sectionType),
30
+ title: row.title,
31
+ description: row.description ?? '',
32
+ safetyPlanId: row.safetyPlanId,
33
+ code: row.code,
34
+ sourceSafetyPlanTypeSectionId: row.sourceSafetyPlanTypeSectionId,
35
+ sortOrder: row.sortOrder ?? index + 1,
36
+ workStepTypeId,
37
+ workStepType: legacyItem?.workStepType,
38
+ widgetOptions: normalizeWidgetOptions(row.widgetOptions),
39
+ columns: [],
40
+ items: (row.items ?? []).map((item, itemIndex) => ({
41
+ id: `${row.id}__item_${itemIndex + 1}`,
42
+ itemIds: [...(item.itemIds ?? [])],
43
+ items: item.items ? [...item.items] : [],
44
+ })),
45
+ };
46
+ }),
47
+ };
48
+ }
49
+ /** Merges SafetyPlanWorkStep row entities into Step Table sections. */
50
+ function hydrateStepTableSectionsWithWorkSteps(value, workSteps, columnsByWorkStepTypeId) {
51
+ const bySection = new Map();
52
+ for (const step of workSteps) {
53
+ const sectionId = resolveEntityRefId(step.safetyPlanSectionId) ?? '';
54
+ if (!sectionId) {
55
+ continue;
56
+ }
57
+ const list = bySection.get(sectionId) ?? [];
58
+ list.push(step);
59
+ bySection.set(sectionId, list);
60
+ }
61
+ return {
62
+ sections: value.sections.map((section) => {
63
+ if (!isStepTableSectionType(section.sectionTypeId, section.sectionType)) {
64
+ return section;
65
+ }
66
+ const steps = [...(bySection.get(section.id) ?? [])].sort((a, b) => (a.sortOrder ?? 0) - (b.sortOrder ?? 0) || String(a.code ?? '').localeCompare(String(b.code ?? '')));
67
+ const workStepTypeId = section.workStepTypeId ||
68
+ (steps[0] ? resolveEntityRefId(steps[0].workStepTypeId) ?? undefined : undefined);
69
+ const columns = (workStepTypeId && columnsByWorkStepTypeId?.get(workStepTypeId)) ||
70
+ normalizeStepTableColumns(steps[0]?.columns) ||
71
+ section.columns ||
72
+ [];
73
+ return {
74
+ ...section,
75
+ workStepTypeId,
76
+ workStepType: section.workStepType ?? steps[0]?.workStepType,
77
+ columns,
78
+ items: steps.map((step) => toBuilderItemFromWorkStepRow(step, columns)),
79
+ };
80
+ }),
81
+ };
82
+ }
83
+ function builderValueToSafetyPlanSectionPayloads(value, safetyPlanId) {
84
+ return value.sections.map((section, index) => ({
85
+ id: section.id,
86
+ safetyPlanId,
87
+ title: section.title,
88
+ description: section.description?.trim() ? section.description.trim() : undefined,
89
+ sectionTypeId: section.sectionTypeId,
90
+ sectionType: section.sectionType,
91
+ sourceSafetyPlanTypeSectionId: section.sourceSafetyPlanTypeSectionId,
92
+ sortOrder: typeof section.sortOrder === 'number' ? section.sortOrder : index + 1,
93
+ workStepTypeId: section.workStepTypeId,
94
+ workStepType: section.workStepType,
95
+ columns: section.columns,
96
+ widgetOptions: section.widgetOptions,
97
+ items: section.items.map((item) => ({
98
+ ...item,
99
+ itemIds: [...(item.itemIds ?? [])],
100
+ items: item.items ? [...item.items] : [],
101
+ stepTableRow: item.stepTableRow ? normalizeStepTableRowPayload(item.stepTableRow) : undefined,
102
+ })),
103
+ }));
104
+ }
105
+ function toBuilderItemFromWorkStepRow(step, columns) {
106
+ const normalizedColumns = normalizeStepTableColumns(columns.length ? columns : step.columns);
107
+ const cells = normalizeStepTableRows([{ id: step.id, sortOrder: step.sortOrder ?? 1, cells: step.cells ?? [] }], normalizedColumns)[0]?.cells ??
108
+ step.cells ??
109
+ [];
110
+ const title = step.title?.trim() || summarizeStepTableRow(cells, normalizedColumns);
111
+ return {
112
+ id: step.id,
113
+ itemIds: [step.id],
114
+ items: [{ id: step.id, title, code: step.code }],
115
+ stepTableRow: {
116
+ cells,
117
+ code: step.code,
118
+ sortOrder: step.sortOrder,
119
+ title,
120
+ },
121
+ };
122
+ }
123
+ function summarizeStepTableRow(cells, columns) {
124
+ for (const column of columns) {
125
+ const key = column.sectionTypeId;
126
+ const cell = cells.find((entry) => entry.columnKey === key);
127
+ if (!cell) {
128
+ continue;
129
+ }
130
+ const fromRefs = cell.refs?.[0]?.title || cell.refs?.[0]?.code;
131
+ if (fromRefs) {
132
+ return fromRefs;
133
+ }
134
+ if (cell.textValue?.trim()) {
135
+ return cell.textValue.trim();
136
+ }
137
+ }
138
+ return columns[0] ? stepTableColumnTitle(columns[0]) : 'Row';
139
+ }
140
+ function normalizeSection(section, index) {
141
+ const id = typeof section.id === 'string' && section.id ? section.id : AXPDataGenerator.uuid();
142
+ const sectionTypeId = resolveEntityRefId(section.sectionTypeId) ?? '';
143
+ const workStepTypeId = resolveEntityRefId(section.workStepTypeId) ?? undefined;
144
+ return {
145
+ id,
146
+ sectionTypeId,
147
+ sectionType: enrichSectionTypeSnapshot(sectionTypeId, section.sectionType),
148
+ title: typeof section.title === 'string' ? section.title : '',
149
+ description: typeof section.description === 'string' ? section.description : '',
150
+ safetyPlanId: typeof section.safetyPlanId === 'string' ? section.safetyPlanId : undefined,
151
+ code: typeof section.code === 'string' ? section.code : undefined,
152
+ sourceSafetyPlanTypeSectionId: typeof section.sourceSafetyPlanTypeSectionId === 'string'
153
+ ? section.sourceSafetyPlanTypeSectionId
154
+ : undefined,
155
+ sortOrder: typeof section.sortOrder === 'number' ? section.sortOrder : index + 1,
156
+ required: section.required === true,
157
+ workStepTypeId,
158
+ workStepType: section.workStepType,
159
+ columns: normalizeStepTableColumns(section.columns),
160
+ widgetOptions: normalizeWidgetOptions(section.widgetOptions),
161
+ items: Array.isArray(section.items)
162
+ ? section.items.map((item) => normalizeItem(item, id, sectionTypeId, section.sectionType))
163
+ : [],
164
+ };
165
+ }
166
+ function normalizeWidgetOptions(value) {
167
+ if (!value || typeof value !== 'object' || Array.isArray(value)) {
168
+ return undefined;
169
+ }
170
+ return { ...value };
171
+ }
172
+ function normalizeItem(item, sectionId, sectionTypeId, sectionType) {
173
+ const isStepTable = isStepTableSectionType(sectionTypeId, sectionType);
174
+ if (isStepTable && item.stepTableRow) {
175
+ const stepTableRow = normalizeStepTableRowPayload(item.stepTableRow);
176
+ const stepId = typeof item.id === 'string' && item.id && !item.id.includes('__item_') && !item.id.includes('__entity_')
177
+ ? item.id
178
+ : AXPDataGenerator.uuid();
179
+ const title = stepTableRow.title?.trim() || 'Row';
180
+ return {
181
+ id: stepId,
182
+ itemIds: [stepId],
183
+ items: [{ id: stepId, title, code: stepTableRow.code }],
184
+ stepTableRow,
185
+ };
186
+ }
187
+ const id = typeof item.id === 'string' && item.id ? item.id : AXPDataGenerator.uuid();
188
+ return {
189
+ id: id.includes('__item_') || id.includes('__entity_') ? id : `${sectionId}__item_${id}`,
190
+ itemIds: Array.isArray(item.itemIds) ? item.itemIds.filter((x) => typeof x === 'string') : [],
191
+ items: Array.isArray(item.items) ? item.items : [],
192
+ };
193
+ }
194
+ function normalizeStepTableRowPayload(payload) {
195
+ return {
196
+ cells: Array.isArray(payload.cells) ? payload.cells : [],
197
+ code: typeof payload.code === 'string' ? payload.code : undefined,
198
+ sortOrder: typeof payload.sortOrder === 'number' ? payload.sortOrder : undefined,
199
+ title: typeof payload.title === 'string' ? payload.title : undefined,
200
+ };
201
+ }
202
+
203
+ export { safetyPlanSectionsToBuilderValue as a, builderValueToSafetyPlanSectionPayloads as b, hydrateStepTableSectionsWithWorkSteps as h, normalizeSafetyPlanSectionBuilderValue as n, summarizeStepTableRow as s };
204
+ //# sourceMappingURL=acorex-platform-module-workplacesafety-management-client-safety-plan-section-builder.types-LaN1NIgc.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-platform-module-workplacesafety-management-client-safety-plan-section-builder.types-LaN1NIgc.mjs","sources":["../../../../libs/modules/workplacesafety-management/client/src/lib/features/safety-plan-sections-page/safety-plan-section-builder.types.ts"],"sourcesContent":["import { AXPDataGenerator } from '@acorex-platform/framework-client/core';\nimport {\n enrichSectionTypeSnapshot,\n isStepTableSectionType,\n normalizeStepTableColumns,\n normalizeStepTableRows,\n resolveEntityRefId,\n stepTableColumnTitle,\n type AXMSafetyPlanSectionBuilderItemValue,\n type AXMSafetyPlanSectionBuilderSectionValue,\n type AXMSafetyPlanSectionBuilderValue,\n type AXMSafetyPlanStepTableRowBuilderPayload,\n type AXMStepTableCellValue,\n type AXMStepTableColumnDef,\n type AXMWorkplaceSafetyManagementSafetyPlanSectionEntityModel,\n type AXMWorkplaceSafetyManagementSafetyPlanWorkStepEntityModel,\n} from '@acorex-platform/module-workplacesafety-management-client/contracts';\n\nexport function createSafetyPlanSectionBuilderDefaultValue(): AXMSafetyPlanSectionBuilderValue {\n return { sections: [] };\n}\n\nexport function normalizeSafetyPlanSectionBuilderValue(\n value: AXMSafetyPlanSectionBuilderValue | null | undefined,\n): AXMSafetyPlanSectionBuilderValue {\n if (!value || !Array.isArray(value.sections)) {\n return createSafetyPlanSectionBuilderDefaultValue();\n }\n\n return {\n sections: value.sections.map((section, index) => normalizeSection(section, index)),\n };\n}\n\nexport function safetyPlanSectionsToBuilderValue(\n rows: AXMWorkplaceSafetyManagementSafetyPlanSectionEntityModel[],\n): AXMSafetyPlanSectionBuilderValue {\n const ordered = [...rows].sort(\n (a, b) => (a.sortOrder ?? 0) - (b.sortOrder ?? 0) || String(a.code ?? '').localeCompare(String(b.code ?? '')),\n );\n return {\n sections: ordered.map((row, index) => {\n const legacyItem = row.items?.[0];\n const sectionTypeId =\n resolveEntityRefId(legacyItem?.sectionTypeId) ??\n resolveEntityRefId(legacyItem?.sectionType) ??\n '';\n const workStepTypeId =\n resolveEntityRefId(legacyItem?.workStepTypeId) ??\n resolveEntityRefId(legacyItem?.workStepType) ??\n undefined;\n return {\n id: row.id,\n sectionTypeId,\n sectionType: enrichSectionTypeSnapshot(sectionTypeId, legacyItem?.sectionType),\n title: row.title,\n description: row.description ?? '',\n safetyPlanId: row.safetyPlanId,\n code: row.code,\n sourceSafetyPlanTypeSectionId: row.sourceSafetyPlanTypeSectionId,\n sortOrder: row.sortOrder ?? index + 1,\n workStepTypeId,\n workStepType: legacyItem?.workStepType,\n widgetOptions: normalizeWidgetOptions(row.widgetOptions),\n columns: [],\n items: (row.items ?? []).map((item, itemIndex) => ({\n id: `${row.id}__item_${itemIndex + 1}`,\n itemIds: [...(item.itemIds ?? [])],\n items: item.items ? [...item.items] : [],\n })),\n };\n }),\n };\n}\n\n/** Merges SafetyPlanWorkStep row entities into Step Table sections. */\nexport function hydrateStepTableSectionsWithWorkSteps(\n value: AXMSafetyPlanSectionBuilderValue,\n workSteps: AXMWorkplaceSafetyManagementSafetyPlanWorkStepEntityModel[],\n columnsByWorkStepTypeId?: ReadonlyMap<string, AXMStepTableColumnDef[]>,\n): AXMSafetyPlanSectionBuilderValue {\n const bySection = new Map<string, AXMWorkplaceSafetyManagementSafetyPlanWorkStepEntityModel[]>();\n for (const step of workSteps) {\n const sectionId = resolveEntityRefId(step.safetyPlanSectionId) ?? '';\n if (!sectionId) {\n continue;\n }\n const list = bySection.get(sectionId) ?? [];\n list.push(step);\n bySection.set(sectionId, list);\n }\n\n return {\n sections: value.sections.map((section) => {\n if (!isStepTableSectionType(section.sectionTypeId, section.sectionType)) {\n return section;\n }\n const steps = [...(bySection.get(section.id) ?? [])].sort(\n (a, b) => (a.sortOrder ?? 0) - (b.sortOrder ?? 0) || String(a.code ?? '').localeCompare(String(b.code ?? '')),\n );\n const workStepTypeId =\n section.workStepTypeId ||\n (steps[0] ? resolveEntityRefId(steps[0].workStepTypeId) ?? undefined : undefined);\n const columns =\n (workStepTypeId && columnsByWorkStepTypeId?.get(workStepTypeId)) ||\n normalizeStepTableColumns(steps[0]?.columns) ||\n section.columns ||\n [];\n return {\n ...section,\n workStepTypeId,\n workStepType: section.workStepType ?? steps[0]?.workStepType,\n columns,\n items: steps.map((step) => toBuilderItemFromWorkStepRow(step, columns)),\n };\n }),\n };\n}\n\nexport function builderValueToSafetyPlanSectionPayloads(\n value: AXMSafetyPlanSectionBuilderValue,\n safetyPlanId: string,\n): Array<{\n id: string;\n safetyPlanId: string;\n title: string;\n description?: string;\n sectionTypeId: string;\n sectionType?: AXMSafetyPlanSectionBuilderSectionValue['sectionType'];\n sourceSafetyPlanTypeSectionId?: string;\n sortOrder: number;\n workStepTypeId?: string;\n workStepType?: AXMSafetyPlanSectionBuilderSectionValue['workStepType'];\n columns?: AXMStepTableColumnDef[];\n widgetOptions?: AXMSafetyPlanSectionBuilderSectionValue['widgetOptions'];\n items: AXMSafetyPlanSectionBuilderItemValue[];\n}> {\n return value.sections.map((section, index) => ({\n id: section.id,\n safetyPlanId,\n title: section.title,\n description: section.description?.trim() ? section.description.trim() : undefined,\n sectionTypeId: section.sectionTypeId,\n sectionType: section.sectionType,\n sourceSafetyPlanTypeSectionId: section.sourceSafetyPlanTypeSectionId,\n sortOrder: typeof section.sortOrder === 'number' ? section.sortOrder : index + 1,\n workStepTypeId: section.workStepTypeId,\n workStepType: section.workStepType,\n columns: section.columns,\n widgetOptions: section.widgetOptions,\n items: section.items.map((item) => ({\n ...item,\n itemIds: [...(item.itemIds ?? [])],\n items: item.items ? [...item.items] : [],\n stepTableRow: item.stepTableRow ? normalizeStepTableRowPayload(item.stepTableRow) : undefined,\n })),\n }));\n}\n\nfunction toBuilderItemFromWorkStepRow(\n step: AXMWorkplaceSafetyManagementSafetyPlanWorkStepEntityModel,\n columns: AXMStepTableColumnDef[],\n): AXMSafetyPlanSectionBuilderItemValue {\n const normalizedColumns = normalizeStepTableColumns(columns.length ? columns : step.columns);\n const cells =\n normalizeStepTableRows(\n [{ id: step.id, sortOrder: step.sortOrder ?? 1, cells: step.cells ?? [] }],\n normalizedColumns,\n )[0]?.cells ??\n step.cells ??\n [];\n const title = step.title?.trim() || summarizeStepTableRow(cells, normalizedColumns);\n return {\n id: step.id,\n itemIds: [step.id],\n items: [{ id: step.id, title, code: step.code }],\n stepTableRow: {\n cells,\n code: step.code,\n sortOrder: step.sortOrder,\n title,\n },\n };\n}\n\nexport function summarizeStepTableRow(\n cells: AXMStepTableCellValue[],\n columns: AXMStepTableColumnDef[],\n): string {\n for (const column of columns) {\n const key = column.sectionTypeId;\n const cell = cells.find((entry) => entry.columnKey === key);\n if (!cell) {\n continue;\n }\n const fromRefs = cell.refs?.[0]?.title || cell.refs?.[0]?.code;\n if (fromRefs) {\n return fromRefs;\n }\n if (cell.textValue?.trim()) {\n return cell.textValue.trim();\n }\n }\n return columns[0] ? stepTableColumnTitle(columns[0]) : 'Row';\n}\n\nfunction normalizeSection(\n section: Partial<AXMSafetyPlanSectionBuilderSectionValue>,\n index: number,\n): AXMSafetyPlanSectionBuilderSectionValue {\n const id = typeof section.id === 'string' && section.id ? section.id : AXPDataGenerator.uuid();\n const sectionTypeId = resolveEntityRefId(section.sectionTypeId) ?? '';\n const workStepTypeId = resolveEntityRefId(section.workStepTypeId) ?? undefined;\n return {\n id,\n sectionTypeId,\n sectionType: enrichSectionTypeSnapshot(sectionTypeId, section.sectionType),\n title: typeof section.title === 'string' ? section.title : '',\n description: typeof section.description === 'string' ? section.description : '',\n safetyPlanId: typeof section.safetyPlanId === 'string' ? section.safetyPlanId : undefined,\n code: typeof section.code === 'string' ? section.code : undefined,\n sourceSafetyPlanTypeSectionId:\n typeof section.sourceSafetyPlanTypeSectionId === 'string'\n ? section.sourceSafetyPlanTypeSectionId\n : undefined,\n sortOrder: typeof section.sortOrder === 'number' ? section.sortOrder : index + 1,\n required: section.required === true,\n workStepTypeId,\n workStepType: section.workStepType,\n columns: normalizeStepTableColumns(section.columns),\n widgetOptions: normalizeWidgetOptions(section.widgetOptions),\n items: Array.isArray(section.items)\n ? section.items.map((item) => normalizeItem(item, id, sectionTypeId, section.sectionType))\n : [],\n };\n}\n\nfunction normalizeWidgetOptions(\n value: AXMSafetyPlanSectionBuilderSectionValue['widgetOptions'] | unknown,\n): AXMSafetyPlanSectionBuilderSectionValue['widgetOptions'] | undefined {\n if (!value || typeof value !== 'object' || Array.isArray(value)) {\n return undefined;\n }\n return { ...(value as NonNullable<AXMSafetyPlanSectionBuilderSectionValue['widgetOptions']>) };\n}\n\nfunction normalizeItem(\n item: Partial<AXMSafetyPlanSectionBuilderItemValue>,\n sectionId: string,\n sectionTypeId: string,\n sectionType: AXMSafetyPlanSectionBuilderSectionValue['sectionType'],\n): AXMSafetyPlanSectionBuilderItemValue {\n const isStepTable = isStepTableSectionType(sectionTypeId, sectionType);\n if (isStepTable && item.stepTableRow) {\n const stepTableRow = normalizeStepTableRowPayload(item.stepTableRow);\n const stepId =\n typeof item.id === 'string' && item.id && !item.id.includes('__item_') && !item.id.includes('__entity_')\n ? item.id\n : AXPDataGenerator.uuid();\n const title = stepTableRow.title?.trim() || 'Row';\n return {\n id: stepId,\n itemIds: [stepId],\n items: [{ id: stepId, title, code: stepTableRow.code }],\n stepTableRow,\n };\n }\n\n const id = typeof item.id === 'string' && item.id ? item.id : AXPDataGenerator.uuid();\n return {\n id: id.includes('__item_') || id.includes('__entity_') ? id : `${sectionId}__item_${id}`,\n itemIds: Array.isArray(item.itemIds) ? item.itemIds.filter((x): x is string => typeof x === 'string') : [],\n items: Array.isArray(item.items) ? item.items : [],\n };\n}\n\nfunction normalizeStepTableRowPayload(\n payload: AXMSafetyPlanStepTableRowBuilderPayload,\n): AXMSafetyPlanStepTableRowBuilderPayload {\n return {\n cells: Array.isArray(payload.cells) ? payload.cells : [],\n code: typeof payload.code === 'string' ? payload.code : undefined,\n sortOrder: typeof payload.sortOrder === 'number' ? payload.sortOrder : undefined,\n title: typeof payload.title === 'string' ? payload.title : undefined,\n };\n}\n\nexport type {\n AXMSafetyPlanSectionBuilderItemValue,\n AXMSafetyPlanSectionBuilderSectionValue,\n AXMSafetyPlanSectionBuilderValue,\n AXMSafetyPlanStepTableRowBuilderPayload,\n};\n"],"names":[],"mappings":";;;SAkBgB,0CAA0C,GAAA;AACxD,IAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;AACzB;AAEM,SAAU,sCAAsC,CACpD,KAA0D,EAAA;AAE1D,IAAA,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE;QAC5C,OAAO,0CAA0C,EAAE;IACrD;IAEA,OAAO;QACL,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,KAAK,KAAK,gBAAgB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;KACnF;AACH;AAEM,SAAU,gCAAgC,CAC9C,IAAgE,EAAA;IAEhE,MAAM,OAAO,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,IAAI,CAC5B,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,IAAI,CAAC,KAAK,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAC9G;IACD,OAAO;QACL,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK,KAAI;YACnC,MAAM,UAAU,GAAG,GAAG,CAAC,KAAK,GAAG,CAAC,CA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AACxF,QAAA,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,KAAkB,OAAO,CAAC,KAAK,QAAQ,CAAC,GAAG,EAAE;AAC1G,QAAA,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,KAAK,GAAG,EAAE;KACnD;AACH;AAEA,SAAS,4BAA4B,CACnC,OAAgD,EAAA;IAEhD,OAAO;AACL,QAAA,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,KAAK,GAAG,EAAE;AACxD,QAAA,IAAI,EAAE,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ,GAAG,OAAO,CAAC,IAAI,GAAG,SAAS;AACjE,QAAA,SAAS,EAAE,OAAO,OAAO,CAAC,SAAS,KAAK,QAAQ,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS;AAChF,QAAA,KAAK,EAAE,OAAO,OAAO,CAAC,KAAK,KAAK,QAAQ,GAAG,OAAO,CAAC,KAAK,GAAG,SAAS;KACrE;AACH;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"acorex-platform-module-workplacesafety-management-client-safety-plan-status.provider-BpWx3gIf.mjs","sources":["../../../../libs/modules/workplacesafety-management/client/src/lib/features/safety-plan-status.provider.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPStatusProvider, AXPStatusTransition, AXPSystemStatusType, systemStatusToDefinition } from '@acorex-platform/framework-shared/core';\n\n//#endregion\n\n//#region ---- Safety plan status provider ----\n\n/**\n * Safety plan lifecycle statuses: Draft, Published, Archived.\n * Used by the status plugin (`workplacesafety-management.status.safety-plan`).\n */\nexport class AXMWorkplaceSafetyManagementSafetyPlanStatusProvider extends AXPStatusProvider {\n readonly key = 'workplacesafety-management.status.safety-plan';\n\n readonly defaultStatus = AXPSystemStatusType.Draft;\n\n readonly statuses = [\n systemStatusToDefinition(AXPSystemStatusType.Draft, {\n title: '@workplacesafety-management:safety-plans.entities.safety-plan.fields.status.options.draft',\n generateView: true,\n }),\n systemStatusToDefinition(AXPSystemStatusType.Published, {\n title: '@workplacesafety-management:safety-plans.entities.safety-plan.fields.status.options.published',\n generateView: true,\n }),\n systemStatusToDefinition(AXPSystemStatusType.Archived, {\n title: '@workplacesafety-management:safety-plans.entities.safety-plan.fields.status.options.archived',\n generateView: true,\n }),\n ];\n\n readonly transitions: AXPStatusTransition[] = [\n // {\n // from: AXPSystemStatusType.Draft,\n // to: AXPSystemStatusType.Published,\n // title: '@general:statuses.transitions.publish',\n // },\n {\n from: AXPSystemStatusType.Published,\n to: AXPSystemStatusType.Archived,\n title: '@general:statuses.transitions.archive',\n },\n {\n from: AXPSystemStatusType.Archived,\n to: AXPSystemStatusType.Draft,\n title: '@general:statuses.transitions.reopen',\n },\n ];\n}\n\n//#endregion\n"],"names":[],"mappings":";;AAAA;AAIA;AAEA;AAEA;;;AAGG;AACG,MAAO,oDAAqD,SAAQ,iBAAiB,CAAA;AAA3F,IAAA,WAAA,GAAA;;QACW,IAAA,CAAA,GAAG,GAAG,+CAA+C;AAErD,QAAA,IAAA,CAAA,aAAa,GAAG,mBAAmB,CAAC,KAAK;AAEzC,QAAA,IAAA,CAAA,QAAQ,GAAG;AAClB,YAAA,wBAAwB,CAAC,mBAAmB,CAAC,KAAK,EAAE;AAClD,gBAAA,KAAK,EAAE,2FAA2F;AAClG,gBAAA,YAAY,EAAE,IAAI;aACnB,CAAC;AACF,YAAA,wBAAwB,CAAC,mBAAmB,CAAC,SAAS,EAAE;AACtD,gBAAA,KAAK,EAAE,+FAA+F;AACtG,gBAAA,YAAY,EAAE,IAAI;aACnB,CAAC;AACF,YAAA,wBAAwB,CAAC,mBAAmB,CAAC,QAAQ,EAAE;AACrD,gBAAA,KAAK,EAAE,8FAA8F;AACrG,gBAAA,YAAY,EAAE,IAAI;aACnB,CAAC;SACH;AAEQ,QAAA,IAAA,CAAA,WAAW,GAA0B;;;;;;AAM5C,YAAA;gBACE,IAAI,EAAE,mBAAmB,CAAC,SAAS;gBACnC,EAAE,EAAE,mBAAmB,CAAC,QAAQ;AAChC,gBAAA,KAAK,EAAE,uCAAuC;AAC/C,aAAA;AACD,YAAA;gBACE,IAAI,EAAE,mBAAmB,CAAC,QAAQ;gBAClC,EAAE,EAAE,mBAAmB,CAAC,KAAK;AAC7B,gBAAA,KAAK,EAAE,sCAAsC;AAC9C,aAAA;SACF;IACH;AAAC;AAED;;;;"}
1
+ {"version":3,"file":"acorex-platform-module-workplacesafety-management-client-safety-plan-status.provider-BpWx3gIf.mjs","sources":["../../../../libs/modules/workplacesafety-management/client/src/lib/features/safety-plan-status.provider.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPStatusProvider, AXPStatusTransition, AXPSystemStatusType, systemStatusToDefinition } from '@acorex-platform/framework-shared/core';\n\n//#endregion\n\n//#region ---- Safety plan status provider ----\n\n/**\n * Safety plan lifecycle statuses: Draft, Published, Archived.\n * Used by the status plugin (`workplacesafety-management.status.safety-plan`).\n */\nexport class AXMWorkplaceSafetyManagementSafetyPlanStatusProvider extends AXPStatusProvider {\n readonly key = 'workplacesafety-management.status.safety-plan';\n\n readonly defaultStatus = AXPSystemStatusType.Draft;\n\n readonly statuses = [\n systemStatusToDefinition(AXPSystemStatusType.Draft, {\n title: '@workplacesafety-management:safety-plans.entities.safety-plan.fields.status.options.draft',\n generateView: true,\n }),\n systemStatusToDefinition(AXPSystemStatusType.Published, {\n title: '@workplacesafety-management:safety-plans.entities.safety-plan.fields.status.options.published',\n generateView: true,\n }),\n systemStatusToDefinition(AXPSystemStatusType.Archived, {\n title: '@workplacesafety-management:safety-plans.entities.safety-plan.fields.status.options.archived',\n generateView: true,\n }),\n ];\n\n readonly transitions: AXPStatusTransition[] = [\n // {\n // from: AXPSystemStatusType.Draft,\n // to: AXPSystemStatusType.Published,\n // title: '@general:statuses.transitions.publish',\n // },\n {\n from: AXPSystemStatusType.Published,\n to: AXPSystemStatusType.Archived,\n title: '@general:statuses.transitions.archive',\n },\n {\n from: AXPSystemStatusType.Archived,\n to: AXPSystemStatusType.Draft,\n title: '@general:statuses.transitions.reopen',\n },\n ];\n}\n\n//#endregion\n"],"names":[],"mappings":";;AAAA;AAIA;AAEA;AAEA;;;AAGG;AACG,MAAO,oDAAqD,SAAQ,iBAAiB,CAAA;AAA3F,IAAA,WAAA,GAAA;;QACW,IAAA,CAAA,GAAG,GAAG,+CAA+C;AAErD,QAAA,IAAA,CAAA,aAAa,GAAG,mBAAmB,CAAC,KAAK;AAEzC,QAAA,IAAA,CAAA,QAAQ,GAAG;AAClB,YAAA,wBAAwB,CAAC,mBAAmB,CAAC,KAAK,EAAE;AAClD,gBAAA,KAAK,EAAE,2FAA2F;AAClG,gBAAA,YAAY,EAAE,IAAI;aACnB,CAAC;AACF,YAAA,wBAAwB,CAAC,mBAAmB,CAAC,SAAS,EAAE;AACtD,gBAAA,KAAK,EAAE,+FAA+F;AACtG,gBAAA,YAAY,EAAE,IAAI;aACnB,CAAC;AACF,YAAA,wBAAwB,CAAC,mBAAmB,CAAC,QAAQ,EAAE;AACrD,gBAAA,KAAK,EAAE,8FAA8F;AACrG,gBAAA,YAAY,EAAE,IAAI;aACnB,CAAC;SACH;AAEQ,QAAA,IAAA,CAAA,WAAW,GAA0B;;;;;;AAM5C,YAAA;gBACE,IAAI,EAAE,mBAAmB,CAAC,SAAS;gBACnC,EAAE,EAAE,mBAAmB,CAAC,QAAQ;AAChC,gBAAA,KAAK,EAAE,uCAAuC;AAC/C,aAAA;AACD,YAAA;gBACE,IAAI,EAAE,mBAAmB,CAAC,QAAQ;gBAClC,EAAE,EAAE,mBAAmB,CAAC,KAAK;AAC7B,gBAAA,KAAK,EAAE,sCAAsC;AAC9C,aAAA;SACF;IACH;AAAC;AAED;;"}
@@ -3,207 +3,8 @@ import { extractRequestErrorInfo } from '@acorex-platform/framework-client/commo
3
3
  import { AXTranslationService } from '@acorex/core/translation';
4
4
  import * as i0 from '@angular/core';
5
5
  import { inject, Injectable } from '@angular/core';
6
- import { resolveEntityRefId, enrichSectionTypeSnapshot, isStepTableSectionType, normalizeStepTableColumns, normalizeStepTableRows, stepTableColumnTitle, RootConfig, dedupeSafetyPlanSectionStructure, collectBuiltInRepeatableSectionTypeIds } from '@acorex-platform/module-workplacesafety-management-client/contracts';
7
- import { AXPDataGenerator } from '@acorex-platform/framework-client/core';
8
-
9
- function createSafetyPlanSectionBuilderDefaultValue() {
10
- return { sections: [] };
11
- }
12
- function normalizeSafetyPlanSectionBuilderValue(value) {
13
- if (!value || !Array.isArray(value.sections)) {
14
- return createSafetyPlanSectionBuilderDefaultValue();
15
- }
16
- return {
17
- sections: value.sections.map((section, index) => normalizeSection(section, index)),
18
- };
19
- }
20
- function safetyPlanSectionsToBuilderValue(rows) {
21
- const ordered = [...rows].sort((a, b) => (a.sortOrder ?? 0) - (b.sortOrder ?? 0) || String(a.code ?? '').localeCompare(String(b.code ?? '')));
22
- return {
23
- sections: ordered.map((row, index) => {
24
- const legacyItem = row.items?.[0];
25
- const sectionTypeId = resolveEntityRefId(legacyItem?.sectionTypeId) ??
26
- resolveEntityRefId(legacyItem?.sectionType) ??
27
- '';
28
- const workStepTypeId = resolveEntityRefId(legacyItem?.workStepTypeId) ??
29
- resolveEntityRefId(legacyItem?.workStepType) ??
30
- undefined;
31
- return {
32
- id: row.id,
33
- sectionTypeId,
34
- sectionType: enrichSectionTypeSnapshot(sectionTypeId, legacyItem?.sectionType),
35
- title: row.title,
36
- description: row.description ?? '',
37
- safetyPlanId: row.safetyPlanId,
38
- code: row.code,
39
- sourceSafetyPlanTypeSectionId: row.sourceSafetyPlanTypeSectionId,
40
- sortOrder: row.sortOrder ?? index + 1,
41
- workStepTypeId,
42
- workStepType: legacyItem?.workStepType,
43
- widgetOptions: normalizeWidgetOptions(row.widgetOptions),
44
- columns: [],
45
- items: (row.items ?? []).map((item, itemIndex) => ({
46
- id: `${row.id}__item_${itemIndex + 1}`,
47
- itemIds: [...(item.itemIds ?? [])],
48
- items: item.items ? [...item.items] : [],
49
- })),
50
- };
51
- }),
52
- };
53
- }
54
- /** Merges SafetyPlanWorkStep row entities into Step Table sections. */
55
- function hydrateStepTableSectionsWithWorkSteps(value, workSteps, columnsByWorkStepTypeId) {
56
- const bySection = new Map();
57
- for (const step of workSteps) {
58
- const sectionId = resolveEntityRefId(step.safetyPlanSectionId) ?? '';
59
- if (!sectionId) {
60
- continue;
61
- }
62
- const list = bySection.get(sectionId) ?? [];
63
- list.push(step);
64
- bySection.set(sectionId, list);
65
- }
66
- return {
67
- sections: value.sections.map((section) => {
68
- if (!isStepTableSectionType(section.sectionTypeId, section.sectionType)) {
69
- return section;
70
- }
71
- const steps = [...(bySection.get(section.id) ?? [])].sort((a, b) => (a.sortOrder ?? 0) - (b.sortOrder ?? 0) || String(a.code ?? '').localeCompare(String(b.code ?? '')));
72
- const workStepTypeId = section.workStepTypeId ||
73
- (steps[0] ? resolveEntityRefId(steps[0].workStepTypeId) ?? undefined : undefined);
74
- const columns = (workStepTypeId && columnsByWorkStepTypeId?.get(workStepTypeId)) ||
75
- normalizeStepTableColumns(steps[0]?.columns) ||
76
- section.columns ||
77
- [];
78
- return {
79
- ...section,
80
- workStepTypeId,
81
- workStepType: section.workStepType ?? steps[0]?.workStepType,
82
- columns,
83
- items: steps.map((step) => toBuilderItemFromWorkStepRow(step, columns)),
84
- };
85
- }),
86
- };
87
- }
88
- function builderValueToSafetyPlanSectionPayloads(value, safetyPlanId) {
89
- return value.sections.map((section, index) => ({
90
- id: section.id,
91
- safetyPlanId,
92
- title: section.title,
93
- description: section.description?.trim() ? section.description.trim() : undefined,
94
- sectionTypeId: section.sectionTypeId,
95
- sectionType: section.sectionType,
96
- sourceSafetyPlanTypeSectionId: section.sourceSafetyPlanTypeSectionId,
97
- sortOrder: typeof section.sortOrder === 'number' ? section.sortOrder : index + 1,
98
- workStepTypeId: section.workStepTypeId,
99
- workStepType: section.workStepType,
100
- columns: section.columns,
101
- widgetOptions: section.widgetOptions,
102
- items: section.items.map((item) => ({
103
- ...item,
104
- itemIds: [...(item.itemIds ?? [])],
105
- items: item.items ? [...item.items] : [],
106
- stepTableRow: item.stepTableRow ? normalizeStepTableRowPayload(item.stepTableRow) : undefined,
107
- })),
108
- }));
109
- }
110
- function toBuilderItemFromWorkStepRow(step, columns) {
111
- const normalizedColumns = normalizeStepTableColumns(columns.length ? columns : step.columns);
112
- const cells = normalizeStepTableRows([{ id: step.id, sortOrder: step.sortOrder ?? 1, cells: step.cells ?? [] }], normalizedColumns)[0]?.cells ??
113
- step.cells ??
114
- [];
115
- const title = step.title?.trim() || summarizeStepTableRow(cells, normalizedColumns);
116
- return {
117
- id: step.id,
118
- itemIds: [step.id],
119
- items: [{ id: step.id, title, code: step.code }],
120
- stepTableRow: {
121
- cells,
122
- code: step.code,
123
- sortOrder: step.sortOrder,
124
- title,
125
- },
126
- };
127
- }
128
- function summarizeStepTableRow(cells, columns) {
129
- for (const column of columns) {
130
- const key = column.sectionTypeId;
131
- const cell = cells.find((entry) => entry.columnKey === key);
132
- if (!cell) {
133
- continue;
134
- }
135
- const fromRefs = cell.refs?.[0]?.title || cell.refs?.[0]?.code;
136
- if (fromRefs) {
137
- return fromRefs;
138
- }
139
- if (cell.textValue?.trim()) {
140
- return cell.textValue.trim();
141
- }
142
- }
143
- return columns[0] ? stepTableColumnTitle(columns[0]) : 'Row';
144
- }
145
- function normalizeSection(section, index) {
146
- const id = typeof section.id === 'string' && section.id ? section.id : AXPDataGenerator.uuid();
147
- const sectionTypeId = resolveEntityRefId(section.sectionTypeId) ?? '';
148
- const workStepTypeId = resolveEntityRefId(section.workStepTypeId) ?? undefined;
149
- return {
150
- id,
151
- sectionTypeId,
152
- sectionType: enrichSectionTypeSnapshot(sectionTypeId, section.sectionType),
153
- title: typeof section.title === 'string' ? section.title : '',
154
- description: typeof section.description === 'string' ? section.description : '',
155
- safetyPlanId: typeof section.safetyPlanId === 'string' ? section.safetyPlanId : undefined,
156
- code: typeof section.code === 'string' ? section.code : undefined,
157
- sourceSafetyPlanTypeSectionId: typeof section.sourceSafetyPlanTypeSectionId === 'string'
158
- ? section.sourceSafetyPlanTypeSectionId
159
- : undefined,
160
- sortOrder: typeof section.sortOrder === 'number' ? section.sortOrder : index + 1,
161
- required: section.required === true,
162
- workStepTypeId,
163
- workStepType: section.workStepType,
164
- columns: normalizeStepTableColumns(section.columns),
165
- widgetOptions: normalizeWidgetOptions(section.widgetOptions),
166
- items: Array.isArray(section.items)
167
- ? section.items.map((item) => normalizeItem(item, id, sectionTypeId, section.sectionType))
168
- : [],
169
- };
170
- }
171
- function normalizeWidgetOptions(value) {
172
- if (!value || typeof value !== 'object' || Array.isArray(value)) {
173
- return undefined;
174
- }
175
- return { ...value };
176
- }
177
- function normalizeItem(item, sectionId, sectionTypeId, sectionType) {
178
- const isStepTable = isStepTableSectionType(sectionTypeId, sectionType);
179
- if (isStepTable && item.stepTableRow) {
180
- const stepTableRow = normalizeStepTableRowPayload(item.stepTableRow);
181
- const stepId = typeof item.id === 'string' && item.id && !item.id.includes('__item_') && !item.id.includes('__entity_')
182
- ? item.id
183
- : AXPDataGenerator.uuid();
184
- const title = stepTableRow.title?.trim() || 'Row';
185
- return {
186
- id: stepId,
187
- itemIds: [stepId],
188
- items: [{ id: stepId, title, code: stepTableRow.code }],
189
- stepTableRow,
190
- };
191
- }
192
- const id = typeof item.id === 'string' && item.id ? item.id : AXPDataGenerator.uuid();
193
- return {
194
- id: id.includes('__item_') || id.includes('__entity_') ? id : `${sectionId}__item_${id}`,
195
- itemIds: Array.isArray(item.itemIds) ? item.itemIds.filter((x) => typeof x === 'string') : [],
196
- items: Array.isArray(item.items) ? item.items : [],
197
- };
198
- }
199
- function normalizeStepTableRowPayload(payload) {
200
- return {
201
- cells: Array.isArray(payload.cells) ? payload.cells : [],
202
- code: typeof payload.code === 'string' ? payload.code : undefined,
203
- sortOrder: typeof payload.sortOrder === 'number' ? payload.sortOrder : undefined,
204
- title: typeof payload.title === 'string' ? payload.title : undefined,
205
- };
206
- }
6
+ import { RootConfig, dedupeSafetyPlanSectionStructure, isStepTableSectionType, normalizeStepTableColumns, collectBuiltInRepeatableSectionTypeIds, resolveEntityRefId } from '@acorex-platform/module-workplacesafety-management-client/contracts';
7
+ import { b as builderValueToSafetyPlanSectionPayloads, s as summarizeStepTableRow, a as safetyPlanSectionsToBuilderValue } from './acorex-platform-module-workplacesafety-management-client-safety-plan-section-builder.types-LaN1NIgc.mjs';
207
8
 
208
9
  const SAFETY_PLAN_SECTIONS_SAVE_COMMAND = 'SafetyPlan:Sections:Save';
209
10
  class AXMSaveSafetyPlanSectionsCommand {
@@ -439,11 +240,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
439
240
  }]
440
241
  }] });
441
242
 
442
- var saveSafetyPlanSections_command = /*#__PURE__*/Object.freeze({
443
- __proto__: null,
444
- AXMSaveSafetyPlanSectionsCommand: AXMSaveSafetyPlanSectionsCommand,
445
- SAFETY_PLAN_SECTIONS_SAVE_COMMAND: SAFETY_PLAN_SECTIONS_SAVE_COMMAND
446
- });
447
-
448
- export { AXMSaveSafetyPlanSectionsCommand as A, SAFETY_PLAN_SECTIONS_SAVE_COMMAND as S, safetyPlanSectionsToBuilderValue as a, saveSafetyPlanSections_command as b, hydrateStepTableSectionsWithWorkSteps as h, normalizeSafetyPlanSectionBuilderValue as n, summarizeStepTableRow as s };
449
- //# sourceMappingURL=acorex-platform-module-workplacesafety-management-client-save-safety-plan-sections.command-BlPzzCc2.mjs.map
243
+ export { AXMSaveSafetyPlanSectionsCommand, SAFETY_PLAN_SECTIONS_SAVE_COMMAND };
244
+ //# sourceMappingURL=acorex-platform-module-workplacesafety-management-client-save-safety-plan-sections.command-CLj3y_JD.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-platform-module-workplacesafety-management-client-save-safety-plan-sections.command-CLj3y_JD.mjs","sources":["../../../../libs/modules/workplacesafety-management/client/src/lib/features/safety-plan-sections-page/save-safety-plan-sections.command.ts"],"sourcesContent":["import {\n AXPEntityService,\n isAXPMiddlewareAbortError,\n mapEntityStorageErrorToCommandResult,\n} from '@acorex-platform/framework-client/layout/entity';\nimport { extractRequestErrorInfo } from '@acorex-platform/framework-client/common';\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { inject, Injectable } from '@angular/core';\nimport {\n AXMSafetyPlanSectionBuilderValue,\n RootConfig,\n collectBuiltInRepeatableSectionTypeIds,\n dedupeSafetyPlanSectionStructure,\n isStepTableSectionType,\n normalizeStepTableColumns,\n resolveEntityRefId,\n} from '@acorex-platform/module-workplacesafety-management-client/contracts';\nimport {\n builderValueToSafetyPlanSectionPayloads,\n safetyPlanSectionsToBuilderValue,\n summarizeStepTableRow,\n} from './safety-plan-section-builder.types';\n\nexport const SAFETY_PLAN_SECTIONS_SAVE_COMMAND = 'SafetyPlan:Sections:Save';\n\nexport interface SaveSafetyPlanSectionsInput {\n id: string;\n value: AXMSafetyPlanSectionBuilderValue;\n}\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AXMSaveSafetyPlanSectionsCommand implements AXPCommand<SaveSafetyPlanSectionsInput, unknown> {\n private readonly entityService = inject(AXPEntityService);\n private readonly translationService = inject(AXTranslationService);\n\n async execute(input: SaveSafetyPlanSectionsInput): AXPCommandExecuteResultPromise<unknown> {\n const safetyPlanId = input?.id;\n const rawValue = input?.value ?? { sections: [] };\n\n if (!safetyPlanId) {\n return {\n success: false,\n message: {\n text: await this.translationService.translateAsync('@general:messages.entity.invalid-data'),\n },\n };\n }\n\n const sectionEntityRef = `${RootConfig.module.name}.${RootConfig.entities.safetyPlanSection.name}`;\n const sectionTypeEntityRef = `${RootConfig.module.name}.${RootConfig.entities.sectionType.name}`;\n const workStepEntityRef = `${RootConfig.module.name}.${RootConfig.entities.safetyPlanWorkStep.name}`;\n const sectionData = this.entityService.withEntity(sectionEntityRef).data();\n const workStepData = this.entityService.withEntity(workStepEntityRef).data();\n\n try {\n const repeatableSectionTypeIds = await this.loadRepeatableSectionTypeIds(sectionTypeEntityRef);\n\n // Dedupe accidental ghost rows (same type-section source materialized twice).\n const value = dedupeSafetyPlanSectionStructure(rawValue, { repeatableSectionTypeIds });\n\n const existing = await this.queryPlanSections(sectionData, safetyPlanId);\n const existingRows = existing.items ?? [];\n const existingIds = new Set(existingRows.map((row) => String((row as { id?: string }).id ?? '')));\n const nextIds = new Set(value.sections.map((section) => section.id));\n\n for (const row of existingRows) {\n const rowId = String((row as { id?: string }).id ?? '');\n if (rowId && !nextIds.has(rowId)) {\n await this.deleteWorkStepsForSection(workStepData, rowId);\n await sectionData.delete(rowId);\n }\n }\n\n const payloads = builderValueToSafetyPlanSectionPayloads(value, safetyPlanId);\n for (const payload of payloads) {\n const isStepTable = isStepTableSectionType(payload.sectionTypeId, payload.sectionType);\n const columns = normalizeStepTableColumns(payload.columns);\n\n if (isStepTable) {\n await this.syncWorkStepsForSection(\n workStepData,\n safetyPlanId,\n payload.id,\n payload.workStepTypeId,\n payload.workStepType,\n columns,\n payload.items,\n );\n }\n\n const itemRows = isStepTable\n ? [\n {\n sectionTypeId: payload.sectionTypeId,\n sectionType: payload.sectionType,\n workStepTypeId: payload.workStepTypeId,\n workStepType: payload.workStepType,\n itemIds: payload.items\n .map((item) => item.id)\n .filter((id): id is string => typeof id === 'string' && id.length > 0),\n items: payload.items.map((item) => ({\n id: item.id,\n title:\n item.stepTableRow?.title ??\n summarizeStepTableRow(item.stepTableRow?.cells ?? [], columns) ??\n item.items?.[0]?.title,\n code: item.stepTableRow?.code ?? item.items?.[0]?.code,\n })),\n },\n ]\n : payload.items.length > 0\n ? payload.items.map(({ itemIds, items }) => ({\n sectionTypeId: payload.sectionTypeId,\n sectionType: payload.sectionType,\n itemIds,\n items,\n }))\n : [\n {\n sectionTypeId: payload.sectionTypeId,\n sectionType: payload.sectionType,\n itemIds: [] as string[],\n items: [] as { id: string; title?: string; code?: string }[],\n },\n ];\n\n const entityPayload = {\n safetyPlanId: payload.safetyPlanId,\n title: payload.title,\n description: payload.description,\n sourceSafetyPlanTypeSectionId: payload.sourceSafetyPlanTypeSectionId,\n sortOrder: payload.sortOrder,\n items: itemRows,\n ...(payload.widgetOptions !== undefined ? { widgetOptions: payload.widgetOptions } : {}),\n };\n\n if (existingIds.has(payload.id)) {\n await sectionData.update(payload.id, entityPayload as never);\n } else {\n await sectionData.create({ ...entityPayload, id: payload.id } as never);\n }\n }\n\n const refreshed = await this.queryPlanSections(sectionData, safetyPlanId);\n const deduped = dedupeSafetyPlanSectionStructure(\n safetyPlanSectionsToBuilderValue(\n (refreshed.items ?? []) as Parameters<typeof safetyPlanSectionsToBuilderValue>[0],\n ),\n { repeatableSectionTypeIds },\n );\n const keepIds = new Set(deduped.sections.map((section) => section.id));\n\n for (const row of refreshed.items ?? []) {\n const rowId = String((row as { id?: string }).id ?? '');\n if (rowId && !keepIds.has(rowId)) {\n await this.deleteWorkStepsForSection(workStepData, rowId);\n await sectionData.delete(rowId);\n }\n }\n\n const cleaned =\n keepIds.size === (refreshed.items ?? []).length\n ? refreshed\n : await this.queryPlanSections(sectionData, safetyPlanId);\n\n const sections = (cleaned.items ?? []).filter((row) =>\n keepIds.has(String((row as { id?: string }).id ?? '')),\n );\n\n return {\n success: true,\n kind: 'object',\n data: { id: safetyPlanId, value, sections },\n message: {\n text: await this.translationService.translateAsync('@general:messages.generic.success.description'),\n },\n };\n } catch (error) {\n if (isAXPMiddlewareAbortError(error)) {\n return mapEntityStorageErrorToCommandResult(error);\n }\n\n const httpInfo = extractRequestErrorInfo(error);\n const text =\n (typeof httpInfo?.message === 'string' && httpInfo.message.startsWith('@')\n ? httpInfo.message\n : null) ??\n (error instanceof Error && error.message.startsWith('@') ? error.message : null) ??\n (await this.translationService.translateAsync('@general:messages.generic.error.description'));\n\n return {\n success: false,\n message: { type: 'error', text },\n };\n }\n }\n\n private async syncWorkStepsForSection(\n workStepData: ReturnType<ReturnType<AXPEntityService['withEntity']>['data']>,\n safetyPlanId: string,\n sectionId: string,\n workStepTypeId: string | undefined,\n workStepType: { id: string; title?: string; code?: string } | undefined,\n columns: ReturnType<typeof normalizeStepTableColumns>,\n items: ReturnType<typeof builderValueToSafetyPlanSectionPayloads>[number]['items'],\n ): Promise<void> {\n const existing = await workStepData.query({\n skip: 0,\n take: 1000,\n filter: {\n logic: 'and',\n filters: [{ field: 'safetyPlanSectionId', operator: { type: 'equal' }, value: sectionId }],\n },\n } as never);\n\n const existingRows = existing.items ?? [];\n const existingIds = new Set(existingRows.map((row) => String((row as { id?: string }).id ?? '')));\n const nextIds = new Set(\n items.map((item) => item.id).filter((id): id is string => typeof id === 'string' && id.length > 0),\n );\n\n for (const row of existingRows) {\n const rowId = String((row as { id?: string }).id ?? '');\n if (rowId && !nextIds.has(rowId)) {\n await workStepData.delete(rowId);\n }\n }\n\n if (!workStepTypeId) {\n return;\n }\n\n for (const [index, item] of items.entries()) {\n const stepTableRow = item.stepTableRow;\n if (!stepTableRow || !item.id) {\n continue;\n }\n const title =\n stepTableRow.title?.trim() ||\n summarizeStepTableRow(stepTableRow.cells ?? [], columns) ||\n item.items?.[0]?.title;\n const entityPayload = {\n safetyPlanId,\n safetyPlanSectionId: sectionId,\n workStepTypeId,\n workStepType: workStepType ?? { id: workStepTypeId },\n title,\n columns,\n cells: stepTableRow.cells ?? [],\n sortOrder: stepTableRow.sortOrder ?? index + 1,\n };\n\n if (existingIds.has(item.id)) {\n await workStepData.update(item.id, entityPayload as never);\n } else {\n await workStepData.create({ ...entityPayload, id: item.id } as never);\n }\n }\n }\n\n private async deleteWorkStepsForSection(\n workStepData: ReturnType<ReturnType<AXPEntityService['withEntity']>['data']>,\n sectionId: string,\n ): Promise<void> {\n const existing = await workStepData.query({\n skip: 0,\n take: 1000,\n filter: {\n logic: 'and',\n filters: [{ field: 'safetyPlanSectionId', operator: { type: 'equal' }, value: sectionId }],\n },\n } as never);\n for (const row of existing.items ?? []) {\n const rowId = String((row as { id?: string }).id ?? '');\n if (rowId) {\n await workStepData.delete(rowId);\n }\n }\n }\n\n private async loadRepeatableSectionTypeIds(sectionTypeEntityRef: string): Promise<string[]> {\n const builtIn = collectBuiltInRepeatableSectionTypeIds();\n try {\n // Prefer client-side filtering — boolean equality filters can miss stored values.\n const result = await this.entityService.withEntity(sectionTypeEntityRef).data().query({\n skip: 0,\n take: 1000,\n } as never);\n const fromQuery = (result.items ?? [])\n .filter((row) => (row as { isRepeatable?: unknown }).isRepeatable === true)\n .map((row) => resolveEntityRefId((row as { id?: unknown }).id))\n .filter((id): id is string => !!id);\n return [...new Set([...fromQuery, ...builtIn])];\n } catch {\n return builtIn;\n }\n }\n\n private queryPlanSections(\n sectionData: ReturnType<ReturnType<AXPEntityService['withEntity']>['data']>,\n safetyPlanId: string,\n ) {\n return sectionData.query({\n skip: 0,\n take: 1000,\n filter: {\n logic: 'and',\n filters: [{ field: 'safetyPlanId', operator: { type: 'equal' }, value: safetyPlanId }],\n },\n } as never);\n }\n}\n"],"names":[],"mappings":";;;;;;;;AAwBO,MAAM,iCAAiC,GAAG;MAUpC,gCAAgC,CAAA;AAH7C,IAAA,WAAA,GAAA;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACxC,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AAsRnE,IAAA;IApRC,MAAM,OAAO,CAAC,KAAkC,EAAA;AAC9C,QAAA,MAAM,YAAY,GAAG,KAAK,EAAE,EAAE;QAC9B,MAAM,QAAQ,GAAG,KAAK,EAAE,KAAK,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE;QAEjD,IAAI,CAAC,YAAY,EAAE;YACjB,OAAO;AACL,gBAAA,OAAO,EAAE,KAAK;AACd,gBAAA,OAAO,EAAE;o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,CAAC,EAAE,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC;AACvF,aAAA;AACO,SAAA,CAAC;IACb;8GAvRW,gCAAgC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAhC,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,gCAAgC,cAF/B,MAAM,EAAA,CAAA,CAAA;;2FAEP,gCAAgC,EAAA,UAAA,EAAA,CAAA;kBAH5C,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;"}
@@ -1,2 +1,2 @@
1
- export { A as AXMWorkplaceSafetyManagementMenuProvider, a as AXMWorkplaceSafetyManagementModule, b as AXMWorkplaceSafetyManagementSearchCommandProvider } from './acorex-platform-module-workplacesafety-management-client-acorex-platform-module-workplacesafety-management-client-mzaaZ6T3.mjs';
1
+ export { A as AXMWorkplaceSafetyManagementMenuProvider, a as AXMWorkplaceSafetyManagementModule, b as AXMWorkplaceSafetyManagementSearchCommandProvider } from './acorex-platform-module-workplacesafety-management-client-acorex-platform-module-workplacesafety-management-client-Ds0Fkspp.mjs';
2
2
  //# sourceMappingURL=acorex-platform-module-workplacesafety-management-client.mjs.map
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@acorex-platform/module-workplacesafety-management-client",
3
- "version": "0.0.33",
3
+ "version": "0.0.38",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {
6
- "@acorex-platform/module-data-management-client": "0.0.33",
6
+ "@acorex-platform/module-data-management-client": "0.0.38",
7
7
  "@angular/common": "^21.0.0 || ^22.0.0",
8
8
  "@angular/core": "^21.0.0 || ^22.0.0"
9
9
  },
@@ -154,6 +154,7 @@ declare const AXMWorkplaceSafetyManagementPermissionKeys: {
154
154
 
155
155
  declare const AXMWorkplaceSafetyManagementCommandKeys: {
156
156
  readonly SafetyPlan: {
157
+ readonly Preview: "WorkplaceSafetyManagement.SafetyPlan:Preview";
157
158
  readonly Publish: "WorkplaceSafetyManagement.SafetyPlan:Publish";
158
159
  readonly ChangeType: "WorkplaceSafetyManagement.SafetyPlan:ChangeType";
159
160
  };
@@ -792,6 +793,16 @@ declare function resolveSafetyPlanSectionPersistedTitle(sectionTitle: unknown, s
792
793
  declare function isSafetyPlanTypeSectionDefault(row: {
793
794
  isDefault?: unknown;
794
795
  } | null | undefined): boolean;
796
+ /**
797
+ * Returns the default Safety Plan Type Section (structure) for a plan type.
798
+ * Prefers `isDefault: true`; otherwise the first active row by sortOrder/title.
799
+ */
800
+ declare function resolveDefaultSafetyPlanTypeSection(typeSections: readonly AXMWorkplaceSafetyManagementSafetyPlanTypeSectionEntityModel[]): AXMWorkplaceSafetyManagementSafetyPlanTypeSectionEntityModel | null;
801
+ /**
802
+ * Narrows type-section rows to the selected structure when `structureId` is set.
803
+ * Falls back to all active rows (caller / build still applies isDefault rules).
804
+ */
805
+ declare function pickSafetyPlanTypeSectionsForStructure(typeSections: readonly AXMWorkplaceSafetyManagementSafetyPlanTypeSectionEntityModel[], structureId?: string | null): AXMWorkplaceSafetyManagementSafetyPlanTypeSectionEntityModel[];
795
806
  /** Extracts a stable entity id from a raw lookup / context value. */
796
807
  declare function resolveEntityRefId(raw: unknown): string | null;
797
808
  /**
@@ -813,7 +824,9 @@ declare function dedupeSafetyPlanSectionStructure<T extends AXMSafetyPlanSection
813
824
  repeatableSectionTypeIds?: readonly string[];
814
825
  }): T;
815
826
  declare function collectAllowedSectionTypeIds(typeSections: readonly AXMWorkplaceSafetyManagementSafetyPlanTypeSectionEntityModel[]): string[];
816
- declare function collectRequiredSourceTypeSectionIds(typeSections: readonly AXMWorkplaceSafetyManagementSafetyPlanTypeSectionEntityModel[]): string[];
827
+ declare function collectRequiredSourceTypeSectionIds(typeSections: readonly AXMWorkplaceSafetyManagementSafetyPlanTypeSectionEntityModel[], options?: {
828
+ structureId?: string | null;
829
+ }): string[];
817
830
  /**
818
831
  * Validates that a plan-type section template does not list the same
819
832
  * non-repeatable section type more than once (across rows and within a single row's repeater).
@@ -1012,6 +1025,15 @@ interface AXMWorkplaceSafetyManagementSafetyPlanEntityModel extends AXPEntityMod
1012
1025
  title?: string;
1013
1026
  code?: string;
1014
1027
  };
1028
+ /**
1029
+ * Selected Safety Plan Type Section (named structure) for this plan.
1030
+ * Filtered by {@link safetyPlanTypeId}; defaults to the type's `isDefault` structure.
1031
+ */
1032
+ structureId?: string;
1033
+ structure?: {
1034
+ id: string;
1035
+ title?: string;
1036
+ };
1015
1037
  status?: AXMSafetyPlanStatus;
1016
1038
  /** When true, a published plan can be cloned into a new draft plan. */
1017
1039
  allowClone?: boolean;
@@ -1049,12 +1071,13 @@ interface AXMWorkplaceSafetyManagementSafetyTemplateEntityModel extends AXPEntit
1049
1071
  /** Managed by the archive plugin (`isArchived`). */
1050
1072
  isArchived?: boolean;
1051
1073
  sectionIds: string[];
1052
- sections?: {
1074
+ /** Expanded from `sectionIds` (multi-lookup join alias). */
1075
+ sectionsList?: {
1053
1076
  id: string;
1054
1077
  title: string;
1055
1078
  code?: string;
1056
1079
  }[];
1057
1080
  }
1058
1081
 
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 };
1082
+ 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, pickSafetyPlanTypeSectionsForStructure, resolveDefaultSafetyPlanTypeSection, resolveEntityRefId, resolveParentHazardIds, resolveParentHazardRiskIds, resolveParentItemIds, resolveSafetyPlanSectionItemColumns, resolveSafetyPlanSectionItemEntityKey, resolveSafetyPlanSectionItemFilter, resolveSafetyPlanSectionItemFilterAsync, resolveSafetyPlanSectionPersistedTitle, resolveSectionItemEntityName, resolveSectionTypeKey, resolveStepTableColumnLookupEntity, sectionTypeKeyFromSection, sortStepTableColumns, stepTableColumnKey, stepTableColumnTitle, toBuilderValueFromStructure, toWorkStepBuilderPayload, validateSafetyPlanSectionStructure, validateSafetyPlanTypeSectionTemplate };
1060
1083
  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 };