- Fix has_unique flag reading from field definition (was scanning fragment fields) - Implement duplicate validation in CLI and TUI backends - Add item counter update in Web backend after add/delete operations - Refactor Web JavaScript: remove global constants, use closure-based state per group - Store repeating group config in data-* attributes instead of global variables - Update documentation and examples with unique = true attribute - All backends now enforce unique items validation consistently
2.3 KiB
2.3 KiB
Changes
[Unreleased]
Added
RepeatingGroup Duplicate Detection
- Implemented duplicate item validation across all backends (CLI, TUI, Web)
- Added
unique = trueattribute support to prevent duplicate items - Added item counter display updates in Web backend
- New
is_duplicate()function in CLI and TUI backends
Web Backend Improvements
- Refactored JavaScript: Replaced global constants with closure-based state management
- Added
render_global_repeating_group_script()for generic repeating group handling - Configuration stored in
data-*attributes:data-min-items,data-max-items,data-has-unique,data-unique-key,data-field-names - Live item counter updates after add/delete operations
- Single document-level event delegation for all repeating group interactions
Documentation
- Updated
docs/FIELD_TYPES.mdwith unique validation details - Updated
examples/README.mdwith RepeatingGroup testing commands - Added
docs/FIELD_TYPES.md(new file) - Updated example forms with
unique = trueattribute
Fixed
- CLI Backend: Fixed validation of duplicate items in add/edit operations
- TUI Backend: Fixed validation of duplicate items with error overlay feedback
- Web Backend: Fixed
has_uniqueflag reading from field definition (was incorrectly scanning fragment fields) - Web Backend: Fixed item counter not updating when adding/deleting items
Changed
Architecture
- Each repeating group now maintains independent state via closure
- Removed ~600 lines of dead code in Web JavaScript
- Event handling now context-aware (finds correct repeating group controller)
Examples
examples/05-fragments/array-trackers.toml: Addedunique = trueto UDP and HTTP tracker arraysexamples/07-nickel-generation/arrays-form.toml: Addedunique = trueto all RepeatingGroup fields
Technical Notes
- Duplicate detection compares ALL field values when
unique = true - Works consistently across CLI, TUI, and Web backends
- Backwards compatible: repeating groups without
unique = trueunaffected - max_items limit already enforced in all backends (no changes needed)
Testing
- All 174 unit tests passing
- No clippy warnings
- Build verified with
--all-featuresflag - Manual testing in Web backend: duplicate detection working correctly
- Item counter updates verified on add/delete operations