@iapps/ng-dhis2-ui 1.1.40 → 1.1.42

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.
@@ -3334,6 +3334,7 @@ class LineListTableComponent extends ReactWrapperModule {
3334
3334
  this.approvalSelected = new EventEmitter();
3335
3335
  this.isButtonLoading = false;
3336
3336
  this.buttonLabel = '';
3337
+ this.firstValue = new EventEmitter();
3337
3338
  this.setReactStateUpdaters = (updaters) => {
3338
3339
  this.reactStateUpdaters = updaters;
3339
3340
  };
@@ -3408,6 +3409,8 @@ class LineListTableComponent extends ReactWrapperModule {
3408
3409
  const { columns, data, filteredEntityColumns } = getTrackedEntityData(response, this.programId, pager, this.filters);
3409
3410
  entityColumns = columns;
3410
3411
  entityData = data;
3412
+ let firstTei = response.data.trackedEntityInstances[0].trackedEntityInstance;
3413
+ this.firstValue.emit(firstTei);
3411
3414
  // setFilteredColumns(filteredEntityColumns);
3412
3415
  // Ensure filter inputs do not disappear when no data is returned
3413
3416
  // If filteredEntityColumns is empty, keep the previous columns instead of clearing them
@@ -3609,7 +3612,7 @@ class LineListTableComponent extends ReactWrapperModule {
3609
3612
  this.render();
3610
3613
  }
3611
3614
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: LineListTableComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
3612
- 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" }, outputs: { actionSelected: "actionSelected", approvalSelected: "approvalSelected" }, 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"] }); }
3615
+ 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" }, 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"] }); }
3613
3616
  }
3614
3617
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: LineListTableComponent, decorators: [{
3615
3618
  type: Component,
@@ -3644,6 +3647,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImpor
3644
3647
  type: Input
3645
3648
  }], buttonLabel: [{
3646
3649
  type: Input
3650
+ }], firstValue: [{
3651
+ type: Output
3647
3652
  }] } });
3648
3653
 
3649
3654
  class LineListModule {
@@ -4516,38 +4521,13 @@ class FormMetaData {
4516
4521
  #getSectionFromPrograms(programs) {
4517
4522
  const sections = flatten(programs.map((program) => {
4518
4523
  return [
4519
- this.#getRegisteringUnitSection(program),
4520
- this.#getReportingDateSection(program),
4521
- new FormMetadataSection({
4522
- section: {
4523
- id: 'registration',
4524
- name: 'Registration',
4525
- fieldGroups: (program.programSections || []).length > 0
4526
- ? program.programSections.map((programSection) => {
4527
- return {
4528
- id: programSection.id,
4529
- name: programSection.name,
4530
- sortOrder: programSection.sortOrder,
4531
- fields: programSection.trackedEntityAttributes,
4532
- };
4533
- })
4534
- : [
4535
- {
4536
- id: 'registration',
4537
- name: '',
4538
- sortOrder: 1,
4539
- fields: (program.programTrackedEntityAttributes || []).map((programTrackedEntityAttribute) => {
4540
- return {
4541
- id: programTrackedEntityAttribute
4542
- .trackedEntityAttribute?.id,
4543
- };
4544
- }),
4545
- },
4546
- ],
4547
- },
4548
- program,
4549
- locale: this.params.locale,
4550
- }).toJson(),
4524
+ ...(this.params.splitRegistrationSection
4525
+ ? [
4526
+ this.#getRegisteringUnitSection(program),
4527
+ this.#getReportingDateSection(program),
4528
+ this.#getRegistrationSection(program),
4529
+ ]
4530
+ : [this.#getMergedRegistrationSection(program)]),
4551
4531
  ...(program.programStages || []).map((programStage) => {
4552
4532
  return new FormMetadataSection({
4553
4533
  section: {
@@ -4654,6 +4634,112 @@ class FormMetaData {
4654
4634
  locale: this.params.locale,
4655
4635
  }).toJson();
4656
4636
  }
4637
+ #getRegistrationSection(program) {
4638
+ return new FormMetadataSection({
4639
+ section: {
4640
+ id: 'registration',
4641
+ name: 'Registration',
4642
+ fieldGroups: (program.programSections || []).length > 0
4643
+ ? program.programSections.map((programSection) => {
4644
+ return {
4645
+ id: programSection.id,
4646
+ name: programSection.name,
4647
+ sortOrder: programSection.sortOrder,
4648
+ fields: programSection.trackedEntityAttributes,
4649
+ };
4650
+ })
4651
+ : [
4652
+ {
4653
+ id: 'registration',
4654
+ name: '',
4655
+ sortOrder: 1,
4656
+ fields: (program.programTrackedEntityAttributes || []).map((programTrackedEntityAttribute) => {
4657
+ return {
4658
+ id: programTrackedEntityAttribute.trackedEntityAttribute
4659
+ ?.id,
4660
+ };
4661
+ }),
4662
+ },
4663
+ ],
4664
+ },
4665
+ program,
4666
+ locale: this.params.locale,
4667
+ }).toJson();
4668
+ }
4669
+ #getMergedRegistrationSection(program) {
4670
+ return new FormMetadataSection({
4671
+ section: {
4672
+ id: 'registration',
4673
+ name: 'Registration',
4674
+ fieldGroups: [
4675
+ {
4676
+ id: 'registering_unit_details',
4677
+ name: 'Registering unit details',
4678
+ sortOrder: 1,
4679
+ isFormHorizontal: false,
4680
+ fields: [
4681
+ new FormField({
4682
+ id: 'orgUnit',
4683
+ key: 'orgUnit',
4684
+ label: program.orgUnitLabel || 'Registering unit',
4685
+ code: 'orgUnit',
4686
+ required: true,
4687
+ controlType: 'org-unit',
4688
+ }),
4689
+ ],
4690
+ },
4691
+ {
4692
+ id: 'reporting_dates',
4693
+ name: 'Reporting dates',
4694
+ sortOrder: 1,
4695
+ isFormHorizontal: false,
4696
+ fields: [
4697
+ new DateField({
4698
+ id: 'enrollmentDate',
4699
+ label: program.enrollmentDateLabel || 'Enrollment date',
4700
+ code: 'enrollmentDate',
4701
+ key: 'enrollmentDate',
4702
+ required: true,
4703
+ }),
4704
+ program.displayIncidentDate
4705
+ ? new DateField({
4706
+ id: 'incidentDate',
4707
+ label: program.incidentDateLabel || 'Incident date',
4708
+ code: 'incidentDate',
4709
+ key: 'incidentDate',
4710
+ required: true,
4711
+ })
4712
+ : null,
4713
+ ].filter((field) => field),
4714
+ },
4715
+ ...((program.programSections || []).length > 0
4716
+ ? program.programSections.map((programSection) => {
4717
+ return {
4718
+ id: programSection.id,
4719
+ name: programSection.name,
4720
+ sortOrder: programSection.sortOrder,
4721
+ fields: programSection.trackedEntityAttributes,
4722
+ };
4723
+ })
4724
+ : [
4725
+ {
4726
+ id: 'registration',
4727
+ name: '',
4728
+ sortOrder: 1,
4729
+ fields: (program.programTrackedEntityAttributes || []).map((programTrackedEntityAttribute) => {
4730
+ return {
4731
+ id: programTrackedEntityAttribute.trackedEntityAttribute
4732
+ ?.id,
4733
+ };
4734
+ }),
4735
+ },
4736
+ ]),
4737
+ ],
4738
+ },
4739
+ program,
4740
+ locale: this.params.locale,
4741
+ }).toJson();
4742
+ }
4657
4743
  toJson() {
4658
4744
  return {
4659
4745
  id: this.params.customFormMetaData?.id,