Repository navigation
feat(forms): give defaultValue the type of each control - #2653
Merged
Merged
Conversation
defaultValue now has the type of the default that each control keeps, in place of unknown. The date controls also accept a string, as value does. The file input keeps no default: defaultValue is always null, and a form reset always clears the selection. Before, a file list written to defaultValue was submitted after a reset while the control showed no files, and a string was submitted one character per entry. The manifest now keeps the type of an override. So the API reference gives the date time input value the type Date | null, not T | null.
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain in the default-value typing, file-reset behavior, and API documentation changes.
No open issues 🎉
What changed in this PR
This PR gives form controls in Ignite UI for Web Components concrete defaultValue types and aligns generated API documentation with those types.
Changes:
- Adds control-specific
defaultValueaccessors, with date controls also accepting strings. - Ensures file inputs retain no default selection and submit no files after reset, with regression tests.
- Corrects manifest override types and updates API references, specifications, Storybook metadata, and the changelog.
| File | Description |
|---|---|
| stories/date-time-input.stories.ts | Adds date-value metadata and removes the generic-type workaround. |
| src/internals/mixins/forms/form-transformers.ts | Makes file-input defaults always null. |
| src/components/textarea/textarea.ts | Types defaultValue as string. |
| src/components/slider/spec.md | Aligns default-value documentation with JSDoc. |
| src/components/slider/slider.ts | Types defaultValue as number. |
| src/components/select/spec.md | Documents string | undefined defaults. |
| src/components/select/select.ts | Types defaultValue as string | undefined. |
| src/components/rating/spec.md | Aligns default-value documentation with JSDoc. |
| src/components/rating/rating.ts | Types defaultValue as number. |
| src/components/mask-input/mask-input.ts | Types defaultValue as string. |
| src/components/input/input.ts | Types defaultValue as string. |
| src/components/file-input/spec.md | Documents null defaults and reset regression scenarios. |
| src/components/file-input/file-input.ts | Exposes a null default and removes redundant default handling. |
| src/components/file-input/file-input.spec.ts | Tests reset behavior after file-list and string default writes. |
| src/components/date-time-input/date-time-input.ts | Adds typed date defaults with string input support. |
| src/components/date-range-picker/date-range-picker.ts | Adds typed range defaults with string input support. |
| src/components/date-picker/date-picker.ts | Adds typed date defaults with string input support. |
| src/components/combo/combo.ts | Types defaults as ComboValue<T>[]. |
| src/components/color-picker/color-picker.ts | Types defaultValue as string. |
| public-api.json | Records concrete default types and the corrected date-time value type. |
| CHANGELOG.md | Records typing changes, manifest correction, and file-reset fix. |
| cem.config.mjs | Resolves explicitly typed overrides through the TypeScript checker. |
| api-reference/igc-textarea.md | Documents string defaults. |
| api-reference/igc-slider.md | Documents numeric defaults. |
| api-reference/igc-select.md | Documents string-or-undefined defaults. |
| api-reference/igc-rating.md | Documents numeric defaults. |
| api-reference/igc-mask-input.md | Documents string defaults. |
| api-reference/igc-input.md | Documents string defaults. |
| api-reference/igc-file-input.md | Documents always-null defaults and reset behavior. |
| api-reference/igc-date-time-input.md | Corrects the value type and documents date defaults. |
| api-reference/igc-date-range-picker.md | Documents nullable date-range defaults. |
| api-reference/igc-date-picker.md | Documents nullable date defaults. |
| api-reference/igc-combo.md | Documents typed selection-array defaults. |
| api-reference/igc-color-picker.md | Documents string defaults. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
defaultValue now has the type of the default that each control keeps, in place of unknown. The date controls also accept a string, as value does.
The file input keeps no default: defaultValue is always null, and a form reset always clears the selection. Before, a file list written to defaultValue was submitted after a reset while the control showed no files, and a string was submitted one character per entry.
The manifest now keeps the type of an override. So the API reference gives the date time input value the type Date | null, not T | null.
Type of Change
Checklist
npm run public-api:updateand committedpublic-api.jsonandapi-reference/CHANGELOG.mdentry under[Unreleased]