@hievilmath/browser-formidavim 1.1.5 → 1.2.0
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/index.css +1 -0
- package/index.js +190 -189
- package/index.mjs +6552 -3152
- package/lib/components/DataRenderer.d.ts +10 -0
- package/lib/components/index.d.ts +1 -2
- package/lib/components/inputs/Date.d.ts +10 -0
- package/lib/components/inputs/Select.d.ts +15 -0
- package/lib/components/inputs/template.d.ts +4 -1
- package/lib/constants/theme.d.ts +1 -0
- package/lib/hooks/useConditionEvaluator.d.ts +1 -1
- package/lib/hooks/useFlowStore.d.ts +2 -1
- package/lib/styled-components/layout.d.ts +2 -2
- package/lib/utils/conditionEvaluator.d.ts +4 -7
- package/lib/utils/templateProcessor.d.ts +8 -0
- package/package.json +4 -2
- package/lib/components/NetworkAwareWrapper.d.ts +0 -7
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FC, PropsWithChildren } from 'react';
|
|
2
|
+
export declare const DataRenderer: FC<PropsWithChildren<{
|
|
3
|
+
dataFetcher?: () => Promise<any>;
|
|
4
|
+
configFetcher?: () => Promise<any>;
|
|
5
|
+
onSubmit?: () => Promise<any>;
|
|
6
|
+
isPreview?: boolean;
|
|
7
|
+
flowName?: string;
|
|
8
|
+
version?: string;
|
|
9
|
+
formidavimHost?: string;
|
|
10
|
+
}>>;
|
|
@@ -6,7 +6,6 @@ export { FlowFormRenderer } from './FlowFormRenderer';
|
|
|
6
6
|
export { FormRenderer } from './FormRenderer';
|
|
7
7
|
export { FormComponentRenderer } from './FormComponentRenderer';
|
|
8
8
|
export { FormWrapper } from './FormWrapper';
|
|
9
|
-
export {
|
|
9
|
+
export { DataRenderer } from './DataRenderer';
|
|
10
10
|
export { DemoConsumer } from './DemoConsumer';
|
|
11
|
-
export { evaluateCondition } from '../utils/conditionEvaluator';
|
|
12
11
|
export { ComponentFactory } from './ComponentFactory';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { FormComponent } from '../../../../../../axios/formidavim/src/index.ts';
|
|
3
|
+
export interface DatePickerProps {
|
|
4
|
+
label: string;
|
|
5
|
+
required: boolean;
|
|
6
|
+
propertyId: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const DatePickerInput: FC<{
|
|
9
|
+
formComponent: Partial<FormComponent>;
|
|
10
|
+
}>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { FormComponent } from '../../../../../../axios/formidavim/src/index.ts';
|
|
3
|
+
export interface SelectOption {
|
|
4
|
+
value: string;
|
|
5
|
+
labelText: string;
|
|
6
|
+
}
|
|
7
|
+
export interface SelectProps {
|
|
8
|
+
label: string;
|
|
9
|
+
required: boolean;
|
|
10
|
+
propertyId: string;
|
|
11
|
+
options: SelectOption[];
|
|
12
|
+
}
|
|
13
|
+
export declare const Select: FC<{
|
|
14
|
+
formComponent: Partial<FormComponent>;
|
|
15
|
+
}>;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
+
import { FormComponent } from '../../../../../../axios/formidavim/src/index.ts';
|
|
2
3
|
export interface NewComponentProps {
|
|
3
4
|
src: string;
|
|
4
5
|
}
|
|
5
|
-
export declare const NewComponent: FC<
|
|
6
|
+
export declare const NewComponent: FC<{
|
|
7
|
+
formComponent: Partial<FormComponent>;
|
|
8
|
+
}>;
|
package/lib/constants/theme.d.ts
CHANGED
|
@@ -3,5 +3,5 @@ import { Condition } from '../../../../../axios/formidavim/src/index.ts';
|
|
|
3
3
|
* Custom hook for evaluating conditions
|
|
4
4
|
*/
|
|
5
5
|
export declare const useConditionEvaluator: () => {
|
|
6
|
-
evaluateCondition: (condition: Condition | undefined) => boolean
|
|
6
|
+
evaluateCondition: (condition: Condition | undefined) => Promise<boolean>;
|
|
7
7
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Flow } from '../../../../../axios/formidavim/src/index.ts';
|
|
1
|
+
import { Flow, PatientProfileDto } from '../../../../../axios/formidavim/src/index.ts';
|
|
2
2
|
export declare const useFlowStore: () => {
|
|
3
3
|
setFlowValue: (field: string, value: any) => void;
|
|
4
4
|
setFlowValues: (values: Record<string, any>) => void;
|
|
@@ -6,6 +6,7 @@ export declare const useFlowStore: () => {
|
|
|
6
6
|
setPatientValue: (field: string, value: any) => void;
|
|
7
7
|
setPatientValues: (profile: any) => void;
|
|
8
8
|
getPatientValue: (field: string) => string | undefined;
|
|
9
|
+
getFullPatient: () => PatientProfileDto | null;
|
|
9
10
|
setFlowAndPatientValue: (field: string, value: any) => void;
|
|
10
11
|
generateFormDataFromFlow: (flow: Partial<Flow>) => Record<string, any>;
|
|
11
12
|
};
|
|
@@ -98,7 +98,7 @@ interface CRAccordionWrapperProps {
|
|
|
98
98
|
$open?: string;
|
|
99
99
|
}
|
|
100
100
|
interface FormSelectWrapperProps {
|
|
101
|
-
$visible?:
|
|
101
|
+
$visible?: boolean;
|
|
102
102
|
$hasError?: boolean;
|
|
103
103
|
}
|
|
104
104
|
interface FormFileWrapperProps {
|
|
@@ -108,7 +108,7 @@ interface FormFileWrapperProps {
|
|
|
108
108
|
$isMultiple?: boolean;
|
|
109
109
|
}
|
|
110
110
|
interface FormDatePickerWrapperProps {
|
|
111
|
-
$visible?:
|
|
111
|
+
$visible?: boolean;
|
|
112
112
|
$margin?: string;
|
|
113
113
|
$hasError?: boolean;
|
|
114
114
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Condition, PatientProfileDto } from '../../../../../axios/formidavim/src/index.ts';
|
|
2
2
|
type GetFieldValueFn = (field: string) => any;
|
|
3
|
+
type GetFullPatientFn = () => PatientProfileDto | null;
|
|
3
4
|
/**
|
|
4
5
|
* Evaluates condition groups using flow store data
|
|
5
6
|
* Each condition group is an array of IndividualCondition that should be ANDed together
|
|
@@ -7,12 +8,8 @@ type GetFieldValueFn = (field: string) => any;
|
|
|
7
8
|
*
|
|
8
9
|
* @param condition - The condition object containing condition groups
|
|
9
10
|
* @param getFieldValue - Function to get field values from the flow store
|
|
10
|
-
* @
|
|
11
|
+
* @param getFullPatient - Function to get the full patient data
|
|
12
|
+
* @returns Promise<boolean> indicating if any condition group is satisfied
|
|
11
13
|
*/
|
|
12
|
-
export declare const evaluateConditionWithFlowStore: (condition: Condition | undefined, getFieldValue: GetFieldValueFn) => boolean
|
|
13
|
-
/**
|
|
14
|
-
* Legacy function for backward compatibility
|
|
15
|
-
* @deprecated Use evaluateConditionWithFlowStore instead
|
|
16
|
-
*/
|
|
17
|
-
export declare const evaluateCondition: (condition: Condition | undefined, data: PatientProfileDto) => boolean;
|
|
14
|
+
export declare const evaluateConditionWithFlowStore: (condition: Condition | undefined, getFieldValue: GetFieldValueFn, getFullPatient: GetFullPatientFn) => Promise<boolean>;
|
|
18
15
|
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Flow, PatientProfileDto } from '../../../../../axios/formidavim/src/index.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Processes a Flow config to replace all template expressions in form component props
|
|
4
|
+
* @param config - The Flow configuration to process
|
|
5
|
+
* @param patientData - The patient data for template evaluation
|
|
6
|
+
* @returns Promise<Partial<Flow>> - The processed Flow config
|
|
7
|
+
*/
|
|
8
|
+
export declare const processFlowConfig: (config: Partial<Flow>, patientData: PatientProfileDto | null) => Promise<Partial<Flow>>;
|
package/package.json
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hievilmath/browser-formidavim",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"main": "./index.js",
|
|
5
5
|
"module": "./index.mjs",
|
|
6
6
|
"typings": "./index.d.ts",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@hievilmath/axios-formidavim": "1.1.1"
|
|
8
|
+
"@hievilmath/axios-formidavim": "1.1.1",
|
|
9
|
+
"jsonata": "^2.1.0"
|
|
9
10
|
},
|
|
10
11
|
"peerDependencies": {
|
|
11
12
|
"axios": "*",
|
|
12
13
|
"react": "*",
|
|
14
|
+
"react-datepicker": "*",
|
|
13
15
|
"react-redux": "*",
|
|
14
16
|
"react-router-dom": "*",
|
|
15
17
|
"styled-components": "*"
|