@ea-lab/reactive-json-docs 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/README-npm.md +49 -0
  2. package/README.md +86 -0
  3. package/package.json +79 -0
  4. package/public/rjbuild/component-doc/chartjs/components.yaml +252 -0
  5. package/public/rjbuild/component-doc/chartjs/overview.yaml +51 -0
  6. package/public/rjbuild/component-doc/core/action/HashChangeListener.md +90 -0
  7. package/public/rjbuild/component-doc/core/action/HashChangeListener.yaml +124 -0
  8. package/public/rjbuild/component-doc/core/action/Hide.md +22 -0
  9. package/public/rjbuild/component-doc/core/action/Hide.yaml +60 -0
  10. package/public/rjbuild/component-doc/core/action/MessageListener.md +93 -0
  11. package/public/rjbuild/component-doc/core/action/MessageListener.yaml +153 -0
  12. package/public/rjbuild/component-doc/core/action/Popover.md +26 -0
  13. package/public/rjbuild/component-doc/core/action/Popover.yaml +100 -0
  14. package/public/rjbuild/component-doc/core/action/ReactOnEvent.md +81 -0
  15. package/public/rjbuild/component-doc/core/action/ReactOnEvent.yaml +133 -0
  16. package/public/rjbuild/component-doc/core/action/Redirect.md +20 -0
  17. package/public/rjbuild/component-doc/core/action/Redirect.yaml +68 -0
  18. package/public/rjbuild/component-doc/core/action/Tooltip.md +22 -0
  19. package/public/rjbuild/component-doc/core/action/Tooltip.yaml +90 -0
  20. package/public/rjbuild/component-doc/core/action/VisuallyHide.md +21 -0
  21. package/public/rjbuild/component-doc/core/action/VisuallyHide.yaml +62 -0
  22. package/public/rjbuild/component-doc/core/action/index.md +214 -0
  23. package/public/rjbuild/component-doc/core/action/index.yaml +278 -0
  24. package/public/rjbuild/component-doc/core/element/form/CheckBoxField.md +276 -0
  25. package/public/rjbuild/component-doc/core/element/form/CheckBoxField.yaml +338 -0
  26. package/public/rjbuild/component-doc/core/element/form/DateField.md +189 -0
  27. package/public/rjbuild/component-doc/core/element/form/DateField.yaml +264 -0
  28. package/public/rjbuild/component-doc/core/element/form/NumberField.md +136 -0
  29. package/public/rjbuild/component-doc/core/element/form/NumberField.yaml +103 -0
  30. package/public/rjbuild/component-doc/core/element/form/SelectField.md +304 -0
  31. package/public/rjbuild/component-doc/core/element/form/SelectField.yaml +360 -0
  32. package/public/rjbuild/component-doc/core/element/form/TextAreaField.md +134 -0
  33. package/public/rjbuild/component-doc/core/element/form/TextAreaField.yaml +146 -0
  34. package/public/rjbuild/component-doc/core/element/form/TextField.md +129 -0
  35. package/public/rjbuild/component-doc/core/element/form/TextField.yaml +147 -0
  36. package/public/rjbuild/component-doc/core/element/form/formElementsCommon.md +106 -0
  37. package/public/rjbuild/component-doc/core/element/form/index.md +50 -0
  38. package/public/rjbuild/component-doc/core/element/form/index.yaml +96 -0
  39. package/public/rjbuild/component-doc/core/element/html/AccordionItem.yaml +47 -0
  40. package/public/rjbuild/component-doc/core/element/html/FolderSortableTree.yaml +81 -0
  41. package/public/rjbuild/component-doc/core/element/html/FormatNumeral.yaml +58 -0
  42. package/public/rjbuild/component-doc/core/element/html/Html.yaml +67 -0
  43. package/public/rjbuild/component-doc/core/element/html/LabelFromValue.yaml +54 -0
  44. package/public/rjbuild/component-doc/core/element/html/Modal.yaml +93 -0
  45. package/public/rjbuild/component-doc/core/element/html/PreformattedMarkup.yaml +37 -0
  46. package/public/rjbuild/component-doc/core/element/html/SortableTreeItemCollapseButton.yaml +92 -0
  47. package/public/rjbuild/component-doc/core/element/html/Tabs.yaml +57 -0
  48. package/public/rjbuild/component-doc/core/element/special/BootstrapElement.md +17 -0
  49. package/public/rjbuild/component-doc/core/element/special/BootstrapElement.yaml +18 -0
  50. package/public/rjbuild/component-doc/core/element/special/Count.md +37 -0
  51. package/public/rjbuild/component-doc/core/element/special/Count.yaml +325 -0
  52. package/public/rjbuild/component-doc/core/element/special/DataFilter.md +149 -0
  53. package/public/rjbuild/component-doc/core/element/special/DataFilter.yaml +315 -0
  54. package/public/rjbuild/component-doc/core/element/special/DelayedActions.md +51 -0
  55. package/public/rjbuild/component-doc/core/element/special/DelayedActions.yaml +55 -0
  56. package/public/rjbuild/component-doc/core/element/special/PageControls.md +126 -0
  57. package/public/rjbuild/component-doc/core/element/special/PageControls.yaml +133 -0
  58. package/public/rjbuild/component-doc/core/element/special/Phantom.md +31 -0
  59. package/public/rjbuild/component-doc/core/element/special/Phantom.yaml +34 -0
  60. package/public/rjbuild/component-doc/core/element/special/ReactiveJsonSubroot.md +27 -0
  61. package/public/rjbuild/component-doc/core/element/special/ReactiveJsonSubroot.yaml +51 -0
  62. package/public/rjbuild/component-doc/core/element/special/Switch.md +262 -0
  63. package/public/rjbuild/component-doc/core/element/special/Switch.yaml +348 -0
  64. package/public/rjbuild/component-doc/core/example/accordion.md +96 -0
  65. package/public/rjbuild/component-doc/core/example/accordion.yaml +64 -0
  66. package/public/rjbuild/component-doc/core/example/dynamic-content.md +197 -0
  67. package/public/rjbuild/component-doc/core/example/dynamic-content.yaml +237 -0
  68. package/public/rjbuild/component-doc/core/example/html.md +66 -0
  69. package/public/rjbuild/component-doc/core/example/html.yaml +83 -0
  70. package/public/rjbuild/component-doc/core/example/website.yaml +1663 -0
  71. package/public/rjbuild/component-doc/core/reaction/addData.md +96 -0
  72. package/public/rjbuild/component-doc/core/reaction/addData.yaml +133 -0
  73. package/public/rjbuild/component-doc/core/reaction/fetchData.md +60 -0
  74. package/public/rjbuild/component-doc/core/reaction/fetchData.yaml +156 -0
  75. package/public/rjbuild/component-doc/core/reaction/index.md +236 -0
  76. package/public/rjbuild/component-doc/core/reaction/index.yaml +254 -0
  77. package/public/rjbuild/component-doc/core/reaction/moveData.md +68 -0
  78. package/public/rjbuild/component-doc/core/reaction/moveData.yaml +71 -0
  79. package/public/rjbuild/component-doc/core/reaction/postMessage.md +63 -0
  80. package/public/rjbuild/component-doc/core/reaction/postMessage.yaml +68 -0
  81. package/public/rjbuild/component-doc/core/reaction/redirectNow.md +37 -0
  82. package/public/rjbuild/component-doc/core/reaction/redirectNow.yaml +37 -0
  83. package/public/rjbuild/component-doc/core/reaction/removeData.md +78 -0
  84. package/public/rjbuild/component-doc/core/reaction/removeData.yaml +56 -0
  85. package/public/rjbuild/component-doc/core/reaction/setClipboardData.md +44 -0
  86. package/public/rjbuild/component-doc/core/reaction/setClipboardData.yaml +41 -0
  87. package/public/rjbuild/component-doc/core/reaction/setData.md +93 -0
  88. package/public/rjbuild/component-doc/core/reaction/setData.yaml +85 -0
  89. package/public/rjbuild/component-doc/core/reaction/submitData.md +138 -0
  90. package/public/rjbuild/component-doc/core/reaction/submitData.yaml +141 -0
  91. package/public/rjbuild/component-doc/core/reaction/triggerEvent.md +59 -0
  92. package/public/rjbuild/component-doc/core/reaction/triggerEvent.yaml +59 -0
  93. package/public/rjbuild/component-doc/index.yaml +13 -0
@@ -0,0 +1,134 @@
1
+ # TextAreaField
2
+
3
+ The `TextAreaField` component renders a multi-line text input field using React Bootstrap. It provides a resizable textarea for longer text content with automatic data binding to the global data context.
4
+
5
+ ## Properties
6
+
7
+ - `dataLocation` (string, optional): Path to bind the field value in the data context
8
+ - `defaultFieldValue` (string, optional): Default value when no data is present
9
+ - `label` (string, optional): Field label text (supports template evaluation)
10
+ - `placeholder` (string, optional): Placeholder text (supports template evaluation)
11
+ - `rows` (number, optional): Number of visible text lines (default: 3)
12
+ - `attributes` (object, optional): Attributes applied to the Form.Group container
13
+ - `inputAttributes` (object, optional): Attributes applied directly to the textarea element
14
+ - `actions` (array, optional): Actions to execute based on field state
15
+
16
+ ## Data Management
17
+
18
+ The component automatically synchronizes its value with the global data context. When using `dataLocation`, the value is stored at the specified path. Without `dataLocation`, the value is stored in the template context using the component's `datafield`.
19
+
20
+ ## Textarea Features
21
+
22
+ The component provides standard HTML textarea functionality:
23
+ - Multi-line text input
24
+ - Automatic line breaks and wrapping
25
+ - Resizable by default (can be controlled via CSS)
26
+ - Character counting support via attributes
27
+ - Scrollable content when exceeding visible area
28
+
29
+ ## Basic Example
30
+
31
+ ```yaml
32
+ renderView:
33
+ - type: TextAreaField
34
+ dataLocation: ~.comments
35
+ label: "Comments:"
36
+ placeholder: "Enter your comments here..."
37
+ rows: 4
38
+
39
+ data:
40
+ comments: ""
41
+ ```
42
+
43
+ ## Character Limiter
44
+
45
+ ```yaml
46
+ renderView:
47
+ - type: TextAreaField
48
+ dataLocation: ~.feedback
49
+ label: "Feedback (max 200 characters):"
50
+ placeholder: "Your feedback..."
51
+ rows: 4
52
+ inputAttributes:
53
+ maxLength: 200
54
+
55
+ data:
56
+ feedback: ""
57
+ ```
58
+
59
+ ## Custom Styling
60
+
61
+ ```yaml
62
+ renderView:
63
+ - type: TextAreaField
64
+ dataLocation: ~.code
65
+ label: "Code Snippet:"
66
+ placeholder: "Enter your code here..."
67
+ rows: 6
68
+ inputAttributes:
69
+ style:
70
+ fontFamily: "monospace"
71
+ fontSize: "14px"
72
+ backgroundColor: "#f8f9fa"
73
+ border: "1px solid #ced4da"
74
+ resize: "vertical"
75
+ spellCheck: false
76
+ - type: TextAreaField
77
+ dataLocation: ~.poetry
78
+ label: "Poetry (no resize):"
79
+ placeholder: "Write your poem..."
80
+ rows: 4
81
+ inputAttributes:
82
+ style:
83
+ fontStyle: "italic"
84
+ resize: "none"
85
+ backgroundColor: "#fff8dc"
86
+
87
+ data:
88
+ code: ""
89
+ poetry: ""
90
+ ```
91
+
92
+ ## Complete Example
93
+
94
+ A comprehensive example showing different TextAreaField configurations:
95
+
96
+ ```yaml
97
+ renderView:
98
+ - type: TextAreaField
99
+ dataLocation: ~.comments
100
+ label: "Comments:"
101
+ placeholder: "Enter your comments here..."
102
+ rows: 4
103
+ inputAttributes:
104
+ maxLength: 500
105
+ - type: TextAreaField
106
+ dataLocation: ~.description
107
+ label: "Product Description:"
108
+ placeholder: "Describe the product features..."
109
+ rows: 6
110
+ inputAttributes:
111
+ style:
112
+ resize: "vertical"
113
+ - type: div
114
+ content:
115
+ - "Comments: "
116
+ - ~.comments
117
+ - type: div
118
+ content:
119
+ - "Description: "
120
+ - ~.description
121
+
122
+ data:
123
+ comments: ""
124
+ description: ""
125
+ ```
126
+
127
+ ## Limitations
128
+
129
+ - No built-in rich text editing capabilities
130
+ - No automatic text formatting or markdown support
131
+ - No built-in character counting display
132
+ - No built-in validation beyond HTML5 attributes
133
+ - No support for auto-resizing based on content
134
+ - No built-in spell checking configuration options
@@ -0,0 +1,146 @@
1
+ renderView:
2
+ - type: Markdown
3
+ content: |
4
+ # TextAreaField
5
+
6
+ The `TextAreaField` component renders a multi-line text input field using React Bootstrap. It provides a resizable textarea for longer text content with automatic data binding to the global data context.
7
+
8
+ ## Properties
9
+
10
+ - `dataLocation` (string, optional): Path to bind the field value in the data context
11
+ - `defaultFieldValue` (string, optional): Default value when no data is present
12
+ - `label` (string, optional): Field label text (supports template evaluation)
13
+ - `placeholder` (string, optional): Placeholder text (supports template evaluation)
14
+ - `rows` (number, optional): Number of visible text lines (default: 3)
15
+ - `attributes` (object, optional): Attributes applied to the Form.Group container
16
+ - `inputAttributes` (object, optional): Attributes applied directly to the textarea element
17
+ - `actions` (array, optional): Actions to execute based on field state
18
+
19
+ ## Data Management
20
+
21
+ The component automatically synchronizes its value with the global data context. When using `dataLocation`, the value is stored at the specified path. Without `dataLocation`, the value is stored in the template context using the component's `datafield`.
22
+
23
+ ## Textarea Features
24
+
25
+ The component provides standard HTML textarea functionality:
26
+ - Multi-line text input
27
+ - Automatic line breaks and wrapping
28
+ - Resizable by default (can be controlled via CSS)
29
+ - Character counting support via attributes
30
+ - Scrollable content when exceeding visible area
31
+
32
+ - type: RjBuildDescriber
33
+ title: "Basic TextAreaField Usage"
34
+ description: "Simple multi-line text input with label and placeholder"
35
+ toDescribe:
36
+ renderView:
37
+ - type: TextAreaField
38
+ dataLocation: ~.comments
39
+ label: "Comments:"
40
+ placeholder: "Enter your comments here..."
41
+ rows: 4
42
+ - type: div
43
+ content:
44
+ - "Current value: "
45
+ - type: strong
46
+ content: ~.comments
47
+ data:
48
+ comments: ""
49
+
50
+ - type: RjBuildDescriber
51
+ title: "Character Limiter"
52
+ description: "TextAreaField with character limit restriction"
53
+ toDescribe:
54
+ renderView:
55
+ - type: TextAreaField
56
+ dataLocation: ~.feedback
57
+ label: "Feedback (max 200 characters):"
58
+ placeholder: "Your feedback..."
59
+ rows: 4
60
+ inputAttributes:
61
+ maxLength: 200
62
+ - type: div
63
+ content:
64
+ - "Feedback: "
65
+ - ~.feedback
66
+ data:
67
+ feedback: ""
68
+
69
+ - type: RjBuildDescriber
70
+ title: "Custom Styling"
71
+ description: "TextAreaField with custom styles and attributes"
72
+ toDescribe:
73
+ renderView:
74
+ - type: TextAreaField
75
+ dataLocation: ~.code
76
+ label: "Code Snippet:"
77
+ placeholder: "Enter your code here..."
78
+ rows: 6
79
+ inputAttributes:
80
+ style:
81
+ fontFamily: "monospace"
82
+ fontSize: "14px"
83
+ backgroundColor: "#f8f9fa"
84
+ border: "1px solid #ced4da"
85
+ resize: "vertical"
86
+ spellCheck: false
87
+ - type: TextAreaField
88
+ dataLocation: ~.poetry
89
+ label: "Poetry (no resize):"
90
+ placeholder: "Write your poem..."
91
+ rows: 4
92
+ inputAttributes:
93
+ style:
94
+ fontStyle: "italic"
95
+ resize: "none"
96
+ backgroundColor: "#fff8dc"
97
+ - type: div
98
+ attributes:
99
+ style:
100
+ marginTop: "20px"
101
+ content:
102
+ - type: strong
103
+ content: "Preview:"
104
+ - type: div
105
+ attributes:
106
+ style:
107
+ fontFamily: "monospace"
108
+ backgroundColor: "#f8f9fa"
109
+ padding: "10px"
110
+ borderRadius: "4px"
111
+ marginTop: "5px"
112
+ content: ~.code
113
+ actions:
114
+ - what: hide
115
+ when: ~.code
116
+ is: ""
117
+ - type: div
118
+ attributes:
119
+ style:
120
+ fontStyle: "italic"
121
+ backgroundColor: "#fff8dc"
122
+ padding: "10px"
123
+ borderRadius: "4px"
124
+ marginTop: "5px"
125
+ content: ~.poetry
126
+ actions:
127
+ - what: hide
128
+ when: ~.poetry
129
+ is: ""
130
+ data:
131
+ code: ""
132
+ poetry: ""
133
+
134
+ - type: Markdown
135
+ content: |
136
+ ## Limitations
137
+
138
+ - No built-in rich text editing capabilities
139
+ - No automatic text formatting or markdown support
140
+ - No built-in character counting display
141
+ - No built-in validation beyond HTML5 attributes
142
+ - No support for auto-resizing based on content
143
+ - No built-in spell checking configuration options
144
+
145
+ templates: {}
146
+ data: {}
@@ -0,0 +1,129 @@
1
+ # TextField
2
+
3
+ The `TextField` component renders a single-line text input field using React Bootstrap. It supports various input types, template evaluation for dynamic content, and automatic data binding to the global data context.
4
+
5
+ ## Properties
6
+
7
+ - `dataLocation` (string, optional): Path to bind the field value in the data context
8
+ - `defaultFieldValue` (string, optional): Default value when no data is present
9
+ - `label` (string, optional): Field label text (supports template evaluation)
10
+ - `placeholder` (string, optional): Placeholder text (supports template evaluation)
11
+ - `inputType` (string, optional): HTML input type (default: "text", supports template evaluation)
12
+ - `attributes` (object, optional): Attributes applied to the Form.Group container
13
+ - `inputAttributes` (object, optional): Attributes applied directly to the input element
14
+ - `actions` (array, optional): Actions to execute based on field state
15
+
16
+ ## Data Management
17
+
18
+ The component automatically synchronizes its value with the global data context. When using `dataLocation`, the value is stored at the specified path. Without `dataLocation`, the value is stored in the template context using the component's `datafield`.
19
+
20
+ ## Input Types
21
+
22
+ The `inputType` property supports all HTML5 input types:
23
+ - `text` (default): Standard text input
24
+ - `email`: Email validation
25
+ - `password`: Masked password input
26
+ - `url`: URL validation
27
+ - `tel`: Telephone number input
28
+ - `search`: Search input with clear button
29
+
30
+ ## Basic Example
31
+
32
+ ```yaml
33
+ renderView:
34
+ - type: TextField
35
+ dataLocation: ~.username
36
+ label: "Username:"
37
+ placeholder: "Enter your username"
38
+
39
+ data:
40
+ username: ""
41
+ ```
42
+
43
+ ## Different Input Types
44
+
45
+ ```yaml
46
+ renderView:
47
+ - type: TextField
48
+ dataLocation: ~.email
49
+ label: "Email:"
50
+ placeholder: "user@example.com"
51
+ inputType: "email"
52
+ - type: TextField
53
+ dataLocation: ~.password
54
+ label: "Password:"
55
+ placeholder: "Enter password"
56
+ inputType: "password"
57
+ - type: TextField
58
+ dataLocation: ~.website
59
+ label: "Website:"
60
+ placeholder: "https://example.com"
61
+ inputType: "url"
62
+
63
+ data:
64
+ email: ""
65
+ password: ""
66
+ website: ""
67
+ ```
68
+
69
+ ## Input Attributes
70
+
71
+ ```yaml
72
+ renderView:
73
+ - type: TextField
74
+ dataLocation: ~.productCode
75
+ label: "Product Code:"
76
+ placeholder: "ABC-123"
77
+ inputAttributes:
78
+ pattern: "[A-Z]{3}-[0-9]{3}"
79
+ title: "Format: ABC-123 (3 letters, dash, 3 numbers)"
80
+ maxLength: 7
81
+ style:
82
+ textTransform: "uppercase"
83
+
84
+ data:
85
+ productCode: ""
86
+ ```
87
+
88
+ ## Complete Example
89
+
90
+ A comprehensive example showing different TextField configurations:
91
+
92
+ ```yaml
93
+ renderView:
94
+ - type: TextField
95
+ dataLocation: ~.username
96
+ label: "Username:"
97
+ placeholder: "Enter your username"
98
+ inputType: "text"
99
+ inputAttributes:
100
+ maxLength: 50
101
+ autoComplete: "username"
102
+ - type: TextField
103
+ dataLocation: ~.email
104
+ label: "Email Address:"
105
+ placeholder: "user@example.com"
106
+ inputType: "email"
107
+ inputAttributes:
108
+ required: true
109
+ - type: div
110
+ content:
111
+ - "Username: "
112
+ - ~.username
113
+ - type: div
114
+ content:
115
+ - "Email: "
116
+ - ~.email
117
+
118
+ data:
119
+ username: ""
120
+ email: ""
121
+ ```
122
+
123
+ ## Limitations
124
+
125
+ - No built-in validation beyond HTML5 input type validation
126
+ - No support for input masking or formatting
127
+ - No built-in error message display
128
+ - Template evaluation for `inputType` should return valid HTML input types
129
+ - No support for complex input patterns beyond HTML5 pattern attribute
@@ -0,0 +1,147 @@
1
+ renderView:
2
+ - type: Markdown
3
+ content: |
4
+ # TextField
5
+
6
+ The `TextField` component renders a single-line text input field using React Bootstrap. It supports various input types, template evaluation for dynamic content, and automatic data binding to the global data context.
7
+
8
+ ## Properties
9
+
10
+ - `dataLocation` (string, optional): Path to bind the field value in the data context
11
+ - `defaultFieldValue` (string, optional): Default value when no data is present
12
+ - `label` (string, optional): Field label text (supports template evaluation)
13
+ - `placeholder` (string, optional): Placeholder text (supports template evaluation)
14
+ - `inputType` (string, optional): HTML input type (default: "text", supports template evaluation)
15
+ - `attributes` (object, optional): Attributes applied to the Form.Group container
16
+ - `inputAttributes` (object, optional): Attributes applied directly to the input element
17
+ - `actions` (array, optional): Actions to execute based on field state
18
+
19
+ ## Data Management
20
+
21
+ The component automatically synchronizes its value with the global data context. When using `dataLocation`, the value is stored at the specified path. Without `dataLocation`, the value is stored in the template context using the component's `datafield`.
22
+
23
+ ## Input Types
24
+
25
+ The `inputType` property supports all HTML5 input types:
26
+ - `text` (default): Standard text input
27
+ - `email`: Email validation
28
+ - `password`: Masked password input
29
+ - `url`: URL validation
30
+ - `tel`: Telephone number input
31
+ - `search`: Search input with clear button
32
+
33
+ - type: RjBuildDescriber
34
+ title: "Basic TextField Usage"
35
+ description: "Simple text input with label and placeholder"
36
+ toDescribe:
37
+ renderView:
38
+ - type: TextField
39
+ dataLocation: ~.username
40
+ label: "Username:"
41
+ placeholder: "Enter your username"
42
+ - type: div
43
+ content:
44
+ - "Current value: "
45
+ - type: strong
46
+ content: ~.username
47
+ data:
48
+ username: ""
49
+
50
+ - type: RjBuildDescriber
51
+ title: "Different Input Types"
52
+ description: "TextField with various HTML5 input types"
53
+ toDescribe:
54
+ renderView:
55
+ - type: TextField
56
+ dataLocation: ~.email
57
+ label: "Email:"
58
+ placeholder: "user@example.com"
59
+ inputType: "email"
60
+ - type: TextField
61
+ dataLocation: ~.password
62
+ label: "Password:"
63
+ placeholder: "Enter password"
64
+ inputType: "password"
65
+ - type: TextField
66
+ dataLocation: ~.website
67
+ label: "Website:"
68
+ placeholder: "https://example.com"
69
+ inputType: "url"
70
+ - type: div
71
+ attributes:
72
+ style:
73
+ marginTop: "20px"
74
+ padding: "10px"
75
+ backgroundColor: "#f8f9fa"
76
+ borderRadius: "5px"
77
+ content:
78
+ - type: strong
79
+ content: "Current Values:"
80
+ - type: div
81
+ content:
82
+ - "Email: "
83
+ - ~.email
84
+ - type: div
85
+ content:
86
+ - "Password: "
87
+ - ~.password
88
+ - type: div
89
+ content:
90
+ - "Website: "
91
+ - ~.website
92
+ data:
93
+ email: ""
94
+ password: ""
95
+ website: ""
96
+
97
+ - type: RjBuildDescriber
98
+ title: "Input Attributes"
99
+ description: "TextField with custom input attributes and validation styling (pattern: ABC-123 format)"
100
+ toDescribe:
101
+ renderView:
102
+ - type: BsAlert
103
+ attributes:
104
+ variant: warning
105
+ content:
106
+ - type: strong
107
+ content: "Note: "
108
+ - "CSS styles are defined inline in this example for demonstration purposes. In practice, it is recommended to define these styles in an external CSS file for better maintainability."
109
+ - type: style
110
+ content: |
111
+ input[pattern]:valid {
112
+ border-color: #28a745;
113
+ box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
114
+ }
115
+ input[pattern]:invalid {
116
+ border-color: #dc3545;
117
+ box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
118
+ }
119
+ - type: TextField
120
+ dataLocation: ~.productCode
121
+ label: "Product Code:"
122
+ placeholder: "ABC-123"
123
+ inputAttributes:
124
+ pattern: "[A-Z]{3}-[0-9]{3}"
125
+ title: "Format: ABC-123 (3 letters, dash, 3 numbers)"
126
+ maxLength: 7
127
+ style:
128
+ textTransform: "uppercase"
129
+ - type: div
130
+ content:
131
+ - "Product Code: "
132
+ - ~.productCode
133
+ data:
134
+ productCode: ""
135
+
136
+ - type: Markdown
137
+ content: |
138
+ ## Limitations
139
+
140
+ - No built-in validation beyond HTML5 input type validation
141
+ - No support for input masking or formatting
142
+ - No built-in error message display
143
+ - Template evaluation for `inputType` should return valid HTML input types
144
+ - No support for complex input patterns beyond HTML5 pattern attribute
145
+
146
+ templates: {}
147
+ data: {}
@@ -0,0 +1,106 @@
1
+ # Form Elements Common Utilities
2
+
3
+ ## Introduction
4
+
5
+ The `formElementsCommon.jsx` file provides shared utilities for all form components in Reactive-JSON. These utilities handle data location resolution, path calculation, and default value management.
6
+
7
+ ## propsDataLocationToPathAndValue Function
8
+
9
+ This utility function is the core of form data management across all form components. It resolves data location and provides the current value and path for form field synchronization.
10
+
11
+ ### Parameters
12
+
13
+ - `currentPath` (string): The current path of the component in the template hierarchy
14
+ - `datafield` (string): The field name of the component (used for template-scoped data)
15
+ - `dataLocation` (string|undefined): The custom data location specified in the component
16
+ - `defaultValue` (any): The default value to use when no data is present
17
+ - `globalDataContext` (object): The global data context object
18
+ - `templateContext` (object): The template context object
19
+
20
+ ### Return Value
21
+
22
+ Returns an object with:
23
+ - `formData`: The current value of the form field
24
+ - `formDataPath`: The path array for updating the data
25
+
26
+ ### Data Location Resolution Logic
27
+
28
+ The function implements two data binding strategies:
29
+
30
+ #### 1. Custom Data Location
31
+ When `dataLocation` is provided:
32
+ - Evaluates the template value at the specified location
33
+ - Uses the resolved path for data updates
34
+ - Falls back to `defaultValue` if the location is undefined
35
+
36
+ #### 2. Template-Scoped Data
37
+ When no `dataLocation` is provided:
38
+ - Uses the component's `datafield` as the key
39
+ - Stores data in the template context under this key
40
+ - Automatically initializes with `defaultValue` if not present
41
+ - Creates the template data object if it doesn't exist
42
+
43
+ ### Usage Example
44
+
45
+ ```javascript
46
+ const {formData, formDataPath} = propsDataLocationToPathAndValue({
47
+ currentPath: "user.profile",
48
+ datafield: "username",
49
+ dataLocation: "~.user.name",
50
+ defaultValue: "",
51
+ globalDataContext,
52
+ templateContext,
53
+ });
54
+ ```
55
+
56
+ ## Implementation Details
57
+
58
+ ### Template Data Initialization
59
+ ```javascript
60
+ if ((templateContext.templateData[datafield] ?? undefined) === undefined) {
61
+ templateContext.templateData = (typeof templateContext.templateData === "object")
62
+ ? templateContext.templateData
63
+ : {};
64
+ templateContext.templateData[datafield] = defaultValue;
65
+ }
66
+ ```
67
+
68
+ ### Path Resolution
69
+ The function uses `dataLocationToPath` to convert template paths to array paths suitable for the `updateData` function in the global data context.
70
+
71
+ ## Benefits
72
+
73
+ - **Consistent data handling**: All form components use the same data resolution logic
74
+ - **Flexible binding**: Supports both explicit paths and automatic field naming
75
+ - **Safe initialization**: Handles missing data gracefully with default values
76
+ - **Template integration**: Works seamlessly with the template system
77
+ - **Performance**: Minimal overhead with efficient path resolution
78
+
79
+ ## Form Component Integration
80
+
81
+ All form components follow this pattern:
82
+
83
+ ```javascript
84
+ const {formData, formDataPath} = propsDataLocationToPathAndValue({
85
+ currentPath: path,
86
+ datafield: datafield,
87
+ dataLocation: props.dataLocation,
88
+ defaultValue: props.defaultFieldValue,
89
+ globalDataContext,
90
+ templateContext,
91
+ });
92
+
93
+ const onChange = (e) => {
94
+ globalDataContext.updateData(e.currentTarget.value, formDataPath);
95
+ };
96
+ ```
97
+
98
+ This ensures consistent behavior across TextField, NumberField, SelectField, CheckBoxField, TextAreaField, and DateField components.
99
+
100
+ ## Limitations
101
+
102
+ - Template data modification may not be the ideal approach (noted in code comments)
103
+ - No built-in validation of data location paths
104
+ - No automatic type conversion or validation
105
+ - Limited error handling for invalid paths or contexts
106
+ - Template data is stored in the template context, which may not persist across template changes