@@ -7,10 +7,27 @@ import type {
77 RenderType ,
88 RequiredFieldProps ,
99 FormReference ,
10+ OpenmrsEncounter ,
11+ OpenmrsObs ,
12+ SessionMode ,
13+ PostSubmissionAction ,
14+ FormSchema ,
15+ FormPage ,
16+ FormSection ,
17+ FormQuestionOptions ,
18+ QuestionAnswerOption ,
19+ HideProps ,
20+ DisableProps ,
21+ RepeatOptions ,
1022} from '@openmrs/esm-form-engine-lib' ;
1123import type { AuditInfo } from './components/audit-details/audit-details.component' ;
1224import type { questionTypes } from '@constants' ;
1325
26+ // Extend FormSchema to include description property
27+ export interface FormBuilderSchema extends FormSchema {
28+ description ?: string ;
29+ }
30+
1431export interface Form {
1532 uuid : string ;
1633 name : string ;
@@ -50,116 +67,33 @@ export type QuestionType = (typeof questionTypes)[number];
5067
5168export type DatePickerType = 'both' | 'calendar' | 'timer' ;
5269
53- export interface Schema {
54- name : string ;
55- pages : Array < {
56- label : string ;
57- sections : Array < {
58- label : string ;
59- isExpanded : string ;
60- reference ?: FormReference ;
61- questions : Array < {
62- id : string ;
63- label ?: string ;
64- value ?: string ;
65- type : string ;
66- required ?: string | boolean | RequiredFieldProps ;
67- questionInfo ?: string ;
68- questionOptions : {
69- type ?: string ;
70- concept ?: string ;
71- answers ?: Array < Record < string , string > > ;
72- rendering : RenderType ;
73- max ?: string ;
74- min ?: string ;
75- conceptMappings ?: Array < Record < string , string > > ;
76- } ;
77- questions ?: Array < Question > ;
78- validators ?: Array < Record < string , string > > ;
79- } > ;
80- } > ;
81- } > ;
82- processor : string ;
83- uuid : string ;
84- encounterType : string ;
85- referencedForms : Array < ReferencedForm > ;
86- version ?: string ;
87- description ?: string ;
88- encounter ?: string | OpenmrsEncounter ;
89- allowUnspecifiedAll ?: boolean ;
90- defaultPage ?: string ;
91- readonly ?: string | boolean ;
92- inlineRendering ?: 'single-line' | 'multiline' | 'automatic' ;
93- markdown ?: unknown ;
94- postSubmissionActions ?: Array < { actionId : string ; config ?: Record < string , unknown > } > ;
95- formOptions ?: {
96- usePreviousValueDisabled : boolean ;
97- } ;
98- translations ?: Record < string , string > ;
99- }
70+ // Using extended FormBuilderSchema instead of FormSchema
71+ export type Schema = FormBuilderSchema ;
10072
10173export interface SchemaContextType {
10274 schema : Schema ;
10375 setSchema : ( schema : Schema ) => void ;
10476}
10577
106- export interface Page {
107- label : string ;
108- sections : Array < Section > ;
109- }
78+ // Using FormPage from form-engine-lib instead of local Page
79+ export type Page = FormPage ;
80+ // Export FormPage as well for direct imports
81+ export { FormPage } ;
11082
111- export interface Section {
112- label : string ;
113- questions : Array < Question > ;
114- isExpanded : string | boolean ;
115- }
83+ // Using FormSection from form-engine-lib instead of local Section
84+ export type Section = FormSection ;
85+ // Export FormSection as well for direct imports
86+ export { FormSection } ;
11687
117- export interface Question {
118- id : string ;
119- label ?: string ;
120- value ?: any ;
121- type : string ;
122- questionOptions : QuestionOptions ;
123- datePickerFormat ?: DatePickerType ;
124- questions ?: Array < Question > ;
125- required ?: string | boolean | RequiredFieldProps ;
126- validators ?: Array < Record < string , string > > ;
127- questionInfo ?: string ;
128- }
88+ // Using FormField from form-engine-lib instead of local Question
89+ export type Question = FormField ;
90+ // Export FormField as well for direct imports
91+ export { FormField } ;
12992
130- export interface QuestionOptions {
131- rendering : RenderType ;
132- answers ?: Array < Record < string , string > > ;
133- concept ?: string ;
134- conceptMappings ?: Array < ConceptMapping > ;
135- max ?: string ;
136- min ?: string ;
137- isSearchable ?: boolean ;
138- attributeType ?: string ;
139- calculate ?: {
140- calculateExpression : string ;
141- } ;
142- rows ?: number ;
143- orderSettingUuid ?: string ;
144- orderType ?: string ;
145- identifierType ?: string ;
146- selectableOrders ?: Array <
147- | {
148- concept : string ;
149- label : string ;
150- }
151- | Record < string , any >
152- > ;
153- weekList ?: [ ] ;
154- showComment ?: boolean ;
155- showDate ?: string ;
156- programUuid ?: string ;
157- workflowUuid ?: string ;
158- toggleOptions ?: {
159- labelTrue : string ;
160- labelFalse : string ;
161- } ;
162- }
93+ // Using FormQuestionOptions from form-engine-lib instead of local QuestionOptions
94+ export type QuestionOptions = FormQuestionOptions ;
95+ // Export FormQuestionOptions as well for direct imports
96+ export { FormQuestionOptions } ;
16397
16498export interface Answer {
16599 concept : string ;
@@ -208,53 +142,24 @@ export interface PersonAttributeType {
208142 } ;
209143}
210144
211- export interface OpenmrsEncounter {
212- uuid ?: string ;
213- encounterDatetime ?: string | Date ;
214- patient ?: OpenmrsResource | string ;
215- location ?: OpenmrsResource | string ;
216- encounterType ?: OpenmrsResource | string ;
217- obs ?: Array < OpenmrsObs > ;
218- orders ?: Array < OpenmrsResource > ;
219- voided ?: boolean ;
220- visit ?: OpenmrsResource | string ;
221- // eslint-disable-next-line @typescript-eslint/no-explicit-any
222- encounterProviders ?: Array < Record < string , any > > ;
223- form ?: OpenmrsFormResource ;
224- }
225-
226- export type SessionMode = 'edit' | 'enter' | 'view' | 'embedded-view' ;
227-
228- export interface PostSubmissionAction {
229- applyAction (
230- formSession : {
231- patient : fhir . Patient ;
232- encounters : Array < OpenmrsEncounter > ;
233- sessionMode : SessionMode ;
234- } ,
235- config ?: Record < string , unknown > ,
236- enabled ?: string ,
237- ) : void ;
238- }
239-
240- export interface OpenmrsObs extends OpenmrsResource {
241- // eslint-disable-next-line @typescript-eslint/no-explicit-any
242- concept ?: any ;
243- obsDatetime ?: string | Date ;
244- obsGroup ?: OpenmrsObs ;
245- groupMembers ?: Array < OpenmrsObs > ;
246- comment ?: string ;
247- location ?: OpenmrsResource ;
248- order ?: OpenmrsResource ;
249- encounter ?: OpenmrsResource ;
250- voided ?: boolean ;
251- // eslint-disable-next-line @typescript-eslint/no-explicit-any
252- value ?: any ;
253- formFieldPath ?: string ;
254- formFieldNamespace ?: string ;
255- status ?: string ;
256- interpretation ?: string ;
257- }
145+ // Export the imported types directly
146+ export type {
147+ OpenmrsEncounter ,
148+ OpenmrsObs ,
149+ SessionMode ,
150+ PostSubmissionAction ,
151+ FormSchema ,
152+ QuestionAnswerOption ,
153+ HideProps ,
154+ DisableProps ,
155+ RepeatOptions ,
156+ OpenmrsFormResource ,
157+ RenderType ,
158+ RequiredFieldProps ,
159+ FormReference ,
160+ ReferencedForm ,
161+ ProgramState ,
162+ } ;
258163
259164export interface Program {
260165 uuid : string ;
0 commit comments