@iapps/ng-dhis2-ui 1.1.76 → 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.
@@ -3955,7 +3955,38 @@ const getTrackedEntityData = (response, programId, pager, isOptionSetNameVisible
3955
3955
  key: attr.id,
3956
3956
  }));
3957
3957
  const searchableKeys = new Set(searchableAttributes.map((attr) => attr.key));
3958
- const filteredEntityColumns = entityColumns.filter((column) => searchableKeys.has(column.key));
3958
+ const filteredEntityColumns = Array.from(allAttributes)
3959
+ .map((attrId) => {
3960
+ const foundAttribute = teis
3961
+ .flatMap((tei) => {
3962
+ const matchingEnrollment = tei.enrollments.find((enrollment) => enrollment.program === programId);
3963
+ return matchingEnrollment
3964
+ ? matchingEnrollment.attributes
3965
+ : tei.attributes;
3966
+ })
3967
+ .find((attr) => attr.attribute === attrId);
3968
+ // Find the corresponding attribute in mappedProgramMetadataAttributes
3969
+ const mappedAttr = mappedProgramMetadataAttributes.find((attr) => attr.id === attrId);
3970
+ return {
3971
+ label: foundAttribute?.displayName || attrId,
3972
+ key: attrId,
3973
+ valueType: foundAttribute?.valueType,
3974
+ options: mappedAttr?.optionSet ?? undefined,
3975
+ };
3976
+ })
3977
+ .filter((column) => {
3978
+ return mappedProgramMetadataAttributes
3979
+ .filter((attr) => attr.displayInList)
3980
+ .some((attr) => attr.id === column.key);
3981
+ })
3982
+ .sort((a, b) => {
3983
+ const sortOrderA = Number(mappedProgramMetadataAttributes.find((attr) => attr.id === a.key)
3984
+ ?.sortOrder ?? 0);
3985
+ const sortOrderB = Number(mappedProgramMetadataAttributes.find((attr) => attr.id === b.key)
3986
+ ?.sortOrder ?? 0);
3987
+ return sortOrderA - sortOrderB;
3988
+ })
3989
+ .filter((column) => searchableKeys.has(column.key));
3959
3990
  const attributesData = teis.map((tei, idx) => {
3960
3991
  const row = {
3961
3992
  trackedEntityInstance: tei.trackedEntity,
@@ -4181,6 +4212,7 @@ class LineListTableComponent extends ReactWrapperModule {
4181
4212
  : (filteredColumns ?? []).slice(0, 2);
4182
4213
  const defaultOrgUnit = this.orgUnit;
4183
4214
  const [prevValue, setPrevValue] = useState();
4215
+ const [dateStates, setDateStates] = useState({});
4184
4216
  // Store updaters in refs for Angular to access
4185
4217
  const updateRefs = useRef({
4186
4218
  setProgramIdState,
@@ -4269,7 +4301,7 @@ class LineListTableComponent extends ReactWrapperModule {
4269
4301
  setIsButtonLoading(true);
4270
4302
  const subscription = this.lineListService
4271
4303
  .getLineListData(this.programId, this.orgUnit, this.programStageId, pager.page, 1000, this.attributeFilters, this.startDate, this.endDate, this.ouMode)
4272
- .pipe(take(1)) // Ensures the observable emits only once
4304
+ .pipe(take(1))
4273
4305
  .subscribe((response) => {
4274
4306
  if ('trackedEntities' in response.data ||
4275
4307
  'instances' in response.data) {
@@ -4285,16 +4317,16 @@ class LineListTableComponent extends ReactWrapperModule {
4285
4317
  }
4286
4318
  : null;
4287
4319
  })
4288
- .filter(Boolean); // Removes null entries
4320
+ .filter(Boolean);
4289
4321
  this.approvalSelected.emit(teiEnrollmentList);
4290
4322
  }
4291
4323
  else {
4292
- this.approvalSelected.emit([]); // Emit empty array if no TEIs
4324
+ this.approvalSelected.emit([]);
4293
4325
  }
4294
- setIsButtonLoading(false); // Stop loading after processing
4326
+ setIsButtonLoading(false);
4295
4327
  });
4296
4328
  return () => {
4297
- subscription.unsubscribe(); // Cleanup to avoid potential memory leaks
4329
+ subscription.unsubscribe();
4298
4330
  };
4299
4331
  };
4300
4332
  const handleInputChange = (key, value) => {
@@ -4312,6 +4344,27 @@ class LineListTableComponent extends ReactWrapperModule {
4312
4344
  return updatedFilters;
4313
4345
  });
4314
4346
  };
4347
+ const handleDateSelect = (key, selectedDate) => {
4348
+ const selectedDateString = selectedDate?.calendarDateString ?? ''; // Default to empty string if null
4349
+ // Update dateStates
4350
+ setDateStates((prevDateStates) => ({
4351
+ ...prevDateStates,
4352
+ [key]: selectedDateString, // Will set it to empty if date is cleared
4353
+ }));
4354
+ // Update attributeFiltersState to remove filter if date is cleared
4355
+ setAttributeFiltersState((prevFilters = []) => {
4356
+ // Remove old filter for this key if the date is empty
4357
+ const filteredFilters = prevFilters.filter((f) => f.attribute !== key);
4358
+ // Only add a filter if the date is not empty
4359
+ const updatedFilters = selectedDateString.trim()
4360
+ ? [
4361
+ ...filteredFilters,
4362
+ { attribute: key, operator: 'like', value: selectedDateString },
4363
+ ]
4364
+ : filteredFilters; // If empty, just keep the filteredFilters as they are
4365
+ return updatedFilters;
4366
+ });
4367
+ };
4315
4368
  return (React__default.createElement("div", null,
4316
4369
  React__default.createElement("div", null, valueMatch &&
4317
4370
  this.dispatchTeis &&
@@ -4337,7 +4390,7 @@ class LineListTableComponent extends ReactWrapperModule {
4337
4390
  // <div>
4338
4391
  // <div/>
4339
4392
  React__default.createElement("div", null,
4340
- React__default.createElement(Modal$1, { hide: hide },
4393
+ React__default.createElement(Modal$1, { hide: hide, position: "middle" },
4341
4394
  React__default.createElement(ModalTitle$1, null, "Select organization unit"),
4342
4395
  React__default.createElement(ModalContent$1, null,
4343
4396
  React__default.createElement(OrgUnitFormField$1, { key: selectedOrgUnit, onSelectOrgUnit: (selectedOrgUnit) => {
@@ -4367,60 +4420,61 @@ class LineListTableComponent extends ReactWrapperModule {
4367
4420
  React__default.createElement(CalendarInput, { label: "End date:", calendar: "gregory", locale: "en-GB", timeZone: "Africa/Dar_es_Salaam", className: "custom-input", date: endDateState, onDateSelect: (selectedDate) => {
4368
4421
  setEndDateState(selectedDate.calendarDateString);
4369
4422
  } }),
4370
- (visibleFilters ?? []).map(({ label, key }) => (React__default.createElement(InputField$1, { key: key, label: `${label}:`, className: "custom-input", value: inputValues[key] || '', clearable: true, onChange: (e) => {
4371
- let currentValue = '';
4372
- if ('target' in e && e.target) {
4373
- currentValue = e.target.value;
4374
- }
4375
- else if ('value' in e) {
4376
- currentValue = e.value ?? '';
4377
- }
4378
- setInputValues((prevValues) => ({
4379
- ...prevValues,
4380
- [key]: currentValue,
4381
- }));
4382
- // Trigger change immediately if the input is cleared
4383
- if (currentValue === '') {
4384
- handleInputChange(key, '');
4385
- }
4386
- },
4387
- // onChange={(
4388
- // e:
4389
- // | React.ChangeEvent<HTMLInputElement>
4390
- // | { value?: string }
4391
- // ) => {
4392
- // if ('target' in e && e.target) {
4393
- // setInputValues((prevValues) => ({
4394
- // ...prevValues,
4395
- // [key]: (e as React.ChangeEvent<HTMLInputElement>)
4396
- // .target.value,
4397
- // }));
4398
- // } else if ('value' in e) {
4399
- // setInputValues((prevValues) => ({
4400
- // ...prevValues,
4401
- // [key]: e.value ?? '',
4402
- // }));
4403
- // }
4404
- // }}
4405
- onBlur: (e) => {
4406
- let currentValue = '';
4407
- if ('target' in e && e.target) {
4408
- currentValue = e.target.value;
4409
- }
4410
- else if ('value' in e) {
4411
- currentValue = e.value ?? '';
4412
- }
4413
- if (currentValue !== '' && currentValue !== prevValue) {
4414
- handleInputChange(key, currentValue);
4415
- setPrevValue(currentValue);
4416
- }
4417
- } }))),
4423
+ (visibleFilters ?? []).map(({ label, key, valueType, options }) => {
4424
+ // Render CalendarInput for DATE fields
4425
+ if (valueType === 'DATE') {
4426
+ return (React__default.createElement(CalendarInput, { key: key, label: `${label}:`, calendar: "gregory", locale: "en-GB", timeZone: "Africa/Dar_es_Salaam", className: "custom-input", date: dateStates[key] || '', onDateSelect: (selectedDate) => handleDateSelect(key, selectedDate) }));
4427
+ }
4428
+ // Render SingleSelectField if options exist
4429
+ if (options && options.options.length > 0) {
4430
+ return (React__default.createElement(SingleSelectField, { key: key, label: `${label}:`, selected: inputValues[key] || '', className: "custom-select-input", clearable: true, onChange: ({ selected }) => {
4431
+ setInputValues((prevValues) => ({
4432
+ ...prevValues,
4433
+ [key]: selected ?? '',
4434
+ }));
4435
+ handleInputChange(key, selected ?? '');
4436
+ } }, (options.options ?? []).map((opt) => (React__default.createElement(SingleSelectOption, { key: opt.id, label: opt.name, value: opt.code })))));
4437
+ }
4438
+ // Fallback: default InputField
4439
+ return (React__default.createElement(InputField$1, { key: key, label: `${label}:`, className: "custom-input", value: inputValues[key] || '', clearable: true, onChange: (e) => {
4440
+ let currentValue = '';
4441
+ if ('target' in e && e.target) {
4442
+ currentValue = e.target.value;
4443
+ }
4444
+ else if ('value' in e) {
4445
+ currentValue = e.value ?? '';
4446
+ }
4447
+ setInputValues((prevValues) => ({
4448
+ ...prevValues,
4449
+ [key]: currentValue,
4450
+ }));
4451
+ if (currentValue === '') {
4452
+ handleInputChange(key, '');
4453
+ }
4454
+ }, onBlur: (e) => {
4455
+ let currentValue = '';
4456
+ if ('target' in e && e.target) {
4457
+ currentValue = e.target.value;
4458
+ }
4459
+ else if ('value' in e) {
4460
+ currentValue = e.value ?? '';
4461
+ }
4462
+ if (currentValue !== '' &&
4463
+ currentValue !== prevValue) {
4464
+ handleInputChange(key, currentValue);
4465
+ setPrevValue(currentValue);
4466
+ }
4467
+ } }));
4468
+ }),
4418
4469
  React__default.createElement(Button$1, { onClick: () => setShowAllFilters(!showAllFilters) }, showAllFilters ? 'Less Filters' : 'More Filters')))),
4419
4470
  React__default.createElement(DataTable, null,
4420
4471
  React__default.createElement(TableHead, null,
4421
4472
  React__default.createElement(DataTableRow, null, columns.map((col) => (React__default.createElement(DataTableColumnHeader, { key: col.key }, col.label))))),
4422
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'
4423
4474
  ? this.actionOptions && (React__default.createElement(DataTableActions, { actionOptions: this.actionOptions, actionOptionOrientation: this.actionOptionOrientation, onClick: (option) => {
4475
+ if (option.onClick) {
4476
+ option.onClick(row);
4477
+ }
4424
4478
  this.actionSelected.emit({
4425
4479
  action: option.label,
4426
4480
  row,
@@ -4484,11 +4538,11 @@ class LineListTableComponent extends ReactWrapperModule {
4484
4538
  this.render();
4485
4539
  }
4486
4540
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: LineListTableComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
4487
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.8", type: LineListTableComponent, isStandalone: false, selector: "ng-dhis2-ui-line-list", inputs: { programId: "programId", orgUnit: "orgUnit", programStageId: "programStageId", actionOptions: "actionOptions", actionOptionOrientation: "actionOptionOrientation", attributeFilters: "attributeFilters", useOuModeWithOlderDHIS2Instance: "useOuModeWithOlderDHIS2Instance", startDate: "startDate", endDate: "endDate", filters: "filters", ouMode: "ouMode", dispatchTeis: "dispatchTeis", isButtonLoading: "isButtonLoading", buttonLabel: "buttonLabel", buttonFilter: "buttonFilter", filterRootOrgUnit: "filterRootOrgUnit", showFilters: "showFilters", isOptionSetNameVisible: "isOptionSetNameVisible" }, outputs: { actionSelected: "actionSelected", approvalSelected: "approvalSelected", firstValue: "firstValue" }, usesInheritance: true, usesOnChanges: true, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, styles: ["::ng-deep .custom-input{display:flex!important;gap:4px!important;align-items:center!important;border:1px solid #9fadba!important;border-radius:4px!important;margin:0;padding:0 0 0 8px;background-color:#fff!important}::ng-deep .custom-input div{margin:0!important}::ng-deep .custom-input label{font-size:12px;padding-right:0}::ng-deep .custom-input input{border:none!important;font-size:12px!important;display:flex;align-items:center;padding-left:4px;height:40px;outline:none!important;box-shadow:none!important}::ng-deep .custom-input input:focus{border:none!important;box-shadow:none!important}::ng-deep .custom-input label{color:gray!important;opacity:1}::ng-deep .table-top-toolbar{background-color:var(--colors-grey100)!important;color:var(--colors-grey900)!important}\n"] }); }
4541
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.8", type: LineListTableComponent, isStandalone: false, selector: "ng-dhis2-ui-line-list", inputs: { programId: "programId", orgUnit: "orgUnit", programStageId: "programStageId", actionOptions: "actionOptions", actionOptionOrientation: "actionOptionOrientation", attributeFilters: "attributeFilters", useOuModeWithOlderDHIS2Instance: "useOuModeWithOlderDHIS2Instance", startDate: "startDate", endDate: "endDate", filters: "filters", ouMode: "ouMode", dispatchTeis: "dispatchTeis", isButtonLoading: "isButtonLoading", buttonLabel: "buttonLabel", buttonFilter: "buttonFilter", filterRootOrgUnit: "filterRootOrgUnit", showFilters: "showFilters", isOptionSetNameVisible: "isOptionSetNameVisible" }, outputs: { actionSelected: "actionSelected", approvalSelected: "approvalSelected", firstValue: "firstValue" }, usesInheritance: true, usesOnChanges: true, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, styles: ["::ng-deep .custom-input{display:flex!important;gap:4px!important;align-items:center!important;border:1px solid #9fadba!important;border-radius:4px!important;margin:0;padding:0 0 0 8px;background-color:#fff!important}::ng-deep .custom-input div{margin:0!important}::ng-deep .custom-input label{font-size:12px;padding-right:0}::ng-deep .custom-input input{border:none!important;font-size:12px!important;display:flex;align-items:center;padding-left:4px;height:40px;outline:none!important;box-shadow:none!important}::ng-deep .custom-input input:focus{border:none!important;box-shadow:none!important}::ng-deep .custom-input label{color:gray!important;opacity:1}::ng-deep .table-top-toolbar{background-color:var(--colors-grey100)!important;color:var(--colors-grey900)!important}::ng-deep .custom-select-input{display:flex!important;gap:4px!important;align-items:center!important;border:1px solid #9fadba!important;border-radius:4px!important;margin:0;padding:0 0 0 8px;background-color:#fff!important}::ng-deep .custom-select-input div{margin:0!important}::ng-deep .custom-select-input [data-test=dhis2-uiwidgets-singleselectfield-label]{font-size:12px;color:gray!important}::ng-deep .custom-select-input [data-test=dhis2-uicore-select-input]{border:none!important;font-size:12px!important;display:flex;align-items:center;padding-left:4px;height:40px;outline:none!important;box-shadow:none!important}::ng-deep .custom-select-input [data-test=dhis2-uicore-select-input]:focus-within{box-shadow:none!important}::ng-deep .custom-select-input input:focus{border:none!important;box-shadow:none!important}\n"] }); }
4488
4542
  }
4489
4543
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: LineListTableComponent, decorators: [{
4490
4544
  type: Component,
4491
- args: [{ selector: 'ng-dhis2-ui-line-list', template: '<ng-content></ng-content>', standalone: false, styles: ["::ng-deep .custom-input{display:flex!important;gap:4px!important;align-items:center!important;border:1px solid #9fadba!important;border-radius:4px!important;margin:0;padding:0 0 0 8px;background-color:#fff!important}::ng-deep .custom-input div{margin:0!important}::ng-deep .custom-input label{font-size:12px;padding-right:0}::ng-deep .custom-input input{border:none!important;font-size:12px!important;display:flex;align-items:center;padding-left:4px;height:40px;outline:none!important;box-shadow:none!important}::ng-deep .custom-input input:focus{border:none!important;box-shadow:none!important}::ng-deep .custom-input label{color:gray!important;opacity:1}::ng-deep .table-top-toolbar{background-color:var(--colors-grey100)!important;color:var(--colors-grey900)!important}\n"] }]
4545
+ args: [{ selector: 'ng-dhis2-ui-line-list', template: '<ng-content></ng-content>', standalone: false, styles: ["::ng-deep .custom-input{display:flex!important;gap:4px!important;align-items:center!important;border:1px solid #9fadba!important;border-radius:4px!important;margin:0;padding:0 0 0 8px;background-color:#fff!important}::ng-deep .custom-input div{margin:0!important}::ng-deep .custom-input label{font-size:12px;padding-right:0}::ng-deep .custom-input input{border:none!important;font-size:12px!important;display:flex;align-items:center;padding-left:4px;height:40px;outline:none!important;box-shadow:none!important}::ng-deep .custom-input input:focus{border:none!important;box-shadow:none!important}::ng-deep .custom-input label{color:gray!important;opacity:1}::ng-deep .table-top-toolbar{background-color:var(--colors-grey100)!important;color:var(--colors-grey900)!important}::ng-deep .custom-select-input{display:flex!important;gap:4px!important;align-items:center!important;border:1px solid #9fadba!important;border-radius:4px!important;margin:0;padding:0 0 0 8px;background-color:#fff!important}::ng-deep .custom-select-input div{margin:0!important}::ng-deep .custom-select-input [data-test=dhis2-uiwidgets-singleselectfield-label]{font-size:12px;color:gray!important}::ng-deep .custom-select-input [data-test=dhis2-uicore-select-input]{border:none!important;font-size:12px!important;display:flex;align-items:center;padding-left:4px;height:40px;outline:none!important;box-shadow:none!important}::ng-deep .custom-select-input [data-test=dhis2-uicore-select-input]:focus-within{box-shadow:none!important}::ng-deep .custom-select-input input:focus{border:none!important;box-shadow:none!important}\n"] }]
4492
4546
  }], propDecorators: { programId: [{
4493
4547
  type: Input
4494
4548
  }], orgUnit: [{
@@ -4552,6 +4606,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImpor
4552
4606
  // Use of this source code is governed by a BSD-style
4553
4607
  // license that can be found in the LICENSE file.
4554
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
+
4555
4613
  const dropdownStyles = {
4556
4614
  layer: {
4557
4615
  zIndex: '1 !important',
@@ -5429,9 +5487,20 @@ class MetadataRule {
5429
5487
  class FormMetadataSection {
5430
5488
  constructor(params) {
5431
5489
  this.params = params;
5490
+ this.inheritedAttributes = [];
5491
+ this.inheritedAttributes =
5492
+ (this.params.program['trackedEntityType'] || {})['trackedEntityTypeAttributes'] || [];
5432
5493
  }
5433
5494
  get attributes() {
5434
- 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) => {
5435
5504
  return {
5436
5505
  ...programTrackedEntityAttribute['trackedEntityAttribute'],
5437
5506
  formName: (programTrackedEntityAttribute['trackedEntityAttribute'] || {})['name'],
@@ -5471,7 +5540,7 @@ class FormMetadataSection {
5471
5540
  return {
5472
5541
  id: this.params.section?.id,
5473
5542
  name: this.params.section?.name,
5474
- fieldGroups: this.fieldGroups,
5543
+ fieldGroups: this.fieldGroups.filter((fieldGroup) => fieldGroup.fields?.length > 0),
5475
5544
  };
5476
5545
  }
5477
5546
  }
@@ -5579,6 +5648,7 @@ class FormMetaData {
5579
5648
  },
5580
5649
  program,
5581
5650
  locale: this.params.locale,
5651
+ excludeInheritedAttributes: this.params.excludeInheritedAttributes,
5582
5652
  }).toJson();
5583
5653
  });
5584
5654
  }
@@ -5607,6 +5677,7 @@ class FormMetaData {
5607
5677
  },
5608
5678
  program,
5609
5679
  locale: this.params.locale,
5680
+ excludeInheritedAttributes: this.params.excludeInheritedAttributes,
5610
5681
  }).toJson();
5611
5682
  }
5612
5683
  #getReportingDateSection(program) {
@@ -5643,6 +5714,7 @@ class FormMetaData {
5643
5714
  },
5644
5715
  program,
5645
5716
  locale: this.params.locale,
5717
+ excludeInheritedAttributes: this.params.excludeInheritedAttributes,
5646
5718
  }).toJson();
5647
5719
  }
5648
5720
  #getRegistrationSection(program) {
@@ -5675,6 +5747,7 @@ class FormMetaData {
5675
5747
  },
5676
5748
  program,
5677
5749
  locale: this.params.locale,
5750
+ excludeInheritedAttributes: this.params.excludeInheritedAttributes,
5678
5751
  }).toJson();
5679
5752
  }
5680
5753
  #getMergedRegistrationSection(program) {
@@ -5750,6 +5823,7 @@ class FormMetaData {
5750
5823
  },
5751
5824
  program,
5752
5825
  locale: this.params.locale,
5826
+ excludeInheritedAttributes: this.params.excludeInheritedAttributes,
5753
5827
  }).toJson();
5754
5828
  }
5755
5829
  toJson() {
@@ -5840,18 +5914,6 @@ const FileUploadField = (props) => {
5840
5914
  else {
5841
5915
  onChange(file);
5842
5916
  }
5843
- // this.ngZone.run(() => {
5844
- // this.form().get(this.field().id) ||
5845
- // this.form()
5846
- // .get(this.field().key)
5847
- // ?.setValue((event?.files || [])[0]);
5848
- // this.update.emit({
5849
- // form: this.form(),
5850
- // value: (event?.files || [])[0],
5851
- // });
5852
- // });
5853
- // setValue((event?.files || [])[0]);
5854
- // setTouched(true);
5855
5917
  } }, file && (React__default.createElement(FileListItem, { cancelText: "Cancel", label: file.name, loading: uploading, onRemove: () => {
5856
5918
  setFile(null);
5857
5919
  }, removeText: "Remove" }))));
@@ -7362,6 +7424,7 @@ class TrackerFormComponent {
7362
7424
  programs: [program],
7363
7425
  programStage: this.programStage(),
7364
7426
  disableEnrollmentDate: true,
7427
+ excludeInheritedAttributes: true,
7365
7428
  }).toJson();
7366
7429
  }
7367
7430
  }
@@ -7477,7 +7540,14 @@ class ProgramEntryFormFieldUtil {
7477
7540
  this.config = config;
7478
7541
  }
7479
7542
  get attributes() {
7480
- 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) => {
7481
7551
  return {
7482
7552
  ...programTrackedEntityAttribute.trackedEntityAttribute,
7483
7553
  sortOrder: programTrackedEntityAttribute.sortOrder,
@@ -7639,6 +7709,11 @@ class ProgramEntryFormMetaData {
7639
7709
  'useFirstStageDuringRegistration',
7640
7710
  'trackedEntityType',
7641
7711
  ])
7712
+ .with(this.d2.programModule.trackedEntityType
7713
+ .select(['id', 'name'])
7714
+ .with(this.d2.programModule.trackedEntityTypeAttribute.select([
7715
+ 'trackedEntityAttribute',
7716
+ ])), 'ToOne')
7642
7717
  .with(this.d2.programModule.programTrackedEntityAttribute.with(this.d2.programModule.trackedEntityAttribute.with(this.d2.optionSetModule.optionSet.with(this.d2.optionSetModule.option), 'ToOne'), 'ToOne'))
7643
7718
  .with(this.d2.programModule.programRuleVariable
7644
7719
  .with(this.d2.dataElementModule.dataElement.select([