react-form-dto 1.0.0 β 1.0.2
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 +31 -0
- package/dist/index.d.ts +1 -1
- package/dist/react-form-dto.es.js +357 -335
- package/dist/react-form-dto.umd.js +2 -2
- package/dist/types/dto.d.ts +15 -0
- package/dist/utils/evaluateVisibleWhen.d.ts +8 -0
- package/dist/utils/index.d.ts +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -38,6 +38,7 @@ It operates at a higher abstraction level where **layout, validation, rendering,
|
|
|
38
38
|
- π§© **Extensible renderers** β plug in custom components
|
|
39
39
|
- π‘οΈ **Strong TypeScript typing** β safe, predictable APIs
|
|
40
40
|
- π **Enterprise-ready** β optimized for large, config-driven forms
|
|
41
|
+
- π **Nested condition engine** β combine AND/OR groups for powerful, multiβfield visibility rules
|
|
41
42
|
|
|
42
43
|
---
|
|
43
44
|
|
|
@@ -92,6 +93,12 @@ pnpm add react-form-dto
|
|
|
92
93
|
|
|
93
94
|
---
|
|
94
95
|
|
|
96
|
+
## Release Notes
|
|
97
|
+
|
|
98
|
+
See [CHANGELOG.md](./.github/CHANGELOG.md) for detailed version history.
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
95
102
|
## Core Concepts
|
|
96
103
|
|
|
97
104
|
### DTO as Source of Truth
|
|
@@ -267,6 +274,30 @@ const profileForm: FormDTO = {
|
|
|
267
274
|
|
|
268
275
|
---
|
|
269
276
|
|
|
277
|
+
## π Conditional Visibility with `visibleWhen`
|
|
278
|
+
|
|
279
|
+
React Form DTO supports dynamic field visibility based on the values of other fields in the form. This is achieved through the `visibleWhen` property, which allows you to define simple conditions or complex logical expressions.
|
|
280
|
+
|
|
281
|
+
### Basic Usage
|
|
282
|
+
|
|
283
|
+
Show a field only when another field has a specific value:
|
|
284
|
+
|
|
285
|
+
```tsx
|
|
286
|
+
{
|
|
287
|
+
id: "partnerName",
|
|
288
|
+
type: "text",
|
|
289
|
+
label: "Partner Name",
|
|
290
|
+
visibleWhen: {
|
|
291
|
+
field: "maritalStatus",
|
|
292
|
+
equals: "married"
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
For detail documentation, please visit [Docs](https://shakir-afridi.github.io/react-form-dto/docs/api/visibleWhen.html)
|
|
298
|
+
|
|
299
|
+
---
|
|
300
|
+
|
|
270
301
|
## π Internationalization (I18n)
|
|
271
302
|
|
|
272
303
|
React Form DTO has built-in support for multi-language forms through `I18String` and `I18nOption` types.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { FormBuilder, Section, Field, TextAreaInput, AutoCompleteField, MultiAutoCompleteField, RadioInput, SelectInput, TextInput, CheckBoxInput, } from './components';
|
|
2
2
|
export { validateAll, validateField, validationRules } from './utils';
|
|
3
|
-
export type { FieldDTO, SectionDTO, FormDTO, InputType, Validations, } from './types';
|
|
3
|
+
export type { FieldDTO, SectionDTO, FormDTO, InputType, Validations, Condition as VisibleWhenCondition, FieldCondition as VisibleWhenFieldCondition, ConditionGroup as VisibleWhenConditionGroup, } from './types';
|
|
4
4
|
export { useFormBuilder } from './hooks';
|