@iapps/ng-dhis2-ui 1.0.4 → 1.0.5

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 (101) hide show
  1. package/esm2022/iapps-ng-dhis2-ui.mjs +1 -1
  2. package/esm2022/index.mjs +1 -2
  3. package/esm2022/lib/modules/button/button.component.mjs +14 -9
  4. package/esm2022/lib/modules/button/button.module.mjs +5 -5
  5. package/esm2022/lib/modules/button/index.mjs +1 -1
  6. package/esm2022/lib/modules/header-bar/header-bar.component.mjs +5 -5
  7. package/esm2022/lib/modules/header-bar/header-bar.module.mjs +5 -5
  8. package/esm2022/lib/modules/header-bar/index.mjs +1 -1
  9. package/esm2022/lib/modules/header-bar/models/header-bar-app.model.mjs +1 -1
  10. package/esm2022/lib/modules/header-bar/models/header-bar-data.model.mjs +1 -1
  11. package/esm2022/lib/modules/header-bar/models/header-bar-notification.model.mjs +1 -1
  12. package/esm2022/lib/modules/header-bar/models/index.mjs +1 -1
  13. package/esm2022/lib/modules/header-bar/utils/apps.mjs +1 -1
  14. package/esm2022/lib/modules/header-bar/utils/debug-info/debug-info-menu-item.mjs +14 -14
  15. package/esm2022/lib/modules/header-bar/utils/debug-info/debug-info-modal.mjs +1 -1
  16. package/esm2022/lib/modules/header-bar/utils/debug-info/debug-info-table.mjs +15 -15
  17. package/esm2022/lib/modules/header-bar/utils/debug-info/use-debug-info.mjs +1 -1
  18. package/esm2022/lib/modules/header-bar/utils/header-bar-context.mjs +2 -2
  19. package/esm2022/lib/modules/header-bar/utils/header-bar.mjs +1 -1
  20. package/esm2022/lib/modules/header-bar/utils/join-path.mjs +1 -1
  21. package/esm2022/lib/modules/header-bar/utils/logo-image.mjs +24 -24
  22. package/esm2022/lib/modules/header-bar/utils/logo.mjs +1 -1
  23. package/esm2022/lib/modules/header-bar/utils/notification-icon.mjs +47 -47
  24. package/esm2022/lib/modules/header-bar/utils/notifications.mjs +10 -10
  25. package/esm2022/lib/modules/header-bar/utils/profile/use-on-doc-click.mjs +1 -1
  26. package/esm2022/lib/modules/header-bar/utils/profile-menu/index.mjs +1 -1
  27. package/esm2022/lib/modules/header-bar/utils/profile-menu/profile-header.mjs +37 -37
  28. package/esm2022/lib/modules/header-bar/utils/profile-menu/profile-menu.mjs +28 -28
  29. package/esm2022/lib/modules/header-bar/utils/profile-menu/update-notification.mjs +24 -24
  30. package/esm2022/lib/modules/header-bar/utils/profile.mjs +25 -25
  31. package/esm2022/lib/modules/header-bar/utils/title.mjs +1 -1
  32. package/esm2022/lib/modules/organisation-unit-selector/components/OrgUnitDimension.mjs +14 -10
  33. package/esm2022/lib/modules/organisation-unit-selector/components/index.mjs +1 -1
  34. package/esm2022/lib/modules/organisation-unit-selector/components/styles/OrgUnitDimension.style.mjs +1 -1
  35. package/esm2022/lib/modules/organisation-unit-selector/components/utils/index.mjs +1 -1
  36. package/esm2022/lib/modules/organisation-unit-selector/components/utils/ouIdHelper/index.mjs +2 -2
  37. package/esm2022/lib/modules/organisation-unit-selector/components/utils/ouLevelUtils/index.mjs +1 -1
  38. package/esm2022/lib/modules/organisation-unit-selector/containers/organisation-unit-selector/organisation-unit-selector.component.mjs +88 -0
  39. package/esm2022/lib/modules/organisation-unit-selector/containers/organisation-unit-selector-modal/organisation-unit-selector-modal.component-modal.mjs +114 -0
  40. package/esm2022/lib/modules/organisation-unit-selector/index.mjs +3 -2
  41. package/esm2022/lib/modules/organisation-unit-selector/models/index.mjs +1 -1
  42. package/esm2022/lib/modules/organisation-unit-selector/models/organisation-unit-config.model.mjs +1 -1
  43. package/esm2022/lib/modules/organisation-unit-selector/organisation-unit-selector.module.mjs +17 -8
  44. package/esm2022/lib/modules/period-selector/components/FixedPeriodFilter.mjs +1 -1
  45. package/esm2022/lib/modules/period-selector/components/PeriodDimension.mjs +1 -1
  46. package/esm2022/lib/modules/period-selector/components/PeriodTransfer.mjs +1 -1
  47. package/esm2022/lib/modules/period-selector/components/RelativePeriodFilter.mjs +1 -1
  48. package/esm2022/lib/modules/period-selector/components/utils/fixedPeriods.mjs +17 -17
  49. package/esm2022/lib/modules/period-selector/components/utils/index.mjs +1 -1
  50. package/esm2022/lib/modules/period-selector/components/utils/periodTypes.mjs +1 -1
  51. package/esm2022/lib/modules/period-selector/components/utils/relativePeriods.mjs +1 -1
  52. package/esm2022/lib/modules/period-selector/containers/period-selector/period-selector.component.mjs +66 -0
  53. package/esm2022/lib/modules/period-selector/containers/period-selector-modal/period-selector-modal.component.mjs +82 -0
  54. package/esm2022/lib/modules/period-selector/index.mjs +3 -2
  55. package/esm2022/lib/modules/period-selector/period-selector.module.mjs +10 -9
  56. package/esm2022/lib/modules/react-wrapper/index.mjs +1 -1
  57. package/esm2022/lib/modules/react-wrapper/react-wrapper.component.mjs +5 -5
  58. package/esm2022/lib/modules/react-wrapper/react-wrapper.module.mjs +5 -5
  59. package/esm2022/lib/shared/assets/AssignedCategoriesIcon.mjs +1 -1
  60. package/esm2022/lib/shared/assets/DimensionItemIcons/PeriodIcon.mjs +1 -1
  61. package/esm2022/lib/shared/components/TransferOption.mjs +1 -1
  62. package/esm2022/lib/shared/components/index.mjs +1 -1
  63. package/esm2022/lib/shared/index.mjs +1 -1
  64. package/esm2022/lib/shared/shared.module.mjs +5 -5
  65. package/esm2022/lib/shared/styles/DimensionSelector.style.mjs +1 -1
  66. package/esm2022/lib/shared/styles/index.mjs +1 -1
  67. package/esm2022/lib/shared/utils/axis.mjs +1 -1
  68. package/esm2022/lib/shared/utils/axisGetDimension.mjs +1 -1
  69. package/esm2022/lib/shared/utils/axisHasDimension.mjs +1 -1
  70. package/esm2022/lib/shared/utils/dimension.mjs +1 -1
  71. package/esm2022/lib/shared/utils/dimensionGetItems.mjs +1 -1
  72. package/esm2022/lib/shared/utils/dimensionIs.mjs +1 -1
  73. package/esm2022/lib/shared/utils/dimensionIsEmpty.mjs +1 -1
  74. package/esm2022/lib/shared/utils/dimensionIsValid.mjs +1 -1
  75. package/esm2022/lib/shared/utils/dimensionSelectorHelper.mjs +1 -1
  76. package/esm2022/lib/shared/utils/index.mjs +1 -1
  77. package/esm2022/lib/shared/utils/layoutGetAllAxes.mjs +1 -1
  78. package/esm2022/lib/shared/utils/layoutGetAllDimensions.mjs +1 -1
  79. package/esm2022/lib/shared/utils/layoutGetDimension.mjs +1 -1
  80. package/esm2022/lib/shared/utils/layoutReplaceDimension.mjs +1 -1
  81. package/esm2022/lib/shared/utils/list.mjs +1 -1
  82. package/esm2022/lib/shared/utils/predefinedDimensions.mjs +3 -1
  83. package/fesm2022/iapps-ng-dhis2-ui.mjs +490 -313
  84. package/fesm2022/iapps-ng-dhis2-ui.mjs.map +1 -1
  85. package/index.d.ts +0 -1
  86. package/lib/modules/button/button.component.d.ts +1 -2
  87. package/lib/modules/organisation-unit-selector/{organisation-unit-selector.component.d.ts → containers/organisation-unit-selector/organisation-unit-selector.component.d.ts} +2 -2
  88. package/lib/modules/organisation-unit-selector/containers/organisation-unit-selector-modal/organisation-unit-selector-modal.component-modal.d.ts +31 -0
  89. package/lib/modules/organisation-unit-selector/index.d.ts +2 -1
  90. package/lib/modules/organisation-unit-selector/organisation-unit-selector.module.d.ts +5 -4
  91. package/lib/modules/period-selector/{period-selector.component.d.ts → containers/period-selector/period-selector.component.d.ts} +1 -1
  92. package/lib/modules/period-selector/containers/period-selector-modal/period-selector-modal.component.d.ts +17 -0
  93. package/lib/modules/period-selector/index.d.ts +2 -1
  94. package/lib/modules/period-selector/period-selector.module.d.ts +5 -4
  95. package/lib/modules/react-wrapper/react-wrapper.component.d.ts +1 -2
  96. package/lib/shared/utils/predefinedDimensions.d.ts +2 -0
  97. package/package.json +1 -2
  98. package/esm2022/lib/modules/organisation-unit-selector/organisation-unit-selector.component.mjs +0 -88
  99. package/esm2022/lib/modules/period-selector/period-selector.component.mjs +0 -66
  100. package/esm2022/lib/ng-dhis2-ui.module.mjs +0 -15
  101. 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: "17.2.4", ngImport: i0, type: SharedDhis2UiModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
164
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.2.4", ngImport: i0, type: SharedDhis2UiModule, imports: [CommonModule] }); }
165
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.2.4", 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: "17.2.4", 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,
@@ -1184,15 +1172,15 @@ class ReactWrapperComponent {
1184
1172
  jsxContent || '',
1185
1173
  " "));
1186
1174
  }
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 }); }
1175
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: ReactWrapperComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
1176
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.2.4", 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: "17.2.4", 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: "17.2.4", ngImport: i0, type: ReactWrapperModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1194
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.2.4", ngImport: i0, type: ReactWrapperModule, declarations: [ReactWrapperComponent], imports: [CommonModule], exports: [ReactWrapperComponent] }); }
1195
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.2.4", 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: "17.2.4", 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: "17.2.4", 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: "17.2.4", 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: "17.2.4", 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: "17.2.4", ngImport: i0, type: HeaderBarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1239
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.2.4", ngImport: i0, type: HeaderBarModule, declarations: [HeaderBarComponent], imports: [CommonModule, SharedDhis2UiModule], exports: [HeaderBarComponent] }); }
1240
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.2.4", 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: "17.2.4", 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: "17.2.4", ngImport: i0, type: ButtonComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
1283
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.4", 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: "17.2.4", 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: "17.2.4", ngImport: i0, type: ButtonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1311
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.2.4", ngImport: i0, type: ButtonModule, declarations: [ButtonComponent], imports: [CommonModule, SharedDhis2UiModule], exports: [ButtonComponent] }); }
1312
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.2.4", 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: "17.2.4", 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 = () => ({
@@ -1746,23 +1739,23 @@ const getRelativePeriodIds = () => Object.values(getOptions$1())
1746
1739
  .flat();
1747
1740
 
1748
1741
  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])$/,
1742
+ [DAILY]: /^([0-9]{4})([0-9]{2})([0-9]{2})$/, // YYYYMMDD
1743
+ [WEEKLY]: /^([0-9]{4})()W([0-9]{1,2})$/, // YYYY"W"[1-53]
1744
+ [BIWEEKLY]: /^([0-9]{4})BiW([0-9]{1,2})$/, // YYYY"BiW"[1-27]
1745
+ [WEEKLYWED]: /^([0-9]{4})(Wed)W([0-9]{1,2})$/, // YYYY"WedW"[1-53]
1746
+ [WEEKLYTHU]: /^([0-9]{4})(Thu)W([0-9]{1,2})$/, // YYYY"ThuW"[1-53]
1747
+ [WEEKLYSAT]: /^([0-9]{4})(Sat)W([0-9]{1,2})$/, // YYYY"SatW"[1-53]
1748
+ [WEEKLYSUN]: /^([0-9]{4})(Sun)W([0-9]{1,2})$/, // YYYY"SunW"[1-53]
1749
+ [MONTHLY]: /^([0-9]{4})([0-9]{2})$/, // YYYYMM
1750
+ [BIMONTHLY]: /^([0-9]{4})([0-9]{2})B$/, // YYYY0[1-6]"B"
1751
+ [QUARTERLY]: /^([0-9]{4})Q([1234])$/, // YYYY"Q"[1-4]
1752
+ [SIXMONTHLY]: /^([0-9]{4})S([12])$/, // YYYY"S"[1/2]
1753
+ [SIXMONTHLYAPR]: /^([0-9]{4})AprilS([12])$/, // YYYY"AprilS"[1/2]
1761
1754
  // [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$/,
1755
+ [YEARLY]: /^([0-9]{4})$/, // YYYY
1756
+ [FYNOV]: /^([0-9]{4})Nov$/, // YYYY"Nov"
1757
+ [FYOCT]: /^([0-9]{4})Oct$/, // YYYY"Oct"
1758
+ [FYJUL]: /^([0-9]{4})July$/, // YYYY"July"
1766
1759
  [FYAPR]: /^([0-9]{4})April$/, // YYYY"April"
1767
1760
  };
1768
1761
  const getPeriods = ({ periodType, config, fnFilter, periodSettings = {}, }) => {
@@ -2249,6 +2242,76 @@ PeriodDimension.defaultProps = {
2249
2242
  selectedPeriods: [],
2250
2243
  };
2251
2244
 
2245
+ class PeriodSelectorModalComponent extends ReactWrapperComponent {
2246
+ constructor(elementRef, httpClient) {
2247
+ super(elementRef);
2248
+ this.httpClient = httpClient;
2249
+ this.selectedPeriods = [];
2250
+ this.cancel = new EventEmitter();
2251
+ this.confirm = new EventEmitter();
2252
+ this.getExcludedPeriodTypes = (systemSettings = {}) => {
2253
+ const types = [];
2254
+ if (systemSettings['hideDailyPeriods']) {
2255
+ types.push(DAILY);
2256
+ }
2257
+ if (systemSettings['hideWeeklyPeriods']) {
2258
+ types.push(WEEKLY, WEEKLYWED, WEEKLYTHU, WEEKLYSAT, WEEKLYSUN);
2259
+ }
2260
+ if (systemSettings['hideBiWeeklyPeriods']) {
2261
+ types.push(BIWEEKLY);
2262
+ }
2263
+ if (systemSettings['hideMonthlyPeriods']) {
2264
+ types.push(MONTHLY);
2265
+ }
2266
+ if (systemSettings['hideBiMonthlyPeriods']) {
2267
+ types.push(BIMONTHLY);
2268
+ }
2269
+ return types;
2270
+ };
2271
+ }
2272
+ async ngAfterViewInit() {
2273
+ if (!this.elementRef)
2274
+ throw new Error('No element ref');
2275
+ this.reactDomRoot = ReactDOM.createRoot(this.elementRef.nativeElement);
2276
+ const systemInfo = await firstValueFrom(this.httpClient.systemInfo());
2277
+ const excludedPeriodTypes = this.getExcludedPeriodTypes(systemInfo);
2278
+ this.component = () => {
2279
+ const [selected, setSelected] = useState(this.selectedPeriods);
2280
+ return (React__default.createElement(DataProvider, null, React__default.createElement(Modal$1, { position: "middle", large: true },
2281
+ React__default.createElement(ModalTitle$1, null, "Period"),
2282
+ React__default.createElement(ModalContent$1, null,
2283
+ React__default.createElement(PeriodDimension, { selectedPeriods: selected, onSelect: (selectionEvent) => setSelected(selectionEvent.items), excludedPeriodTypes: excludedPeriodTypes, systemInfo: systemInfo })),
2284
+ React__default.createElement(ModalActions$1, null,
2285
+ React__default.createElement(ButtonStrip$1, { end: true },
2286
+ React__default.createElement(Button$1, { onClick: () => {
2287
+ this.onCancel();
2288
+ } }, "Cancel"),
2289
+ React__default.createElement(Button$1, { primary: true, disabled: selected.length === 0, onClick: () => {
2290
+ this.onConfirm(selected);
2291
+ } }, "Confirm"))))));
2292
+ };
2293
+ this.render();
2294
+ }
2295
+ onCancel() {
2296
+ this.cancel.emit();
2297
+ }
2298
+ onConfirm(selectedItems) {
2299
+ this.confirm.emit(selectedItems);
2300
+ }
2301
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: PeriodSelectorModalComponent, deps: [{ token: i0.ElementRef }, { token: i1.NgxDhis2HttpClientService }], target: i0.ɵɵFactoryTarget.Component }); }
2302
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.4", 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"] }); }
2303
+ }
2304
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: PeriodSelectorModalComponent, decorators: [{
2305
+ type: Component,
2306
+ args: [{ selector: 'ng-dhis2-ui-period-selector-modal', template: `<ng-container></ng-container>`, styles: ["::ng-deep .layer{z-index:2!important}\n"] }]
2307
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1.NgxDhis2HttpClientService }], propDecorators: { selectedPeriods: [{
2308
+ type: Input
2309
+ }], cancel: [{
2310
+ type: Output
2311
+ }], confirm: [{
2312
+ type: Output
2313
+ }] } });
2314
+
2252
2315
  class PeriodSelectorComponent extends ReactWrapperComponent {
2253
2316
  constructor(elementRef, httpClient) {
2254
2317
  super(elementRef);
@@ -2292,29 +2355,29 @@ class PeriodSelectorComponent extends ReactWrapperComponent {
2292
2355
  onSelectItems(selectionEvent) {
2293
2356
  this.selectPeriods.emit(selectionEvent.items);
2294
2357
  }
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"] }); }
2358
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: PeriodSelectorComponent, deps: [{ token: i0.ElementRef }, { token: i1.NgxDhis2HttpClientService }], target: i0.ɵɵFactoryTarget.Component }); }
2359
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.4", 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
2360
  }
2298
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PeriodSelectorComponent, decorators: [{
2361
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: PeriodSelectorComponent, decorators: [{
2299
2362
  type: Component,
2300
2363
  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: [{
2364
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1.NgxDhis2HttpClientService }], propDecorators: { selectedPeriods: [{
2302
2365
  type: Input
2303
2366
  }], selectPeriods: [{
2304
2367
  type: Output
2305
2368
  }] } });
2306
2369
 
2307
2370
  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] }); }
2371
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: PeriodSelectorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
2372
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.2.4", ngImport: i0, type: PeriodSelectorModule, declarations: [PeriodSelectorComponent, PeriodSelectorModalComponent], imports: [CommonModule, SharedDhis2UiModule], exports: [PeriodSelectorComponent, PeriodSelectorModalComponent] }); }
2373
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: PeriodSelectorModule, imports: [CommonModule, SharedDhis2UiModule] }); }
2311
2374
  }
2312
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PeriodSelectorModule, decorators: [{
2375
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: PeriodSelectorModule, decorators: [{
2313
2376
  type: NgModule,
2314
2377
  args: [{
2315
2378
  imports: [CommonModule, SharedDhis2UiModule],
2316
- declarations: [PeriodSelectorComponent],
2317
- exports: [PeriodSelectorComponent],
2379
+ declarations: [PeriodSelectorComponent, PeriodSelectorModalComponent],
2380
+ exports: [PeriodSelectorComponent, PeriodSelectorModalComponent],
2318
2381
  }]
2319
2382
  }] });
2320
2383
 
@@ -2328,7 +2391,7 @@ const USER_ORG_UNIT = 'USER_ORGUNIT';
2328
2391
  const USER_ORG_UNIT_CHILDREN = 'USER_ORGUNIT_CHILDREN';
2329
2392
  const USER_ORG_UNIT_GRANDCHILDREN = 'USER_ORGUNIT_GRANDCHILDREN';
2330
2393
  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;
2394
+ const hasLevelPrefix = (id) => id.includes(LEVEL_ID_PREFIX);
2332
2395
  const stripLevelPrefix = (id) => hasLevelPrefix(id) ? id.substr(LEVEL_ID_PREFIX.length + 1) : id;
2333
2396
  const stripGroupPrefix = (id) => hasGroupPrefix(id) ? id.substr(GROUP_ID_PREFIX.length + 1) : id;
2334
2397
  const removePrefix = (id) => stripGroupPrefix(stripLevelPrefix(id));
@@ -2471,11 +2534,11 @@ const OrgUnitDimension = ({ roots, selected, onSelect, hideGroupSelect, hideLeve
2471
2534
  if (checked && DYNAMIC_ORG_UNITS.includes(id)) {
2472
2535
  result = [
2473
2536
  ...result.filter((item) => DYNAMIC_ORG_UNITS.includes(item.id)),
2474
- { id, displayName },
2537
+ { id, displayName, type: 'USER_ORGUNIT' },
2475
2538
  ];
2476
2539
  }
2477
2540
  else if (checked) {
2478
- result.push({ id, path, name: displayName });
2541
+ result.push({ id, path, name: displayName, type: 'ORGUNIT' });
2479
2542
  }
2480
2543
  else {
2481
2544
  result = [...result.filter((item) => item.id !== id)];
@@ -2511,14 +2574,16 @@ const OrgUnitDimension = ({ roots, selected, onSelect, hideGroupSelect, hideLeve
2511
2574
  id: ouIdHelper.addLevelPrefix(id),
2512
2575
  name: ouLevels?.find((level) => level.id === id)
2513
2576
  ?.displayName,
2577
+ type: 'ORGUNIT_LEVEL',
2514
2578
  }));
2515
- setSelectedItems([
2579
+ const updatedSelectedItems = [
2516
2580
  ...selectedItems.filter((ou) => !ouIdHelper.hasLevelPrefix(ou.id)),
2517
2581
  ...items,
2518
- ]);
2582
+ ];
2583
+ setSelectedItems(updatedSelectedItems);
2519
2584
  onSelect({
2520
2585
  dimensionId: DIMENSION_ID_ORGUNIT,
2521
- items: selectedItems,
2586
+ items: updatedSelectedItems,
2522
2587
  });
2523
2588
  };
2524
2589
  const onGroupChange = (ids) => {
@@ -2526,14 +2591,16 @@ const OrgUnitDimension = ({ roots, selected, onSelect, hideGroupSelect, hideLeve
2526
2591
  id: ouIdHelper.addGroupPrefix(id),
2527
2592
  name: (ouGroups?.find((group) => group.id === id) || {})
2528
2593
  .displayName,
2594
+ type: 'ORGUNIT_GROUP',
2529
2595
  }));
2530
- setSelectedItems([
2596
+ const updatedSelectedItems = [
2531
2597
  ...selectedItems.filter((ou) => !ouIdHelper.hasGroupPrefix(ou.id)),
2532
2598
  ...items,
2533
- ]);
2599
+ ];
2600
+ setSelectedItems(updatedSelectedItems);
2534
2601
  onSelect({
2535
2602
  dimensionId: DIMENSION_ID_ORGUNIT,
2536
- items: selectedItems,
2603
+ items: updatedSelectedItems,
2537
2604
  });
2538
2605
  };
2539
2606
  const getSummary = () => {
@@ -2737,34 +2804,144 @@ class OrganisationUnitSelectorComponent extends ReactWrapperComponent {
2737
2804
  onSelectItems(selectionEvent) {
2738
2805
  this.selectOrgUnits.emit(selectionEvent.items);
2739
2806
  }
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 }); }
2807
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: OrganisationUnitSelectorComponent, deps: [{ token: i0.ElementRef }, { token: i1.NgxDhis2HttpClientService }], target: i0.ɵɵFactoryTarget.Component }); }
2808
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.4", 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
2809
  }
2743
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: OrganisationUnitSelectorComponent, decorators: [{
2810
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: OrganisationUnitSelectorComponent, decorators: [{
2744
2811
  type: Component,
2745
2812
  args: [{
2746
2813
  selector: 'ng-dhis2-ui-org-unit-selector',
2747
2814
  template: '<ng-container><ng-container>',
2748
2815
  }]
2749
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.NgxDhis2HttpClientService }]; }, propDecorators: { selectedOrgUnits: [{
2816
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1.NgxDhis2HttpClientService }], propDecorators: { selectedOrgUnits: [{
2817
+ type: Input
2818
+ }], orgUnitSelectionConfig: [{
2819
+ type: Input
2820
+ }], selectOrgUnits: [{
2821
+ type: Output
2822
+ }] } });
2823
+
2824
+ class OrganisationUnitSelectorModalComponent extends ReactWrapperComponent {
2825
+ constructor(elementRef, httpClient) {
2826
+ super(elementRef);
2827
+ this.httpClient = httpClient;
2828
+ this.selectedOrgUnits = [];
2829
+ this.orgUnitSelectionConfig = new OrganisationUnitSelectionConfig();
2830
+ this.selectOrgUnits = new EventEmitter();
2831
+ this.cancel = new EventEmitter();
2832
+ this.confirm = new EventEmitter();
2833
+ this.props = {
2834
+ onSelect: (e) => {
2835
+ this.onSelectItems(e);
2836
+ },
2837
+ };
2838
+ }
2839
+ async ngAfterViewInit() {
2840
+ if (!this.elementRef)
2841
+ throw new Error('No element ref');
2842
+ this.reactDomRoot = ReactDOM.createRoot(this.elementRef.nativeElement);
2843
+ const rootOrgUnits = await this.getRootOrgUnits();
2844
+ const config = await this.getAppConfig();
2845
+ this.component = () => {
2846
+ const [selected, setSelected] = useState(this.selectedOrgUnits);
2847
+ return (React__default.createElement(Provider, { config: config }, React__default.createElement(Modal$1, { position: "middle", large: true },
2848
+ React__default.createElement(ModalTitle$1, null, "Organisation unit"),
2849
+ React__default.createElement(ModalContent$1, null,
2850
+ React__default.createElement(OrgUnitDimension, { selected: selected, hideGroupSelect: this.orgUnitSelectionConfig.hideGroupSelect, hideLevelSelect: this.orgUnitSelectionConfig.hideLevelSelect, hideUserOrgUnits: this.orgUnitSelectionConfig.hideUserOrgUnits, onSelect: (selectionEvent) => {
2851
+ setSelected(selectionEvent.items);
2852
+ }, orgUnitGroupPromise: this.getOrgUnitGroups(), orgUnitLevelPromise: this.getOrgUnitLevels(), roots: rootOrgUnits })),
2853
+ React__default.createElement(ModalActions$1, null,
2854
+ React__default.createElement(ButtonStrip$1, { end: true },
2855
+ React__default.createElement(Button$1, { onClick: () => {
2856
+ this.onCancel();
2857
+ } }, "Cancel"),
2858
+ React__default.createElement(Button$1, { primary: true, disabled: selected.length === 0, onClick: () => {
2859
+ this.onConfirm(selected);
2860
+ } }, "Confirm"))))));
2861
+ };
2862
+ this.render();
2863
+ }
2864
+ onCancel() {
2865
+ this.cancel.emit();
2866
+ }
2867
+ onConfirm(selectedItems) {
2868
+ this.confirm.emit(selectedItems);
2869
+ }
2870
+ async getAppConfig() {
2871
+ const systemInfo = (await firstValueFrom(this.httpClient.systemInfo()));
2872
+ return {
2873
+ baseUrl: (document?.location?.host?.includes('localhost')
2874
+ ? `${document.location.protocol}//${document.location.host}`
2875
+ : systemInfo['contextPath']),
2876
+ apiVersion: Number(((systemInfo['version'] || '')?.split('.') || [])[1]),
2877
+ };
2878
+ }
2879
+ getOrgUnitAttributeByUsage(usageType) {
2880
+ switch (usageType) {
2881
+ case 'DATA_ENTRY':
2882
+ return 'organisationUnits';
2883
+ case 'DATA_VIEW':
2884
+ return 'dataViewOrganisationUnits';
2885
+ default:
2886
+ return 'organisationUnits';
2887
+ }
2888
+ }
2889
+ getRootOrgUnits() {
2890
+ const orgUnitAttribute = this.getOrgUnitAttributeByUsage(this.orgUnitSelectionConfig.usageType);
2891
+ return firstValueFrom(this.httpClient
2892
+ .me()
2893
+ .pipe(map((user) => (user ? user[orgUnitAttribute] : []).map((orgUnit) => orgUnit.id))));
2894
+ }
2895
+ getOrgUnitGroups() {
2896
+ return firstValueFrom(this.httpClient
2897
+ .get('organisationUnitGroups.json?fields=id,displayName,name&paging=false')
2898
+ .pipe(map((res) => res?.['organisationUnitGroups'])));
2899
+ }
2900
+ getOrgUnitLevels() {
2901
+ return firstValueFrom(this.httpClient
2902
+ .get('organisationUnitLevels.json?fields=id,level,displayName,name&paging=false')
2903
+ .pipe(map((res) => res?.['organisationUnitLevels'])));
2904
+ }
2905
+ onSelectItems(selectionEvent) {
2906
+ this.selectOrgUnits.emit(selectionEvent.items);
2907
+ }
2908
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: OrganisationUnitSelectorModalComponent, deps: [{ token: i0.ElementRef }, { token: i1.NgxDhis2HttpClientService }], target: i0.ɵɵFactoryTarget.Component }); }
2909
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.4", 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"] }); }
2910
+ }
2911
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: OrganisationUnitSelectorModalComponent, decorators: [{
2912
+ type: Component,
2913
+ args: [{ selector: 'ng-dhis2-ui-org-unit-selector-modal', template: '<ng-container><ng-container>', styles: ["::ng-deep .layer{z-index:2!important}\n"] }]
2914
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1.NgxDhis2HttpClientService }], propDecorators: { selectedOrgUnits: [{
2750
2915
  type: Input
2751
2916
  }], orgUnitSelectionConfig: [{
2752
2917
  type: Input
2753
2918
  }], selectOrgUnits: [{
2754
2919
  type: Output
2920
+ }], cancel: [{
2921
+ type: Output
2922
+ }], confirm: [{
2923
+ type: Output
2755
2924
  }] } });
2756
2925
 
2757
2926
  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] }); }
2927
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: OrganisationUnitSelectorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
2928
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.2.4", ngImport: i0, type: OrganisationUnitSelectorModule, declarations: [OrganisationUnitSelectorComponent,
2929
+ OrganisationUnitSelectorModalComponent], imports: [CommonModule, SharedDhis2UiModule], exports: [OrganisationUnitSelectorComponent,
2930
+ OrganisationUnitSelectorModalComponent] }); }
2931
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: OrganisationUnitSelectorModule, imports: [CommonModule, SharedDhis2UiModule] }); }
2761
2932
  }
2762
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: OrganisationUnitSelectorModule, decorators: [{
2933
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: OrganisationUnitSelectorModule, decorators: [{
2763
2934
  type: NgModule,
2764
2935
  args: [{
2765
2936
  imports: [CommonModule, SharedDhis2UiModule],
2766
- declarations: [OrganisationUnitSelectorComponent],
2767
- exports: [OrganisationUnitSelectorComponent],
2937
+ declarations: [
2938
+ OrganisationUnitSelectorComponent,
2939
+ OrganisationUnitSelectorModalComponent,
2940
+ ],
2941
+ exports: [
2942
+ OrganisationUnitSelectorComponent,
2943
+ OrganisationUnitSelectorModalComponent,
2944
+ ],
2768
2945
  }]
2769
2946
  }] });
2770
2947
 
@@ -2776,5 +2953,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
2776
2953
  * Generated bundle index. Do not edit.
2777
2954
  */
2778
2955
 
2779
- export { ButtonComponent, ButtonModule, HeaderBarComponent, HeaderBarModule, NgDhis2UiModule, OrganisationUnitSelectorComponent, OrganisationUnitSelectorModule, PeriodSelectorComponent, PeriodSelectorModule, ReactWrapperComponent, ReactWrapperModule };
2956
+ export { ButtonComponent, ButtonModule, HeaderBarComponent, HeaderBarModule, OrganisationUnitSelectorComponent, OrganisationUnitSelectorModalComponent, OrganisationUnitSelectorModule, PeriodSelectorComponent, PeriodSelectorModalComponent, PeriodSelectorModule, ReactWrapperComponent, ReactWrapperModule };
2780
2957
  //# sourceMappingURL=iapps-ng-dhis2-ui.mjs.map