Pop-up Variable Editors #73
Description
Providing a modal pop-up to edit variables would be useful as it would constrain users from entering bad data. The variables could be rendered as links in the contract text, and clicking on a variable should open the appropriate pop-up. See designs from @Michael-Grover.
- String variable: unconstrained text input
- String variable with regex in model: constrain text input based on a regex
- Integer/Long variable: whole numbers only (including negative numbers)
- Float/Double variable: floating point numbers only (including negative numbers)
- Numeric variable with range validation: constrain numeric variable based on upper and lower range
- DataTime variable: calendar pop up (allowing user to enter Date, Time or DateTime), along with a timezone
- Monetary Amount
- Temporal Duration
- Temporal Period
- Boolean variable: a drop down with true/false (or similar)
- Anything else : unconstrained text input
Describe the solution you'd like
We should ensure that we don't duplicate the logic in the concerto-ui
React form component, which can create React forms for Concerto types. The pop-ups will want to delegate to concerto-ui
to ensure consistency.
Note that the concept of Variable
is defined by the Contract Editor via a plugin, here:
https://github.com/accordproject/web-components/blob/master/packages/ui-contract-editor/src/components/Variable/index.js
When variables are clicked we should open a modal to edit them. Conceptually this is similar to how links are handled in the base markdown editor, so that can be used as a reference. We will want any code that handles variables to be in the contract-editor.
https://github.com/accordproject/web-components/blob/master/packages/ui-markdown-editor/src/FormattingToolbar/index.js#L51