Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add u8 field type support #433

Merged
merged 7 commits into from
Dec 16, 2024
Merged

feat: add u8 field type support #433

merged 7 commits into from
Dec 16, 2024

Conversation

c12i
Copy link
Collaborator

@c12i c12i commented Dec 11, 2024

This PR will close #405.

Additionally, the representation of Vec<u8> field types in UI code is a Uint8Array instead of Array<number>.

@c12i c12i added the ShouldBackport/0.4 This change should be backported to develop-0.1 label Dec 11, 2024
@c12i c12i requested review from matthme and mattyg December 11, 2024 13:00
@matthme
Copy link
Collaborator

matthme commented Dec 12, 2024

I'm noticing, at least in the Vue framework so far, that a u8 field does not offer the option to scaffold a UI widget, while u32 does. I think u8 could use that same widget?

Copy link
Collaborator

@matthme matthme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left one comment regarding adding the slider component as well for u8. Not sure anyone will ever use a u8 type outside of a vector though but if it's not too much effort it would be nice I think to have the same behavior as u32 in this regard.

@c12i
Copy link
Collaborator Author

c12i commented Dec 13, 2024

I'm noticing, at least in the Vue framework so far, that a u8 field does not offer the option to scaffold a UI widget, while u32 does. I think u8 could use that same widget?

Yes, the components were not added, fixed now

@c12i c12i requested a review from matthme December 13, 2024 11:29
@matthme
Copy link
Collaborator

matthme commented Dec 13, 2024

Now it offers to use a Slider also when a Vec<u8> is scaffoldded. I'm not sure that's expected behavior. And also, when I scaffold an entry type with a u8 field and Vec<u8> field, the type of the Vec<u8> field in the Create and Edit Svelte UI components is scaffolded as Array<number> instead of Uint8Array although the type in the types.ts file is correctly a Uint8Array.

@c12i c12i requested a review from matthme December 16, 2024 14:41
Copy link
Collaborator

@matthme matthme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me now 👍

@c12i c12i merged commit 8276f96 into develop Dec 16, 2024
11 checks passed
@c12i c12i deleted the feat/add-u8-field-type branch December 16, 2024 16:31
c12i added a commit that referenced this pull request Dec 18, 2024
* Add u8 field type

* Represent Vec<u8> as a Uint8Array

* Add u8 widgets

* Fix misplaced lables

* Fix svelte slider props

* Ensure correct TS type is generated for Vec<u8>

* Skip ui generation for Vec<u8> types
@c12i c12i removed the ShouldBackport/0.4 This change should be backported to develop-0.1 label Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add u8 & Vec<u8> to field types
2 participants