@iapps/ng-dhis2-ui 1.0.4 → 1.0.7

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 (106) hide show
  1. package/README.md +60 -3
  2. package/esm2022/iapps-ng-dhis2-ui.mjs +1 -1
  3. package/esm2022/index.mjs +1 -2
  4. package/esm2022/lib/modules/button/button.component.mjs +14 -9
  5. package/esm2022/lib/modules/button/button.module.mjs +5 -5
  6. package/esm2022/lib/modules/button/index.mjs +1 -1
  7. package/esm2022/lib/modules/header-bar/header-bar.component.mjs +5 -5
  8. package/esm2022/lib/modules/header-bar/header-bar.module.mjs +5 -5
  9. package/esm2022/lib/modules/header-bar/index.mjs +1 -1
  10. package/esm2022/lib/modules/header-bar/models/header-bar-app.model.mjs +1 -1
  11. package/esm2022/lib/modules/header-bar/models/header-bar-data.model.mjs +1 -1
  12. package/esm2022/lib/modules/header-bar/models/header-bar-notification.model.mjs +1 -1
  13. package/esm2022/lib/modules/header-bar/models/index.mjs +1 -1
  14. package/esm2022/lib/modules/header-bar/utils/apps.mjs +1 -1
  15. package/esm2022/lib/modules/header-bar/utils/debug-info/debug-info-menu-item.mjs +14 -14
  16. package/esm2022/lib/modules/header-bar/utils/debug-info/debug-info-modal.mjs +1 -1
  17. package/esm2022/lib/modules/header-bar/utils/debug-info/debug-info-table.mjs +15 -15
  18. package/esm2022/lib/modules/header-bar/utils/debug-info/use-debug-info.mjs +1 -1
  19. package/esm2022/lib/modules/header-bar/utils/header-bar-context.mjs +2 -2
  20. package/esm2022/lib/modules/header-bar/utils/header-bar.mjs +1 -1
  21. package/esm2022/lib/modules/header-bar/utils/join-path.mjs +1 -1
  22. package/esm2022/lib/modules/header-bar/utils/logo-image.mjs +24 -24
  23. package/esm2022/lib/modules/header-bar/utils/logo.mjs +1 -1
  24. package/esm2022/lib/modules/header-bar/utils/notification-icon.mjs +47 -47
  25. package/esm2022/lib/modules/header-bar/utils/notifications.mjs +10 -10
  26. package/esm2022/lib/modules/header-bar/utils/profile/use-on-doc-click.mjs +1 -1
  27. package/esm2022/lib/modules/header-bar/utils/profile-menu/index.mjs +1 -1
  28. package/esm2022/lib/modules/header-bar/utils/profile-menu/profile-header.mjs +37 -37
  29. package/esm2022/lib/modules/header-bar/utils/profile-menu/profile-menu.mjs +28 -28
  30. package/esm2022/lib/modules/header-bar/utils/profile-menu/update-notification.mjs +24 -24
  31. package/esm2022/lib/modules/header-bar/utils/profile.mjs +25 -25
  32. package/esm2022/lib/modules/header-bar/utils/title.mjs +1 -1
  33. package/esm2022/lib/modules/organisation-unit-selector/components/OrgUnitDimension.mjs +14 -10
  34. package/esm2022/lib/modules/organisation-unit-selector/components/index.mjs +1 -1
  35. package/esm2022/lib/modules/organisation-unit-selector/components/styles/OrgUnitDimension.style.mjs +1 -1
  36. package/esm2022/lib/modules/organisation-unit-selector/components/utils/index.mjs +1 -1
  37. package/esm2022/lib/modules/organisation-unit-selector/components/utils/ouIdHelper/index.mjs +2 -2
  38. package/esm2022/lib/modules/organisation-unit-selector/components/utils/ouLevelUtils/index.mjs +1 -1
  39. package/esm2022/lib/modules/organisation-unit-selector/containers/organisation-unit-selector/organisation-unit-selector.component.mjs +91 -0
  40. package/esm2022/lib/modules/organisation-unit-selector/containers/organisation-unit-selector-modal/organisation-unit-selector-modal.component-modal.mjs +114 -0
  41. package/esm2022/lib/modules/organisation-unit-selector/index.mjs +3 -2
  42. package/esm2022/lib/modules/organisation-unit-selector/models/index.mjs +1 -1
  43. package/esm2022/lib/modules/organisation-unit-selector/models/organisation-unit-config.model.mjs +1 -1
  44. package/esm2022/lib/modules/organisation-unit-selector/organisation-unit-selector.module.mjs +17 -8
  45. package/esm2022/lib/modules/period-selector/components/FixedPeriodFilter.mjs +1 -1
  46. package/esm2022/lib/modules/period-selector/components/PeriodDimension.mjs +1 -1
  47. package/esm2022/lib/modules/period-selector/components/PeriodTransfer.mjs +1 -1
  48. package/esm2022/lib/modules/period-selector/components/RelativePeriodFilter.mjs +1 -1
  49. package/esm2022/lib/modules/period-selector/components/utils/fixedPeriods.mjs +17 -17
  50. package/esm2022/lib/modules/period-selector/components/utils/index.mjs +1 -1
  51. package/esm2022/lib/modules/period-selector/components/utils/periodTypes.mjs +1 -1
  52. package/esm2022/lib/modules/period-selector/components/utils/relativePeriods.mjs +1 -1
  53. package/esm2022/lib/modules/period-selector/containers/period-selector/period-selector.component.mjs +69 -0
  54. package/esm2022/lib/modules/period-selector/containers/period-selector-modal/period-selector-modal.component.mjs +82 -0
  55. package/esm2022/lib/modules/period-selector/index.mjs +3 -2
  56. package/esm2022/lib/modules/period-selector/period-selector.module.mjs +10 -9
  57. package/esm2022/lib/modules/react-wrapper/index.mjs +1 -1
  58. package/esm2022/lib/modules/react-wrapper/react-wrapper.component.mjs +17 -17
  59. package/esm2022/lib/modules/react-wrapper/react-wrapper.module.mjs +5 -5
  60. package/esm2022/lib/shared/assets/AssignedCategoriesIcon.mjs +1 -1
  61. package/esm2022/lib/shared/assets/DimensionItemIcons/PeriodIcon.mjs +1 -1
  62. package/esm2022/lib/shared/components/TransferOption.mjs +1 -1
  63. package/esm2022/lib/shared/components/index.mjs +1 -1
  64. package/esm2022/lib/shared/index.mjs +1 -1
  65. package/esm2022/lib/shared/shared.module.mjs +5 -5
  66. package/esm2022/lib/shared/styles/DimensionSelector.style.mjs +1 -1
  67. package/esm2022/lib/shared/styles/index.mjs +1 -1
  68. package/esm2022/lib/shared/utils/axis.mjs +1 -1
  69. package/esm2022/lib/shared/utils/axisGetDimension.mjs +1 -1
  70. package/esm2022/lib/shared/utils/axisHasDimension.mjs +1 -1
  71. package/esm2022/lib/shared/utils/dimension.mjs +1 -1
  72. package/esm2022/lib/shared/utils/dimensionGetItems.mjs +1 -1
  73. package/esm2022/lib/shared/utils/dimensionIs.mjs +1 -1
  74. package/esm2022/lib/shared/utils/dimensionIsEmpty.mjs +1 -1
  75. package/esm2022/lib/shared/utils/dimensionIsValid.mjs +3 -2
  76. package/esm2022/lib/shared/utils/dimensionSelectorHelper.mjs +1 -1
  77. package/esm2022/lib/shared/utils/index.mjs +1 -1
  78. package/esm2022/lib/shared/utils/layoutGetAllAxes.mjs +1 -1
  79. package/esm2022/lib/shared/utils/layoutGetAllDimensions.mjs +1 -1
  80. package/esm2022/lib/shared/utils/layoutGetDimension.mjs +1 -1
  81. package/esm2022/lib/shared/utils/layoutReplaceDimension.mjs +1 -1
  82. package/esm2022/lib/shared/utils/list.mjs +1 -1
  83. package/esm2022/lib/shared/utils/predefinedDimensions.mjs +3 -1
  84. package/fesm2022/iapps-ng-dhis2-ui.mjs +516 -332
  85. package/fesm2022/iapps-ng-dhis2-ui.mjs.map +1 -1
  86. package/index.d.ts +0 -1
  87. package/lib/modules/button/button.component.d.ts +1 -2
  88. package/lib/modules/organisation-unit-selector/{organisation-unit-selector.component.d.ts → containers/organisation-unit-selector/organisation-unit-selector.component.d.ts} +5 -4
  89. package/lib/modules/organisation-unit-selector/containers/organisation-unit-selector-modal/organisation-unit-selector-modal.component-modal.d.ts +31 -0
  90. package/lib/modules/organisation-unit-selector/index.d.ts +2 -1
  91. package/lib/modules/organisation-unit-selector/organisation-unit-selector.module.d.ts +5 -4
  92. package/lib/modules/period-selector/{period-selector.component.d.ts → containers/period-selector/period-selector.component.d.ts} +4 -3
  93. package/lib/modules/period-selector/containers/period-selector-modal/period-selector-modal.component.d.ts +17 -0
  94. package/lib/modules/period-selector/index.d.ts +2 -1
  95. package/lib/modules/period-selector/period-selector.module.d.ts +5 -4
  96. package/lib/modules/react-wrapper/react-wrapper.component.d.ts +1 -2
  97. package/lib/shared/utils/axis.d.ts +1 -1
  98. package/lib/shared/utils/dimension.d.ts +20 -10
  99. package/lib/shared/utils/dimensionIsEmpty.d.ts +3 -1
  100. package/lib/shared/utils/dimensionIsValid.d.ts +3 -1
  101. package/lib/shared/utils/predefinedDimensions.d.ts +2 -0
  102. package/package.json +1 -2
  103. package/esm2022/lib/modules/organisation-unit-selector/organisation-unit-selector.component.mjs +0 -88
  104. package/esm2022/lib/modules/period-selector/period-selector.component.mjs +0 -66
  105. package/esm2022/lib/ng-dhis2-ui.module.mjs +0 -15
  106. package/lib/ng-dhis2-ui.module.d.ts +0 -7
@@ -1,7 +1,7 @@
1
+ import { CommonModule } from '@angular/common';
1
2
  import * as i0 from '@angular/core';
2
3
  import { NgModule, Directive, Input, ContentChild, Component, EventEmitter, Output } from '@angular/core';
3
- import { CommonModule } from '@angular/common';
4
- import { IconEdit16, spacers, colors, theme, Tooltip, Button as Button$1, IconDimensionData16, IconClock16, IconDimensionOrgUnit16, SingleSelectField, SingleSelectOption, InputField as InputField$1, TabBar, Tab, Transfer, Checkbox, OrganisationUnitTree, MultiSelect, MultiSelectOption, IconWarningFilled16 } from '@dhis2/ui';
4
+ import { IconEdit16, spacers, colors, theme, Tooltip, Button as Button$1, IconDimensionData16, IconClock16, IconDimensionOrgUnit16, SingleSelectField, SingleSelectOption, InputField as InputField$1, TabBar, Tab, Transfer, Modal as Modal$1, ModalTitle as ModalTitle$1, ModalContent as ModalContent$1, ModalActions as ModalActions$1, ButtonStrip as ButtonStrip$1, Checkbox, OrganisationUnitTree, MultiSelect, MultiSelectOption, IconWarningFilled16 } from '@dhis2/ui';
5
5
  import cx from 'classnames';
6
6
  import PropTypes from 'prop-types';
7
7
  import * as React from 'react';
@@ -28,18 +28,6 @@ import parse from 'html-react-parser';
28
28
  import { getNowInCalendar, generateFixedPeriods } from '@dhis2/multi-calendar-dates';
29
29
  import { isObject, isString } from 'lodash';
30
30
 
31
- class NgDhis2UiModule {
32
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NgDhis2UiModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
33
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: NgDhis2UiModule, imports: [CommonModule] }); }
34
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NgDhis2UiModule, imports: [CommonModule] }); }
35
- }
36
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NgDhis2UiModule, decorators: [{
37
- type: NgModule,
38
- args: [{
39
- imports: [CommonModule],
40
- }]
41
- }] });
42
-
43
31
  const TransferOption = ({ disabled, label, highlighted, selected, onClick, onDoubleClick, value, icon, active, tooltipText, dataTest, onEditClick, }) => {
44
32
  const renderContent = () => (React__default.createElement("div", { className: cx('chip', {
45
33
  highlighted,
@@ -172,11 +160,11 @@ TransferOption.propTypes = {
172
160
  const sharedComponents = [];
173
161
 
174
162
  class SharedDhis2UiModule {
175
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SharedDhis2UiModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
176
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: SharedDhis2UiModule, imports: [CommonModule] }); }
177
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SharedDhis2UiModule, imports: [CommonModule] }); }
163
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: SharedDhis2UiModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
164
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.1.1", ngImport: i0, type: SharedDhis2UiModule, imports: [CommonModule] }); }
165
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: SharedDhis2UiModule, imports: [CommonModule] }); }
178
166
  }
179
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SharedDhis2UiModule, decorators: [{
167
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: SharedDhis2UiModule, decorators: [{
180
168
  type: NgModule,
181
169
  args: [{
182
170
  imports: [CommonModule],
@@ -496,7 +484,7 @@ const LogoImage = () => {
496
484
  }
497
485
  let Logo;
498
486
  if (!error && pathExists(data)) {
499
- Logo = (React__default.createElement("img", { alt: "Headerbar Logo", src: data.customLogo.images.png }));
487
+ Logo = React__default.createElement("img", { alt: "Headerbar Logo", src: data.customLogo.images.png });
500
488
  }
501
489
  else {
502
490
  Logo = React__default.createElement(LogoIconWhite, null);
@@ -504,29 +492,29 @@ const LogoImage = () => {
504
492
  return (React__default.createElement("div", { className: "header-bar-logo" },
505
493
  Logo,
506
494
  React__default.createElement("style", { jsx: true }, `
507
- .header-bar-logo {
508
- min-width: 48px;
509
- max-width: 250px;
510
- height: 48px;
511
- display: flex;
512
- -webkit-box-pack: center;
513
- justify-content: center;
514
- -webkit-box-align: center;
515
- align-items: center;
516
- overflow: hidden;
517
- }
518
-
519
- .header-bar-logo svg {
520
- height: 25px;
521
- width: 27px;
522
- }
523
-
524
- .header-bar-logo img {
525
- max-height: 100%;
526
- min-height: auto;
527
- width: auto;
528
- }
529
- `)));
495
+ .header-bar-logo {
496
+ min-width: 48px;
497
+ max-width: 250px;
498
+ height: 48px;
499
+ display: flex;
500
+ -webkit-box-pack: center;
501
+ justify-content: center;
502
+ -webkit-box-align: center;
503
+ align-items: center;
504
+ overflow: hidden;
505
+ }
506
+
507
+ .header-bar-logo svg {
508
+ height: 25px;
509
+ width: 27px;
510
+ }
511
+
512
+ .header-bar-logo img {
513
+ max-height: 100%;
514
+ min-height: auto;
515
+ width: auto;
516
+ }
517
+ `)));
530
518
  };
531
519
 
532
520
  const Logo = ({ baseUrl }) => {
@@ -572,56 +560,56 @@ function icon(kind) {
572
560
  }
573
561
  const NotificationIcon = (params) => {
574
562
  const { count, href, kind, dataTestId } = params;
575
- const notificationClassName = "headerbar-notification-icon " + kind;
563
+ const notificationClassName = 'headerbar-notification-icon ' + kind;
576
564
  return (React__default.createElement("a", { href: href, className: notificationClassName, "data-test": dataTestId },
577
565
  icon(kind),
578
566
  count > 0 && React__default.createElement("span", { "data-test": `${dataTestId}-count` }, count),
579
567
  React__default.createElement("style", { jsx: true }, `
580
- .headerbar-notification-icon {
581
- position: relative;
582
- margin: 0;
583
- cursor: pointer;
584
- padding: 0 ${spacers$1.dp12};
585
- height: 100%;
586
- display: flex;
587
- align-items: center;
588
- }
589
- .headerbar-notification-icon:focus {
590
- outline: 2px solid white;
591
- outline-offset: -2px;
592
- }
593
- .headerbar-notification-icon:focus:not(:focus-visible) {
594
- outline: none;
595
- }
596
- .headerbar-notification-icon:hover {
597
- background: #1a557f;
598
- }
599
- .headerbar-notification-icon:active {
600
- background: #104067;
601
- }
602
- .headerbar-notification-icon span {
603
- display: flex;
604
- justify-content: center;
605
- align-items: center;
606
- z-index: 1;
607
- position: absolute;
608
- top: 3px;
609
- right: 2px;
610
- min-width: 18px;
611
- min-height: 18px;
612
- border-radius: ${spacers$1.dp12};
613
- box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1),
614
- 0 1px 2px 0 rgba(0, 0, 0, 0.06);
615
- background-color: ${theme$1.secondary500};
616
- color: ${colors$1.white};
617
- font-size: 13px;
618
- font-weight: 600;
619
- line-height: 15px;
620
- text-align: center;
621
- cursor: inherit;
622
- padding: 0 ${spacers$1.dp4};
623
- }
624
- `)));
568
+ .headerbar-notification-icon {
569
+ position: relative;
570
+ margin: 0;
571
+ cursor: pointer;
572
+ padding: 0 ${spacers$1.dp12};
573
+ height: 100%;
574
+ display: flex;
575
+ align-items: center;
576
+ }
577
+ .headerbar-notification-icon:focus {
578
+ outline: 2px solid white;
579
+ outline-offset: -2px;
580
+ }
581
+ .headerbar-notification-icon:focus:not(:focus-visible) {
582
+ outline: none;
583
+ }
584
+ .headerbar-notification-icon:hover {
585
+ background: #1a557f;
586
+ }
587
+ .headerbar-notification-icon:active {
588
+ background: #104067;
589
+ }
590
+ .headerbar-notification-icon span {
591
+ display: flex;
592
+ justify-content: center;
593
+ align-items: center;
594
+ z-index: 1;
595
+ position: absolute;
596
+ top: 3px;
597
+ right: 2px;
598
+ min-width: 18px;
599
+ min-height: 18px;
600
+ border-radius: ${spacers$1.dp12};
601
+ box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1),
602
+ 0 1px 2px 0 rgba(0, 0, 0, 0.06);
603
+ background-color: ${theme$1.secondary500};
604
+ color: ${colors$1.white};
605
+ font-size: 13px;
606
+ font-weight: 600;
607
+ line-height: 15px;
608
+ text-align: center;
609
+ cursor: inherit;
610
+ padding: 0 ${spacers$1.dp4};
611
+ }
612
+ `)));
625
613
  };
626
614
  NotificationIcon.defaultProps = {
627
615
  count: 0,
@@ -643,20 +631,20 @@ NotificationIcon.propTypes = {
643
631
  const hasAuthority = (userAuthorities, authId) => Array.isArray(userAuthorities) &&
644
632
  userAuthorities.some((userAuthId) => userAuthId === 'ALL' || userAuthId === authId);
645
633
  const Notifications = (params) => {
646
- const { interpretations, messages, userAuthorities, } = params;
634
+ const { interpretations, messages, userAuthorities } = params;
647
635
  const { baseUrl } = useConfig();
648
636
  return (React__default.createElement("div", { className: "headerbar-notifications", "data-test": "headerbar-notifications" },
649
637
  hasAuthority(userAuthorities, 'M_dhis-web-interpretation') && (React__default.createElement(NotificationIcon, { count: interpretations, href: joinPath(baseUrl, 'dhis-web-interpretation'), kind: "message", dataTestId: "headerbar-interpretations" })),
650
638
  hasAuthority(userAuthorities, 'M_dhis-web-messaging') && (React__default.createElement(NotificationIcon, { message: "email", count: messages, href: joinPath(baseUrl, 'dhis-web-messaging'), kind: "interpretation", dataTestId: "headerbar-messages" })),
651
639
  React__default.createElement("style", { jsx: true }, `
652
- .headerbar-notifications {
653
- user-select: none;
654
- display: flex;
655
- flex-direction: row;
656
- align-items: center;
657
- height: 100%;
658
- }
659
- `)));
640
+ .headerbar-notifications {
641
+ user-select: none;
642
+ display: flex;
643
+ flex-direction: row;
644
+ align-items: center;
645
+ height: 100%;
646
+ }
647
+ `)));
660
648
  };
661
649
  Notifications.propTypes = {
662
650
  interpretations: PropTypes.number,
@@ -695,20 +683,20 @@ function DebugInfoTable() {
695
683
  React__default.createElement("td", { className: "debug-info-key" }, formatDebugInfoKey(key)),
696
684
  React__default.createElement("td", null, debugInfo[key]))))),
697
685
  React__default.createElement("style", { jsx: true }, `
698
- table {
699
- white-space: pre-wrap;
700
- font-size: 14px;
701
- line-height: 1.2;
702
- color: ${colors$1.grey700};
703
- font-famile: Menlo, Courier, monospace !important;
704
- }
705
- td {
706
- padding: 3px 16px 3px 0;
707
- }
708
- .debug-info-key {
709
- font-weight: bold;
710
- }
711
- `)));
686
+ table {
687
+ white-space: pre-wrap;
688
+ font-size: 14px;
689
+ line-height: 1.2;
690
+ color: ${colors$1.grey700};
691
+ font-famile: Menlo, Courier, monospace !important;
692
+ }
693
+ td {
694
+ padding: 3px 16px 3px 0;
695
+ }
696
+ .debug-info-key {
697
+ font-weight: bold;
698
+ }
699
+ `)));
712
700
  }
713
701
 
714
702
  function DebugInfoModal(params) {
@@ -758,19 +746,19 @@ const DebugInfoMenuItem = (params) => {
758
746
  })
759
747
  : i18n.t('App version unknown')),
760
748
  React__default.createElement("style", { jsx: true }, `
761
- .root {
762
- color: ${colors$1.grey700};
763
- font-style: italic;
764
- font-size: 14px;
765
- line-height: 17px;
766
- }
767
- .instance-info {
768
- margin-bottom: 4px;
769
- }
770
- .version {
771
- white-space: no-wrap;
772
- }
773
- `)));
749
+ .root {
750
+ color: ${colors$1.grey700};
751
+ font-style: italic;
752
+ font-size: 14px;
753
+ line-height: 17px;
754
+ }
755
+ .instance-info {
756
+ margin-bottom: 4px;
757
+ }
758
+ .version {
759
+ white-space: no-wrap;
760
+ }
761
+ `)));
774
762
  return (React__default.createElement(MenuItem, { dense: true, onClick: openDebugModal, label: debugInfoLabel, dataTest: "dhis2-ui-headerbar-debuginfo" }));
775
763
  };
776
764
  DebugInfoMenuItem.propTypes = {
@@ -783,12 +771,12 @@ const ProfileName = (params) => {
783
771
  return (React__default.createElement("div", { className: "headerbar-profile-username", "data-test": "headerbar-profile-username" },
784
772
  children,
785
773
  React__default.createElement("style", { jsx: true }, `
786
- .headerbar-profile-username {
787
- margin-bottom: 3px;
788
- font-size: 16px;
789
- line-height: 19px;
790
- }
791
- `)));
774
+ .headerbar-profile-username {
775
+ margin-bottom: 3px;
776
+ font-size: 16px;
777
+ line-height: 19px;
778
+ }
779
+ `)));
792
780
  };
793
781
  ProfileName.propTypes = {
794
782
  children: PropTypes.string,
@@ -798,12 +786,12 @@ const ProfileEmail = (params) => {
798
786
  return (React__default.createElement("div", { className: "headerbar-profile-user-email", "data-test": "headerbar-profile-user-email" },
799
787
  children,
800
788
  React__default.createElement("style", { jsx: true }, `
801
- .headerbar-profile-user-email {
802
- margin-bottom: 6px;
803
- font-size: 14px;
804
- line-height: 16px;
805
- }
806
- `)));
789
+ .headerbar-profile-user-email {
790
+ margin-bottom: 6px;
791
+ font-size: 14px;
792
+ line-height: 16px;
793
+ }
794
+ `)));
807
795
  };
808
796
  ProfileEmail.propTypes = {
809
797
  children: PropTypes.string,
@@ -814,14 +802,14 @@ const ProfileEdit = (params) => {
814
802
  return (React__default.createElement("a", { className: "headerbar-profile-edit-profile-link", href: joinPath(baseUrl, 'dhis-web-user-profile/#/profile'), "data-test": "headerbar-profile-edit-profile-link" },
815
803
  children,
816
804
  React__default.createElement("style", { jsx: true }, `
817
- .headerbar-profile-edit-profile-link {
818
- color: rgba(0, 0, 0, 0.87);
819
- font-size: 12px;
820
- line-height: 14px;
821
- text-decoration: underline !important;
822
- cursor: pointer;
823
- }
824
- `)));
805
+ .headerbar-profile-edit-profile-link {
806
+ color: rgba(0, 0, 0, 0.87);
807
+ font-size: 12px;
808
+ line-height: 14px;
809
+ text-decoration: underline !important;
810
+ cursor: pointer;
811
+ }
812
+ `)));
825
813
  };
826
814
  ProfileEdit.propTypes = {
827
815
  children: PropTypes.string,
@@ -833,15 +821,15 @@ const ProfileDetails = (params) => {
833
821
  React__default.createElement(ProfileEmail, null, email),
834
822
  React__default.createElement(ProfileEdit, null, i18n.t('Edit profile')),
835
823
  React__default.createElement("style", { jsx: true }, `
836
- .headerbar-profile-details {
837
- display: flex;
838
- flex-direction: column;
839
- margin-left: 20px;
840
- color: #000;
841
- font-size: 14px;
842
- font-weight: 400;
843
- }
844
- `)));
824
+ .headerbar-profile-details {
825
+ display: flex;
826
+ flex-direction: column;
827
+ margin-left: 20px;
828
+ color: #000;
829
+ font-size: 14px;
830
+ font-weight: 400;
831
+ }
832
+ `)));
845
833
  };
846
834
  ProfileDetails.propTypes = {
847
835
  email: PropTypes.string,
@@ -853,13 +841,13 @@ const ProfileHeader = (params) => {
853
841
  React__default.createElement(UserAvatar, { avatarId: avatarId, name: name, dataTest: "headerbar-profile-menu-icon", large: true }),
854
842
  React__default.createElement(ProfileDetails, { name: name, email: email }),
855
843
  React__default.createElement("style", { jsx: true }, `
856
- .headerbar-profile-header {
857
- display: flex;
858
- flex-direction: row;
859
- margin-left: 24px;
860
- padding-top: 20px;
861
- }
862
- `)));
844
+ .headerbar-profile-header {
845
+ display: flex;
846
+ flex-direction: row;
847
+ margin-left: 24px;
848
+ padding-top: 20px;
849
+ }
850
+ `)));
863
851
  };
864
852
  ProfileHeader.propTypes = {
865
853
  avatarId: PropTypes.string,
@@ -872,7 +860,7 @@ const headerBarContext = createContext({
872
860
  onApplyAvailableUpdate: () => { },
873
861
  });
874
862
  const HeaderBarContextProvider = (params) => {
875
- const { updateAvailable, onApplyAvailableUpdate, children, } = params;
863
+ const { updateAvailable, onApplyAvailableUpdate, children } = params;
876
864
  return (React__default.createElement(headerBarContext.Provider, { value: { updateAvailable, onApplyAvailableUpdate } }, children));
877
865
  };
878
866
  HeaderBarContextProvider.propTypes = {
@@ -900,29 +888,29 @@ function UpdateNotification(params) {
900
888
  React__default.createElement("br", null),
901
889
  i18n.t('Click to reload')),
902
890
  React__default.createElement("style", { jsx: true }, `
903
- .root {
904
- display: flex;
905
- flex-direction: row;
906
- align-items: center;
907
- font-size: 14px;
908
- line-height: 17px;
909
- }
910
- .badge {
911
- display: inline-block;
912
- width: 12px;
913
- height: 12px;
914
- margin: 0 8px;
915
- border-radius: 6px;
916
- background-color: ${colors$1.blue600};
917
- }
918
- .spacer {
919
- display: inline-block;
920
- width: 8px;
921
- }
922
- .message {
923
- display: inline-block;
924
- }
925
- `)));
891
+ .root {
892
+ display: flex;
893
+ flex-direction: row;
894
+ align-items: center;
895
+ font-size: 14px;
896
+ line-height: 17px;
897
+ }
898
+ .badge {
899
+ display: inline-block;
900
+ width: 12px;
901
+ height: 12px;
902
+ margin: 0 8px;
903
+ border-radius: 6px;
904
+ background-color: ${colors$1.blue600};
905
+ }
906
+ .spacer {
907
+ display: inline-block;
908
+ width: 8px;
909
+ }
910
+ .message {
911
+ display: inline-block;
912
+ }
913
+ `)));
926
914
  return updateAvailable ? (React__default.createElement(MenuItem, { dense: true, onClick: onClick, label: updateNotificationLabel, dataTest: "dhis2-ui-headerbar-updatenotification" })) : null;
927
915
  }
928
916
  UpdateNotification.propTypes = {
@@ -960,29 +948,29 @@ const ProfileContents = (params) => {
960
948
  React__default.createElement(UpdateNotification, { hideProfileMenu: hideProfileMenu }))),
961
949
  loading && React__default.createElement(LoadingMask, null),
962
950
  React__default.createElement("style", { jsx: true }, `
963
- .headerbar-profile-contents {
964
- width: 100%;
965
- padding: 0;
966
- }
967
-
968
- .headerbar-profile-contents ul {
969
- padding: 0;
970
- margin: 0;
971
- }
972
-
973
- .headerbar-profile-contents a {
974
- display: inline-flex !important;
975
- }
976
-
977
- .headerbar-profile-contents a,
978
- .headerbar-profile-contents a:hover,
979
- .headerbar-profile-contents a:focus,
980
- .headerbar-profile-contents a:active,
981
- .headerbar-profile-contents a:visited {
982
- text-decoration: none;
983
- display: block;
984
- }
985
- `)));
951
+ .headerbar-profile-contents {
952
+ width: 100%;
953
+ padding: 0;
954
+ }
955
+
956
+ .headerbar-profile-contents ul {
957
+ padding: 0;
958
+ margin: 0;
959
+ }
960
+
961
+ .headerbar-profile-contents a {
962
+ display: inline-flex !important;
963
+ }
964
+
965
+ .headerbar-profile-contents a,
966
+ .headerbar-profile-contents a:hover,
967
+ .headerbar-profile-contents a:focus,
968
+ .headerbar-profile-contents a:active,
969
+ .headerbar-profile-contents a:visited {
970
+ text-decoration: none;
971
+ display: block;
972
+ }
973
+ `)));
986
974
  };
987
975
  ProfileContents.propTypes = {
988
976
  hideProfileMenu: PropTypes.func.isRequired,
@@ -997,13 +985,13 @@ const ProfileMenu = (params) => {
997
985
  return (React__default.createElement("div", { className: "headerbar-profile-menu", "data-test": "headerbar-profile-menu" },
998
986
  React__default.createElement(ProfileContents, { ...props }),
999
987
  React__default.createElement("style", { jsx: true }, `
1000
- .headerbar-profile-menu {
1001
- z-index: 10000;
1002
- position: absolute;
1003
- right: 4px;
1004
- width: 320px;
1005
- }
1006
- `)));
988
+ .headerbar-profile-menu {
989
+ z-index: 10000;
990
+ position: absolute;
991
+ right: 4px;
992
+ width: 320px;
993
+ }
994
+ `)));
1007
995
  };
1008
996
  ProfileMenu.propTypes = {
1009
997
  hideProfileMenu: PropTypes.func.isRequired,
@@ -1052,31 +1040,31 @@ const Profile = (params) => {
1052
1040
  setShowDebugInfoModal(false);
1053
1041
  } })),
1054
1042
  React__default.createElement("style", { jsx: true }, `
1055
- .headerbar-profile {
1056
- position: relative;
1057
- height: 100%;
1058
- }
1059
-
1060
- .headerbar-profile-btn {
1061
- background: transparent;
1062
- padding: 6px;
1063
- border: 0;
1064
- cursor: pointer;
1065
- }
1066
- .headerbar-profile-btn:focus {
1067
- outline: 2px solid white;
1068
- outline-offset: -2px;
1069
- }
1070
- .headerbar-profile-btn:focus:not(:focus-visible) {
1071
- outline: none;
1072
- }
1073
- .headerbar-profile-btn:hover {
1074
- background: #1a557f;
1075
- }
1076
- .headerbar-profile-btn:active {
1077
- background: #104067;
1078
- }
1079
- `)));
1043
+ .headerbar-profile {
1044
+ position: relative;
1045
+ height: 100%;
1046
+ }
1047
+
1048
+ .headerbar-profile-btn {
1049
+ background: transparent;
1050
+ padding: 6px;
1051
+ border: 0;
1052
+ cursor: pointer;
1053
+ }
1054
+ .headerbar-profile-btn:focus {
1055
+ outline: 2px solid white;
1056
+ outline-offset: -2px;
1057
+ }
1058
+ .headerbar-profile-btn:focus:not(:focus-visible) {
1059
+ outline: none;
1060
+ }
1061
+ .headerbar-profile-btn:hover {
1062
+ background: #1a557f;
1063
+ }
1064
+ .headerbar-profile-btn:active {
1065
+ background: #104067;
1066
+ }
1067
+ `)));
1080
1068
  };
1081
1069
  Profile.propTypes = {
1082
1070
  name: PropTypes.string.isRequired,
@@ -1163,8 +1151,7 @@ class ReactWrapperComponent {
1163
1151
  this.render();
1164
1152
  }
1165
1153
  ngOnChanges() {
1166
- if (this.elementRef)
1167
- this.render();
1154
+ // if (this.elementRef) this.render();
1168
1155
  }
1169
1156
  ngOnDestroy() {
1170
1157
  this.reactDomRoot?.unmount();
@@ -1172,27 +1159,28 @@ class ReactWrapperComponent {
1172
1159
  render() {
1173
1160
  if (!this.component) {
1174
1161
  console.warn('React component must be supplied');
1175
- return;
1176
- }
1177
- if (!this.reactDomRoot)
1178
- return;
1179
- const jsxContent = this.content?.nativeElement?.outerHTML
1180
- ? parse(this.content?.nativeElement?.outerHTML)
1181
- : undefined;
1182
- this.reactDomRoot.render(React.createElement(this.component, { ...this.props },
1183
- " ",
1184
- jsxContent || '',
1185
- " "));
1186
- }
1187
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ReactWrapperComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
1188
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: ReactWrapperComponent, selector: "ng-dhis2-ui-wrapper", inputs: { props: "props", component: "component" }, queries: [{ propertyName: "content", first: true, predicate: ["ngDhis2UiContent"], descendants: true }], usesOnChanges: true, ngImport: i0 }); }
1162
+ }
1163
+ else {
1164
+ if (!this.reactDomRoot)
1165
+ return;
1166
+ const jsxContent = this.content?.nativeElement?.outerHTML
1167
+ ? parse(this.content?.nativeElement?.outerHTML)
1168
+ : undefined;
1169
+ this.reactDomRoot.render(React.createElement(this.component, { ...this.props },
1170
+ " ",
1171
+ jsxContent || '',
1172
+ " "));
1173
+ }
1174
+ }
1175
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: ReactWrapperComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
1176
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.1.1", type: ReactWrapperComponent, selector: "ng-dhis2-ui-wrapper", inputs: { props: "props", component: "component" }, queries: [{ propertyName: "content", first: true, predicate: ["ngDhis2UiContent"], descendants: true }], usesOnChanges: true, ngImport: i0 }); }
1189
1177
  }
1190
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ReactWrapperComponent, decorators: [{
1178
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: ReactWrapperComponent, decorators: [{
1191
1179
  type: Directive,
1192
1180
  args: [{
1193
1181
  selector: 'ng-dhis2-ui-wrapper',
1194
1182
  }]
1195
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { props: [{
1183
+ }], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { props: [{
1196
1184
  type: Input
1197
1185
  }], component: [{
1198
1186
  type: Input
@@ -1202,11 +1190,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
1202
1190
  }] } });
1203
1191
 
1204
1192
  class ReactWrapperModule {
1205
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ReactWrapperModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1206
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: ReactWrapperModule, declarations: [ReactWrapperComponent], imports: [CommonModule], exports: [ReactWrapperComponent] }); }
1207
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ReactWrapperModule, imports: [CommonModule] }); }
1193
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: ReactWrapperModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1194
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.1.1", ngImport: i0, type: ReactWrapperModule, declarations: [ReactWrapperComponent], imports: [CommonModule], exports: [ReactWrapperComponent] }); }
1195
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: ReactWrapperModule, imports: [CommonModule] }); }
1208
1196
  }
1209
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ReactWrapperModule, decorators: [{
1197
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: ReactWrapperModule, decorators: [{
1210
1198
  type: NgModule,
1211
1199
  args: [{
1212
1200
  imports: [CommonModule],
@@ -1235,23 +1223,23 @@ class HeaderBarComponent extends ReactWrapperComponent {
1235
1223
  : () => React__default.createElement("div", null, "Something went wrong");
1236
1224
  this.render();
1237
1225
  }
1238
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: HeaderBarComponent, deps: [{ token: i0.ElementRef }, { token: i1.NgxDhis2HttpClientService }], target: i0.ɵɵFactoryTarget.Component }); }
1239
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: HeaderBarComponent, selector: "ng-dhis2-ui-header-bar", usesInheritance: true, ngImport: i0, template: `<ng-container></ng-container>`, isInline: true }); }
1226
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: HeaderBarComponent, deps: [{ token: i0.ElementRef }, { token: i1.NgxDhis2HttpClientService }], target: i0.ɵɵFactoryTarget.Component }); }
1227
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.1", type: HeaderBarComponent, selector: "ng-dhis2-ui-header-bar", usesInheritance: true, ngImport: i0, template: `<ng-container></ng-container>`, isInline: true }); }
1240
1228
  }
1241
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: HeaderBarComponent, decorators: [{
1229
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: HeaderBarComponent, decorators: [{
1242
1230
  type: Component,
1243
1231
  args: [{
1244
1232
  selector: 'ng-dhis2-ui-header-bar',
1245
1233
  template: `<ng-container></ng-container>`,
1246
1234
  }]
1247
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.NgxDhis2HttpClientService }]; } });
1235
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1.NgxDhis2HttpClientService }] });
1248
1236
 
1249
1237
  class HeaderBarModule {
1250
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: HeaderBarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1251
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: HeaderBarModule, declarations: [HeaderBarComponent], imports: [CommonModule, SharedDhis2UiModule], exports: [HeaderBarComponent] }); }
1252
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: HeaderBarModule, imports: [CommonModule, SharedDhis2UiModule] }); }
1238
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: HeaderBarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1239
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.1.1", ngImport: i0, type: HeaderBarModule, declarations: [HeaderBarComponent], imports: [CommonModule, SharedDhis2UiModule], exports: [HeaderBarComponent] }); }
1240
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: HeaderBarModule, imports: [CommonModule, SharedDhis2UiModule] }); }
1253
1241
  }
1254
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: HeaderBarModule, decorators: [{
1242
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: HeaderBarModule, decorators: [{
1255
1243
  type: NgModule,
1256
1244
  args: [{
1257
1245
  imports: [CommonModule, SharedDhis2UiModule],
@@ -1268,12 +1256,15 @@ class ButtonComponent extends ReactWrapperComponent {
1268
1256
  constructor() {
1269
1257
  super(...arguments);
1270
1258
  this.buttonClick = new EventEmitter();
1271
- this.props = {
1272
- onClick: (e) => {
1259
+ }
1260
+ async ngAfterViewInit() {
1261
+ if (!this.elementRef)
1262
+ throw new Error('No element ref');
1263
+ this.reactDomRoot = ReactDOM.createRoot(this.elementRef.nativeElement);
1264
+ this.component = () => (React__default.createElement(Button$1, { onClick: (e) => {
1273
1265
  this.onButtonClick(e);
1274
- },
1275
- };
1276
- this.component = Button$1;
1266
+ }, primary: this.primary, secondary: this.secondary, destructive: this.destructive, disabled: this.disabled, small: this.small, large: this.large, ...this.props }, this.label));
1267
+ this.render();
1277
1268
  }
1278
1269
  ngOnInit() {
1279
1270
  this.props = {
@@ -1288,10 +1279,10 @@ class ButtonComponent extends ReactWrapperComponent {
1288
1279
  onButtonClick(event) {
1289
1280
  this.buttonClick.emit(event);
1290
1281
  }
1291
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ButtonComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
1292
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ButtonComponent, selector: "ng-dhis2-ui-button", inputs: { label: "label", primary: "primary", secondary: "secondary", destructive: "destructive", disabled: "disabled", small: "small", large: "large" }, outputs: { buttonClick: "buttonClick" }, usesInheritance: true, ngImport: i0, template: '<ng-content></ng-content>', isInline: true }); }
1282
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: ButtonComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
1283
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.1", type: ButtonComponent, selector: "ng-dhis2-ui-button", inputs: { label: "label", primary: "primary", secondary: "secondary", destructive: "destructive", disabled: "disabled", small: "small", large: "large" }, outputs: { buttonClick: "buttonClick" }, usesInheritance: true, ngImport: i0, template: '<ng-content></ng-content>', isInline: true }); }
1293
1284
  }
1294
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ButtonComponent, decorators: [{
1285
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: ButtonComponent, decorators: [{
1295
1286
  type: Component,
1296
1287
  args: [{
1297
1288
  selector: 'ng-dhis2-ui-button',
@@ -1316,11 +1307,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
1316
1307
  }] } });
1317
1308
 
1318
1309
  class ButtonModule {
1319
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ButtonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1320
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: ButtonModule, declarations: [ButtonComponent], imports: [CommonModule, SharedDhis2UiModule], exports: [ButtonComponent] }); }
1321
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ButtonModule, imports: [CommonModule, SharedDhis2UiModule] }); }
1310
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: ButtonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1311
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.1.1", ngImport: i0, type: ButtonModule, declarations: [ButtonComponent], imports: [CommonModule, SharedDhis2UiModule], exports: [ButtonComponent] }); }
1312
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: ButtonModule, imports: [CommonModule, SharedDhis2UiModule] }); }
1322
1313
  }
1323
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ButtonModule, decorators: [{
1314
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: ButtonModule, decorators: [{
1324
1315
  type: NgModule,
1325
1316
  args: [{
1326
1317
  declarations: [ButtonComponent],
@@ -1347,6 +1338,8 @@ const AssignedCategoriesIcon = () => {
1347
1338
  const DIMENSION_ID_DATA = 'dx';
1348
1339
  const DIMENSION_ID_PERIOD = 'pe';
1349
1340
  const DIMENSION_ID_ORGUNIT = 'ou';
1341
+ const DIMENSION_ID_ORGUNIT_LEVEL = 'ouLevel';
1342
+ const DIMENSION_ID_ORGUNIT_GROUP = 'ouGroup';
1350
1343
  const DIMENSION_ID_ASSIGNED_CATEGORIES = 'co';
1351
1344
  const DIMENSION_PROP_NO_ITEMS = 'noItems';
1352
1345
  const getFixedDimensions = () => ({
@@ -1525,7 +1518,8 @@ const dimensionIsValid = (dimension, { requireItems } = {}) => {
1525
1518
  if (!requiredProps.every((prop) => prop.isValid(dimension[prop.name]))) {
1526
1519
  return false;
1527
1520
  }
1528
- if (requireItems === true && dimensionIsEmpty(dimension)) {
1521
+ if (requireItems === true &&
1522
+ dimensionIsEmpty(dimension)) {
1529
1523
  return false;
1530
1524
  }
1531
1525
  return true;
@@ -1746,23 +1740,23 @@ const getRelativePeriodIds = () => Object.values(getOptions$1())
1746
1740
  .flat();
1747
1741
 
1748
1742
  const PERIOD_TYPE_REGEX = {
1749
- [DAILY]: /^([0-9]{4})([0-9]{2})([0-9]{2})$/,
1750
- [WEEKLY]: /^([0-9]{4})()W([0-9]{1,2})$/,
1751
- [BIWEEKLY]: /^([0-9]{4})BiW([0-9]{1,2})$/,
1752
- [WEEKLYWED]: /^([0-9]{4})(Wed)W([0-9]{1,2})$/,
1753
- [WEEKLYTHU]: /^([0-9]{4})(Thu)W([0-9]{1,2})$/,
1754
- [WEEKLYSAT]: /^([0-9]{4})(Sat)W([0-9]{1,2})$/,
1755
- [WEEKLYSUN]: /^([0-9]{4})(Sun)W([0-9]{1,2})$/,
1756
- [MONTHLY]: /^([0-9]{4})([0-9]{2})$/,
1757
- [BIMONTHLY]: /^([0-9]{4})([0-9]{2})B$/,
1758
- [QUARTERLY]: /^([0-9]{4})Q([1234])$/,
1759
- [SIXMONTHLY]: /^([0-9]{4})S([12])$/,
1760
- [SIXMONTHLYAPR]: /^([0-9]{4})AprilS([12])$/,
1743
+ [DAILY]: /^([0-9]{4})([0-9]{2})([0-9]{2})$/, // YYYYMMDD
1744
+ [WEEKLY]: /^([0-9]{4})()W([0-9]{1,2})$/, // YYYY"W"[1-53]
1745
+ [BIWEEKLY]: /^([0-9]{4})BiW([0-9]{1,2})$/, // YYYY"BiW"[1-27]
1746
+ [WEEKLYWED]: /^([0-9]{4})(Wed)W([0-9]{1,2})$/, // YYYY"WedW"[1-53]
1747
+ [WEEKLYTHU]: /^([0-9]{4})(Thu)W([0-9]{1,2})$/, // YYYY"ThuW"[1-53]
1748
+ [WEEKLYSAT]: /^([0-9]{4})(Sat)W([0-9]{1,2})$/, // YYYY"SatW"[1-53]
1749
+ [WEEKLYSUN]: /^([0-9]{4})(Sun)W([0-9]{1,2})$/, // YYYY"SunW"[1-53]
1750
+ [MONTHLY]: /^([0-9]{4})([0-9]{2})$/, // YYYYMM
1751
+ [BIMONTHLY]: /^([0-9]{4})([0-9]{2})B$/, // YYYY0[1-6]"B"
1752
+ [QUARTERLY]: /^([0-9]{4})Q([1234])$/, // YYYY"Q"[1-4]
1753
+ [SIXMONTHLY]: /^([0-9]{4})S([12])$/, // YYYY"S"[1/2]
1754
+ [SIXMONTHLYAPR]: /^([0-9]{4})AprilS([12])$/, // YYYY"AprilS"[1/2]
1761
1755
  // [SIXMONTHLYNOV]: /^([0-9]{4})NovS([12])$/, // YYYY"NovS"[1/2] Not supported?
1762
- [YEARLY]: /^([0-9]{4})$/,
1763
- [FYNOV]: /^([0-9]{4})Nov$/,
1764
- [FYOCT]: /^([0-9]{4})Oct$/,
1765
- [FYJUL]: /^([0-9]{4})July$/,
1756
+ [YEARLY]: /^([0-9]{4})$/, // YYYY
1757
+ [FYNOV]: /^([0-9]{4})Nov$/, // YYYY"Nov"
1758
+ [FYOCT]: /^([0-9]{4})Oct$/, // YYYY"Oct"
1759
+ [FYJUL]: /^([0-9]{4})July$/, // YYYY"July"
1766
1760
  [FYAPR]: /^([0-9]{4})April$/, // YYYY"April"
1767
1761
  };
1768
1762
  const getPeriods = ({ periodType, config, fnFilter, periodSettings = {}, }) => {
@@ -2249,11 +2243,82 @@ PeriodDimension.defaultProps = {
2249
2243
  selectedPeriods: [],
2250
2244
  };
2251
2245
 
2252
- class PeriodSelectorComponent extends ReactWrapperComponent {
2246
+ class PeriodSelectorModalComponent extends ReactWrapperComponent {
2253
2247
  constructor(elementRef, httpClient) {
2254
2248
  super(elementRef);
2255
2249
  this.httpClient = httpClient;
2256
2250
  this.selectedPeriods = [];
2251
+ this.cancel = new EventEmitter();
2252
+ this.confirm = new EventEmitter();
2253
+ this.getExcludedPeriodTypes = (systemSettings = {}) => {
2254
+ const types = [];
2255
+ if (systemSettings['hideDailyPeriods']) {
2256
+ types.push(DAILY);
2257
+ }
2258
+ if (systemSettings['hideWeeklyPeriods']) {
2259
+ types.push(WEEKLY, WEEKLYWED, WEEKLYTHU, WEEKLYSAT, WEEKLYSUN);
2260
+ }
2261
+ if (systemSettings['hideBiWeeklyPeriods']) {
2262
+ types.push(BIWEEKLY);
2263
+ }
2264
+ if (systemSettings['hideMonthlyPeriods']) {
2265
+ types.push(MONTHLY);
2266
+ }
2267
+ if (systemSettings['hideBiMonthlyPeriods']) {
2268
+ types.push(BIMONTHLY);
2269
+ }
2270
+ return types;
2271
+ };
2272
+ }
2273
+ async ngAfterViewInit() {
2274
+ if (!this.elementRef)
2275
+ throw new Error('No element ref');
2276
+ this.reactDomRoot = ReactDOM.createRoot(this.elementRef.nativeElement);
2277
+ const systemInfo = await firstValueFrom(this.httpClient.systemInfo());
2278
+ const excludedPeriodTypes = this.getExcludedPeriodTypes(systemInfo);
2279
+ this.component = () => {
2280
+ const [selected, setSelected] = useState(this.selectedPeriods);
2281
+ return (React__default.createElement(DataProvider, null, React__default.createElement(Modal$1, { position: "middle", large: true },
2282
+ React__default.createElement(ModalTitle$1, null, "Period"),
2283
+ React__default.createElement(ModalContent$1, null,
2284
+ React__default.createElement(PeriodDimension, { selectedPeriods: selected, onSelect: (selectionEvent) => setSelected(selectionEvent.items), excludedPeriodTypes: excludedPeriodTypes, systemInfo: systemInfo })),
2285
+ React__default.createElement(ModalActions$1, null,
2286
+ React__default.createElement(ButtonStrip$1, { end: true },
2287
+ React__default.createElement(Button$1, { onClick: () => {
2288
+ this.onCancel();
2289
+ } }, "Cancel"),
2290
+ React__default.createElement(Button$1, { primary: true, disabled: selected.length === 0, onClick: () => {
2291
+ this.onConfirm(selected);
2292
+ } }, "Confirm"))))));
2293
+ };
2294
+ this.render();
2295
+ }
2296
+ onCancel() {
2297
+ this.cancel.emit();
2298
+ }
2299
+ onConfirm(selectedItems) {
2300
+ this.confirm.emit(selectedItems);
2301
+ }
2302
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: PeriodSelectorModalComponent, deps: [{ token: i0.ElementRef }, { token: i1.NgxDhis2HttpClientService }], target: i0.ɵɵFactoryTarget.Component }); }
2303
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.1", type: PeriodSelectorModalComponent, selector: "ng-dhis2-ui-period-selector-modal", inputs: { selectedPeriods: "selectedPeriods" }, outputs: { cancel: "cancel", confirm: "confirm" }, usesInheritance: true, ngImport: i0, template: `<ng-container></ng-container>`, isInline: true, styles: ["::ng-deep .layer{z-index:2!important}\n"] }); }
2304
+ }
2305
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: PeriodSelectorModalComponent, decorators: [{
2306
+ type: Component,
2307
+ args: [{ selector: 'ng-dhis2-ui-period-selector-modal', template: `<ng-container></ng-container>`, styles: ["::ng-deep .layer{z-index:2!important}\n"] }]
2308
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1.NgxDhis2HttpClientService }], propDecorators: { selectedPeriods: [{
2309
+ type: Input
2310
+ }], cancel: [{
2311
+ type: Output
2312
+ }], confirm: [{
2313
+ type: Output
2314
+ }] } });
2315
+
2316
+ class PeriodSelectorComponent extends ReactWrapperComponent {
2317
+ constructor(elementRef, httpClient, ngZone) {
2318
+ super(elementRef);
2319
+ this.httpClient = httpClient;
2320
+ this.ngZone = ngZone;
2321
+ this.selectedPeriods = [];
2257
2322
  this.selectPeriods = new EventEmitter();
2258
2323
  this.props = {
2259
2324
  onSelect: (e) => {
@@ -2286,35 +2351,37 @@ class PeriodSelectorComponent extends ReactWrapperComponent {
2286
2351
  this.reactDomRoot = ReactDOM.createRoot(this.elementRef.nativeElement);
2287
2352
  const systemInfo = await firstValueFrom(this.httpClient.systemInfo());
2288
2353
  const excludedPeriodTypes = this.getExcludedPeriodTypes(systemInfo);
2289
- this.component = () => (React__default.createElement(DataProvider, null, React__default.createElement(PeriodDimension, { selectedPeriods: this.selectedPeriods, onSelect: (selectionEvent) => this.onSelectItems(selectionEvent), excludedPeriodTypes: excludedPeriodTypes, systemInfo: systemInfo })));
2354
+ this.component = () => (React__default.createElement(DataProvider, null, React__default.createElement(PeriodDimension, { selectedPeriods: this.selectedPeriods, onSelect: (selectionEvent) => this.ngZone.run(() => {
2355
+ this.onSelectItems(selectionEvent);
2356
+ }), excludedPeriodTypes: excludedPeriodTypes, systemInfo: systemInfo })));
2290
2357
  this.render();
2291
2358
  }
2292
2359
  onSelectItems(selectionEvent) {
2293
2360
  this.selectPeriods.emit(selectionEvent.items);
2294
2361
  }
2295
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PeriodSelectorComponent, deps: [{ token: i0.ElementRef }, { token: i1.NgxDhis2HttpClientService }], target: i0.ɵɵFactoryTarget.Component }); }
2296
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: PeriodSelectorComponent, selector: "ng-dhis2-ui-period-selector", inputs: { selectedPeriods: "selectedPeriods" }, outputs: { selectPeriods: "selectPeriods" }, usesInheritance: true, ngImport: i0, template: `<ng-container></ng-container>`, isInline: true, styles: ["::ng-deep .content-container{z-index:0!important}\n"] }); }
2362
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: PeriodSelectorComponent, deps: [{ token: i0.ElementRef }, { token: i1.NgxDhis2HttpClientService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component }); }
2363
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.1", type: PeriodSelectorComponent, selector: "ng-dhis2-ui-period-selector", inputs: { selectedPeriods: "selectedPeriods" }, outputs: { selectPeriods: "selectPeriods" }, usesInheritance: true, ngImport: i0, template: `<ng-container></ng-container>`, isInline: true, styles: ["::ng-deep .content-container{z-index:0!important}\n"] }); }
2297
2364
  }
2298
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PeriodSelectorComponent, decorators: [{
2365
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: PeriodSelectorComponent, decorators: [{
2299
2366
  type: Component,
2300
2367
  args: [{ selector: 'ng-dhis2-ui-period-selector', template: `<ng-container></ng-container>`, styles: ["::ng-deep .content-container{z-index:0!important}\n"] }]
2301
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.NgxDhis2HttpClientService }]; }, propDecorators: { selectedPeriods: [{
2368
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1.NgxDhis2HttpClientService }, { type: i0.NgZone }], propDecorators: { selectedPeriods: [{
2302
2369
  type: Input
2303
2370
  }], selectPeriods: [{
2304
2371
  type: Output
2305
2372
  }] } });
2306
2373
 
2307
2374
  class PeriodSelectorModule {
2308
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PeriodSelectorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
2309
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: PeriodSelectorModule, declarations: [PeriodSelectorComponent], imports: [CommonModule, SharedDhis2UiModule], exports: [PeriodSelectorComponent] }); }
2310
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PeriodSelectorModule, imports: [CommonModule, SharedDhis2UiModule] }); }
2375
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: PeriodSelectorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
2376
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.1.1", ngImport: i0, type: PeriodSelectorModule, declarations: [PeriodSelectorComponent, PeriodSelectorModalComponent], imports: [CommonModule, SharedDhis2UiModule], exports: [PeriodSelectorComponent, PeriodSelectorModalComponent] }); }
2377
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: PeriodSelectorModule, imports: [CommonModule, SharedDhis2UiModule] }); }
2311
2378
  }
2312
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PeriodSelectorModule, decorators: [{
2379
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: PeriodSelectorModule, decorators: [{
2313
2380
  type: NgModule,
2314
2381
  args: [{
2315
2382
  imports: [CommonModule, SharedDhis2UiModule],
2316
- declarations: [PeriodSelectorComponent],
2317
- exports: [PeriodSelectorComponent],
2383
+ declarations: [PeriodSelectorComponent, PeriodSelectorModalComponent],
2384
+ exports: [PeriodSelectorComponent, PeriodSelectorModalComponent],
2318
2385
  }]
2319
2386
  }] });
2320
2387
 
@@ -2328,7 +2395,7 @@ const USER_ORG_UNIT = 'USER_ORGUNIT';
2328
2395
  const USER_ORG_UNIT_CHILDREN = 'USER_ORGUNIT_CHILDREN';
2329
2396
  const USER_ORG_UNIT_GRANDCHILDREN = 'USER_ORGUNIT_GRANDCHILDREN';
2330
2397
  const hasGroupPrefix = (id) => id.substr(0, GROUP_ID_PREFIX.length) === GROUP_ID_PREFIX;
2331
- const hasLevelPrefix = (id) => id.substr(0, LEVEL_ID_PREFIX.length) === LEVEL_ID_PREFIX;
2398
+ const hasLevelPrefix = (id) => id.includes(LEVEL_ID_PREFIX);
2332
2399
  const stripLevelPrefix = (id) => hasLevelPrefix(id) ? id.substr(LEVEL_ID_PREFIX.length + 1) : id;
2333
2400
  const stripGroupPrefix = (id) => hasGroupPrefix(id) ? id.substr(GROUP_ID_PREFIX.length + 1) : id;
2334
2401
  const removePrefix = (id) => stripGroupPrefix(stripLevelPrefix(id));
@@ -2471,11 +2538,11 @@ const OrgUnitDimension = ({ roots, selected, onSelect, hideGroupSelect, hideLeve
2471
2538
  if (checked && DYNAMIC_ORG_UNITS.includes(id)) {
2472
2539
  result = [
2473
2540
  ...result.filter((item) => DYNAMIC_ORG_UNITS.includes(item.id)),
2474
- { id, displayName },
2541
+ { id, displayName, type: 'USER_ORGUNIT' },
2475
2542
  ];
2476
2543
  }
2477
2544
  else if (checked) {
2478
- result.push({ id, path, name: displayName });
2545
+ result.push({ id, path, name: displayName, type: 'ORGUNIT' });
2479
2546
  }
2480
2547
  else {
2481
2548
  result = [...result.filter((item) => item.id !== id)];
@@ -2511,14 +2578,16 @@ const OrgUnitDimension = ({ roots, selected, onSelect, hideGroupSelect, hideLeve
2511
2578
  id: ouIdHelper.addLevelPrefix(id),
2512
2579
  name: ouLevels?.find((level) => level.id === id)
2513
2580
  ?.displayName,
2581
+ type: 'ORGUNIT_LEVEL',
2514
2582
  }));
2515
- setSelectedItems([
2583
+ const updatedSelectedItems = [
2516
2584
  ...selectedItems.filter((ou) => !ouIdHelper.hasLevelPrefix(ou.id)),
2517
2585
  ...items,
2518
- ]);
2586
+ ];
2587
+ setSelectedItems(updatedSelectedItems);
2519
2588
  onSelect({
2520
2589
  dimensionId: DIMENSION_ID_ORGUNIT,
2521
- items: selectedItems,
2590
+ items: updatedSelectedItems,
2522
2591
  });
2523
2592
  };
2524
2593
  const onGroupChange = (ids) => {
@@ -2526,14 +2595,16 @@ const OrgUnitDimension = ({ roots, selected, onSelect, hideGroupSelect, hideLeve
2526
2595
  id: ouIdHelper.addGroupPrefix(id),
2527
2596
  name: (ouGroups?.find((group) => group.id === id) || {})
2528
2597
  .displayName,
2598
+ type: 'ORGUNIT_GROUP',
2529
2599
  }));
2530
- setSelectedItems([
2600
+ const updatedSelectedItems = [
2531
2601
  ...selectedItems.filter((ou) => !ouIdHelper.hasGroupPrefix(ou.id)),
2532
2602
  ...items,
2533
- ]);
2603
+ ];
2604
+ setSelectedItems(updatedSelectedItems);
2534
2605
  onSelect({
2535
2606
  dimensionId: DIMENSION_ID_ORGUNIT,
2536
- items: selectedItems,
2607
+ items: updatedSelectedItems,
2537
2608
  });
2538
2609
  };
2539
2610
  const getSummary = () => {
@@ -2678,9 +2749,10 @@ class OrganisationUnitSelectionConfig {
2678
2749
  // license that can be found in the LICENSE file.
2679
2750
 
2680
2751
  class OrganisationUnitSelectorComponent extends ReactWrapperComponent {
2681
- constructor(elementRef, httpClient) {
2752
+ constructor(elementRef, httpClient, ngZone) {
2682
2753
  super(elementRef);
2683
2754
  this.httpClient = httpClient;
2755
+ this.ngZone = ngZone;
2684
2756
  this.selectedOrgUnits = [];
2685
2757
  this.orgUnitSelectionConfig = new OrganisationUnitSelectionConfig();
2686
2758
  this.selectOrgUnits = new EventEmitter();
@@ -2696,7 +2768,9 @@ class OrganisationUnitSelectorComponent extends ReactWrapperComponent {
2696
2768
  this.reactDomRoot = ReactDOM.createRoot(this.elementRef.nativeElement);
2697
2769
  const rootOrgUnits = await this.getRootOrgUnits();
2698
2770
  const config = await this.getAppConfig();
2699
- this.component = () => (React__default.createElement(Provider, { config: config }, React__default.createElement(OrgUnitDimension, { selected: this.selectedOrgUnits, hideGroupSelect: this.orgUnitSelectionConfig.hideGroupSelect, hideLevelSelect: this.orgUnitSelectionConfig.hideLevelSelect, hideUserOrgUnits: this.orgUnitSelectionConfig.hideUserOrgUnits, onSelect: (selectionEvent) => this.onSelectItems(selectionEvent), orgUnitGroupPromise: this.getOrgUnitGroups(), orgUnitLevelPromise: this.getOrgUnitLevels(), roots: rootOrgUnits })));
2771
+ this.component = () => (React__default.createElement(Provider, { config: config }, React__default.createElement(OrgUnitDimension, { selected: this.selectedOrgUnits, hideGroupSelect: this.orgUnitSelectionConfig.hideGroupSelect, hideLevelSelect: this.orgUnitSelectionConfig.hideLevelSelect, hideUserOrgUnits: this.orgUnitSelectionConfig.hideUserOrgUnits, onSelect: (selectionEvent) => this.ngZone.run(() => {
2772
+ this.onSelectItems(selectionEvent);
2773
+ }), orgUnitGroupPromise: this.getOrgUnitGroups(), orgUnitLevelPromise: this.getOrgUnitLevels(), roots: rootOrgUnits })));
2700
2774
  this.render();
2701
2775
  }
2702
2776
  async getAppConfig() {
@@ -2737,34 +2811,144 @@ class OrganisationUnitSelectorComponent extends ReactWrapperComponent {
2737
2811
  onSelectItems(selectionEvent) {
2738
2812
  this.selectOrgUnits.emit(selectionEvent.items);
2739
2813
  }
2740
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: OrganisationUnitSelectorComponent, deps: [{ token: i0.ElementRef }, { token: i1.NgxDhis2HttpClientService }], target: i0.ɵɵFactoryTarget.Component }); }
2741
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: OrganisationUnitSelectorComponent, selector: "ng-dhis2-ui-org-unit-selector", inputs: { selectedOrgUnits: "selectedOrgUnits", orgUnitSelectionConfig: "orgUnitSelectionConfig" }, outputs: { selectOrgUnits: "selectOrgUnits" }, usesInheritance: true, ngImport: i0, template: '<ng-container><ng-container>', isInline: true }); }
2814
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: OrganisationUnitSelectorComponent, deps: [{ token: i0.ElementRef }, { token: i1.NgxDhis2HttpClientService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component }); }
2815
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.1", type: OrganisationUnitSelectorComponent, selector: "ng-dhis2-ui-org-unit-selector", inputs: { selectedOrgUnits: "selectedOrgUnits", orgUnitSelectionConfig: "orgUnitSelectionConfig" }, outputs: { selectOrgUnits: "selectOrgUnits" }, usesInheritance: true, ngImport: i0, template: '<ng-container><ng-container>', isInline: true }); }
2742
2816
  }
2743
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: OrganisationUnitSelectorComponent, decorators: [{
2817
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: OrganisationUnitSelectorComponent, decorators: [{
2744
2818
  type: Component,
2745
2819
  args: [{
2746
2820
  selector: 'ng-dhis2-ui-org-unit-selector',
2747
2821
  template: '<ng-container><ng-container>',
2748
2822
  }]
2749
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.NgxDhis2HttpClientService }]; }, propDecorators: { selectedOrgUnits: [{
2823
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1.NgxDhis2HttpClientService }, { type: i0.NgZone }], propDecorators: { selectedOrgUnits: [{
2824
+ type: Input
2825
+ }], orgUnitSelectionConfig: [{
2826
+ type: Input
2827
+ }], selectOrgUnits: [{
2828
+ type: Output
2829
+ }] } });
2830
+
2831
+ class OrganisationUnitSelectorModalComponent extends ReactWrapperComponent {
2832
+ constructor(elementRef, httpClient) {
2833
+ super(elementRef);
2834
+ this.httpClient = httpClient;
2835
+ this.selectedOrgUnits = [];
2836
+ this.orgUnitSelectionConfig = new OrganisationUnitSelectionConfig();
2837
+ this.selectOrgUnits = new EventEmitter();
2838
+ this.cancel = new EventEmitter();
2839
+ this.confirm = new EventEmitter();
2840
+ this.props = {
2841
+ onSelect: (e) => {
2842
+ this.onSelectItems(e);
2843
+ },
2844
+ };
2845
+ }
2846
+ async ngAfterViewInit() {
2847
+ if (!this.elementRef)
2848
+ throw new Error('No element ref');
2849
+ this.reactDomRoot = ReactDOM.createRoot(this.elementRef.nativeElement);
2850
+ const rootOrgUnits = await this.getRootOrgUnits();
2851
+ const config = await this.getAppConfig();
2852
+ this.component = () => {
2853
+ const [selected, setSelected] = useState(this.selectedOrgUnits);
2854
+ return (React__default.createElement(Provider, { config: config }, React__default.createElement(Modal$1, { position: "middle", large: true },
2855
+ React__default.createElement(ModalTitle$1, null, "Organisation unit"),
2856
+ React__default.createElement(ModalContent$1, null,
2857
+ React__default.createElement(OrgUnitDimension, { selected: selected, hideGroupSelect: this.orgUnitSelectionConfig.hideGroupSelect, hideLevelSelect: this.orgUnitSelectionConfig.hideLevelSelect, hideUserOrgUnits: this.orgUnitSelectionConfig.hideUserOrgUnits, onSelect: (selectionEvent) => {
2858
+ setSelected(selectionEvent.items);
2859
+ }, orgUnitGroupPromise: this.getOrgUnitGroups(), orgUnitLevelPromise: this.getOrgUnitLevels(), roots: rootOrgUnits })),
2860
+ React__default.createElement(ModalActions$1, null,
2861
+ React__default.createElement(ButtonStrip$1, { end: true },
2862
+ React__default.createElement(Button$1, { onClick: () => {
2863
+ this.onCancel();
2864
+ } }, "Cancel"),
2865
+ React__default.createElement(Button$1, { primary: true, disabled: selected.length === 0, onClick: () => {
2866
+ this.onConfirm(selected);
2867
+ } }, "Confirm"))))));
2868
+ };
2869
+ this.render();
2870
+ }
2871
+ onCancel() {
2872
+ this.cancel.emit();
2873
+ }
2874
+ onConfirm(selectedItems) {
2875
+ this.confirm.emit(selectedItems);
2876
+ }
2877
+ async getAppConfig() {
2878
+ const systemInfo = (await firstValueFrom(this.httpClient.systemInfo()));
2879
+ return {
2880
+ baseUrl: (document?.location?.host?.includes('localhost')
2881
+ ? `${document.location.protocol}//${document.location.host}`
2882
+ : systemInfo['contextPath']),
2883
+ apiVersion: Number(((systemInfo['version'] || '')?.split('.') || [])[1]),
2884
+ };
2885
+ }
2886
+ getOrgUnitAttributeByUsage(usageType) {
2887
+ switch (usageType) {
2888
+ case 'DATA_ENTRY':
2889
+ return 'organisationUnits';
2890
+ case 'DATA_VIEW':
2891
+ return 'dataViewOrganisationUnits';
2892
+ default:
2893
+ return 'organisationUnits';
2894
+ }
2895
+ }
2896
+ getRootOrgUnits() {
2897
+ const orgUnitAttribute = this.getOrgUnitAttributeByUsage(this.orgUnitSelectionConfig.usageType);
2898
+ return firstValueFrom(this.httpClient
2899
+ .me()
2900
+ .pipe(map((user) => (user ? user[orgUnitAttribute] : []).map((orgUnit) => orgUnit.id))));
2901
+ }
2902
+ getOrgUnitGroups() {
2903
+ return firstValueFrom(this.httpClient
2904
+ .get('organisationUnitGroups.json?fields=id,displayName,name&paging=false')
2905
+ .pipe(map((res) => res?.['organisationUnitGroups'])));
2906
+ }
2907
+ getOrgUnitLevels() {
2908
+ return firstValueFrom(this.httpClient
2909
+ .get('organisationUnitLevels.json?fields=id,level,displayName,name&paging=false')
2910
+ .pipe(map((res) => res?.['organisationUnitLevels'])));
2911
+ }
2912
+ onSelectItems(selectionEvent) {
2913
+ this.selectOrgUnits.emit(selectionEvent.items);
2914
+ }
2915
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: OrganisationUnitSelectorModalComponent, deps: [{ token: i0.ElementRef }, { token: i1.NgxDhis2HttpClientService }], target: i0.ɵɵFactoryTarget.Component }); }
2916
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.1", type: OrganisationUnitSelectorModalComponent, selector: "ng-dhis2-ui-org-unit-selector-modal", inputs: { selectedOrgUnits: "selectedOrgUnits", orgUnitSelectionConfig: "orgUnitSelectionConfig" }, outputs: { selectOrgUnits: "selectOrgUnits", cancel: "cancel", confirm: "confirm" }, usesInheritance: true, ngImport: i0, template: '<ng-container><ng-container>', isInline: true, styles: ["::ng-deep .layer{z-index:2!important}\n"] }); }
2917
+ }
2918
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: OrganisationUnitSelectorModalComponent, decorators: [{
2919
+ type: Component,
2920
+ args: [{ selector: 'ng-dhis2-ui-org-unit-selector-modal', template: '<ng-container><ng-container>', styles: ["::ng-deep .layer{z-index:2!important}\n"] }]
2921
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1.NgxDhis2HttpClientService }], propDecorators: { selectedOrgUnits: [{
2750
2922
  type: Input
2751
2923
  }], orgUnitSelectionConfig: [{
2752
2924
  type: Input
2753
2925
  }], selectOrgUnits: [{
2754
2926
  type: Output
2927
+ }], cancel: [{
2928
+ type: Output
2929
+ }], confirm: [{
2930
+ type: Output
2755
2931
  }] } });
2756
2932
 
2757
2933
  class OrganisationUnitSelectorModule {
2758
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: OrganisationUnitSelectorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
2759
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: OrganisationUnitSelectorModule, declarations: [OrganisationUnitSelectorComponent], imports: [CommonModule, SharedDhis2UiModule], exports: [OrganisationUnitSelectorComponent] }); }
2760
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: OrganisationUnitSelectorModule, imports: [CommonModule, SharedDhis2UiModule] }); }
2934
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: OrganisationUnitSelectorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
2935
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.1.1", ngImport: i0, type: OrganisationUnitSelectorModule, declarations: [OrganisationUnitSelectorComponent,
2936
+ OrganisationUnitSelectorModalComponent], imports: [CommonModule, SharedDhis2UiModule], exports: [OrganisationUnitSelectorComponent,
2937
+ OrganisationUnitSelectorModalComponent] }); }
2938
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: OrganisationUnitSelectorModule, imports: [CommonModule, SharedDhis2UiModule] }); }
2761
2939
  }
2762
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: OrganisationUnitSelectorModule, decorators: [{
2940
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: OrganisationUnitSelectorModule, decorators: [{
2763
2941
  type: NgModule,
2764
2942
  args: [{
2765
2943
  imports: [CommonModule, SharedDhis2UiModule],
2766
- declarations: [OrganisationUnitSelectorComponent],
2767
- exports: [OrganisationUnitSelectorComponent],
2944
+ declarations: [
2945
+ OrganisationUnitSelectorComponent,
2946
+ OrganisationUnitSelectorModalComponent,
2947
+ ],
2948
+ exports: [
2949
+ OrganisationUnitSelectorComponent,
2950
+ OrganisationUnitSelectorModalComponent,
2951
+ ],
2768
2952
  }]
2769
2953
  }] });
2770
2954
 
@@ -2776,5 +2960,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
2776
2960
  * Generated bundle index. Do not edit.
2777
2961
  */
2778
2962
 
2779
- export { ButtonComponent, ButtonModule, HeaderBarComponent, HeaderBarModule, NgDhis2UiModule, OrganisationUnitSelectorComponent, OrganisationUnitSelectorModule, PeriodSelectorComponent, PeriodSelectorModule, ReactWrapperComponent, ReactWrapperModule };
2963
+ export { ButtonComponent, ButtonModule, HeaderBarComponent, HeaderBarModule, OrganisationUnitSelectorComponent, OrganisationUnitSelectorModalComponent, OrganisationUnitSelectorModule, PeriodSelectorComponent, PeriodSelectorModalComponent, PeriodSelectorModule, ReactWrapperComponent, ReactWrapperModule };
2780
2964
  //# sourceMappingURL=iapps-ng-dhis2-ui.mjs.map