@iapps/ng-dhis2-ui 1.2.80 → 1.2.81
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 +35 -11
- 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/line-list/containers/line-list.component.d.ts +1 -1
- package/lib/modules/program-entry-form/models/program-entry-form.config.d.ts +2 -0
- package/lib/modules/program-entry-form/program-entry-form.component.d.ts +3 -3
- package/lib/modules/program-entry-form/utils/program-entry-form-field.util.d.ts +1 -0
- package/package.json +1 -1
|
@@ -4102,7 +4102,7 @@ class LineListTableComponent extends ReactWrapperModule {
|
|
|
4102
4102
|
try {
|
|
4103
4103
|
const trackerResponse = (await d2.trackerModule.trackedEntity
|
|
4104
4104
|
.setProgram(this.programId)
|
|
4105
|
-
.getMetaData());
|
|
4105
|
+
.getMetaData({ skipProgramRules: true }));
|
|
4106
4106
|
const data = trackerResponse;
|
|
4107
4107
|
setMetaData(data);
|
|
4108
4108
|
}
|
|
@@ -4353,7 +4353,11 @@ class LineListTableComponent extends ReactWrapperModule {
|
|
|
4353
4353
|
React__default.createElement("div", { style: {
|
|
4354
4354
|
fontSize: 14,
|
|
4355
4355
|
} }, "Loading"))) : (React__default.createElement("div", null,
|
|
4356
|
-
this.showDownloadButton && (React__default.createElement("div", { style: {
|
|
4356
|
+
this.showDownloadButton && (React__default.createElement("div", { style: {
|
|
4357
|
+
paddingBottom: '1rem',
|
|
4358
|
+
display: 'flex',
|
|
4359
|
+
justifyContent: 'flex-end',
|
|
4360
|
+
} },
|
|
4357
4361
|
React__default.createElement(DropdownButton, { name: "Download", component: React__default.createElement("span", null,
|
|
4358
4362
|
' ',
|
|
4359
4363
|
React__default.createElement(MenuItem$1, { label: "Download Csv", onClick: handleCsvDownload }),
|
|
@@ -6079,6 +6083,13 @@ class BaseFormFieldComponent extends ReactWrapperModule {
|
|
|
6079
6083
|
}
|
|
6080
6084
|
return [];
|
|
6081
6085
|
}, [value]);
|
|
6086
|
+
const inputWidth = useMemo(() => {
|
|
6087
|
+
if (this.field().controlType === 'date' ||
|
|
6088
|
+
this.field().controlType === 'date-time') {
|
|
6089
|
+
return '360px';
|
|
6090
|
+
}
|
|
6091
|
+
return this.fieldConfig()?.inputWidth;
|
|
6092
|
+
}, []);
|
|
6082
6093
|
const { validationError, hasError } = useFieldValidation({
|
|
6083
6094
|
field: this.field(),
|
|
6084
6095
|
form: this.form(),
|
|
@@ -6229,7 +6240,7 @@ class BaseFormFieldComponent extends ReactWrapperModule {
|
|
|
6229
6240
|
setTouched(true);
|
|
6230
6241
|
}, extension: this.field()?.extension })));
|
|
6231
6242
|
default:
|
|
6232
|
-
return (React__default.createElement(InputField$1, { error: hasError, validationText: validationError, type: this.field().type, inputWidth:
|
|
6243
|
+
return (React__default.createElement(InputField$1, { error: hasError, validationText: validationError, type: this.field().type, inputWidth: inputWidth, required: this.field().required, name: this.field().id, label: this.label(), min: this.field().min?.toString(), max: this.field().max?.toString(), placeholder: this.placeholder(), value: value, readOnly: disabled, onChange: (event) => {
|
|
6233
6244
|
this.ngZone.run(() => {
|
|
6234
6245
|
(this.form().get(this.field().id) ||
|
|
6235
6246
|
this.form().get(this.field().key))?.setValue(event.value);
|
|
@@ -7541,6 +7552,11 @@ class ProgramEntryFormFieldUtil {
|
|
|
7541
7552
|
const options = FieldDropdown.getDropdownOptions(field);
|
|
7542
7553
|
const hasOptions = options?.length > 0;
|
|
7543
7554
|
const extension = this.config.formFieldExtensions?.find((fieldExtension) => fieldExtension?.id === field.id);
|
|
7555
|
+
const autoAssignedValue = this.#getAutoAssignedValue(field);
|
|
7556
|
+
if (!isUndefined(autoAssignedValue) &&
|
|
7557
|
+
this.config.hideCustomAssignedFields) {
|
|
7558
|
+
return null;
|
|
7559
|
+
}
|
|
7544
7560
|
return new FormField({
|
|
7545
7561
|
...field,
|
|
7546
7562
|
id: field.id,
|
|
@@ -7559,6 +7575,7 @@ class ProgramEntryFormFieldUtil {
|
|
|
7559
7575
|
extension,
|
|
7560
7576
|
});
|
|
7561
7577
|
})
|
|
7578
|
+
.filter((field) => field != null)
|
|
7562
7579
|
.sort((a, b) => a.order ?? 0 - (b.order ?? 0));
|
|
7563
7580
|
return [...this.reportFields, ...fields];
|
|
7564
7581
|
}
|
|
@@ -7568,12 +7585,16 @@ class ProgramEntryFormFieldUtil {
|
|
|
7568
7585
|
}
|
|
7569
7586
|
if (this.config.autoAssignedValues &&
|
|
7570
7587
|
this.config.autoAssignedValues.length > 0) {
|
|
7571
|
-
const
|
|
7572
|
-
const assignedValue = (this.config.autoAssignedValues || []).find((assignedValue) => assignedValue.field === key)?.value;
|
|
7588
|
+
const assignedValue = this.#getAutoAssignedValue(field);
|
|
7573
7589
|
return !isUndefined(assignedValue);
|
|
7574
7590
|
}
|
|
7575
7591
|
return false;
|
|
7576
7592
|
}
|
|
7593
|
+
#getAutoAssignedValue(field) {
|
|
7594
|
+
const key = field.code ? camelCase(field.code) : field.id;
|
|
7595
|
+
const assignedValue = (this.config.autoAssignedValues || []).find((assignedValue) => assignedValue.field === key)?.value;
|
|
7596
|
+
return assignedValue;
|
|
7597
|
+
}
|
|
7577
7598
|
}
|
|
7578
7599
|
|
|
7579
7600
|
// Copyright 2025 UDSM DHIS2 Lab. All rights reserved.
|
|
@@ -7894,14 +7915,17 @@ class ProgramEntryFormModule {
|
|
|
7894
7915
|
if (!this.trackedEntity()) {
|
|
7895
7916
|
return await this.instanceQuery.create();
|
|
7896
7917
|
}
|
|
7897
|
-
const
|
|
7918
|
+
const instanceResult = (await this.instanceQuery
|
|
7898
7919
|
.setTrackedEntity(this.trackedEntity())
|
|
7899
7920
|
.get()).data;
|
|
7900
|
-
if (!
|
|
7921
|
+
if (!instanceResult) {
|
|
7901
7922
|
return await this.instanceQuery.create();
|
|
7902
7923
|
}
|
|
7903
|
-
|
|
7904
|
-
|
|
7924
|
+
const instance = await this.instanceQuery
|
|
7925
|
+
.setInstanceFields(this.metaData()?.program)
|
|
7926
|
+
.setReservedValues();
|
|
7927
|
+
if (this.orgUnit()) {
|
|
7928
|
+
instance.setOrgUnit(this.orgUnit());
|
|
7905
7929
|
}
|
|
7906
7930
|
return instance;
|
|
7907
7931
|
}
|
|
@@ -7935,11 +7959,11 @@ class ProgramEntryFormModule {
|
|
|
7935
7959
|
}
|
|
7936
7960
|
}
|
|
7937
7961
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: ProgramEntryFormModule, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
7938
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.8", type: ProgramEntryFormModule, isStandalone: true, selector: "ng-dhis2-ui-program-entry-form", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null }, trackedEntity: { classPropertyName: "trackedEntity", publicName: "trackedEntity", isSignal: true, isRequired: false, transformFunction: null }, event: { classPropertyName: "event", publicName: "event", isSignal: true, isRequired: false, transformFunction: null }, enrollment: { classPropertyName: "enrollment", publicName: "enrollment", isSignal: true, isRequired: false, transformFunction: null }, orgUnit: { classPropertyName: "orgUnit", publicName: "orgUnit", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { instanceSave: "instanceSave", instanceSaveCompleted: "instanceSaveCompleted", instanceUpdate: "instanceUpdate", formValidityUpdate: "formValidityUpdate", formCancel: "formCancel" }, ngImport: i0, template: "@if (loading()) {\n<div className=\"program-entry__form-loader\">\n <ng-dhis2-ui-wrapper [component]=\"FormLoader\" />\n</div>\n} @else if(metaData()) {\n\n<div>\n <!-- Form content -->\n @switch (config().displayType) {\n\n <!-- Flat display -->\n @case ('FLAT') {\n\n <ng-dhis2-ui-flat-form\n [name]=\"metaData()!.name\"\n [dataValues]=\"instance()
|
|
7962
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.8", type: ProgramEntryFormModule, isStandalone: true, selector: "ng-dhis2-ui-program-entry-form", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null }, trackedEntity: { classPropertyName: "trackedEntity", publicName: "trackedEntity", isSignal: true, isRequired: false, transformFunction: null }, event: { classPropertyName: "event", publicName: "event", isSignal: true, isRequired: false, transformFunction: null }, enrollment: { classPropertyName: "enrollment", publicName: "enrollment", isSignal: true, isRequired: false, transformFunction: null }, orgUnit: { classPropertyName: "orgUnit", publicName: "orgUnit", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { instanceSave: "instanceSave", instanceSaveCompleted: "instanceSaveCompleted", instanceUpdate: "instanceUpdate", formValidityUpdate: "formValidityUpdate", formCancel: "formCancel" }, ngImport: i0, template: "@if (loading()) {\n<div className=\"program-entry__form-loader\">\n <ng-dhis2-ui-wrapper [component]=\"FormLoader\" />\n</div>\n} @else if(metaData()) {\n\n<div>\n <!-- Form content -->\n @switch (config().displayType) {\n\n <!-- Flat display -->\n @case ('FLAT') {\n\n <ng-dhis2-ui-flat-form\n [name]=\"metaData()!.name\"\n [dataValues]=\"instance() || {}\"\n [rules]=\"metaData()!.rules\"\n [fields]=\"metaData()!.formFields\"\n (formUpdate)=\"onFormUpdate($event)\"\n (formValidityUpdate)=\"onValidityUpdate($event)\"\n />\n }\n\n <!-- SECTION display -->\n @case ('SECTION') { Section form }\n\n <!-- CUSTOM FORM -->\n @case ('CUSTOM') { } }\n\n <!-- Action buttons -->\n\n @if(!config().hideActionButtons) {\n <ng-dhis2-ui-wrapper [component]=\"FormActionButtons()\" />\n }\n</div>\n}\n", styles: ["::ng-deep .program-entry__form-loader{padding:8px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: D2FormModule }, { kind: "component", type: FlatFormComponent, selector: "ng-dhis2-ui-flat-form" }, { kind: "directive", type: ReactWrapperModule, selector: "ng-dhis2-ui-wrapper", inputs: ["props", "component"] }] }); }
|
|
7939
7963
|
}
|
|
7940
7964
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: ProgramEntryFormModule, decorators: [{
|
|
7941
7965
|
type: Component,
|
|
7942
|
-
args: [{ selector: 'ng-dhis2-ui-program-entry-form', imports: [CommonModule, D2FormModule, ReactWrapperModule], template: "@if (loading()) {\n<div className=\"program-entry__form-loader\">\n <ng-dhis2-ui-wrapper [component]=\"FormLoader\" />\n</div>\n} @else if(metaData()) {\n\n<div>\n <!-- Form content -->\n @switch (config().displayType) {\n\n <!-- Flat display -->\n @case ('FLAT') {\n\n <ng-dhis2-ui-flat-form\n [name]=\"metaData()!.name\"\n [dataValues]=\"instance()
|
|
7966
|
+
args: [{ selector: 'ng-dhis2-ui-program-entry-form', imports: [CommonModule, D2FormModule, ReactWrapperModule], template: "@if (loading()) {\n<div className=\"program-entry__form-loader\">\n <ng-dhis2-ui-wrapper [component]=\"FormLoader\" />\n</div>\n} @else if(metaData()) {\n\n<div>\n <!-- Form content -->\n @switch (config().displayType) {\n\n <!-- Flat display -->\n @case ('FLAT') {\n\n <ng-dhis2-ui-flat-form\n [name]=\"metaData()!.name\"\n [dataValues]=\"instance() || {}\"\n [rules]=\"metaData()!.rules\"\n [fields]=\"metaData()!.formFields\"\n (formUpdate)=\"onFormUpdate($event)\"\n (formValidityUpdate)=\"onValidityUpdate($event)\"\n />\n }\n\n <!-- SECTION display -->\n @case ('SECTION') { Section form }\n\n <!-- CUSTOM FORM -->\n @case ('CUSTOM') { } }\n\n <!-- Action buttons -->\n\n @if(!config().hideActionButtons) {\n <ng-dhis2-ui-wrapper [component]=\"FormActionButtons()\" />\n }\n</div>\n}\n", styles: ["::ng-deep .program-entry__form-loader{padding:8px}\n"] }]
|
|
7943
7967
|
}], propDecorators: { instanceSave: [{
|
|
7944
7968
|
type: Output
|
|
7945
7969
|
}], instanceSaveCompleted: [{
|