@iapps/ng-dhis2-ui 1.2.7 → 1.2.62

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.
@@ -3534,7 +3534,6 @@ const DataTableActions = (props) => {
3534
3534
  // license that can be found in the LICENSE file.
3535
3535
 
3536
3536
  const TableCell = ({ cell, getTextColorFromBackGround, }) => {
3537
- console.log('cel value', cell);
3538
3537
  if (cell?.style && cell?.style !== 'default-value') {
3539
3538
  return (React__default.createElement(DataTableCell, null,
3540
3539
  React__default.createElement("div", { style: { display: 'flex', justifyContent: 'center' } },
@@ -3791,12 +3790,21 @@ const getTrackedEntityTableData = (response, programId, pager, metaData) => {
3791
3790
  label: trackedEntityAttribute.formName ?? trackedEntityAttribute.name,
3792
3791
  key: trackedEntityAttribute.id,
3793
3792
  }));
3794
- const dataElementColumns = metaData.displayInListDataElements
3795
- .sort((a, b) => a.sortOrder - b.sortOrder)
3796
- .map((dataElement) => ({
3797
- label: dataElement.formName || dataElement.name,
3798
- key: dataElement.id,
3799
- }));
3793
+ // const dataElementColumns = metaData.displayInListDataElements
3794
+ // .sort((a, b) => a.sortOrder! - b.sortOrder!)
3795
+ // .map((dataElement) => ({
3796
+ // label: dataElement.formName || dataElement.name,
3797
+ // key: dataElement.id,
3798
+ // }));
3799
+ const dataElementColumns = metaData
3800
+ .programStages.sort((a, b) => a.sortOrder - b.sortOrder) // Sorts stages by sortOrder
3801
+ .flatMap((stage) => stage
3802
+ .programStageDataElements.filter((psde) => psde.displayInReports)
3803
+ .sort((a, b) => a.sortOrder - b.sortOrder) // Sorts data elements within stage
3804
+ .map((psde) => ({
3805
+ label: psde.dataElement.formName || psde.dataElement.name,
3806
+ key: psde.dataElement.id,
3807
+ })));
3800
3808
  const dataElementOptions = metaData.displayInListDataElements.map((element) => ({
3801
3809
  id: element.id,
3802
3810
  options: element.optionSet?.options.map((opt) => ({
@@ -3837,7 +3845,7 @@ const getTrackedEntityTableData = (response, programId, pager, metaData) => {
3837
3845
  };
3838
3846
  }
3839
3847
  catch {
3840
- return { ...attr }; // Leave value as is on parse failure
3848
+ return { ...attr };
3841
3849
  }
3842
3850
  }
3843
3851
  return attr;
@@ -3856,11 +3864,11 @@ const getTrackedEntityTableData = (response, programId, pager, metaData) => {
3856
3864
  }
3857
3865
  });
3858
3866
  dataElementsData.forEach((element) => {
3859
- // Find the matching data element in dataElementOptions by ID
3867
+ // Finds the matching data element in dataElementOptions by ID
3860
3868
  const dataElementOption = dataElementOptions.find((deo) => deo.id === element.dataElement);
3861
- // find a matching option within that data element's options
3869
+ // finds a matching option within that data element's options
3862
3870
  const matchingOption = dataElementOption?.options?.find((opt) => opt.name === element.value);
3863
- // Build the row entry with value and optionally style
3871
+ // Builds the row entry with value and optional style
3864
3872
  if (matchingOption) {
3865
3873
  row[element.dataElement] = {
3866
3874
  value: element.value,
@@ -3873,7 +3881,7 @@ const getTrackedEntityTableData = (response, programId, pager, metaData) => {
3873
3881
  };
3874
3882
  }
3875
3883
  });
3876
- // Include orgUnit in the row for id access with style
3884
+ // Includes orgUnit in the row for id access with style
3877
3885
  row['orgUnitId'] = { value: matchingEnrollment.orgUnit };
3878
3886
  row['orgUnit'] = {
3879
3887
  value: orgUnitMap?.get(matchingEnrollment.orgUnit) || '-',
@@ -3959,6 +3967,7 @@ class LineListTableComponent extends ReactWrapperModule {
3959
3967
  this.showFilters = false;
3960
3968
  this.isOptionSetNameVisible = false;
3961
3969
  this.allowRowsSelection = false;
3970
+ this.triggerRefetch = false;
3962
3971
  this.actionSelected = new EventEmitter();
3963
3972
  this.rowsSelected = new EventEmitter();
3964
3973
  this.reactStateUpdaters = null;
@@ -3999,6 +4008,7 @@ class LineListTableComponent extends ReactWrapperModule {
3999
4008
  const [dateStates, setDateStates] = useState({});
4000
4009
  const [metaData, setMetaData] = useState(null);
4001
4010
  const [selectable, setSelectable] = useState(this.allowRowsSelection);
4011
+ const [triggerRefetch, setTriggerRefetch] = useState(this.triggerRefetch);
4002
4012
  const d2 = window.d2Web;
4003
4013
  // Store updaters in refs for Angular to access
4004
4014
  const updateRefs = useRef({
@@ -4010,6 +4020,7 @@ class LineListTableComponent extends ReactWrapperModule {
4010
4020
  setEndDateState,
4011
4021
  setOptionSetNameVisible,
4012
4022
  setSelectable,
4023
+ setTriggerRefetch
4013
4024
  });
4014
4025
  useEffect(() => {
4015
4026
  this.setReactStateUpdaters?.(updateRefs.current);
@@ -4128,6 +4139,7 @@ class LineListTableComponent extends ReactWrapperModule {
4128
4139
  pager.pageSize,
4129
4140
  isOptionSetNameVisibleState,
4130
4141
  dataQueryFiltersState,
4142
+ triggerRefetch
4131
4143
  ]);
4132
4144
  const handleInputChange = (key, value) => {
4133
4145
  setInputValues((prevValues) => ({
@@ -4250,6 +4262,9 @@ class LineListTableComponent extends ReactWrapperModule {
4250
4262
  if (changes['allowRowsSelection']) {
4251
4263
  this.reactStateUpdaters.setIsButtonLoading(this.allowRowsSelection);
4252
4264
  }
4265
+ if (changes['triggerRefetch']) {
4266
+ this.reactStateUpdaters.setTriggerRefetch(this.triggerRefetch);
4267
+ }
4253
4268
  }
4254
4269
  }
4255
4270
  async ngAfterViewInit() {
@@ -4260,7 +4275,7 @@ class LineListTableComponent extends ReactWrapperModule {
4260
4275
  this.render();
4261
4276
  }
4262
4277
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: LineListTableComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
4263
- 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", dataQueryFilters: "dataQueryFilters", ouMode: "ouMode", isButtonLoading: "isButtonLoading", buttonFilter: "buttonFilter", filterRootOrgUnit: "filterRootOrgUnit", showFilters: "showFilters", isOptionSetNameVisible: "isOptionSetNameVisible", allowRowsSelection: "allowRowsSelection", enrollmentStatus: "enrollmentStatus", eventStatus: "eventStatus" }, 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"] }); }
4278
+ 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", dataQueryFilters: "dataQueryFilters", ouMode: "ouMode", isButtonLoading: "isButtonLoading", buttonFilter: "buttonFilter", filterRootOrgUnit: "filterRootOrgUnit", showFilters: "showFilters", isOptionSetNameVisible: "isOptionSetNameVisible", allowRowsSelection: "allowRowsSelection", enrollmentStatus: "enrollmentStatus", triggerRefetch: "triggerRefetch", eventStatus: "eventStatus" }, 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"] }); }
4264
4279
  }
4265
4280
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: LineListTableComponent, decorators: [{
4266
4281
  type: Component,
@@ -4301,6 +4316,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImpor
4301
4316
  type: Input
4302
4317
  }], enrollmentStatus: [{
4303
4318
  type: Input
4319
+ }], triggerRefetch: [{
4320
+ type: Input
4304
4321
  }], eventStatus: [{
4305
4322
  type: Input
4306
4323
  }], actionSelected: [{