react-jsonschema-rxnt-extras 0.4.4 → 0.4.5

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.
package/README.md CHANGED
@@ -1,189 +1,189 @@
1
- [![npm version](https://badge.fury.io/js/react-jsonschema-rxnt-extras.svg)](https://badge.fury.io/js/react-jsonschema-rxnt-extras)
2
-
3
- This project takes [react-jsonschema-form-extras](https://github.com/RxNT/react-jsonschema-form-extras) and adds additional fields, specific to RxNT.
4
-
5
- # Catalogue
6
-
7
- - IMO field - field that allows to make request to IMO API, through RxNT network
8
- - Async typeahead - extension of general typeahead, that uses standard RxNT signature and request formats
9
-
10
- ### Table of Contents
11
-
12
- - [IMO field](#imo-field)
13
- - [Purpose](#purpose)
14
- - [Use](#use)
15
- - [Properties](#properties)
16
- - [Async typeahead](#async-typeahead)
17
- - [Async multi typeahead](#async-multi-typeahead)
18
-
19
- ---
20
-
21
- ## IMO field
22
-
23
- ### Purpose
24
-
25
- IMO field allows to query problems with IMO service in separate window.
26
-
27
- ### Use
28
-
29
- In accordance with requirements, there are 3 ways to trigger IMO search
30
-
31
- - with a [Composite array](https://github.com/RxNT/react-jsonschema-form-extras/#composite-array-field-compositearray)
32
- - with `inputField` `imo` which would display `Add` and optional `Free Text` button
33
- - with `inputField`: `imoFreeText` which would just display `Free Text` button
34
- - with [Collapsible add](https://github.com/RxNT/react-jsonschema-form-extras/#collapsible-fields-collapsible)
35
- - with `addElement` `imoAdd` in this case on pressing a plus in collapsible `IMO` modal will be displayed
36
-
37
- For example
38
-
39
- Composite array with `inputField` `imo`
40
-
41
- ```json
42
- {
43
- "ui:field": "compositeArray",
44
- "inputField": "imo",
45
- "arrayField": "table"
46
- }
47
- ```
48
-
49
- Composite array with `inputField` `imoFreeText`
50
-
51
- ```json
52
- {
53
- "ui:field": "compositeArray",
54
- "inputField": "imoFreeText",
55
- "arrayField": "table"
56
- }
57
- ```
58
-
59
- Collapsible with `imo`
60
-
61
- ```json
62
- {
63
- "ui:field": "collapsible",
64
- "collapse": {
65
- "collapsed": false,
66
- "addTo": "familyHistory",
67
- "addElement": "imoAdd",
68
- "field": "ObjectField"
69
- }
70
- }
71
- ```
72
-
73
- ### Properties
74
-
75
- For Composite array with `inputField` `imo`, the only property IMO accepts is
76
-
77
- - `freeText` boolean which enables freeText button on IMO field
78
-
79
- All other uses do not have specific configurations
80
-
81
- ## Async typeahead
82
-
83
- This component is minimalistic modification of [react-jsonschema-form-extras](https://github.com/RxNT/react-jsonschema-form-extras) component,
84
- which specifies predefined `search` string, that allows to query RxNT autocomplete data.
85
-
86
- ## Async multi typeahead
87
-
88
- This component extends the functionality of the standard async typeahead to support multiple selections. It's a wrapper around the multiTypeahead component from [react-jsonschema-form-extras](https://github.com/RxNT/react-jsonschema-form-extras) that integrates with RxNT's autocomplete API.
89
-
90
- ### Usage
91
-
92
- To use the async multi typeahead, set the `ui:field` to `asyncMultiTypeahead`:
93
-
94
- ```json
95
- {
96
- "ui:field": "asyncMultiTypeahead",
97
- "asyncMultiTypeahead": {
98
- "url": "http://your-api-endpoint/search",
99
- "queryKey": "name",
100
- "optionsPath": "Results",
101
- "labelTemplate": "{Name}",
102
- "valueKeys": ["Id", "Name", "Code", "Description"],
103
- "label": "Search Items",
104
- "placeholder": "Search and select multiple items..."
105
- }
106
- }
107
- ```
108
-
109
- ### Properties
110
-
111
- The component accepts the following configuration options in the `asyncMultiTypeahead` key:
112
-
113
- - `url` (string): The API endpoint to search for options
114
- - `queryKey` (string): The query parameter name to send the search term (e.g., "name")
115
- - `optionsPath` (string): The path in the API response where the options array is located
116
- - `labelTemplate` (string): Template for displaying options, using {FieldName} syntax
117
- - `valueKeys` (array): Array of field names to extract from selected items
118
- - `label` (string): Label for the field
119
- - `placeholder` (string): Placeholder text for the input
120
-
121
- The search function is automatically configured to use RxNT's autocomplete API format.
122
-
123
- ### Styling
124
-
125
- The component includes custom styling to remove Material-UI input borders and focus states for better integration with RxNT's design system. These styles are defined in the `rxnt-extras.css` file under the `.async-multi-typeahead-wrapper` class.
126
-
127
- ```
128
- !!! WARNING
129
- IMO and AsyncTypeahead rely on window variables for Authentication, provided by the caller
130
- - `encounterTemplateV2User` user data
131
- - `encounterTemplateV2EncounterInfo` encounter data
132
- You need to have them in the scope in order for IMO to work properly
133
- ```
134
-
135
- ## TableWithSearchAdd
136
-
137
- This component is to add the new records to the table through the custom AddElement(Popup) from custom collapsible/SearchField
138
- `ui:field` should be [tableWithSearchAdd]
139
- `tableWithSearchAdd` new attribute to mention the AddElement(Popup/Dropdown etc)
140
- Collapsible with `procedureCode POPUP as AddElement`
141
-
142
- ```json
143
- {
144
- "table": {
145
- "tableCols": [
146
- {
147
- "dataField": "code",
148
- "columnWidth": "25%",
149
- "width": "40%",
150
- "field": "asyncTypeahead",
151
- "editable": false,
152
- "uiSchema": {
153
- "focusOnMount": true,
154
- "asyncTypeahead": {
155
- "placeholder": "CPT code or description",
156
- "url": "https://jsonplaceholder.typicode.com/todos",
157
- "mapping": {
158
- "code": "userId",
159
- "description": "title"
160
- },
161
- "minLength": 1,
162
- "labelKey": {
163
- "fields": ["userId", "title"],
164
- "separator": " - "
165
- },
166
- "className": "rectangle diagnosisTypeahead"
167
- }
168
- }
169
- },
170
- {
171
- "dataField": "description",
172
- "columnWidth": "60%",
173
- "width": "50%",
174
- "editable": false
175
- }
176
- ],
177
- "focusOnAdd": 0,
178
- "hover": true
179
- },
180
- "ui:options": {
181
- "label": false
182
- },
183
- "classNames": "col-md-12 ",
184
- "ui:field": "tableWithSearchAdd",
185
- "tableWithSearchAdd": {
186
- "addElement": "procedureCode"
187
- }
188
- }
189
- ```
1
+ [![npm version](https://badge.fury.io/js/react-jsonschema-rxnt-extras.svg)](https://badge.fury.io/js/react-jsonschema-rxnt-extras)
2
+
3
+ This project takes [react-jsonschema-form-extras](https://github.com/RxNT/react-jsonschema-form-extras) and adds additional fields, specific to RxNT.
4
+
5
+ # Catalogue
6
+
7
+ - IMO field - field that allows to make request to IMO API, through RxNT network
8
+ - Async typeahead - extension of general typeahead, that uses standard RxNT signature and request formats
9
+
10
+ ### Table of Contents
11
+
12
+ - [IMO field](#imo-field)
13
+ - [Purpose](#purpose)
14
+ - [Use](#use)
15
+ - [Properties](#properties)
16
+ - [Async typeahead](#async-typeahead)
17
+ - [Async multi typeahead](#async-multi-typeahead)
18
+
19
+ ---
20
+
21
+ ## IMO field
22
+
23
+ ### Purpose
24
+
25
+ IMO field allows to query problems with IMO service in separate window.
26
+
27
+ ### Use
28
+
29
+ In accordance with requirements, there are 3 ways to trigger IMO search
30
+
31
+ - with a [Composite array](https://github.com/RxNT/react-jsonschema-form-extras/#composite-array-field-compositearray)
32
+ - with `inputField` `imo` which would display `Add` and optional `Free Text` button
33
+ - with `inputField`: `imoFreeText` which would just display `Free Text` button
34
+ - with [Collapsible add](https://github.com/RxNT/react-jsonschema-form-extras/#collapsible-fields-collapsible)
35
+ - with `addElement` `imoAdd` in this case on pressing a plus in collapsible `IMO` modal will be displayed
36
+
37
+ For example
38
+
39
+ Composite array with `inputField` `imo`
40
+
41
+ ```json
42
+ {
43
+ "ui:field": "compositeArray",
44
+ "inputField": "imo",
45
+ "arrayField": "table"
46
+ }
47
+ ```
48
+
49
+ Composite array with `inputField` `imoFreeText`
50
+
51
+ ```json
52
+ {
53
+ "ui:field": "compositeArray",
54
+ "inputField": "imoFreeText",
55
+ "arrayField": "table"
56
+ }
57
+ ```
58
+
59
+ Collapsible with `imo`
60
+
61
+ ```json
62
+ {
63
+ "ui:field": "collapsible",
64
+ "collapse": {
65
+ "collapsed": false,
66
+ "addTo": "familyHistory",
67
+ "addElement": "imoAdd",
68
+ "field": "ObjectField"
69
+ }
70
+ }
71
+ ```
72
+
73
+ ### Properties
74
+
75
+ For Composite array with `inputField` `imo`, the only property IMO accepts is
76
+
77
+ - `freeText` boolean which enables freeText button on IMO field
78
+
79
+ All other uses do not have specific configurations
80
+
81
+ ## Async typeahead
82
+
83
+ This component is minimalistic modification of [react-jsonschema-form-extras](https://github.com/RxNT/react-jsonschema-form-extras) component,
84
+ which specifies predefined `search` string, that allows to query RxNT autocomplete data.
85
+
86
+ ## Async multi typeahead
87
+
88
+ This component extends the functionality of the standard async typeahead to support multiple selections. It's a wrapper around the multiTypeahead component from [react-jsonschema-form-extras](https://github.com/RxNT/react-jsonschema-form-extras) that integrates with RxNT's autocomplete API.
89
+
90
+ ### Usage
91
+
92
+ To use the async multi typeahead, set the `ui:field` to `asyncMultiTypeahead`:
93
+
94
+ ```json
95
+ {
96
+ "ui:field": "asyncMultiTypeahead",
97
+ "asyncMultiTypeahead": {
98
+ "url": "http://your-api-endpoint/search",
99
+ "queryKey": "name",
100
+ "optionsPath": "Results",
101
+ "labelTemplate": "{Name}",
102
+ "valueKeys": ["Id", "Name", "Code", "Description"],
103
+ "label": "Search Items",
104
+ "placeholder": "Search and select multiple items..."
105
+ }
106
+ }
107
+ ```
108
+
109
+ ### Properties
110
+
111
+ The component accepts the following configuration options in the `asyncMultiTypeahead` key:
112
+
113
+ - `url` (string): The API endpoint to search for options
114
+ - `queryKey` (string): The query parameter name to send the search term (e.g., "name")
115
+ - `optionsPath` (string): The path in the API response where the options array is located
116
+ - `labelTemplate` (string): Template for displaying options, using {FieldName} syntax
117
+ - `valueKeys` (array): Array of field names to extract from selected items
118
+ - `label` (string): Label for the field
119
+ - `placeholder` (string): Placeholder text for the input
120
+
121
+ The search function is automatically configured to use RxNT's autocomplete API format.
122
+
123
+ ### Styling
124
+
125
+ The component includes custom styling to remove Material-UI input borders and focus states for better integration with RxNT's design system. These styles are defined in the `rxnt-extras.css` file under the `.async-multi-typeahead-wrapper` class.
126
+
127
+ ```
128
+ !!! WARNING
129
+ IMO and AsyncTypeahead rely on window variables for Authentication, provided by the caller
130
+ - `encounterTemplateV2User` user data
131
+ - `encounterTemplateV2EncounterInfo` encounter data
132
+ You need to have them in the scope in order for IMO to work properly
133
+ ```
134
+
135
+ ## TableWithSearchAdd
136
+
137
+ This component is to add the new records to the table through the custom AddElement(Popup) from custom collapsible/SearchField
138
+ `ui:field` should be [tableWithSearchAdd]
139
+ `tableWithSearchAdd` new attribute to mention the AddElement(Popup/Dropdown etc)
140
+ Collapsible with `procedureCode POPUP as AddElement`
141
+
142
+ ```json
143
+ {
144
+ "table": {
145
+ "tableCols": [
146
+ {
147
+ "dataField": "code",
148
+ "columnWidth": "25%",
149
+ "width": "40%",
150
+ "field": "asyncTypeahead",
151
+ "editable": false,
152
+ "uiSchema": {
153
+ "focusOnMount": true,
154
+ "asyncTypeahead": {
155
+ "placeholder": "CPT code or description",
156
+ "url": "https://jsonplaceholder.typicode.com/todos",
157
+ "mapping": {
158
+ "code": "userId",
159
+ "description": "title"
160
+ },
161
+ "minLength": 1,
162
+ "labelKey": {
163
+ "fields": ["userId", "title"],
164
+ "separator": " - "
165
+ },
166
+ "className": "rectangle diagnosisTypeahead"
167
+ }
168
+ }
169
+ },
170
+ {
171
+ "dataField": "description",
172
+ "columnWidth": "60%",
173
+ "width": "50%",
174
+ "editable": false
175
+ }
176
+ ],
177
+ "focusOnAdd": 0,
178
+ "hover": true
179
+ },
180
+ "ui:options": {
181
+ "label": false
182
+ },
183
+ "classNames": "col-md-12 ",
184
+ "ui:field": "tableWithSearchAdd",
185
+ "tableWithSearchAdd": {
186
+ "addElement": "procedureCode"
187
+ }
188
+ }
189
+ ```