@iapps/ng-dhis2-ui 1.1.8 → 1.1.10
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 +34 -25
- package/fesm2022/iapps-ng-dhis2-ui.mjs.map +1 -1
- package/lib/modules/form/utils/field-type.util.d.ts +1 -1
- package/lib/modules/form/utils/field.util.d.ts +1 -1
- package/lib/modules/selection-filters-ui/containers/selection-filters-ui/selection-filters-ui.component.d.ts +6 -5
- package/lib/modules/selection-filters-ui/models/selection-filters-ui.model.d.ts +30 -14
- package/package.json +1 -1
- package/lib/modules/selection-filters-ui/models/selection-filters-ui.models.d.ts +0 -10
|
@@ -5400,8 +5400,8 @@ class SelectionFiltersComponent extends ReactWrapperModule {
|
|
|
5400
5400
|
constructor() {
|
|
5401
5401
|
super(...arguments);
|
|
5402
5402
|
this.actionOptions = [];
|
|
5403
|
-
this.
|
|
5404
|
-
this.
|
|
5403
|
+
this.programAttributesFilters = [];
|
|
5404
|
+
this.programStageDataElementFilters = [];
|
|
5405
5405
|
this.actionSelected = new EventEmitter();
|
|
5406
5406
|
this.httpClient = inject(NgxDhis2HttpClientService);
|
|
5407
5407
|
this.ngZone = inject(NgZone);
|
|
@@ -5446,11 +5446,12 @@ class SelectionFiltersComponent extends ReactWrapperModule {
|
|
|
5446
5446
|
this.selectedOrgUnit$ = toObservable(this.selectedOrgUnit);
|
|
5447
5447
|
this.SelectionFiltersUI = () => {
|
|
5448
5448
|
const [filters, setFilters] = useState({
|
|
5449
|
-
|
|
5450
|
-
|
|
5451
|
-
organizationUnitId: '',
|
|
5449
|
+
programAttributesFilters: this.programAttributesFilters || [],
|
|
5450
|
+
programStageDataElementFilters: this.programStageDataElementFilters || [],
|
|
5452
5451
|
startDate: this.startDate || '',
|
|
5453
5452
|
endDate: this.endDate || '',
|
|
5453
|
+
program: this.program || '',
|
|
5454
|
+
organisationUnit: this.organisationUnit || '',
|
|
5454
5455
|
});
|
|
5455
5456
|
const [displayValue, setDisplayValue] = useState(null);
|
|
5456
5457
|
const [selected, setSelected] = useState();
|
|
@@ -5460,49 +5461,53 @@ class SelectionFiltersComponent extends ReactWrapperModule {
|
|
|
5460
5461
|
const [value, setValue] = useState(null);
|
|
5461
5462
|
useEffect(() => {
|
|
5462
5463
|
setFilters({
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
organizationUnitId: '',
|
|
5464
|
+
programAttributesFilters: this.programAttributesFilters,
|
|
5465
|
+
programStageDataElementFilters: this.programStageDataElementFilters,
|
|
5466
5466
|
startDate: this.startDate || '',
|
|
5467
5467
|
endDate: this.endDate || '',
|
|
5468
|
+
program: this.program || '',
|
|
5469
|
+
organisationUnit: this.organisationUnit || filters.organisationUnit,
|
|
5468
5470
|
});
|
|
5469
5471
|
}, [
|
|
5470
|
-
this.
|
|
5471
|
-
this.
|
|
5472
|
+
this.programAttributesFilters,
|
|
5473
|
+
this.programStageDataElementFilters,
|
|
5472
5474
|
this.startDate,
|
|
5473
5475
|
this.endDate,
|
|
5474
5476
|
]);
|
|
5475
5477
|
const handleAttributeChange = (index, selectedValue) => {
|
|
5476
5478
|
setFilters((prevFilters) => {
|
|
5477
|
-
const updatedFilters = [...prevFilters.
|
|
5479
|
+
const updatedFilters = [...prevFilters.programAttributesFilters];
|
|
5478
5480
|
updatedFilters[index] = {
|
|
5479
5481
|
...updatedFilters[index],
|
|
5480
5482
|
value: selectedValue,
|
|
5481
5483
|
};
|
|
5482
|
-
return { ...prevFilters,
|
|
5484
|
+
return { ...prevFilters, programAttributesFilters: updatedFilters };
|
|
5483
5485
|
});
|
|
5484
5486
|
};
|
|
5485
5487
|
const handleDataElementChange = (index, selectedValue) => {
|
|
5486
5488
|
setFilters((prevFilters) => {
|
|
5487
|
-
const updatedFilters = [...prevFilters.
|
|
5489
|
+
const updatedFilters = [...prevFilters.programStageDataElementFilters];
|
|
5488
5490
|
updatedFilters[index] = {
|
|
5489
5491
|
...updatedFilters[index],
|
|
5490
5492
|
value: selectedValue,
|
|
5491
5493
|
};
|
|
5492
|
-
return {
|
|
5494
|
+
return {
|
|
5495
|
+
...prevFilters,
|
|
5496
|
+
programStageDataElementFilters: updatedFilters,
|
|
5497
|
+
};
|
|
5493
5498
|
});
|
|
5494
5499
|
};
|
|
5495
5500
|
const handleSearch = () => {
|
|
5496
5501
|
this.actionSelected.emit({
|
|
5497
5502
|
...filters,
|
|
5498
|
-
|
|
5499
|
-
organizationUnitId: selectedOrganisationUnit,
|
|
5503
|
+
organisationUnit: selectedOrganisationUnit,
|
|
5500
5504
|
startDate: filters.startDate,
|
|
5501
5505
|
endDate: filters.endDate,
|
|
5506
|
+
program: this.program,
|
|
5502
5507
|
});
|
|
5503
5508
|
};
|
|
5504
5509
|
const getAttributeColumnSpan = (index) => {
|
|
5505
|
-
const totalItems = filters.
|
|
5510
|
+
const totalItems = filters.programAttributesFilters.length;
|
|
5506
5511
|
if (totalItems <= 4) {
|
|
5507
5512
|
if (totalItems === 1) {
|
|
5508
5513
|
return 'span 4';
|
|
@@ -5532,7 +5537,7 @@ class SelectionFiltersComponent extends ReactWrapperModule {
|
|
|
5532
5537
|
return 'span 1';
|
|
5533
5538
|
};
|
|
5534
5539
|
const getDataElementColumnSpan = (index) => {
|
|
5535
|
-
const totalItems = filters.
|
|
5540
|
+
const totalItems = filters.programStageDataElementFilters.length;
|
|
5536
5541
|
if (totalItems <= 4) {
|
|
5537
5542
|
if (totalItems === 1) {
|
|
5538
5543
|
return 'span 4';
|
|
@@ -5605,18 +5610,18 @@ class SelectionFiltersComponent extends ReactWrapperModule {
|
|
|
5605
5610
|
// });
|
|
5606
5611
|
}
|
|
5607
5612
|
} }))),
|
|
5608
|
-
React__default.createElement(InputField$1, { className: "input-field", label: "Start Date", type: "
|
|
5609
|
-
React__default.createElement(InputField$1, { className: "input-field", label: "End Date", type: "
|
|
5613
|
+
React__default.createElement(InputField$1, { className: "input-field", label: "Start Date", type: "DATE", value: filters.startDate, onChange: (event) => setFilters({ ...filters, startDate: event.value }) }),
|
|
5614
|
+
React__default.createElement(InputField$1, { className: "input-field", label: "End Date", type: "DATE", value: filters.endDate, onChange: (event) => setFilters({ ...filters, endDate: event.value }) })),
|
|
5610
5615
|
React__default.createElement("div", { style: {
|
|
5611
5616
|
display: 'grid',
|
|
5612
5617
|
gridTemplateColumns: 'repeat(4, 1fr)',
|
|
5613
5618
|
gap: '16px',
|
|
5614
|
-
} }, filters.
|
|
5619
|
+
} }, filters.programAttributesFilters.map((filter, index) => (React__default.createElement("div", { key: index, style: { gridColumn: getAttributeColumnSpan(index) } }, filter.hasOptions && filter.options.length > 0 ? (React__default.createElement(SingleSelectField, { className: "single-select", label: filter.name || 'Select Option', type: filter.valueType, selected: filter.value, onChange: (event) => handleAttributeChange(index, event.selected) }, filter.options.map((option, i) => (React__default.createElement(SingleSelectOption, { key: i, label: option.name, value: option.code }))))) : (React__default.createElement(InputField$1, { className: "input-field", label: filter.name || 'Program name', type: filter.valueType, value: filter.value, onChange: (event) => handleAttributeChange(index, event.value) })))))),
|
|
5615
5620
|
React__default.createElement("div", { style: {
|
|
5616
5621
|
display: 'grid',
|
|
5617
5622
|
gridTemplateColumns: 'repeat(4, 1fr)',
|
|
5618
5623
|
gap: '16px',
|
|
5619
|
-
} }, filters.
|
|
5624
|
+
} }, filters.programStageDataElementFilters.map((filter, index) => (React__default.createElement("div", { key: index, style: { gridColumn: getDataElementColumnSpan(index) } }, filter.hasOptions && filter.options.length > 0 ? (React__default.createElement(SingleSelectField, { className: "single-select", label: filter.name || 'Aggregation type', type: filter.valueType, selected: filter.value, onChange: (event) => handleDataElementChange(index, event.selected) }, filter.options.map((option, i) => (React__default.createElement(SingleSelectOption, { key: i, label: option.name, value: option.code }))))) : (React__default.createElement(InputField$1, { className: "input-field", type: filter.valueType, label: filter.name || 'Program name', value: filter.value, onChange: (event) => handleDataElementChange(index, event.value) })))))),
|
|
5620
5625
|
React__default.createElement("div", { style: { textAlign: 'right', marginTop: '16px' } },
|
|
5621
5626
|
React__default.createElement(Button$1, { onClick: handleSearch }, "Search"))));
|
|
5622
5627
|
};
|
|
@@ -5672,21 +5677,25 @@ class SelectionFiltersComponent extends ReactWrapperModule {
|
|
|
5672
5677
|
this.render();
|
|
5673
5678
|
}
|
|
5674
5679
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: SelectionFiltersComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
5675
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.8", type: SelectionFiltersComponent, isStandalone: false, selector: "app-selection-filters-ui", inputs: { actionOptions: "actionOptions",
|
|
5680
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.8", type: SelectionFiltersComponent, isStandalone: false, selector: "app-selection-filters-ui", inputs: { actionOptions: "actionOptions", programAttributesFilters: "programAttributesFilters", programStageDataElementFilters: "programStageDataElementFilters", startDate: "startDate", endDate: "endDate", program: "program", organisationUnit: "organisationUnit" }, outputs: { actionSelected: "actionSelected" }, usesInheritance: true, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, styles: [".react-filters-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:20px;margin-bottom:20px}.input-field,.single-select{width:100%}\n"] }); }
|
|
5676
5681
|
}
|
|
5677
5682
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: SelectionFiltersComponent, decorators: [{
|
|
5678
5683
|
type: Component,
|
|
5679
5684
|
args: [{ selector: 'app-selection-filters-ui', template: '<ng-content></ng-content>', standalone: false, styles: [".react-filters-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:20px;margin-bottom:20px}.input-field,.single-select{width:100%}\n"] }]
|
|
5680
5685
|
}], propDecorators: { actionOptions: [{
|
|
5681
5686
|
type: Input
|
|
5682
|
-
}],
|
|
5687
|
+
}], programAttributesFilters: [{
|
|
5683
5688
|
type: Input
|
|
5684
|
-
}],
|
|
5689
|
+
}], programStageDataElementFilters: [{
|
|
5685
5690
|
type: Input
|
|
5686
5691
|
}], startDate: [{
|
|
5687
5692
|
type: Input
|
|
5688
5693
|
}], endDate: [{
|
|
5689
5694
|
type: Input
|
|
5695
|
+
}], program: [{
|
|
5696
|
+
type: Input
|
|
5697
|
+
}], organisationUnit: [{
|
|
5698
|
+
type: Input
|
|
5690
5699
|
}], actionSelected: [{
|
|
5691
5700
|
type: Output
|
|
5692
5701
|
}] } });
|