@iapps/ng-dhis2-ui 1.0.3 → 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.
- package/esm2022/iapps-ng-dhis2-ui.mjs +1 -1
- package/esm2022/index.mjs +1 -2
- package/esm2022/lib/modules/button/button.component.mjs +14 -9
- package/esm2022/lib/modules/button/button.module.mjs +5 -5
- package/esm2022/lib/modules/button/index.mjs +1 -1
- package/esm2022/lib/modules/header-bar/header-bar.component.mjs +5 -5
- package/esm2022/lib/modules/header-bar/header-bar.module.mjs +5 -5
- package/esm2022/lib/modules/header-bar/index.mjs +1 -1
- package/esm2022/lib/modules/header-bar/models/header-bar-app.model.mjs +1 -1
- package/esm2022/lib/modules/header-bar/models/header-bar-data.model.mjs +1 -1
- package/esm2022/lib/modules/header-bar/models/header-bar-notification.model.mjs +1 -1
- package/esm2022/lib/modules/header-bar/models/index.mjs +1 -1
- package/esm2022/lib/modules/header-bar/utils/apps.mjs +1 -1
- package/esm2022/lib/modules/header-bar/utils/debug-info/debug-info-menu-item.mjs +14 -14
- package/esm2022/lib/modules/header-bar/utils/debug-info/debug-info-modal.mjs +1 -1
- package/esm2022/lib/modules/header-bar/utils/debug-info/debug-info-table.mjs +15 -15
- package/esm2022/lib/modules/header-bar/utils/debug-info/use-debug-info.mjs +1 -1
- package/esm2022/lib/modules/header-bar/utils/header-bar-context.mjs +2 -2
- package/esm2022/lib/modules/header-bar/utils/header-bar.mjs +1 -1
- package/esm2022/lib/modules/header-bar/utils/join-path.mjs +1 -1
- package/esm2022/lib/modules/header-bar/utils/logo-image.mjs +24 -24
- package/esm2022/lib/modules/header-bar/utils/logo.mjs +1 -1
- package/esm2022/lib/modules/header-bar/utils/notification-icon.mjs +47 -47
- package/esm2022/lib/modules/header-bar/utils/notifications.mjs +10 -10
- package/esm2022/lib/modules/header-bar/utils/profile/use-on-doc-click.mjs +1 -1
- package/esm2022/lib/modules/header-bar/utils/profile-menu/index.mjs +1 -1
- package/esm2022/lib/modules/header-bar/utils/profile-menu/profile-header.mjs +37 -37
- package/esm2022/lib/modules/header-bar/utils/profile-menu/profile-menu.mjs +28 -28
- package/esm2022/lib/modules/header-bar/utils/profile-menu/update-notification.mjs +24 -24
- package/esm2022/lib/modules/header-bar/utils/profile.mjs +25 -25
- package/esm2022/lib/modules/header-bar/utils/title.mjs +1 -1
- package/esm2022/lib/modules/organisation-unit-selector/components/OrgUnitDimension.mjs +14 -10
- package/esm2022/lib/modules/organisation-unit-selector/components/index.mjs +1 -1
- package/esm2022/lib/modules/organisation-unit-selector/components/styles/OrgUnitDimension.style.mjs +1 -1
- package/esm2022/lib/modules/organisation-unit-selector/components/utils/index.mjs +1 -1
- package/esm2022/lib/modules/organisation-unit-selector/components/utils/ouIdHelper/index.mjs +2 -2
- package/esm2022/lib/modules/organisation-unit-selector/components/utils/ouLevelUtils/index.mjs +1 -1
- package/esm2022/lib/modules/organisation-unit-selector/containers/organisation-unit-selector/organisation-unit-selector.component.mjs +88 -0
- package/esm2022/lib/modules/organisation-unit-selector/containers/organisation-unit-selector-modal/organisation-unit-selector-modal.component-modal.mjs +114 -0
- package/esm2022/lib/modules/organisation-unit-selector/index.mjs +3 -2
- package/esm2022/lib/modules/organisation-unit-selector/models/index.mjs +1 -1
- package/esm2022/lib/modules/organisation-unit-selector/models/organisation-unit-config.model.mjs +1 -1
- package/esm2022/lib/modules/organisation-unit-selector/organisation-unit-selector.module.mjs +17 -8
- package/esm2022/lib/modules/period-selector/components/FixedPeriodFilter.mjs +1 -1
- package/esm2022/lib/modules/period-selector/components/PeriodDimension.mjs +1 -1
- package/esm2022/lib/modules/period-selector/components/PeriodTransfer.mjs +1 -1
- package/esm2022/lib/modules/period-selector/components/RelativePeriodFilter.mjs +1 -1
- package/esm2022/lib/modules/period-selector/components/utils/fixedPeriods.mjs +17 -17
- package/esm2022/lib/modules/period-selector/components/utils/index.mjs +1 -1
- package/esm2022/lib/modules/period-selector/components/utils/periodTypes.mjs +1 -1
- package/esm2022/lib/modules/period-selector/components/utils/relativePeriods.mjs +1 -1
- package/esm2022/lib/modules/period-selector/containers/period-selector/period-selector.component.mjs +66 -0
- package/esm2022/lib/modules/period-selector/containers/period-selector-modal/period-selector-modal.component.mjs +82 -0
- package/esm2022/lib/modules/period-selector/index.mjs +3 -2
- package/esm2022/lib/modules/period-selector/period-selector.module.mjs +10 -9
- package/esm2022/lib/modules/react-wrapper/index.mjs +1 -1
- package/esm2022/lib/modules/react-wrapper/react-wrapper.component.mjs +9 -7
- package/esm2022/lib/modules/react-wrapper/react-wrapper.module.mjs +5 -5
- package/esm2022/lib/shared/assets/AssignedCategoriesIcon.mjs +1 -1
- package/esm2022/lib/shared/assets/DimensionItemIcons/PeriodIcon.mjs +1 -1
- package/esm2022/lib/shared/components/TransferOption.mjs +1 -1
- package/esm2022/lib/shared/components/index.mjs +1 -1
- package/esm2022/lib/shared/index.mjs +1 -1
- package/esm2022/lib/shared/shared.module.mjs +5 -5
- package/esm2022/lib/shared/styles/DimensionSelector.style.mjs +1 -1
- package/esm2022/lib/shared/styles/index.mjs +1 -1
- package/esm2022/lib/shared/utils/axis.mjs +1 -1
- package/esm2022/lib/shared/utils/axisGetDimension.mjs +1 -1
- package/esm2022/lib/shared/utils/axisHasDimension.mjs +1 -1
- package/esm2022/lib/shared/utils/dimension.mjs +1 -1
- package/esm2022/lib/shared/utils/dimensionGetItems.mjs +1 -1
- package/esm2022/lib/shared/utils/dimensionIs.mjs +1 -1
- package/esm2022/lib/shared/utils/dimensionIsEmpty.mjs +1 -1
- package/esm2022/lib/shared/utils/dimensionIsValid.mjs +1 -1
- package/esm2022/lib/shared/utils/dimensionSelectorHelper.mjs +1 -1
- package/esm2022/lib/shared/utils/index.mjs +1 -1
- package/esm2022/lib/shared/utils/layoutGetAllAxes.mjs +1 -1
- package/esm2022/lib/shared/utils/layoutGetAllDimensions.mjs +1 -1
- package/esm2022/lib/shared/utils/layoutGetDimension.mjs +1 -1
- package/esm2022/lib/shared/utils/layoutReplaceDimension.mjs +1 -1
- package/esm2022/lib/shared/utils/list.mjs +1 -1
- package/esm2022/lib/shared/utils/predefinedDimensions.mjs +3 -1
- package/fesm2022/iapps-ng-dhis2-ui.mjs +506 -317
- package/fesm2022/iapps-ng-dhis2-ui.mjs.map +1 -1
- package/index.d.ts +0 -1
- package/lib/modules/button/button.component.d.ts +1 -2
- package/lib/modules/organisation-unit-selector/{organisation-unit-selector.component.d.ts → containers/organisation-unit-selector/organisation-unit-selector.component.d.ts} +3 -2
- package/lib/modules/organisation-unit-selector/containers/organisation-unit-selector-modal/organisation-unit-selector-modal.component-modal.d.ts +31 -0
- package/lib/modules/organisation-unit-selector/index.d.ts +2 -1
- package/lib/modules/organisation-unit-selector/organisation-unit-selector.module.d.ts +5 -4
- package/lib/modules/period-selector/{period-selector.component.d.ts → containers/period-selector/period-selector.component.d.ts} +1 -1
- package/lib/modules/period-selector/containers/period-selector-modal/period-selector-modal.component.d.ts +17 -0
- package/lib/modules/period-selector/index.d.ts +2 -1
- package/lib/modules/period-selector/period-selector.module.d.ts +5 -4
- package/lib/modules/react-wrapper/react-wrapper.component.d.ts +1 -2
- package/lib/shared/utils/predefinedDimensions.d.ts +2 -0
- package/package.json +1 -2
- package/esm2022/lib/modules/organisation-unit-selector/organisation-unit-selector.component.mjs +0 -78
- package/esm2022/lib/modules/period-selector/period-selector.component.mjs +0 -66
- package/esm2022/lib/ng-dhis2-ui.module.mjs +0 -15
- package/lib/ng-dhis2-ui.module.d.ts +0 -7
|
@@ -1,12 +1,12 @@
|
|
|
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 {
|
|
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';
|
|
8
8
|
import React__default, { useState, useCallback, useRef, useEffect, createContext, useContext, useMemo } from 'react';
|
|
9
|
-
import { useDataQuery, useConfig, useAlert, clearSensitiveCaches, DataProvider, useDataEngine } from '@dhis2/app-runtime';
|
|
9
|
+
import { useDataQuery, useConfig, useAlert, clearSensitiveCaches, DataProvider, useDataEngine, Provider } from '@dhis2/app-runtime';
|
|
10
10
|
import * as i1 from '@iapps/ngx-dhis2-http-client';
|
|
11
11
|
import * as ReactDOM from 'react-dom/client';
|
|
12
12
|
import { catchError, of, map, zip, firstValueFrom } from 'rxjs';
|
|
@@ -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: "
|
|
176
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
177
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
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: "
|
|
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 =
|
|
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
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
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 =
|
|
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
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
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
|
|
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
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
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
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
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
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
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
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
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
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
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
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
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
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
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
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
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
|
|
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
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
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
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
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
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
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
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
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,
|
|
@@ -1170,8 +1158,10 @@ class ReactWrapperComponent {
|
|
|
1170
1158
|
this.reactDomRoot?.unmount();
|
|
1171
1159
|
}
|
|
1172
1160
|
render() {
|
|
1173
|
-
if (!this.component)
|
|
1174
|
-
|
|
1161
|
+
if (!this.component) {
|
|
1162
|
+
console.warn('React component must be supplied');
|
|
1163
|
+
return;
|
|
1164
|
+
}
|
|
1175
1165
|
if (!this.reactDomRoot)
|
|
1176
1166
|
return;
|
|
1177
1167
|
const jsxContent = this.content?.nativeElement?.outerHTML
|
|
@@ -1182,15 +1172,15 @@ class ReactWrapperComponent {
|
|
|
1182
1172
|
jsxContent || '',
|
|
1183
1173
|
" "));
|
|
1184
1174
|
}
|
|
1185
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1186
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
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 }); }
|
|
1187
1177
|
}
|
|
1188
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1178
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: ReactWrapperComponent, decorators: [{
|
|
1189
1179
|
type: Directive,
|
|
1190
1180
|
args: [{
|
|
1191
1181
|
selector: 'ng-dhis2-ui-wrapper',
|
|
1192
1182
|
}]
|
|
1193
|
-
}], ctorParameters:
|
|
1183
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { props: [{
|
|
1194
1184
|
type: Input
|
|
1195
1185
|
}], component: [{
|
|
1196
1186
|
type: Input
|
|
@@ -1200,11 +1190,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
1200
1190
|
}] } });
|
|
1201
1191
|
|
|
1202
1192
|
class ReactWrapperModule {
|
|
1203
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1204
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
1205
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
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] }); }
|
|
1206
1196
|
}
|
|
1207
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1197
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: ReactWrapperModule, decorators: [{
|
|
1208
1198
|
type: NgModule,
|
|
1209
1199
|
args: [{
|
|
1210
1200
|
imports: [CommonModule],
|
|
@@ -1233,23 +1223,23 @@ class HeaderBarComponent extends ReactWrapperComponent {
|
|
|
1233
1223
|
: () => React__default.createElement("div", null, "Something went wrong");
|
|
1234
1224
|
this.render();
|
|
1235
1225
|
}
|
|
1236
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1237
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
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 }); }
|
|
1238
1228
|
}
|
|
1239
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1229
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: HeaderBarComponent, decorators: [{
|
|
1240
1230
|
type: Component,
|
|
1241
1231
|
args: [{
|
|
1242
1232
|
selector: 'ng-dhis2-ui-header-bar',
|
|
1243
1233
|
template: `<ng-container></ng-container>`,
|
|
1244
1234
|
}]
|
|
1245
|
-
}], ctorParameters:
|
|
1235
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1.NgxDhis2HttpClientService }] });
|
|
1246
1236
|
|
|
1247
1237
|
class HeaderBarModule {
|
|
1248
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1249
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
1250
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
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] }); }
|
|
1251
1241
|
}
|
|
1252
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1242
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: HeaderBarModule, decorators: [{
|
|
1253
1243
|
type: NgModule,
|
|
1254
1244
|
args: [{
|
|
1255
1245
|
imports: [CommonModule, SharedDhis2UiModule],
|
|
@@ -1266,12 +1256,15 @@ class ButtonComponent extends ReactWrapperComponent {
|
|
|
1266
1256
|
constructor() {
|
|
1267
1257
|
super(...arguments);
|
|
1268
1258
|
this.buttonClick = new EventEmitter();
|
|
1269
|
-
|
|
1270
|
-
|
|
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) => {
|
|
1271
1265
|
this.onButtonClick(e);
|
|
1272
|
-
},
|
|
1273
|
-
|
|
1274
|
-
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();
|
|
1275
1268
|
}
|
|
1276
1269
|
ngOnInit() {
|
|
1277
1270
|
this.props = {
|
|
@@ -1286,10 +1279,10 @@ class ButtonComponent extends ReactWrapperComponent {
|
|
|
1286
1279
|
onButtonClick(event) {
|
|
1287
1280
|
this.buttonClick.emit(event);
|
|
1288
1281
|
}
|
|
1289
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1290
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
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 }); }
|
|
1291
1284
|
}
|
|
1292
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1285
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: ButtonComponent, decorators: [{
|
|
1293
1286
|
type: Component,
|
|
1294
1287
|
args: [{
|
|
1295
1288
|
selector: 'ng-dhis2-ui-button',
|
|
@@ -1314,11 +1307,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
1314
1307
|
}] } });
|
|
1315
1308
|
|
|
1316
1309
|
class ButtonModule {
|
|
1317
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1318
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
1319
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
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] }); }
|
|
1320
1313
|
}
|
|
1321
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1314
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: ButtonModule, decorators: [{
|
|
1322
1315
|
type: NgModule,
|
|
1323
1316
|
args: [{
|
|
1324
1317
|
declarations: [ButtonComponent],
|
|
@@ -1345,6 +1338,8 @@ const AssignedCategoriesIcon = () => {
|
|
|
1345
1338
|
const DIMENSION_ID_DATA = 'dx';
|
|
1346
1339
|
const DIMENSION_ID_PERIOD = 'pe';
|
|
1347
1340
|
const DIMENSION_ID_ORGUNIT = 'ou';
|
|
1341
|
+
const DIMENSION_ID_ORGUNIT_LEVEL = 'ouLevel';
|
|
1342
|
+
const DIMENSION_ID_ORGUNIT_GROUP = 'ouGroup';
|
|
1348
1343
|
const DIMENSION_ID_ASSIGNED_CATEGORIES = 'co';
|
|
1349
1344
|
const DIMENSION_PROP_NO_ITEMS = 'noItems';
|
|
1350
1345
|
const getFixedDimensions = () => ({
|
|
@@ -1744,23 +1739,23 @@ const getRelativePeriodIds = () => Object.values(getOptions$1())
|
|
|
1744
1739
|
.flat();
|
|
1745
1740
|
|
|
1746
1741
|
const PERIOD_TYPE_REGEX = {
|
|
1747
|
-
[DAILY]: /^([0-9]{4})([0-9]{2})([0-9]{2})$/,
|
|
1748
|
-
[WEEKLY]: /^([0-9]{4})()W([0-9]{1,2})$/,
|
|
1749
|
-
[BIWEEKLY]: /^([0-9]{4})BiW([0-9]{1,2})$/,
|
|
1750
|
-
[WEEKLYWED]: /^([0-9]{4})(Wed)W([0-9]{1,2})$/,
|
|
1751
|
-
[WEEKLYTHU]: /^([0-9]{4})(Thu)W([0-9]{1,2})$/,
|
|
1752
|
-
[WEEKLYSAT]: /^([0-9]{4})(Sat)W([0-9]{1,2})$/,
|
|
1753
|
-
[WEEKLYSUN]: /^([0-9]{4})(Sun)W([0-9]{1,2})$/,
|
|
1754
|
-
[MONTHLY]: /^([0-9]{4})([0-9]{2})$/,
|
|
1755
|
-
[BIMONTHLY]: /^([0-9]{4})([0-9]{2})B$/,
|
|
1756
|
-
[QUARTERLY]: /^([0-9]{4})Q([1234])$/,
|
|
1757
|
-
[SIXMONTHLY]: /^([0-9]{4})S([12])$/,
|
|
1758
|
-
[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]
|
|
1759
1754
|
// [SIXMONTHLYNOV]: /^([0-9]{4})NovS([12])$/, // YYYY"NovS"[1/2] Not supported?
|
|
1760
|
-
[YEARLY]: /^([0-9]{4})$/,
|
|
1761
|
-
[FYNOV]: /^([0-9]{4})Nov$/,
|
|
1762
|
-
[FYOCT]: /^([0-9]{4})Oct$/,
|
|
1763
|
-
[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"
|
|
1764
1759
|
[FYAPR]: /^([0-9]{4})April$/, // YYYY"April"
|
|
1765
1760
|
};
|
|
1766
1761
|
const getPeriods = ({ periodType, config, fnFilter, periodSettings = {}, }) => {
|
|
@@ -2247,6 +2242,76 @@ PeriodDimension.defaultProps = {
|
|
|
2247
2242
|
selectedPeriods: [],
|
|
2248
2243
|
};
|
|
2249
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
|
+
|
|
2250
2315
|
class PeriodSelectorComponent extends ReactWrapperComponent {
|
|
2251
2316
|
constructor(elementRef, httpClient) {
|
|
2252
2317
|
super(elementRef);
|
|
@@ -2290,29 +2355,29 @@ class PeriodSelectorComponent extends ReactWrapperComponent {
|
|
|
2290
2355
|
onSelectItems(selectionEvent) {
|
|
2291
2356
|
this.selectPeriods.emit(selectionEvent.items);
|
|
2292
2357
|
}
|
|
2293
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2294
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
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"] }); }
|
|
2295
2360
|
}
|
|
2296
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2361
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: PeriodSelectorComponent, decorators: [{
|
|
2297
2362
|
type: Component,
|
|
2298
2363
|
args: [{ selector: 'ng-dhis2-ui-period-selector', template: `<ng-container></ng-container>`, styles: ["::ng-deep .content-container{z-index:0!important}\n"] }]
|
|
2299
|
-
}], ctorParameters:
|
|
2364
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1.NgxDhis2HttpClientService }], propDecorators: { selectedPeriods: [{
|
|
2300
2365
|
type: Input
|
|
2301
2366
|
}], selectPeriods: [{
|
|
2302
2367
|
type: Output
|
|
2303
2368
|
}] } });
|
|
2304
2369
|
|
|
2305
2370
|
class PeriodSelectorModule {
|
|
2306
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2307
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
2308
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
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] }); }
|
|
2309
2374
|
}
|
|
2310
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2375
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: PeriodSelectorModule, decorators: [{
|
|
2311
2376
|
type: NgModule,
|
|
2312
2377
|
args: [{
|
|
2313
2378
|
imports: [CommonModule, SharedDhis2UiModule],
|
|
2314
|
-
declarations: [PeriodSelectorComponent],
|
|
2315
|
-
exports: [PeriodSelectorComponent],
|
|
2379
|
+
declarations: [PeriodSelectorComponent, PeriodSelectorModalComponent],
|
|
2380
|
+
exports: [PeriodSelectorComponent, PeriodSelectorModalComponent],
|
|
2316
2381
|
}]
|
|
2317
2382
|
}] });
|
|
2318
2383
|
|
|
@@ -2326,7 +2391,7 @@ const USER_ORG_UNIT = 'USER_ORGUNIT';
|
|
|
2326
2391
|
const USER_ORG_UNIT_CHILDREN = 'USER_ORGUNIT_CHILDREN';
|
|
2327
2392
|
const USER_ORG_UNIT_GRANDCHILDREN = 'USER_ORGUNIT_GRANDCHILDREN';
|
|
2328
2393
|
const hasGroupPrefix = (id) => id.substr(0, GROUP_ID_PREFIX.length) === GROUP_ID_PREFIX;
|
|
2329
|
-
const hasLevelPrefix = (id) => id.
|
|
2394
|
+
const hasLevelPrefix = (id) => id.includes(LEVEL_ID_PREFIX);
|
|
2330
2395
|
const stripLevelPrefix = (id) => hasLevelPrefix(id) ? id.substr(LEVEL_ID_PREFIX.length + 1) : id;
|
|
2331
2396
|
const stripGroupPrefix = (id) => hasGroupPrefix(id) ? id.substr(GROUP_ID_PREFIX.length + 1) : id;
|
|
2332
2397
|
const removePrefix = (id) => stripGroupPrefix(stripLevelPrefix(id));
|
|
@@ -2469,11 +2534,11 @@ const OrgUnitDimension = ({ roots, selected, onSelect, hideGroupSelect, hideLeve
|
|
|
2469
2534
|
if (checked && DYNAMIC_ORG_UNITS.includes(id)) {
|
|
2470
2535
|
result = [
|
|
2471
2536
|
...result.filter((item) => DYNAMIC_ORG_UNITS.includes(item.id)),
|
|
2472
|
-
{ id, displayName },
|
|
2537
|
+
{ id, displayName, type: 'USER_ORGUNIT' },
|
|
2473
2538
|
];
|
|
2474
2539
|
}
|
|
2475
2540
|
else if (checked) {
|
|
2476
|
-
result.push({ id, path, name: displayName });
|
|
2541
|
+
result.push({ id, path, name: displayName, type: 'ORGUNIT' });
|
|
2477
2542
|
}
|
|
2478
2543
|
else {
|
|
2479
2544
|
result = [...result.filter((item) => item.id !== id)];
|
|
@@ -2509,14 +2574,16 @@ const OrgUnitDimension = ({ roots, selected, onSelect, hideGroupSelect, hideLeve
|
|
|
2509
2574
|
id: ouIdHelper.addLevelPrefix(id),
|
|
2510
2575
|
name: ouLevels?.find((level) => level.id === id)
|
|
2511
2576
|
?.displayName,
|
|
2577
|
+
type: 'ORGUNIT_LEVEL',
|
|
2512
2578
|
}));
|
|
2513
|
-
|
|
2579
|
+
const updatedSelectedItems = [
|
|
2514
2580
|
...selectedItems.filter((ou) => !ouIdHelper.hasLevelPrefix(ou.id)),
|
|
2515
2581
|
...items,
|
|
2516
|
-
]
|
|
2582
|
+
];
|
|
2583
|
+
setSelectedItems(updatedSelectedItems);
|
|
2517
2584
|
onSelect({
|
|
2518
2585
|
dimensionId: DIMENSION_ID_ORGUNIT,
|
|
2519
|
-
items:
|
|
2586
|
+
items: updatedSelectedItems,
|
|
2520
2587
|
});
|
|
2521
2588
|
};
|
|
2522
2589
|
const onGroupChange = (ids) => {
|
|
@@ -2524,14 +2591,16 @@ const OrgUnitDimension = ({ roots, selected, onSelect, hideGroupSelect, hideLeve
|
|
|
2524
2591
|
id: ouIdHelper.addGroupPrefix(id),
|
|
2525
2592
|
name: (ouGroups?.find((group) => group.id === id) || {})
|
|
2526
2593
|
.displayName,
|
|
2594
|
+
type: 'ORGUNIT_GROUP',
|
|
2527
2595
|
}));
|
|
2528
|
-
|
|
2596
|
+
const updatedSelectedItems = [
|
|
2529
2597
|
...selectedItems.filter((ou) => !ouIdHelper.hasGroupPrefix(ou.id)),
|
|
2530
2598
|
...items,
|
|
2531
|
-
]
|
|
2599
|
+
];
|
|
2600
|
+
setSelectedItems(updatedSelectedItems);
|
|
2532
2601
|
onSelect({
|
|
2533
2602
|
dimensionId: DIMENSION_ID_ORGUNIT,
|
|
2534
|
-
items:
|
|
2603
|
+
items: updatedSelectedItems,
|
|
2535
2604
|
});
|
|
2536
2605
|
};
|
|
2537
2606
|
const getSummary = () => {
|
|
@@ -2693,9 +2762,19 @@ class OrganisationUnitSelectorComponent extends ReactWrapperComponent {
|
|
|
2693
2762
|
throw new Error('No element ref');
|
|
2694
2763
|
this.reactDomRoot = ReactDOM.createRoot(this.elementRef.nativeElement);
|
|
2695
2764
|
const rootOrgUnits = await this.getRootOrgUnits();
|
|
2696
|
-
|
|
2765
|
+
const config = await this.getAppConfig();
|
|
2766
|
+
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 })));
|
|
2697
2767
|
this.render();
|
|
2698
2768
|
}
|
|
2769
|
+
async getAppConfig() {
|
|
2770
|
+
const systemInfo = (await firstValueFrom(this.httpClient.systemInfo()));
|
|
2771
|
+
return {
|
|
2772
|
+
baseUrl: (document?.location?.host?.includes('localhost')
|
|
2773
|
+
? `${document.location.protocol}//${document.location.host}`
|
|
2774
|
+
: systemInfo['contextPath']),
|
|
2775
|
+
apiVersion: Number(((systemInfo['version'] || '')?.split('.') || [])[1]),
|
|
2776
|
+
};
|
|
2777
|
+
}
|
|
2699
2778
|
getOrgUnitAttributeByUsage(usageType) {
|
|
2700
2779
|
switch (usageType) {
|
|
2701
2780
|
case 'DATA_ENTRY':
|
|
@@ -2725,34 +2804,144 @@ class OrganisationUnitSelectorComponent extends ReactWrapperComponent {
|
|
|
2725
2804
|
onSelectItems(selectionEvent) {
|
|
2726
2805
|
this.selectOrgUnits.emit(selectionEvent.items);
|
|
2727
2806
|
}
|
|
2728
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2729
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
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 }); }
|
|
2730
2809
|
}
|
|
2731
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2810
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: OrganisationUnitSelectorComponent, decorators: [{
|
|
2732
2811
|
type: Component,
|
|
2733
2812
|
args: [{
|
|
2734
2813
|
selector: 'ng-dhis2-ui-org-unit-selector',
|
|
2735
2814
|
template: '<ng-container><ng-container>',
|
|
2736
2815
|
}]
|
|
2737
|
-
}], ctorParameters:
|
|
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: [{
|
|
2738
2915
|
type: Input
|
|
2739
2916
|
}], orgUnitSelectionConfig: [{
|
|
2740
2917
|
type: Input
|
|
2741
2918
|
}], selectOrgUnits: [{
|
|
2742
2919
|
type: Output
|
|
2920
|
+
}], cancel: [{
|
|
2921
|
+
type: Output
|
|
2922
|
+
}], confirm: [{
|
|
2923
|
+
type: Output
|
|
2743
2924
|
}] } });
|
|
2744
2925
|
|
|
2745
2926
|
class OrganisationUnitSelectorModule {
|
|
2746
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2747
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
2748
|
-
|
|
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] }); }
|
|
2749
2932
|
}
|
|
2750
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2933
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: OrganisationUnitSelectorModule, decorators: [{
|
|
2751
2934
|
type: NgModule,
|
|
2752
2935
|
args: [{
|
|
2753
2936
|
imports: [CommonModule, SharedDhis2UiModule],
|
|
2754
|
-
declarations: [
|
|
2755
|
-
|
|
2937
|
+
declarations: [
|
|
2938
|
+
OrganisationUnitSelectorComponent,
|
|
2939
|
+
OrganisationUnitSelectorModalComponent,
|
|
2940
|
+
],
|
|
2941
|
+
exports: [
|
|
2942
|
+
OrganisationUnitSelectorComponent,
|
|
2943
|
+
OrganisationUnitSelectorModalComponent,
|
|
2944
|
+
],
|
|
2756
2945
|
}]
|
|
2757
2946
|
}] });
|
|
2758
2947
|
|
|
@@ -2764,5 +2953,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
2764
2953
|
* Generated bundle index. Do not edit.
|
|
2765
2954
|
*/
|
|
2766
2955
|
|
|
2767
|
-
export { ButtonComponent, ButtonModule, HeaderBarComponent, HeaderBarModule,
|
|
2956
|
+
export { ButtonComponent, ButtonModule, HeaderBarComponent, HeaderBarModule, OrganisationUnitSelectorComponent, OrganisationUnitSelectorModalComponent, OrganisationUnitSelectorModule, PeriodSelectorComponent, PeriodSelectorModalComponent, PeriodSelectorModule, ReactWrapperComponent, ReactWrapperModule };
|
|
2768
2957
|
//# sourceMappingURL=iapps-ng-dhis2-ui.mjs.map
|