@acorex/modules 19.2.4 → 19.2.6

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 (100) hide show
  1. package/auth/lib/store/auth.effects.d.ts +2 -2
  2. package/fesm2022/{acorex-modules-application-management-module-designer.component-uLfQYtpy.mjs → acorex-modules-application-management-module-designer.component-DPJ4qpK3.mjs} +5 -5
  3. package/fesm2022/acorex-modules-application-management-module-designer.component-DPJ4qpK3.mjs.map +1 -0
  4. package/fesm2022/acorex-modules-application-management.mjs +3 -3
  5. package/fesm2022/acorex-modules-application-management.mjs.map +1 -1
  6. package/fesm2022/{acorex-modules-auth-acorex-modules-auth-C-qPiQhk.mjs → acorex-modules-auth-acorex-modules-auth-D75igkfc.mjs} +25 -25
  7. package/fesm2022/acorex-modules-auth-acorex-modules-auth-D75igkfc.mjs.map +1 -0
  8. package/fesm2022/acorex-modules-auth-app-chooser.component-BZb8n5Ag.mjs +64 -0
  9. package/fesm2022/acorex-modules-auth-app-chooser.component-BZb8n5Ag.mjs.map +1 -0
  10. package/fesm2022/{acorex-modules-auth-login.module-nqFBpUaE.mjs → acorex-modules-auth-login.module-DAtJYcHZ.mjs} +4 -4
  11. package/fesm2022/{acorex-modules-auth-login.module-nqFBpUaE.mjs.map → acorex-modules-auth-login.module-DAtJYcHZ.mjs.map} +1 -1
  12. package/fesm2022/acorex-modules-auth-master.layout-qeAQTygT.mjs +23 -0
  13. package/fesm2022/acorex-modules-auth-master.layout-qeAQTygT.mjs.map +1 -0
  14. package/fesm2022/{acorex-modules-auth-password.component-DZ6TiNI-.mjs → acorex-modules-auth-password.component-20Ofs9FL.mjs} +2 -2
  15. package/fesm2022/{acorex-modules-auth-password.component-DZ6TiNI-.mjs.map → acorex-modules-auth-password.component-20Ofs9FL.mjs.map} +1 -1
  16. package/fesm2022/{acorex-modules-auth-password.component-3t_WqB4c.mjs → acorex-modules-auth-password.component-CRvI9sIa.mjs} +4 -4
  17. package/fesm2022/acorex-modules-auth-password.component-CRvI9sIa.mjs.map +1 -0
  18. package/fesm2022/{acorex-modules-auth-routes-nnrAlvkD.mjs → acorex-modules-auth-routes-BDED-qaZ.mjs} +2 -2
  19. package/fesm2022/{acorex-modules-auth-routes-nnrAlvkD.mjs.map → acorex-modules-auth-routes-BDED-qaZ.mjs.map} +1 -1
  20. package/fesm2022/acorex-modules-auth-tenant-chooser.component-CKsbiOUX.mjs +83 -0
  21. package/fesm2022/acorex-modules-auth-tenant-chooser.component-CKsbiOUX.mjs.map +1 -0
  22. package/fesm2022/{acorex-modules-auth-two-factor.module-DWtEYnHW.mjs → acorex-modules-auth-two-factor.module-B0C2aBWh.mjs} +2 -2
  23. package/fesm2022/{acorex-modules-auth-two-factor.module-DWtEYnHW.mjs.map → acorex-modules-auth-two-factor.module-B0C2aBWh.mjs.map} +1 -1
  24. package/fesm2022/acorex-modules-auth.mjs +1 -1
  25. package/fesm2022/acorex-modules-conversation.mjs +10 -10
  26. package/fesm2022/acorex-modules-conversation.mjs.map +1 -1
  27. package/fesm2022/acorex-modules-form-template-management-template-picker.component-xiRKc4FF.mjs +126 -0
  28. package/fesm2022/acorex-modules-form-template-management-template-picker.component-xiRKc4FF.mjs.map +1 -0
  29. package/fesm2022/acorex-modules-form-template-management.mjs +1 -1
  30. package/fesm2022/acorex-modules-notification-management.mjs +417 -4
  31. package/fesm2022/acorex-modules-notification-management.mjs.map +1 -1
  32. package/fesm2022/{acorex-modules-organization-managment-employee.entity-oo5Tyyp2.mjs → acorex-modules-organization-managment-employee.entity-D4BSxGAW.mjs} +40 -2
  33. package/fesm2022/acorex-modules-organization-managment-employee.entity-D4BSxGAW.mjs.map +1 -0
  34. package/fesm2022/acorex-modules-organization-managment-org-chart-configuration.page-DEFgztyn.mjs +92 -0
  35. package/fesm2022/acorex-modules-organization-managment-org-chart-configuration.page-DEFgztyn.mjs.map +1 -0
  36. package/fesm2022/acorex-modules-organization-managment-org-chart-configuration.service-D-LkPUIw.mjs +145 -0
  37. package/fesm2022/acorex-modules-organization-managment-org-chart-configuration.service-D-LkPUIw.mjs.map +1 -0
  38. package/fesm2022/acorex-modules-organization-managment-org-chart.page-B3aaLlm2.mjs +597 -0
  39. package/fesm2022/acorex-modules-organization-managment-org-chart.page-B3aaLlm2.mjs.map +1 -0
  40. package/fesm2022/acorex-modules-organization-managment-setting.keys-CF6Giykz.mjs +22 -0
  41. package/fesm2022/acorex-modules-organization-managment-setting.keys-CF6Giykz.mjs.map +1 -0
  42. package/fesm2022/{acorex-modules-organization-managment-setting.provider-BtkaTjLS.mjs → acorex-modules-organization-managment-setting.provider-nKs53GcA.mjs} +2 -20
  43. package/fesm2022/acorex-modules-organization-managment-setting.provider-nKs53GcA.mjs.map +1 -0
  44. package/fesm2022/acorex-modules-organization-managment.mjs +44 -27
  45. package/fesm2022/acorex-modules-organization-managment.mjs.map +1 -1
  46. package/fesm2022/acorex-modules-platform-management.mjs +404 -145
  47. package/fesm2022/acorex-modules-platform-management.mjs.map +1 -1
  48. package/fesm2022/acorex-modules-security-management.mjs +12 -1
  49. package/fesm2022/acorex-modules-security-management.mjs.map +1 -1
  50. package/notification-management/lib/components/promotion-slot/promotion-slot.component.d.ts +11 -0
  51. package/notification-management/lib/entities/channel/channel.types.d.ts +11 -1
  52. package/organization-managment/lib/const.d.ts +12 -0
  53. package/organization-managment/lib/features/organization-chart/org-chart-configuration.page.d.ts +141 -0
  54. package/organization-managment/lib/features/organization-chart/org-chart-configuration.service.d.ts +24 -0
  55. package/organization-managment/lib/features/organization-chart/org-chart-print.service.d.ts +22 -0
  56. package/organization-managment/lib/features/organization-chart/org-chart.page.d.ts +162 -0
  57. package/organization-managment/lib/features/organization-chart/org-chart.service.d.ts +19 -0
  58. package/organization-managment/lib/features/organization-chart/org-chart.type.d.ts +25 -0
  59. package/organization-managment/lib/setting.keys.d.ts +2 -1
  60. package/package.json +5 -5
  61. package/platform-management/index.d.ts +1 -0
  62. package/platform-management/lib/const.d.ts +2 -0
  63. package/platform-management/lib/entities/app-term/app-term.types.d.ts +12 -2
  64. package/platform-management/lib/entities/app-term/components/notify-app/notify-app.component.d.ts +16 -0
  65. package/platform-management/lib/entities/app-term/index.d.ts +2 -0
  66. package/platform-management/lib/entities/app-term/pages/index.d.ts +1 -0
  67. package/platform-management/lib/entities/app-term/pages/list/list-terms.component.d.ts +20 -0
  68. package/platform-management/lib/entities/app-term/workflows/index.d.ts +1 -0
  69. package/platform-management/lib/entities/app-term/workflows/notify-new-term.workflow.d.ts +15 -0
  70. package/platform-management/lib/entities/app-version/app-version.types.d.ts +7 -0
  71. package/platform-management/lib/entities/app-version/components/index.d.ts +2 -0
  72. package/platform-management/lib/entities/app-version/components/list-versions/list-version.component.d.ts +13 -0
  73. package/platform-management/lib/entities/app-version/{workflow/test/test.component.d.ts → components/notify-app/notify-app.component.d.ts} +3 -3
  74. package/platform-management/lib/entities/app-version/components/slots/app-version-slot.component.d.ts +12 -0
  75. package/platform-management/lib/entities/app-version/index.d.ts +2 -1
  76. package/platform-management/lib/entities/app-version/{workflow → workflows}/index.d.ts +0 -1
  77. package/platform-management/lib/entities/check-version.d.ts +12 -0
  78. package/platform-management/lib/entities/index.d.ts +1 -0
  79. package/platform-management/lib/platform-management.module.d.ts +2 -2
  80. package/security-management/index.d.ts +1 -0
  81. package/security-management/lib/menu.keys.d.ts +5 -0
  82. package/fesm2022/acorex-modules-application-management-module-designer.component-uLfQYtpy.mjs.map +0 -1
  83. package/fesm2022/acorex-modules-auth-acorex-modules-auth-C-qPiQhk.mjs.map +0 -1
  84. package/fesm2022/acorex-modules-auth-app-chooser.component-j3JgxtBC.mjs +0 -64
  85. package/fesm2022/acorex-modules-auth-app-chooser.component-j3JgxtBC.mjs.map +0 -1
  86. package/fesm2022/acorex-modules-auth-master.layout-C9eKuJgU.mjs +0 -23
  87. package/fesm2022/acorex-modules-auth-master.layout-C9eKuJgU.mjs.map +0 -1
  88. package/fesm2022/acorex-modules-auth-password.component-3t_WqB4c.mjs.map +0 -1
  89. package/fesm2022/acorex-modules-auth-tenant-chooser.component-Cx3fK__H.mjs +0 -83
  90. package/fesm2022/acorex-modules-auth-tenant-chooser.component-Cx3fK__H.mjs.map +0 -1
  91. package/fesm2022/acorex-modules-form-template-management-template-picker.component-DW0iMqAA.mjs +0 -126
  92. package/fesm2022/acorex-modules-form-template-management-template-picker.component-DW0iMqAA.mjs.map +0 -1
  93. package/fesm2022/acorex-modules-organization-managment-employee.entity-oo5Tyyp2.mjs.map +0 -1
  94. package/fesm2022/acorex-modules-organization-managment-org-chart.page-fOxjGb8i.mjs +0 -297
  95. package/fesm2022/acorex-modules-organization-managment-org-chart.page-fOxjGb8i.mjs.map +0 -1
  96. package/fesm2022/acorex-modules-organization-managment-setting.provider-BtkaTjLS.mjs.map +0 -1
  97. package/organization-managment/lib/pages/org-chart/org-chart.page.d.ts +0 -28
  98. package/organization-managment/lib/pages/org-chart/org-chart.type.d.ts +0 -9
  99. package/platform-management/lib/entities/app-version/check-version.d.ts +0 -11
  100. /package/platform-management/lib/entities/app-version/{workflow → workflows}/change-log.workflow.d.ts +0 -0
@@ -14,7 +14,7 @@ async function factory(injector) {
14
14
  individual: `t("employee", { scope: "${i18n}" })`,
15
15
  plural: `t("employees", { scope: "${i18n}" })`,
16
16
  searchResult: {
17
- title: '{{ title }}',
17
+ title: '{{ firstname }} {{ lastname }}',
18
18
  description: RootConfig.module.title,
19
19
  },
20
20
  },
@@ -249,6 +249,44 @@ async function factory(injector) {
249
249
  },
250
250
  ],
251
251
  },
252
+ single: {
253
+ title: '{{firstname}} {{lastname}}',
254
+ sections: [
255
+ {
256
+ id: 'personal',
257
+ layout: {
258
+ positions: {
259
+ lg: {
260
+ colSpan: 12,
261
+ },
262
+ },
263
+ },
264
+ },
265
+ ],
266
+ properties: [
267
+ {
268
+ name: 'firstname',
269
+ layout: {
270
+ positions: {
271
+ lg: {
272
+ colSpan: 12,
273
+ },
274
+ },
275
+ },
276
+ },
277
+ {
278
+ name: 'lastname',
279
+ layout: {
280
+ positions: {
281
+ lg: {
282
+ colSpan: 12,
283
+ },
284
+ },
285
+ },
286
+ },
287
+ ],
288
+ actions: [],
289
+ },
252
290
  list: {
253
291
  actions: [
254
292
  {
@@ -298,4 +336,4 @@ async function factory(injector) {
298
336
  }
299
337
 
300
338
  export { factory };
301
- //# sourceMappingURL=acorex-modules-organization-managment-employee.entity-oo5Tyyp2.mjs.map
339
+ //# sourceMappingURL=acorex-modules-organization-managment-employee.entity-D4BSxGAW.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-modules-organization-managment-employee.entity-D4BSxGAW.mjs","sources":["../../../../libs/modules/organization-managment/src/lib/entities/employee/employee.entity.ts"],"sourcesContent":["import { AXPEntity, AXPEntityCommandScope, AXPEntityQueryType } from '@acorex/platform/common';\nimport { AXPWidgetsCatalog } from '@acorex/platform/layout/builder';\nimport { Injector } from '@angular/core';\nimport { RootConfig } from '../../const';\nimport { AXMOrganizationManagementEmployeeEntityService } from './employee.service';\n\nexport async function factory(injector: Injector): Promise<AXPEntity | null> {\n const dataService = injector.get(AXMOrganizationManagementEmployeeEntityService);\n const i18n = RootConfig.config.i18n;\n\n const entityDef: AXPEntity = {\n module: RootConfig.module.name,\n name: RootConfig.entities.employee.name,\n source: 'employees',\n title: `t(\"employee\", { scope: \"${i18n}\" })`,\n formats: {\n individual: `t(\"employee\", { scope: \"${i18n}\" })`,\n plural: `t(\"employees\", { scope: \"${i18n}\" })`,\n searchResult: {\n title: '{{ firstname }} {{ lastname }}',\n description: RootConfig.module.title,\n },\n },\n relatedEntities: [],\n groups: [\n {\n id: 'personal',\n title: `t(\"personalInformation\", { scope: \"${i18n}\" })`,\n },\n {\n id: 'job',\n title: `t(\"jobInformation\", { scope: \"${i18n}\" })`,\n },\n ],\n properties: [\n {\n name: 'firstname',\n title: `t(\"firstname\", { scope: \"common\" })`,\n groupId: 'personal',\n schema: {\n dataType: 'string',\n interface: {\n type: AXPWidgetsCatalog.text,\n },\n },\n validations: [\n {\n rule: 'required',\n },\n ],\n },\n {\n name: 'lastname',\n title: `t(\"lastname\", { scope: \"common\" })`,\n groupId: 'personal',\n schema: {\n dataType: 'string',\n interface: {\n type: AXPWidgetsCatalog.text,\n },\n },\n validations: [\n {\n rule: 'required',\n },\n ],\n },\n {\n name: 'email',\n title: `t(\"email\", { scope: \"common\" })`,\n groupId: 'personal',\n schema: {\n dataType: 'string',\n interface: {\n type: AXPWidgetsCatalog.contact,\n options: {\n type: 'email',\n multiple: false,\n hasLabel: false,\n }\n },\n },\n validations: [\n {\n rule: 'required',\n },\n {\n rule: 'email',\n },\n ],\n },\n {\n name: 'position',\n title: `t(\"position\", { scope: \"common\" })`,\n groupId: 'job',\n schema: {\n dataType: 'string',\n interface: {\n type: AXPWidgetsCatalog.select,\n options: {\n dataSource: 'positions',\n displayField: 'name',\n valueField: 'id',\n },\n },\n },\n validations: [\n {\n rule: 'required',\n },\n ],\n },\n {\n name: 'department',\n title: `t(\"department\", { scope: \"common\" })`,\n groupId: 'job',\n schema: {\n dataType: 'string',\n interface: {\n type: AXPWidgetsCatalog.select,\n options: {\n dataSource: 'departments',\n displayField: 'name',\n valueField: 'id',\n },\n },\n },\n },\n ],\n columns: [\n { name: 'firstname' },\n { name: 'lastname' },\n { name: 'email' },\n { name: 'position' },\n { name: 'department' },\n ],\n commands: {\n create: {\n execute: async (data: any) => {\n const res = await dataService.insertOne(data);\n return { id: res };\n },\n },\n delete: {\n execute: async (id: any) => {\n return await dataService.deleteOne(id);\n },\n },\n update: {\n execute: async (data: any) => {\n return await dataService.updateOne(data.id, data);\n },\n },\n },\n queries: {\n byKey: {\n execute: async (id: string) => {\n return await dataService.getOne(id);\n },\n type: AXPEntityQueryType.Single,\n },\n list: {\n execute: async (e: any) => {\n return await dataService.query({ skip: e.skip, take: e.take, filter: e.filter, sort: e.sort });\n },\n type: AXPEntityQueryType.List,\n },\n },\n interfaces: {\n master: {\n create: {\n sections: [\n {\n id: 'personal',\n },\n {\n id: 'job',\n },\n ],\n properties: [\n {\n name: 'firstname',\n layout: {\n positions: {\n lg: {\n colSpan: 12,\n },\n },\n },\n },\n {\n name: 'lastname',\n layout: {\n positions: {\n lg: {\n colSpan: 12,\n },\n },\n },\n },\n {\n name: 'email',\n layout: {\n positions: {\n lg: {\n colSpan: 12,\n },\n },\n },\n },\n ],\n },\n update: {\n sections: [\n {\n id: 'personal',\n },\n {\n id: 'job',\n },\n ],\n properties: [\n {\n name: 'firstname',\n layout: {\n positions: {\n lg: {\n colSpan: 12,\n },\n },\n },\n },\n {\n name: 'lastname',\n layout: {\n positions: {\n lg: {\n colSpan: 12,\n },\n },\n },\n },\n {\n name: 'email',\n layout: {\n positions: {\n lg: {\n colSpan: 12,\n },\n },\n },\n },\n ],\n },\n single: {\n title: '{{firstname}} {{lastname}}',\n sections: [\n {\n id: 'personal',\n layout: {\n positions: {\n lg: {\n colSpan: 12,\n },\n },\n },\n },\n ],\n properties: [\n {\n name: 'firstname',\n layout: {\n positions: {\n lg: {\n colSpan: 12,\n },\n },\n },\n },\n {\n name: 'lastname',\n layout: {\n positions: {\n lg: {\n colSpan: 12,\n },\n },\n },\n },\n ],\n actions: [],\n },\n list: {\n actions: [\n {\n title: `t(\"create\", { scope: \"common\" })`,\n command: 'create-entity',\n priority: 'primary',\n type: 'create',\n scope: AXPEntityCommandScope.TypeLevel,\n },\n {\n title: 't(\"deleteItems\", { scope: \"common\" })',\n command: 'delete-entity',\n priority: 'primary',\n type: 'delete',\n scope: AXPEntityCommandScope.Selected,\n },\n {\n title: 't(\"detail\", { scope: \"common\" })',\n command: 'open-entity',\n priority: 'secondary',\n type: 'view',\n scope: AXPEntityCommandScope.Individual,\n },\n {\n title: 't(\"delete\", { scope: \"common\" })',\n command: 'delete-entity',\n priority: 'secondary',\n type: 'delete',\n scope: AXPEntityCommandScope.Individual,\n },\n ],\n views: [\n {\n name: 'all',\n title: 't(\"allItem\", { scope: \"common\" })',\n fixed: true,\n columns: ['firstname', 'lastname', 'email', 'position', 'department'],\n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AE,QAAQ;4BACd,KAAK,EAAE,qBAAqB,CAAC,QAAQ;AACtC,yBAAA;AACD,wBAAA;AACE,4BAAA,KAAK,EAAE,kCAAkC;AACzC,4BAAA,OAAO,EAAE,aAAa;AACtB,4BAAA,QAAQ,EAAE,WAAW;AACrB,4BAAA,IAAI,EAAE,MAAM;4BACZ,KAAK,EAAE,qBAAqB,CAAC,UAAU;AACxC,yBAAA;AACD,wBAAA;AACE,4BAAA,KAAK,EAAE,kCAAkC;AACzC,4BAAA,OAAO,EAAE,eAAe;AACxB,4BAAA,QAAQ,EAAE,WAAW;AACrB,4BAAA,IAAI,EAAE,QAAQ;4BACd,KAAK,EAAE,qBAAqB,CAAC,UAAU;AACxC,yBAAA;AACF,qBAAA;AACD,oBAAA,KAAK,EAAE;AACL,wBAAA;AACE,4BAAA,IAAI,EAAE,KAAK;AACX,4BAAA,KAAK,EAAE,mCAAmC;AAC1C,4BAAA,KAAK,EAAE,IAAI;4BACX,OAAO,EAAE,CAAC,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,YAAY,CAAC;AACrE,4BAAA,UAAU,EAAE,EAAE;AACd,4BAAA,KAAK,EAAE,EAAE;AACV,yBAAA;AACF,qBAAA;AACF,iBAAA;AACF,aAAA;AACF,SAAA;KACF;AAED,IAAA,OAAO,SAAS;AAClB;;;;"}
@@ -0,0 +1,92 @@
1
+ import * as i3 from '@acorex/components/button';
2
+ import { AXButtonModule } from '@acorex/components/button';
3
+ import * as i5 from '@acorex/components/decorators';
4
+ import { AXDecoratorModule } from '@acorex/components/decorators';
5
+ import { AXDropdownButtonModule } from '@acorex/components/dropdown-button';
6
+ import * as i5$1 from '@acorex/components/loading';
7
+ import { AXLoadingModule } from '@acorex/components/loading';
8
+ import { AXMenuModule } from '@acorex/components/menu';
9
+ import * as i4 from '@acorex/core/translation';
10
+ import { AXTranslationModule } from '@acorex/core/translation';
11
+ import { AXPSimplePageLayout } from '@acorex/platform/themes/default';
12
+ import { AXPLayoutThemeService, AXPThemeLayoutBlockComponent, AXPThemeLayoutHeaderTemplateComponent, AXPThemeLayoutActionsComponent, AXPThemeLayoutPageSecondaryActionsComponent, AXPThemeLayoutPagePrimaryActionsComponent } from '@acorex/platform/themes/shared';
13
+ import * as i1 from '@angular/common';
14
+ import { CommonModule } from '@angular/common';
15
+ import * as i0 from '@angular/core';
16
+ import { inject, signal, Component, ChangeDetectionStrategy } from '@angular/core';
17
+ import { RouterModule } from '@angular/router';
18
+ import { RootConfig } from './acorex-modules-organization-managment.mjs';
19
+ import { AXCheckBoxModule } from '@acorex/components/check-box';
20
+ import { FormsModule } from '@angular/forms';
21
+ import * as i6 from '@acorex/components/breadcrumbs';
22
+ import { AXBreadcrumbsModule } from '@acorex/components/breadcrumbs';
23
+ import * as i7 from '@acorex/components/alert';
24
+ import { AXAlertModule } from '@acorex/components/alert';
25
+ import { A as AXMOrgChartConfigService } from './acorex-modules-organization-managment-org-chart-configuration.service-D-LkPUIw.mjs';
26
+
27
+ class AXMOrgChartConfigurationPage {
28
+ constructor() {
29
+ this.layout = inject(AXPLayoutThemeService);
30
+ this.chartService = inject(AXMOrgChartConfigService);
31
+ this.loadingStates = signal({});
32
+ this.rootConfig = RootConfig;
33
+ }
34
+ async ngOnInit() {
35
+ await this.chartService.load();
36
+ }
37
+ async togglePermission(parent, child) {
38
+ //TODO: Check the async and loading
39
+ // Set the loading state for this cell to true.
40
+ this.loadingStates.update((states) => {
41
+ if (!states[parent]) {
42
+ states[parent] = {};
43
+ }
44
+ states[parent][child] = true;
45
+ return states;
46
+ });
47
+ this.chartService.set(parent, child, !this.chartService.get(parent, child));
48
+ await this.chartService.update();
49
+ // Turn off the loading state.
50
+ this.loadingStates.update((states) => {
51
+ if (!states[parent]) {
52
+ states[parent] = {};
53
+ }
54
+ states[parent][child] = false;
55
+ return states;
56
+ });
57
+ }
58
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMOrgChartConfigurationPage, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
59
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: AXMOrgChartConfigurationPage, isStandalone: true, selector: "ng-component", providers: [AXMOrgChartConfigService], ngImport: i0, template: "<axp-layout-simple-page *translate=\"let t\">\n <axp-layout-header>\n <axp-layout-title> {{t(rootConfig.entities.structure.title) | async}} </axp-layout-title>\n\n <axp-layout-description>Customize your organization's hierarchical relationships</axp-layout-description>\n\n <axp-layout-actions>\n <axp-layout-actions-primary> </axp-layout-actions-primary>\n <axp-layout-actions-secondary>\n <ax-button-item [text]=\"(t('reset') | async)!\">\n <ax-prefix>\n <ax-icon [icon]=\"'fa-solid fa-print'\"> </ax-icon>\n </ax-prefix>\n </ax-button-item>\n </axp-layout-actions-secondary>\n </axp-layout-actions>\n\n\n <axp-layout-breadcrumbs>\n <ax-breadcrumbs [class.ax-hidden]=\"layout.isSmall()\">\n <ng-template #divider>\n <i class=\"fa-regular fa-slash-forward\"></i>\n </ng-template>\n <ax-breadcrumbs-item>\n Home\n </ax-breadcrumbs-item>\n <ax-breadcrumbs-item>\n Organization\n </ax-breadcrumbs-item>\n </ax-breadcrumbs>\n </axp-layout-breadcrumbs>\n </axp-layout-header>\n\n <axp-layout-content>\n <div class=\"ax-flex ax-flex-col ax-gap-6 ax-w-full 2xl:ax-w-3/4 3xl:ax-w-1/2\">\n <div>\n <h3 class=\"ax-font-semibold ax-text-xl\">Relations Permissions</h3>\n <p class=\"ax-text-sm ax-opacity-85\">\n This matrix sets the relationships between nodes in your organization chart. Click a cell to toggle the\n relation between <span class=\"ax-text-danger-500\">Allowed</span> and <span\n class=\"ax-text-success-500\">Denied</span>.\n </p>\n </div>\n <div class=\"ax-rounded-md ax-overflow-hidden ax-w-full\">\n <table class=\" ax-table-auto ax-border-collapse ax-w-full ax-border-primary-darkest ax-rounded-md\">\n <thead>\n <tr class=\"ax-bg-primary-light ax-text-on-primary-light\">\n <!-- Top-left empty cell -->\n <th class=\"ax-border ax-border-primary-darkest ax-p-4 ax-min-w-44 ax-font-semibold ax-text-start\">Parent\n \\\n Child</th>\n <!-- Horizontal headers -->\n @for ( type of chartService.types; track $index) {\n <th class=\"ax-border ax-border-primary-darkest ax-p-4 ax-min-w-44 ax-text-center ax-font-semibold\">\n {{ type }}\n </th>\n }\n </tr>\n </thead>\n <tbody>\n <!-- For each parent type, render a row with alternating backgrounds -->\n @for ( parent of chartService.types; track $index) {\n <tr>\n <!-- Vertical header cell with custom header colors -->\n <td\n class=\"ax-border ax-border-primary-darkest ax-p-4 ax-font-semibold ax-bg-primary-light ax-text-on-primary-light ax-text-start\">\n {{ parent }}\n </td>\n <!-- Render a cell for each potential child type -->\n @for ( child of chartService.types; track $index) {\n <td class=\"ax-border ax-border-primary-darkest ax-p-2 \">\n <div class=\"ax-flex ax-justify-center ax-cursor-pointer ax-sm\">\n @let isLoading = loadingStates()[parent]?.[child];\n <ax-button look=\"twotone\" [color]=\"chartService.isAllowed(parent, child) ? 'success' : 'danger'\"\n [text]=\"chartService.isAllowed(parent, child) ? 'Allowed' : 'Denied'\" [disabled]=\"isLoading\"\n (onClick)=\"togglePermission(parent, child)\">\n @if(isLoading)\n {\n <ax-loading></ax-loading>\n }\n </ax-button>\n </div>\n </td>\n }\n </tr>\n }\n </tbody>\n </table>\n </div>\n <div>\n <ax-alert [color]=\"'warning'\">\n <ax-icon></ax-icon>\n <ax-title>Attention</ax-title>\n <ax-content>\n Changes made here will not update your current organization chart. They will only affect future charts or\n updates.\n </ax-content>\n </ax-alert>\n </div>\n </div>\n\n </axp-layout-content>\n</axp-layout-simple-page>", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "ngmodule", type: RouterModule }, { kind: "ngmodule", type: FormsModule }, { kind: "component", type:
60
+ //
61
+ AXPSimplePageLayout, selector: "axp-layout-simple-page" }, { kind: "component", type: AXPThemeLayoutBlockComponent, selector: " axp-layout-content, axp-layout-header-container, axp-layout-footer-container, axp-layout-side-container, axp-layout-sections, axp-layout-section-container, axp-layout-body, axp-layout-prefix, axp-layout-suffix, axp-layout-title, axp-layout-nav-button, axp-layout-description, axp-layout-toolbar, axp-layout-title-bar, axp-layout-breadcrumbs, axp-layout-list-action, " }, { kind: "component", type: AXPThemeLayoutHeaderTemplateComponent, selector: "axp-layout-header" }, { kind: "component", type: AXPThemeLayoutActionsComponent, selector: "axp-layout-actions" }, { kind: "component", type: AXPThemeLayoutPageSecondaryActionsComponent, selector: "axp-layout-actions-secondary" }, { kind: "component", type: AXPThemeLayoutPagePrimaryActionsComponent, selector: "axp-layout-actions-primary" }, { kind: "ngmodule", type:
62
+ //
63
+ AXMenuModule }, { kind: "ngmodule", type: AXButtonModule }, { kind: "component", type: i3.AXButtonComponent, selector: "ax-button", inputs: ["disabled", "size", "tabIndex", "color", "look", "text", "toggleable", "selected", "type", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "loadingTextChange"] }, { kind: "component", type: i3.AXButtonItemComponent, selector: "ax-button-item", inputs: ["color", "disabled", "text", "selected", "divided", "data", "name"], outputs: ["onClick", "onFocus", "onBlur", "disabledChange"] }, { kind: "ngmodule", type: AXDropdownButtonModule }, { kind: "ngmodule", type: AXTranslationModule }, { kind: "directive", type: i4.AXTranslatorDirective, selector: "[translate]" }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: i5.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "component", type: i5.AXDecoratorGenericComponent, selector: "ax-footer, ax-header, ax-content, ax-divider, ax-form-hint, ax-prefix, ax-suffix, ax-text, ax-title, ax-subtitle, ax-placeholder, ax-overlay" }, { kind: "ngmodule", type: AXLoadingModule }, { kind: "component", type: i5$1.AXLoadingComponent, selector: "ax-loading", inputs: ["visible", "type", "context"], outputs: ["visibleChange"] }, { kind: "ngmodule", type: AXCheckBoxModule }, { kind: "ngmodule", type: AXBreadcrumbsModule }, { kind: "component", type: i6.AXBreadCrumbsComponent, selector: "ax-breadcrumbs" }, { kind: "component", type: i6.AXBreadCrumbsItemComponent, selector: "ax-breadcrumbs-item", inputs: ["disabled", "active"] }, { kind: "ngmodule", type: AXAlertModule }, { kind: "component", type: i7.AXAlertComponent, selector: "ax-alert", inputs: ["color", "timeOut"], outputs: ["colorChange", "onClosed", "timeOutChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
64
+ }
65
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMOrgChartConfigurationPage, decorators: [{
66
+ type: Component,
67
+ args: [{ imports: [
68
+ CommonModule,
69
+ RouterModule,
70
+ FormsModule,
71
+ //
72
+ AXPSimplePageLayout,
73
+ AXPThemeLayoutBlockComponent,
74
+ AXPThemeLayoutHeaderTemplateComponent,
75
+ AXPThemeLayoutActionsComponent,
76
+ AXPThemeLayoutPageSecondaryActionsComponent,
77
+ AXPThemeLayoutPagePrimaryActionsComponent,
78
+ //
79
+ AXMenuModule,
80
+ AXButtonModule,
81
+ AXDropdownButtonModule,
82
+ AXTranslationModule,
83
+ AXDecoratorModule,
84
+ AXLoadingModule,
85
+ AXCheckBoxModule,
86
+ AXBreadcrumbsModule,
87
+ AXAlertModule
88
+ ], changeDetection: ChangeDetectionStrategy.OnPush, providers: [AXMOrgChartConfigService], template: "<axp-layout-simple-page *translate=\"let t\">\n <axp-layout-header>\n <axp-layout-title> {{t(rootConfig.entities.structure.title) | async}} </axp-layout-title>\n\n <axp-layout-description>Customize your organization's hierarchical relationships</axp-layout-description>\n\n <axp-layout-actions>\n <axp-layout-actions-primary> </axp-layout-actions-primary>\n <axp-layout-actions-secondary>\n <ax-button-item [text]=\"(t('reset') | async)!\">\n <ax-prefix>\n <ax-icon [icon]=\"'fa-solid fa-print'\"> </ax-icon>\n </ax-prefix>\n </ax-button-item>\n </axp-layout-actions-secondary>\n </axp-layout-actions>\n\n\n <axp-layout-breadcrumbs>\n <ax-breadcrumbs [class.ax-hidden]=\"layout.isSmall()\">\n <ng-template #divider>\n <i class=\"fa-regular fa-slash-forward\"></i>\n </ng-template>\n <ax-breadcrumbs-item>\n Home\n </ax-breadcrumbs-item>\n <ax-breadcrumbs-item>\n Organization\n </ax-breadcrumbs-item>\n </ax-breadcrumbs>\n </axp-layout-breadcrumbs>\n </axp-layout-header>\n\n <axp-layout-content>\n <div class=\"ax-flex ax-flex-col ax-gap-6 ax-w-full 2xl:ax-w-3/4 3xl:ax-w-1/2\">\n <div>\n <h3 class=\"ax-font-semibold ax-text-xl\">Relations Permissions</h3>\n <p class=\"ax-text-sm ax-opacity-85\">\n This matrix sets the relationships between nodes in your organization chart. Click a cell to toggle the\n relation between <span class=\"ax-text-danger-500\">Allowed</span> and <span\n class=\"ax-text-success-500\">Denied</span>.\n </p>\n </div>\n <div class=\"ax-rounded-md ax-overflow-hidden ax-w-full\">\n <table class=\" ax-table-auto ax-border-collapse ax-w-full ax-border-primary-darkest ax-rounded-md\">\n <thead>\n <tr class=\"ax-bg-primary-light ax-text-on-primary-light\">\n <!-- Top-left empty cell -->\n <th class=\"ax-border ax-border-primary-darkest ax-p-4 ax-min-w-44 ax-font-semibold ax-text-start\">Parent\n \\\n Child</th>\n <!-- Horizontal headers -->\n @for ( type of chartService.types; track $index) {\n <th class=\"ax-border ax-border-primary-darkest ax-p-4 ax-min-w-44 ax-text-center ax-font-semibold\">\n {{ type }}\n </th>\n }\n </tr>\n </thead>\n <tbody>\n <!-- For each parent type, render a row with alternating backgrounds -->\n @for ( parent of chartService.types; track $index) {\n <tr>\n <!-- Vertical header cell with custom header colors -->\n <td\n class=\"ax-border ax-border-primary-darkest ax-p-4 ax-font-semibold ax-bg-primary-light ax-text-on-primary-light ax-text-start\">\n {{ parent }}\n </td>\n <!-- Render a cell for each potential child type -->\n @for ( child of chartService.types; track $index) {\n <td class=\"ax-border ax-border-primary-darkest ax-p-2 \">\n <div class=\"ax-flex ax-justify-center ax-cursor-pointer ax-sm\">\n @let isLoading = loadingStates()[parent]?.[child];\n <ax-button look=\"twotone\" [color]=\"chartService.isAllowed(parent, child) ? 'success' : 'danger'\"\n [text]=\"chartService.isAllowed(parent, child) ? 'Allowed' : 'Denied'\" [disabled]=\"isLoading\"\n (onClick)=\"togglePermission(parent, child)\">\n @if(isLoading)\n {\n <ax-loading></ax-loading>\n }\n </ax-button>\n </div>\n </td>\n }\n </tr>\n }\n </tbody>\n </table>\n </div>\n <div>\n <ax-alert [color]=\"'warning'\">\n <ax-icon></ax-icon>\n <ax-title>Attention</ax-title>\n <ax-content>\n Changes made here will not update your current organization chart. They will only affect future charts or\n updates.\n </ax-content>\n </ax-alert>\n </div>\n </div>\n\n </axp-layout-content>\n</axp-layout-simple-page>" }]
89
+ }] });
90
+
91
+ export { AXMOrgChartConfigurationPage };
92
+ //# sourceMappingURL=acorex-modules-organization-managment-org-chart-configuration.page-DEFgztyn.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-modules-organization-managment-org-chart-configuration.page-DEFgztyn.mjs","sources":["../../../../libs/modules/organization-managment/src/lib/features/organization-chart/org-chart-configuration.page.ts","../../../../libs/modules/organization-managment/src/lib/features/organization-chart/org-chart-configuration.page.html"],"sourcesContent":["import { AXButtonModule } from '@acorex/components/button';\nimport { AXDecoratorModule } from '@acorex/components/decorators';\nimport { AXDropdownButtonModule } from '@acorex/components/dropdown-button';\nimport { AXLoadingModule } from '@acorex/components/loading';\nimport { AXMenuModule } from '@acorex/components/menu';\nimport { AXTranslationModule } from '@acorex/core/translation';\nimport { AXPSimplePageLayout } from '@acorex/platform/themes/default';\nimport {\n AXPLayoutThemeService,\n AXPThemeLayoutActionsComponent,\n AXPThemeLayoutBlockComponent,\n AXPThemeLayoutHeaderTemplateComponent,\n AXPThemeLayoutPagePrimaryActionsComponent,\n AXPThemeLayoutPageSecondaryActionsComponent,\n} from '@acorex/platform/themes/shared';\nimport { CommonModule } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n inject,\n signal,\n} from '@angular/core';\nimport { RouterModule } from '@angular/router';\nimport { RootConfig } from '../../const';\nimport { AXCheckBoxModule } from '@acorex/components/check-box';\nimport { FormsModule } from '@angular/forms';\nimport { AXBreadcrumbsModule } from '@acorex/components/breadcrumbs';\nimport { AXAlertModule } from '@acorex/components/alert';\nimport { AXMOrgChartConfigService } from './org-chart-configuration.service';\n\n@Component({\n templateUrl: './org-chart-configuration.page.html',\n imports: [\n CommonModule,\n RouterModule,\n FormsModule,\n //\n AXPSimplePageLayout,\n AXPThemeLayoutBlockComponent,\n AXPThemeLayoutHeaderTemplateComponent,\n AXPThemeLayoutActionsComponent,\n AXPThemeLayoutPageSecondaryActionsComponent,\n AXPThemeLayoutPagePrimaryActionsComponent,\n //\n AXMenuModule,\n AXButtonModule,\n AXDropdownButtonModule,\n AXTranslationModule,\n AXDecoratorModule,\n AXLoadingModule,\n AXCheckBoxModule,\n AXBreadcrumbsModule,\n AXAlertModule\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [AXMOrgChartConfigService],\n})\nexport class AXMOrgChartConfigurationPage {\n\n protected readonly layout = inject(AXPLayoutThemeService);\n protected readonly chartService = inject(AXMOrgChartConfigService);\n\n protected loadingStates = signal<{ [parent: string]: { [child: string]: boolean } | undefined }>({});\n\n protected readonly rootConfig = RootConfig;\n\n\n async ngOnInit() {\n await this.chartService.load();\n }\n\n\n protected async togglePermission(parent: string, child: string) {\n //TODO: Check the async and loading\n\n // Set the loading state for this cell to true.\n this.loadingStates.update((states) => {\n if (!states[parent]) {\n states[parent] = {};\n }\n states[parent][child] = true;\n return states;\n });\n\n\n\n this.chartService.set(parent, child, !this.chartService.get(parent, child));\n\n await this.chartService.update();\n\n // Turn off the loading state.\n this.loadingStates.update((states) => {\n if (!states[parent]) {\n states[parent] = {};\n }\n states[parent][child] = false;\n return states;\n });\n }\n\n\n}\n","<axp-layout-simple-page *translate=\"let t\">\n <axp-layout-header>\n <axp-layout-title> {{t(rootConfig.entities.structure.title) | async}} </axp-layout-title>\n\n <axp-layout-description>Customize your organization's hierarchical relationships</axp-layout-description>\n\n <axp-layout-actions>\n <axp-layout-actions-primary> </axp-layout-actions-primary>\n <axp-layout-actions-secondary>\n <ax-button-item [text]=\"(t('reset') | async)!\">\n <ax-prefix>\n <ax-icon [icon]=\"'fa-solid fa-print'\"> </ax-icon>\n </ax-prefix>\n </ax-button-item>\n </axp-layout-actions-secondary>\n </axp-layout-actions>\n\n\n <axp-layout-breadcrumbs>\n <ax-breadcrumbs [class.ax-hidden]=\"layout.isSmall()\">\n <ng-template #divider>\n <i class=\"fa-regular fa-slash-forward\"></i>\n </ng-template>\n <ax-breadcrumbs-item>\n Home\n </ax-breadcrumbs-item>\n <ax-breadcrumbs-item>\n Organization\n </ax-breadcrumbs-item>\n </ax-breadcrumbs>\n </axp-layout-breadcrumbs>\n </axp-layout-header>\n\n <axp-layout-content>\n <div class=\"ax-flex ax-flex-col ax-gap-6 ax-w-full 2xl:ax-w-3/4 3xl:ax-w-1/2\">\n <div>\n <h3 class=\"ax-font-semibold ax-text-xl\">Relations Permissions</h3>\n <p class=\"ax-text-sm ax-opacity-85\">\n This matrix sets the relationships between nodes in your organization chart. Click a cell to toggle the\n relation between <span class=\"ax-text-danger-500\">Allowed</span> and <span\n class=\"ax-text-success-500\">Denied</span>.\n </p>\n </div>\n <div class=\"ax-rounded-md ax-overflow-hidden ax-w-full\">\n <table class=\" ax-table-auto ax-border-collapse ax-w-full ax-border-primary-darkest ax-rounded-md\">\n <thead>\n <tr class=\"ax-bg-primary-light ax-text-on-primary-light\">\n <!-- Top-left empty cell -->\n <th class=\"ax-border ax-border-primary-darkest ax-p-4 ax-min-w-44 ax-font-semibold ax-text-start\">Parent\n \\\n Child</th>\n <!-- Horizontal headers -->\n @for ( type of chartService.types; track $index) {\n <th class=\"ax-border ax-border-primary-darkest ax-p-4 ax-min-w-44 ax-text-center ax-font-semibold\">\n {{ type }}\n </th>\n }\n </tr>\n </thead>\n <tbody>\n <!-- For each parent type, render a row with alternating backgrounds -->\n @for ( parent of chartService.types; track $index) {\n <tr>\n <!-- Vertical header cell with custom header colors -->\n <td\n class=\"ax-border ax-border-primary-darkest ax-p-4 ax-font-semibold ax-bg-primary-light ax-text-on-primary-light ax-text-start\">\n {{ parent }}\n </td>\n <!-- Render a cell for each potential child type -->\n @for ( child of chartService.types; track $index) {\n <td class=\"ax-border ax-border-primary-darkest ax-p-2 \">\n <div class=\"ax-flex ax-justify-center ax-cursor-pointer ax-sm\">\n @let isLoading = loadingStates()[parent]?.[child];\n <ax-button look=\"twotone\" [color]=\"chartService.isAllowed(parent, child) ? 'success' : 'danger'\"\n [text]=\"chartService.isAllowed(parent, child) ? 'Allowed' : 'Denied'\" [disabled]=\"isLoading\"\n (onClick)=\"togglePermission(parent, child)\">\n @if(isLoading)\n {\n <ax-loading></ax-loading>\n }\n </ax-button>\n </div>\n </td>\n }\n </tr>\n }\n </tbody>\n </table>\n </div>\n <div>\n <ax-alert [color]=\"'warning'\">\n <ax-icon></ax-icon>\n <ax-title>Attention</ax-title>\n <ax-content>\n Changes made here will not update your current organization chart. They will only affect future charts or\n updates.\n </ax-content>\n </ax-alert>\n </div>\n </div>\n\n </axp-layout-content>\n</axp-layout-simple-page>"],"names":["i2","i3","i4","i5"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;MAyDa,4BAA4B,CAAA;AA3BzC,IAAA,WAAA,GAAA;AA6BqB,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACtC,QAAA,IAAA,CAAA,YAAY,GAAG,MAAM,CAAC,wBAAwB,CAAC;AAExD,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAiE,EAAE,CAAC;QAEjF,IAAU,CAAA,UAAA,GAAG,UAAU;AAqC3C;AAlCC,IAAA,MAAM,QAAQ,GAAA;AACZ,QAAA,MAAM,IAAI,CAAC,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EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA,CAAA;;2FAKJ,4BAA4B,EAAA,UAAA,EAAA,CAAA;kBA3BxC,SAAS;AAEC,YAAA,IAAA,EAAA,CAAA,EAAA,OAAA,EAAA;wBACP,YAAY;wBACZ,YAAY;wBACZ,WAAW;;wBAEX,mBAAmB;wBACnB,4BAA4B;wBAC5B,qCAAqC;wBACrC,8BAA8B;wBAC9B,2CAA2C;wBAC3C,yCAAyC;;wBAEzC,YAAY;wBACZ,cAAc;wBACd,sBAAsB;wBACtB,mBAAmB;wBACnB,iBAAiB;wBACjB,eAAe;wBACf,gBAAgB;wBAChB,mBAAmB;wBACnB;AACD,qBAAA,EAAA,eAAA,EACgB,uBAAuB,CAAC,MAAM,EACpC,SAAA,EAAA,CAAC,wBAAwB,CAAC,EAAA,QAAA,EAAA,0wIAAA,EAAA;;;;;"}
@@ -0,0 +1,145 @@
1
+ import * as i0 from '@angular/core';
2
+ import { inject, signal, Injectable } from '@angular/core';
3
+ import { AXPSettingService, AXPSettingScope } from '@acorex/platform/common';
4
+ import { A as AXPOrganizationSetting } from './acorex-modules-organization-managment-setting.keys-CF6Giykz.mjs';
5
+
6
+ class AXMOrgChartConfigService {
7
+ constructor() {
8
+ this.settingService = inject(AXPSettingService);
9
+ //
10
+ this._types = ['Company', 'Location', 'BusinessUnit', 'Role', 'Employee'];
11
+ this._defaultPermissioEncoded = '0111001110001100001100001';
12
+ this.permissions = signal(this.defaultPermissions());
13
+ }
14
+ get types() {
15
+ return this._types;
16
+ }
17
+ defaultPermissions() {
18
+ return this.decode(this._defaultPermissioEncoded);
19
+ }
20
+ encode(permissions) {
21
+ let str = '';
22
+ for (const parent of this.types) {
23
+ for (const child of this.types) {
24
+ str += (permissions[parent]?.[child] ?? 0).toString();
25
+ }
26
+ }
27
+ return str;
28
+ }
29
+ decode(encoded) {
30
+ const result = {};
31
+ const expectedLength = this.types.length * this.types.length;
32
+ if (encoded.length !== expectedLength) {
33
+ throw new Error(`Invalid permissions string length. Expected ${expectedLength} but got ${encoded.length}`);
34
+ }
35
+ let index = 0;
36
+ for (const parent of this.types) {
37
+ result[parent] = {};
38
+ for (const child of this.types) {
39
+ const char = encoded.charAt(index);
40
+ result[parent][child] = parseInt(char, 10);
41
+ index++;
42
+ }
43
+ }
44
+ return result;
45
+ }
46
+ decodeMatrix(matrix) {
47
+ const newPermissions = {};
48
+ this.types.forEach((parent, rowIndex) => {
49
+ newPermissions[parent] = {};
50
+ this.types.forEach((child, colIndex) => {
51
+ newPermissions[parent][child] = matrix[rowIndex][colIndex];
52
+ });
53
+ });
54
+ return newPermissions;
55
+ }
56
+ validateEncodedValue(storedValue) {
57
+ try {
58
+ if (typeof storedValue === 'string') {
59
+ const expectedLength = this.types.length * this.types.length;
60
+ // Check that the string is the correct length and only contains 0s and 1s.
61
+ if (storedValue.length === expectedLength && /^[01]+$/.test(storedValue)) {
62
+ return this.decode(storedValue);
63
+ }
64
+ }
65
+ else if (Array.isArray(storedValue)) {
66
+ // Validate the 2D array dimensions and values.
67
+ if (storedValue.length === this.types.length &&
68
+ storedValue.every(row => Array.isArray(row) &&
69
+ row.length === this.types.length &&
70
+ row.every(val => val === 0 || val === 1))) {
71
+ return this.decodeMatrix(storedValue);
72
+ }
73
+ }
74
+ else if (typeof storedValue === 'object' && storedValue !== null) {
75
+ // Validate that the object has all the required keys and that their values are 0 or 1.
76
+ let valid = true;
77
+ for (const parent of this.types) {
78
+ if (!(parent in storedValue)) {
79
+ valid = false;
80
+ break;
81
+ }
82
+ const childPermissions = storedValue[parent];
83
+ for (const child of this.types) {
84
+ if (!(child in childPermissions) || (childPermissions[child] !== 0 && childPermissions[child] !== 1)) {
85
+ valid = false;
86
+ break;
87
+ }
88
+ }
89
+ if (!valid)
90
+ break;
91
+ }
92
+ if (valid) {
93
+ return storedValue;
94
+ }
95
+ }
96
+ }
97
+ catch (error) {
98
+ // In case of any errors during validation, fall back to default permissions.
99
+ }
100
+ // Return the default permissions if validation fails.
101
+ return this.defaultPermissions();
102
+ }
103
+ isAllowed(parent, child) {
104
+ return (this.permissions()[parent]?.[child] ?? 0) === 1;
105
+ }
106
+ set(parent, child, value) {
107
+ this.permissions.update((p) => {
108
+ if (!p[parent]) {
109
+ p[parent] = {};
110
+ }
111
+ p[parent][child] = value ? 1 : 0;
112
+ return p;
113
+ });
114
+ }
115
+ get(parent, child) {
116
+ return this.permissions()[parent]?.[child] === 1;
117
+ }
118
+ async load() {
119
+ const storedValue = await this.settingService
120
+ .scope(AXPSettingScope.Tenant)
121
+ .get(AXPOrganizationSetting.Relations);
122
+ // Use the validation method to ensure the stored value is correct.
123
+ if (storedValue) {
124
+ const validatedPermissions = this.validateEncodedValue(storedValue);
125
+ this.permissions.set(validatedPermissions);
126
+ }
127
+ else {
128
+ this.permissions.set(this.defaultPermissions());
129
+ }
130
+ }
131
+ async update() {
132
+ const matrix = this.encode(this.permissions());
133
+ await this.settingService
134
+ .scope(AXPSettingScope.Tenant)
135
+ .set(AXPOrganizationSetting.Relations, matrix);
136
+ }
137
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMOrgChartConfigService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
138
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMOrgChartConfigService }); }
139
+ }
140
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXMOrgChartConfigService, decorators: [{
141
+ type: Injectable
142
+ }] });
143
+
144
+ export { AXMOrgChartConfigService as A };
145
+ //# sourceMappingURL=acorex-modules-organization-managment-org-chart-configuration.service-D-LkPUIw.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-modules-organization-managment-org-chart-configuration.service-D-LkPUIw.mjs","sources":["../../../../libs/modules/organization-managment/src/lib/features/organization-chart/org-chart-configuration.service.ts"],"sourcesContent":["import { inject, Injectable, signal } from '@angular/core';\nimport { AXPSettingScope, AXPSettingService } from '@acorex/platform/common';\nimport { AXPOrganizationSetting } from '../../setting.keys';\n\n\n@Injectable()\nexport class AXMOrgChartConfigService {\n\n private readonly settingService = inject(AXPSettingService);\n //\n protected _types = ['Company', 'Location', 'BusinessUnit', 'Role', 'Employee'];\n\n public get types(): string[] {\n return this._types;\n }\n\n private _defaultPermissioEncoded = '0111001110001100001100001';\n\n protected permissions = signal<{ [parent: string]: { [child: string]: number } }>(this.defaultPermissions());\n\n\n private defaultPermissions() {\n return this.decode(this._defaultPermissioEncoded);\n }\n\n\n private encode(\n permissions: { [parent: string]: { [child: string]: number } }\n ): string {\n let str = '';\n for (const parent of this.types) {\n for (const child of this.types) {\n str += (permissions[parent]?.[child] ?? 0).toString();\n }\n }\n return str;\n }\n\n\n private decode(encoded: string): { [parent: string]: { [child: string]: number } } {\n const result: { [parent: string]: { [child: string]: number } } = {};\n const expectedLength = this.types.length * this.types.length;\n if (encoded.length !== expectedLength) {\n throw new Error(`Invalid permissions string length. Expected ${expectedLength} but got ${encoded.length}`);\n }\n let index = 0;\n for (const parent of this.types) {\n result[parent] = {};\n for (const child of this.types) {\n const char = encoded.charAt(index);\n result[parent][child] = parseInt(char, 10);\n index++;\n }\n }\n return result;\n }\n\n\n private decodeMatrix(matrix: number[][]): { [parent: string]: { [child: string]: number } } {\n const newPermissions: { [parent: string]: { [child: string]: number } } = {};\n this.types.forEach((parent, rowIndex) => {\n newPermissions[parent] = {};\n this.types.forEach((child, colIndex) => {\n newPermissions[parent][child] = matrix[rowIndex][colIndex];\n });\n });\n return newPermissions;\n }\n\n private validateEncodedValue(storedValue: unknown): { [parent: string]: { [child: string]: number } } {\n try {\n if (typeof storedValue === 'string') {\n const expectedLength = this.types.length * this.types.length;\n // Check that the string is the correct length and only contains 0s and 1s.\n if (storedValue.length === expectedLength && /^[01]+$/.test(storedValue)) {\n return this.decode(storedValue);\n }\n } else if (Array.isArray(storedValue)) {\n // Validate the 2D array dimensions and values.\n if (\n storedValue.length === this.types.length &&\n storedValue.every(\n row =>\n Array.isArray(row) &&\n row.length === this.types.length &&\n row.every(val => val === 0 || val === 1)\n )\n ) {\n return this.decodeMatrix(storedValue);\n }\n } else if (typeof storedValue === 'object' && storedValue !== null) {\n // Validate that the object has all the required keys and that their values are 0 or 1.\n let valid = true;\n for (const parent of this.types) {\n if (!(parent in storedValue)) {\n valid = false;\n break;\n }\n const childPermissions = (storedValue as any)[parent];\n for (const child of this.types) {\n if (!(child in childPermissions) || (childPermissions[child] !== 0 && childPermissions[child] !== 1)) {\n valid = false;\n break;\n }\n }\n if (!valid) break;\n }\n if (valid) {\n return storedValue as { [parent: string]: { [child: string]: number } };\n }\n }\n } catch (error) {\n // In case of any errors during validation, fall back to default permissions.\n }\n // Return the default permissions if validation fails.\n return this.defaultPermissions();\n }\n\n\n public isAllowed(parent: string, child: string): boolean {\n return (this.permissions()[parent]?.[child] ?? 0) === 1;\n }\n\n\n public set(parent: string, child: string, value: boolean) {\n this.permissions.update((p) => {\n if (!p[parent]) {\n p[parent] = {};\n }\n p[parent][child] = value ? 1 : 0;\n return p;\n });\n }\n\n public get(parent: string, child: string): boolean {\n return this.permissions()[parent]?.[child] === 1;\n }\n\n\n public async load() {\n const storedValue = await this.settingService\n .scope(AXPSettingScope.Tenant)\n .get(AXPOrganizationSetting.Relations);\n\n // Use the validation method to ensure the stored value is correct.\n if (storedValue) {\n const validatedPermissions = this.validateEncodedValue(storedValue);\n this.permissions.set(validatedPermissions);\n } else {\n this.permissions.set(this.defaultPermissions());\n }\n }\n\n public async update() {\n const matrix = this.encode(this.permissions());\n await this.settingService\n .scope(AXPSettingScope.Tenant)\n .set(AXPOrganizationSetting.Relations, matrix);\n }\n\n}\n"],"names":[],"mappings":";;;;;MAMa,wBAAwB,CAAA;AADrC,IAAA,WAAA,GAAA;AAGqB,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,C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