-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Fix bigint interface bugs #20757
base: main
Are you sure you want to change the base?
Fix bigint interface bugs #20757
Conversation
🦋 Changeset detectedLatest commit: db5e768 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@br41nslug @paescuj It still is a wip |
@paescuj I handled |
I fixed all the things within the |
fd5ab30
to
b2f6f96
Compare
I hope the |
c09e0d7
to
3e3ce0e
Compare
@br41nslug Can you check it out? I think other than |
type numeric = number | bigint; | ||
|
||
export class SafeInteger { | ||
private _value: numeric; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont think we need an underscore in the variable name here
private _value: numeric; | |
private value: numeric; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did set it private so we can't modify it outside of the class. But can't have a getter with the same name as a variable name.
@@ -87,6 +91,7 @@ const setRawValue = () => { | |||
:disabled="disabled" | |||
language="plaintext" | |||
:placeholder="t('enter_raw_value')" | |||
:is-big-integer="props.field.type === 'bigInteger'" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's try to work with BigInts as strings where possible so we limit the amount of "is big int" props added to where they are strictly required. I think we can drop a bunch of the "if big int then" logic if getJSType
were to return string
for bigInt
instead of number
.
@br41nslug I hope I added the changes you suggested. Can you check it? |
2f3dfb7
to
5b2104b
Compare
@br41nslug Can you check it one more time and let me know if you're satisfied with the changes I made. Also it already became a huge PR so I can work on |
Will put it on the list for tomorrow :D Yeah the slider should definitely be in a separate PR the goal is to keep PRs as small and to the point as possible |
@br41nslug Can you review it now please? |
if (safeInt.isInvalid) { | ||
inputRef.value?.focus(); | ||
codemirror?.setValue(content.substring(0, content.length - 1)); | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this recursively set the value? probably a better approach to emit null if it is invalid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No this doesn't recursively set values. As It'll be unfocused once the value is invalid.
<!-- This input is exists just to unfocus the codemirror component --> | ||
<input ref="inputRef" type="radio" :style="{ all: 'unset' }" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can do without this workaround.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't find any documentation on blur
method first. But looks like it has a method to get the input field.
if (props.field.type === 'bigInteger') { | ||
return emit('setRawValue', internalValue.value); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be in the switch
statement as getJSType now returns bigInteger
…f the global v-form
…sing the SafeInteger class
5b2104b
to
db5e768
Compare
@br41nslug Every changes has been made |
Scope
What's changed:
(But atm not possible to validate editing on the raw editor)Potential Risks / Drawbacks
.admin/settings/data-model/table/field
->interface tab
Adding a maximum or minimum value in a bigInteger field is not possible. It thinks of the field as integerReview Notes / Questions
Fixes #20287