Skip to content

Add format property to NumberRange component #2

@jeanaurent

Description

@jeanaurent

Problem:
Large numbers in NumberRange are hard to read without formatting (e.g., "1000000").

Solution:
Implement a Svelte action to apply a specific formatting to the value of the min and max fields of NumberRange.

Description of the proposal:

  1. The backend must specify the format as a regex expression
  2. Add format property to NumberRange Class
class NumberRange {
  ...
  public Format: string | null = null; 
}

and to the controller

export class Controller extends InputController<NumberRange> {
  ...
  public format: string | null = null;
}
  1. Implement a Svelte action that would accept a regex expression as a parameter to format a value (e.g., "regex:\\B(?=(\\d{3})+(?!\\d))")
  • By default (or if format is null), there is no formatting.
  • Display is formatted on blur, raw on focus.
  • Can be used as a normal svelte action <input bind:value={controller.minValue} use:formatInput={{ format: format }}/>
  1. No serialization changes in the NumberRange component

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions