@iapps/ng-dhis2-ui 1.2.80 → 1.2.82

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.
@@ -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: { paddingBottom: '1rem', display: 'flex', justifyContent: 'flex-end' } },
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: this.fieldConfig()?.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) => {
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);
@@ -6551,10 +6562,6 @@ class FormComponent {
6551
6562
  this.#processRules(this.programRuleActions());
6552
6563
  });
6553
6564
  }
6554
- ngOnInit() {
6555
- this.values = this.form.getRawValue();
6556
- this.formUpdate.emit(new FormValue(this.form, this.fields));
6557
- }
6558
6565
  ngOnChanges(changes) {
6559
6566
  this.values = this.form.getRawValue();
6560
6567
  }
@@ -6888,6 +6895,7 @@ class FlatFormComponent extends BaseFormWrapperComponent {
6888
6895
  this.onFormUpdate();
6889
6896
  }
6890
6897
  onFormUpdate() {
6898
+ console.log('WE ARE UPDATING HERE');
6891
6899
  this.updateDataValues(this.formGroup.getRawValue());
6892
6900
  this.updateFormValidity(this.formGroup.valid);
6893
6901
  }
@@ -7541,6 +7549,11 @@ class ProgramEntryFormFieldUtil {
7541
7549
  const options = FieldDropdown.getDropdownOptions(field);
7542
7550
  const hasOptions = options?.length > 0;
7543
7551
  const extension = this.config.formFieldExtensions?.find((fieldExtension) => fieldExtension?.id === field.id);
7552
+ const autoAssignedValue = this.#getAutoAssignedValue(field);
7553
+ if (!isUndefined(autoAssignedValue) &&
7554
+ this.config.hideCustomAssignedFields) {
7555
+ return null;
7556
+ }
7544
7557
  return new FormField({
7545
7558
  ...field,
7546
7559
  id: field.id,
@@ -7559,6 +7572,7 @@ class ProgramEntryFormFieldUtil {
7559
7572
  extension,
7560
7573
  });
7561
7574
  })
7575
+ .filter((field) => field != null)
7562
7576
  .sort((a, b) => a.order ?? 0 - (b.order ?? 0));
7563
7577
  return [...this.reportFields, ...fields];
7564
7578
  }
@@ -7568,12 +7582,16 @@ class ProgramEntryFormFieldUtil {
7568
7582
  }
7569
7583
  if (this.config.autoAssignedValues &&
7570
7584
  this.config.autoAssignedValues.length > 0) {
7571
- const key = field.code ? camelCase(field.code) : field.id;
7572
- const assignedValue = (this.config.autoAssignedValues || []).find((assignedValue) => assignedValue.field === key)?.value;
7585
+ const assignedValue = this.#getAutoAssignedValue(field);
7573
7586
  return !isUndefined(assignedValue);
7574
7587
  }
7575
7588
  return false;
7576
7589
  }
7590
+ #getAutoAssignedValue(field) {
7591
+ const key = field.code ? camelCase(field.code) : field.id;
7592
+ const assignedValue = (this.config.autoAssignedValues || []).find((assignedValue) => assignedValue.field === key)?.value;
7593
+ return assignedValue;
7594
+ }
7577
7595
  }
7578
7596
 
7579
7597
  // Copyright 2025 UDSM DHIS2 Lab. All rights reserved.
@@ -7894,14 +7912,17 @@ class ProgramEntryFormModule {
7894
7912
  if (!this.trackedEntity()) {
7895
7913
  return await this.instanceQuery.create();
7896
7914
  }
7897
- const instance = (await this.instanceQuery
7915
+ const instanceResult = (await this.instanceQuery
7898
7916
  .setTrackedEntity(this.trackedEntity())
7899
7917
  .get()).data;
7900
- if (!instance) {
7918
+ if (!instanceResult) {
7901
7919
  return await this.instanceQuery.create();
7902
7920
  }
7903
- if (this.metaData()?.program) {
7904
- instance.setFields(this.metaData().program);
7921
+ const instance = await this.instanceQuery
7922
+ .setInstanceFields(this.metaData()?.program)
7923
+ .setReservedValues();
7924
+ if (this.orgUnit()) {
7925
+ instance.setOrgUnit(this.orgUnit());
7905
7926
  }
7906
7927
  return instance;
7907
7928
  }
@@ -7935,11 +7956,11 @@ class ProgramEntryFormModule {
7935
7956
  }
7936
7957
  }
7937
7958
  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()!\"\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"] }] }); }
7959
+ 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
7960
  }
7940
7961
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: ProgramEntryFormModule, decorators: [{
7941
7962
  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()!\"\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"] }]
7963
+ 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
7964
  }], propDecorators: { instanceSave: [{
7944
7965
  type: Output
7945
7966
  }], instanceSaveCompleted: [{