Repository navigation
Releases: Thavarshan/formlink
Release list
v1.3.0
Added
-
Debug Mode: Added development-friendly debug mode with automatic detection based on
NODE_ENV- Safe environment checks for browser/Node.js compatibility
- Prefixed debug messages with
[Form Debug]for easy identification - Optional data parameter for detailed debugging output
-
Type Guards: Implemented robust type safety improvements
isFile()type guard with environment safety checksisBlob()type guard for better file handling- Enhanced cross-platform compatibility for browser and Node.js environments
-
Advanced State Management: Comprehensive form state tracking and reporting
getStateSummary()method for complete form state overviewisState()method for checking specific form states- Enhanced dirty field tracking with granular control
- Form state enumeration (
FormState.IDLE,PROCESSING,SUCCESS,ERROR,CANCELLED)
-
Enhanced Validation System: Improved validation capabilities
validateField()for individual field validationvalidateDirtyFields()for validating only modified fields- Async validation support with proper error handling
- Better validation error reporting and management
-
Input Validation: Added constructor input validation for better error prevention
- Validates
initialDataparameter to ensure it's a valid object - Throws descriptive errors for invalid input
- Prevents runtime errors from malformed initialization
- Validates
-
Cross-Platform Improvements: Enhanced compatibility across different environments
- Safe
processexistence checks for browser compatibility - Graceful fallbacks for environment-specific APIs
- Better error handling for different runtime environments
- Safe
Changed
-
Enhanced Data Cloning: Improved cloning strategy with performance optimizations
- Uses
structuredClonewhen available for better performance - Graceful fallback to utility
deepClonefunction - Separate methods for full data cloning vs. field-level cloning
- Better handling of complex nested objects and circular references
- Uses
-
FormData Generation: Enhanced file handling in
toFormData()method- Uses new type guards for safer File/Blob detection
- Better handling of nested objects and arrays
- Improved FormData key generation for complex structures
- Enhanced null/undefined value handling
-
Form Reset Logic: Improved reset functionality with better state management
- Enhanced field-specific reset with proper dirty field cleanup
- Better default value handling and restoration
- Improved state cleanup after reset operations
- More reliable form state restoration
-
Error Handling: Significantly improved error management
- DRY error assignment with helper functions
- Better HTTP status code handling (401, 403, 404, 422, 5xx)
- Enhanced network error detection and reporting
- Improved validation error formatting and display
-
Resource Management: Enhanced cleanup and disposal mechanisms
- Better timeout management and cleanup
- Improved request cancellation handling
- More thorough resource disposal in
dispose()method - Enhanced memory management for long-running applications
Fixed
-
Constructor Safety: Fixed potential runtime errors from invalid initialization data
- Added comprehensive input validation
- Better error messages for debugging
- Prevents crashes from malformed initial data
-
Environment Compatibility: Resolved cross-platform compatibility issues
- Fixed
processaccess in browser environments - Better handling of Node.js vs. browser APIs
- Improved error handling for missing environment features
- Fixed
-
File Upload Reliability: Enhanced file handling robustness
- Better type checking for File and Blob objects
- Improved error handling for unsupported file types
- Enhanced FormData generation for complex file structures
-
State Consistency: Fixed various state management edge cases
- Better dirty field tracking consistency
- Improved form state transitions
- Enhanced error state management
- More reliable success/failure state handling
-
Memory Leaks: Addressed potential memory leaks and resource cleanup
- Better timeout cleanup in all scenarios
- Improved request cancellation handling
- Enhanced disposal of event listeners and callbacks
- More thorough cleanup of internal state
Developer Experience
-
Enhanced Documentation: Comprehensive JSDoc improvements
- Detailed parameter descriptions for all methods
- Better return type documentation
- Enhanced usage examples in comments
- Improved TypeScript intellisense support
-
Better Debugging: Improved development experience
- Debug mode for development environments
- Better error messages with context
- Enhanced logging for troubleshooting
- More descriptive validation error messages
-
Improved Tooling: Enhanced development and build tooling
- Better TypeScript integration
- Improved linting rules and fixes
- Enhanced testing capabilities
- Better IDE support and autocomplete
v1.2.6
Added
-
Utility Abstractions: Introduced several utility functions to improve modularity and testability:
createFormProxy(moved proxy logic out of class)deepClone(replaces internaldeepClonemethod)prepareSubmissionData(encapsulates data transformation and file handling logic)getDefaultHeaders(extracts CSRF token header logic)createProgressObject(standardizes upload progress structure)formatGeneralErrorandformatValidationErrors(modular error formatting)createTimeout(abstracts timeout creation)
-
Debounce Time Configuration: Added optional
debounceTimeparameter tosubmitDebouncedmethod for customizable delay duration.
Changed
- Proxy Creation: Replaced inline proxy logic within the constructor with
createFormProxy()helper. - Deep Cloning: Refactored cloning logic to use the
deepClone()utility instead of a private method. - Data Preparation: Moved data transformation and file handling into
prepareSubmissionData(). - Header Management: Extracted CSRF token header logic into
getDefaultHeaders(). - Progress Tracking: Refactored
updateProgressto usecreateProgressObject()for standardized formatting. - Error Handling: Replaced inline error formatting with
formatValidationErrors()andformatGeneralError()for better readability and separation of concerns. - Timeout Management: Switched from
window.setTimeouttocreateTimeout()for better control and consistency. - Cleaner Disposal: Updated
dispose()to useObject.keys().forEach()for better clarity and reliability when clearing object keys.
Fixed
- Potential Proxy Redundancy: Improved property fallback logic by moving proxy logic out, reducing chances of conflicts or duplication.
- Error Object Casting: Made error response casting and fallback more robust using type-safe utilities.
- Form Reset Edge Cases: Fixed edge case where resetting with specific fields might not deep clone defaults properly.
- Timeout Cleanup: Ensured all timeouts (including debounce) are properly cleared in all scenarios, improving memory safety.
v1.2.5
Changed
- Strip
lodashand use native JS/TS functions instead
v1.2.4
Added
- Option to install as Vue plugin
Fixed
- Laravel validation errors set without input name as key in
errorsobject (#59)
v1.2.0
Added
- Form Validation: Introduced a new form validation feature that validates form data based on provided rules before submission, ensuring correct data is sent.- File Upload Progress Tracking: Added support for tracking the progress of file uploads during form submission.
- Debounced Form Submission: Added support for debounced form submissions, reducing redundant network requests by delaying execution for a specified time.
Changed
- Improved Error Handling: The error handling mechanism has been improved to integrate more effectively with Laravel's backend for validation errors.
- Dependency Updates: Project dependencies have been updated to ensure compatibility and performance improvements.
Fixed
- Form Error Handling: Fixed issues where form errors were not being correctly cleared or reset upon new submissions.
v1.0.11
Added
- Complete code refactor and restructure
- Added support for file upload progress tracking.
- Added handling of Laravel validation error responses within the form.
Changed
- Updated API to support all common HTTP methods (
GET,POST,PUT,PATCH,DELETE). - Improved error handling and validation mechanisms to integrate seamlessly with Laravel.
- Updted dependencies
Fixed
- Fixed CSRF token management for automatic inclusion in form requests.
- Fixed issues where form errors were not being properly cleared or reset upon new submissions.
v0.0.11
Added
- Add
getInitialmethod to Form
Changed
- Update dependencies
- Update docblocks to option types and update
package.json - Update proxy instance to use lodash when checking for reserved field names
Fixed
- Fix props being set directly on form client
- Fix all props being set inside data and initial data props of form client
v0.0.10
Changed
- Update import statements to use proper relative paths
- Export response types and error types from
index.ts
v0.0.9
Added
- Add
extractErrorprivate method to Form - Add
getFirstInputFieldNameprivate method to Form - Add
exceptionenum - Add
initialiseprivate method to Form
Changed
- Update type hints on
Formclass - Update http initialise method call priority
- Update README.md with CI badges
- Update error handler to extract error from response
Fixed
- Fix typo on ErrorResponse interface name
v0.0.5
Added
- Add
getIsDirtymethod to Form - Add
setIsDirtymethod to Form - Add
isDirtyproperty to Form
Changed
- Update initials data setting mechanism
- Update
allErrorsmethod toerrors - Integrate Axios types into Formlink types