Skip to content

Numberbox: Refactor and improve typing - #34779

Open
Raushen wants to merge 2 commits into
DevExpress:mainfrom
Raushen:NumberBox-refactoring
Open

Numberbox: Refactor and improve typing#34779
Raushen wants to merge 2 commits into
DevExpress:mainfrom
Raushen:NumberBox-refactoring

Conversation

@Raushen

@Raushen Raushen commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@Raushen Raushen self-assigned this Aug 14, 2026
Copilot AI lite review requested due to automatic review settings August 14, 2026 14:25
@Raushen
Raushen requested a review from a team as a code owner August 14, 2026 14:25
@Raushen Raushen added the 26_2 label Aug 14, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the internal NumberBox implementation by removing legacy m_* modules, introducing new shared utilities, and tightening TypeScript typings across NumberBox-related components and their consumers.

Changes:

  • Replaced legacy m_number_box* imports with the new number_box* module structure across internal widgets and tests.
  • Extracted NumberBox helper logic into new reusable modules (utils.ts, number_box.caret.ts) and removed obsolete ones.
  • Improved TypeScript typing for NumberBox base/mask/spin/spins implementations and updated downstream consumers (e.g., ColorBox, DateBox).

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/devextreme/testing/tests/DevExpress.ui.widgets/toolbar.kbn.tests.js Updates NumberBox class import to new internal module path.
packages/devextreme/testing/tests/DevExpress.ui.widgets.editors/numberBoxParts/mask.caret.tests.js Updates caret helper import to new module path.
packages/devextreme/testing/tests/DevExpress.ui.widgets.editors/numberBoxParts/common.tests.js Updates SpinButton import to new module path.
packages/devextreme/js/ui/number_box.js Updates public entry reexport to point at new internal implementation.
packages/devextreme/js/__internal/ui/text_box/text_editor.mask.ts Adjusts typing to allow char to be undefined in replace logic.
packages/devextreme/js/__internal/ui/number_box/utils.ts Adds new shared NumberBox utility helpers (separator parsing, percent adjustment, etc.).
packages/devextreme/js/__internal/ui/number_box/number_box.ts Switches NumberBox to use the renamed mask module.
packages/devextreme/js/__internal/ui/number_box/number_box.spins.ts Refactors spin buttons to stronger typing and cleaner option handling.
packages/devextreme/js/__internal/ui/number_box/number_box.spin.ts Strengthens typing around spin change events and pointer handling.
packages/devextreme/js/__internal/ui/number_box/number_box.mask.ts Major typing improvements + refactors using new caret/utils modules.
packages/devextreme/js/__internal/ui/number_box/number_box.caret.ts Adds a new caret utility module (replacing legacy caret implementation).
packages/devextreme/js/__internal/ui/number_box/number_box.base.ts Improves typing for NumberBox base behavior (spin events, parsing, ARIA).
packages/devextreme/js/__internal/ui/number_box/m_utils.ts Removes legacy NumberBox utilities (replaced by utils.ts).
packages/devextreme/js/__internal/ui/number_box/m_number_box.caret.ts Removes legacy caret implementation (replaced by number_box.caret.ts).
packages/devextreme/js/__internal/ui/date_box/time_view.ts Updates DateBox TimeView to import the new NumberBox module/types.
packages/devextreme/js/__internal/ui/color_box/color_view.ts Updates ColorBox to import the new NumberBox module/constants.
Suppressed comments (1)

packages/devextreme/js/__internal/ui/number_box/number_box.mask.ts:451

  • In _updateFormat, _format() is typed to return string | undefined, but the LDML callback passes its result directly to number.convertDigits and returns it as a string. If a custom formatter ever returns undefined, this will propagate (or become a non-string) and can break formatting/caret logic at runtime. Normalize the formatted text to a string before calling convertDigits and returning it.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants