@iapps/ng-dhis2-ui 1.2.154 → 1.2.156
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.
- package/fesm2022/iapps-ng-dhis2-ui.mjs +68 -31
- package/fesm2022/iapps-ng-dhis2-ui.mjs.map +1 -1
- package/index.d.ts +20 -18
- package/package.json +1 -1
|
@@ -4300,7 +4300,7 @@ 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) => {
|
|
4303
|
+
const getTrackedEntityTableData = (response, programId, pager, metaData, searcheableDataElements, customDisplayInReportsIds) => {
|
|
4304
4304
|
const teisRaw = response.data
|
|
4305
4305
|
.trackedEntityInstances;
|
|
4306
4306
|
const teis = Array.isArray(teisRaw)
|
|
@@ -4315,10 +4315,13 @@ const getTrackedEntityTableData = (response, programId, pager, metaData, searche
|
|
|
4315
4315
|
label: trackedEntityAttribute.name ?? trackedEntityAttribute.formName,
|
|
4316
4316
|
key: trackedEntityAttribute.id,
|
|
4317
4317
|
}));
|
|
4318
|
+
const shouldIncludeDataElement = (psde) => customDisplayInReportsIds !== undefined
|
|
4319
|
+
? customDisplayInReportsIds.includes(psde.dataElement.id)
|
|
4320
|
+
: psde.displayInReports;
|
|
4318
4321
|
const tableSearcheableDataElements = metaData
|
|
4319
4322
|
.programStages.sort((a, b) => a.sortOrder - b.sortOrder)
|
|
4320
4323
|
.flatMap((stage) => stage
|
|
4321
|
-
.programStageDataElements.filter(
|
|
4324
|
+
.programStageDataElements.filter(shouldIncludeDataElement)
|
|
4322
4325
|
.sort((a, b) => a.sortOrder - b.sortOrder)
|
|
4323
4326
|
.map((psde) => ({
|
|
4324
4327
|
label: psde.dataElement.name || psde.dataElement.formName || 'default',
|
|
@@ -4331,19 +4334,32 @@ const getTrackedEntityTableData = (response, programId, pager, metaData, searche
|
|
|
4331
4334
|
const dataElementColumns = metaData
|
|
4332
4335
|
.programStages.sort((a, b) => a.sortOrder - b.sortOrder)
|
|
4333
4336
|
.flatMap((stage) => stage
|
|
4334
|
-
.programStageDataElements.filter(
|
|
4337
|
+
.programStageDataElements.filter(shouldIncludeDataElement)
|
|
4335
4338
|
.sort((a, b) => a.sortOrder - b.sortOrder)
|
|
4336
4339
|
.map((psde) => ({
|
|
4337
4340
|
label: psde.dataElement.name || psde.dataElement.formName || 'default',
|
|
4338
4341
|
key: psde.dataElement.id,
|
|
4339
4342
|
})));
|
|
4340
|
-
const dataElementOptions = metaData.displayInListDataElements.map(
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4343
|
+
// const dataElementOptions = metaData.displayInListDataElements.map(
|
|
4344
|
+
// (element) => ({
|
|
4345
|
+
// id: element.id,
|
|
4346
|
+
// options: element.optionSet?.options.map((opt) => ({
|
|
4347
|
+
// name: opt.name,
|
|
4348
|
+
// code: opt.code,
|
|
4349
|
+
// color: opt.style?.color,
|
|
4350
|
+
// })),
|
|
4351
|
+
// })
|
|
4352
|
+
// );
|
|
4353
|
+
const dataElementOptions = (metaData.programStages ?? [])
|
|
4354
|
+
.flatMap((stage) => stage.programStageDataElements ?? [])
|
|
4355
|
+
.filter((psde) => psde.dataElement && shouldIncludeDataElement(psde))
|
|
4356
|
+
.map(({ dataElement }) => ({
|
|
4357
|
+
id: dataElement.id,
|
|
4358
|
+
options: dataElement.optionSet?.options?.map((option) => ({
|
|
4359
|
+
name: option.name,
|
|
4360
|
+
code: option.code,
|
|
4361
|
+
color: option.style?.color,
|
|
4362
|
+
})) ?? [],
|
|
4347
4363
|
}));
|
|
4348
4364
|
const tableColumns = [
|
|
4349
4365
|
{
|
|
@@ -4851,7 +4867,7 @@ class LineListTableComponent extends ReactWrapperModule {
|
|
|
4851
4867
|
pager: pager,
|
|
4852
4868
|
orgUnitsMap: fetchedOrgUnits,
|
|
4853
4869
|
};
|
|
4854
|
-
const { columns, data, filteredEntityColumns, orgUnitLabel } = getTrackedEntityTableData({ data: trackedEntityResponse }, this.programId, pager, metaData, this.searcheableDataElements);
|
|
4870
|
+
const { columns, data, filteredEntityColumns, orgUnitLabel } = getTrackedEntityTableData({ data: trackedEntityResponse }, this.programId, pager, metaData, this.searcheableDataElements, this.customDisplayInReportsIds);
|
|
4855
4871
|
setFilteredColumns((prev) => filteredEntityColumns.length > 0 ? filteredEntityColumns : prev);
|
|
4856
4872
|
let updatedFilterableColumnIds;
|
|
4857
4873
|
if (Array.isArray(this.filterableColumnIds) &&
|
|
@@ -5220,7 +5236,7 @@ class LineListTableComponent extends ReactWrapperModule {
|
|
|
5220
5236
|
this.render();
|
|
5221
5237
|
}
|
|
5222
5238
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: LineListTableComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
5223
|
-
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" }, 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"] }); }
|
|
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"] }); }
|
|
5224
5240
|
}
|
|
5225
5241
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: LineListTableComponent, decorators: [{
|
|
5226
5242
|
type: Component,
|
|
@@ -5285,6 +5301,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImpor
|
|
|
5285
5301
|
type: Input
|
|
5286
5302
|
}], searcheableDataElements: [{
|
|
5287
5303
|
type: Input
|
|
5304
|
+
}], customDisplayInReportsIds: [{
|
|
5305
|
+
type: Input
|
|
5288
5306
|
}] } });
|
|
5289
5307
|
|
|
5290
5308
|
class LineListModule {
|
|
@@ -9169,18 +9187,18 @@ class BaseFormFieldComponent extends ReactWrapperModule {
|
|
|
9169
9187
|
`${pad(date.getMinutes())}`);
|
|
9170
9188
|
}
|
|
9171
9189
|
/**
|
|
9172
|
-
|
|
9173
|
-
|
|
9174
|
-
|
|
9175
|
-
|
|
9176
|
-
|
|
9177
|
-
|
|
9178
|
-
|
|
9179
|
-
|
|
9180
|
-
|
|
9181
|
-
|
|
9182
|
-
|
|
9183
|
-
|
|
9190
|
+
* Normalizes value from the HTML input into DHIS storage format.
|
|
9191
|
+
*
|
|
9192
|
+
* For date:
|
|
9193
|
+
* - Input: "YYYY-MM-DD"
|
|
9194
|
+
* - Output: "YYYY-MM-DD"
|
|
9195
|
+
*
|
|
9196
|
+
* For datetime:
|
|
9197
|
+
* - Input: "YYYY-MM-DDTHH:mm" (local)
|
|
9198
|
+
* - Output: ISO string in UTC: "YYYY-MM-DDTHH:mm:ss.sssZ"
|
|
9199
|
+
*
|
|
9200
|
+
* If allowFutureDate = false, any value beyond "now" is clamped to now.
|
|
9201
|
+
*/
|
|
9184
9202
|
normalizeDateValueFromHtmlInput(inputValue, isDateTimeField, allowFutureDate) {
|
|
9185
9203
|
const trimmed = (inputValue ?? '').trim();
|
|
9186
9204
|
if (!trimmed)
|
|
@@ -9202,19 +9220,38 @@ class BaseFormFieldComponent extends ReactWrapperModule {
|
|
|
9202
9220
|
if (!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}$/.test(trimmed)) {
|
|
9203
9221
|
return null;
|
|
9204
9222
|
}
|
|
9205
|
-
// Interpret as
|
|
9206
|
-
const
|
|
9207
|
-
|
|
9223
|
+
// Interpret selected datetime as EAT, not UTC/GMT
|
|
9224
|
+
const eatDateTimeValue = `${trimmed}:00.000+03:00`;
|
|
9225
|
+
const eatDate = new Date(eatDateTimeValue);
|
|
9226
|
+
if (Number.isNaN(eatDate.getTime())) {
|
|
9208
9227
|
return null;
|
|
9209
9228
|
}
|
|
9210
9229
|
if (!allowFutureDate) {
|
|
9211
9230
|
const now = new Date();
|
|
9212
|
-
if (
|
|
9213
|
-
return
|
|
9231
|
+
if (eatDate.getTime() > now.getTime()) {
|
|
9232
|
+
return this.getNowInEatIsoString();
|
|
9214
9233
|
}
|
|
9215
9234
|
}
|
|
9216
|
-
|
|
9217
|
-
|
|
9235
|
+
return eatDateTimeValue;
|
|
9236
|
+
}
|
|
9237
|
+
getNowInEatIsoString() {
|
|
9238
|
+
const formatter = new Intl.DateTimeFormat('en-GB', {
|
|
9239
|
+
timeZone: 'Africa/Dar_es_Salaam',
|
|
9240
|
+
year: 'numeric',
|
|
9241
|
+
month: '2-digit',
|
|
9242
|
+
day: '2-digit',
|
|
9243
|
+
hour: '2-digit',
|
|
9244
|
+
minute: '2-digit',
|
|
9245
|
+
second: '2-digit',
|
|
9246
|
+
hourCycle: 'h23',
|
|
9247
|
+
});
|
|
9248
|
+
const parts = formatter.formatToParts(new Date()).reduce((acc, part) => {
|
|
9249
|
+
if (part.type !== 'literal') {
|
|
9250
|
+
acc[part.type] = part.value;
|
|
9251
|
+
}
|
|
9252
|
+
return acc;
|
|
9253
|
+
}, {});
|
|
9254
|
+
return `${parts['year']}-${parts['month']}-${parts['day']}T${parts['hour']}:${parts['minute']}:${parts['second']}.000+03:00`;
|
|
9218
9255
|
}
|
|
9219
9256
|
async searchForDuplicates(value) {
|
|
9220
9257
|
const d2 = window.d2Web;
|