Gathering detailed insights and metrics for react-form-model-controller
Gathering detailed insights and metrics for react-form-model-controller
Gathering detailed insights and metrics for react-form-model-controller
Gathering detailed insights and metrics for react-form-model-controller
Enhances productivity with TypeScript IDE support, simplifies data serialization/deserialization and validation.
npm install react-form-model-controller
Typescript
Module System
Node Version
NPM Version
73.5
Supply Chain
91.5
Quality
76.8
Maintenance
100
Vulnerability
100
License
TypeScript (93.79%)
Shell (4.13%)
JavaScript (2.08%)
Total Downloads
963
Last Day
3
Last Week
13
Last Month
37
Last Year
402
MIT License
4 Stars
57 Commits
1 Watchers
9 Branches
1 Contributors
Updated on Feb 09, 2025
Latest Version
0.1.0
Package Id
react-form-model-controller@0.1.0
Unpacked Size
1.34 MB
Size
1.18 MB
File Count
48
NPM Version
9.6.7
Node Version
18.17.1
Published on
Feb 02, 2025
Cumulative downloads
Total Downloads
Last Day
0%
3
Compared to previous day
Last Week
0%
13
Compared to previous week
Last Month
825%
37
Compared to previous month
Last Year
-28.3%
402
Compared to previous year
2
Boosts productivity through TypeScript IDE support, streamlines data serialization/deserialization and validation, and offers customizable UI with render props for seamless server communication. A class model-based React form system utilizing decorators and metadata reflection.
This form system enhances productivity with TypeScript IDE support, simplifies data serialization/deserialization and validation, and provides customizable UI with render props for seamless server communication.
npm install react-form-model-controller
yarn add react-form-model-controller
pnpm add react-form-model-controller
Define model and create hook.
Use created hook in your component.
Target | Description | Type | Required |
---|---|---|---|
name | Name of the field defined in the model | string | required |
refValues | Fields that will trigger re-rendering and are included in the values | Array<keyof TFormModel> | optional |
validator | Function to validate the field | (value: T) => string | null | undefined | optional |
validateOnMount | Whether to validate the field when it is mounted | boolean | optional |
Target | Description | Type |
---|---|---|
value | Value of the field | TValue |
values | Values of the fields passed in refValues | Partial<TFormModel> |
error | Error message | string | undefined | null |
fieldHandler | Handler for the field corresponding to the Field component | (TValue) => void |
getFieldHandler | Getter for a specific field handler | (key: TKey, value: TFormModel[TKey]) => void |
getComplexFieldHandler | Getter for a handler used in complex field settings | (key: TKey, path: string (inferred by TypeScript), value: TValue) => void |
Target | Description | Type |
---|---|---|
setValue | Updates the value of a specific field | (key: TKey, value: TFormModel[TKey]) => void |
setValues | Updates the entire form model | (values: TFormModel) => void |
validate | Validates a specific field | (key: TKey) => boolean |
validateAll | Validates all fields | (key: TKey, value: TFormModel[TKey]) => boolean |
undo | Undoes the last update (experimental) | () => void |
reset | Resets the form to its initial state | () => void |
subscribe | Subscribes to changes in specific form values. Listens for changes in the specified keys and triggers the provided callback function when those values change. | (keys: TKey[], listener: (values: Pick<NonNullable<TFormModel>, TKey>) => void |
read | Fetches data from the server, converts it to the model format, and sets the form | (data: DataResponse) => void |
write | Converts model data to the format expected by the server | () => WriteResult(server expected data) |
No vulnerabilities found.