fix: #2692 Tabbing / clicking / returning out of a number field round your input#3427
fix: #2692 Tabbing / clicking / returning out of a number field round your input#3427cwhitten merged 11 commits intomicrosoft:masterfrom LouisEugeneMSFT:leugene/issue2692
Conversation
Composer/packages/extensions/adaptive-form/src/components/fields/NumberField.tsx
Show resolved
Hide resolved
Composer/packages/extensions/adaptive-form/src/components/fields/NumberField.tsx
Show resolved
Hide resolved
Composer/packages/extensions/adaptive-form/src/components/fields/NumberField.tsx
Outdated
Show resolved
Hide resolved
Composer/packages/extensions/adaptive-form/src/components/fields/NumberField.tsx
Outdated
Show resolved
Hide resolved
a-b-r-o-w-n
left a comment
There was a problem hiding this comment.
If possible, try to add a test case for this. Fabric does not make testing the SpinButton very easy, so just do what you can.
|
@vishwacsena @tomlm can you comment to the introduction of |
|
@cwhitten , It seems I have some misunderstanding here, I was trying to say that This means user can set precision of the output by formatNumber expression in LG. |
|
@luhan2017 @LouisEugeneMSFT let's take this and continue discussion to determine if we want to allow the the number type to include a precision option, so that you don't need to format using lg. |
* link the application keys with bot service in provision script (#3425) * fix: #3309 Allow configuring app settings without opening a bot project (#3454) * issues#3309 * fixes lints * Default to bot settings if no route cache Co-authored-by: Soroush <sorgh@microsoft.com> Co-authored-by: Chris Whitten <christopher.whitten@microsoft.com> * feat: 'Ctrl + Click', 'Shift + Click' behaviors in Flow Editor (#3448) * ctrl + click behavior * enhance the focus behavior * range selection e2e * calculate accurate range selection * MacOS Meta + Click support Co-authored-by: Chris Whitten <christopher.whitten@microsoft.com> * fix: fix relative path of runtime folder in eject customized (#3434) * fix runtime relative path in eject * fix process pid not exist when runtime folder not exist Co-authored-by: Chris Whitten <christopher.whitten@microsoft.com> * fix: typo (#3474) * Fix a typo Message recieved -> Message received * Improve language A basic brush of the Home page. * fix: fix get history before file persistence (#3440) * fix get history before file persistence * flush in action not in component * fix bug Co-authored-by: Chris Whitten <christopher.whitten@microsoft.com> Co-authored-by: Dong Lei <donglei@microsoft.com> * fix: #2692 Tabbing / clicking / returning out of a number field round your input (#3427) * bug fix * pr comment * lint * double export * updated test Co-authored-by: Louis Eugene <leugene@microsoft.com> Co-authored-by: Ben Yackley <61990921+beyackle@users.noreply.github.com> Co-authored-by: Chris Whitten <christopher.whitten@microsoft.com> * fix: revert plugins out of workspace (#3479) * revert commit about add plugins into workspace * revert other relative path change * update the lock file * remove yarn.lock in azure plugins to make sure bot-deploy updated Co-authored-by: leilzh <leilzh@microsoft.com> Co-authored-by: Andy Brown <asbrown002@gmail.com> * chore: Hide ignored folders in vscode, update prettier config (#3493) * issues#3309 * fixes lints * Default to bot settings if no route cache * fix: #3485 Co-authored-by: Soroush <sorgh@microsoft.com> Co-authored-by: Chris Whitten <christopher.whitten@microsoft.com> * feat: show 'AutoEndDialog' from Adaptive Dialog Property Editor (#3498) * refactor: add rule and remove dangling underscores (#3496) * add rule and remove dangling underscores * update elliptic and test Co-authored-by: Andy Brown <asbrown002@gmail.com> * chore: added config to debug Electron main process. (#3501) Co-authored-by: Andy Brown <asbrown002@gmail.com> * Merge pull request #3502 from hatpick/master fix: #3486 Debug/Fix HMR support * fix: add logo-clicking to tests (#3500) * add logo-clicking to tests * bump elliptic version * Update yarn.lock Co-authored-by: Andy Brown <asbrown002@gmail.com> * feat: support validate lg custom functions (#3273) * fix: support validate lg custom functions and separate the dialog validation from parser * use file name as namespace * add unit test * fix lint * fix: inline editing LU mess up whole file (#3478) * upgrade lu packages * update package * clean * update * clean up Co-authored-by: Andy Brown <asbrown002@gmail.com> * refactor: change term primary key to authoring key (#3516) Co-authored-by: Andy Brown <asbrown002@gmail.com> Co-authored-by: Qi Kang <kangqidev@gmail.com> Co-authored-by: Soroush <hatpick@gmail.com> Co-authored-by: Soroush <sorgh@microsoft.com> Co-authored-by: Chris Whitten <christopher.whitten@microsoft.com> Co-authored-by: zeye <2295905420@qq.com> Co-authored-by: VanyLaw <wenyluo@microsoft.com> Co-authored-by: Yan Liu <32497439+zxyanliu@users.noreply.github.com> Co-authored-by: Dong Lei <donglei@microsoft.com> Co-authored-by: LouisEugeneMSFT <66701106+LouisEugeneMSFT@users.noreply.github.com> Co-authored-by: Louis Eugene <leugene@microsoft.com> Co-authored-by: leilzh <leilzh@microsoft.com> Co-authored-by: Andy Brown <asbrown002@gmail.com> Co-authored-by: TJ Durnford <tjdford@gmail.com> Co-authored-by: Tony Anziano <toanzian@microsoft.com> Co-authored-by: Zhixiang Zhan <zhixzhan@microsoft.com> Co-authored-by: liweitian <liweitian93@outlook.com>
* link the application keys with bot service in provision script (microsoft#3425) * fix: microsoft#3309 Allow configuring app settings without opening a bot project (microsoft#3454) * issues#3309 * fixes lints * Default to bot settings if no route cache Co-authored-by: Soroush <sorgh@microsoft.com> Co-authored-by: Chris Whitten <christopher.whitten@microsoft.com> * feat: 'Ctrl + Click', 'Shift + Click' behaviors in Flow Editor (microsoft#3448) * ctrl + click behavior * enhance the focus behavior * range selection e2e * calculate accurate range selection * MacOS Meta + Click support Co-authored-by: Chris Whitten <christopher.whitten@microsoft.com> * fix: fix relative path of runtime folder in eject customized (microsoft#3434) * fix runtime relative path in eject * fix process pid not exist when runtime folder not exist Co-authored-by: Chris Whitten <christopher.whitten@microsoft.com> * fix: typo (microsoft#3474) * Fix a typo Message recieved -> Message received * Improve language A basic brush of the Home page. * fix: fix get history before file persistence (microsoft#3440) * fix get history before file persistence * flush in action not in component * fix bug Co-authored-by: Chris Whitten <christopher.whitten@microsoft.com> Co-authored-by: Dong Lei <donglei@microsoft.com> * fix: microsoft#2692 Tabbing / clicking / returning out of a number field round your input (microsoft#3427) * bug fix * pr comment * lint * double export * updated test Co-authored-by: Louis Eugene <leugene@microsoft.com> Co-authored-by: Ben Yackley <61990921+beyackle@users.noreply.github.com> Co-authored-by: Chris Whitten <christopher.whitten@microsoft.com> * fix: revert plugins out of workspace (microsoft#3479) * revert commit about add plugins into workspace * revert other relative path change * update the lock file * remove yarn.lock in azure plugins to make sure bot-deploy updated Co-authored-by: leilzh <leilzh@microsoft.com> Co-authored-by: Andy Brown <asbrown002@gmail.com> * chore: Hide ignored folders in vscode, update prettier config (microsoft#3493) * issues#3309 * fixes lints * Default to bot settings if no route cache * fix: microsoft#3485 Co-authored-by: Soroush <sorgh@microsoft.com> Co-authored-by: Chris Whitten <christopher.whitten@microsoft.com> * feat: show 'AutoEndDialog' from Adaptive Dialog Property Editor (microsoft#3498) * refactor: add rule and remove dangling underscores (microsoft#3496) * add rule and remove dangling underscores * update elliptic and test Co-authored-by: Andy Brown <asbrown002@gmail.com> * chore: added config to debug Electron main process. (microsoft#3501) Co-authored-by: Andy Brown <asbrown002@gmail.com> * Merge pull request microsoft#3502 from hatpick/master fix: microsoft#3486 Debug/Fix HMR support * fix: add logo-clicking to tests (microsoft#3500) * add logo-clicking to tests * bump elliptic version * Update yarn.lock Co-authored-by: Andy Brown <asbrown002@gmail.com> * feat: support validate lg custom functions (microsoft#3273) * fix: support validate lg custom functions and separate the dialog validation from parser * use file name as namespace * add unit test * fix lint * fix: inline editing LU mess up whole file (microsoft#3478) * upgrade lu packages * update package * clean * update * clean up Co-authored-by: Andy Brown <asbrown002@gmail.com> * refactor: change term primary key to authoring key (microsoft#3516) Co-authored-by: Andy Brown <asbrown002@gmail.com> Co-authored-by: Qi Kang <kangqidev@gmail.com> Co-authored-by: Soroush <hatpick@gmail.com> Co-authored-by: Soroush <sorgh@microsoft.com> Co-authored-by: Chris Whitten <christopher.whitten@microsoft.com> Co-authored-by: zeye <2295905420@qq.com> Co-authored-by: VanyLaw <wenyluo@microsoft.com> Co-authored-by: Yan Liu <32497439+zxyanliu@users.noreply.github.com> Co-authored-by: Dong Lei <donglei@microsoft.com> Co-authored-by: LouisEugeneMSFT <66701106+LouisEugeneMSFT@users.noreply.github.com> Co-authored-by: Louis Eugene <leugene@microsoft.com> Co-authored-by: leilzh <leilzh@microsoft.com> Co-authored-by: Andy Brown <asbrown002@gmail.com> Co-authored-by: TJ Durnford <tjdford@gmail.com> Co-authored-by: Tony Anziano <toanzian@microsoft.com> Co-authored-by: Zhixiang Zhan <zhixzhan@microsoft.com> Co-authored-by: liweitian <liweitian93@outlook.com>
* link the application keys with bot service in provision script (#3425) * fix: #3309 Allow configuring app settings without opening a bot project (#3454) * issues#3309 * fixes lints * Default to bot settings if no route cache Co-authored-by: Soroush <sorgh@microsoft.com> Co-authored-by: Chris Whitten <christopher.whitten@microsoft.com> * feat: 'Ctrl + Click', 'Shift + Click' behaviors in Flow Editor (#3448) * ctrl + click behavior * enhance the focus behavior * range selection e2e * calculate accurate range selection * MacOS Meta + Click support Co-authored-by: Chris Whitten <christopher.whitten@microsoft.com> * fix: fix relative path of runtime folder in eject customized (#3434) * fix runtime relative path in eject * fix process pid not exist when runtime folder not exist Co-authored-by: Chris Whitten <christopher.whitten@microsoft.com> * fix: typo (#3474) * Fix a typo Message recieved -> Message received * Improve language A basic brush of the Home page. * fix: fix get history before file persistence (#3440) * fix get history before file persistence * flush in action not in component * fix bug Co-authored-by: Chris Whitten <christopher.whitten@microsoft.com> Co-authored-by: Dong Lei <donglei@microsoft.com> * fix: #2692 Tabbing / clicking / returning out of a number field round your input (#3427) * bug fix * pr comment * lint * double export * updated test Co-authored-by: Louis Eugene <leugene@microsoft.com> Co-authored-by: Ben Yackley <61990921+beyackle@users.noreply.github.com> Co-authored-by: Chris Whitten <christopher.whitten@microsoft.com> * fix: revert plugins out of workspace (#3479) * revert commit about add plugins into workspace * revert other relative path change * update the lock file * remove yarn.lock in azure plugins to make sure bot-deploy updated Co-authored-by: leilzh <leilzh@microsoft.com> Co-authored-by: Andy Brown <asbrown002@gmail.com> * chore: Hide ignored folders in vscode, update prettier config (#3493) * issues#3309 * fixes lints * Default to bot settings if no route cache * fix: #3485 Co-authored-by: Soroush <sorgh@microsoft.com> Co-authored-by: Chris Whitten <christopher.whitten@microsoft.com> * feat: show 'AutoEndDialog' from Adaptive Dialog Property Editor (#3498) * refactor: add rule and remove dangling underscores (#3496) * add rule and remove dangling underscores * update elliptic and test Co-authored-by: Andy Brown <asbrown002@gmail.com> * chore: added config to debug Electron main process. (#3501) Co-authored-by: Andy Brown <asbrown002@gmail.com> * Merge pull request #3502 from hatpick/master fix: #3486 Debug/Fix HMR support * fix: add logo-clicking to tests (#3500) * add logo-clicking to tests * bump elliptic version * Update yarn.lock Co-authored-by: Andy Brown <asbrown002@gmail.com> * feat: support validate lg custom functions (#3273) * fix: support validate lg custom functions and separate the dialog validation from parser * use file name as namespace * add unit test * fix lint * fix: inline editing LU mess up whole file (#3478) * upgrade lu packages * update package * clean * update * clean up Co-authored-by: Andy Brown <asbrown002@gmail.com> * refactor: change term primary key to authoring key (#3516) Co-authored-by: Andy Brown <asbrown002@gmail.com> Co-authored-by: Qi Kang <kangqidev@gmail.com> Co-authored-by: Soroush <hatpick@gmail.com> Co-authored-by: Soroush <sorgh@microsoft.com> Co-authored-by: Chris Whitten <christopher.whitten@microsoft.com> Co-authored-by: zeye <2295905420@qq.com> Co-authored-by: VanyLaw <wenyluo@microsoft.com> Co-authored-by: Yan Liu <32497439+zxyanliu@users.noreply.github.com> Co-authored-by: Dong Lei <donglei@microsoft.com> Co-authored-by: LouisEugeneMSFT <66701106+LouisEugeneMSFT@users.noreply.github.com> Co-authored-by: Louis Eugene <leugene@microsoft.com> Co-authored-by: leilzh <leilzh@microsoft.com> Co-authored-by: Andy Brown <asbrown002@gmail.com> Co-authored-by: TJ Durnford <tjdford@gmail.com> Co-authored-by: Tony Anziano <toanzian@microsoft.com> Co-authored-by: Zhixiang Zhan <zhixzhan@microsoft.com> Co-authored-by: liweitian <liweitian93@outlook.com>
…eld round your input (microsoft#3427) * bug fix * pr comment * lint * double export * updated test Co-authored-by: Louis Eugene <leugene@microsoft.com> Co-authored-by: Ben Yackley <61990921+beyackle@users.noreply.github.com> Co-authored-by: Chris Whitten <christopher.whitten@microsoft.com>


Description
The field (Composer/packages/extensions/adaptive-form/src/components/fields/NumberField.tsx) was always rounding numbers to be integers since onValidate calls updateValue(0).
In the case of floats, updateValue(0) would call getFloat(value, 0), which would call .toFixed(0).
This is because the step variable was used in different places for different purposes. In the case of getFloat it was used both for incrementing and rounding, which is incorrect.
The PR therefore makes the rounding "amount" a separate variable (floatNumberOfDecimals).
Task Item
fixes #2692
Screenshots