@iapps/ng-dhis2-ui 1.0.7 → 1.0.9
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 +435 -54
- package/fesm2022/iapps-ng-dhis2-ui.mjs.map +1 -1
- package/index.d.ts +1 -0
- package/lib/modules/line-list/components/dropdown-menu/dropdown-menu.d.ts +19 -0
- package/lib/modules/line-list/components/dropdown-menu/dropdown-menu.styles.d.ts +5 -0
- package/lib/modules/line-list/components/dropdown-menu/index.d.ts +1 -0
- package/lib/modules/line-list/containers/line-list.component.d.ts +20 -0
- package/lib/modules/line-list/hooks/index.d.ts +1 -0
- package/lib/modules/line-list/hooks/use-dynamic-styles.hook.d.ts +1 -0
- package/lib/modules/line-list/index.d.ts +2 -0
- package/lib/modules/line-list/line-list.module.d.ts +9 -0
- package/lib/modules/line-list/models/attribute-filter.model.d.ts +9 -0
- package/lib/modules/line-list/models/line-list.models.d.ts +70 -0
- package/lib/modules/line-list/services/line-list.service.d.ts +16 -0
- package/lib/modules/line-list/utils/filter-builder.d.ts +2 -0
- package/lib/modules/line-list/utils/line-list-utils.d.ts +14 -0
- package/lib/modules/organisation-unit-selector/components/OrgUnitDimension.d.ts +3 -1
- package/lib/modules/organisation-unit-selector/index.d.ts +1 -0
- package/package.json +6 -8
- package/esm2022/iapps-ng-dhis2-ui.mjs +0 -5
- package/esm2022/index.mjs +0 -6
- package/esm2022/lib/modules/button/button.component.mjs +0 -60
- package/esm2022/lib/modules/button/button.module.mjs +0 -19
- package/esm2022/lib/modules/button/index.mjs +0 -6
- package/esm2022/lib/modules/header-bar/header-bar.component.mjs +0 -38
- package/esm2022/lib/modules/header-bar/header-bar.module.mjs +0 -19
- package/esm2022/lib/modules/header-bar/index.mjs +0 -6
- package/esm2022/lib/modules/header-bar/models/header-bar-app.model.mjs +0 -20
- package/esm2022/lib/modules/header-bar/models/header-bar-data.model.mjs +0 -46
- package/esm2022/lib/modules/header-bar/models/header-bar-notification.model.mjs +0 -11
- package/esm2022/lib/modules/header-bar/models/index.mjs +0 -6
- package/esm2022/lib/modules/header-bar/utils/apps.mjs +0 -221
- package/esm2022/lib/modules/header-bar/utils/debug-info/debug-info-menu-item.mjs +0 -51
- package/esm2022/lib/modules/header-bar/utils/debug-info/debug-info-modal.mjs +0 -30
- package/esm2022/lib/modules/header-bar/utils/debug-info/debug-info-table.mjs +0 -39
- package/esm2022/lib/modules/header-bar/utils/debug-info/use-debug-info.mjs +0 -12
- package/esm2022/lib/modules/header-bar/utils/header-bar-context.mjs +0 -17
- package/esm2022/lib/modules/header-bar/utils/header-bar.mjs +0 -56
- package/esm2022/lib/modules/header-bar/utils/join-path.mjs +0 -5
- package/esm2022/lib/modules/header-bar/utils/logo-image.mjs +0 -52
- package/esm2022/lib/modules/header-bar/utils/logo.mjs +0 -35
- package/esm2022/lib/modules/header-bar/utils/notification-icon.mjs +0 -76
- package/esm2022/lib/modules/header-bar/utils/notifications.mjs +0 -35
- package/esm2022/lib/modules/header-bar/utils/profile/use-on-doc-click.mjs +0 -21
- package/esm2022/lib/modules/header-bar/utils/profile-menu/index.mjs +0 -2
- package/esm2022/lib/modules/header-bar/utils/profile-menu/profile-header.mjs +0 -95
- package/esm2022/lib/modules/header-bar/utils/profile-menu/profile-menu.mjs +0 -101
- package/esm2022/lib/modules/header-bar/utils/profile-menu/update-notification.mjs +0 -54
- package/esm2022/lib/modules/header-bar/utils/profile.mjs +0 -58
- package/esm2022/lib/modules/header-bar/utils/title.mjs +0 -22
- package/esm2022/lib/modules/organisation-unit-selector/components/OrgUnitDimension.mjs +0 -216
- package/esm2022/lib/modules/organisation-unit-selector/components/index.mjs +0 -6
- package/esm2022/lib/modules/organisation-unit-selector/components/styles/OrgUnitDimension.style.mjs +0 -83
- package/esm2022/lib/modules/organisation-unit-selector/components/utils/index.mjs +0 -6
- package/esm2022/lib/modules/organisation-unit-selector/components/utils/ouIdHelper/index.mjs +0 -18
- package/esm2022/lib/modules/organisation-unit-selector/components/utils/ouLevelUtils/index.mjs +0 -27
- package/esm2022/lib/modules/organisation-unit-selector/containers/organisation-unit-selector/organisation-unit-selector.component.mjs +0 -91
- package/esm2022/lib/modules/organisation-unit-selector/containers/organisation-unit-selector-modal/organisation-unit-selector-modal.component-modal.mjs +0 -114
- package/esm2022/lib/modules/organisation-unit-selector/index.mjs +0 -7
- package/esm2022/lib/modules/organisation-unit-selector/models/index.mjs +0 -5
- package/esm2022/lib/modules/organisation-unit-selector/models/organisation-unit-config.model.mjs +0 -16
- package/esm2022/lib/modules/organisation-unit-selector/organisation-unit-selector.module.mjs +0 -28
- package/esm2022/lib/modules/period-selector/components/FixedPeriodFilter.mjs +0 -44
- package/esm2022/lib/modules/period-selector/components/PeriodDimension.mjs +0 -41
- package/esm2022/lib/modules/period-selector/components/PeriodTransfer.mjs +0 -110
- package/esm2022/lib/modules/period-selector/components/RelativePeriodFilter.mjs +0 -28
- package/esm2022/lib/modules/period-selector/components/utils/fixedPeriods.mjs +0 -308
- package/esm2022/lib/modules/period-selector/components/utils/index.mjs +0 -5
- package/esm2022/lib/modules/period-selector/components/utils/periodTypes.mjs +0 -23
- package/esm2022/lib/modules/period-selector/components/utils/relativePeriods.mjs +0 -139
- package/esm2022/lib/modules/period-selector/containers/period-selector/period-selector.component.mjs +0 -69
- package/esm2022/lib/modules/period-selector/containers/period-selector-modal/period-selector-modal.component.mjs +0 -82
- package/esm2022/lib/modules/period-selector/index.mjs +0 -7
- package/esm2022/lib/modules/period-selector/period-selector.module.mjs +0 -20
- package/esm2022/lib/modules/react-wrapper/index.mjs +0 -6
- package/esm2022/lib/modules/react-wrapper/react-wrapper.component.mjs +0 -55
- package/esm2022/lib/modules/react-wrapper/react-wrapper.module.mjs +0 -18
- package/esm2022/lib/shared/assets/AssignedCategoriesIcon.mjs +0 -12
- package/esm2022/lib/shared/assets/DimensionItemIcons/PeriodIcon.mjs +0 -4
- package/esm2022/lib/shared/components/TransferOption.mjs +0 -130
- package/esm2022/lib/shared/components/index.mjs +0 -6
- package/esm2022/lib/shared/index.mjs +0 -7
- package/esm2022/lib/shared/shared.module.mjs +0 -18
- package/esm2022/lib/shared/styles/DimensionSelector.style.mjs +0 -39
- package/esm2022/lib/shared/styles/index.mjs +0 -5
- package/esm2022/lib/shared/utils/axis.mjs +0 -25
- package/esm2022/lib/shared/utils/axisGetDimension.mjs +0 -5
- package/esm2022/lib/shared/utils/axisHasDimension.mjs +0 -3
- package/esm2022/lib/shared/utils/dimension.mjs +0 -52
- package/esm2022/lib/shared/utils/dimensionGetItems.mjs +0 -6
- package/esm2022/lib/shared/utils/dimensionIs.mjs +0 -3
- package/esm2022/lib/shared/utils/dimensionIsEmpty.mjs +0 -5
- package/esm2022/lib/shared/utils/dimensionIsValid.mjs +0 -17
- package/esm2022/lib/shared/utils/dimensionSelectorHelper.mjs +0 -4
- package/esm2022/lib/shared/utils/index.mjs +0 -15
- package/esm2022/lib/shared/utils/layoutGetAllAxes.mjs +0 -7
- package/esm2022/lib/shared/utils/layoutGetAllDimensions.mjs +0 -6
- package/esm2022/lib/shared/utils/layoutGetDimension.mjs +0 -4
- package/esm2022/lib/shared/utils/layoutReplaceDimension.mjs +0 -17
- package/esm2022/lib/shared/utils/list.mjs +0 -15
- package/esm2022/lib/shared/utils/predefinedDimensions.mjs +0 -47
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CommonModule } from '@angular/common';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { NgModule, Directive, Input, ContentChild, Component, EventEmitter, Output } from '@angular/core';
|
|
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';
|
|
3
|
+
import { NgModule, Directive, Input, ContentChild, Component, EventEmitter, Output, Injectable, inject } from '@angular/core';
|
|
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, Layer as Layer$1, Popper, FlyoutMenu, MenuItem as MenuItem$1, IconMore24, DataTable, TableHead, DataTableRow, DataTableColumnHeader, TableBody, DataTableCell, TableFoot, Pagination } from '@dhis2/ui';
|
|
5
5
|
import cx from 'classnames';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import * as React from 'react';
|
|
@@ -27,6 +27,7 @@ import { MenuItem, MenuDivider } from '@dhis2-ui/menu';
|
|
|
27
27
|
import parse from 'html-react-parser';
|
|
28
28
|
import { getNowInCalendar, generateFixedPeriods } from '@dhis2/multi-calendar-dates';
|
|
29
29
|
import { isObject, isString } from 'lodash';
|
|
30
|
+
import { switchMap, map as map$1 } from 'rxjs/operators';
|
|
30
31
|
|
|
31
32
|
const TransferOption = ({ disabled, label, highlighted, selected, onClick, onDoubleClick, value, icon, active, tooltipText, dataTest, onEditClick, }) => {
|
|
32
33
|
const renderContent = () => (React__default.createElement("div", { className: cx('chip', {
|
|
@@ -160,11 +161,11 @@ TransferOption.propTypes = {
|
|
|
160
161
|
const sharedComponents = [];
|
|
161
162
|
|
|
162
163
|
class SharedDhis2UiModule {
|
|
163
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
164
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
165
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
164
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: SharedDhis2UiModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
165
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.7", ngImport: i0, type: SharedDhis2UiModule, imports: [CommonModule] }); }
|
|
166
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: SharedDhis2UiModule, imports: [CommonModule] }); }
|
|
166
167
|
}
|
|
167
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
168
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: SharedDhis2UiModule, decorators: [{
|
|
168
169
|
type: NgModule,
|
|
169
170
|
args: [{
|
|
170
171
|
imports: [CommonModule],
|
|
@@ -1172,13 +1173,14 @@ class ReactWrapperComponent {
|
|
|
1172
1173
|
" "));
|
|
1173
1174
|
}
|
|
1174
1175
|
}
|
|
1175
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1176
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
1176
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: ReactWrapperComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1177
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.7", type: ReactWrapperComponent, isStandalone: false, selector: "ng-dhis2-ui-wrapper", inputs: { props: "props", component: "component" }, queries: [{ propertyName: "content", first: true, predicate: ["ngDhis2UiContent"], descendants: true }], usesOnChanges: true, ngImport: i0 }); }
|
|
1177
1178
|
}
|
|
1178
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1179
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: ReactWrapperComponent, decorators: [{
|
|
1179
1180
|
type: Directive,
|
|
1180
1181
|
args: [{
|
|
1181
1182
|
selector: 'ng-dhis2-ui-wrapper',
|
|
1183
|
+
standalone: false,
|
|
1182
1184
|
}]
|
|
1183
1185
|
}], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { props: [{
|
|
1184
1186
|
type: Input
|
|
@@ -1190,11 +1192,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImpor
|
|
|
1190
1192
|
}] } });
|
|
1191
1193
|
|
|
1192
1194
|
class ReactWrapperModule {
|
|
1193
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1194
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
1195
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
1195
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: ReactWrapperModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1196
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.7", ngImport: i0, type: ReactWrapperModule, declarations: [ReactWrapperComponent], imports: [CommonModule], exports: [ReactWrapperComponent] }); }
|
|
1197
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: ReactWrapperModule, imports: [CommonModule] }); }
|
|
1196
1198
|
}
|
|
1197
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1199
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: ReactWrapperModule, decorators: [{
|
|
1198
1200
|
type: NgModule,
|
|
1199
1201
|
args: [{
|
|
1200
1202
|
imports: [CommonModule],
|
|
@@ -1223,23 +1225,24 @@ class HeaderBarComponent extends ReactWrapperComponent {
|
|
|
1223
1225
|
: () => React__default.createElement("div", null, "Something went wrong");
|
|
1224
1226
|
this.render();
|
|
1225
1227
|
}
|
|
1226
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1227
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
1228
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: HeaderBarComponent, deps: [{ token: i0.ElementRef }, { token: i1.NgxDhis2HttpClientService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1229
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.7", type: HeaderBarComponent, isStandalone: false, selector: "ng-dhis2-ui-header-bar", usesInheritance: true, ngImport: i0, template: `<ng-container></ng-container>`, isInline: true }); }
|
|
1228
1230
|
}
|
|
1229
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1231
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: HeaderBarComponent, decorators: [{
|
|
1230
1232
|
type: Component,
|
|
1231
1233
|
args: [{
|
|
1232
1234
|
selector: 'ng-dhis2-ui-header-bar',
|
|
1233
1235
|
template: `<ng-container></ng-container>`,
|
|
1236
|
+
standalone: false
|
|
1234
1237
|
}]
|
|
1235
1238
|
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1.NgxDhis2HttpClientService }] });
|
|
1236
1239
|
|
|
1237
1240
|
class HeaderBarModule {
|
|
1238
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1239
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
1240
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
1241
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: HeaderBarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1242
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.7", ngImport: i0, type: HeaderBarModule, declarations: [HeaderBarComponent], imports: [CommonModule, SharedDhis2UiModule], exports: [HeaderBarComponent] }); }
|
|
1243
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: HeaderBarModule, imports: [CommonModule, SharedDhis2UiModule] }); }
|
|
1241
1244
|
}
|
|
1242
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1245
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: HeaderBarModule, decorators: [{
|
|
1243
1246
|
type: NgModule,
|
|
1244
1247
|
args: [{
|
|
1245
1248
|
imports: [CommonModule, SharedDhis2UiModule],
|
|
@@ -1279,14 +1282,15 @@ class ButtonComponent extends ReactWrapperComponent {
|
|
|
1279
1282
|
onButtonClick(event) {
|
|
1280
1283
|
this.buttonClick.emit(event);
|
|
1281
1284
|
}
|
|
1282
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1283
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
1285
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: ButtonComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1286
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.7", type: ButtonComponent, isStandalone: false, 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 }); }
|
|
1284
1287
|
}
|
|
1285
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1288
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: ButtonComponent, decorators: [{
|
|
1286
1289
|
type: Component,
|
|
1287
1290
|
args: [{
|
|
1288
1291
|
selector: 'ng-dhis2-ui-button',
|
|
1289
1292
|
template: '<ng-content></ng-content>',
|
|
1293
|
+
standalone: false
|
|
1290
1294
|
}]
|
|
1291
1295
|
}], propDecorators: { label: [{
|
|
1292
1296
|
type: Input
|
|
@@ -1307,11 +1311,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImpor
|
|
|
1307
1311
|
}] } });
|
|
1308
1312
|
|
|
1309
1313
|
class ButtonModule {
|
|
1310
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1311
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
1312
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
1314
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: ButtonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1315
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.7", ngImport: i0, type: ButtonModule, declarations: [ButtonComponent], imports: [CommonModule, SharedDhis2UiModule], exports: [ButtonComponent] }); }
|
|
1316
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: ButtonModule, imports: [CommonModule, SharedDhis2UiModule] }); }
|
|
1313
1317
|
}
|
|
1314
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1318
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: ButtonModule, decorators: [{
|
|
1315
1319
|
type: NgModule,
|
|
1316
1320
|
args: [{
|
|
1317
1321
|
declarations: [ButtonComponent],
|
|
@@ -2299,12 +2303,12 @@ class PeriodSelectorModalComponent extends ReactWrapperComponent {
|
|
|
2299
2303
|
onConfirm(selectedItems) {
|
|
2300
2304
|
this.confirm.emit(selectedItems);
|
|
2301
2305
|
}
|
|
2302
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2303
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
2306
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: PeriodSelectorModalComponent, deps: [{ token: i0.ElementRef }, { token: i1.NgxDhis2HttpClientService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2307
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.7", type: PeriodSelectorModalComponent, isStandalone: false, selector: "ng-dhis2-ui-period-selector-modal", inputs: { selectedPeriods: "selectedPeriods" }, outputs: { cancel: "cancel", confirm: "confirm" }, usesInheritance: true, ngImport: i0, template: `<ng-container></ng-container>`, isInline: true, styles: ["::ng-deep .layer{z-index:2!important}\n"] }); }
|
|
2304
2308
|
}
|
|
2305
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2309
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: PeriodSelectorModalComponent, decorators: [{
|
|
2306
2310
|
type: Component,
|
|
2307
|
-
args: [{ selector: 'ng-dhis2-ui-period-selector-modal', template: `<ng-container></ng-container>`, styles: ["::ng-deep .layer{z-index:2!important}\n"] }]
|
|
2311
|
+
args: [{ selector: 'ng-dhis2-ui-period-selector-modal', template: `<ng-container></ng-container>`, standalone: false, styles: ["::ng-deep .layer{z-index:2!important}\n"] }]
|
|
2308
2312
|
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1.NgxDhis2HttpClientService }], propDecorators: { selectedPeriods: [{
|
|
2309
2313
|
type: Input
|
|
2310
2314
|
}], cancel: [{
|
|
@@ -2359,12 +2363,12 @@ class PeriodSelectorComponent extends ReactWrapperComponent {
|
|
|
2359
2363
|
onSelectItems(selectionEvent) {
|
|
2360
2364
|
this.selectPeriods.emit(selectionEvent.items);
|
|
2361
2365
|
}
|
|
2362
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2363
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
2366
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: PeriodSelectorComponent, deps: [{ token: i0.ElementRef }, { token: i1.NgxDhis2HttpClientService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2367
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.7", type: PeriodSelectorComponent, isStandalone: false, 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"] }); }
|
|
2364
2368
|
}
|
|
2365
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2369
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: PeriodSelectorComponent, decorators: [{
|
|
2366
2370
|
type: Component,
|
|
2367
|
-
args: [{ selector: 'ng-dhis2-ui-period-selector', template: `<ng-container></ng-container>`, styles: ["::ng-deep .content-container{z-index:0!important}\n"] }]
|
|
2371
|
+
args: [{ selector: 'ng-dhis2-ui-period-selector', template: `<ng-container></ng-container>`, standalone: false, styles: ["::ng-deep .content-container{z-index:0!important}\n"] }]
|
|
2368
2372
|
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1.NgxDhis2HttpClientService }, { type: i0.NgZone }], propDecorators: { selectedPeriods: [{
|
|
2369
2373
|
type: Input
|
|
2370
2374
|
}], selectPeriods: [{
|
|
@@ -2372,11 +2376,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImpor
|
|
|
2372
2376
|
}] } });
|
|
2373
2377
|
|
|
2374
2378
|
class PeriodSelectorModule {
|
|
2375
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2376
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
2377
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
2379
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: PeriodSelectorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
2380
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.7", ngImport: i0, type: PeriodSelectorModule, declarations: [PeriodSelectorComponent, PeriodSelectorModalComponent], imports: [CommonModule, SharedDhis2UiModule], exports: [PeriodSelectorComponent, PeriodSelectorModalComponent] }); }
|
|
2381
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: PeriodSelectorModule, imports: [CommonModule, SharedDhis2UiModule] }); }
|
|
2378
2382
|
}
|
|
2379
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2383
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: PeriodSelectorModule, decorators: [{
|
|
2380
2384
|
type: NgModule,
|
|
2381
2385
|
args: [{
|
|
2382
2386
|
imports: [CommonModule, SharedDhis2UiModule],
|
|
@@ -2527,12 +2531,13 @@ const DYNAMIC_ORG_UNITS = [
|
|
|
2527
2531
|
USER_ORG_UNIT_CHILDREN,
|
|
2528
2532
|
USER_ORG_UNIT_GRANDCHILDREN,
|
|
2529
2533
|
];
|
|
2530
|
-
const OrgUnitDimension = ({ roots, selected, onSelect, hideGroupSelect, hideLevelSelect, hideUserOrgUnits, warning, orgUnitGroupPromise, orgUnitLevelPromise, }) => {
|
|
2534
|
+
const OrgUnitDimension = ({ roots, selected, onSelect, hideGroupSelect, hideLevelSelect, hideUserOrgUnits, allowSingleSelection, warning, orgUnitGroupPromise, orgUnitLevelPromise, }) => {
|
|
2531
2535
|
const [ouLevels, setOuLevels] = useState([]);
|
|
2532
2536
|
const [ouGroups, setOuGroups] = useState([]);
|
|
2533
2537
|
const [selectedItems, setSelectedItems] = useState(selected);
|
|
2534
2538
|
const dataEngine = useDataEngine();
|
|
2535
2539
|
const onSelectItems = (selectedItem) => {
|
|
2540
|
+
console.log('WE ARE SELECTING HERE', selectedItem);
|
|
2536
2541
|
const { id, checked, displayName, path } = selectedItem;
|
|
2537
2542
|
let result = [...selectedItems];
|
|
2538
2543
|
if (checked && DYNAMIC_ORG_UNITS.includes(id)) {
|
|
@@ -2711,11 +2716,13 @@ OrgUnitDimension.defaultProps = {
|
|
|
2711
2716
|
hideGroupSelect: false,
|
|
2712
2717
|
hideLevelSelect: false,
|
|
2713
2718
|
hideUserOrgUnits: false,
|
|
2719
|
+
allowSingleSelection: false,
|
|
2714
2720
|
};
|
|
2715
2721
|
OrgUnitDimension.propTypes = {
|
|
2716
2722
|
hideGroupSelect: PropTypes.bool,
|
|
2717
2723
|
hideLevelSelect: PropTypes.bool,
|
|
2718
2724
|
hideUserOrgUnits: PropTypes.bool,
|
|
2725
|
+
allowSingleSelection: PropTypes.bool,
|
|
2719
2726
|
roots: PropTypes.arrayOf(PropTypes.string),
|
|
2720
2727
|
selected: PropTypes.arrayOf(PropTypes.shape({
|
|
2721
2728
|
id: PropTypes.string.isRequired,
|
|
@@ -2768,7 +2775,7 @@ class OrganisationUnitSelectorComponent extends ReactWrapperComponent {
|
|
|
2768
2775
|
this.reactDomRoot = ReactDOM.createRoot(this.elementRef.nativeElement);
|
|
2769
2776
|
const rootOrgUnits = await this.getRootOrgUnits();
|
|
2770
2777
|
const config = await this.getAppConfig();
|
|
2771
|
-
this.component = () => (React__default.createElement(Provider, { config: config }, React__default.createElement(OrgUnitDimension, { selected: this.selectedOrgUnits, hideGroupSelect: this.orgUnitSelectionConfig.hideGroupSelect, hideLevelSelect: this.orgUnitSelectionConfig.hideLevelSelect, hideUserOrgUnits: this.orgUnitSelectionConfig.hideUserOrgUnits, onSelect: (selectionEvent) => this.ngZone.run(() => {
|
|
2778
|
+
this.component = () => (React__default.createElement(Provider, { config: config, plugin: false, parentAlertsAdd: undefined, showAlertsInPlugin: false }, React__default.createElement(OrgUnitDimension, { selected: this.selectedOrgUnits, hideGroupSelect: this.orgUnitSelectionConfig.hideGroupSelect, hideLevelSelect: this.orgUnitSelectionConfig.hideLevelSelect, hideUserOrgUnits: this.orgUnitSelectionConfig.hideUserOrgUnits, onSelect: (selectionEvent) => this.ngZone.run(() => {
|
|
2772
2779
|
this.onSelectItems(selectionEvent);
|
|
2773
2780
|
}), orgUnitGroupPromise: this.getOrgUnitGroups(), orgUnitLevelPromise: this.getOrgUnitLevels(), roots: rootOrgUnits })));
|
|
2774
2781
|
this.render();
|
|
@@ -2811,14 +2818,15 @@ class OrganisationUnitSelectorComponent extends ReactWrapperComponent {
|
|
|
2811
2818
|
onSelectItems(selectionEvent) {
|
|
2812
2819
|
this.selectOrgUnits.emit(selectionEvent.items);
|
|
2813
2820
|
}
|
|
2814
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2815
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
2821
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: OrganisationUnitSelectorComponent, deps: [{ token: i0.ElementRef }, { token: i1.NgxDhis2HttpClientService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2822
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.7", type: OrganisationUnitSelectorComponent, isStandalone: false, 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 }); }
|
|
2816
2823
|
}
|
|
2817
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2824
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: OrganisationUnitSelectorComponent, decorators: [{
|
|
2818
2825
|
type: Component,
|
|
2819
2826
|
args: [{
|
|
2820
2827
|
selector: 'ng-dhis2-ui-org-unit-selector',
|
|
2821
2828
|
template: '<ng-container><ng-container>',
|
|
2829
|
+
standalone: false,
|
|
2822
2830
|
}]
|
|
2823
2831
|
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1.NgxDhis2HttpClientService }, { type: i0.NgZone }], propDecorators: { selectedOrgUnits: [{
|
|
2824
2832
|
type: Input
|
|
@@ -2851,7 +2859,7 @@ class OrganisationUnitSelectorModalComponent extends ReactWrapperComponent {
|
|
|
2851
2859
|
const config = await this.getAppConfig();
|
|
2852
2860
|
this.component = () => {
|
|
2853
2861
|
const [selected, setSelected] = useState(this.selectedOrgUnits);
|
|
2854
|
-
return (React__default.createElement(Provider, { config: config }, React__default.createElement(Modal$1, { position: "middle", large: true },
|
|
2862
|
+
return (React__default.createElement(Provider, { config: config, plugin: false, parentAlertsAdd: undefined, showAlertsInPlugin: false }, React__default.createElement(Modal$1, { position: "middle", large: true },
|
|
2855
2863
|
React__default.createElement(ModalTitle$1, null, "Organisation unit"),
|
|
2856
2864
|
React__default.createElement(ModalContent$1, null,
|
|
2857
2865
|
React__default.createElement(OrgUnitDimension, { selected: selected, hideGroupSelect: this.orgUnitSelectionConfig.hideGroupSelect, hideLevelSelect: this.orgUnitSelectionConfig.hideLevelSelect, hideUserOrgUnits: this.orgUnitSelectionConfig.hideUserOrgUnits, onSelect: (selectionEvent) => {
|
|
@@ -2912,12 +2920,12 @@ class OrganisationUnitSelectorModalComponent extends ReactWrapperComponent {
|
|
|
2912
2920
|
onSelectItems(selectionEvent) {
|
|
2913
2921
|
this.selectOrgUnits.emit(selectionEvent.items);
|
|
2914
2922
|
}
|
|
2915
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2916
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
2923
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: OrganisationUnitSelectorModalComponent, deps: [{ token: i0.ElementRef }, { token: i1.NgxDhis2HttpClientService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2924
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.7", type: OrganisationUnitSelectorModalComponent, isStandalone: false, selector: "ng-dhis2-ui-org-unit-selector-modal", inputs: { selectedOrgUnits: "selectedOrgUnits", orgUnitSelectionConfig: "orgUnitSelectionConfig" }, outputs: { selectOrgUnits: "selectOrgUnits", cancel: "cancel", confirm: "confirm" }, usesInheritance: true, ngImport: i0, template: '<ng-container><ng-container>', isInline: true, styles: ["::ng-deep .layer{z-index:2!important}\n"] }); }
|
|
2917
2925
|
}
|
|
2918
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2926
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: OrganisationUnitSelectorModalComponent, decorators: [{
|
|
2919
2927
|
type: Component,
|
|
2920
|
-
args: [{ selector: 'ng-dhis2-ui-org-unit-selector-modal', template: '<ng-container><ng-container>', styles: ["::ng-deep .layer{z-index:2!important}\n"] }]
|
|
2928
|
+
args: [{ selector: 'ng-dhis2-ui-org-unit-selector-modal', template: '<ng-container><ng-container>', standalone: false, styles: ["::ng-deep .layer{z-index:2!important}\n"] }]
|
|
2921
2929
|
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1.NgxDhis2HttpClientService }], propDecorators: { selectedOrgUnits: [{
|
|
2922
2930
|
type: Input
|
|
2923
2931
|
}], orgUnitSelectionConfig: [{
|
|
@@ -2931,13 +2939,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImpor
|
|
|
2931
2939
|
}] } });
|
|
2932
2940
|
|
|
2933
2941
|
class OrganisationUnitSelectorModule {
|
|
2934
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2935
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
2942
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: OrganisationUnitSelectorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
2943
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.7", ngImport: i0, type: OrganisationUnitSelectorModule, declarations: [OrganisationUnitSelectorComponent,
|
|
2936
2944
|
OrganisationUnitSelectorModalComponent], imports: [CommonModule, SharedDhis2UiModule], exports: [OrganisationUnitSelectorComponent,
|
|
2937
2945
|
OrganisationUnitSelectorModalComponent] }); }
|
|
2938
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
2946
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: OrganisationUnitSelectorModule, imports: [CommonModule, SharedDhis2UiModule] }); }
|
|
2939
2947
|
}
|
|
2940
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2948
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: OrganisationUnitSelectorModule, decorators: [{
|
|
2941
2949
|
type: NgModule,
|
|
2942
2950
|
args: [{
|
|
2943
2951
|
imports: [CommonModule, SharedDhis2UiModule],
|
|
@@ -2956,9 +2964,382 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImpor
|
|
|
2956
2964
|
// Use of this source code is governed by a BSD-style
|
|
2957
2965
|
// license that can be found in the LICENSE file.
|
|
2958
2966
|
|
|
2967
|
+
function buildFilters(filters) {
|
|
2968
|
+
return filters
|
|
2969
|
+
.map(({ attribute, operator, value }) => `filter=${attribute}:${operator}:${value}`)
|
|
2970
|
+
.join('&');
|
|
2971
|
+
}
|
|
2972
|
+
|
|
2973
|
+
class LineListService {
|
|
2974
|
+
constructor(httpClient) {
|
|
2975
|
+
this.httpClient = httpClient;
|
|
2976
|
+
}
|
|
2977
|
+
getProgramMetadata(programId) {
|
|
2978
|
+
return this.httpClient.get(`programs/${programId}.json?fields=programType,programStages[id,name,programStageDataElements[dataElement[id,name]]],organisationUnits[id,name]`);
|
|
2979
|
+
}
|
|
2980
|
+
getTrackedEntityInstances(programId, orgUnit, page, pageSize, filters = [], startDate, endDate) {
|
|
2981
|
+
const filterParams = buildFilters(filters);
|
|
2982
|
+
const dateFilter = startDate && endDate ? `&programStartDate=${startDate}&programEndDate=${endDate}` : '';
|
|
2983
|
+
return this.httpClient.get(`trackedEntityInstances.json?program=${programId}&ou=${orgUnit}&page=${page}&pageSize=${pageSize}&fields=trackedEntityInstance,attributes[*],enrollments[*]&totalPages=true&${filterParams}${dateFilter}`);
|
|
2984
|
+
}
|
|
2985
|
+
getEvents(programId, orgUnit, page, pageSize) {
|
|
2986
|
+
return this.httpClient.get(`events.json?program=${programId}&orgUnit=${orgUnit}&page=${page}&pageSize=${pageSize}&fields=event,programStage,dataValues[dataElement,value]&totalPages=true`);
|
|
2987
|
+
}
|
|
2988
|
+
getEventsByProgramStage(programStageId, orgUnit, page, pageSize) {
|
|
2989
|
+
return this.httpClient.get(`events.json?programStage=${programStageId}&orgUnit=${orgUnit}&page=${page}&pageSize=${pageSize}&fields=event,dataValues[dataElement,value]&totalPages=true`);
|
|
2990
|
+
}
|
|
2991
|
+
getLineListData(programId, orgUnit = '', programStageId, page = 1, pageSize = 10, filters = [], startDate, endDate) {
|
|
2992
|
+
return this.getProgramMetadata(programId).pipe(switchMap((programMetadata) => {
|
|
2993
|
+
if (programStageId) {
|
|
2994
|
+
return this.getEventsByProgramStage(programStageId, orgUnit, page, pageSize).pipe(map$1((events) => ({
|
|
2995
|
+
metadata: programMetadata,
|
|
2996
|
+
data: events,
|
|
2997
|
+
})));
|
|
2998
|
+
}
|
|
2999
|
+
if (programMetadata.programType === 'WITH_REGISTRATION') {
|
|
3000
|
+
return this.getTrackedEntityInstances(programId, orgUnit, page, pageSize, filters, startDate, endDate).pipe(map$1((teis) => ({
|
|
3001
|
+
metadata: programMetadata,
|
|
3002
|
+
data: teis,
|
|
3003
|
+
})));
|
|
3004
|
+
}
|
|
3005
|
+
else {
|
|
3006
|
+
return this.getEvents(programId, orgUnit, page, pageSize).pipe(map$1((events) => ({
|
|
3007
|
+
metadata: programMetadata,
|
|
3008
|
+
data: events,
|
|
3009
|
+
})));
|
|
3010
|
+
}
|
|
3011
|
+
}));
|
|
3012
|
+
}
|
|
3013
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: LineListService, deps: [{ token: i1.NgxDhis2HttpClientService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
3014
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: LineListService }); }
|
|
3015
|
+
}
|
|
3016
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: LineListService, decorators: [{
|
|
3017
|
+
type: Injectable
|
|
3018
|
+
}], ctorParameters: () => [{ type: i1.NgxDhis2HttpClientService }] });
|
|
3019
|
+
|
|
3020
|
+
const dropdownStyles = {
|
|
3021
|
+
layer: {
|
|
3022
|
+
zIndex: '1 !important',
|
|
3023
|
+
},
|
|
3024
|
+
};
|
|
3025
|
+
|
|
3026
|
+
// Helper function to generate a unique class name
|
|
3027
|
+
const generateClassName = (base) => `${base}-${Math.random().toString(36).substr(2, 9)}`;
|
|
3028
|
+
// Helper function to convert camelCased properties to hyphenated CSS properties
|
|
3029
|
+
const convertStylesToCSS = (className, styles) => {
|
|
3030
|
+
let cssString = `.${className} {`;
|
|
3031
|
+
for (const key in styles) {
|
|
3032
|
+
if (typeof styles[key] === "object" && key.startsWith("@media")) {
|
|
3033
|
+
const mediaStyles = convertStylesToCSS(className, styles[key]);
|
|
3034
|
+
cssString += `${key} { ${mediaStyles} }`;
|
|
3035
|
+
}
|
|
3036
|
+
else if (key.startsWith("&:")) {
|
|
3037
|
+
const pseudoClass = key.replace("&", "");
|
|
3038
|
+
cssString += `${pseudoClass} { ${convertStylesToCSS("", styles[key])} }`;
|
|
3039
|
+
}
|
|
3040
|
+
else {
|
|
3041
|
+
const cssKey = key.replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`);
|
|
3042
|
+
cssString += `${cssKey}: ${styles[key]}; `;
|
|
3043
|
+
}
|
|
3044
|
+
}
|
|
3045
|
+
cssString += "}";
|
|
3046
|
+
return cssString;
|
|
3047
|
+
};
|
|
3048
|
+
// Custom hook for dynamic styles with generics
|
|
3049
|
+
const useDynamicStyles = (stylesObj) => {
|
|
3050
|
+
const [classNames, setClassNames] = useState({});
|
|
3051
|
+
useEffect(() => {
|
|
3052
|
+
const convertedStyles = Object.keys(stylesObj).map((key) => {
|
|
3053
|
+
const className = generateClassName(key);
|
|
3054
|
+
const styleElement = document.createElement("style");
|
|
3055
|
+
styleElement.innerHTML = convertStylesToCSS(className, stylesObj[key]);
|
|
3056
|
+
document.head.appendChild(styleElement);
|
|
3057
|
+
return {
|
|
3058
|
+
key,
|
|
3059
|
+
className,
|
|
3060
|
+
styleElement,
|
|
3061
|
+
};
|
|
3062
|
+
});
|
|
3063
|
+
setClassNames(convertedStyles.reduce((classNameEntity, convertedStyle) => {
|
|
3064
|
+
return {
|
|
3065
|
+
...classNameEntity,
|
|
3066
|
+
[convertedStyle.key]: convertedStyle.className,
|
|
3067
|
+
};
|
|
3068
|
+
}, {}));
|
|
3069
|
+
return () => {
|
|
3070
|
+
convertedStyles.forEach((convertedStyle) => {
|
|
3071
|
+
document.head.removeChild(convertedStyle.styleElement);
|
|
3072
|
+
});
|
|
3073
|
+
};
|
|
3074
|
+
}, []);
|
|
3075
|
+
return classNames;
|
|
3076
|
+
};
|
|
3077
|
+
|
|
3078
|
+
const useCurrentModal = () => {
|
|
3079
|
+
const [CurrentModal, setCurrentModal] = useState();
|
|
3080
|
+
return [
|
|
3081
|
+
CurrentModal,
|
|
3082
|
+
(Modal) => {
|
|
3083
|
+
// As setState supports functional updates, we can't pass functional
|
|
3084
|
+
// components directly
|
|
3085
|
+
setCurrentModal(() => Modal);
|
|
3086
|
+
},
|
|
3087
|
+
];
|
|
3088
|
+
};
|
|
3089
|
+
const ContextMenu = (params) => {
|
|
3090
|
+
const { onClose, onMenuClick, anchorRef, dropDownOptions } = params;
|
|
3091
|
+
const [CurrentModal, setCurrentModal] = useCurrentModal();
|
|
3092
|
+
const styles = useDynamicStyles(dropdownStyles);
|
|
3093
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
3094
|
+
React__default.createElement(Layer$1, { onBackdropClick: onClose, className: styles.layer },
|
|
3095
|
+
React__default.createElement(Popper, { reference: anchorRef, placement: "bottom-start" },
|
|
3096
|
+
React__default.createElement(FlyoutMenu, null, dropDownOptions.map((dropDownOption, index) => (React__default.createElement(MenuItem$1, { key: index, destructive: dropDownOption.destructive, label: dropDownOption.label, icon: dropDownOption.icon, onClick: () => {
|
|
3097
|
+
// onMenuClick(dropDownOption);
|
|
3098
|
+
//onClose();
|
|
3099
|
+
}, dense: true })))))),
|
|
3100
|
+
CurrentModal && (React__default.createElement(CurrentModal, { onClose: () => {
|
|
3101
|
+
onClose();
|
|
3102
|
+
setCurrentModal(null);
|
|
3103
|
+
} }))));
|
|
3104
|
+
};
|
|
3105
|
+
const DropdownMenu = (props) => {
|
|
3106
|
+
const ref = useRef();
|
|
3107
|
+
const [visible, setVisible] = useState(false);
|
|
3108
|
+
const { dropdownOptions, onClick } = props;
|
|
3109
|
+
return (React__default.createElement("div", { ref: ref, style: { display: "inline-block" } },
|
|
3110
|
+
React__default.createElement(Button$1, { small: true, secondary: true, icon: React__default.createElement(IconMore24, { color: colors.grey600 }), onClick: () => setVisible(true) }),
|
|
3111
|
+
visible && (React__default.createElement(ContextMenu, { dropDownOptions: dropdownOptions, anchorRef: ref, onClose: () => setVisible(false), onMenuClick: (dropDownOption) => {
|
|
3112
|
+
onClick(dropDownOption);
|
|
3113
|
+
} }))));
|
|
3114
|
+
};
|
|
3115
|
+
|
|
3116
|
+
const getProgramStageData = (response, programStageId, pager) => {
|
|
3117
|
+
const events = response.data.events;
|
|
3118
|
+
const allDataElements = new Set();
|
|
3119
|
+
events.forEach((event) => {
|
|
3120
|
+
event.dataValues.forEach((dv) => allDataElements.add(dv.dataElement));
|
|
3121
|
+
});
|
|
3122
|
+
const stageFromMetaData = response.metadata.programStages.find((stage) => stage.id === programStageId);
|
|
3123
|
+
if (!stageFromMetaData) {
|
|
3124
|
+
throw new Error(`Program stage with ID ${programStageId} not found`);
|
|
3125
|
+
}
|
|
3126
|
+
const entityColumns = Array.from(allDataElements).map((dataElementId) => ({
|
|
3127
|
+
label: stageFromMetaData.programStageDataElements.find((psde) => psde.dataElement.id === dataElementId)?.dataElement.name || dataElementId,
|
|
3128
|
+
key: dataElementId,
|
|
3129
|
+
}));
|
|
3130
|
+
const dataElementsData = events.map((event, idx) => {
|
|
3131
|
+
let row = {
|
|
3132
|
+
event: event.event,
|
|
3133
|
+
index: (pager.page - 1) * pager.pageSize + idx + 1,
|
|
3134
|
+
};
|
|
3135
|
+
allDataElements.forEach((dataElementId) => (row[dataElementId] = ''));
|
|
3136
|
+
event.dataValues.forEach((dv) => (row[dv.dataElement] = dv.value));
|
|
3137
|
+
return row;
|
|
3138
|
+
});
|
|
3139
|
+
return { columns: entityColumns, data: dataElementsData };
|
|
3140
|
+
};
|
|
3141
|
+
const getTrackedEntityData = (response, programId, pager) => {
|
|
3142
|
+
const teis = response.data.trackedEntityInstances;
|
|
3143
|
+
const allAttributes = new Set();
|
|
3144
|
+
teis.forEach((tei) => {
|
|
3145
|
+
const matchingEnrollment = tei.enrollments.find((enrollment) => enrollment.program === programId);
|
|
3146
|
+
const attributes = matchingEnrollment
|
|
3147
|
+
? matchingEnrollment.attributes
|
|
3148
|
+
: tei.attributes;
|
|
3149
|
+
attributes.forEach((attr) => allAttributes.add(attr.attribute));
|
|
3150
|
+
});
|
|
3151
|
+
const entityColumns = Array.from(allAttributes).map((attrId) => {
|
|
3152
|
+
const foundAttribute = teis
|
|
3153
|
+
.flatMap((tei) => {
|
|
3154
|
+
const matchingEnrollment = tei.enrollments.find((enrollment) => enrollment.program === programId);
|
|
3155
|
+
return matchingEnrollment
|
|
3156
|
+
? matchingEnrollment.attributes
|
|
3157
|
+
: tei.attributes;
|
|
3158
|
+
})
|
|
3159
|
+
.find((attr) => attr.attribute === attrId);
|
|
3160
|
+
return {
|
|
3161
|
+
label: foundAttribute?.displayName || attrId,
|
|
3162
|
+
key: attrId,
|
|
3163
|
+
};
|
|
3164
|
+
});
|
|
3165
|
+
const attributesData = teis.map((tei, idx) => {
|
|
3166
|
+
let row = {
|
|
3167
|
+
trackedEntityInstance: tei.trackedEntityInstance,
|
|
3168
|
+
index: (pager.page - 1) * pager.pageSize + idx + 1,
|
|
3169
|
+
};
|
|
3170
|
+
allAttributes.forEach((attrId) => (row[attrId] = ''));
|
|
3171
|
+
const matchingEnrollment = tei.enrollments.find((enrollment) => enrollment.program === programId);
|
|
3172
|
+
const attributesToUse = matchingEnrollment
|
|
3173
|
+
? matchingEnrollment.attributes
|
|
3174
|
+
: tei.attributes;
|
|
3175
|
+
attributesToUse.forEach((attr) => (row[attr.attribute] = attr.value));
|
|
3176
|
+
return row;
|
|
3177
|
+
});
|
|
3178
|
+
return { columns: entityColumns, data: attributesData };
|
|
3179
|
+
};
|
|
3180
|
+
const getEventData = (response, pager) => {
|
|
3181
|
+
const events = response.data.events;
|
|
3182
|
+
const uniqueDataElements = new Set();
|
|
3183
|
+
events.forEach((event) => {
|
|
3184
|
+
event.dataValues.forEach((dv) => uniqueDataElements.add(dv.dataElement));
|
|
3185
|
+
});
|
|
3186
|
+
const entityColumns = Array.from(uniqueDataElements).map((dataElement) => ({
|
|
3187
|
+
label: response.metadata.programStages[0].programStageDataElements.find((psde) => psde.dataElement.id === dataElement)?.dataElement.name || dataElement,
|
|
3188
|
+
key: dataElement,
|
|
3189
|
+
}));
|
|
3190
|
+
const dataElementsData = events.map((event, idx) => {
|
|
3191
|
+
let row = {
|
|
3192
|
+
event: event.event,
|
|
3193
|
+
index: (pager.page - 1) * pager.pageSize + idx + 1,
|
|
3194
|
+
};
|
|
3195
|
+
uniqueDataElements.forEach((dataElement) => (row[dataElement] = ''));
|
|
3196
|
+
event.dataValues.forEach((dv) => (row[dv.dataElement] = dv.value));
|
|
3197
|
+
return row;
|
|
3198
|
+
});
|
|
3199
|
+
return { columns: entityColumns, data: dataElementsData };
|
|
3200
|
+
};
|
|
3201
|
+
const addActionsColumn = (columns, actionOptions) => {
|
|
3202
|
+
return [
|
|
3203
|
+
...columns,
|
|
3204
|
+
...(actionOptions && actionOptions.length > 0
|
|
3205
|
+
? [{ label: 'Actions', key: 'actions' }]
|
|
3206
|
+
: []),
|
|
3207
|
+
];
|
|
3208
|
+
};
|
|
3209
|
+
|
|
3210
|
+
class LineListTableComponent extends ReactWrapperComponent {
|
|
3211
|
+
constructor() {
|
|
3212
|
+
super(...arguments);
|
|
3213
|
+
this.lineListService = inject(LineListService);
|
|
3214
|
+
this.LineList = () => {
|
|
3215
|
+
const [columns, setColumns] = useState([]);
|
|
3216
|
+
const [data, setData] = useState([]);
|
|
3217
|
+
const [pager, setPager] = useState({
|
|
3218
|
+
page: 1,
|
|
3219
|
+
pageSize: 10,
|
|
3220
|
+
total: 0,
|
|
3221
|
+
pageCount: 1,
|
|
3222
|
+
});
|
|
3223
|
+
const paginationRef = useRef(null);
|
|
3224
|
+
useEffect(() => {
|
|
3225
|
+
setTimeout(() => {
|
|
3226
|
+
const paginationContainer = document.querySelector('[data-test="dhis2-uiwidgets-pagination"]');
|
|
3227
|
+
if (paginationContainer) {
|
|
3228
|
+
paginationContainer.style.setProperty('display', 'flex', 'important');
|
|
3229
|
+
paginationContainer.style.setProperty('flex-direction', 'row', 'important');
|
|
3230
|
+
paginationContainer.style.setProperty('justify-content', 'space-between', 'important');
|
|
3231
|
+
paginationContainer.style.setProperty('align-items', 'center', 'important');
|
|
3232
|
+
}
|
|
3233
|
+
}, 1000);
|
|
3234
|
+
if (paginationRef.current) {
|
|
3235
|
+
paginationRef.current.style.setProperty('display', 'flex', 'important');
|
|
3236
|
+
paginationRef.current.style.setProperty('flex-direction', 'row', 'important');
|
|
3237
|
+
}
|
|
3238
|
+
this.lineListService
|
|
3239
|
+
.getLineListData(this.programId, this.orgUnit, this.programStageId, pager.page, pager.pageSize, this.attributeFilters, this.startDate, this.endDate)
|
|
3240
|
+
.subscribe((response) => {
|
|
3241
|
+
let entityColumns = [];
|
|
3242
|
+
let responsePager;
|
|
3243
|
+
let entityData = [];
|
|
3244
|
+
if (this.programStageId) {
|
|
3245
|
+
responsePager = response.data.pager;
|
|
3246
|
+
const { columns, data } = getProgramStageData(response, this.programStageId, pager);
|
|
3247
|
+
entityColumns = columns;
|
|
3248
|
+
entityData = data;
|
|
3249
|
+
}
|
|
3250
|
+
else if ('trackedEntityInstances' in response.data) {
|
|
3251
|
+
responsePager = response.data
|
|
3252
|
+
.pager;
|
|
3253
|
+
const { columns, data } = getTrackedEntityData(response, this.programId, pager);
|
|
3254
|
+
entityColumns = columns;
|
|
3255
|
+
entityData = data;
|
|
3256
|
+
}
|
|
3257
|
+
else {
|
|
3258
|
+
responsePager = response.data.pager;
|
|
3259
|
+
const { columns, data } = getEventData(response, pager);
|
|
3260
|
+
entityColumns = columns;
|
|
3261
|
+
entityData = data;
|
|
3262
|
+
}
|
|
3263
|
+
const finalColumns = addActionsColumn([{ label: '#', key: 'index' }, ...entityColumns], this.actionOptions);
|
|
3264
|
+
setColumns(finalColumns);
|
|
3265
|
+
setData(entityData);
|
|
3266
|
+
setPager(responsePager);
|
|
3267
|
+
});
|
|
3268
|
+
}, [pager.page, pager.pageSize]);
|
|
3269
|
+
console.log('columns', columns);
|
|
3270
|
+
console.log('data', data);
|
|
3271
|
+
const getDropdownOptions = (row) => {
|
|
3272
|
+
return (this.actionOptions || []).map((option) => ({
|
|
3273
|
+
...option,
|
|
3274
|
+
onClick: () => option.onClick?.(row),
|
|
3275
|
+
}));
|
|
3276
|
+
};
|
|
3277
|
+
return (React__default.createElement("div", null,
|
|
3278
|
+
React__default.createElement(DataTable, null,
|
|
3279
|
+
React__default.createElement(TableHead, null,
|
|
3280
|
+
React__default.createElement(DataTableRow, null, columns.map((col) => (React__default.createElement(DataTableColumnHeader, { key: col.key }, col.label))))),
|
|
3281
|
+
React__default.createElement(TableBody, null, data.map((row) => (React__default.createElement(DataTableRow, { key: row.index }, columns.map((col) => (React__default.createElement(DataTableCell, { key: col.key }, col.key === 'actions' ? (React__default.createElement(DropdownMenu, { dropdownOptions: getDropdownOptions(row), onClick: (option) => option.onClick?.() })) : (row[col.key])))))))),
|
|
3282
|
+
React__default.createElement(TableFoot, null,
|
|
3283
|
+
React__default.createElement(DataTableRow, null,
|
|
3284
|
+
React__default.createElement(DataTableCell, { colSpan: columns.length },
|
|
3285
|
+
React__default.createElement("div", null,
|
|
3286
|
+
React__default.createElement(Pagination, { page: pager.page, pageCount: pager.pageCount, pageSize: pager.pageSize, total: pager.total, onPageChange: (page) => setPager((prev) => ({ ...prev, page })), onPageSizeChange: (pageSize) => {
|
|
3287
|
+
const newPageSize = Number(pageSize);
|
|
3288
|
+
setPager((prev) => ({
|
|
3289
|
+
...prev,
|
|
3290
|
+
page: 1,
|
|
3291
|
+
pageSize: newPageSize,
|
|
3292
|
+
}));
|
|
3293
|
+
}, pageSizes: ['5', '10', '20', '50'] }))))))));
|
|
3294
|
+
};
|
|
3295
|
+
}
|
|
3296
|
+
async ngAfterViewInit() {
|
|
3297
|
+
if (!this.elementRef)
|
|
3298
|
+
throw new Error('No element ref');
|
|
3299
|
+
this.reactDomRoot = ReactDOM.createRoot(this.elementRef.nativeElement);
|
|
3300
|
+
this.component = this.LineList;
|
|
3301
|
+
this.render();
|
|
3302
|
+
}
|
|
3303
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: LineListTableComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
3304
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.7", type: LineListTableComponent, isStandalone: false, selector: "app-line-list", inputs: { programId: "programId", orgUnit: "orgUnit", programStageId: "programStageId", actionOptions: "actionOptions", attributeFilters: "attributeFilters", startDate: "startDate", endDate: "endDate" }, usesInheritance: true, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, styles: [""] }); }
|
|
3305
|
+
}
|
|
3306
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: LineListTableComponent, decorators: [{
|
|
3307
|
+
type: Component,
|
|
3308
|
+
args: [{ selector: 'app-line-list', template: '<ng-content></ng-content>', standalone: false }]
|
|
3309
|
+
}], propDecorators: { programId: [{
|
|
3310
|
+
type: Input
|
|
3311
|
+
}], orgUnit: [{
|
|
3312
|
+
type: Input
|
|
3313
|
+
}], programStageId: [{
|
|
3314
|
+
type: Input
|
|
3315
|
+
}], actionOptions: [{
|
|
3316
|
+
type: Input
|
|
3317
|
+
}], attributeFilters: [{
|
|
3318
|
+
type: Input
|
|
3319
|
+
}], startDate: [{
|
|
3320
|
+
type: Input
|
|
3321
|
+
}], endDate: [{
|
|
3322
|
+
type: Input
|
|
3323
|
+
}] } });
|
|
3324
|
+
|
|
3325
|
+
class LineListModule {
|
|
3326
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: LineListModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
3327
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.7", ngImport: i0, type: LineListModule, declarations: [LineListTableComponent], imports: [CommonModule, SharedDhis2UiModule], exports: [LineListTableComponent] }); }
|
|
3328
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: LineListModule, providers: [LineListService], imports: [CommonModule, SharedDhis2UiModule] }); }
|
|
3329
|
+
}
|
|
3330
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: LineListModule, decorators: [{
|
|
3331
|
+
type: NgModule,
|
|
3332
|
+
args: [{
|
|
3333
|
+
declarations: [LineListTableComponent],
|
|
3334
|
+
exports: [LineListTableComponent],
|
|
3335
|
+
imports: [CommonModule, SharedDhis2UiModule],
|
|
3336
|
+
providers: [LineListService],
|
|
3337
|
+
}]
|
|
3338
|
+
}] });
|
|
3339
|
+
|
|
2959
3340
|
/**
|
|
2960
3341
|
* Generated bundle index. Do not edit.
|
|
2961
3342
|
*/
|
|
2962
3343
|
|
|
2963
|
-
export { ButtonComponent, ButtonModule, HeaderBarComponent, HeaderBarModule, OrganisationUnitSelectorComponent, OrganisationUnitSelectorModalComponent, OrganisationUnitSelectorModule, PeriodSelectorComponent, PeriodSelectorModalComponent, PeriodSelectorModule, ReactWrapperComponent, ReactWrapperModule };
|
|
3344
|
+
export { ButtonComponent, ButtonModule, HeaderBarComponent, HeaderBarModule, LineListModule, LineListTableComponent, OrganisationUnitSelectionConfig, OrganisationUnitSelectorComponent, OrganisationUnitSelectorModalComponent, OrganisationUnitSelectorModule, PeriodSelectorComponent, PeriodSelectorModalComponent, PeriodSelectorModule, ReactWrapperComponent, ReactWrapperModule };
|
|
2964
3345
|
//# sourceMappingURL=iapps-ng-dhis2-ui.mjs.map
|