Skip to content
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

Proposing new Property Elements: displayFormat and editFormat #93

Open
wertzui opened this issue Jul 3, 2023 · 0 comments
Open

Proposing new Property Elements: displayFormat and editFormat #93

wertzui opened this issue Jul 3, 2023 · 0 comments

Comments

@wertzui
Copy link

wertzui commented Jul 3, 2023

While type can guide the client which type of input to render, this still leaves room on how to render the value.

For example a number can have a different number of digits after the decimal point, or should be padded with 0s.
A datetime-local might be displayed just as a date when it is readOnly: true, but with time when editing the value.

In contrast to the placeholder this is not intended to be displayed to the user, but for the rendering of values.

So I'm proposing new OPTIONAL Property Elements

  • displayFormat is a string that instructs the interface how to render a value that is not in edit mode (maybe because it is read only).
  • editFormat is a string of the same format, but is used when editing the value.

If a client does not support these elements, it can just render the value as if they where not present.

As I have a strong .Net background, I propose those formats to be possible values (There is also an npm package implementing the same format clr-format):

  • format: "{0:N2}", value: 1234.567, browser-locale: en-us => "1,234.45"
  • format: "{0:F1}", value: 1234.567, browser-locale: de-de => "1234,5"
  • format: "Foo {0} Baz", value: "Bar", browser-locale: doesn't matter => "Foo Bar Baz"

However I'm open minded of the structure of the string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant