@iapps/ng-dhis2-ui 1.2.111 → 1.2.113
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/fesm2022/iapps-ng-dhis2-ui.mjs +90 -173
- package/fesm2022/iapps-ng-dhis2-ui.mjs.map +1 -1
- package/index.d.ts +8 -15
- package/package.json +1 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import * as i1
|
|
1
|
+
import * as i1 from '@angular/common';
|
|
2
2
|
import { CommonModule } from '@angular/common';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { NgModule, ContentChild, Input, Directive, Component, EventEmitter, Output,
|
|
4
|
+
import { NgModule, ContentChild, Input, Directive, inject, ElementRef, Component, EventEmitter, Output, NgZone, input, ChangeDetectionStrategy, Injectable, model, computed, signal, effect, ViewChildren } from '@angular/core';
|
|
5
5
|
import { useDataQuery, useConfig, useAlert, clearSensitiveCaches, DataProvider, useDataEngine, Provider } from '@dhis2/app-runtime';
|
|
6
|
-
import * as i1 from '@iapps/ngx-dhis2-http-client';
|
|
7
6
|
import * as React from 'react';
|
|
8
7
|
import React__default, { useState, useCallback, useRef, useEffect, createContext, useContext, useMemo } from 'react';
|
|
9
8
|
import * as ReactDOM from 'react-dom/client';
|
|
10
|
-
import { catchError, of,
|
|
9
|
+
import { from, map, catchError, of, zip, firstValueFrom, filter, take, Subject, takeUntil } from 'rxjs';
|
|
10
|
+
import parse from 'html-react-parser';
|
|
11
11
|
import i18n from '@dhis2/d2-i18n';
|
|
12
12
|
import { colors, theme, spacers } from '@dhis2/ui-constants';
|
|
13
13
|
import PropTypes from 'prop-types';
|
|
@@ -23,7 +23,6 @@ import { Divider } from '@dhis2-ui/divider';
|
|
|
23
23
|
import { Layer } from '@dhis2-ui/layer';
|
|
24
24
|
import { CircularLoader } from '@dhis2-ui/loader';
|
|
25
25
|
import { MenuItem, MenuDivider } from '@dhis2-ui/menu';
|
|
26
|
-
import parse from 'html-react-parser';
|
|
27
26
|
import { Button as Button$1, IconDimensionOrgUnit16, IconClock16, IconDimensionData16, spacers as spacers$1, colors as colors$1, IconEdit16, theme as theme$1, Tooltip, IconChevronRight16, 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, CircularLoader as CircularLoader$1, Chip, DataTableToolbar, DropdownButton, FlyoutMenu, CalendarInput, TableHead, DataTableRow, DataTableColumnHeader, Layer as Layer$1, Popper, MenuItem as MenuItem$1, IconMore24, DataTableCell, TableBody as TableBody$1, Pagination as Pagination$1, TableFoot, DataTable, FileInputField, FileListItem, MultiSelectField, TextAreaField } from '@dhis2/ui';
|
|
28
27
|
import { isObject, isString, debounce, sortBy, isArray, find, camelCase, flatten, isUndefined, head, isEmpty } from 'lodash';
|
|
29
28
|
import cx from 'classnames';
|
|
@@ -51,6 +50,50 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImpor
|
|
|
51
50
|
}]
|
|
52
51
|
}] });
|
|
53
52
|
|
|
53
|
+
window.React = React;
|
|
54
|
+
class ReactWrapperModule {
|
|
55
|
+
constructor(elementRef) {
|
|
56
|
+
this.elementRef = elementRef;
|
|
57
|
+
}
|
|
58
|
+
ngAfterViewInit() {
|
|
59
|
+
if (!this.elementRef)
|
|
60
|
+
throw new Error('No element ref');
|
|
61
|
+
this.reactDomRoot = ReactDOM.createRoot(this.elementRef.nativeElement);
|
|
62
|
+
this.render();
|
|
63
|
+
}
|
|
64
|
+
ngOnDestroy() {
|
|
65
|
+
this.reactDomRoot?.unmount();
|
|
66
|
+
}
|
|
67
|
+
render() {
|
|
68
|
+
if (!this.component) {
|
|
69
|
+
console.warn('React component must be supplied');
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
if (!this.reactDomRoot)
|
|
73
|
+
return;
|
|
74
|
+
const jsxContent = this.content?.nativeElement?.outerHTML
|
|
75
|
+
? parse(this.content?.nativeElement?.outerHTML)
|
|
76
|
+
: undefined;
|
|
77
|
+
this.reactDomRoot.render(React.createElement(this.component, this.props, jsxContent || ''));
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: ReactWrapperModule, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
81
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.1.3", type: ReactWrapperModule, isStandalone: true, selector: "ng-dhis2-ui-wrapper", inputs: { props: "props", component: "component" }, queries: [{ propertyName: "content", first: true, predicate: ["ngDhis2UiContent"], descendants: true }], ngImport: i0 }); }
|
|
82
|
+
}
|
|
83
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: ReactWrapperModule, decorators: [{
|
|
84
|
+
type: Directive,
|
|
85
|
+
args: [{
|
|
86
|
+
selector: 'ng-dhis2-ui-wrapper',
|
|
87
|
+
}]
|
|
88
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { props: [{
|
|
89
|
+
type: Input
|
|
90
|
+
}], component: [{
|
|
91
|
+
type: Input
|
|
92
|
+
}], content: [{
|
|
93
|
+
type: ContentChild,
|
|
94
|
+
args: ['ngDhis2UiContent']
|
|
95
|
+
}] } });
|
|
96
|
+
|
|
54
97
|
// Copyright 2023 UDSM DHIS2 Lab. All rights reserved.
|
|
55
98
|
// Use of this source code is governed by a BSD-style
|
|
56
99
|
// license that can be found in the LICENSE file.
|
|
@@ -86,15 +129,15 @@ class HeaderBarNotification {
|
|
|
86
129
|
// Use of this source code is governed by a BSD-style
|
|
87
130
|
// license that can be found in the LICENSE file.
|
|
88
131
|
class HeaderBarData {
|
|
89
|
-
constructor(
|
|
90
|
-
this.
|
|
132
|
+
constructor(httpInstance) {
|
|
133
|
+
this.httpInstance = httpInstance;
|
|
91
134
|
}
|
|
92
135
|
getApps() {
|
|
93
|
-
return this.
|
|
94
|
-
.get('dhis-web-commons/menu/getModules.action', {
|
|
136
|
+
return from(this.httpInstance.get('dhis-web-commons/menu/getModules.action', {
|
|
95
137
|
useRootUrl: true,
|
|
96
|
-
})
|
|
97
|
-
|
|
138
|
+
})).pipe(map((result) => result.data || {
|
|
139
|
+
modules: [],
|
|
140
|
+
}), catchError(() => of({
|
|
98
141
|
modules: [],
|
|
99
142
|
})), map((result) => {
|
|
100
143
|
return (result?.modules || [])
|
|
@@ -103,12 +146,12 @@ class HeaderBarData {
|
|
|
103
146
|
}));
|
|
104
147
|
}
|
|
105
148
|
getNotifications() {
|
|
106
|
-
return this.
|
|
107
|
-
|
|
108
|
-
|
|
149
|
+
return from(this.httpInstance.get('me/dashboard')).pipe(map((notificationResponse) => notificationResponse?.data
|
|
150
|
+
? new HeaderBarNotification(notificationResponse?.data)
|
|
151
|
+
: null));
|
|
109
152
|
}
|
|
110
153
|
get() {
|
|
111
|
-
return zip(this.getApps(), this.
|
|
154
|
+
return zip(this.getApps(), from(this.httpInstance.get('systemSettings/helpPageLink')).pipe(map((response) => response?.data)), from(this.httpInstance.get('me/dashboard')).pipe(map((response) => response?.data)), from(this.httpInstance.get('systemSettings/applicationTitle')).pipe(map((response) => response?.data)), from(this.httpInstance.get('me.json?fields=authorities,avatar,email,name,settings')).pipe(map((response) => response?.data))).pipe(map((response) => {
|
|
112
155
|
if (response) {
|
|
113
156
|
const [apps, help, notifications, title, user] = response;
|
|
114
157
|
this.apps = apps;
|
|
@@ -1017,73 +1060,31 @@ HeaderBar.propTypes = {
|
|
|
1017
1060
|
onApplyAvailableUpdate: PropTypes.func,
|
|
1018
1061
|
};
|
|
1019
1062
|
|
|
1020
|
-
window.React = React;
|
|
1021
|
-
class ReactWrapperModule {
|
|
1022
|
-
constructor(elementRef) {
|
|
1023
|
-
this.elementRef = elementRef;
|
|
1024
|
-
}
|
|
1025
|
-
ngAfterViewInit() {
|
|
1026
|
-
if (!this.elementRef)
|
|
1027
|
-
throw new Error('No element ref');
|
|
1028
|
-
this.reactDomRoot = ReactDOM.createRoot(this.elementRef.nativeElement);
|
|
1029
|
-
this.render();
|
|
1030
|
-
}
|
|
1031
|
-
ngOnDestroy() {
|
|
1032
|
-
this.reactDomRoot?.unmount();
|
|
1033
|
-
}
|
|
1034
|
-
render() {
|
|
1035
|
-
if (!this.component) {
|
|
1036
|
-
console.warn('React component must be supplied');
|
|
1037
|
-
}
|
|
1038
|
-
else {
|
|
1039
|
-
if (!this.reactDomRoot)
|
|
1040
|
-
return;
|
|
1041
|
-
const jsxContent = this.content?.nativeElement?.outerHTML
|
|
1042
|
-
? parse(this.content?.nativeElement?.outerHTML)
|
|
1043
|
-
: undefined;
|
|
1044
|
-
this.reactDomRoot.render(React.createElement(this.component, this.props, jsxContent || ''));
|
|
1045
|
-
}
|
|
1046
|
-
}
|
|
1047
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: ReactWrapperModule, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1048
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.1.3", type: ReactWrapperModule, isStandalone: true, selector: "ng-dhis2-ui-wrapper", inputs: { props: "props", component: "component" }, queries: [{ propertyName: "content", first: true, predicate: ["ngDhis2UiContent"], descendants: true }], ngImport: i0 }); }
|
|
1049
|
-
}
|
|
1050
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: ReactWrapperModule, decorators: [{
|
|
1051
|
-
type: Directive,
|
|
1052
|
-
args: [{
|
|
1053
|
-
selector: 'ng-dhis2-ui-wrapper',
|
|
1054
|
-
}]
|
|
1055
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { props: [{
|
|
1056
|
-
type: Input
|
|
1057
|
-
}], component: [{
|
|
1058
|
-
type: Input
|
|
1059
|
-
}], content: [{
|
|
1060
|
-
type: ContentChild,
|
|
1061
|
-
args: ['ngDhis2UiContent']
|
|
1062
|
-
}] } });
|
|
1063
|
-
|
|
1064
1063
|
class HeaderBarComponent extends ReactWrapperModule {
|
|
1065
|
-
constructor(
|
|
1066
|
-
super(
|
|
1067
|
-
this.httpClient = httpClient;
|
|
1064
|
+
constructor() {
|
|
1065
|
+
super(inject((ElementRef)));
|
|
1068
1066
|
}
|
|
1069
1067
|
async ngAfterViewInit() {
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1068
|
+
const d2 = window?.d2Web;
|
|
1069
|
+
if (d2) {
|
|
1070
|
+
if (!this.elementRef)
|
|
1071
|
+
throw new Error('No element ref');
|
|
1072
|
+
this.reactDomRoot = ReactDOM.createRoot(this.elementRef.nativeElement);
|
|
1073
|
+
const manifest = d2.appManifest;
|
|
1074
|
+
const data = await firstValueFrom(new HeaderBarData(d2.httpInstance).get());
|
|
1075
|
+
this.component = data
|
|
1076
|
+
? () => {
|
|
1077
|
+
const headerBarElement = React__default.createElement(HeaderBar, {
|
|
1078
|
+
appName: manifest?.name,
|
|
1079
|
+
data: data,
|
|
1080
|
+
});
|
|
1081
|
+
return React__default.createElement(DataProvider, null, headerBarElement);
|
|
1082
|
+
}
|
|
1083
|
+
: () => React__default.createElement('div', null, 'Something went wrong');
|
|
1084
|
+
this.render();
|
|
1085
|
+
}
|
|
1085
1086
|
}
|
|
1086
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: HeaderBarComponent, deps: [
|
|
1087
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: HeaderBarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1087
1088
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.3", type: HeaderBarComponent, isStandalone: false, selector: "ng-dhis2-ui-header-bar", usesInheritance: true, ngImport: i0, template: `<ng-container></ng-container>`, isInline: true }); }
|
|
1088
1089
|
}
|
|
1089
1090
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: HeaderBarComponent, decorators: [{
|
|
@@ -1093,7 +1094,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImpor
|
|
|
1093
1094
|
template: `<ng-container></ng-container>`,
|
|
1094
1095
|
standalone: false,
|
|
1095
1096
|
}]
|
|
1096
|
-
}], ctorParameters: () => [
|
|
1097
|
+
}], ctorParameters: () => [] });
|
|
1097
1098
|
|
|
1098
1099
|
class HeaderBarModule {
|
|
1099
1100
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: HeaderBarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
@@ -4041,30 +4042,23 @@ const LineListTable = ({ columns, data, pager, setPager, getTextColorFromBackGro
|
|
|
4041
4042
|
};
|
|
4042
4043
|
|
|
4043
4044
|
class LineListService {
|
|
4044
|
-
constructor(httpClient) {
|
|
4045
|
-
this.httpClient = httpClient;
|
|
4046
|
-
}
|
|
4047
|
-
/**
|
|
4048
|
-
* Fetch orgUnit names for given orgUnit IDs
|
|
4049
|
-
*/
|
|
4050
4045
|
fetchOrgUnits(orgUnitIds) {
|
|
4046
|
+
const d2 = window.d2Web;
|
|
4051
4047
|
const idsQuery = `filter=id:in:[${orgUnitIds}]`;
|
|
4052
|
-
return
|
|
4053
|
-
.get(`organisationUnits.json?fields=id,name&paging=false&${idsQuery}`)
|
|
4054
|
-
.pipe(map$1((response) => {
|
|
4048
|
+
return from(d2.httpInstance.get(`organisationUnits.json?fields=id,name&paging=false&${idsQuery}`)).pipe(map$1((response) => {
|
|
4055
4049
|
const orgUnitsMap = new Map();
|
|
4056
|
-
response
|
|
4050
|
+
(response?.data?.['organisationUnits'] || []).forEach((orgUnit) => {
|
|
4057
4051
|
orgUnitsMap.set(orgUnit.id, orgUnit.name);
|
|
4058
4052
|
});
|
|
4059
4053
|
return orgUnitsMap;
|
|
4060
4054
|
}));
|
|
4061
4055
|
}
|
|
4062
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: LineListService, deps: [
|
|
4056
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: LineListService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
4063
4057
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: LineListService }); }
|
|
4064
4058
|
}
|
|
4065
4059
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: LineListService, decorators: [{
|
|
4066
4060
|
type: Injectable
|
|
4067
|
-
}]
|
|
4061
|
+
}] });
|
|
4068
4062
|
|
|
4069
4063
|
const getTrackedEntityTableData = (response, programId, pager, metaData, searcheableDataElements) => {
|
|
4070
4064
|
const teisRaw = response.data
|
|
@@ -6505,66 +6499,13 @@ const buildReadableFullName = (unit) => {
|
|
|
6505
6499
|
return pathParts.join(' / ');
|
|
6506
6500
|
};
|
|
6507
6501
|
const OrgUnitFormField = (props) => {
|
|
6508
|
-
// const { onSelectOrgUnit, label, required, selected, disabled, key, customOrgUnitRoots } = props;
|
|
6509
|
-
// const d2 = (window as unknown as D2Window)?.d2Web;
|
|
6510
|
-
// const classes = useDynamicStyles(orgUnitFieldStyles);
|
|
6511
|
-
// const config = useMemo(() => {
|
|
6512
|
-
// return d2.systemInfo?.toInitObject();
|
|
6513
|
-
// }, []);
|
|
6514
|
-
// TODO: Improvements
|
|
6515
6502
|
const { onSelectOrgUnit, label, required, selected, disabled, key, field, customOrgUnitRoots, } = props;
|
|
6516
6503
|
const d2 = window?.d2Web;
|
|
6517
6504
|
const classes = useDynamicStyles$2(orgUnitFieldStyles);
|
|
6518
6505
|
const config = useMemo(() => d2.systemInfo?.toInitObject(), []);
|
|
6519
|
-
// TODO: Improvements
|
|
6520
|
-
// New state to hold full orgUnit info from customOrgUnitRoots
|
|
6521
|
-
// const [configuredRootInfo, setConfiguredRootInfo] = useState<
|
|
6522
|
-
// { id: string; name: string; code?: string; path: string; level: number }[]
|
|
6523
|
-
// >([]);
|
|
6524
6506
|
const [configuredRootInfo, setConfiguredRootInfo] = useState([]);
|
|
6525
6507
|
const [configuredRootsLoading, setConfiguredRootsLoading] = useState(false);
|
|
6526
|
-
// Strike-through (fallback) current user roots
|
|
6527
6508
|
const [useCustomRoots, setUseCustomRoots] = useState(customOrgUnitRoots && customOrgUnitRoots.length ? true : false);
|
|
6528
|
-
// TODO: START | Deprecated Approach that doesn't support passing ID of Organisation Unit as root
|
|
6529
|
-
// const rootOrgUnits = useMemo(() => {
|
|
6530
|
-
// return d2.currentUser?.organisationUnits || [];
|
|
6531
|
-
// }, []);
|
|
6532
|
-
// TODO: END | Deprecated Approach that doesn't support passing ID of Organisation Unit as root
|
|
6533
|
-
// TODO: Improvements
|
|
6534
|
-
// Fetch matching configured roots on mount or when key changes:
|
|
6535
|
-
// useEffect(() => {
|
|
6536
|
-
// const matchList =
|
|
6537
|
-
// customOrgUnitRoots?.filter((entry) => entry.field === (field || key)) ||
|
|
6538
|
-
// [];
|
|
6539
|
-
// if (matchList?.length > 0) {
|
|
6540
|
-
// setUseCustomRoots(true);
|
|
6541
|
-
// Promise.all(
|
|
6542
|
-
// (matchList || []).map((entry) =>
|
|
6543
|
-
// d2.httpInstance
|
|
6544
|
-
// .get(
|
|
6545
|
-
// `organisationUnits/${entry.orgUnit}.json?fields=id,displayName,name,code,path,level`
|
|
6546
|
-
// )
|
|
6547
|
-
// .then((res) => {
|
|
6548
|
-
// const u = res.data as OrgUnitResponse;
|
|
6549
|
-
// return {
|
|
6550
|
-
// id: u.id,
|
|
6551
|
-
// name: u.displayName || u.name,
|
|
6552
|
-
// code: u.code,
|
|
6553
|
-
// path: u.path,
|
|
6554
|
-
// level: u.level,
|
|
6555
|
-
// };
|
|
6556
|
-
// })
|
|
6557
|
-
// )
|
|
6558
|
-
// )
|
|
6559
|
-
// .then(setConfiguredRootInfo)
|
|
6560
|
-
// .catch((err) =>
|
|
6561
|
-
// console.warn(
|
|
6562
|
-
// `[OrgUnitFormField] Failed to fetch customOrgUnitRoots:`,
|
|
6563
|
-
// err
|
|
6564
|
-
// )
|
|
6565
|
-
// );
|
|
6566
|
-
// }
|
|
6567
|
-
// }, [customOrgUnitRoots, key, field, d2.httpInstance]);
|
|
6568
6509
|
useEffect(() => {
|
|
6569
6510
|
const matchList = customOrgUnitRoots?.filter((entry) => entry.field === (field || key)) ||
|
|
6570
6511
|
[];
|
|
@@ -6573,7 +6514,7 @@ const OrgUnitFormField = (props) => {
|
|
|
6573
6514
|
setConfiguredRootsLoading(true);
|
|
6574
6515
|
Promise.allSettled(matchList.map(async (orgUnitConfig) => {
|
|
6575
6516
|
try {
|
|
6576
|
-
const orgUnitResponse = await d2.httpInstance.get(`organisationUnits/${orgUnitConfig.orgUnit}.json?fields=id,displayName,name,code,path,level,ancestors[displayName],children[id,displayName,name,code,path,level,ancestors[displayName],children[id,displayName,name,code,path,level,ancestors[displayName]]]&paging=false`);
|
|
6517
|
+
const orgUnitResponse = await d2.httpInstance.get(`organisationUnits/${orgUnitConfig.orgUnit}.json?fields=id,displayName,name,code,path,level,ancestors[displayName],children[id,displayName,name,code,path,level,ancestors[displayName],children[id,displayName,name,code,path,level,ancestors[displayName],children[id,displayName,name,code,path,level,ancestors[displayName]]]]&paging=false`);
|
|
6577
6518
|
const rootOrgUnitData = orgUnitResponse.data;
|
|
6578
6519
|
const allDescendantOrgUnits = flattenChildren([rootOrgUnitData]);
|
|
6579
6520
|
const matchingConfig = customOrgUnitRoots?.find((config) => config.orgUnit === orgUnitConfig.orgUnit);
|
|
@@ -6605,6 +6546,7 @@ const OrgUnitFormField = (props) => {
|
|
|
6605
6546
|
const allFacilities = settledResults
|
|
6606
6547
|
.filter((result) => result.status === 'fulfilled')
|
|
6607
6548
|
.flatMap((result) => result.value);
|
|
6549
|
+
console.log("ALL FACILITIES::: ", allFacilities);
|
|
6608
6550
|
setConfiguredRootInfo(allFacilities);
|
|
6609
6551
|
setConfiguredRootsLoading(false);
|
|
6610
6552
|
})
|
|
@@ -6614,28 +6556,6 @@ const OrgUnitFormField = (props) => {
|
|
|
6614
6556
|
});
|
|
6615
6557
|
}
|
|
6616
6558
|
}, [customOrgUnitRoots, key, field, d2.httpInstance]);
|
|
6617
|
-
// const rootOrgUnits = useMemo(() => {
|
|
6618
|
-
// if (customOrgUnitRoots && customOrgUnitRoots.length > 0) {
|
|
6619
|
-
// return customOrgUnitRoots.map((id) => ({ id }));
|
|
6620
|
-
// }
|
|
6621
|
-
// return d2.currentUser?.organisationUnits || [];
|
|
6622
|
-
// }, [customOrgUnitRoots]);
|
|
6623
|
-
// const getExpandedItems = () => {
|
|
6624
|
-
// if (rootOrgUnits && rootOrgUnits.length === 1) {
|
|
6625
|
-
// return [`/${rootOrgUnits[0].id}`];
|
|
6626
|
-
// } else if (rootOrgUnits?.length > 1) {
|
|
6627
|
-
// return rootOrgUnits.map((root) => root.path);
|
|
6628
|
-
// }
|
|
6629
|
-
// return undefined;
|
|
6630
|
-
// };
|
|
6631
|
-
// TODO: Improvements
|
|
6632
|
-
// Decide which roots to render
|
|
6633
|
-
// const rootOrgUnits = useMemo(() => {
|
|
6634
|
-
// if (useCustomRoots && configuredRootInfo.length > 0) {
|
|
6635
|
-
// return configuredRootInfo.map((u) => u);
|
|
6636
|
-
// }
|
|
6637
|
-
// return d2.currentUser?.organisationUnits || [];
|
|
6638
|
-
// }, [useCustomRoots, configuredRootInfo, d2.currentUser]);
|
|
6639
6559
|
const rootOrgUnits = useMemo(() => {
|
|
6640
6560
|
if (useCustomRoots) {
|
|
6641
6561
|
if (configuredRootsLoading) {
|
|
@@ -6755,9 +6675,6 @@ const OrgUnitFormField = (props) => {
|
|
|
6755
6675
|
onSelectOrgUnit(event.id);
|
|
6756
6676
|
} })));
|
|
6757
6677
|
};
|
|
6758
|
-
const handleBlur = () => {
|
|
6759
|
-
// onBlur && onBlur(null);
|
|
6760
|
-
};
|
|
6761
6678
|
return (config && (React__default.createElement(Provider, { config: config, plugin: false, parentAlertsAdd: undefined, showAlertsInPlugin: false },
|
|
6762
6679
|
React__default.createElement("div", null,
|
|
6763
6680
|
label && (React__default.createElement("div", { className: classes.orgUnitFieldLabel },
|
|
@@ -7239,7 +7156,7 @@ class FormFieldComponent {
|
|
|
7239
7156
|
this._runtimeOptions = [...options];
|
|
7240
7157
|
}
|
|
7241
7158
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: FormFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
7242
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.3", type: FormFieldComponent, isStandalone: false, selector: "ng-dhis2-ui-form-field", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: true, transformFunction: null }, fieldConfig: { classPropertyName: "fieldConfig", publicName: "fieldConfig", isSignal: true, isRequired: true, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: false, isRequired: false, transformFunction: null }, isCheckBoxButton: { classPropertyName: "isCheckBoxButton", publicName: "isCheckBoxButton", isSignal: true, isRequired: false, transformFunction: null }, fieldClass: { classPropertyName: "fieldClass", publicName: "fieldClass", isSignal: true, isRequired: false, transformFunction: null }, programRuleActions: { classPropertyName: "programRuleActions", publicName: "programRuleActions", isSignal: true, isRequired: false, transformFunction: null }, dataEntities: { classPropertyName: "dataEntities", publicName: "dataEntities", isSignal: true, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: true, isRequired: false, transformFunction: null }, dataId: { classPropertyName: "dataId", publicName: "dataId", isSignal: true, isRequired: false, transformFunction: null }, customOrgUnitRoots: { classPropertyName: "customOrgUnitRoots", publicName: "customOrgUnitRoots", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { fieldUpdate: "fieldUpdate", immediateFieldUpdate: "immediateFieldUpdate", runtimeOptionChange: "runtimeOptionChange" }, usesOnChanges: true, ngImport: i0, template: "<div *ngIf=\"field()\" class=\"form-field-item\">\n <ng-dhis2-ui-form-field-item\n [field]=\"field()\"\n [fieldError]=\"runtimeError()\"\n [isValueAssigned]=\"isValueAssigned()\"\n [fieldConfig]=\"fieldConfig()\"\n [(form)]=\"form\"\n [dataId]=\"dataId()\"\n [customOrgUnitRoots]=\"customOrgUnitRoots()\"\n [value]=\"value()\"\n (update)=\"onValueChange()\"\n (immediateUpdate)=\"onImmediateChange($event)\"\n />\n</div>\n", styles: [".form-field-item{margin-bottom:16px}\n"], dependencies: [{ kind: "directive", type: i1
|
|
7159
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.3", type: FormFieldComponent, isStandalone: false, selector: "ng-dhis2-ui-form-field", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: true, transformFunction: null }, fieldConfig: { classPropertyName: "fieldConfig", publicName: "fieldConfig", isSignal: true, isRequired: true, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: false, isRequired: false, transformFunction: null }, isCheckBoxButton: { classPropertyName: "isCheckBoxButton", publicName: "isCheckBoxButton", isSignal: true, isRequired: false, transformFunction: null }, fieldClass: { classPropertyName: "fieldClass", publicName: "fieldClass", isSignal: true, isRequired: false, transformFunction: null }, programRuleActions: { classPropertyName: "programRuleActions", publicName: "programRuleActions", isSignal: true, isRequired: false, transformFunction: null }, dataEntities: { classPropertyName: "dataEntities", publicName: "dataEntities", isSignal: true, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: true, isRequired: false, transformFunction: null }, dataId: { classPropertyName: "dataId", publicName: "dataId", isSignal: true, isRequired: false, transformFunction: null }, customOrgUnitRoots: { classPropertyName: "customOrgUnitRoots", publicName: "customOrgUnitRoots", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { fieldUpdate: "fieldUpdate", immediateFieldUpdate: "immediateFieldUpdate", runtimeOptionChange: "runtimeOptionChange" }, usesOnChanges: true, ngImport: i0, template: "<div *ngIf=\"field()\" class=\"form-field-item\">\n <ng-dhis2-ui-form-field-item\n [field]=\"field()\"\n [fieldError]=\"runtimeError()\"\n [isValueAssigned]=\"isValueAssigned()\"\n [fieldConfig]=\"fieldConfig()\"\n [(form)]=\"form\"\n [dataId]=\"dataId()\"\n [customOrgUnitRoots]=\"customOrgUnitRoots()\"\n [value]=\"value()\"\n (update)=\"onValueChange()\"\n (immediateUpdate)=\"onImmediateChange($event)\"\n />\n</div>\n", styles: [".form-field-item{margin-bottom:16px}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: FormFieldItemComponent, selector: "ng-dhis2-ui-form-field-item" }] }); }
|
|
7243
7160
|
}
|
|
7244
7161
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: FormFieldComponent, decorators: [{
|
|
7245
7162
|
type: Component,
|
|
@@ -7379,7 +7296,7 @@ class FormComponent {
|
|
|
7379
7296
|
this.ruleProcessor.destroy();
|
|
7380
7297
|
}
|
|
7381
7298
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: FormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
7382
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.3", type: FormComponent, isStandalone: false, selector: "ng-dhis2-ui-form", inputs: { formConfig: { classPropertyName: "formConfig", publicName: "formConfig", isSignal: true, isRequired: false, transformFunction: null }, fields: { classPropertyName: "fields", publicName: "fields", isSignal: true, isRequired: true, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: true, transformFunction: null }, isFormHorizontal: { classPropertyName: "isFormHorizontal", publicName: "isFormHorizontal", isSignal: true, isRequired: false, transformFunction: null }, showSaveButton: { classPropertyName: "showSaveButton", publicName: "showSaveButton", isSignal: true, isRequired: false, transformFunction: null }, fieldsData: { classPropertyName: "fieldsData", publicName: "fieldsData", isSignal: true, isRequired: false, transformFunction: null }, fieldClass: { classPropertyName: "fieldClass", publicName: "fieldClass", isSignal: true, isRequired: false, transformFunction: null }, shouldRenderAsCheckBoxesButton: { classPropertyName: "shouldRenderAsCheckBoxesButton", publicName: "shouldRenderAsCheckBoxesButton", isSignal: true, isRequired: false, transformFunction: null }, programRuleActions: { classPropertyName: "programRuleActions", publicName: "programRuleActions", isSignal: true, isRequired: false, transformFunction: null }, dataEntities: { classPropertyName: "dataEntities", publicName: "dataEntities", isSignal: true, isRequired: false, transformFunction: null }, dataId: { classPropertyName: "dataId", publicName: "dataId", isSignal: true, isRequired: false, transformFunction: null }, customOrgUnitRoots: { classPropertyName: "customOrgUnitRoots", publicName: "customOrgUnitRoots", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { formUpdate: "formUpdate", formValidityUpdate: "formValidityUpdate" }, viewQueries: [{ propertyName: "fieldComponents", predicate: FormFieldComponent, descendants: true }], usesOnChanges: true, ngImport: i0, template: "<form [formGroup]=\"form()\" class=\"{{ configuration().directionClassName }}\">\n <!-- form name -->\n <div class=\"form-name\">\n <h2>{{ configuration().formName }}</h2>\n </div>\n <div\n *ngFor=\"let field of sanitizedFields\"\n class=\"form-field-{{ configuration().direction }}\"\n >\n <ng-dhis2-ui-form-field\n [field]=\"field\"\n [fieldConfig]=\"configuration().fieldConfig\"\n [form]=\"form()\"\n [fieldClass]=\"fieldClass()\"\n [dataEntities]=\"dataEntities()\"\n [dataId]=\"dataId()\"\n [customOrgUnitRoots]=\"customOrgUnitRoots()\"\n [programRuleActions]=\"programRuleActions()\"\n [isCheckBoxButton]=\"shouldRenderAsCheckBoxesButton()\"\n (fieldUpdate)=\"onFieldUpdate($event, field)\"\n (runtimeOptionChange)=\"onRunTimeOptionUpdate($event)\"\n />\n </div>\n</form>\n", styles: [".form-horizontal{display:flex;flex-wrap:wrap;gap:16px;width:100%}.hidden-field{display:none}.units-and-ranges span{margin-left:1%;font-weight:600}.for-warning{margin-left:8px}.form-field-vertical{margin-bottom:8px}.form-field-horizontal{flex:1;margin-bottom:8px;width:100%}\n"], dependencies: [{ kind: "directive", type: i1
|
|
7299
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.3", type: FormComponent, isStandalone: false, selector: "ng-dhis2-ui-form", inputs: { formConfig: { classPropertyName: "formConfig", publicName: "formConfig", isSignal: true, isRequired: false, transformFunction: null }, fields: { classPropertyName: "fields", publicName: "fields", isSignal: true, isRequired: true, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: true, transformFunction: null }, isFormHorizontal: { classPropertyName: "isFormHorizontal", publicName: "isFormHorizontal", isSignal: true, isRequired: false, transformFunction: null }, showSaveButton: { classPropertyName: "showSaveButton", publicName: "showSaveButton", isSignal: true, isRequired: false, transformFunction: null }, fieldsData: { classPropertyName: "fieldsData", publicName: "fieldsData", isSignal: true, isRequired: false, transformFunction: null }, fieldClass: { classPropertyName: "fieldClass", publicName: "fieldClass", isSignal: true, isRequired: false, transformFunction: null }, shouldRenderAsCheckBoxesButton: { classPropertyName: "shouldRenderAsCheckBoxesButton", publicName: "shouldRenderAsCheckBoxesButton", isSignal: true, isRequired: false, transformFunction: null }, programRuleActions: { classPropertyName: "programRuleActions", publicName: "programRuleActions", isSignal: true, isRequired: false, transformFunction: null }, dataEntities: { classPropertyName: "dataEntities", publicName: "dataEntities", isSignal: true, isRequired: false, transformFunction: null }, dataId: { classPropertyName: "dataId", publicName: "dataId", isSignal: true, isRequired: false, transformFunction: null }, customOrgUnitRoots: { classPropertyName: "customOrgUnitRoots", publicName: "customOrgUnitRoots", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { formUpdate: "formUpdate", formValidityUpdate: "formValidityUpdate" }, viewQueries: [{ propertyName: "fieldComponents", predicate: FormFieldComponent, descendants: true }], usesOnChanges: true, ngImport: i0, template: "<form [formGroup]=\"form()\" class=\"{{ configuration().directionClassName }}\">\n <!-- form name -->\n <div class=\"form-name\">\n <h2>{{ configuration().formName }}</h2>\n </div>\n <div\n *ngFor=\"let field of sanitizedFields\"\n class=\"form-field-{{ configuration().direction }}\"\n >\n <ng-dhis2-ui-form-field\n [field]=\"field\"\n [fieldConfig]=\"configuration().fieldConfig\"\n [form]=\"form()\"\n [fieldClass]=\"fieldClass()\"\n [dataEntities]=\"dataEntities()\"\n [dataId]=\"dataId()\"\n [customOrgUnitRoots]=\"customOrgUnitRoots()\"\n [programRuleActions]=\"programRuleActions()\"\n [isCheckBoxButton]=\"shouldRenderAsCheckBoxesButton()\"\n (fieldUpdate)=\"onFieldUpdate($event, field)\"\n (runtimeOptionChange)=\"onRunTimeOptionUpdate($event)\"\n />\n </div>\n</form>\n", styles: [".form-horizontal{display:flex;flex-wrap:wrap;gap:16px;width:100%}.hidden-field{display:none}.units-and-ranges span{margin-left:1%;font-weight:600}.for-warning{margin-left:8px}.form-field-vertical{margin-bottom:8px}.form-field-horizontal{flex:1;margin-bottom:8px;width:100%}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: FormFieldComponent, selector: "ng-dhis2-ui-form-field", inputs: ["field", "fieldConfig", "form", "isCheckBoxButton", "fieldClass", "programRuleActions", "dataEntities", "minDate", "maxDate", "dataId", "customOrgUnitRoots"], outputs: ["fieldUpdate", "immediateFieldUpdate", "runtimeOptionChange"] }] }); }
|
|
7383
7300
|
}
|
|
7384
7301
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: FormComponent, decorators: [{
|
|
7385
7302
|
type: Component,
|
|
@@ -7571,7 +7488,7 @@ class SectionFormComponent {
|
|
|
7571
7488
|
return valueValidity || repeatableDataValidity;
|
|
7572
7489
|
}
|
|
7573
7490
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: SectionFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
7574
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.3", type: SectionFormComponent, isStandalone: false, selector: "ng-dhis2-ui-section-form", inputs: { loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, formMetaData: { classPropertyName: "formMetaData", publicName: "formMetaData", isSignal: true, isRequired: true, transformFunction: null }, dataValueEntities: { classPropertyName: "dataValueEntities", publicName: "dataValueEntities", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { save: "save", formUpdate: "formUpdate", cancel: "cancel", formValidityUpdate: "formValidityUpdate" }, ngImport: i0, template: "<ng-container *ngIf=\"formMetaData()\">\n <ng-container *ngFor=\"let formSection of formMetaData().sections\">\n @if(formSection?.name; as sectionName) {\n <div class=\"form__section-name\">\n {{ sectionName }}\n </div>\n }\n <div class=\"form__section-content\">\n <ng-container *ngIf=\"formSection\">\n <div *ngFor=\"let fieldGroup of formSection?.fieldGroups\">\n <ng-container *ngIf=\"formGroups[fieldGroup.id] as formGroup\">\n <div\n *ngIf=\"fieldGroup.name && !fieldGroup.repeatableStage\"\n class=\"form__field-group-name\"\n >\n {{ fieldGroup?.name }}\n </div>\n <div *ngIf=\"fieldGroup.fields\">\n <!-- Single stage form section -->\n <ng-container *ngIf=\"!fieldGroup.repeatableStage\">\n <ng-dhis2-ui-form\n *ngIf=\"fieldGroup.fields.length > 0\"\n [fields]=\"fieldGroup.fields\"\n [form]=\"formGroup\"\n [dataEntities]=\"dataValueEntities()\"\n [programRuleActions]=\"ruleActions()\"\n [isFormHorizontal]=\"fieldGroup.isFormHorizontal || false\"\n (formUpdate)=\"onFormUpdate($event, fieldGroup.id)\"\n ></ng-dhis2-ui-form>\n </ng-container>\n\n <!-- Repeatable stage form section -->\n <ng-container *ngIf=\"fieldGroup.repeatableStage\">\n @if(fieldGroup.repeatDependentField) {\n\n <ng-container *ngIf=\"fieldGroup.repeatDependentField\">\n <ng-container\n *ngIf=\"{\n numberOfRows:\n dataValueEntities()[fieldGroup.repeatDependentField]\n } as dataParams\"\n >\n <ng-dhis2-ui-repeatable-form\n *ngIf=\"\n dataParams.numberOfRows &&\n dataParams.numberOfRows !== '0'\n \"\n [fieldGroup]=\"fieldGroup\"\n [dataEntities]=\"dataValueEntities()\"\n [form]=\"formGroup\"\n [program]=\"formSection.program || ''\"\n [programStage]=\"fieldGroup.repeatableStage\"\n [programRuleActions]=\"ruleActions()\"\n [numberOfRows]=\"+dataParams.numberOfRows\"\n [repeatDependentField]=\"\n fieldGroup.repeatDependentField || ''\n \"\n [events]=\"dataValueEntities()[fieldGroup.dataKey!]\"\n (repeatableStageUpdate)=\"\n onUpdateRepeatableStage($event, fieldGroup)\n \"\n ></ng-dhis2-ui-repeatable-form\n ></ng-container>\n </ng-container>\n } @else {\n <ng-dhis2-ui-repeatable-form\n [fieldGroup]=\"fieldGroup\"\n [dataEntities]=\"dataValueEntities()\"\n [form]=\"formGroup\"\n [program]=\"formSection.program || ''\"\n [programStage]=\"fieldGroup.repeatableStage\"\n [programRuleActions]=\"ruleActions()\"\n [numberOfRows]=\"1\"\n [repeatDependentField]=\"fieldGroup.repeatDependentField || ''\"\n [events]=\"dataValueEntities()[fieldGroup.dataKey!]\"\n (repeatableStageUpdate)=\"\n onUpdateRepeatableStage($event, fieldGroup)\n \"\n ></ng-dhis2-ui-repeatable-form>\n }\n </ng-container>\n </div>\n </ng-container>\n </div>\n </ng-container>\n </div>\n </ng-container>\n</ng-container>\n", styles: [".form__section-name{font-size:16px;font-weight:600;margin-bottom:16px}.form__section-content{margin-bottom:24px}.form__field-group-name{font-size:14px;font-weight:500;padding-bottom:8px;border-bottom:solid 1px rgb(232,237,242);margin-bottom:16px}\n"], dependencies: [{ kind: "directive", type: i1
|
|
7491
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.3", type: SectionFormComponent, isStandalone: false, selector: "ng-dhis2-ui-section-form", inputs: { loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, formMetaData: { classPropertyName: "formMetaData", publicName: "formMetaData", isSignal: true, isRequired: true, transformFunction: null }, dataValueEntities: { classPropertyName: "dataValueEntities", publicName: "dataValueEntities", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { save: "save", formUpdate: "formUpdate", cancel: "cancel", formValidityUpdate: "formValidityUpdate" }, ngImport: i0, template: "<ng-container *ngIf=\"formMetaData()\">\n <ng-container *ngFor=\"let formSection of formMetaData().sections\">\n @if(formSection?.name; as sectionName) {\n <div class=\"form__section-name\">\n {{ sectionName }}\n </div>\n }\n <div class=\"form__section-content\">\n <ng-container *ngIf=\"formSection\">\n <div *ngFor=\"let fieldGroup of formSection?.fieldGroups\">\n <ng-container *ngIf=\"formGroups[fieldGroup.id] as formGroup\">\n <div\n *ngIf=\"fieldGroup.name && !fieldGroup.repeatableStage\"\n class=\"form__field-group-name\"\n >\n {{ fieldGroup?.name }}\n </div>\n <div *ngIf=\"fieldGroup.fields\">\n <!-- Single stage form section -->\n <ng-container *ngIf=\"!fieldGroup.repeatableStage\">\n <ng-dhis2-ui-form\n *ngIf=\"fieldGroup.fields.length > 0\"\n [fields]=\"fieldGroup.fields\"\n [form]=\"formGroup\"\n [dataEntities]=\"dataValueEntities()\"\n [programRuleActions]=\"ruleActions()\"\n [isFormHorizontal]=\"fieldGroup.isFormHorizontal || false\"\n (formUpdate)=\"onFormUpdate($event, fieldGroup.id)\"\n ></ng-dhis2-ui-form>\n </ng-container>\n\n <!-- Repeatable stage form section -->\n <ng-container *ngIf=\"fieldGroup.repeatableStage\">\n @if(fieldGroup.repeatDependentField) {\n\n <ng-container *ngIf=\"fieldGroup.repeatDependentField\">\n <ng-container\n *ngIf=\"{\n numberOfRows:\n dataValueEntities()[fieldGroup.repeatDependentField]\n } as dataParams\"\n >\n <ng-dhis2-ui-repeatable-form\n *ngIf=\"\n dataParams.numberOfRows &&\n dataParams.numberOfRows !== '0'\n \"\n [fieldGroup]=\"fieldGroup\"\n [dataEntities]=\"dataValueEntities()\"\n [form]=\"formGroup\"\n [program]=\"formSection.program || ''\"\n [programStage]=\"fieldGroup.repeatableStage\"\n [programRuleActions]=\"ruleActions()\"\n [numberOfRows]=\"+dataParams.numberOfRows\"\n [repeatDependentField]=\"\n fieldGroup.repeatDependentField || ''\n \"\n [events]=\"dataValueEntities()[fieldGroup.dataKey!]\"\n (repeatableStageUpdate)=\"\n onUpdateRepeatableStage($event, fieldGroup)\n \"\n ></ng-dhis2-ui-repeatable-form\n ></ng-container>\n </ng-container>\n } @else {\n <ng-dhis2-ui-repeatable-form\n [fieldGroup]=\"fieldGroup\"\n [dataEntities]=\"dataValueEntities()\"\n [form]=\"formGroup\"\n [program]=\"formSection.program || ''\"\n [programStage]=\"fieldGroup.repeatableStage\"\n [programRuleActions]=\"ruleActions()\"\n [numberOfRows]=\"1\"\n [repeatDependentField]=\"fieldGroup.repeatDependentField || ''\"\n [events]=\"dataValueEntities()[fieldGroup.dataKey!]\"\n (repeatableStageUpdate)=\"\n onUpdateRepeatableStage($event, fieldGroup)\n \"\n ></ng-dhis2-ui-repeatable-form>\n }\n </ng-container>\n </div>\n </ng-container>\n </div>\n </ng-container>\n </div>\n </ng-container>\n</ng-container>\n", styles: [".form__section-name{font-size:16px;font-weight:600;margin-bottom:16px}.form__section-content{margin-bottom:24px}.form__field-group-name{font-size:14px;font-weight:500;padding-bottom:8px;border-bottom:solid 1px rgb(232,237,242);margin-bottom:16px}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: FormComponent, selector: "ng-dhis2-ui-form", inputs: ["formConfig", "fields", "form", "isFormHorizontal", "showSaveButton", "fieldsData", "fieldClass", "shouldRenderAsCheckBoxesButton", "programRuleActions", "dataEntities", "dataId", "customOrgUnitRoots"], outputs: ["formUpdate", "formValidityUpdate"] }, { kind: "component", type: RepeatableFormComponent, selector: "ng-dhis2-ui-repeatable-form", inputs: ["formObject", "formData", "fieldGroup", "form", "numberOfRows", "programRuleActions", "events", "program", "programStage", "repeatDependentField", "dataEntities"], outputs: ["eventsChange", "repeatableStageUpdate"] }] }); }
|
|
7575
7492
|
}
|
|
7576
7493
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: SectionFormComponent, decorators: [{
|
|
7577
7494
|
type: Component,
|