Closed beepsoft closed 5 months ago
These are great ideas.
re: the Date / DateTime rules: The date picker supports the format field which satisfies this idea but I think it could get confusing when the user tries to enter a year in the format YYYY and ends up with that year as an ISO String. These cases can be modeled as a Text field with min = 4, max = 4 and an appropriate regex (Ie check 4 digits) And it means dates always output iSO Strings as expected (and this is what I do in my own app - a date field in ISO format and a date as a simple string).
Leave it with me - this is a good first task for someone I know that wants to start helping out. If they can't do it, then we can talk about your team providing a pull request or me doing it when i can.
@marcolarosa, do you think you or your helper will be able to proceed with this issues? Or should our team provide a PR for this?
Umm yeah - if you guys can do this that would be great. Thankyou.
OK, we'll start working on it!
@beepsoft Any news on this?
Yes, we have this working internally, I just need to make it ready for PR.
Done!! Well done guys - this is great!
Profiles currently define 3 constraints for inputs
It would be great to have further type specific constraints for inputs - similar to JSON Schema property constraints - and enforce them via the current validation mechanism.
The possible constraint, which could be added per type:
Text
minLength
: minimum required length for valuemaxLength
: maximum allowed length for valueregex
: a regular expression the value has to matchTextArea
minLength
: minimum required length for valuemaxLength
: maximum allowed length for valueregex
: a regular expression the value has to matchNumber
minValue
: minimum possible value to be enteredmaxValue
: maximum possible value to be enterednumberType
: one or many of "any", "long", "int", "float", "double". It maybe an array to allow specifying any of the possble numberType valuesDate
granularity
: may have the values "year" (YYYY), "month" (YYYY-MM), "day" (YYYY-MM-DD). It maybe an array to allow specifying any of the possible granularity valuesDateTime
dateGranularity
: may have the values "year" (YYYY), "month" (YYYY-MM), "day" (YYYY-MM-DD). It maybe an array to allow specifying any of the possible granularity valuestimeGranularity
: may have the values "hour" (hh), "minute" (hh:mm), "second" (hh:mm:ss).It maybe an array to allow specifying any of the possible granularity valuesI think the Text, TextArea and Number constraints could be easily added. The Date/DateTime might be trickier, but also valid use cases, for example, Dataverse has this kind of Date field, which allows entering either YYYY, or YYYY-MM or YYYY-MM-DD format dates.