@iapps/ng-dhis2-ui 1.1.53 → 1.1.55

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.
@@ -1,7 +1,7 @@
1
1
  import * as i1$1 from '@angular/common';
2
2
  import { CommonModule } from '@angular/common';
3
3
  import * as i0 from '@angular/core';
4
- import { NgModule, Directive, Input, ContentChild, Component, EventEmitter, Output, inject, NgZone, input, ChangeDetectionStrategy, Injectable, model, signal, computed, ViewChildren } from '@angular/core';
4
+ import { NgModule, Directive, Input, ContentChild, Component, EventEmitter, Output, inject, 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
6
  import * as i1 from '@iapps/ngx-dhis2-http-client';
7
7
  import { NgxDhis2HttpClientService } from '@iapps/ngx-dhis2-http-client';
@@ -25,8 +25,8 @@ import { Layer } from '@dhis2-ui/layer';
25
25
  import { CircularLoader } from '@dhis2-ui/loader';
26
26
  import { MenuItem, MenuDivider } from '@dhis2-ui/menu';
27
27
  import parse from 'html-react-parser';
28
- import { Button as Button$1, IconDimensionData16, IconClock16, IconDimensionOrgUnit16, 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, Layer as Layer$1, Popper, FlyoutMenu, MenuItem as MenuItem$1, IconMore24, CircularLoader as CircularLoader$1, IconFilter16, DataTable, TableHead, DataTableRow, DataTableColumnHeader, TableBody, DataTableCell, TableFoot, Pagination, Chip, FileInputField, FileListItem, MultiSelectField, TextAreaField } from '@dhis2/ui';
29
- import { isObject, isString, sortBy, isArray, find, camelCase, flatten, debounce, isUndefined, head, isEmpty } from 'lodash';
28
+ import { Button as Button$1, IconDimensionData16, IconClock16, IconDimensionOrgUnit16, 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, Layer as Layer$1, Popper, FlyoutMenu, MenuItem as MenuItem$1, IconMore24, CircularLoader as CircularLoader$1, IconFilter16, DataTable, TableHead, DataTableRow, DataTableColumnHeader, TableBody, DataTableCell, TableFoot, Pagination, FileInputField, FileListItem, Chip, MultiSelectField, TextAreaField } from '@dhis2/ui';
29
+ import { isObject, isString, sortBy, isArray, find, camelCase, flatten, isUndefined, debounce, head, isEmpty } from 'lodash';
30
30
  import cx from 'classnames';
31
31
  import { getNowInCalendar, generateFixedPeriods } from '@dhis2/multi-calendar-dates';
32
32
  import { map as map$1, switchMap } from 'rxjs/operators';
@@ -3295,15 +3295,24 @@ class LineListService {
3295
3295
  getProgramMetadata(programId) {
3296
3296
  return this.httpClient.get(`programs/${programId}.json?fields=programType,programStages[id,name,programStageDataElements[dataElement[id,name]]],organisationUnits[id,name],*`);
3297
3297
  }
3298
- getTrackedEntityInstances(programId, orgUnit, page, pageSize, filters = [], startDate, endDate, ouMode) {
3298
+ getTrackedEntityInstances(programId, orgUnit, page, pageSize, filters = [], startDate, endDate, ouMode, filterRootOrgUnit) {
3299
3299
  const filterParams = buildFilters(filters);
3300
3300
  const dateFilter = startDate && endDate ? `&programStartDate=${startDate}&programEndDate=${endDate}` : '';
3301
3301
  const ouModeIdentifier = ouMode ? `&ouMode=${ouMode}` : ``;
3302
3302
  return this.httpClient.get(`trackedEntityInstances.json?program=${programId}&ou=${orgUnit}${ouModeIdentifier}&page=${page}&pageSize=${pageSize}&fields=trackedEntityInstance,orgUnit,attributes[*,displayInList],enrollments[*]&totalPages=true&${filterParams}${dateFilter}&order=created:desc`).pipe(map$1((response) => {
3303
- //TODO: use the api to to order by desc
3304
- // response.trackedEntityInstances.reverse();
3303
+ if (filterRootOrgUnit) {
3304
+ response.trackedEntityInstances = response.trackedEntityInstances.filter((tei) => tei.orgUnit !== orgUnit // Exclude TEIs with the root orgUnit
3305
+ );
3306
+ }
3305
3307
  return response;
3306
3308
  }));
3309
+ // pipe(
3310
+ // map((response: any) => {
3311
+ // //TODO: use the api to to order by desc
3312
+ // // response.trackedEntityInstances.reverse();
3313
+ // return response;
3314
+ // })
3315
+ // );
3307
3316
  }
3308
3317
  getEvents(programId, orgUnit, page, pageSize, filters = [], startDate, endDate, ouMode) {
3309
3318
  const filterParams = buildFilters(filters);
@@ -3317,7 +3326,7 @@ class LineListService {
3317
3326
  const ouModeIdentifier = ouMode ? `&ouMode=${ouMode}` : ``;
3318
3327
  return this.httpClient.get(`events.json?programStage=${programStageId}&orgUnit=${orgUnit}${ouModeIdentifier}&page=${page}&pageSize=${pageSize}&fields=*&totalPages=true&${filterParams}${dateFilter}`);
3319
3328
  }
3320
- getLineListData(programId, orgUnit = '', programStageId, page = 1, pageSize = 10, filters = [], startDate, endDate, ouMode) {
3329
+ getLineListData(programId, orgUnit = '', programStageId, page = 1, pageSize = 10, filters = [], startDate, endDate, ouMode, filterRootOrgUnit) {
3321
3330
  return this.getProgramMetadata(programId).pipe(switchMap((programMetadata) => {
3322
3331
  if (programStageId) {
3323
3332
  return this.getEventsByProgramStage(programStageId, orgUnit, page, pageSize, filters, startDate, endDate, ouMode).pipe(map$1((events) => ({
@@ -3326,7 +3335,7 @@ class LineListService {
3326
3335
  })));
3327
3336
  }
3328
3337
  if (programMetadata.programType === 'WITH_REGISTRATION') {
3329
- return this.getTrackedEntityInstances(programId, orgUnit, page, pageSize, filters, startDate, endDate, ouMode).pipe(map$1((teis) => ({
3338
+ return this.getTrackedEntityInstances(programId, orgUnit, page, pageSize, filters, startDate, endDate, ouMode, filterRootOrgUnit).pipe(map$1((teis) => ({
3330
3339
  metadata: programMetadata,
3331
3340
  data: teis,
3332
3341
  })));
@@ -3378,7 +3387,10 @@ const getTrackedEntityData = (response, programId, pager, filters) => {
3378
3387
  //organisation units from metadata
3379
3388
  let orgUnitsFromMetaData = response.metadata.organisationUnits;
3380
3389
  //a Map to efficiently look up orgUnit names by ID
3381
- const orgUnitMap = new Map(orgUnitsFromMetaData.map((ou) => [ou.id, ou.name]));
3390
+ const orgUnitMap = new Map(orgUnitsFromMetaData.map((ou) => [
3391
+ ou.id,
3392
+ ou.name,
3393
+ ]));
3382
3394
  const mappedProgramMetadataAttributes = programMetaData.map((attr) => ({
3383
3395
  displayInList: attr.displayInList,
3384
3396
  searchable: attr.searchable,
@@ -3449,11 +3461,17 @@ const getTrackedEntityData = (response, programId, pager, filters) => {
3449
3461
  ? matchingEnrollment.attributes
3450
3462
  : tei.attributes;
3451
3463
  attributesToUse.forEach((attr) => (row[attr.attribute] = attr.value));
3464
+ //include orgUnit in the row for id access
3465
+ row['orgUnitId'] = tei.orgUnit;
3452
3466
  // Access the name of the orgUnit using the Map
3453
3467
  row['orgUnit'] = orgUnitMap.get(tei.orgUnit) || tei.orgUnit || 'N/A';
3454
3468
  return row;
3455
3469
  });
3456
- return { columns: entityColumns, data: attributesData, filteredEntityColumns: filteredEntityColumns };
3470
+ return {
3471
+ columns: entityColumns,
3472
+ data: attributesData,
3473
+ filteredEntityColumns: filteredEntityColumns,
3474
+ };
3457
3475
  };
3458
3476
  const getEventData = (response, pager) => {
3459
3477
  const events = response.data.events;
@@ -3497,6 +3515,7 @@ class LineListTableComponent extends ReactWrapperModule {
3497
3515
  this.isButtonLoading = false;
3498
3516
  this.buttonLabel = '';
3499
3517
  this.firstValue = new EventEmitter();
3518
+ this.filterRootOrgUnit = false;
3500
3519
  this.setReactStateUpdaters = (updaters) => {
3501
3520
  this.reactStateUpdaters = updaters;
3502
3521
  };
@@ -3556,7 +3575,7 @@ class LineListTableComponent extends ReactWrapperModule {
3556
3575
  this.lineListService
3557
3576
  .getLineListData(this.programId, this.orgUnit, this.programStageId, pager.page, pager.pageSize, attributeFiltersState,
3558
3577
  // this.attributeFilters,
3559
- this.startDate, this.endDate, this.ouMode)
3578
+ this.startDate, this.endDate, this.ouMode, this.filterRootOrgUnit)
3560
3579
  .subscribe((response) => {
3561
3580
  let entityColumns = [];
3562
3581
  let responsePager;
@@ -3782,7 +3801,7 @@ class LineListTableComponent extends ReactWrapperModule {
3782
3801
  this.render();
3783
3802
  }
3784
3803
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: LineListTableComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
3785
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.8", type: LineListTableComponent, isStandalone: false, selector: "app-line-list", inputs: { programId: "programId", orgUnit: "orgUnit", programStageId: "programStageId", actionOptions: "actionOptions", attributeFilters: "attributeFilters", startDate: "startDate", endDate: "endDate", filters: "filters", ouMode: "ouMode", dispatchTeis: "dispatchTeis", showFilterButton: "showFilterButton", isButtonLoading: "isButtonLoading", buttonLabel: "buttonLabel", buttonFilter: "buttonFilter" }, outputs: { actionSelected: "actionSelected", approvalSelected: "approvalSelected", firstValue: "firstValue" }, usesInheritance: true, usesOnChanges: true, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, styles: ["[data-test=dhis2-uiwidgets-pagination]{display:flex!important;flex-direction:row!important;justify-content:space-between!important;align-items:center!important}\n"] }); }
3804
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.8", type: LineListTableComponent, isStandalone: false, selector: "app-line-list", inputs: { programId: "programId", orgUnit: "orgUnit", programStageId: "programStageId", actionOptions: "actionOptions", attributeFilters: "attributeFilters", startDate: "startDate", endDate: "endDate", filters: "filters", ouMode: "ouMode", dispatchTeis: "dispatchTeis", showFilterButton: "showFilterButton", isButtonLoading: "isButtonLoading", buttonLabel: "buttonLabel", buttonFilter: "buttonFilter", filterRootOrgUnit: "filterRootOrgUnit" }, outputs: { actionSelected: "actionSelected", approvalSelected: "approvalSelected", firstValue: "firstValue" }, usesInheritance: true, usesOnChanges: true, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, styles: ["[data-test=dhis2-uiwidgets-pagination]{display:flex!important;flex-direction:row!important;justify-content:space-between!important;align-items:center!important}\n"] }); }
3786
3805
  }
3787
3806
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: LineListTableComponent, decorators: [{
3788
3807
  type: Component,
@@ -3821,6 +3840,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImpor
3821
3840
  type: Output
3822
3841
  }], buttonFilter: [{
3823
3842
  type: Input
3843
+ }], filterRootOrgUnit: [{
3844
+ type: Input
3824
3845
  }] } });
3825
3846
 
3826
3847
  class LineListModule {
@@ -4040,6 +4061,50 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImpor
4040
4061
  }]
4041
4062
  }] });
4042
4063
 
4064
+ // Copyright 2025 UDSM DHIS2 Lab. All rights reserved.
4065
+ // Use of this source code is governed by a BSD-style
4066
+ // license that can be found in the LICENSE file.
4067
+ const useFieldValidation = (props) => {
4068
+ const { form, touched, field, value } = props;
4069
+ const hasError = useMemo(() => {
4070
+ return touched && (form.get(field.id) || form.get(field.key))?.invalid;
4071
+ }, [value, touched]);
4072
+ const validationError = useMemo(() => {
4073
+ if (!touched) {
4074
+ return undefined;
4075
+ }
4076
+ const error = (form.get(field.id) || form.get(field.key))?.errors;
4077
+ if (!error) {
4078
+ return undefined;
4079
+ }
4080
+ if (error['min']) {
4081
+ return `${field.label || 'Value'} should not be less than ${error['min'].min}!`;
4082
+ }
4083
+ else if (error['max']) {
4084
+ return `${field.label || 'Value'} should not be greater than ${error['max'].max}!`;
4085
+ }
4086
+ else if (error['pattern']) {
4087
+ if (field.type === 'email') {
4088
+ return `The email address provided is not valid`;
4089
+ }
4090
+ else if (field.type === 'tel') {
4091
+ return 'Phone number provided is not valid';
4092
+ }
4093
+ else {
4094
+ return `${field.label || 'Value'} should have appropriate format`;
4095
+ }
4096
+ }
4097
+ return error['required']
4098
+ ? `${field.label || 'Value'} is required`
4099
+ : undefined;
4100
+ }, [hasError]);
4101
+ return { hasError, validationError };
4102
+ };
4103
+
4104
+ // Copyright 2025 UDSM DHIS2 Lab. All rights reserved.
4105
+ // Use of this source code is governed by a BSD-style
4106
+ // license that can be found in the LICENSE file.
4107
+
4043
4108
  class FormField {
4044
4109
  constructor(options = {}) {
4045
4110
  this.value = options.value || '';
@@ -4053,11 +4118,10 @@ class FormField {
4053
4118
  this.controlType = options.controlType;
4054
4119
  this.type = options.type || '';
4055
4120
  this.options = options.options || [];
4056
- this.disabled = options.disabled || false;
4121
+ this.disabled = options.disabled ?? false;
4057
4122
  this.placeholder = options.placeholder || '';
4058
4123
  this.min = options.min;
4059
- this.max =
4060
- options.max || (this.controlType === 'date' ? new Date() : undefined);
4124
+ this.max = this.setMax(options);
4061
4125
  this.maxLength = options.maxLength;
4062
4126
  this.hidden = options.hidden || false;
4063
4127
  this.unique = options.unique || false;
@@ -4082,6 +4146,16 @@ class FormField {
4082
4146
  options.availableOptionsLabel ?? 'Available options';
4083
4147
  this.selectedOptionsLabel =
4084
4148
  options.availableOptionsLabel ?? 'Selected options';
4149
+ this.allowFutureDate = options.allowFutureDate;
4150
+ }
4151
+ setMax(field) {
4152
+ if (field.controlType !== 'date') {
4153
+ return field.max;
4154
+ }
4155
+ if (field.allowFutureDate) {
4156
+ return undefined;
4157
+ }
4158
+ return format(new Date(), 'yyyy-MM-dd');
4085
4159
  }
4086
4160
  }
4087
4161
 
@@ -4562,8 +4636,9 @@ class FormFieldGroup {
4562
4636
  }
4563
4637
 
4564
4638
  class MetadataRuleAction {
4565
- constructor(ruleAction) {
4639
+ constructor(ruleAction, ruleVariables) {
4566
4640
  this.ruleAction = ruleAction;
4641
+ this.ruleVariables = ruleVariables;
4567
4642
  }
4568
4643
  get field() {
4569
4644
  return (this.ruleAction.dataElement?.id ||
@@ -4572,10 +4647,36 @@ class MetadataRuleAction {
4572
4647
  get actionType() {
4573
4648
  return this.ruleAction.programRuleActionType;
4574
4649
  }
4650
+ get assignedData() {
4651
+ const regex = /(A|#|V)\{([^}]+)\}/g;
4652
+ return this.ruleAction?.data?.replace(regex, (match, _, dataVariable) => {
4653
+ const ruleVariableObject = this.ruleVariables?.find((variable) => variable.name === dataVariable);
4654
+ if (!ruleVariableObject) {
4655
+ return `{${dataVariable}}`;
4656
+ }
4657
+ const code = camelCase(ruleVariableObject?.dataElement?.code) ||
4658
+ ruleVariableObject?.dataElement?.id ||
4659
+ camelCase(ruleVariableObject?.trackedEntityAttribute?.code) ||
4660
+ ruleVariableObject?.trackedEntityAttribute?.id;
4661
+ return `{${code}}`;
4662
+ });
4663
+ }
4664
+ get displayedContent() {
4665
+ return this.ruleAction.displayContent;
4666
+ }
4667
+ get options() {
4668
+ if (this.ruleAction.option) {
4669
+ return [this.ruleAction.option];
4670
+ }
4671
+ return this.ruleAction.optionGroup?.options || [];
4672
+ }
4575
4673
  toJson() {
4576
4674
  return {
4577
4675
  field: this.field,
4578
4676
  actionType: this.actionType,
4677
+ assignedData: this.assignedData,
4678
+ displayedContent: this.ruleAction.displayContent,
4679
+ options: this.options,
4579
4680
  };
4580
4681
  }
4581
4682
  }
@@ -4585,10 +4686,10 @@ class MetadataRule {
4585
4686
  this.ruleVariables = ruleVariables;
4586
4687
  }
4587
4688
  get actions() {
4588
- return (this.rule?.programRuleActions || []).map((action) => new MetadataRuleAction(action));
4689
+ return (this.rule?.programRuleActions || []).map((action) => new MetadataRuleAction(action, this.ruleVariables));
4589
4690
  }
4590
4691
  get condition() {
4591
- const regex = /(A|#)\{([^}]+)\}/g;
4692
+ const regex = /(A|#|V)\{([^}]+)\}/g;
4592
4693
  return this.rule?.condition?.replace(regex, (match, _, ruleVariable) => {
4593
4694
  const ruleVariableObject = this.ruleVariables?.find((variable) => variable.name === ruleVariable);
4594
4695
  const code = camelCase(ruleVariableObject?.dataElement?.code) ||
@@ -4617,6 +4718,7 @@ class FormMetadataSection {
4617
4718
  formName: (programTrackedEntityAttribute['trackedEntityAttribute'] || {})['name'],
4618
4719
  sortOrder: programTrackedEntityAttribute['sortOrder'],
4619
4720
  mandatory: programTrackedEntityAttribute['mandatory'],
4721
+ allowFutureDate: programTrackedEntityAttribute['allowFutureDate'],
4620
4722
  metaType: 'ATTRIBUTE',
4621
4723
  };
4622
4724
  });
@@ -4629,6 +4731,7 @@ class FormMetadataSection {
4629
4731
  ...(stageDataElement['dataElement'] ||
4630
4732
  {}),
4631
4733
  mandatory: stageDataElement['compulsory'],
4734
+ allowFutureDate: stageDataElement['allowFutureDate'],
4632
4735
  stepId: programStage['id'],
4633
4736
  metaType: 'DATA_ELEMENT',
4634
4737
  };
@@ -4803,6 +4906,7 @@ class FormMetaData {
4803
4906
  code: 'enrollmentDate',
4804
4907
  key: 'enrollmentDate',
4805
4908
  required: true,
4909
+ disabled: this.params.disableEnrollmentDate,
4806
4910
  }),
4807
4911
  program.displayIncidentDate
4808
4912
  ? new DateField({
@@ -4887,6 +4991,7 @@ class FormMetaData {
4887
4991
  code: 'enrollmentDate',
4888
4992
  key: 'enrollmentDate',
4889
4993
  required: true,
4994
+ disabled: this.params.disableEnrollmentDate,
4890
4995
  }),
4891
4996
  program.displayIncidentDate
4892
4997
  ? new DateField({
@@ -4976,47 +5081,62 @@ class FormValue {
4976
5081
  // Copyright 2025 UDSM DHIS2 Lab. All rights reserved.
4977
5082
  // Use of this source code is governed by a BSD-style
4978
5083
  // license that can be found in the LICENSE file.
4979
- const useFieldValidation = (props) => {
4980
- const { form, touched, field, value } = props;
4981
- const hasError = useMemo(() => {
4982
- return touched && (form.get(field.id) || form.get(field.key))?.invalid;
4983
- }, [value, touched]);
4984
- const validationError = useMemo(() => {
4985
- if (!touched) {
4986
- return undefined;
4987
- }
4988
- const error = (form.get(field.id) || form.get(field.key))?.errors;
4989
- if (!error) {
5084
+ const FileUploadField = (props) => {
5085
+ const { label, id, uploadUrl, performUpload, validationText, required, hasError, onChange, onUploadSuccess, } = props;
5086
+ const d2 = window?.d2Web;
5087
+ const [file, setFile] = useState(null);
5088
+ const [uploading, setUploading] = useState();
5089
+ const valid = useMemo(() => {
5090
+ if (isUndefined(hasError)) {
4990
5091
  return undefined;
4991
5092
  }
4992
- if (error['min']) {
4993
- return `${field.label || 'Value'} should not be less than ${error['min'].min}!`;
4994
- }
4995
- else if (error['max']) {
4996
- return `${field.label || 'Value'} should not be greater than ${error['max'].max}!`;
4997
- }
4998
- else if (error['pattern']) {
4999
- if (field.type === 'email') {
5000
- return `The email address provided is not valid`;
5093
+ return !hasError;
5094
+ }, [hasError]);
5095
+ const uploadFile = async (fileItem) => {
5096
+ if (fileItem) {
5097
+ setUploading(true);
5098
+ const formData = new FormData();
5099
+ formData.append('file', fileItem);
5100
+ try {
5101
+ const fileUploadResponse = await d2.httpInstance.post(uploadUrl, formData);
5102
+ setUploading(false);
5103
+ const fileId = fileUploadResponse?.data?.response?.fileResource
5104
+ ?.id;
5105
+ if (fileId) {
5106
+ onUploadSuccess(fileId);
5107
+ }
5001
5108
  }
5002
- else if (field.type === 'tel') {
5003
- return 'Phone number provided is not valid';
5109
+ catch (error) {
5110
+ setUploading(false);
5111
+ }
5112
+ }
5113
+ };
5114
+ return (React__default.createElement(FileInputField, { accept: "*", buttonLabel: "Upload a file", label: label, name: id, required: required, validationText: validationText, onChange: (event) => {
5115
+ const fileItem = (event?.files || [])[0];
5116
+ setFile(fileItem);
5117
+ if (performUpload) {
5118
+ uploadFile(fileItem);
5004
5119
  }
5005
5120
  else {
5006
- return `${field.label || 'Value'} should have appropriate format`;
5121
+ onChange(file);
5007
5122
  }
5008
- }
5009
- return error['required']
5010
- ? `${field.label || 'Value'} is required`
5011
- : undefined;
5012
- }, [hasError]);
5013
- return { hasError, validationError };
5123
+ // this.ngZone.run(() => {
5124
+ // this.form().get(this.field().id) ||
5125
+ // this.form()
5126
+ // .get(this.field().key)
5127
+ // ?.setValue((event?.files || [])[0]);
5128
+ // this.update.emit({
5129
+ // form: this.form(),
5130
+ // value: (event?.files || [])[0],
5131
+ // });
5132
+ // });
5133
+ // setValue((event?.files || [])[0]);
5134
+ // setTouched(true);
5135
+ } }, file && (React__default.createElement(FileListItem, { cancelText: "Cancel", label: file.name, loading: uploading, onRemove: () => {
5136
+ setFile(null);
5137
+ }, removeText: "Remove" }))));
5014
5138
  };
5015
5139
 
5016
- // Copyright 2025 UDSM DHIS2 Lab. All rights reserved.
5017
- // Use of this source code is governed by a BSD-style
5018
- // license that can be found in the LICENSE file.
5019
-
5020
5140
  // Copyright 2025 UDSM DHIS2 Lab. All rights reserved.
5021
5141
  // Use of this source code is governed by a BSD-style
5022
5142
  // license that can be found in the LICENSE file.
@@ -5201,65 +5321,6 @@ const OrgUnitFormField = (props) => {
5201
5321
  React__default.createElement(CircularLoader$1, { small: true }))) : (React__default.createElement("div", { className: classes.orgUnitTreeContainer, style: { maxHeight: '200px', overflowY: 'auto' } }, renderOrgUnitTree()))))))));
5202
5322
  };
5203
5323
 
5204
- // Copyright 2025 UDSM DHIS2 Lab. All rights reserved.
5205
- // Use of this source code is governed by a BSD-style
5206
- // license that can be found in the LICENSE file.
5207
- const FileUploadField = (props) => {
5208
- const { label, id, uploadUrl, performUpload, validationText, required, hasError, onChange, onUploadSuccess, } = props;
5209
- const d2 = window?.d2Web;
5210
- const [file, setFile] = useState(null);
5211
- const [uploading, setUploading] = useState();
5212
- const valid = useMemo(() => {
5213
- if (isUndefined(hasError)) {
5214
- return undefined;
5215
- }
5216
- return !hasError;
5217
- }, [hasError]);
5218
- const uploadFile = async (fileItem) => {
5219
- if (fileItem) {
5220
- setUploading(true);
5221
- const formData = new FormData();
5222
- formData.append('file', fileItem);
5223
- try {
5224
- const fileUploadResponse = await d2.httpInstance.post(uploadUrl, formData);
5225
- setUploading(false);
5226
- const fileId = fileUploadResponse?.data?.response?.fileResource
5227
- ?.id;
5228
- if (fileId) {
5229
- onUploadSuccess(fileId);
5230
- }
5231
- }
5232
- catch (error) {
5233
- setUploading(false);
5234
- }
5235
- }
5236
- };
5237
- return (React__default.createElement(FileInputField, { accept: "*", buttonLabel: "Upload a file", label: label, name: id, required: required, validationText: validationText, onChange: (event) => {
5238
- const fileItem = (event?.files || [])[0];
5239
- setFile(fileItem);
5240
- if (performUpload) {
5241
- uploadFile(fileItem);
5242
- }
5243
- else {
5244
- onChange(file);
5245
- }
5246
- // this.ngZone.run(() => {
5247
- // this.form().get(this.field().id) ||
5248
- // this.form()
5249
- // .get(this.field().key)
5250
- // ?.setValue((event?.files || [])[0]);
5251
- // this.update.emit({
5252
- // form: this.form(),
5253
- // value: (event?.files || [])[0],
5254
- // });
5255
- // });
5256
- // setValue((event?.files || [])[0]);
5257
- // setTouched(true);
5258
- } }, file && (React__default.createElement(FileListItem, { cancelText: "Cancel", label: file.name, loading: uploading, onRemove: () => {
5259
- setFile(null);
5260
- }, removeText: "Remove" }))));
5261
- };
5262
-
5263
5324
  // Copyright 2024 UDSM DHIS2 Lab. All rights reserved.
5264
5325
  // Use of this source code is governed by a BSD-style
5265
5326
  // license that can be found in the LICENSE file.
@@ -5273,43 +5334,10 @@ class BaseFormFieldComponent extends ReactWrapperModule {
5273
5334
  this.fieldConfig = input(new FieldConfig());
5274
5335
  this.form = model.required();
5275
5336
  this.isValid = input();
5276
- this.uploadedFiles = [];
5337
+ this.isValueAssigned = input();
5277
5338
  this.value = model();
5278
5339
  this.value$ = toObservable(this.value);
5279
- this.FieldOrgUnitSelector = (props) => {
5280
- const { onSelectOrgUnit, selectedOrgUnits } = props;
5281
- const [selected, setSelected] = useState(selectedOrgUnits);
5282
- const [rootOrgUnits, setRootOrgUnits] = useState();
5283
- const [config, setConfig] = useState();
5284
- useEffect(() => {
5285
- zip(this.getAppConfig(), this.getRootOrgUnits()).subscribe({
5286
- next: ([appConfig, rootOrgUnits]) => {
5287
- setConfig(appConfig);
5288
- setRootOrgUnits(rootOrgUnits);
5289
- },
5290
- error: (error) => console.error(error),
5291
- });
5292
- }, []);
5293
- return config ? (React__default.createElement(Provider, { config: config, plugin: false, parentAlertsAdd: undefined, showAlertsInPlugin: false }, React__default.createElement(Modal$1, { position: "middle", large: true },
5294
- React__default.createElement(ModalTitle$1, null,
5295
- "Select ",
5296
- this.field().label),
5297
- React__default.createElement(ModalContent$1, null,
5298
- React__default.createElement(OrgUnitDimension, { selected: selected, allowSingleSelection: true, hideGroupSelect: this.orgUnitSelectionConfig.hideGroupSelect, hideLevelSelect: this.orgUnitSelectionConfig.hideLevelSelect, hideUserOrgUnits: this.orgUnitSelectionConfig.hideUserOrgUnits, onSelect: (selectionEvent) => {
5299
- setSelected(selectionEvent.items);
5300
- onSelectOrgUnit(selectionEvent.items);
5301
- }, orgUnitGroupPromise: this.getOrgUnitGroups(), orgUnitLevelPromise: this.getOrgUnitLevels(), roots: rootOrgUnits }))))) : (React__default.createElement(CircularLoader$1, { small: true }));
5302
- };
5303
- this.showOrgUnitTree = signal(false);
5304
- this.orgUnitSelectionConfig = {
5305
- hideGroupSelect: true,
5306
- hideLevelSelect: true,
5307
- hideUserOrgUnits: true,
5308
- allowSingleSelection: true,
5309
- usageType: 'DATA_ENTRY',
5310
- };
5311
- this.selectedOrgUnit = signal(null);
5312
- this.selectedOrgUnit$ = toObservable(this.selectedOrgUnit);
5340
+ this.isValueAssigned$ = toObservable(this.isValueAssigned);
5313
5341
  this.label = computed(() => {
5314
5342
  return !this.fieldConfig()?.hideLabel ? this.field().label : undefined;
5315
5343
  });
@@ -5338,10 +5366,16 @@ class BaseFormFieldComponent extends ReactWrapperModule {
5338
5366
  return () => {
5339
5367
  const [value, setValue] = useState(this.form().get(this.field().id)?.value ||
5340
5368
  this.form().get(this.field().key)?.value);
5341
- const [displayValue, setDisplayValue] = useState(null);
5342
5369
  const [selected, setSelected] = useState();
5343
5370
  const [touched, setTouched] = useState(false);
5344
- const [showOrgUnit, setShowOrgUnit] = useState(false);
5371
+ const [disabled, setDisabled] = useState(this.field()?.disabled ?? this.field()?.generated ?? false);
5372
+ useEffect(() => {
5373
+ if (this.isValueAssigned()) {
5374
+ setDisabled(true);
5375
+ setValue(this.form().get(this.field().id)?.value ||
5376
+ this.form().get(this.field().key)?.value);
5377
+ }
5378
+ }, [this.isValueAssigned()]);
5345
5379
  const onChange = (payload) => setSelected(payload.selected);
5346
5380
  const arrayValue = useMemo(() => {
5347
5381
  if (value && value.length > 0) {
@@ -5404,10 +5438,7 @@ class BaseFormFieldComponent extends ReactWrapperModule {
5404
5438
  this.update.emit({ form: this.form(), value });
5405
5439
  } }));
5406
5440
  case 'checkbox':
5407
- return (React__default.createElement(Checkbox, { checked: Boolean(value), error: hasError, label: this.label(), name: this.field().id, disabled: this.field()?.disabled ||
5408
- this.field()?.generated ||
5409
- this.field()?.unique ||
5410
- false, onChange: (event) => {
5441
+ return (React__default.createElement(Checkbox, { checked: Boolean(value), error: hasError, label: this.label(), name: this.field().id, disabled: disabled, onChange: (event) => {
5411
5442
  this.ngZone.run(() => {
5412
5443
  (this.form().get(this.field().id) ||
5413
5444
  this.form().get(this.field().key))?.setValue(event.checked);
@@ -5420,10 +5451,7 @@ class BaseFormFieldComponent extends ReactWrapperModule {
5420
5451
  });
5421
5452
  } }));
5422
5453
  case 'dropdown':
5423
- return (React__default.createElement(SingleSelectField, { filterable: (this.field().options || []).length > 5, clearable: true, error: hasError, validationText: validationError, inputWidth: this.fieldConfig()?.inputWidth, disabled: this.field()?.disabled ||
5424
- this.field()?.generated ||
5425
- this.field()?.unique ||
5426
- false, required: this.field().required, className: "select", label: this.label(), selected: value, onChange: (event) => {
5454
+ return (React__default.createElement(SingleSelectField, { filterable: (this.field().options || []).length > 5, clearable: true, error: hasError, validationText: validationError, inputWidth: this.fieldConfig()?.inputWidth, disabled: disabled, required: this.field().required, className: "select", label: this.label(), selected: value, onChange: (event) => {
5427
5455
  this.ngZone.run(() => {
5428
5456
  (this.form().get(this.field().id) ||
5429
5457
  this.form().get(this.field().key))?.setValue(event.selected);
@@ -5436,10 +5464,7 @@ class BaseFormFieldComponent extends ReactWrapperModule {
5436
5464
  setTouched(true);
5437
5465
  } }, (this.field().options || []).map((option) => (React__default.createElement(SingleSelectOption, { key: crypto.randomUUID() || option.key, label: option.label, value: option.value })))));
5438
5466
  case 'multi-dropdown':
5439
- return (React__default.createElement(MultiSelectField, { clearText: "Clear", clearable: true, empty: "No data found", filterable: (this.field().options || []).length > 5, filterPlaceholder: "Type to filter options", error: hasError, validationText: validationError, inputWidth: this.fieldConfig()?.inputWidth, disabled: this.field()?.disabled ||
5440
- this.field()?.generated ||
5441
- this.field()?.unique ||
5442
- false, label: this.label(), required: this.field().required, loadingText: "Loading options", noMatchText: "No options found", onChange: (event) => {
5467
+ return (React__default.createElement(MultiSelectField, { clearText: "Clear", clearable: true, empty: "No data found", filterable: (this.field().options || []).length > 5, filterPlaceholder: "Type to filter options", error: hasError, validationText: validationError, inputWidth: this.fieldConfig()?.inputWidth, disabled: disabled, label: this.label(), required: this.field().required, loadingText: "Loading options", noMatchText: "No options found", onChange: (event) => {
5443
5468
  const selectedValue = (event.selected || []).join(',');
5444
5469
  this.ngZone.run(() => {
5445
5470
  (this.form().get(this.field().id) ||
@@ -5467,13 +5492,7 @@ class BaseFormFieldComponent extends ReactWrapperModule {
5467
5492
  setTouched(true);
5468
5493
  } })));
5469
5494
  default:
5470
- return (React__default.createElement(InputField$1, { error: hasError, validationText: validationError, type: this.field().type, inputWidth: this.fieldConfig()?.inputWidth, required: this.field().required, name: this.field().id, label: this.label(), min: this.field().min?.toString(), max: this.field().max?.toString(), placeholder: this.placeholder(), value: value, disabled: this.field()?.disabled ||
5471
- this.field()?.generated ||
5472
- this.field()?.unique ||
5473
- false, readOnly: this.field()?.disabled ||
5474
- this.field()?.generated ||
5475
- this.field()?.unique ||
5476
- false, onChange: (event) => {
5495
+ return (React__default.createElement(InputField$1, { error: hasError, validationText: validationError, type: this.field().type, inputWidth: this.fieldConfig()?.inputWidth, required: this.field().required, name: this.field().id, label: this.label(), min: this.field().min?.toString(), max: this.field().max?.toString(), placeholder: this.placeholder(), value: value, readOnly: disabled, onChange: (event) => {
5477
5496
  this.ngZone.run(() => {
5478
5497
  (this.form().get(this.field().id) ||
5479
5498
  this.form().get(this.field().key))?.setValue(event.value);
@@ -5495,54 +5514,8 @@ class BaseFormFieldComponent extends ReactWrapperModule {
5495
5514
  onChange(event) {
5496
5515
  this.value.set(event);
5497
5516
  }
5498
- onSelectOrgUnit(selectedOrgUnits) {
5499
- this.showOrgUnitTree.set(false);
5500
- if ((selectedOrgUnits || [])[0]) {
5501
- this.selectedOrgUnit.set(selectedOrgUnits[0]);
5502
- }
5503
- }
5504
- onCancelOrgUnit() {
5505
- this.showOrgUnitTree.set(false);
5506
- }
5507
- getAppConfig() {
5508
- return this.httpClient.systemInfo().pipe(map((response) => {
5509
- const systemInfo = response;
5510
- return {
5511
- baseUrl: (document?.location?.host?.includes('localhost')
5512
- ? `${document.location.protocol}//${document.location.host}`
5513
- : systemInfo['contextPath']),
5514
- apiVersion: Number(((systemInfo['version'] || '')?.split('.') || [])[1]),
5515
- };
5516
- }));
5517
- }
5518
- getOrgUnitAttributeByUsage(usageType) {
5519
- switch (usageType) {
5520
- case 'DATA_ENTRY':
5521
- return 'organisationUnits';
5522
- case 'DATA_VIEW':
5523
- return 'dataViewOrganisationUnits';
5524
- default:
5525
- return 'organisationUnits';
5526
- }
5527
- }
5528
- getRootOrgUnits() {
5529
- const orgUnitAttribute = this.getOrgUnitAttributeByUsage(this.orgUnitSelectionConfig.usageType);
5530
- return this.httpClient
5531
- .me()
5532
- .pipe(map((user) => (user ? user[orgUnitAttribute] : []).map((orgUnit) => orgUnit.id)));
5533
- }
5534
- getOrgUnitGroups() {
5535
- return firstValueFrom(this.httpClient
5536
- .get('organisationUnitGroups.json?fields=id,displayName,name&paging=false')
5537
- .pipe(map((res) => res?.['organisationUnitGroups'])));
5538
- }
5539
- getOrgUnitLevels() {
5540
- return firstValueFrom(this.httpClient
5541
- .get('organisationUnitLevels.json?fields=id,level,displayName,name&paging=false')
5542
- .pipe(map((res) => res?.['organisationUnitLevels'])));
5543
- }
5544
5517
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: BaseFormFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
5545
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.1.8", type: BaseFormFieldComponent, isStandalone: true, inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: true, transformFunction: null }, fieldConfig: { classPropertyName: "fieldConfig", publicName: "fieldConfig", isSignal: true, isRequired: false, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: true, transformFunction: null }, isValid: { classPropertyName: "isValid", publicName: "isValid", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { form: "formChange", value: "valueChange", update: "update", immediateUpdate: "immediateUpdate" }, usesInheritance: true, usesOnChanges: true, ngImport: i0 }); }
5518
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.1.8", type: BaseFormFieldComponent, isStandalone: true, inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: true, transformFunction: null }, fieldConfig: { classPropertyName: "fieldConfig", publicName: "fieldConfig", isSignal: true, isRequired: false, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: true, transformFunction: null }, isValid: { classPropertyName: "isValid", publicName: "isValid", isSignal: true, isRequired: false, transformFunction: null }, isValueAssigned: { classPropertyName: "isValueAssigned", publicName: "isValueAssigned", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { form: "formChange", value: "valueChange", update: "update", immediateUpdate: "immediateUpdate" }, usesInheritance: true, usesOnChanges: true, ngImport: i0 }); }
5546
5519
  }
5547
5520
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: BaseFormFieldComponent, decorators: [{
5548
5521
  type: Directive
@@ -5568,6 +5541,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImpor
5568
5541
  class FormFieldComponent {
5569
5542
  constructor() {
5570
5543
  this.field = input.required();
5544
+ this.programRuleActions = input([]);
5571
5545
  this.maxDate = new Date();
5572
5546
  this.color = 'primary';
5573
5547
  this.fieldUpdate = new EventEmitter();
@@ -5578,6 +5552,10 @@ class FormFieldComponent {
5578
5552
  this.runtimeOptions = [];
5579
5553
  this.fieldFilterControl = new FormControl();
5580
5554
  this._onDestroy = new Subject();
5555
+ this.isValueAssigned = signal(false);
5556
+ this.ruleProcessor = effect(() => {
5557
+ this.#processRules(this.programRuleActions());
5558
+ });
5581
5559
  }
5582
5560
  ngOnChanges(changes) {
5583
5561
  if (changes && changes['dataEntities'] && this.field()?.dependentField) {
@@ -5602,9 +5580,33 @@ class FormFieldComponent {
5602
5580
  this.optionSearchTerm = this.fieldFilterControl.value;
5603
5581
  });
5604
5582
  }
5583
+ #processRules(ruleActions) {
5584
+ ruleActions
5585
+ .filter((ruleAction) => ruleAction.field === this.field().id)
5586
+ .forEach((ruleAction) => {
5587
+ switch (ruleAction.actionType) {
5588
+ case 'ASSIGN': {
5589
+ if (ruleAction.assignedData) {
5590
+ const currentValue = this.form?.get(this.field().key)?.value;
5591
+ if (currentValue != ruleAction.assignedData) {
5592
+ this.form
5593
+ ?.get(this.field().key)
5594
+ ?.setValue(ruleAction.assignedData);
5595
+ this.isValueAssigned.set(true);
5596
+ this.onValueChange();
5597
+ }
5598
+ }
5599
+ break;
5600
+ }
5601
+ default:
5602
+ break;
5603
+ }
5604
+ });
5605
+ }
5605
5606
  ngOnDestroy() {
5606
5607
  this._onDestroy.next();
5607
5608
  this._onDestroy.complete();
5609
+ this.ruleProcessor.destroy();
5608
5610
  }
5609
5611
  get isValid() {
5610
5612
  return this.form?.controls[this.field().id]?.valid;
@@ -5707,12 +5709,12 @@ class FormFieldComponent {
5707
5709
  this._runtimeOptions = [...options];
5708
5710
  }
5709
5711
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: FormFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
5710
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.1.8", 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: false, isRequired: false, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: false, isRequired: false, transformFunction: null }, isCheckBoxButton: { classPropertyName: "isCheckBoxButton", publicName: "isCheckBoxButton", isSignal: false, isRequired: false, transformFunction: null }, fieldClass: { classPropertyName: "fieldClass", publicName: "fieldClass", isSignal: false, isRequired: false, transformFunction: null }, programRuleActions: { classPropertyName: "programRuleActions", publicName: "programRuleActions", isSignal: false, isRequired: false, transformFunction: null }, dataEntities: { classPropertyName: "dataEntities", publicName: "dataEntities", isSignal: false, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: false, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: false, 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 [fieldConfig]=\"fieldConfig\"\n [(form)]=\"form\"\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$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: FormFieldItemComponent, selector: "ng-dhis2-ui-form-field-item" }] }); }
5712
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.1.8", 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: false, isRequired: false, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: false, isRequired: false, transformFunction: null }, isCheckBoxButton: { classPropertyName: "isCheckBoxButton", publicName: "isCheckBoxButton", isSignal: false, isRequired: false, transformFunction: null }, fieldClass: { classPropertyName: "fieldClass", publicName: "fieldClass", isSignal: false, isRequired: false, transformFunction: null }, programRuleActions: { classPropertyName: "programRuleActions", publicName: "programRuleActions", isSignal: true, isRequired: false, transformFunction: null }, dataEntities: { classPropertyName: "dataEntities", publicName: "dataEntities", isSignal: false, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: false, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: false, 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 [isValueAssigned]=\"isValueAssigned()\"\n [fieldConfig]=\"fieldConfig\"\n [(form)]=\"form\"\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$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: FormFieldItemComponent, selector: "ng-dhis2-ui-form-field-item" }] }); }
5711
5713
  }
5712
5714
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: FormFieldComponent, decorators: [{
5713
5715
  type: Component,
5714
- args: [{ selector: 'ng-dhis2-ui-form-field', standalone: false, template: "<div *ngIf=\"field()\" class=\"form-field-item\">\n <ng-dhis2-ui-form-field-item\n [field]=\"field()\"\n [fieldConfig]=\"fieldConfig\"\n [(form)]=\"form\"\n [value]=\"value()\"\n (update)=\"onValueChange()\"\n (immediateUpdate)=\"onImmediateChange($event)\"\n />\n</div>\n", styles: [".form-field-item{margin-bottom:16px}\n"] }]
5715
- }], propDecorators: { fieldConfig: [{
5716
+ args: [{ selector: 'ng-dhis2-ui-form-field', standalone: false, template: "<div *ngIf=\"field()\" class=\"form-field-item\">\n <ng-dhis2-ui-form-field-item\n [field]=\"field()\"\n [isValueAssigned]=\"isValueAssigned()\"\n [fieldConfig]=\"fieldConfig\"\n [(form)]=\"form\"\n [value]=\"value()\"\n (update)=\"onValueChange()\"\n (immediateUpdate)=\"onImmediateChange($event)\"\n />\n</div>\n", styles: [".form-field-item{margin-bottom:16px}\n"] }]
5717
+ }], ctorParameters: () => [], propDecorators: { fieldConfig: [{
5716
5718
  type: Input
5717
5719
  }], form: [{
5718
5720
  type: Input
@@ -5720,8 +5722,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImpor
5720
5722
  type: Input
5721
5723
  }], fieldClass: [{
5722
5724
  type: Input
5723
- }], programRuleActions: [{
5724
- type: Input
5725
5725
  }], dataEntities: [{
5726
5726
  type: Input
5727
5727
  }], minDate: [{
@@ -5737,18 +5737,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImpor
5737
5737
  }] } });
5738
5738
 
5739
5739
  class FormComponent {
5740
- constructor() {
5741
- this.formConfig = input();
5742
- this.configuration = computed(() => {
5743
- if (!this.formConfig()) {
5744
- return new FormConfig({
5745
- direction: this.isFormHorizontal ? 'horizontal' : 'vertical',
5746
- });
5747
- }
5748
- return this.formConfig();
5749
- });
5750
- this.formUpdate = new EventEmitter();
5751
- }
5752
5740
  get sanitizedFields() {
5753
5741
  return (this.fields || []).filter((field) => {
5754
5742
  if (field.hidden) {
@@ -5761,17 +5749,14 @@ class FormComponent {
5761
5749
  if (!elementItem) {
5762
5750
  return true;
5763
5751
  }
5764
- const availableRule = head((this.programRuleActions || []).filter((ruleAction) => {
5765
- const fieldId = ruleAction.field || ruleAction[type]?.id;
5766
- return (fieldId === elementItem.id &&
5767
- (ruleAction.programRuleActionType === 'HIDEFIELD' ||
5768
- ruleAction.actionType === 'HIDEFIELD'));
5752
+ const availableRule = head((this.programRuleActions() || []).filter((ruleAction) => {
5753
+ return (ruleAction.field === elementItem.id &&
5754
+ ruleAction.actionType === 'HIDEFIELD');
5769
5755
  }));
5770
5756
  if (!availableRule) {
5771
5757
  return true;
5772
5758
  }
5773
- const actionType = availableRule?.programRuleActionType || availableRule?.actionType;
5774
- return actionType !== 'HIDEFIELD';
5759
+ return availableRule.actionType !== 'HIDEFIELD';
5775
5760
  });
5776
5761
  }
5777
5762
  get layoutCssClass() {
@@ -5787,29 +5772,44 @@ class FormComponent {
5787
5772
  }
5788
5773
  return 'col-sm-4';
5789
5774
  }
5790
- onUpdateFields(programRuleActions) {
5791
- this.fields = (this.fields || []).filter((field) => {
5792
- const type = field.isDataElement
5793
- ? 'dataElement'
5794
- : 'trackedEntityAttribute';
5795
- const elementItem = field[type] || field;
5796
- if (!elementItem) {
5797
- return true;
5798
- }
5799
- const availableRule = head((programRuleActions || []).filter((rule) => {
5800
- return (rule[type] &&
5801
- rule[type].id === elementItem.id &&
5802
- rule.programRuleActionType === 'HIDEFIELD');
5803
- }));
5804
- if (!availableRule) {
5805
- return true;
5775
+ constructor() {
5776
+ this.formConfig = input();
5777
+ this.programRuleActions = input([]);
5778
+ this.configuration = computed(() => {
5779
+ if (!this.formConfig()) {
5780
+ return new FormConfig({
5781
+ direction: this.isFormHorizontal ? 'horizontal' : 'vertical',
5782
+ });
5806
5783
  }
5807
- return (availableRule && availableRule.programRuleActionType !== 'HIDEFIELD');
5784
+ return this.formConfig();
5785
+ });
5786
+ this.formUpdate = new EventEmitter();
5787
+ this.ruleProcessor = effect(() => {
5788
+ this.#processRules(this.programRuleActions());
5808
5789
  });
5809
5790
  }
5810
- ngOnChanges() {
5791
+ ngOnChanges(changes) {
5811
5792
  this.values = this.form.getRawValue();
5812
5793
  }
5794
+ #processRules(ruleActions) {
5795
+ ruleActions.forEach((ruleAction) => {
5796
+ switch (ruleAction.actionType) {
5797
+ case 'HIDEFIELD': {
5798
+ const fieldToRemove = this.fields.find((field) => field.id === ruleAction.field);
5799
+ if (fieldToRemove) {
5800
+ const currentValue = this.form.get(fieldToRemove.key)?.value;
5801
+ if (currentValue != null) {
5802
+ this.form.get(fieldToRemove.key)?.setValue(null);
5803
+ this.onFieldUpdate(this.form, fieldToRemove);
5804
+ }
5805
+ }
5806
+ break;
5807
+ }
5808
+ default:
5809
+ break;
5810
+ }
5811
+ });
5812
+ }
5813
5813
  onSubmit() {
5814
5814
  this.formUpdate.emit(this.form.getRawValue());
5815
5815
  }
@@ -5832,13 +5832,16 @@ class FormComponent {
5832
5832
  fieldToUpdate?.onUpdateRuntimeOptions(parentOption?.options || []);
5833
5833
  }
5834
5834
  }
5835
+ ngOnDestroy() {
5836
+ this.ruleProcessor.destroy();
5837
+ }
5835
5838
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: FormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
5836
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.1.8", 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: false, isRequired: false, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: false, isRequired: false, transformFunction: null }, isFormHorizontal: { classPropertyName: "isFormHorizontal", publicName: "isFormHorizontal", isSignal: false, isRequired: false, transformFunction: null }, showSaveButton: { classPropertyName: "showSaveButton", publicName: "showSaveButton", isSignal: false, isRequired: false, transformFunction: null }, fieldsData: { classPropertyName: "fieldsData", publicName: "fieldsData", isSignal: false, isRequired: false, transformFunction: null }, fieldClass: { classPropertyName: "fieldClass", publicName: "fieldClass", isSignal: false, isRequired: false, transformFunction: null }, shouldRenderAsCheckBoxesButton: { classPropertyName: "shouldRenderAsCheckBoxesButton", publicName: "shouldRenderAsCheckBoxesButton", isSignal: false, isRequired: false, transformFunction: null }, programRuleActions: { classPropertyName: "programRuleActions", publicName: "programRuleActions", isSignal: false, isRequired: false, transformFunction: null }, dataEntities: { classPropertyName: "dataEntities", publicName: "dataEntities", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { formUpdate: "formUpdate" }, 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 [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$1.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"], outputs: ["fieldUpdate", "immediateFieldUpdate", "runtimeOptionChange"] }] }); }
5839
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.1.8", 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: false, isRequired: false, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: false, isRequired: false, transformFunction: null }, isFormHorizontal: { classPropertyName: "isFormHorizontal", publicName: "isFormHorizontal", isSignal: false, isRequired: false, transformFunction: null }, showSaveButton: { classPropertyName: "showSaveButton", publicName: "showSaveButton", isSignal: false, isRequired: false, transformFunction: null }, fieldsData: { classPropertyName: "fieldsData", publicName: "fieldsData", isSignal: false, isRequired: false, transformFunction: null }, fieldClass: { classPropertyName: "fieldClass", publicName: "fieldClass", isSignal: false, isRequired: false, transformFunction: null }, shouldRenderAsCheckBoxesButton: { classPropertyName: "shouldRenderAsCheckBoxesButton", publicName: "shouldRenderAsCheckBoxesButton", isSignal: false, isRequired: false, transformFunction: null }, programRuleActions: { classPropertyName: "programRuleActions", publicName: "programRuleActions", isSignal: true, isRequired: false, transformFunction: null }, dataEntities: { classPropertyName: "dataEntities", publicName: "dataEntities", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { formUpdate: "formUpdate" }, 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 [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$1.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"], outputs: ["fieldUpdate", "immediateFieldUpdate", "runtimeOptionChange"] }] }); }
5837
5840
  }
5838
5841
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: FormComponent, decorators: [{
5839
5842
  type: Component,
5840
- args: [{ selector: 'ng-dhis2-ui-form', standalone: false, 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 [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"] }]
5841
- }], propDecorators: { fields: [{
5843
+ args: [{ selector: 'ng-dhis2-ui-form', standalone: false, 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 [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"] }]
5844
+ }], ctorParameters: () => [], propDecorators: { fields: [{
5842
5845
  type: Input
5843
5846
  }], form: [{
5844
5847
  type: Input
@@ -5852,8 +5855,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImpor
5852
5855
  type: Input
5853
5856
  }], shouldRenderAsCheckBoxesButton: [{
5854
5857
  type: Input
5855
- }], programRuleActions: [{
5856
- type: Input
5857
5858
  }], dataEntities: [{
5858
5859
  type: Input
5859
5860
  }], formUpdate: [{
@@ -5947,7 +5948,7 @@ class SectionFormComponent {
5947
5948
  this.formGroups = {};
5948
5949
  this.formValueEntity = {};
5949
5950
  this.repeatableFormValueEntity = {};
5950
- this.ruleActions = [];
5951
+ this.ruleActions = signal([]);
5951
5952
  this.save = new EventEmitter();
5952
5953
  this.formUpdate = new EventEmitter();
5953
5954
  this.cancel = new EventEmitter();
@@ -5972,10 +5973,10 @@ class SectionFormComponent {
5972
5973
  });
5973
5974
  });
5974
5975
  this.inValid.set(this.checkIfInValid());
5975
- this.ruleActions = new ProgramRuleEngine()
5976
+ this.ruleActions.set(new ProgramRuleEngine()
5976
5977
  .setRules(this.formMetaData().rules)
5977
5978
  .setDataValues(this.#getDataValue())
5978
- .execute();
5979
+ .execute());
5979
5980
  }
5980
5981
  }
5981
5982
  onUpdateRepeatableStage(repeatableData, fieldGroup) {
@@ -5991,10 +5992,10 @@ class SectionFormComponent {
5991
5992
  this.formValueEntity[fieldGroupId] = formValue;
5992
5993
  this.inValid.set(this.checkIfInValid());
5993
5994
  const dataValues = this.#getDataValue();
5994
- this.ruleActions = new ProgramRuleEngine()
5995
+ this.ruleActions.set(new ProgramRuleEngine()
5995
5996
  .setRules(this.formMetaData().rules)
5996
5997
  .setDataValues(dataValues)
5997
- .execute();
5998
+ .execute());
5998
5999
  this.formUpdate.emit(dataValues);
5999
6000
  }
6000
6001
  onSubmit() {
@@ -6037,11 +6038,11 @@ class SectionFormComponent {
6037
6038
  return valueValidity || repeatableDataValidity;
6038
6039
  }
6039
6040
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: SectionFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
6040
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.8", 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" }, 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$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.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"], outputs: ["formUpdate"] }, { 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"] }] }); }
6041
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.8", 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" }, 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$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.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"], outputs: ["formUpdate"] }, { 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"] }] }); }
6041
6042
  }
6042
6043
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: SectionFormComponent, decorators: [{
6043
6044
  type: Component,
6044
- args: [{ selector: 'ng-dhis2-ui-section-form', standalone: false, 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"] }]
6045
+ args: [{ selector: 'ng-dhis2-ui-section-form', standalone: false, 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"] }]
6045
6046
  }], ctorParameters: () => [], propDecorators: { save: [{
6046
6047
  type: Output
6047
6048
  }], formUpdate: [{
@@ -6440,18 +6441,22 @@ class TrackerFormComponent {
6440
6441
  this.formMetaData = new FormMetaData({
6441
6442
  programs: [program],
6442
6443
  programStage: this.programStage(),
6444
+ disableEnrollmentDate: true,
6443
6445
  }).toJson();
6444
- console.log(this.formMetaData, this.instance.enrollmentDate);
6445
6446
  }
6446
6447
  }
6448
+ onFormUpdate(values) {
6449
+ const instance = this.instance;
6450
+ instance?.updateDataValues(values);
6451
+ }
6447
6452
  onSave(event) { }
6448
6453
  onCancel() { }
6449
6454
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: TrackerFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
6450
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.8", type: TrackerFormComponent, isStandalone: false, selector: "ng-dhis2-ui-tracker-form", inputs: { program: { classPropertyName: "program", publicName: "program", isSignal: true, isRequired: true, transformFunction: null }, programStage: { classPropertyName: "programStage", publicName: "programStage", isSignal: true, isRequired: false, transformFunction: null }, trackedEntity: { classPropertyName: "trackedEntity", publicName: "trackedEntity", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@if(formMetaData) {\n<ng-dhis2-ui-section-form\n [formMetaData]=\"formMetaData\"\n [dataValueEntities]=\"instance\"\n (save)=\"onSave($event)\"\n (cancel)=\"onCancel()\"\n/>\n}\n", dependencies: [{ kind: "component", type: SectionFormComponent, selector: "ng-dhis2-ui-section-form", inputs: ["loading", "formMetaData", "dataValueEntities"], outputs: ["save", "formUpdate", "cancel"] }] }); }
6455
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.8", type: TrackerFormComponent, isStandalone: false, selector: "ng-dhis2-ui-tracker-form", inputs: { program: { classPropertyName: "program", publicName: "program", isSignal: true, isRequired: true, transformFunction: null }, programStage: { classPropertyName: "programStage", publicName: "programStage", isSignal: true, isRequired: false, transformFunction: null }, trackedEntity: { classPropertyName: "trackedEntity", publicName: "trackedEntity", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@if(formMetaData) {\n<ng-dhis2-ui-section-form\n [formMetaData]=\"formMetaData\"\n [dataValueEntities]=\"instance\"\n (formUpdate)=\"onFormUpdate($event)\"\n (save)=\"onSave($event)\"\n (cancel)=\"onCancel()\"\n/>\n}\n", dependencies: [{ kind: "component", type: SectionFormComponent, selector: "ng-dhis2-ui-section-form", inputs: ["loading", "formMetaData", "dataValueEntities"], outputs: ["save", "formUpdate", "cancel"] }] }); }
6451
6456
  }
6452
6457
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: TrackerFormComponent, decorators: [{
6453
6458
  type: Component,
6454
- args: [{ selector: 'ng-dhis2-ui-tracker-form', standalone: false, template: "@if(formMetaData) {\n<ng-dhis2-ui-section-form\n [formMetaData]=\"formMetaData\"\n [dataValueEntities]=\"instance\"\n (save)=\"onSave($event)\"\n (cancel)=\"onCancel()\"\n/>\n}\n" }]
6459
+ args: [{ selector: 'ng-dhis2-ui-tracker-form', standalone: false, template: "@if(formMetaData) {\n<ng-dhis2-ui-section-form\n [formMetaData]=\"formMetaData\"\n [dataValueEntities]=\"instance\"\n (formUpdate)=\"onFormUpdate($event)\"\n (save)=\"onSave($event)\"\n (cancel)=\"onCancel()\"\n/>\n}\n" }]
6455
6460
  }] });
6456
6461
 
6457
6462
  class TrackerFormModule {
@@ -6472,9 +6477,68 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImpor
6472
6477
  // Use of this source code is governed by a BSD-style
6473
6478
  // license that can be found in the LICENSE file.
6474
6479
 
6480
+ class EventFormComponent {
6481
+ constructor() {
6482
+ this.program = input.required();
6483
+ this.programStage = input.required();
6484
+ this.eventId = input();
6485
+ this.enrollment = input();
6486
+ this.trackedEntity = input();
6487
+ this.d2 = window.d2Web;
6488
+ }
6489
+ async ngOnInit() {
6490
+ this.eventQuery = this.d2.eventModule.event
6491
+ .setProgram(this.program())
6492
+ .setProgramStage(this.programStage())
6493
+ .setEnrollment(this.enrollment())
6494
+ .setTrackedEntity(this.trackedEntity());
6495
+ const program = await this.eventQuery.getMetaData();
6496
+ this.instance = this.eventId()
6497
+ ? (await this.eventQuery.setEvent(this.eventId()).get())
6498
+ .data || (await this.eventQuery.create())
6499
+ : await this.eventQuery.create();
6500
+ if (program) {
6501
+ this.formMetaData = new FormMetaData({
6502
+ programs: [program],
6503
+ programStage: this.programStage(),
6504
+ }).toJson();
6505
+ }
6506
+ }
6507
+ onFormUpdate(values) {
6508
+ const instance = this.instance;
6509
+ instance?.updateDataValues(values);
6510
+ }
6511
+ onSave(event) { }
6512
+ onCancel() { }
6513
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: EventFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
6514
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.8", type: EventFormComponent, isStandalone: false, selector: "ng-dhis2-ui-event-form", inputs: { program: { classPropertyName: "program", publicName: "program", isSignal: true, isRequired: true, transformFunction: null }, programStage: { classPropertyName: "programStage", publicName: "programStage", isSignal: true, isRequired: true, transformFunction: null }, eventId: { classPropertyName: "eventId", publicName: "eventId", isSignal: true, isRequired: false, transformFunction: null }, enrollment: { classPropertyName: "enrollment", publicName: "enrollment", isSignal: true, isRequired: false, transformFunction: null }, trackedEntity: { classPropertyName: "trackedEntity", publicName: "trackedEntity", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@if(formMetaData) {\n<ng-dhis2-ui-section-form\n [formMetaData]=\"formMetaData\"\n [dataValueEntities]=\"instance\"\n (formUpdate)=\"onFormUpdate($event)\"\n (save)=\"onSave($event)\"\n (cancel)=\"onCancel()\"\n/>\n}\n", dependencies: [{ kind: "component", type: SectionFormComponent, selector: "ng-dhis2-ui-section-form", inputs: ["loading", "formMetaData", "dataValueEntities"], outputs: ["save", "formUpdate", "cancel"] }] }); }
6515
+ }
6516
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: EventFormComponent, decorators: [{
6517
+ type: Component,
6518
+ args: [{ selector: 'ng-dhis2-ui-event-form', standalone: false, template: "@if(formMetaData) {\n<ng-dhis2-ui-section-form\n [formMetaData]=\"formMetaData\"\n [dataValueEntities]=\"instance\"\n (formUpdate)=\"onFormUpdate($event)\"\n (save)=\"onSave($event)\"\n (cancel)=\"onCancel()\"\n/>\n}\n" }]
6519
+ }] });
6520
+
6521
+ class EventFormModule {
6522
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: EventFormModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
6523
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.8", ngImport: i0, type: EventFormModule, declarations: [EventFormComponent], imports: [CommonModule, D2FormModule], exports: [EventFormComponent] }); }
6524
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: EventFormModule, imports: [CommonModule, D2FormModule] }); }
6525
+ }
6526
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: EventFormModule, decorators: [{
6527
+ type: NgModule,
6528
+ args: [{
6529
+ imports: [CommonModule, D2FormModule],
6530
+ declarations: [EventFormComponent],
6531
+ exports: [EventFormComponent],
6532
+ }]
6533
+ }] });
6534
+
6535
+ // Copyright 2025 UDSM DHIS2 Lab. All rights reserved.
6536
+ // Use of this source code is governed by a BSD-style
6537
+ // license that can be found in the LICENSE file.
6538
+
6475
6539
  /**
6476
6540
  * Generated bundle index. Do not edit.
6477
6541
  */
6478
6542
 
6479
- export { Boolean$1 as Boolean, BreadcrumbComponent, BreadcrumbModule, ButtonComponent, ButtonModule, CheckBox, D2FormModule, DataTableUIComponent, DataTableUIModule, DateField, DateRangeValue, Dropdown, FieldConfig, FieldControlTypeUtil, FieldDropdown, FieldType, FieldUtil, FormComponent, FormConfig, FormField, FormFieldComponent, FormFieldGroup, FormFieldTypeUtil, FormMetaData, FormMetadataSection, FormUtil, FormValue, FormValueUtil, HeaderBarComponent, HeaderBarModule, LineListModule, LineListTableComponent, MetadataRule, MetadataRuleAction, OrganisationUnitSelectionConfig, OrganisationUnitSelectorComponent, OrganisationUnitSelectorModalComponent, OrganisationUnitSelectorModule, PeriodSelectorComponent, PeriodSelectorModalComponent, PeriodSelectorModule, ReactWrapperModule, RepeatableFormComponent, SectionFormComponent, SelectionFiltersComponent, SelectionFiltersUiModule, TrackerFormComponent, TrackerFormModule, TranslationUtil };
6543
+ export { Boolean$1 as Boolean, BreadcrumbComponent, BreadcrumbModule, ButtonComponent, ButtonModule, CheckBox, D2FormModule, DataTableUIComponent, DataTableUIModule, DateField, DateRangeValue, Dropdown, EventFormComponent, EventFormModule, FieldConfig, FieldControlTypeUtil, FieldDropdown, FieldType, FieldUtil, FormComponent, FormConfig, FormField, FormFieldComponent, FormFieldGroup, FormFieldTypeUtil, FormMetaData, FormMetadataSection, FormUtil, FormValue, FormValueUtil, HeaderBarComponent, HeaderBarModule, LineListModule, LineListTableComponent, MetadataRule, MetadataRuleAction, OrganisationUnitSelectionConfig, OrganisationUnitSelectorComponent, OrganisationUnitSelectorModalComponent, OrganisationUnitSelectorModule, PeriodSelectorComponent, PeriodSelectorModalComponent, PeriodSelectorModule, ReactWrapperModule, RepeatableFormComponent, SectionFormComponent, SelectionFiltersComponent, SelectionFiltersUiModule, TrackerFormComponent, TrackerFormModule, TranslationUtil };
6480
6544
  //# sourceMappingURL=iapps-ng-dhis2-ui.mjs.map