Repository navigation
fix(input-number): 保持千分位实时编辑与受控回流时光标位置不跳尾 - #6
Merged
Merged
Conversation
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.
背景与问题
在
InputNumber开启千分位(useGrouping: true默认值)或受控绑定时修改前部/中间数字:onKeypress对所有合法字符调用preventDefault()并直接覆写el.value,未恢复选区导致每次按键光标被浏览器重置到末尾,且破坏原生撤销栈;modelValue/value回流重刷displayText,再次打断光标;变更内容
@mango-write/ui-core新增headless/number-edit:Intl.NumberFormat.formatToParts区分当前 locale 的group/decimal与本地数码表(兼容en-US、zh-CN、de-DE、fr-FR、en-IN、ar-EG等),编辑态整数分组与失焦提交态保持同构,并在删除首位时保留前导零不塌缩;Number.MAX_SAFE_INTEGER边界拦截,拒绝非法粘贴静默篡改原值,兼容中文全角数码与句号小数点。@mango-write/ui-vue&@mango-write/ui-react双端InputNumber对等改造:beforeinput+input,仅在!event.isTrusted合成测试事件下走keypress兜底并同步恢复选区;draftVersion识别当前回声与过期异步回流,隔离 IME 组合态下的方向键步进与回车提交。core、vue、react三处光标锚定、区域分隔符与极端词法单测。