@iapps/ng-dhis2-ui 1.2.156 → 1.2.157

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.
@@ -4300,7 +4300,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImpor
4300
4300
  type: Injectable
4301
4301
  }] });
4302
4302
 
4303
- const getTrackedEntityTableData = (response, programId, pager, metaData, searcheableDataElements, customDisplayInReportsIds) => {
4303
+ const getTrackedEntityTableData = (response, programId, pager, metaData, searcheableDataElements, customDisplayInReportsIds, columnNameSource = 'NAME') => {
4304
+ const getColumnLabel = (item) => columnNameSource === 'FORM_NAME'
4305
+ ? item?.formName || item?.name || 'Default'
4306
+ : item?.name || item?.formName || 'Default';
4304
4307
  const teisRaw = response.data
4305
4308
  .trackedEntityInstances;
4306
4309
  const teis = Array.isArray(teisRaw)
@@ -4312,19 +4315,19 @@ const getTrackedEntityTableData = (response, programId, pager, metaData, searche
4312
4315
  const attributeColumns = metaData.displayInListTrackedEntityAttributes
4313
4316
  .sort((a, b) => a.sortOrder - b.sortOrder)
4314
4317
  .map((trackedEntityAttribute) => ({
4315
- label: trackedEntityAttribute.name ?? trackedEntityAttribute.formName,
4318
+ label: getColumnLabel(trackedEntityAttribute),
4316
4319
  key: trackedEntityAttribute.id,
4317
4320
  }));
4318
4321
  const shouldIncludeDataElement = (psde) => customDisplayInReportsIds !== undefined
4319
- ? customDisplayInReportsIds.includes(psde.dataElement.id)
4320
- : psde.displayInReports;
4322
+ ? customDisplayInReportsIds.includes(psde.dataElement?.id)
4323
+ : psde.displayInReports === true;
4321
4324
  const tableSearcheableDataElements = metaData
4322
4325
  .programStages.sort((a, b) => a.sortOrder - b.sortOrder)
4323
4326
  .flatMap((stage) => stage
4324
4327
  .programStageDataElements.filter(shouldIncludeDataElement)
4325
4328
  .sort((a, b) => a.sortOrder - b.sortOrder)
4326
4329
  .map((psde) => ({
4327
- label: psde.dataElement.name || psde.dataElement.formName || 'default',
4330
+ label: getColumnLabel(psde.dataElement),
4328
4331
  key: psde.dataElement.id,
4329
4332
  valueType: psde.dataElement.valueType,
4330
4333
  options: psde.dataElement.optionSet,
@@ -4337,7 +4340,7 @@ const getTrackedEntityTableData = (response, programId, pager, metaData, searche
4337
4340
  .programStageDataElements.filter(shouldIncludeDataElement)
4338
4341
  .sort((a, b) => a.sortOrder - b.sortOrder)
4339
4342
  .map((psde) => ({
4340
- label: psde.dataElement.name || psde.dataElement.formName || 'default',
4343
+ label: getColumnLabel(psde.dataElement),
4341
4344
  key: psde.dataElement.id,
4342
4345
  })));
4343
4346
  // const dataElementOptions = metaData.displayInListDataElements.map(
@@ -4372,7 +4375,8 @@ const getTrackedEntityTableData = (response, programId, pager, metaData, searche
4372
4375
  const tableFilters = metaData.searchableTrackedEntityAttributes
4373
4376
  .sort((a, b) => a.sortOrder - b.sortOrder)
4374
4377
  .map((attr) => ({
4375
- label: attr.name,
4378
+ // label: attr.name,
4379
+ label: getColumnLabel(attr),
4376
4380
  key: attr.id,
4377
4381
  valueType: attr.valueType,
4378
4382
  options: attr.optionSet ?? undefined,
@@ -4592,7 +4596,10 @@ const addActionsColumn = (columns, actionOptions) => {
4592
4596
  ];
4593
4597
  };
4594
4598
 
4595
- const getEvents = (response, programStageId, pager, metaData) => {
4599
+ const getEvents = (response, programStageId, pager, metaData, columnNameSource = 'NAME') => {
4600
+ const getColumnLabel = (item) => columnNameSource === 'FORM_NAME'
4601
+ ? item?.formName || item?.name || 'Default'
4602
+ : item?.name || item?.formName || 'Default';
4596
4603
  const events = response.data.events;
4597
4604
  const eventsiiii = response.data;
4598
4605
  const allDataElements = new Set();
@@ -4612,7 +4619,9 @@ const getEvents = (response, programStageId, pager, metaData) => {
4612
4619
  const entityColumns = Array.from(allDataElements).map((dataElementId) => {
4613
4620
  const dataElementMeta = stageFromMetaData.programStageDataElements.find((psde) => psde.dataElement.id === dataElementId);
4614
4621
  return {
4615
- label: dataElementMeta?.dataElement.name || dataElementId,
4622
+ label: dataElementMeta
4623
+ ? getColumnLabel(dataElementMeta.dataElement)
4624
+ : dataElementId,
4616
4625
  key: dataElementId,
4617
4626
  };
4618
4627
  });
@@ -4662,6 +4671,7 @@ class LineListTableComponent extends ReactWrapperModule {
4662
4671
  this.showEnrollmentDates = true;
4663
4672
  this.showDownloadButton = false;
4664
4673
  this.searcheableDataElements = [];
4674
+ this.columnNameSource = 'NAME';
4665
4675
  this.reactStateUpdaters = null;
4666
4676
  this.setReactStateUpdaters = (updaters) => {
4667
4677
  this.reactStateUpdaters = updaters;
@@ -4787,7 +4797,7 @@ class LineListTableComponent extends ReactWrapperModule {
4787
4797
  pager: pager,
4788
4798
  // orgUnitsMap: fetchedOrgUnits,
4789
4799
  };
4790
- const { columns, data } = getEvents({ data: eventsResponse }, this.programStageId, pager, metaData);
4800
+ const { columns, data } = getEvents({ data: eventsResponse }, this.programStageId, pager, metaData, this.columnNameSource);
4791
4801
  // const filterableColumnIdsSet = new Set(
4792
4802
  // this.filterableColumnIds
4793
4803
  // );
@@ -4867,7 +4877,7 @@ class LineListTableComponent extends ReactWrapperModule {
4867
4877
  pager: pager,
4868
4878
  orgUnitsMap: fetchedOrgUnits,
4869
4879
  };
4870
- const { columns, data, filteredEntityColumns, orgUnitLabel } = getTrackedEntityTableData({ data: trackedEntityResponse }, this.programId, pager, metaData, this.searcheableDataElements, this.customDisplayInReportsIds);
4880
+ const { columns, data, filteredEntityColumns, orgUnitLabel } = getTrackedEntityTableData({ data: trackedEntityResponse }, this.programId, pager, metaData, this.searcheableDataElements, this.customDisplayInReportsIds, this.columnNameSource);
4871
4881
  setFilteredColumns((prev) => filteredEntityColumns.length > 0 ? filteredEntityColumns : prev);
4872
4882
  let updatedFilterableColumnIds;
4873
4883
  if (Array.isArray(this.filterableColumnIds) &&
@@ -5236,7 +5246,7 @@ class LineListTableComponent extends ReactWrapperModule {
5236
5246
  this.render();
5237
5247
  }
5238
5248
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: LineListTableComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
5239
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.3", type: LineListTableComponent, isStandalone: false, selector: "ng-dhis2-ui-line-list", inputs: { triggerToken: "triggerToken", programId: "programId", orgUnit: "orgUnit", programStageId: "programStageId", actionOptions: "actionOptions", actionOptionOrientation: "actionOptionOrientation", attributeFilters: "attributeFilters", useOuModeWithOlderDHIS2Instance: "useOuModeWithOlderDHIS2Instance", startDate: "startDate", endDate: "endDate", dataQueryFilters: "dataQueryFilters", lineListRowActionFilterConfig: "lineListRowActionFilterConfig", hydrateForActionFiltering: "hydrateForActionFiltering", ouMode: "ouMode", isButtonLoading: "isButtonLoading", buttonFilter: "buttonFilter", filterRootOrgUnit: "filterRootOrgUnit", showFilters: "showFilters", isOptionSetNameVisible: "isOptionSetNameVisible", allowRowsSelection: "allowRowsSelection", enrollmentStatus: "enrollmentStatus", filterableColumnIds: "filterableColumnIds", triggerRefetch: "triggerRefetch", eventStatus: "eventStatus", showActionButtons: "showActionButtons", showEnrollmentDates: "showEnrollmentDates", showDownloadButton: "showDownloadButton", searcheableDataElements: "searcheableDataElements", customDisplayInReportsIds: "customDisplayInReportsIds" }, outputs: { actionSelected: "actionSelected", rowsSelected: "rowsSelected" }, usesInheritance: true, usesOnChanges: true, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, styles: ["@charset \"UTF-8\";::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 [data-test=calendar-clear-button]{background-color:#f2f2f2!important;color:#870808!important;border-radius:6px!important;padding:4px 10px!important;font-size:0!important}::ng-deep .custom-input [data-test=calendar-clear-button]:before{content:\"\\2715\";font-size:14px;color:#870808}::ng-deep .custom-input [data-test=calendar-clear-button]:hover{background-color:#ddd}::ng-deep .calendar-input-wrapper{position:relative}::ng-deep .calendar-input-wrapper .custom-input{position:relative;width:100%;display:flex;align-items:center}::ng-deep .calendar-input-wrapper [data-test=calendar-clear-button]{right:8px;bottom:14px;margin:auto;display:flex;align-items:center;justify-content:center;width:16px;height:16px;font-size:0!important;background-color:#a0adba!important;border-radius:50%;padding:2px;cursor:pointer}::ng-deep .calendar-input-wrapper [data-test=calendar-clear-button]:before{content:\"\\2715\";font-size:10px;color:#f0f0f0}::ng-deep .calendar-input-wrapper input{padding-right:40px!important;height:40px;line-height:40px;box-sizing:border-box}::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"] }); }
5249
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.3", type: LineListTableComponent, isStandalone: false, selector: "ng-dhis2-ui-line-list", inputs: { triggerToken: "triggerToken", programId: "programId", orgUnit: "orgUnit", programStageId: "programStageId", actionOptions: "actionOptions", actionOptionOrientation: "actionOptionOrientation", attributeFilters: "attributeFilters", useOuModeWithOlderDHIS2Instance: "useOuModeWithOlderDHIS2Instance", startDate: "startDate", endDate: "endDate", dataQueryFilters: "dataQueryFilters", lineListRowActionFilterConfig: "lineListRowActionFilterConfig", hydrateForActionFiltering: "hydrateForActionFiltering", ouMode: "ouMode", isButtonLoading: "isButtonLoading", buttonFilter: "buttonFilter", filterRootOrgUnit: "filterRootOrgUnit", showFilters: "showFilters", isOptionSetNameVisible: "isOptionSetNameVisible", allowRowsSelection: "allowRowsSelection", enrollmentStatus: "enrollmentStatus", filterableColumnIds: "filterableColumnIds", triggerRefetch: "triggerRefetch", eventStatus: "eventStatus", showActionButtons: "showActionButtons", showEnrollmentDates: "showEnrollmentDates", showDownloadButton: "showDownloadButton", searcheableDataElements: "searcheableDataElements", columnNameSource: "columnNameSource", customDisplayInReportsIds: "customDisplayInReportsIds" }, outputs: { actionSelected: "actionSelected", rowsSelected: "rowsSelected" }, usesInheritance: true, usesOnChanges: true, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, styles: ["@charset \"UTF-8\";::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 [data-test=calendar-clear-button]{background-color:#f2f2f2!important;color:#870808!important;border-radius:6px!important;padding:4px 10px!important;font-size:0!important}::ng-deep .custom-input [data-test=calendar-clear-button]:before{content:\"\\2715\";font-size:14px;color:#870808}::ng-deep .custom-input [data-test=calendar-clear-button]:hover{background-color:#ddd}::ng-deep .calendar-input-wrapper{position:relative}::ng-deep .calendar-input-wrapper .custom-input{position:relative;width:100%;display:flex;align-items:center}::ng-deep .calendar-input-wrapper [data-test=calendar-clear-button]{right:8px;bottom:14px;margin:auto;display:flex;align-items:center;justify-content:center;width:16px;height:16px;font-size:0!important;background-color:#a0adba!important;border-radius:50%;padding:2px;cursor:pointer}::ng-deep .calendar-input-wrapper [data-test=calendar-clear-button]:before{content:\"\\2715\";font-size:10px;color:#f0f0f0}::ng-deep .calendar-input-wrapper input{padding-right:40px!important;height:40px;line-height:40px;box-sizing:border-box}::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"] }); }
5240
5250
  }
5241
5251
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: LineListTableComponent, decorators: [{
5242
5252
  type: Component,
@@ -5301,6 +5311,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImpor
5301
5311
  type: Input
5302
5312
  }], searcheableDataElements: [{
5303
5313
  type: Input
5314
+ }], columnNameSource: [{
5315
+ type: Input
5304
5316
  }], customDisplayInReportsIds: [{
5305
5317
  type: Input
5306
5318
  }] } });