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

✨ Add iban and licenseplate component #51

Merged
merged 7 commits into from
Nov 10, 2023

Conversation

Viicos
Copy link
Contributor

@Viicos Viicos commented Nov 6, 2023

No description provided.

@Viicos Viicos changed the title ✨ Add iban component ✨ Add iban and licenseplate component Nov 7, 2023
@Viicos
Copy link
Contributor Author

Viicos commented Nov 7, 2023

The type definition of licenseplate seems to be incorrect:

image

export interface LicensePlateProperties {
    type: 'licenseplate';
    validate: {
        pattern: '^[a-zA-Z0-9]{1,3}\\-[a-zA-Z0-9]{1,3}\\-[a-zA-Z0-9]{1,3}$';  // Should also extend OFValidateOptions?
    };
    validateOn: 'blur';
}

Also, I've removed readonly input checkboxes in last commit for these two components, but I don't see any reference to that attribute in the types, nor in the base formio types?

@sergei-maertens
Copy link
Member

The type definition of licenseplate seems to be incorrect:

image

export interface LicensePlateProperties {
    type: 'licenseplate';
    validate: {
        pattern: '^[a-zA-Z0-9]{1,3}\\-[a-zA-Z0-9]{1,3}\\-[a-zA-Z0-9]{1,3}$';  // Should also extend OFValidateOptions?
    };
    validateOn: 'blur';
}

Also, I've removed readonly input checkboxes in last commit for these two components, but I don't see any reference to that attribute in the types, nor in the base formio types?

Good catch, something seems to have gone wrong there. We should at least check the type tests to see if those also highlight the issue. There may be a forgotten intersection or something like that.

@Viicos
Copy link
Contributor Author

Viicos commented Nov 8, 2023

Hum, there's a test for this and it seems to pass

@sergei-maertens
Copy link
Member

Hum, there's a test for this and it seems to pass

interesting 🤔

@sergei-maertens sergei-maertens force-pushed the feature/licenseplate-iban-components branch from 4ef3a97 to 57df6f0 Compare November 10, 2023 11:09
Copy link
Member

@sergei-maertens sergei-maertens left a comment

Choose a reason for hiding this comment

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

Spotted a couple of oversights.

src/registry/iban/edit.tsx Outdated Show resolved Hide resolved
Comment on lines 141 to 142
defaultValue: '',
placeholder: '',
Copy link
Member

Choose a reason for hiding this comment

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

I'm surprised the type checker didn't complain about this one though

Copy link
Contributor Author

@Viicos Viicos Nov 10, 2023

Choose a reason for hiding this comment

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

It seems types are incorrect: defaultValue is not excluded. But Iban is multiple capable, so according to the definition of MultipleCapable, it would infer never if we Omit defaultValue on the BaseIbanComponentSchema :/

placeholder doesn't seem to be Omit'ed as well

Copy link
Member

Choose a reason for hiding this comment

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

defaultValue is something we can't/shouldn't omit since formik needs to have one in the renderer anyway, so it can be present in the component definition but not exposed in the form builder

placeholder should be omitted, feel free to file an issue in the types repo

src/registry/licenseplate/edit.tsx Outdated Show resolved Hide resolved
src/registry/iban/edit.tsx Outdated Show resolved Hide resolved
src/registry/licenseplate/edit.tsx Outdated Show resolved Hide resolved
@sergei-maertens sergei-maertens merged commit edc8a6f into main Nov 10, 2023
8 checks passed
@Viicos Viicos deleted the feature/licenseplate-iban-components branch November 10, 2023 15:47
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.

2 participants