@ilife-tech/react-application-flow-renderer 1.0.9 → 1.0.11
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/README.md +72 -2
- package/dist/example.js +3 -3
- package/dist/example.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -315,7 +315,7 @@ function App() {
|
|
|
315
315
|
questionGroups,
|
|
316
316
|
pageRules: Array.isArray(rawPageRules) ? rawPageRules : [],
|
|
317
317
|
pageRuleGroup:
|
|
318
|
-
rawPageRuleGroup
|
|
318
|
+
Array.isArray(rawPageRuleGroup) ? rawPageRuleGroup : [],
|
|
319
319
|
validationSchema: validationErrors,
|
|
320
320
|
actionSchema: actionButtons,
|
|
321
321
|
sectionSchema: sectionList || [],
|
|
@@ -787,7 +787,7 @@ The `DynamicForm` component accepts the following props:
|
|
|
787
787
|
| `theme` | `Object` | No | `{}` | Theme customization |
|
|
788
788
|
| `validationSchema` | `Array` | No | `[]` | Additional validation rules |
|
|
789
789
|
| `pageRules` | `Array` | No | `[]` | Page rules for conditional logic |
|
|
790
|
-
| `pageRuleGroup` | `
|
|
790
|
+
| `pageRuleGroup` | `Array` | No | `[]` | Page rule groups with complex boolean expressions |
|
|
791
791
|
| `debug` | `Boolean` | No | `false` | Enable debug mode |
|
|
792
792
|
| `formApiRef` | `Object` | No | - | Ref object to access form API methods |
|
|
793
793
|
| `toastConfig` | `Object` | No | `{}` | Toast configuration |
|
|
@@ -908,6 +908,76 @@ The package supports a wide range of field types to handle various input require
|
|
|
908
908
|
| `button` | `ButtonField` | Action button field |
|
|
909
909
|
| `spinner` | `SpinnerField` | Loading indicator field |
|
|
910
910
|
|
|
911
|
+
## Conditional Logic
|
|
912
|
+
|
|
913
|
+
The Dynamic Form Renderer provides powerful conditional logic capabilities through the `pageRules` and `pageRuleGroup` props.
|
|
914
|
+
|
|
915
|
+
### PageRules
|
|
916
|
+
|
|
917
|
+
Page rules define individual conditions and actions for dynamic form behavior:
|
|
918
|
+
|
|
919
|
+
```javascript
|
|
920
|
+
const pageRules = [
|
|
921
|
+
{
|
|
922
|
+
ruleId: "rule1",
|
|
923
|
+
triggerQuestionIds: ["101"],
|
|
924
|
+
comparison: "equals",
|
|
925
|
+
compareValue: "yes",
|
|
926
|
+
action: "showquestion",
|
|
927
|
+
targetQuestionIds: ["201"]
|
|
928
|
+
},
|
|
929
|
+
// more rules...
|
|
930
|
+
];
|
|
931
|
+
```
|
|
932
|
+
|
|
933
|
+
### Enhanced PageRuleGroup
|
|
934
|
+
|
|
935
|
+
The enhanced `pageRuleGroup` feature provides sophisticated boolean expressions for complex conditional logic:
|
|
936
|
+
|
|
937
|
+
```javascript
|
|
938
|
+
// New array-based format with complex boolean expressions
|
|
939
|
+
const pageRuleGroup = [
|
|
940
|
+
{
|
|
941
|
+
questionId: "40374",
|
|
942
|
+
evaluationExpression: "rule1 AND rule2"
|
|
943
|
+
},
|
|
944
|
+
{
|
|
945
|
+
questionId: "40555",
|
|
946
|
+
evaluationExpression: "(rule1 AND rule2) OR rule3"
|
|
947
|
+
}
|
|
948
|
+
];
|
|
949
|
+
```
|
|
950
|
+
|
|
951
|
+
#### Key Features
|
|
952
|
+
|
|
953
|
+
- **Complex Boolean Logic**: Combine multiple rules with AND/OR operations
|
|
954
|
+
- **Parentheses Support**: Control operator precedence for complex evaluations
|
|
955
|
+
- **Backward Compatibility**: Supports legacy object-based format
|
|
956
|
+
|
|
957
|
+
#### Expression Syntax
|
|
958
|
+
|
|
959
|
+
- **Operators**: `AND`, `OR` (case-insensitive)
|
|
960
|
+
- **Rule References**: Use `ruleId` values from the pageRules array
|
|
961
|
+
- **Parentheses**: Group expressions to control evaluation order
|
|
962
|
+
|
|
963
|
+
#### Examples
|
|
964
|
+
|
|
965
|
+
```javascript
|
|
966
|
+
// Simple AND condition
|
|
967
|
+
{
|
|
968
|
+
questionId: "40374",
|
|
969
|
+
evaluationExpression: "rule1 AND rule2"
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
// Complex nested conditions
|
|
973
|
+
{
|
|
974
|
+
questionId: "40890",
|
|
975
|
+
evaluationExpression: "(rule1 AND rule2) OR (rule3 AND rule4)"
|
|
976
|
+
}
|
|
977
|
+
```
|
|
978
|
+
|
|
979
|
+
For detailed documentation on the enhanced pageRuleGroup feature, see the [PageRuleGroupEnhancement.md](docs/PageRuleGroupImplementation/PageRuleGroupEnhancement.md) file.
|
|
980
|
+
|
|
911
981
|
## Advanced Configuration
|
|
912
982
|
|
|
913
983
|
### Toast Notifications
|