@iapps/ng-dhis2-ui 1.3.6 → 1.3.8
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.
|
@@ -3233,18 +3233,20 @@ const orgUnitFieldStyles$1 = {
|
|
|
3233
3233
|
},
|
|
3234
3234
|
};
|
|
3235
3235
|
const OrgUnitFormField$1 = (props) => {
|
|
3236
|
-
const { onSelectOrgUnit, label, required, selected, disabled, key } = props;
|
|
3236
|
+
const { onSelectOrgUnit, label, required, selected, disabled, key, customOrgUnitRoots, multiple = false, selectedPaths, } = props;
|
|
3237
3237
|
const d2 = window?.d2Web;
|
|
3238
3238
|
const classes = useDynamicStyles$2(orgUnitFieldStyles$1);
|
|
3239
3239
|
const config = useMemo(() => {
|
|
3240
3240
|
return d2.systemInfo?.toInitObject();
|
|
3241
3241
|
}, []);
|
|
3242
3242
|
const rootOrgUnits = useMemo(() => {
|
|
3243
|
-
return
|
|
3244
|
-
|
|
3243
|
+
return (customOrgUnitRoots?.map((id) => ({ id: `/${id}`, path: `/${id}` })) ??
|
|
3244
|
+
d2.currentUser?.organisationUnits ??
|
|
3245
|
+
[]);
|
|
3246
|
+
}, [customOrgUnitRoots]);
|
|
3245
3247
|
const getExpandedItems = () => {
|
|
3246
3248
|
if (rootOrgUnits && rootOrgUnits.length === 1) {
|
|
3247
|
-
return [
|
|
3249
|
+
return [`${rootOrgUnits[0].path}`];
|
|
3248
3250
|
}
|
|
3249
3251
|
else if (rootOrgUnits?.length > 1) {
|
|
3250
3252
|
return rootOrgUnits.map((root) => root.path);
|
|
@@ -3278,11 +3280,14 @@ const OrgUnitFormField$1 = (props) => {
|
|
|
3278
3280
|
}
|
|
3279
3281
|
}, []);
|
|
3280
3282
|
const highlighted = useMemo(() => {
|
|
3283
|
+
if (selectedPaths !== undefined) {
|
|
3284
|
+
return selectedPaths;
|
|
3285
|
+
}
|
|
3281
3286
|
if (selectedOrgUnit) {
|
|
3282
3287
|
return [selectedOrgUnit['path']];
|
|
3283
3288
|
}
|
|
3284
3289
|
return undefined;
|
|
3285
|
-
}, [selectedOrgUnit]);
|
|
3290
|
+
}, [selectedPaths, selectedOrgUnit]);
|
|
3286
3291
|
const selectedOrgUnitLabel = useMemo(() => {
|
|
3287
3292
|
if (selectedOrgUnit) {
|
|
3288
3293
|
return [
|
|
@@ -3300,13 +3305,7 @@ const OrgUnitFormField$1 = (props) => {
|
|
|
3300
3305
|
}
|
|
3301
3306
|
};
|
|
3302
3307
|
const handleCollapse = ({ path }) => {
|
|
3303
|
-
|
|
3304
|
-
if (pathIndex && pathIndex !== -1 && expanded) {
|
|
3305
|
-
const updatedExpanded = pathIndex === 0
|
|
3306
|
-
? expanded.slice(1)
|
|
3307
|
-
: [...expanded.slice(0, pathIndex), ...expanded.slice(pathIndex + 1)];
|
|
3308
|
-
setExpanded(updatedExpanded);
|
|
3309
|
-
}
|
|
3308
|
+
setExpanded((previous) => previous?.filter((item) => item !== path));
|
|
3310
3309
|
};
|
|
3311
3310
|
const handleOrgUnitSearch = async (query) => {
|
|
3312
3311
|
setSearchLoading(true);
|
|
@@ -3335,15 +3334,15 @@ const OrgUnitFormField$1 = (props) => {
|
|
|
3335
3334
|
return (React__default.createElement("div", { className: classes.orgUnitTreeLoader },
|
|
3336
3335
|
React__default.createElement(CircularLoader$1, { small: true })));
|
|
3337
3336
|
}
|
|
3338
|
-
return (ready && (React__default.createElement(OrganisationUnitTree, { key: `${key}-search`, roots: searchData?.map((orgUnit) => orgUnit.id) || [], singleSelection:
|
|
3337
|
+
return (ready && (React__default.createElement(OrganisationUnitTree, { key: `${key}-search`, roots: searchData?.map((orgUnit) => orgUnit.id) || [], singleSelection: !multiple, expanded: expanded, handleExpand: handleExpand, handleCollapse: handleCollapse, selected: highlighted, onChange: (event) => {
|
|
3339
3338
|
setSelectedOrgUnit(event);
|
|
3340
|
-
setShowOrgUnitTree(
|
|
3339
|
+
setShowOrgUnitTree(multiple);
|
|
3341
3340
|
onSelectOrgUnit(event);
|
|
3342
3341
|
} })));
|
|
3343
3342
|
}
|
|
3344
|
-
return (React__default.createElement(OrganisationUnitTree, { key: key, roots: rootOrgUnits?.map((orgUnit) => orgUnit.id) || [], singleSelection:
|
|
3343
|
+
return (React__default.createElement(OrganisationUnitTree, { key: key, roots: rootOrgUnits?.map((orgUnit) => orgUnit.id) || [], singleSelection: !multiple, expanded: expanded, handleExpand: handleExpand, handleCollapse: handleCollapse, selected: highlighted, onChange: (event) => {
|
|
3345
3344
|
setSelectedOrgUnit(event);
|
|
3346
|
-
setShowOrgUnitTree(
|
|
3345
|
+
setShowOrgUnitTree(multiple);
|
|
3347
3346
|
onSelectOrgUnit(event);
|
|
3348
3347
|
} }));
|
|
3349
3348
|
};
|
|
@@ -3355,7 +3354,7 @@ const OrgUnitFormField$1 = (props) => {
|
|
|
3355
3354
|
label && (React__default.createElement("div", { className: classes.orgUnitFieldLabel },
|
|
3356
3355
|
React__default.createElement("span", null, label),
|
|
3357
3356
|
required ? (React__default.createElement("span", { className: classes.orgUnitFieldRequiredLabel }, "*")) : (React__default.createElement(React__default.Fragment, null)))),
|
|
3358
|
-
!showOrgUnitTree ? (selectedOrgUnit ? (React__default.createElement(React__default.Fragment, null,
|
|
3357
|
+
!multiple && !showOrgUnitTree ? (selectedOrgUnit ? (React__default.createElement(React__default.Fragment, null,
|
|
3359
3358
|
React__default.createElement(Tooltip, { content: selectedOrgUnitLabel },
|
|
3360
3359
|
React__default.createElement(Chip, { onRemove: () => {
|
|
3361
3360
|
setShowOrgUnitTree(true);
|
|
@@ -3367,19 +3366,17 @@ const OrgUnitFormField$1 = (props) => {
|
|
|
3367
3366
|
React__default.createElement(CircularLoader$1, { small: true }))) : (React__default.createElement("div", { className: classes.orgUnitTreeContainer, style: { maxHeight: '200px', overflowY: 'auto' } }, renderOrgUnitTree()))))))));
|
|
3368
3367
|
};
|
|
3369
3368
|
|
|
3370
|
-
const
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
const FilterToolbar = ({ orgUnitLabel, selectedOrgUnit, setSelectedOrgUnit, setOrgUnitState, defaultOrgUnit, setHide, startDateState, setStartDateState, endDateState, setEndDateState, visibleFilters, dateStates, inputValues, setInputValues, handleInputChange, handleInputChangeForSelectField, handleDateSelect, showAllFilters, setShowAllFilters, setTempStartDateState, setTempEndDateState, setTempOrgUnitState, tempStartDateState, tempEndDateState, tempOrgUnitState, dataQueryFiltersState, setDataQueryFiltersState, SetOrgUnitModalVisible, showEnrollmentDates, handleAdditionalFilters, handleStartDateFilter, handleEndDateFilter, handleOrgUnitFilter, setDateStates, prevInputValues, setPrevInputValues, setTempDataQueryFiltersState, prevDateStates, setPrevDateStates, prevSelectedOrgUnit, setPrevSelectedOrgUnit, }) => {
|
|
3369
|
+
const FilterToolbar = ({ orgUnit: { customOrgUnitRoots, allowMultipleOrgUnits, chosenOrgUnits: chosenOrgUnitsProp, setChosenOrgUnits, orgUnitLabel, selectedOrgUnit, setSelectedOrgUnit, setOrgUnitState, defaultOrgUnit, setTempOrgUnitState, tempOrgUnitState, handleOrgUnitFilter, tempOrgUnitModeState, defaultOrgUnitMode, setTempOrgUnitModeState, handleOrgUnitModeReset, prevSelectedOrgUnit, setPrevSelectedOrgUnit, }, dates: { startDateState, setStartDateState, endDateState, setEndDateState, setTempStartDateState, setTempEndDateState, tempStartDateState, tempEndDateState, showEnrollmentDates, handleStartDateFilter, handleEndDateFilter, }, filters: { visibleFilters, dateStates, inputValues, setInputValues, handleInputChange, handleInputChangeForSelectField, handleDateSelect, showAllFilters, setShowAllFilters, dataQueryFiltersState, setDataQueryFiltersState, handleAdditionalFilters, setDateStates, prevInputValues, setPrevInputValues, setTempDataQueryFiltersState, prevDateStates, setPrevDateStates, }, }) => {
|
|
3370
|
+
const chosenOrgUnits = chosenOrgUnitsProp;
|
|
3371
|
+
const displayedOrgUnitNames = (prevSelectedOrgUnit || '').split(', ');
|
|
3372
|
+
const orgUnitSelectionLabel = displayedOrgUnitNames.length > 2
|
|
3373
|
+
? `${displayedOrgUnitNames.slice(0, 2).join(', ')} .....`
|
|
3374
|
+
: prevSelectedOrgUnit;
|
|
3375
|
+
const updateChosenOrgUnits = (units) => {
|
|
3376
|
+
setChosenOrgUnits(units);
|
|
3377
|
+
setSelectedOrgUnit(units.map((unit) => unit.displayName).join(', '));
|
|
3378
|
+
setTempOrgUnitState(units.map((unit) => unit.id).join(';'));
|
|
3379
|
+
};
|
|
3383
3380
|
const [isOpen, setIsOpen] = useState(false);
|
|
3384
3381
|
const [isOpenOrgUnitDropdown, setIsOpenOrgUnitDropdown] = useState(false);
|
|
3385
3382
|
const [openDropdownKey, setOpenDropdownKey] = useState(null);
|
|
@@ -3399,12 +3396,25 @@ const FilterToolbar = ({ orgUnitLabel, selectedOrgUnit, setSelectedOrgUnit, setO
|
|
|
3399
3396
|
flexWrap: 'wrap',
|
|
3400
3397
|
} },
|
|
3401
3398
|
React__default.createElement(DropdownButton, { name: "customDropdown", open: isOpenOrgUnitDropdown, onClick: () => setIsOpenOrgUnitDropdown(!isOpenOrgUnitDropdown), component: React__default.createElement("div", null,
|
|
3402
|
-
React__default.createElement(FlyoutMenu,
|
|
3399
|
+
React__default.createElement(FlyoutMenu, { maxWidth: "90vw" },
|
|
3403
3400
|
React__default.createElement("div", { style: { padding: '16px' } },
|
|
3404
|
-
React__default.createElement(
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3401
|
+
isOpenOrgUnitDropdown && (React__default.createElement("div", { style: { width: '400px', maxWidth: '80vw' } },
|
|
3402
|
+
React__default.createElement(OrgUnitFormField$1, { key: "registering-unit", customOrgUnitRoots: customOrgUnitRoots, multiple: allowMultipleOrgUnits, selectedPaths: chosenOrgUnits.map((unit) => unit.path), onSelectOrgUnit: (unit) => {
|
|
3403
|
+
if (!allowMultipleOrgUnits) {
|
|
3404
|
+
updateChosenOrgUnits([unit]);
|
|
3405
|
+
return;
|
|
3406
|
+
}
|
|
3407
|
+
const paths = unit.selected;
|
|
3408
|
+
const units = chosenOrgUnits.filter((chosen) => paths.includes(chosen.path));
|
|
3409
|
+
if (paths.includes(unit.path) && !units.some((chosen) => chosen.id === unit.id)) {
|
|
3410
|
+
units.push(unit);
|
|
3411
|
+
}
|
|
3412
|
+
updateChosenOrgUnits(units);
|
|
3413
|
+
} }),
|
|
3414
|
+
React__default.createElement("div", { role: "group", "aria-label": "Mode", style: { display: 'flex', alignItems: 'center', gap: '12px', margin: '8px 0 12px' } },
|
|
3415
|
+
React__default.createElement("span", { style: { fontSize: '14px', fontWeight: 400 } }, "Mode:"),
|
|
3416
|
+
React__default.createElement("div", { style: { flex: 1, minWidth: 0 } },
|
|
3417
|
+
React__default.createElement(SingleSelectField, { selected: tempOrgUnitModeState, helpText: `If no mode is selected, the default mode will be ${defaultOrgUnitMode}.`, onChange: ({ selected }) => setTempOrgUnitModeState(selected) }, ['DESCENDANTS', 'SELECTED', 'CHILDREN'].map((mode) => (React__default.createElement(SingleSelectOption, { key: mode, label: mode, value: mode })))))))),
|
|
3408
3418
|
React__default.createElement("div", { style: {
|
|
3409
3419
|
paddingTop: '8px',
|
|
3410
3420
|
display: 'flex',
|
|
@@ -3418,21 +3428,25 @@ const FilterToolbar = ({ orgUnitLabel, selectedOrgUnit, setSelectedOrgUnit, setO
|
|
|
3418
3428
|
} }, "Update"),
|
|
3419
3429
|
React__default.createElement(Button$1, { disabled: !selectedOrgUnit, onClick: () => {
|
|
3420
3430
|
setSelectedOrgUnit('');
|
|
3431
|
+
setChosenOrgUnits([]);
|
|
3421
3432
|
setPrevSelectedOrgUnit('');
|
|
3422
3433
|
setOrgUnitState(defaultOrgUnit);
|
|
3434
|
+
handleOrgUnitModeReset();
|
|
3423
3435
|
setTempOrgUnitState(defaultOrgUnit);
|
|
3424
3436
|
setIsOpenOrgUnitDropdown(false);
|
|
3425
3437
|
} }, "Reset")))))) },
|
|
3426
3438
|
orgUnitLabel ? orgUnitLabel : 'Registering unit',
|
|
3427
3439
|
' ',
|
|
3428
|
-
prevSelectedOrgUnit &&
|
|
3429
|
-
|
|
3430
|
-
|
|
3440
|
+
prevSelectedOrgUnit && (React__default.createElement("span", { title: prevSelectedOrgUnit },
|
|
3441
|
+
": ",
|
|
3442
|
+
orgUnitSelectionLabel)),
|
|
3431
3443
|
prevSelectedOrgUnit && (React__default.createElement("span", { onClick: (event) => {
|
|
3432
3444
|
event.stopPropagation();
|
|
3433
3445
|
setSelectedOrgUnit('');
|
|
3446
|
+
setChosenOrgUnits([]);
|
|
3434
3447
|
setPrevSelectedOrgUnit('');
|
|
3435
3448
|
setOrgUnitState(defaultOrgUnit);
|
|
3449
|
+
handleOrgUnitModeReset();
|
|
3436
3450
|
setTempOrgUnitState(defaultOrgUnit);
|
|
3437
3451
|
setIsOpenOrgUnitDropdown(false);
|
|
3438
3452
|
}, style: { display: 'inline-flex', alignItems: 'center' } },
|
|
@@ -3688,49 +3702,6 @@ function formatDateForDisplay(dateString) {
|
|
|
3688
3702
|
return 'dd-mm-yyyy';
|
|
3689
3703
|
}
|
|
3690
3704
|
}
|
|
3691
|
-
// case 'date':
|
|
3692
|
-
// case 'date-time':
|
|
3693
|
-
// return (
|
|
3694
|
-
// // <InputField
|
|
3695
|
-
// // error={hasError}
|
|
3696
|
-
// // validationText={validationError}
|
|
3697
|
-
// // type={this.field().type as any}
|
|
3698
|
-
// // inputWidth={inputWidth}
|
|
3699
|
-
// // required={this.field().required}
|
|
3700
|
-
// // name={this.field().id}
|
|
3701
|
-
// // label={this.label()}
|
|
3702
|
-
// // min={this.field().min?.toString()}
|
|
3703
|
-
// // max={this.field().max?.toString()}
|
|
3704
|
-
// // placeholder={this.placeholder()}
|
|
3705
|
-
// // value={value}
|
|
3706
|
-
// // readOnly={disabled}
|
|
3707
|
-
// // onChange={(event: any) => {
|
|
3708
|
-
// // onValueChange(event.value);
|
|
3709
|
-
// // }}
|
|
3710
|
-
// // onBlur={() => {
|
|
3711
|
-
// // checkValueUniqueness();
|
|
3712
|
-
// // }}
|
|
3713
|
-
// // />
|
|
3714
|
-
// <CalendarInput
|
|
3715
|
-
// label={this.label()}
|
|
3716
|
-
// error={hasError}
|
|
3717
|
-
// validationText={validationError}
|
|
3718
|
-
// date={value}
|
|
3719
|
-
// readOnly={disabled}
|
|
3720
|
-
// min={this.field().min?.toString()}
|
|
3721
|
-
// max={this.field().max?.toString()}
|
|
3722
|
-
// placeholder={this.placeholder()}
|
|
3723
|
-
// onDateSelect={(selectedDate: any) => {
|
|
3724
|
-
// onValueChange(selectedDate.calendarDateString);
|
|
3725
|
-
// }}
|
|
3726
|
-
// disabled={disabled}
|
|
3727
|
-
// inputWidth={inputWidth}
|
|
3728
|
-
// required={this.field().required}
|
|
3729
|
-
// calendar="gregory"
|
|
3730
|
-
// locale="en-GB"
|
|
3731
|
-
// timeZone="Africa/Dar_es_Salaam"
|
|
3732
|
-
// />
|
|
3733
|
-
// );
|
|
3734
3705
|
|
|
3735
3706
|
const TableHeader = ({ columns, allSelected, onSelectAll, selectable, showActionButtons, }) => {
|
|
3736
3707
|
const handleCheckboxChange = () => {
|
|
@@ -4332,7 +4303,7 @@ const formatMultiTextOptionValue = (value, options = []) => {
|
|
|
4332
4303
|
return codes.map((code) => optionByCode.get(code)?.name || code).join(', ');
|
|
4333
4304
|
};
|
|
4334
4305
|
|
|
4335
|
-
const getTrackedEntityTableData = (response, programId, pager, metaData, searcheableDataElements, customDisplayInReportsIds, columnNameSource = 'NAME', columnMetadataDisplayMode) => {
|
|
4306
|
+
const getTrackedEntityTableData = (response, programId, pager, metaData, searcheableDataElements, customDisplayInReportsIds, columnNameSource = 'NAME', columnMetadataDisplayMode, orgUnitAndDateColumnsPosition = 'start') => {
|
|
4336
4307
|
const getColumnLabel = (item) => columnNameSource === 'FORM_NAME'
|
|
4337
4308
|
? item?.formName || item?.name || 'Default'
|
|
4338
4309
|
: item?.name || item?.formName || 'Default';
|
|
@@ -4411,7 +4382,7 @@ const getTrackedEntityTableData = (response, programId, pager, metaData, searche
|
|
|
4411
4382
|
color: option.style?.color,
|
|
4412
4383
|
})) ?? [],
|
|
4413
4384
|
}));
|
|
4414
|
-
const
|
|
4385
|
+
const orgUnitAndDateColumns = [
|
|
4415
4386
|
{
|
|
4416
4387
|
label: orgUnitLabel || 'Registering unit',
|
|
4417
4388
|
key: 'orgUnit',
|
|
@@ -4424,9 +4395,11 @@ const getTrackedEntityTableData = (response, programId, pager, metaData, searche
|
|
|
4424
4395
|
},
|
|
4425
4396
|
]
|
|
4426
4397
|
: []),
|
|
4427
|
-
...attributeColumns,
|
|
4428
|
-
...dataElementColumns,
|
|
4429
4398
|
];
|
|
4399
|
+
const entityColumns = [...attributeColumns, ...dataElementColumns];
|
|
4400
|
+
const tableColumns = orgUnitAndDateColumnsPosition === 'end'
|
|
4401
|
+
? [...entityColumns, ...orgUnitAndDateColumns]
|
|
4402
|
+
: [...orgUnitAndDateColumns, ...entityColumns];
|
|
4430
4403
|
const tableFilters = metaData.searchableTrackedEntityAttributes
|
|
4431
4404
|
.sort((a, b) => a.sortOrder - b.sortOrder)
|
|
4432
4405
|
.map((attr) => ({
|
|
@@ -4881,6 +4854,7 @@ const fetchLineListDownloadRows = async ({ d2, metaData, programId, programStage
|
|
|
4881
4854
|
class LineListTableComponent extends ReactWrapperModule {
|
|
4882
4855
|
constructor() {
|
|
4883
4856
|
super(...arguments);
|
|
4857
|
+
this.allowMultipleOrgUnits = false;
|
|
4884
4858
|
this.actionOptionOrientation = 'DROPDOWN';
|
|
4885
4859
|
this.dataQueryFilters = [];
|
|
4886
4860
|
this.hydrateForActionFiltering = true;
|
|
@@ -4897,6 +4871,7 @@ class LineListTableComponent extends ReactWrapperModule {
|
|
|
4897
4871
|
this.showDownloadButton = false;
|
|
4898
4872
|
this.searcheableDataElements = [];
|
|
4899
4873
|
this.columnNameSource = 'NAME';
|
|
4874
|
+
this.orgUnitAndDateColumnsPosition = 'start';
|
|
4900
4875
|
this.reactStateUpdaters = null;
|
|
4901
4876
|
this.setReactStateUpdaters = (updaters) => {
|
|
4902
4877
|
this.reactStateUpdaters = updaters;
|
|
@@ -4914,6 +4889,10 @@ class LineListTableComponent extends ReactWrapperModule {
|
|
|
4914
4889
|
const [triggerTokenState, setTriggerTokenState] = useState(this.triggerToken);
|
|
4915
4890
|
const [programIdState, setProgramIdState] = useState(this.programId);
|
|
4916
4891
|
const [isOptionSetNameVisibleState, setOptionSetNameVisible] = useState(this.isOptionSetNameVisible);
|
|
4892
|
+
const [chosenOrgUnits, setChosenOrgUnits] = useState([]);
|
|
4893
|
+
const defaultOrgUnitMode = (this.ouMode);
|
|
4894
|
+
const [orgUnitModeState, setOrgUnitModeState] = useState(defaultOrgUnitMode);
|
|
4895
|
+
const [tempOrgUnitModeState, setTempOrgUnitModeState] = useState(defaultOrgUnitMode);
|
|
4917
4896
|
const [orgUnitState, setOrgUnitState] = useState(this.orgUnit);
|
|
4918
4897
|
const [tempOrgUnitState, setTempOrgUnitState] = useState(this.orgUnit);
|
|
4919
4898
|
const [programStageIdState, setProgramStageIdState] = useState(this.programStageId);
|
|
@@ -4932,7 +4911,6 @@ class LineListTableComponent extends ReactWrapperModule {
|
|
|
4932
4911
|
const [orgUnitLabel, setOrgUnitLabel] = useState('');
|
|
4933
4912
|
const [selectedOrgUnit, setSelectedOrgUnit] = useState('');
|
|
4934
4913
|
const [prevSelectedOrgUnit, setPrevSelectedOrgUnit] = useState('');
|
|
4935
|
-
const [hide, setHide] = useState(true);
|
|
4936
4914
|
const [showAllFilters, setShowAllFilters] = useState(false);
|
|
4937
4915
|
const visibleFilters = showAllFilters
|
|
4938
4916
|
? filteredColumns ?? []
|
|
@@ -4947,7 +4925,6 @@ class LineListTableComponent extends ReactWrapperModule {
|
|
|
4947
4925
|
const [selectable, setSelectable] = useState(this.allowRowsSelection);
|
|
4948
4926
|
const [triggerRefetch, setTriggerRefetch] = useState(this.triggerRefetch);
|
|
4949
4927
|
const [showActionButtons, setShowActionButtons] = useState(this.showActionButtons);
|
|
4950
|
-
const [orgUnitModalVisible, setOrgUnitModalVisible] = useState(false);
|
|
4951
4928
|
const [error, setError] = useState(null);
|
|
4952
4929
|
const [prevInputValues, setPrevInputValues] = useState({});
|
|
4953
4930
|
const d2 = window.d2Web;
|
|
@@ -5009,7 +4986,7 @@ class LineListTableComponent extends ReactWrapperModule {
|
|
|
5009
4986
|
.setProgram(this.programId)
|
|
5010
4987
|
.setProgramStage(this.programStageId)
|
|
5011
4988
|
.setOrgUnit(orgUnitState)
|
|
5012
|
-
.setOuMode(
|
|
4989
|
+
.setOuMode(orgUnitModeState)
|
|
5013
4990
|
.setPagination(new Pager({
|
|
5014
4991
|
pageSize: pager.pageSize,
|
|
5015
4992
|
page: pager.page,
|
|
@@ -5071,7 +5048,7 @@ class LineListTableComponent extends ReactWrapperModule {
|
|
|
5071
5048
|
.setProgram(this.programId)
|
|
5072
5049
|
.setProgramStage(this.programStageId)
|
|
5073
5050
|
.setOrgUnit(orgUnitState)
|
|
5074
|
-
.setOuMode(
|
|
5051
|
+
.setOuMode(orgUnitModeState)
|
|
5075
5052
|
.setStatus(this.enrollmentStatus)
|
|
5076
5053
|
.setEventStatus(this.eventStatus?.status, this.eventStatus?.programStage)
|
|
5077
5054
|
.setFilters(dataQueryFiltersState)
|
|
@@ -5103,7 +5080,7 @@ class LineListTableComponent extends ReactWrapperModule {
|
|
|
5103
5080
|
pager: pager,
|
|
5104
5081
|
orgUnitsMap: fetchedOrgUnits,
|
|
5105
5082
|
};
|
|
5106
|
-
const { columns, data, filteredEntityColumns, orgUnitLabel } = getTrackedEntityTableData({ data: trackedEntityResponse }, this.programId, pager, metaData, this.searcheableDataElements, this.customDisplayInReportsIds, this.columnNameSource, this.columnMetadataDisplayMode);
|
|
5083
|
+
const { columns, data, filteredEntityColumns, orgUnitLabel } = getTrackedEntityTableData({ data: trackedEntityResponse }, this.programId, pager, metaData, this.searcheableDataElements, this.customDisplayInReportsIds, this.columnNameSource, this.columnMetadataDisplayMode, this.orgUnitAndDateColumnsPosition);
|
|
5107
5084
|
setFilteredColumns((prev) => filteredEntityColumns.length > 0 ? filteredEntityColumns : prev);
|
|
5108
5085
|
let updatedFilterableColumnIds;
|
|
5109
5086
|
if (Array.isArray(this.filterableColumnIds) &&
|
|
@@ -5139,6 +5116,7 @@ class LineListTableComponent extends ReactWrapperModule {
|
|
|
5139
5116
|
metaData,
|
|
5140
5117
|
programIdState,
|
|
5141
5118
|
orgUnitState,
|
|
5119
|
+
orgUnitModeState,
|
|
5142
5120
|
programStageIdState,
|
|
5143
5121
|
attributeFiltersState,
|
|
5144
5122
|
startDateState,
|
|
@@ -5160,7 +5138,7 @@ class LineListTableComponent extends ReactWrapperModule {
|
|
|
5160
5138
|
programId: programIdState,
|
|
5161
5139
|
programStageId: programStageIdState,
|
|
5162
5140
|
orgUnit: orgUnitState,
|
|
5163
|
-
ouMode:
|
|
5141
|
+
ouMode: orgUnitModeState,
|
|
5164
5142
|
startDate: startDateState,
|
|
5165
5143
|
endDate: endDateState,
|
|
5166
5144
|
dataQueryFilters: dataQueryFiltersState,
|
|
@@ -5311,7 +5289,16 @@ class LineListTableComponent extends ReactWrapperModule {
|
|
|
5311
5289
|
const handleAdditionalFilters = () => setDataQueryFiltersState(tempDataQueryFiltersState);
|
|
5312
5290
|
const handleStartDateFilter = () => setStartDateState(tempStartDateState);
|
|
5313
5291
|
const handleEndDateFilter = () => setEndDateState(tempEndDateState);
|
|
5314
|
-
const handleOrgUnitFilter = () =>
|
|
5292
|
+
const handleOrgUnitFilter = () => {
|
|
5293
|
+
setOrgUnitState(tempOrgUnitState);
|
|
5294
|
+
setOrgUnitModeState(tempOrgUnitModeState);
|
|
5295
|
+
setPager((previous) => new Pager({ ...previous, page: 1 }));
|
|
5296
|
+
};
|
|
5297
|
+
const handleOrgUnitModeReset = () => {
|
|
5298
|
+
setOrgUnitModeState(defaultOrgUnitMode);
|
|
5299
|
+
setTempOrgUnitModeState(defaultOrgUnitMode);
|
|
5300
|
+
setPager((previous) => new Pager({ ...previous, page: 1 }));
|
|
5301
|
+
};
|
|
5315
5302
|
function getTextColorFromBackGround(hex) {
|
|
5316
5303
|
hex = hex.replace('#', '');
|
|
5317
5304
|
const r = parseInt(hex.substr(0, 2), 16);
|
|
@@ -5355,59 +5342,61 @@ class LineListTableComponent extends ReactWrapperModule {
|
|
|
5355
5342
|
value: 'Download',
|
|
5356
5343
|
}, downloadLoading
|
|
5357
5344
|
? React__default.createElement(CircularLoader$1, { small: true })
|
|
5358
|
-
: 'Download')),
|
|
5359
|
-
React__default.createElement(OrgUnitSelector, {
|
|
5360
|
-
hide: hide,
|
|
5361
|
-
setHide: setHide,
|
|
5362
|
-
selectedOrgUnit: selectedOrgUnit,
|
|
5363
|
-
setSelectedOrgUnit: setSelectedOrgUnit,
|
|
5364
|
-
setOrgUnitState: setOrgUnitState,
|
|
5365
|
-
setTempOrgUnitState: setTempOrgUnitState,
|
|
5366
|
-
tempOrgUnitState: tempOrgUnitState,
|
|
5367
|
-
}), this.showFilters &&
|
|
5345
|
+
: 'Download')), this.showFilters &&
|
|
5368
5346
|
React__default.createElement(FilterToolbar, {
|
|
5369
|
-
|
|
5370
|
-
|
|
5371
|
-
|
|
5372
|
-
|
|
5373
|
-
|
|
5374
|
-
|
|
5375
|
-
|
|
5376
|
-
|
|
5377
|
-
|
|
5378
|
-
|
|
5379
|
-
|
|
5380
|
-
|
|
5381
|
-
|
|
5382
|
-
|
|
5383
|
-
|
|
5384
|
-
|
|
5385
|
-
|
|
5386
|
-
|
|
5387
|
-
|
|
5388
|
-
|
|
5389
|
-
|
|
5390
|
-
|
|
5391
|
-
|
|
5392
|
-
|
|
5393
|
-
|
|
5394
|
-
|
|
5395
|
-
|
|
5396
|
-
|
|
5397
|
-
|
|
5398
|
-
|
|
5399
|
-
|
|
5400
|
-
|
|
5401
|
-
|
|
5402
|
-
|
|
5403
|
-
|
|
5404
|
-
|
|
5405
|
-
|
|
5406
|
-
|
|
5407
|
-
|
|
5408
|
-
|
|
5409
|
-
|
|
5410
|
-
|
|
5347
|
+
orgUnit: {
|
|
5348
|
+
allowMultipleOrgUnits: this.allowMultipleOrgUnits,
|
|
5349
|
+
chosenOrgUnits,
|
|
5350
|
+
setChosenOrgUnits,
|
|
5351
|
+
customOrgUnitRoots: this.customOrgUnitRoots,
|
|
5352
|
+
orgUnitLabel,
|
|
5353
|
+
selectedOrgUnit,
|
|
5354
|
+
setSelectedOrgUnit,
|
|
5355
|
+
setOrgUnitState,
|
|
5356
|
+
defaultOrgUnit,
|
|
5357
|
+
setTempOrgUnitState,
|
|
5358
|
+
tempOrgUnitState,
|
|
5359
|
+
handleOrgUnitFilter,
|
|
5360
|
+
tempOrgUnitModeState,
|
|
5361
|
+
defaultOrgUnitMode,
|
|
5362
|
+
setTempOrgUnitModeState,
|
|
5363
|
+
handleOrgUnitModeReset,
|
|
5364
|
+
prevSelectedOrgUnit,
|
|
5365
|
+
setPrevSelectedOrgUnit,
|
|
5366
|
+
},
|
|
5367
|
+
dates: {
|
|
5368
|
+
startDateState,
|
|
5369
|
+
setStartDateState,
|
|
5370
|
+
endDateState,
|
|
5371
|
+
setEndDateState,
|
|
5372
|
+
setTempStartDateState,
|
|
5373
|
+
setTempEndDateState,
|
|
5374
|
+
tempStartDateState,
|
|
5375
|
+
tempEndDateState,
|
|
5376
|
+
showEnrollmentDates: this.showEnrollmentDates,
|
|
5377
|
+
handleStartDateFilter,
|
|
5378
|
+
handleEndDateFilter,
|
|
5379
|
+
},
|
|
5380
|
+
filters: {
|
|
5381
|
+
visibleFilters,
|
|
5382
|
+
dateStates,
|
|
5383
|
+
inputValues,
|
|
5384
|
+
setInputValues,
|
|
5385
|
+
handleInputChange,
|
|
5386
|
+
handleInputChangeForSelectField,
|
|
5387
|
+
handleDateSelect,
|
|
5388
|
+
showAllFilters,
|
|
5389
|
+
setShowAllFilters,
|
|
5390
|
+
dataQueryFiltersState,
|
|
5391
|
+
setDataQueryFiltersState,
|
|
5392
|
+
handleAdditionalFilters,
|
|
5393
|
+
setDateStates,
|
|
5394
|
+
prevInputValues,
|
|
5395
|
+
setPrevInputValues,
|
|
5396
|
+
setTempDataQueryFiltersState,
|
|
5397
|
+
prevDateStates,
|
|
5398
|
+
setPrevDateStates,
|
|
5399
|
+
},
|
|
5411
5400
|
}), React__default.createElement('div', { className: 'line-list-table-scroll' }, React__default.createElement(LineListTable, {
|
|
5412
5401
|
columns: columns,
|
|
5413
5402
|
data: data,
|
|
@@ -5471,7 +5460,7 @@ class LineListTableComponent extends ReactWrapperModule {
|
|
|
5471
5460
|
this.render();
|
|
5472
5461
|
}
|
|
5473
5462
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: LineListTableComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
5474
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.8", 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", columnMetadataDisplayMode: "columnMetadataDisplayMode" }, outputs: { actionSelected: "actionSelected", rowsSelected: "rowsSelected" }, usesInheritance: true, usesOnChanges: true, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, styles: ["@charset \"UTF-8\";::ng-deep .line-list-root{width:100%;max-width:100%;min-width:0}::ng-deep .line-list-download-toolbar{position:sticky;left:0;z-index:2;display:flex;justify-content:flex-end;width:100%;max-width:100%;box-sizing:border-box;background:#fff}::ng-deep .line-list-table-scroll{width:100%;max-width:100%;overflow-x:auto}::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"], changeDetection: i0.ChangeDetectionStrategy.Eager }); }
|
|
5463
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.8", type: LineListTableComponent, isStandalone: false, selector: "ng-dhis2-ui-line-list", inputs: { triggerToken: "triggerToken", programId: "programId", orgUnit: "orgUnit", allowMultipleOrgUnits: "allowMultipleOrgUnits", customOrgUnitRoots: "customOrgUnitRoots", 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", orgUnitAndDateColumnsPosition: "orgUnitAndDateColumnsPosition", customDisplayInReportsIds: "customDisplayInReportsIds", columnMetadataDisplayMode: "columnMetadataDisplayMode" }, outputs: { actionSelected: "actionSelected", rowsSelected: "rowsSelected" }, usesInheritance: true, usesOnChanges: true, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, styles: ["@charset \"UTF-8\";::ng-deep .line-list-root{width:100%;max-width:100%;min-width:0}::ng-deep .line-list-download-toolbar{position:sticky;left:0;z-index:2;display:flex;justify-content:flex-end;width:100%;max-width:100%;box-sizing:border-box;background:#fff}::ng-deep .line-list-table-scroll{width:100%;max-width:100%;overflow-x:auto}::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"], changeDetection: i0.ChangeDetectionStrategy.Eager }); }
|
|
5475
5464
|
}
|
|
5476
5465
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: LineListTableComponent, decorators: [{
|
|
5477
5466
|
type: Component,
|
|
@@ -5482,6 +5471,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
5482
5471
|
type: Input
|
|
5483
5472
|
}], orgUnit: [{
|
|
5484
5473
|
type: Input
|
|
5474
|
+
}], allowMultipleOrgUnits: [{
|
|
5475
|
+
type: Input
|
|
5476
|
+
}], customOrgUnitRoots: [{
|
|
5477
|
+
type: Input
|
|
5485
5478
|
}], programStageId: [{
|
|
5486
5479
|
type: Input
|
|
5487
5480
|
}], actionOptions: [{
|
|
@@ -5538,6 +5531,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
5538
5531
|
type: Input
|
|
5539
5532
|
}], columnNameSource: [{
|
|
5540
5533
|
type: Input
|
|
5534
|
+
}], orgUnitAndDateColumnsPosition: [{
|
|
5535
|
+
type: Input
|
|
5541
5536
|
}], customDisplayInReportsIds: [{
|
|
5542
5537
|
type: Input
|
|
5543
5538
|
}], columnMetadataDisplayMode: [{
|