@iapps/ng-dhis2-ui 1.1.77 → 1.1.78

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.
@@ -3971,7 +3971,7 @@ const getTrackedEntityData = (response, programId, pager, isOptionSetNameVisible
3971
3971
  label: foundAttribute?.displayName || attrId,
3972
3972
  key: attrId,
3973
3973
  valueType: foundAttribute?.valueType,
3974
- options: mappedAttr?.optionSet ?? undefined
3974
+ options: mappedAttr?.optionSet ?? undefined,
3975
3975
  };
3976
3976
  })
3977
3977
  .filter((column) => {
@@ -3987,7 +3987,6 @@ const getTrackedEntityData = (response, programId, pager, isOptionSetNameVisible
3987
3987
  return sortOrderA - sortOrderB;
3988
3988
  })
3989
3989
  .filter((column) => searchableKeys.has(column.key));
3990
- console.log('filtered entity columns', filteredEntityColumns);
3991
3990
  const attributesData = teis.map((tei, idx) => {
3992
3991
  const row = {
3993
3992
  trackedEntityInstance: tei.trackedEntity,
@@ -4061,7 +4060,6 @@ const getTrackedEntityData = (response, programId, pager, isOptionSetNameVisible
4061
4060
  })),
4062
4061
  ];
4063
4062
  }
4064
- console.log('filtered entity columns', filteredEntityColumns);
4065
4063
  return {
4066
4064
  columns: entityColumns,
4067
4065
  data: attributesData,
@@ -4392,7 +4390,7 @@ class LineListTableComponent extends ReactWrapperModule {
4392
4390
  // <div>
4393
4391
  // <div/>
4394
4392
  React__default.createElement("div", null,
4395
- React__default.createElement(Modal$1, { hide: hide },
4393
+ React__default.createElement(Modal$1, { hide: hide, position: "middle" },
4396
4394
  React__default.createElement(ModalTitle$1, null, "Select organization unit"),
4397
4395
  React__default.createElement(ModalContent$1, null,
4398
4396
  React__default.createElement(OrgUnitFormField$1, { key: selectedOrgUnit, onSelectOrgUnit: (selectedOrgUnit) => {
@@ -4474,6 +4472,9 @@ class LineListTableComponent extends ReactWrapperModule {
4474
4472
  React__default.createElement(DataTableRow, null, columns.map((col) => (React__default.createElement(DataTableColumnHeader, { key: col.key }, col.label))))),
4475
4473
  React__default.createElement(TableBody, null, data.length > 0 ? (data.map((row) => (React__default.createElement(DataTableRow, { key: row.index }, columns.map((col) => (React__default.createElement(DataTableCell, { key: col.key }, col.key === 'actions'
4476
4474
  ? this.actionOptions && (React__default.createElement(DataTableActions, { actionOptions: this.actionOptions, actionOptionOrientation: this.actionOptionOrientation, onClick: (option) => {
4475
+ if (option.onClick) {
4476
+ option.onClick(row);
4477
+ }
4477
4478
  this.actionSelected.emit({
4478
4479
  action: option.label,
4479
4480
  row,
@@ -4605,6 +4606,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImpor
4605
4606
  // Use of this source code is governed by a BSD-style
4606
4607
  // license that can be found in the LICENSE file.
4607
4608
 
4609
+ // Copyright 2025 UDSM DHIS2 Lab. All rights reserved.
4610
+ // Use of this source code is governed by a BSD-style
4611
+ // license that can be found in the LICENSE file.
4612
+
4608
4613
  const dropdownStyles = {
4609
4614
  layer: {
4610
4615
  zIndex: '1 !important',
@@ -5482,9 +5487,20 @@ class MetadataRule {
5482
5487
  class FormMetadataSection {
5483
5488
  constructor(params) {
5484
5489
  this.params = params;
5490
+ this.inheritedAttributes = [];
5491
+ this.inheritedAttributes =
5492
+ (this.params.program['trackedEntityType'] || {})['trackedEntityTypeAttributes'] || [];
5485
5493
  }
5486
5494
  get attributes() {
5487
- return (this.params.program['programTrackedEntityAttributes'] || []).map((programTrackedEntityAttribute) => {
5495
+ let programTrackedEntityAttributes = this.params.program['programTrackedEntityAttributes'] || [];
5496
+ if (this.params.excludeInheritedAttributes) {
5497
+ programTrackedEntityAttributes = programTrackedEntityAttributes.filter((programTrackedEntityAttribute) => {
5498
+ return !this.inheritedAttributes.find((inheritedAttribute) => inheritedAttribute['trackedEntityAttribute']?.id ===
5499
+ programTrackedEntityAttribute['trackedEntityAttribute']
5500
+ ?.id);
5501
+ });
5502
+ }
5503
+ return programTrackedEntityAttributes.map((programTrackedEntityAttribute) => {
5488
5504
  return {
5489
5505
  ...programTrackedEntityAttribute['trackedEntityAttribute'],
5490
5506
  formName: (programTrackedEntityAttribute['trackedEntityAttribute'] || {})['name'],
@@ -5524,7 +5540,7 @@ class FormMetadataSection {
5524
5540
  return {
5525
5541
  id: this.params.section?.id,
5526
5542
  name: this.params.section?.name,
5527
- fieldGroups: this.fieldGroups,
5543
+ fieldGroups: this.fieldGroups.filter((fieldGroup) => fieldGroup.fields?.length > 0),
5528
5544
  };
5529
5545
  }
5530
5546
  }
@@ -5632,6 +5648,7 @@ class FormMetaData {
5632
5648
  },
5633
5649
  program,
5634
5650
  locale: this.params.locale,
5651
+ excludeInheritedAttributes: this.params.excludeInheritedAttributes,
5635
5652
  }).toJson();
5636
5653
  });
5637
5654
  }
@@ -5660,6 +5677,7 @@ class FormMetaData {
5660
5677
  },
5661
5678
  program,
5662
5679
  locale: this.params.locale,
5680
+ excludeInheritedAttributes: this.params.excludeInheritedAttributes,
5663
5681
  }).toJson();
5664
5682
  }
5665
5683
  #getReportingDateSection(program) {
@@ -5696,6 +5714,7 @@ class FormMetaData {
5696
5714
  },
5697
5715
  program,
5698
5716
  locale: this.params.locale,
5717
+ excludeInheritedAttributes: this.params.excludeInheritedAttributes,
5699
5718
  }).toJson();
5700
5719
  }
5701
5720
  #getRegistrationSection(program) {
@@ -5728,6 +5747,7 @@ class FormMetaData {
5728
5747
  },
5729
5748
  program,
5730
5749
  locale: this.params.locale,
5750
+ excludeInheritedAttributes: this.params.excludeInheritedAttributes,
5731
5751
  }).toJson();
5732
5752
  }
5733
5753
  #getMergedRegistrationSection(program) {
@@ -5803,6 +5823,7 @@ class FormMetaData {
5803
5823
  },
5804
5824
  program,
5805
5825
  locale: this.params.locale,
5826
+ excludeInheritedAttributes: this.params.excludeInheritedAttributes,
5806
5827
  }).toJson();
5807
5828
  }
5808
5829
  toJson() {
@@ -5893,18 +5914,6 @@ const FileUploadField = (props) => {
5893
5914
  else {
5894
5915
  onChange(file);
5895
5916
  }
5896
- // this.ngZone.run(() => {
5897
- // this.form().get(this.field().id) ||
5898
- // this.form()
5899
- // .get(this.field().key)
5900
- // ?.setValue((event?.files || [])[0]);
5901
- // this.update.emit({
5902
- // form: this.form(),
5903
- // value: (event?.files || [])[0],
5904
- // });
5905
- // });
5906
- // setValue((event?.files || [])[0]);
5907
- // setTouched(true);
5908
5917
  } }, file && (React__default.createElement(FileListItem, { cancelText: "Cancel", label: file.name, loading: uploading, onRemove: () => {
5909
5918
  setFile(null);
5910
5919
  }, removeText: "Remove" }))));
@@ -7415,6 +7424,7 @@ class TrackerFormComponent {
7415
7424
  programs: [program],
7416
7425
  programStage: this.programStage(),
7417
7426
  disableEnrollmentDate: true,
7427
+ excludeInheritedAttributes: true,
7418
7428
  }).toJson();
7419
7429
  }
7420
7430
  }
@@ -7530,7 +7540,14 @@ class ProgramEntryFormFieldUtil {
7530
7540
  this.config = config;
7531
7541
  }
7532
7542
  get attributes() {
7533
- return (this.program.programTrackedEntityAttributes || []).map((programTrackedEntityAttribute) => {
7543
+ let programTrackedEntityAttributes = this.program.programTrackedEntityAttributes || [];
7544
+ if (this.config.excludeInheritedAttributes) {
7545
+ programTrackedEntityAttributes = programTrackedEntityAttributes.filter((programTrackedEntityAttribute) => {
7546
+ return !(this.program.trackedEntityType?.trackedEntityTypeAttributes || []).find((inheritedAttribute) => inheritedAttribute.trackedEntityAttribute?.id ===
7547
+ programTrackedEntityAttribute?.trackedEntityAttribute?.id);
7548
+ });
7549
+ }
7550
+ return programTrackedEntityAttributes.map((programTrackedEntityAttribute) => {
7534
7551
  return {
7535
7552
  ...programTrackedEntityAttribute.trackedEntityAttribute,
7536
7553
  sortOrder: programTrackedEntityAttribute.sortOrder,
@@ -7692,6 +7709,11 @@ class ProgramEntryFormMetaData {
7692
7709
  'useFirstStageDuringRegistration',
7693
7710
  'trackedEntityType',
7694
7711
  ])
7712
+ .with(this.d2.programModule.trackedEntityType
7713
+ .select(['id', 'name'])
7714
+ .with(this.d2.programModule.trackedEntityTypeAttribute.select([
7715
+ 'trackedEntityAttribute',
7716
+ ])), 'ToOne')
7695
7717
  .with(this.d2.programModule.programTrackedEntityAttribute.with(this.d2.programModule.trackedEntityAttribute.with(this.d2.optionSetModule.optionSet.with(this.d2.optionSetModule.option), 'ToOne'), 'ToOne'))
7696
7718
  .with(this.d2.programModule.programRuleVariable
7697
7719
  .with(this.d2.dataElementModule.dataElement.select([