@iapps/ng-dhis2-ui 1.1.54 → 1.1.56

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.
Files changed (38) hide show
  1. package/fesm2022/iapps-ng-dhis2-ui.mjs +874 -263
  2. package/fesm2022/iapps-ng-dhis2-ui.mjs.map +1 -1
  3. package/index.d.ts +2 -0
  4. package/lib/modules/event-form/event-form.component.d.ts +21 -0
  5. package/lib/modules/event-form/event-form.module.d.ts +9 -0
  6. package/lib/modules/event-form/index.d.ts +2 -0
  7. package/lib/modules/form/components/base-form-field.component.d.ts +8 -23
  8. package/lib/modules/form/containers/flat-form/flat-form.component.d.ts +11 -0
  9. package/lib/modules/form/containers/form/form.component.d.ts +14 -10
  10. package/lib/modules/form/containers/form-field/form-field.component.d.ts +10 -5
  11. package/lib/modules/form/containers/section-form/section-form.component.d.ts +1 -1
  12. package/lib/modules/form/form.module.d.ts +7 -6
  13. package/lib/modules/form/hooks/field-validation.hook.d.ts +2 -2
  14. package/lib/modules/form/index.d.ts +1 -0
  15. package/lib/modules/form/interfaces/form-field.interface.d.ts +4 -0
  16. package/lib/modules/form/models/form-field.model.d.ts +7 -1
  17. package/lib/modules/form/models/form-metadata-rule.model.d.ts +9 -2
  18. package/lib/modules/form/models/form-metadata-section.model.d.ts +2 -0
  19. package/lib/modules/form/models/form-metadata.model.d.ts +3 -3
  20. package/lib/modules/form/models/form-value.model.d.ts +4 -4
  21. package/lib/modules/form/shared/components/base-form-wrapper.component.d.ts +26 -0
  22. package/lib/modules/form/shared/components/index.d.ts +1 -0
  23. package/lib/modules/form/shared/index.d.ts +1 -0
  24. package/lib/modules/form/utils/field-type.util.d.ts +1 -1
  25. package/lib/modules/form/utils/field.util.d.ts +1 -1
  26. package/lib/modules/form/utils/form.util.d.ts +3 -2
  27. package/lib/modules/program-entry-form/index.d.ts +2 -0
  28. package/lib/modules/program-entry-form/models/index.d.ts +3 -0
  29. package/lib/modules/program-entry-form/models/program-entry-form-metadata.d.ts +28 -0
  30. package/lib/modules/program-entry-form/models/program-entry-form-section.model.d.ts +16 -0
  31. package/lib/modules/program-entry-form/models/program-entry-form.config.d.ts +47 -0
  32. package/lib/modules/program-entry-form/program-entry-form.component.d.ts +35 -0
  33. package/lib/modules/program-entry-form/utils/index.d.ts +2 -0
  34. package/lib/modules/program-entry-form/utils/program-entry-form-field.util.d.ts +62 -0
  35. package/lib/modules/program-entry-form/utils/program-entry-form-section.util.d.ts +8 -0
  36. package/lib/modules/tracker-form/tracker-form.component.d.ts +1 -0
  37. package/lib/shared/utils/predefinedDimensions.d.ts +6 -6
  38. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -9,3 +9,5 @@ export * from './lib/modules/data-table-ui';
9
9
  export * from './lib/modules/form';
10
10
  export * from './lib/modules/selection-filters-ui';
11
11
  export * from './lib/modules/tracker-form';
12
+ export * from './lib/modules/event-form';
13
+ export * from './lib/modules/program-entry-form';
@@ -0,0 +1,21 @@
1
+ import { OnInit } from '@angular/core';
2
+ import { BaseEventQuery, DHIS2Event } from '@iapps/d2-web-sdk';
3
+ import { IFormMetadata } from '../form';
4
+ import * as i0 from "@angular/core";
5
+ export declare class EventFormComponent implements OnInit {
6
+ program: import("@angular/core").InputSignal<string>;
7
+ programStage: import("@angular/core").InputSignal<string>;
8
+ eventId: import("@angular/core").InputSignal<string>;
9
+ enrollment: import("@angular/core").InputSignal<string>;
10
+ trackedEntity: import("@angular/core").InputSignal<string>;
11
+ d2: import("@iapps/d2-web-sdk").D2Web;
12
+ eventQuery: BaseEventQuery<DHIS2Event>;
13
+ formMetaData: IFormMetadata;
14
+ instance: DHIS2Event;
15
+ ngOnInit(): Promise<void>;
16
+ onFormUpdate(values: any): void;
17
+ onSave(event: any): void;
18
+ onCancel(): void;
19
+ static ɵfac: i0.ɵɵFactoryDeclaration<EventFormComponent, never>;
20
+ static ɵcmp: i0.ɵɵComponentDeclaration<EventFormComponent, "ng-dhis2-ui-event-form", never, { "program": { "alias": "program"; "required": true; "isSignal": true; }; "programStage": { "alias": "programStage"; "required": true; "isSignal": true; }; "eventId": { "alias": "eventId"; "required": false; "isSignal": true; }; "enrollment": { "alias": "enrollment"; "required": false; "isSignal": true; }; "trackedEntity": { "alias": "trackedEntity"; "required": false; "isSignal": true; }; }, {}, never, never, false, never>;
21
+ }
@@ -0,0 +1,9 @@
1
+ import * as i0 from "@angular/core";
2
+ import * as i1 from "./event-form.component";
3
+ import * as i2 from "@angular/common";
4
+ import * as i3 from "../form/form.module";
5
+ export declare class EventFormModule {
6
+ static ɵfac: i0.ɵɵFactoryDeclaration<EventFormModule, never>;
7
+ static ɵmod: i0.ɵɵNgModuleDeclaration<EventFormModule, [typeof i1.EventFormComponent], [typeof i2.CommonModule, typeof i3.D2FormModule], [typeof i1.EventFormComponent]>;
8
+ static ɵinj: i0.ɵɵInjectorDeclaration<EventFormModule>;
9
+ }
@@ -0,0 +1,2 @@
1
+ export * from './event-form.module';
2
+ export * from './event-form.component';
@@ -1,32 +1,24 @@
1
1
  import { EventEmitter, NgZone, OnChanges, Signal, SimpleChanges } from '@angular/core';
2
2
  import { FormGroup } from '@angular/forms';
3
+ import { NgxDhis2HttpClientService } from '@iapps/ngx-dhis2-http-client';
3
4
  import React from 'react';
4
5
  import { ReactWrapperModule } from '../../react-wrapper/react-wrapper.component';
5
- import { FieldConfig, FormField } from '../models';
6
- import { OrganisationUnitSelectionConfig } from '../../organisation-unit-selector';
7
- import { Observable } from 'rxjs';
8
- import { NgxDhis2HttpClientService } from '@iapps/ngx-dhis2-http-client';
6
+ import { IFormField } from '../interfaces';
7
+ import { FieldConfig } from '../models';
9
8
  import * as i0 from "@angular/core";
10
9
  export declare class BaseFormFieldComponent extends ReactWrapperModule implements OnChanges {
11
10
  #private;
12
11
  ngZone: NgZone;
13
12
  httpClient: NgxDhis2HttpClientService;
14
13
  fieldType: string;
15
- field: import("@angular/core").InputSignal<FormField<string>>;
14
+ field: import("@angular/core").InputSignal<IFormField<string>>;
16
15
  fieldConfig: import("@angular/core").InputSignal<FieldConfig>;
17
16
  form: import("@angular/core").ModelSignal<FormGroup<any>>;
18
17
  isValid: import("@angular/core").InputSignal<boolean>;
19
- uploadedFiles: any;
18
+ isValueAssigned: import("@angular/core").InputSignal<boolean>;
20
19
  value: import("@angular/core").ModelSignal<string>;
21
- protected value$: Observable<string>;
22
- FieldOrgUnitSelector: (props: {
23
- selectedOrgUnits: any;
24
- onSelectOrgUnit: (selectedOrgUnits: any) => void;
25
- }) => React.JSX.Element;
26
- showOrgUnitTree: import("@angular/core").WritableSignal<boolean>;
27
- orgUnitSelectionConfig: OrganisationUnitSelectionConfig;
28
- selectedOrgUnit: import("@angular/core").WritableSignal<any>;
29
- selectedOrgUnit$: Observable<any>;
20
+ protected value$: import("rxjs").Observable<string>;
21
+ protected isValueAssigned$: import("rxjs").Observable<boolean>;
30
22
  label: Signal<string | undefined>;
31
23
  placeholder: Signal<string>;
32
24
  InputField: () => React.JSX.Element;
@@ -41,13 +33,6 @@ export declare class BaseFormFieldComponent extends ReactWrapperModule implement
41
33
  ngAfterViewInit(): Promise<void>;
42
34
  ngOnChanges(changes: SimpleChanges): void;
43
35
  onChange(event: any): void;
44
- onSelectOrgUnit(selectedOrgUnits: Record<string, string>[]): void;
45
- onCancelOrgUnit(): void;
46
- private getAppConfig;
47
- getOrgUnitAttributeByUsage(usageType: string): "organisationUnits" | "dataViewOrganisationUnits";
48
- getRootOrgUnits(): Observable<string[]>;
49
- getOrgUnitGroups(): Promise<any>;
50
- getOrgUnitLevels(): Promise<any>;
51
36
  static ɵfac: i0.ɵɵFactoryDeclaration<BaseFormFieldComponent, never>;
52
- static ɵdir: i0.ɵɵDirectiveDeclaration<BaseFormFieldComponent, never, never, { "field": { "alias": "field"; "required": true; "isSignal": true; }; "fieldConfig": { "alias": "fieldConfig"; "required": false; "isSignal": true; }; "form": { "alias": "form"; "required": true; "isSignal": true; }; "isValid": { "alias": "isValid"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; }, { "form": "formChange"; "value": "valueChange"; "update": "update"; "immediateUpdate": "immediateUpdate"; }, never, never, true, never>;
37
+ static ɵdir: i0.ɵɵDirectiveDeclaration<BaseFormFieldComponent, never, never, { "field": { "alias": "field"; "required": true; "isSignal": true; }; "fieldConfig": { "alias": "fieldConfig"; "required": false; "isSignal": true; }; "form": { "alias": "form"; "required": true; "isSignal": true; }; "isValid": { "alias": "isValid"; "required": false; "isSignal": true; }; "isValueAssigned": { "alias": "isValueAssigned"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; }, { "form": "formChange"; "value": "valueChange"; "update": "update"; "immediateUpdate": "immediateUpdate"; }, never, never, true, never>;
53
38
  }
@@ -0,0 +1,11 @@
1
+ import { OnInit } from '@angular/core';
2
+ import { FormGroup } from '@angular/forms';
3
+ import { BaseFormWrapperComponent } from '../../shared';
4
+ import * as i0 from "@angular/core";
5
+ export declare class FlatFormComponent extends BaseFormWrapperComponent implements OnInit {
6
+ formGroup: FormGroup;
7
+ ngOnInit(): void;
8
+ onFormUpdate(): void;
9
+ static ɵfac: i0.ɵɵFactoryDeclaration<FlatFormComponent, never>;
10
+ static ɵcmp: i0.ɵɵComponentDeclaration<FlatFormComponent, "ng-dhis2-ui-flat-form", never, {}, {}, never, never, false, never>;
11
+ }
@@ -1,32 +1,36 @@
1
- import { EventEmitter, OnChanges } from '@angular/core';
1
+ import { EffectRef, EventEmitter, OnChanges, OnDestroy, SimpleChanges } from '@angular/core';
2
2
  import { FormGroup } from '@angular/forms';
3
- import { FieldsData, FormConfig, FormField } from '../../models';
3
+ import { FieldsData, FormConfig, IMetadataRuleAction } from '../../models';
4
4
  import { FormFieldComponent } from '../form-field/form-field.component';
5
+ import { IFormField } from '../../interfaces';
5
6
  import * as i0 from "@angular/core";
6
- export declare class FormComponent implements OnChanges {
7
+ export declare class FormComponent implements OnChanges, OnDestroy {
8
+ #private;
7
9
  formConfig: import("@angular/core").InputSignal<FormConfig>;
8
- fields: FormField<string>[];
10
+ fields: IFormField<string>[];
9
11
  form: FormGroup;
10
12
  isFormHorizontal: boolean;
11
13
  showSaveButton: boolean;
12
14
  fieldsData: FieldsData;
13
15
  fieldClass: string;
14
16
  shouldRenderAsCheckBoxesButton: boolean;
15
- programRuleActions: any[];
17
+ programRuleActions: import("@angular/core").InputSignal<IMetadataRuleAction[]>;
16
18
  dataEntities: any;
17
19
  configuration: import("@angular/core").Signal<FormConfig>;
18
20
  formUpdate: EventEmitter<any>;
19
21
  fieldComponents: FormFieldComponent[];
20
22
  values: any;
21
- get sanitizedFields(): FormField<string>[];
23
+ get sanitizedFields(): IFormField<string>[];
22
24
  get layoutCssClass(): string;
23
- onUpdateFields(programRuleActions: any): void;
24
- ngOnChanges(): void;
25
+ ruleProcessor: EffectRef;
26
+ constructor();
27
+ ngOnChanges(changes: SimpleChanges): void;
25
28
  onSubmit(): void;
26
- onFieldUpdate(form: FormGroup, field: FormField<string>): void;
29
+ onFieldUpdate(form: FormGroup, field: IFormField<string>): void;
27
30
  onClear(): void;
28
31
  isFormInValid(): boolean;
29
32
  onRunTimeOptionUpdate(result: any): void;
33
+ ngOnDestroy(): void;
30
34
  static ɵfac: i0.ɵɵFactoryDeclaration<FormComponent, never>;
31
- static ɵcmp: i0.ɵɵComponentDeclaration<FormComponent, "ng-dhis2-ui-form", never, { "formConfig": { "alias": "formConfig"; "required": false; "isSignal": true; }; "fields": { "alias": "fields"; "required": false; }; "form": { "alias": "form"; "required": false; }; "isFormHorizontal": { "alias": "isFormHorizontal"; "required": false; }; "showSaveButton": { "alias": "showSaveButton"; "required": false; }; "fieldsData": { "alias": "fieldsData"; "required": false; }; "fieldClass": { "alias": "fieldClass"; "required": false; }; "shouldRenderAsCheckBoxesButton": { "alias": "shouldRenderAsCheckBoxesButton"; "required": false; }; "programRuleActions": { "alias": "programRuleActions"; "required": false; }; "dataEntities": { "alias": "dataEntities"; "required": false; }; }, { "formUpdate": "formUpdate"; }, never, never, false, never>;
35
+ static ɵcmp: i0.ɵɵComponentDeclaration<FormComponent, "ng-dhis2-ui-form", never, { "formConfig": { "alias": "formConfig"; "required": false; "isSignal": true; }; "fields": { "alias": "fields"; "required": false; }; "form": { "alias": "form"; "required": false; }; "isFormHorizontal": { "alias": "isFormHorizontal"; "required": false; }; "showSaveButton": { "alias": "showSaveButton"; "required": false; }; "fieldsData": { "alias": "fieldsData"; "required": false; }; "fieldClass": { "alias": "fieldClass"; "required": false; }; "shouldRenderAsCheckBoxesButton": { "alias": "shouldRenderAsCheckBoxesButton"; "required": false; }; "programRuleActions": { "alias": "programRuleActions"; "required": false; "isSignal": true; }; "dataEntities": { "alias": "dataEntities"; "required": false; }; }, { "formUpdate": "formUpdate"; }, never, never, false, never>;
32
36
  }
@@ -1,15 +1,17 @@
1
- import { EventEmitter, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core';
1
+ import { EffectRef, EventEmitter, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core';
2
2
  import { FormControl, FormGroup } from '@angular/forms';
3
3
  import { Subject } from 'rxjs';
4
- import { FieldConfig, FormField } from '../../models';
4
+ import { FieldConfig, IMetadataRuleAction } from '../../models';
5
+ import { IFormField } from '../../interfaces';
5
6
  import * as i0 from "@angular/core";
6
7
  export declare class FormFieldComponent implements OnInit, OnChanges, OnDestroy {
7
- field: import("@angular/core").InputSignal<FormField<string>>;
8
+ #private;
9
+ field: import("@angular/core").InputSignal<IFormField<string>>;
8
10
  fieldConfig: FieldConfig;
9
11
  form: FormGroup;
10
12
  isCheckBoxButton: boolean;
11
13
  fieldClass: string;
12
- programRuleActions: any[];
14
+ programRuleActions: import("@angular/core").InputSignal<IMetadataRuleAction[]>;
13
15
  dataEntities: any;
14
16
  minDate: any;
15
17
  maxDate: Date;
@@ -25,6 +27,9 @@ export declare class FormFieldComponent implements OnInit, OnChanges, OnDestroy
25
27
  fieldFilterControl: FormControl;
26
28
  protected _onDestroy: Subject<void>;
27
29
  optionSearchTerm: string;
30
+ isValueAssigned: import("@angular/core").WritableSignal<boolean>;
31
+ ruleProcessor: EffectRef;
32
+ constructor();
28
33
  ngOnChanges(changes: SimpleChanges): void;
29
34
  ngOnInit(): void;
30
35
  ngOnDestroy(): void;
@@ -46,5 +51,5 @@ export declare class FormFieldComponent implements OnInit, OnChanges, OnDestroy
46
51
  onFieldUpdate(e?: any, isDate?: boolean, isDateTime?: boolean): void;
47
52
  onUpdateRuntimeOptions(options: any[]): void;
48
53
  static ɵfac: i0.ɵɵFactoryDeclaration<FormFieldComponent, never>;
49
- static ɵcmp: i0.ɵɵComponentDeclaration<FormFieldComponent, "ng-dhis2-ui-form-field", never, { "field": { "alias": "field"; "required": true; "isSignal": true; }; "fieldConfig": { "alias": "fieldConfig"; "required": false; }; "form": { "alias": "form"; "required": false; }; "isCheckBoxButton": { "alias": "isCheckBoxButton"; "required": false; }; "fieldClass": { "alias": "fieldClass"; "required": false; }; "programRuleActions": { "alias": "programRuleActions"; "required": false; }; "dataEntities": { "alias": "dataEntities"; "required": false; }; "minDate": { "alias": "minDate"; "required": false; }; "maxDate": { "alias": "maxDate"; "required": false; }; }, { "fieldUpdate": "fieldUpdate"; "immediateFieldUpdate": "immediateFieldUpdate"; "runtimeOptionChange": "runtimeOptionChange"; }, never, never, false, never>;
54
+ static ɵcmp: i0.ɵɵComponentDeclaration<FormFieldComponent, "ng-dhis2-ui-form-field", never, { "field": { "alias": "field"; "required": true; "isSignal": true; }; "fieldConfig": { "alias": "fieldConfig"; "required": false; }; "form": { "alias": "form"; "required": false; }; "isCheckBoxButton": { "alias": "isCheckBoxButton"; "required": false; }; "fieldClass": { "alias": "fieldClass"; "required": false; }; "programRuleActions": { "alias": "programRuleActions"; "required": false; "isSignal": true; }; "dataEntities": { "alias": "dataEntities"; "required": false; }; "minDate": { "alias": "minDate"; "required": false; }; "maxDate": { "alias": "maxDate"; "required": false; }; }, { "fieldUpdate": "fieldUpdate"; "immediateFieldUpdate": "immediateFieldUpdate"; "runtimeOptionChange": "runtimeOptionChange"; }, never, never, false, never>;
50
55
  }
@@ -14,7 +14,7 @@ export declare class SectionFormComponent implements OnInit {
14
14
  formGroups: Record<string, FormGroup>;
15
15
  formValueEntity: Record<string, FormValue>;
16
16
  repeatableFormValueEntity: Record<string, Record<number, FormValue>>;
17
- ruleActions: Record<string, unknown>[];
17
+ ruleActions: import("@angular/core").WritableSignal<any[]>;
18
18
  save: EventEmitter<Record<string, unknown>>;
19
19
  formUpdate: EventEmitter<Record<string, unknown>>;
20
20
  cancel: EventEmitter<any>;
@@ -3,13 +3,14 @@ import * as i1 from "./containers/form-field/form-field.component";
3
3
  import * as i2 from "./containers/form/form.component";
4
4
  import * as i3 from "./containers/repeatable-form/repeatable-form.component";
5
5
  import * as i4 from "./containers/section-form/section-form.component";
6
- import * as i5 from "./components/form-field-item.component";
7
- import * as i6 from "@angular/common";
8
- import * as i7 from "@angular/forms";
9
- import * as i8 from "../react-wrapper/react-wrapper.component.tsx";
10
- import * as i9 from "../organisation-unit-selector/organisation-unit-selector.module";
6
+ import * as i5 from "./containers/flat-form/flat-form.component";
7
+ import * as i6 from "./components/form-field-item.component";
8
+ import * as i7 from "@angular/common";
9
+ import * as i8 from "@angular/forms";
10
+ import * as i9 from "../react-wrapper/react-wrapper.component.tsx";
11
+ import * as i10 from "../organisation-unit-selector/organisation-unit-selector.module";
11
12
  export declare class D2FormModule {
12
13
  static ɵfac: i0.ɵɵFactoryDeclaration<D2FormModule, never>;
13
- static ɵmod: i0.ɵɵNgModuleDeclaration<D2FormModule, [typeof i1.FormFieldComponent, typeof i2.FormComponent, typeof i3.RepeatableFormComponent, typeof i4.SectionFormComponent, typeof i5.FormFieldItemComponent], [typeof i6.CommonModule, typeof i7.ReactiveFormsModule, typeof i8.ReactWrapperModule, typeof i9.OrganisationUnitSelectorModule], [typeof i1.FormFieldComponent, typeof i2.FormComponent, typeof i3.RepeatableFormComponent, typeof i4.SectionFormComponent]>;
14
+ static ɵmod: i0.ɵɵNgModuleDeclaration<D2FormModule, [typeof i1.FormFieldComponent, typeof i2.FormComponent, typeof i3.RepeatableFormComponent, typeof i4.SectionFormComponent, typeof i5.FlatFormComponent, typeof i6.FormFieldItemComponent], [typeof i7.CommonModule, typeof i8.ReactiveFormsModule, typeof i9.ReactWrapperModule, typeof i10.OrganisationUnitSelectorModule], [typeof i1.FormFieldComponent, typeof i2.FormComponent, typeof i3.RepeatableFormComponent, typeof i4.SectionFormComponent, typeof i5.FlatFormComponent]>;
14
15
  static ɵinj: i0.ɵɵInjectorDeclaration<D2FormModule>;
15
16
  }
@@ -1,8 +1,8 @@
1
1
  import { FormGroup } from '@angular/forms';
2
- import { FormField } from '../models';
2
+ import { IFormField } from '../interfaces';
3
3
  export declare const useFieldValidation: (props: {
4
4
  form: FormGroup;
5
- field: FormField<string>;
5
+ field: IFormField<string>;
6
6
  touched: boolean;
7
7
  value: string;
8
8
  }) => {
@@ -3,6 +3,7 @@ export * from './containers/form-field/form-field.component';
3
3
  export * from './containers/form/form.component';
4
4
  export * from './containers/repeatable-form/repeatable-form.component';
5
5
  export * from './containers/section-form/section-form.component';
6
+ export * from './containers/flat-form/flat-form.component';
6
7
  export * from './models';
7
8
  export * from './interfaces';
8
9
  export * from './utils';
@@ -20,6 +20,7 @@ export interface IFormField<T> {
20
20
  maxLength?: number | string;
21
21
  hidden: boolean;
22
22
  units?: string;
23
+ generated?: boolean;
23
24
  isDataElement?: boolean;
24
25
  isAttribute?: boolean;
25
26
  isOrgUnit?: boolean;
@@ -37,4 +38,7 @@ export interface IFormField<T> {
37
38
  unique?: boolean;
38
39
  metaType?: FormFieldMetaType;
39
40
  stepId?: string;
41
+ availableOptionsLabel?: string;
42
+ selectedOptionsLabel?: string;
43
+ allowFutureDate?: boolean;
40
44
  }
@@ -1,5 +1,8 @@
1
1
  import { FieldControlType, FormFieldMetaType, IFormField, IFieldDropdown } from '../interfaces';
2
- export declare class FormField<T> implements IFormField<T> {
2
+ interface FormFieldFunction<T> {
3
+ setMax: (field: Partial<IFormField<T>>) => string | number | Date | undefined;
4
+ }
5
+ export declare class FormField<T> implements IFormField<T>, FormFieldFunction<T> {
3
6
  value?: T | '';
4
7
  id: string;
5
8
  code?: string;
@@ -38,5 +41,8 @@ export declare class FormField<T> implements IFormField<T> {
38
41
  stepId?: string;
39
42
  availableOptionsLabel?: string;
40
43
  selectedOptionsLabel?: string;
44
+ allowFutureDate?: boolean;
41
45
  constructor(options?: Partial<FormField<T>>);
46
+ setMax(field: Partial<FormField<T>>): string | number | Date | undefined;
42
47
  }
48
+ export {};
@@ -1,16 +1,23 @@
1
- import { ProgramRule, ProgramRuleAction, ProgramRuleVariable } from '@iapps/d2-web-sdk';
1
+ import { Option, ProgramRule, ProgramRuleAction, ProgramRuleVariable } from '@iapps/d2-web-sdk';
2
2
  interface JsonTransformer<T> {
3
3
  toJson: () => T;
4
4
  }
5
5
  export interface IMetadataRuleAction {
6
6
  field: string;
7
7
  actionType: string;
8
+ assignedData?: string;
9
+ displayedContent?: string;
10
+ options?: Partial<Option>[];
8
11
  }
9
12
  export declare class MetadataRuleAction implements IMetadataRuleAction, JsonTransformer<IMetadataRuleAction> {
10
13
  private ruleAction;
11
- constructor(ruleAction: ProgramRuleAction);
14
+ private ruleVariables;
15
+ constructor(ruleAction: ProgramRuleAction, ruleVariables: ProgramRuleVariable[]);
12
16
  get field(): string;
13
17
  get actionType(): string;
18
+ get assignedData(): string | undefined;
19
+ get displayedContent(): string | undefined;
20
+ get options(): Partial<Option>[] | undefined;
14
21
  toJson(): IMetadataRuleAction;
15
22
  }
16
23
  export interface IMetadataRule {
@@ -16,10 +16,12 @@ export declare class FormMetadataSection implements IFormMetadataSection {
16
16
  formName: unknown;
17
17
  sortOrder: unknown;
18
18
  mandatory: unknown;
19
+ allowFutureDate: unknown;
19
20
  metaType: string;
20
21
  }[];
21
22
  get dataElements(): {
22
23
  mandatory: unknown;
24
+ allowFutureDate: unknown;
23
25
  stepId: unknown;
24
26
  metaType: string;
25
27
  }[];
@@ -1,7 +1,6 @@
1
1
  import { IMetadataRule } from './form-metadata-rule.model';
2
- import { FormField } from './form-field.model';
3
2
  import { Program } from '@iapps/d2-web-sdk';
4
- import { IFormMetadata, IFormMetadataSection } from '../interfaces';
3
+ import { IFormField, IFormMetadata, IFormMetadataSection } from '../interfaces';
5
4
  export declare class FormMetaData implements IFormMetadata {
6
5
  #private;
7
6
  private params;
@@ -14,11 +13,12 @@ export declare class FormMetaData implements IFormMetadata {
14
13
  locale?: string;
15
14
  splitRegistrationSection?: boolean;
16
15
  includeAllProgramStages?: boolean;
16
+ disableEnrollmentDate?: boolean;
17
17
  programStage?: string;
18
18
  customFormMetaData?: Partial<FormMetaData>;
19
19
  });
20
20
  get sections(): IFormMetadataSection[];
21
- get fields(): FormField<string>[];
21
+ get fields(): IFormField<string>[];
22
22
  get rules(): IMetadataRule[];
23
23
  toJson(): IFormMetadata;
24
24
  }
@@ -1,10 +1,10 @@
1
1
  import { FormGroup } from '@angular/forms';
2
- import { FormField } from './form-field.model';
2
+ import { IFormField } from '../interfaces';
3
3
  export declare class FormValue {
4
4
  form: FormGroup;
5
- fields: FormField<string>[];
6
- changedField?: FormField<string>;
7
- constructor(form: FormGroup, fields: FormField<string>[], changedField?: FormField<string>);
5
+ fields: IFormField<string>[];
6
+ changedField?: IFormField<string>;
7
+ constructor(form: FormGroup, fields: IFormField<string>[], changedField?: IFormField<string>);
8
8
  get isValid(): boolean;
9
9
  clear(): void;
10
10
  getValues(options?: {
@@ -0,0 +1,26 @@
1
+ import { EffectRef, EventEmitter, NgZone, OnDestroy } from '@angular/core';
2
+ import { IFormField } from '../../interfaces';
3
+ import { IMetadataRule, IMetadataRuleAction } from '../../models';
4
+ import * as i0 from "@angular/core";
5
+ export declare class BaseFormWrapperComponent implements OnDestroy {
6
+ #private;
7
+ ngZone: NgZone;
8
+ name: import("@angular/core").InputSignal<string>;
9
+ fields: import("@angular/core").InputSignal<IFormField<string>[]>;
10
+ rules: import("@angular/core").InputSignal<IMetadataRule[]>;
11
+ dataValues: import("@angular/core").InputSignal<Record<string, unknown>>;
12
+ ruleActions: import("@angular/core").WritableSignal<IMetadataRuleAction[]>;
13
+ isFormValid: import("@angular/core").WritableSignal<boolean>;
14
+ formSave: EventEmitter<Record<string, unknown>>;
15
+ formUpdate: EventEmitter<Record<string, unknown>>;
16
+ formCancel: EventEmitter<void>;
17
+ formValidityUpdate: EventEmitter<boolean>;
18
+ ruleProcessor: EffectRef;
19
+ constructor();
20
+ updateDataValues(dataValues: Record<string, unknown>): void;
21
+ updateFormValidity(isFormValid: boolean): void;
22
+ protected executeRules(): void;
23
+ ngOnDestroy(): void;
24
+ static ɵfac: i0.ɵɵFactoryDeclaration<BaseFormWrapperComponent, never>;
25
+ static ɵdir: i0.ɵɵDirectiveDeclaration<BaseFormWrapperComponent, never, never, { "name": { "alias": "name"; "required": false; "isSignal": true; }; "fields": { "alias": "fields"; "required": true; "isSignal": true; }; "rules": { "alias": "rules"; "required": false; "isSignal": true; }; "dataValues": { "alias": "dataValues"; "required": false; "isSignal": true; }; }, { "formSave": "formSave"; "formUpdate": "formUpdate"; "formCancel": "formCancel"; "formValidityUpdate": "formValidityUpdate"; }, never, never, true, never>;
26
+ }
@@ -0,0 +1 @@
1
+ export * from './base-form-wrapper.component';
@@ -0,0 +1 @@
1
+ export * from './components';
@@ -1,3 +1,3 @@
1
1
  export declare class FormFieldTypeUtil {
2
- static getFieldType(valueType: string): "file" | "image" | "org-unit" | "number" | "text";
2
+ static getFieldType(valueType: string): "number" | "text" | "image" | "org-unit" | "file";
3
3
  }
@@ -3,7 +3,7 @@ import { DropdownOption } from '../models';
3
3
  export declare class FieldUtil {
4
4
  static getFieldDropdownOptions(field: any): DropdownOption[];
5
5
  static sanitizeOptions(options: any[]): any;
6
- static getFieldType(valueType: string): "file" | "date" | "org-unit" | "number" | "tel" | "text";
6
+ static getFieldType(valueType: string): "number" | "text" | "tel" | "date" | "org-unit" | "file";
7
7
  static getFieldControlType(valueType: string, hasOptions: boolean): FieldControlType;
8
8
  static getOptionEntities?(options: any[]): any;
9
9
  }
@@ -1,8 +1,9 @@
1
1
  import { UntypedFormGroup } from '@angular/forms';
2
2
  import { FormField } from '../models';
3
+ import { IFormField } from '../interfaces';
3
4
  export declare class FormUtil {
4
- static getFormGroup(fields: FormField<string>[], dataEntities: any): UntypedFormGroup;
5
- static getFieldValue(field: FormField<string>, dataEntities: Record<string, any>): any;
5
+ static getFormGroup(fields: IFormField<string>[], dataEntities: any): UntypedFormGroup;
6
+ static getFieldValue(field: IFormField<string>, dataEntities: Record<string, any>): any;
6
7
  static getFormFields(fields: any[]): FormField<string>[];
7
8
  static createField(id: string, label: string, required: boolean, controlType: 'textbox' | 'dropdown' | 'textarea' | 'transfer' | 'search' | 'file', disabled?: boolean, placeholder?: string, options?: Array<any>): FormField<string>;
8
9
  }
@@ -0,0 +1,2 @@
1
+ export * from './models';
2
+ export * from './program-entry-form.component';
@@ -0,0 +1,3 @@
1
+ export * from './program-entry-form.config';
2
+ export * from './program-entry-form-metadata';
3
+ export * from './program-entry-form-section.model';
@@ -0,0 +1,28 @@
1
+ import { Program } from '@iapps/d2-web-sdk';
2
+ import { ProgramEntryFormConfig } from './program-entry-form.config';
3
+ import { IFormField, IMetadataRule } from '../../form';
4
+ import { IProgramEntryFormSection } from './program-entry-form-section.model';
5
+ export interface IProgramEntryFormMetaData {
6
+ id: string;
7
+ name: string;
8
+ description?: string;
9
+ formFields: IFormField<string>[];
10
+ sections: IProgramEntryFormSection[];
11
+ rules: IMetadataRule[];
12
+ }
13
+ export declare class ProgramEntryFormMetaData implements IProgramEntryFormMetaData {
14
+ #private;
15
+ id: string;
16
+ name: string;
17
+ description?: string;
18
+ d2: import("@iapps/d2-web-sdk").D2Web;
19
+ config: ProgramEntryFormConfig;
20
+ metaData: Program;
21
+ setConfig(config: ProgramEntryFormConfig): ProgramEntryFormMetaData;
22
+ getProgramPromise(): Promise<import("@iapps/d2-web-sdk").D2Response<Program>>;
23
+ get formFields(): IFormField<string>[];
24
+ get sections(): IProgramEntryFormSection[];
25
+ get rules(): IMetadataRule[];
26
+ toJson(): IProgramEntryFormMetaData;
27
+ get(): Promise<IProgramEntryFormMetaData>;
28
+ }
@@ -0,0 +1,16 @@
1
+ import { IFormField } from '../../form';
2
+ export interface IProgramEntryFormSection {
3
+ id: string;
4
+ name: string;
5
+ description?: string;
6
+ formFields: IFormField<string>[];
7
+ orientation: 'HORIZONTAL' | 'VERTICAL';
8
+ }
9
+ export declare class ProgramEntryFormSection implements IProgramEntryFormSection {
10
+ id: string;
11
+ name: string;
12
+ description?: string;
13
+ formFields: IFormField<string>[];
14
+ orientation: 'HORIZONTAL' | 'VERTICAL';
15
+ constructor(props: IProgramEntryFormSection);
16
+ }
@@ -0,0 +1,47 @@
1
+ export type AutoAssignedValues = {
2
+ field: string;
3
+ value: string;
4
+ };
5
+ export interface IProgramEntryFormConfig {
6
+ program: string;
7
+ programStage?: string;
8
+ displayType: 'FLAT' | 'SECTION' | 'CUSTOM';
9
+ formType: 'TRACKER' | 'EVENT';
10
+ hideRegistrationUnit?: boolean;
11
+ hideEnrollmentDate?: boolean;
12
+ hideTrackedEntityTypeAttributes?: boolean;
13
+ disableRegistrationUnit?: boolean;
14
+ disableEnrollmentDate?: boolean;
15
+ disabledIncidentDate?: boolean;
16
+ excludeProgramStages?: boolean;
17
+ includedProgramStages?: string[];
18
+ submitButtonLabel?: string;
19
+ cancelButtonLabel?: string;
20
+ hideActionButtons?: boolean;
21
+ hideSubmitButton?: boolean;
22
+ hideCancelButton?: boolean;
23
+ ignoreRepeatability?: boolean;
24
+ autoAssignedValues?: AutoAssignedValues[];
25
+ }
26
+ export declare class ProgramEntryFormConfig implements IProgramEntryFormConfig {
27
+ program: string;
28
+ programStage?: string;
29
+ displayType: 'FLAT' | 'SECTION' | 'CUSTOM';
30
+ formType: 'TRACKER' | 'EVENT';
31
+ hideRegistrationUnit?: boolean;
32
+ hideEnrollmentDate?: boolean;
33
+ hideTrackedEntityTypeAttributes?: boolean;
34
+ disableRegistrationUnit?: boolean;
35
+ disableEnrollmentDate?: boolean;
36
+ disabledIncidentDate?: boolean;
37
+ excludeProgramStages?: boolean;
38
+ includedProgramStages?: string[];
39
+ submitButtonLabel: string;
40
+ cancelButtonLabel: string;
41
+ hideActionButtons?: boolean;
42
+ hideSubmitButton?: boolean;
43
+ hideCancelButton?: boolean;
44
+ ignoreRepeatability?: boolean;
45
+ autoAssignedValues?: AutoAssignedValues[];
46
+ constructor(config: IProgramEntryFormConfig);
47
+ }
@@ -0,0 +1,35 @@
1
+ import { EventEmitter, NgZone } from '@angular/core';
2
+ import { IProgramEntryFormMetaData, ProgramEntryFormConfig } from './models';
3
+ import React from 'react';
4
+ import { Observable } from 'rxjs';
5
+ import { BaseEventQuery, BaseTrackerQuery, D2EventResponse, D2TrackerResponse, DHIS2Event, TrackedEntityInstance } from '@iapps/d2-web-sdk';
6
+ import * as i0 from "@angular/core";
7
+ export declare class ProgramEntryFormModule {
8
+ #private;
9
+ config: import("@angular/core").InputSignal<ProgramEntryFormConfig>;
10
+ trackedEntity: import("@angular/core").InputSignal<string>;
11
+ event: import("@angular/core").InputSignal<string>;
12
+ enrollment: import("@angular/core").InputSignal<string>;
13
+ orgUnit: import("@angular/core").InputSignal<string>;
14
+ ngZone: NgZone;
15
+ d2: import("@iapps/d2-web-sdk").D2Web;
16
+ loading: import("@angular/core").WritableSignal<boolean>;
17
+ metaData: import("@angular/core").WritableSignal<IProgramEntryFormMetaData>;
18
+ isFormValid: import("@angular/core").WritableSignal<boolean>;
19
+ isFormValid$: Observable<boolean>;
20
+ instance: import("@angular/core").WritableSignal<TrackedEntityInstance | DHIS2Event>;
21
+ instanceQuery: BaseTrackerQuery<TrackedEntityInstance> | BaseEventQuery<DHIS2Event>;
22
+ instanceSave: EventEmitter<TrackedEntityInstance | DHIS2Event>;
23
+ instanceSaveCompleted: EventEmitter<D2TrackerResponse<TrackedEntityInstance> | D2EventResponse<DHIS2Event>>;
24
+ instanceUpdate: EventEmitter<TrackedEntityInstance | DHIS2Event>;
25
+ formValidityUpdate: EventEmitter<boolean>;
26
+ formCancel: EventEmitter<any>;
27
+ FormLoader: () => React.JSX.Element;
28
+ FormActionButtons: import("@angular/core").Signal<React.JSX.Element | (() => React.JSX.Element)>;
29
+ ngOnInit(): Promise<void>;
30
+ onFormUpdate(dataValues: Record<string, unknown>): void;
31
+ onValidityUpdate(isFormValid: boolean): void;
32
+ onCancel(): void;
33
+ static ɵfac: i0.ɵɵFactoryDeclaration<ProgramEntryFormModule, never>;
34
+ static ɵcmp: i0.ɵɵComponentDeclaration<ProgramEntryFormModule, "ng-dhis2-ui-program-entry-form", never, { "config": { "alias": "config"; "required": true; "isSignal": true; }; "trackedEntity": { "alias": "trackedEntity"; "required": false; "isSignal": true; }; "event": { "alias": "event"; "required": false; "isSignal": true; }; "enrollment": { "alias": "enrollment"; "required": false; "isSignal": true; }; "orgUnit": { "alias": "orgUnit"; "required": false; "isSignal": true; }; }, { "instanceSave": "instanceSave"; "instanceSaveCompleted": "instanceSaveCompleted"; "instanceUpdate": "instanceUpdate"; "formValidityUpdate": "formValidityUpdate"; "formCancel": "formCancel"; }, never, never, true, never>;
35
+ }
@@ -0,0 +1,2 @@
1
+ export * from './program-entry-form-field.util';
2
+ export * from './program-entry-form-section.util';