lforms 29.3.1 → 33.2.0

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 (116) hide show
  1. package/CHANGELOG.md +256 -0
  2. package/README.md +97 -14
  3. package/changed-features.md +99 -0
  4. package/dist/lforms/LICENSE.md +70 -0
  5. package/dist/lforms/README.md +100 -0
  6. package/dist/lforms/fhir/R4/lformsFHIR.min.js +2 -0
  7. package/dist/lforms/fhir/R4/lformsFHIR.min.js.map +1 -0
  8. package/dist/lforms/fhir/STU3/lformsFHIR.min.js +2 -0
  9. package/dist/lforms/fhir/STU3/lformsFHIR.min.js.map +1 -0
  10. package/dist/lforms/fhir/lformsFHIRAll.min.js +2 -0
  11. package/dist/lforms/fhir/lformsFHIRAll.min.js.map +1 -0
  12. package/dist/lforms/webcomponent/assets/lib/zone.min.js +134 -0
  13. package/dist/lforms/webcomponent/down_arrow_gray_10_10.png +0 -0
  14. package/dist/lforms/webcomponent/favicon.ico +0 -0
  15. package/dist/lforms/webcomponent/index.html +9 -0
  16. package/dist/lforms/webcomponent/lhc-forms.js +2471 -0
  17. package/dist/lforms/webcomponent/magnifying_glass.png +0 -0
  18. package/dist/lforms/webcomponent/main.js +2464 -0
  19. package/dist/lforms/webcomponent/main.js.map +1 -0
  20. package/dist/lforms/webcomponent/polyfills.js +2 -0
  21. package/dist/lforms/webcomponent/polyfills.js.map +1 -0
  22. package/dist/lforms/webcomponent/runtime.js +2 -0
  23. package/dist/lforms/webcomponent/runtime.js.map +1 -0
  24. package/dist/lforms/webcomponent/scripts.js +3 -0
  25. package/dist/lforms/webcomponent/scripts.js.map +1 -0
  26. package/dist/lforms/webcomponent/styles.css +3 -0
  27. package/dist/lforms/webcomponent/styles.css.map +1 -0
  28. package/form_definition.md +382 -0
  29. package/lforms-33.2.0.tgz +0 -0
  30. package/package.json +94 -88
  31. package/r4-support.md +147 -0
  32. package/sdc-support.md +127 -0
  33. package/app/.npmignore +0 -3
  34. package/app/images/blank.gif +0 -0
  35. package/app/images/signal-stop.png +0 -0
  36. package/app/index.html +0 -10
  37. package/app/lforms.js +0 -56
  38. package/app/lforms.tpl.js +0 -964
  39. package/app/scripts/angular-packages.js +0 -11
  40. package/app/scripts/bootstrap-decorators.js +0 -31
  41. package/app/scripts/bower-index.js +0 -14
  42. package/app/scripts/fhir/R4/export.js +0 -33
  43. package/app/scripts/fhir/R4/fhirRequire.js +0 -36
  44. package/app/scripts/fhir/R4/lformsFHIR.js +0 -27260
  45. package/app/scripts/fhir/R4/sdc-export.js +0 -455
  46. package/app/scripts/fhir/R4/sdc-import.js +0 -483
  47. package/app/scripts/fhir/STU3/export.js +0 -27
  48. package/app/scripts/fhir/STU3/fhirRequire.js +0 -36
  49. package/app/scripts/fhir/STU3/lformsFHIR.js +0 -27291
  50. package/app/scripts/fhir/STU3/sdc-export.js +0 -493
  51. package/app/scripts/fhir/STU3/sdc-import.js +0 -494
  52. package/app/scripts/fhir/diagnostic-report.js +0 -707
  53. package/app/scripts/fhir/export-common.js +0 -209
  54. package/app/scripts/fhir/expression-processor.js +0 -670
  55. package/app/scripts/fhir/extensions/rendering-style.js +0 -23
  56. package/app/scripts/fhir/fhir-common.js +0 -3
  57. package/app/scripts/fhir/obs-prepop.mjs +0 -97
  58. package/app/scripts/fhir/runtime-common.js +0 -33
  59. package/app/scripts/fhir/sdc-common.js +0 -334
  60. package/app/scripts/fhir/sdc-export-common.js +0 -1046
  61. package/app/scripts/fhir/sdc-import-common.js +0 -1343
  62. package/app/scripts/fhir/versions.js +0 -8
  63. package/app/scripts/index.js +0 -20
  64. package/app/scripts/lforms-config.js +0 -12
  65. package/app/scripts/lforms-constants.js +0 -10
  66. package/app/scripts/lforms-controllers.js +0 -1196
  67. package/app/scripts/lforms-directives.js +0 -424
  68. package/app/scripts/lforms-index.js +0 -20
  69. package/app/scripts/lib/cross_browser.js +0 -21
  70. package/app/scripts/lib/lforms-data.js +0 -3591
  71. package/app/scripts/lib/lforms-hl7.js +0 -525
  72. package/app/scripts/lib/lforms-util.js +0 -1122
  73. package/app/scripts/lib/lforms-validate.js +0 -277
  74. package/app/scripts/lib/polyfill.js +0 -81
  75. package/app/scripts/themeList.js +0 -17
  76. package/app/styles/lforms.css +0 -1219
  77. package/app/styles/redmond-theme/README.txt +0 -2
  78. package/app/styles/redmond-theme/images/ui-bg_glass_75_d0e5f5_1x400.png +0 -0
  79. package/app/styles/redmond-theme/images/ui-bg_glass_85_dfeffc_1x400.png +0 -0
  80. package/app/styles/redmond-theme/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  81. package/app/styles/redmond-theme/images/ui-bg_gloss-wave_55_5c9ccc_500x100.png +0 -0
  82. package/app/styles/redmond-theme/images/ui-bg_inset-hard_100_f5f8f9_1x100.png +0 -0
  83. package/app/styles/redmond-theme/images/ui-bg_inset-hard_100_fcfdfd_1x100.png +0 -0
  84. package/app/styles/redmond-theme/images/ui-icons_217bc0_256x240.png +0 -0
  85. package/app/styles/redmond-theme/images/ui-icons_2e83ff_256x240.png +0 -0
  86. package/app/styles/redmond-theme/images/ui-icons_469bdd_256x240.png +0 -0
  87. package/app/styles/redmond-theme/images/ui-icons_6da8d5_256x240.png +0 -0
  88. package/app/styles/redmond-theme/images/ui-icons_cd0a0a_256x240.png +0 -0
  89. package/app/styles/redmond-theme/images/ui-icons_d8e7f3_256x240.png +0 -0
  90. package/app/styles/redmond-theme/images/ui-icons_f9bd01_256x240.png +0 -0
  91. package/app/styles/redmond-theme/jquery-ui.css +0 -1311
  92. package/app/styles/redmond-theme/jquery-ui.min.css +0 -7
  93. package/app/styles/redmond-theme/theme.css +0 -443
  94. package/app/styles/themes.css +0 -1541
  95. package/app/styles/themes.css.map +0 -9
  96. package/app/styles/themes.scss +0 -411
  97. package/app/version.json +0 -1
  98. package/app/views/partials/attachment.html +0 -38
  99. package/app/views/partials/field-answers.html +0 -67
  100. package/app/views/partials/field-units.html +0 -24
  101. package/app/views/partials/form-controls.html +0 -19
  102. package/app/views/partials/form-header.html +0 -35
  103. package/app/views/partials/form-options.html +0 -50
  104. package/app/views/partials/form-title.html +0 -20
  105. package/app/views/partials/form-view.html +0 -13
  106. package/app/views/partials/item-options.html +0 -48
  107. package/app/views/partials/item.html +0 -126
  108. package/app/views/partials/itemPrefixAndText.html +0 -4
  109. package/app/views/partials/layout-horizontal.html +0 -156
  110. package/app/views/partials/layout-matrix.html +0 -145
  111. package/app/views/partials/popover-content.html +0 -1
  112. package/app/views/partials/repeating-button.html +0 -16
  113. package/app/views/partials/table-item.html +0 -30
  114. package/app/views/partials/template-table.html +0 -69
  115. package/app/views/partials/uib-popover-templates/uib-popover-template.html +0 -13
  116. package/app/views/partials/uib-popover-templates/uib-popover.html +0 -11
package/CHANGELOG.md CHANGED
@@ -2,6 +2,262 @@
2
2
 
3
3
  This project follows [Semantic Versioning](http://semver.org/).
4
4
 
5
+ ## [33.2.0] 2022-01-06
6
+ ### Added
7
+ - Added a template option to control whether to display scores along
8
+ with texts for answers that have scores.
9
+
10
+ ## [33.1.2] 2022-12-23
11
+ ### Fixed
12
+ - FHIR Expressions were being run on form load once per item with an
13
+ autocompletion list. It now will only run an extra time (on form load) once
14
+ for each item of type quantity which has a unit list, which is still more
15
+ often that should be needed, but this fix by itself should help speed up the
16
+ loading of many forms.
17
+
18
+ ## [33.1.1] 2022-12-13
19
+ ### Fixed
20
+ - Fixed a bug that hidden items in a questionnaire are displayed when
21
+ a questionnaire response is loaded/merged into the questionnaire.
22
+
23
+ ## [33.1.0] 2022-11-30
24
+ ### Added
25
+ - Added support for answerExpression on items whose types are string, integer,
26
+ date and time.
27
+ ### Fixed
28
+ - Fixed a configuration issue in webpack dev server that FHIR js files
29
+ failed to load through a proxy in dev mode.
30
+
31
+ ## [33.0.0] 2022-11-15
32
+ ### Updated
33
+ - Updated angular from v12 to v14
34
+ ### Changed
35
+ - Removed the support for IE 11.
36
+ - Only ES2017 files (no ES5 files) are in the build files.
37
+ The concatnated js file name is now lhc-forms.js, not
38
+ lhc-forms.es5.js or lhc-forms.es2015.js
39
+ - Made item.dataType in lforms internal format required (a breaking change).
40
+ - Made initial[x] values and the initialSelected on answerOption both work
41
+ when the item.type is choice or open-choice.
42
+ ### Added
43
+ - Added support for string, date, time and integer values in answerOption (R4)
44
+ and option (STU3), including the support for related extensions (optionPrefix,
45
+ ordinalValue, and itemControl) and the initial[x] values.
46
+ ### Fixed
47
+ - Fixed a bug in a custom cypress command.
48
+ - Fixed a bug in importing a DiagnosticReport resource.
49
+
50
+ ## [32.2.3] 2022-11-03
51
+ ### Fixed
52
+ - When running e2e tests, webpack-dev-server now serves the files so that
53
+ changes to source files are more quickly recompiled and updated for the test
54
+ runner.
55
+
56
+ ## [32.2.2] 2022-10-25
57
+ ### Fixed
58
+ - Fixed a bug in the construction of the URL for a FHIR ValueSet $expand
59
+ operation, though there was already a work-around in place, so the only result
60
+ was a single failed network call logged to the console (which then can cause a
61
+ problem for Cypress tests).
62
+ ### Updated
63
+ - Cypress has been updated to version 10.
64
+
65
+ ## [32.2.1] 2022-10-20
66
+ ### Fixed
67
+ - Fixed a bug that enableWhen does not work on the values calculated from FHIRPath
68
+ expressions.
69
+
70
+ ## [32.2.0] 2022-10-18
71
+ ### Added
72
+ - Added support the currenly published URI for the preferred terminology server
73
+ extension, though that URI will be changing
74
+ (https://jira.hl7.org/browse/FHIR-23977).
75
+
76
+ ## [32.1.0] 2022-09-18
77
+ ### Added
78
+ - Added support the entryFormat extension
79
+
80
+ ## [32.0.3] 2022-09-12
81
+ ### Changed
82
+ - Removed item._modifiedAnswers and use item.answers directly.
83
+ - Removed fast-deep-equal package that is causing failed e2e tests in cypress.
84
+ ### Fixed
85
+ - Fixed a bug that a user typed value on open-choice item is not set as a string value.
86
+
87
+ ## [32.0.2] 2022-09-07
88
+ ### Fixed
89
+ - Moved the URI for the custom FHIR extension lforms generates to store
90
+ the "externallyDefined" setting out of the HL7 namespace.
91
+ - Minor refactoring of the SDC import code, which should not impact users,
92
+ except that for STU3 item.definition will no longer be lost if you convert to
93
+ LForms format and and back to FHIR. (The R4 import did not have that issue.)
94
+
95
+ ## [32.0.1] 2022-08-31
96
+ ### Fixed
97
+ - Updated fhirpath.js to 3.0.0 to get a fix for
98
+ https://github.com/lhncbc/lforms/issues/102
99
+
100
+ ## [32.0.0] 2022-08-30
101
+ ### Changed
102
+ - Removed a feature in which the autocompletion list fields would default to
103
+ the answer list value if there were just one answer in the list.
104
+ - Changed the implementation on how the data changes in questionnaire data are handled.
105
+ - Added the active row indicator for the radio buttons and checkboxes.
106
+
107
+ ## [31.0.1] 2022-08-26
108
+ ### Fixed
109
+ - A very minor fix to the formatting of the form title, probably not visible to
110
+ a user, but which was causing a test to fail in another package.
111
+
112
+ ## [31.0.0] 2022-08-04
113
+ ### Changed
114
+ - FHIR Quantities with a comparator can no longer be stored or loaded into a
115
+ Questionnaire. This change is in line with
116
+ https://jira.hl7.org/browse/FHIR-37468.
117
+ ### Fixed
118
+ - Fixes for handling Quantities in expressions.
119
+
120
+ ## [30.4.2] 2022-07-07
121
+ ### Changed
122
+ - Added a button on the test page (test/pages/lforms_testpage.html) to batch convert lforms
123
+ to FHIR questionnaires or vice versa, where both input and output are zip files
124
+
125
+ ## [30.4.1] 2022-06-24
126
+ ### Fixed
127
+ - Fixed a bug that FHIRPath expressions are not calculated on newly added
128
+ repeating items.
129
+ - Fixed a bug that enableWhen is not working on prepopulated answers.
130
+
131
+ ## [30.4.0] 2022-06-13
132
+ ### Added
133
+ - The beginnings of support to show error messages for individual fields.
134
+
135
+ ## [30.3.0] 2022-05-19
136
+ ### Added
137
+ - Added support for answerOption.initialSelected in R4 Questionnaire
138
+
139
+ ## [30.2.0] 2022-05-18
140
+ ### Changed
141
+ - Updated angular to v12 and ng-zorro-antd to v12.
142
+
143
+ ## [30.1.7] 2022-05-17
144
+ ### Fixed
145
+ - Fixed a bug that the radio button of "Other" of the CWE typed items lost
146
+ its checked state when users typed in the input field.
147
+
148
+ ## [30.1.6] 2022-05-02
149
+ ### Fixed
150
+ - Off-list string values from an open-choice field are now usable in an
151
+ expression for another open-choice field.
152
+
153
+ ## [30.1.5] 2022-04-22
154
+ ### Fixed
155
+ - Support for multiple values coming from intialExpression or calculateExpresion
156
+ on fields that are of type string or coding.
157
+
158
+ ## [30.1.4] 2022-04-20
159
+ ### Fixed
160
+ - Fixed a bug that the initial value of boolean type was not imported correctly
161
+ when it was false.
162
+
163
+ ## [30.1.3] 2022-04-04
164
+ ### Changed
165
+ - Adjusted the styles of readonly items
166
+
167
+ ## [30.1.2] 2022-03-30
168
+ ### Fixed
169
+ - Fixed a bug that observations were extracted from items that were either hidden or
170
+ had no values.
171
+ - Fixed a bug that boolean value false was not extracted correctly.
172
+
173
+ ## [30.1.1] 2022-03-30
174
+ ### Fixed
175
+ - Fixed a performance issue in the initial loading of a Questionnaire when it
176
+ contains a lot of choice and/or open-choice items.
177
+ - Fixed a bug that the values of date or dateTime items in a repeating group
178
+ are not checked when adding a new repeating group.
179
+ - Fixed a style issue for the first item in a group.
180
+
181
+ ## [30.1.0] 2022-03-25
182
+ ### Added
183
+ - Added options to hide tree line styles, indentation or repetition numbers.
184
+
185
+ ## [30.0.1] 2020-03-22
186
+ ### Fixed
187
+ - Fixed answerExpression and calculatedExpression processing so that for list
188
+ fields, both answers and answer lists can be set by an expression that depends
189
+ on the answers of another field.
190
+
191
+ ## [30.0.0] 2020-03-08
192
+ Official release of the new Web Component version of lforms. See a list of changed
193
+ features in changed-features.md.
194
+ ### Fixed
195
+ - Fixed a minor style issue
196
+ ### Changed
197
+ - Code refactoring and clean up.
198
+ - Made most commands in package.json work on Windows.
199
+
200
+
201
+ ## [30.0.0-beta.9] 2022-02-24
202
+ ### Fixed
203
+ - Fixed a bug that the user saved data was overwritten by the values from initialExpression.
204
+ ### Changed
205
+ - Added back the support of a CSS selector as the element parameter for LForms.Util functions
206
+ such as getFormData, getUserData and getFormFHIRData.
207
+ - Removed the redundant resourceType parameter in the LForms.Util.mergeFHIRDataIntoLForms function.
208
+
209
+ ## [30.0.0-beta.8] 2022-02-17
210
+ ### Fixed
211
+ - Fixed a bug that saved user data in a form are lost when answer lists are updated
212
+ by FHIRPath expression.
213
+
214
+ ## [30.0.0-beta.7] 2022-02-17
215
+ ### Added
216
+ - Support for the newer launchContext "name" data type, valueCoding. For
217
+ backward compatibility, valueId is still supported.
218
+ (https://build.fhir.org/ig/HL7/sdc/StructureDefinition-sdc-questionnaire-launchContext.html)
219
+
220
+ ## [30.0.0-beta.6] 2022-02-15
221
+ ### Added
222
+ - Support for arbitrary launchContext names and resource types. A second
223
+ parameter has been added to LForms.Util.setFHIRContext which is a map between
224
+ launchContext variable names and FHIR resource instances (as objects). This
225
+ allows an application that is familiar with a partictular Questionnaire
226
+ to pass in the needed resources.
227
+
228
+ ## [30.0.0-beta.5] 2022-02-09
229
+ ### Fixed
230
+ - Fixed a a bug that repeating rows in horizontal table (gtable) are not added
231
+ at the end of the table.
232
+ ### Added
233
+ - Added the support of the questionnaire-hidden extension on the horizontal tables
234
+ (gtable) and the matrix (table).
235
+
236
+ ## [30.0.0-beta.4] 2022-02-04
237
+ ### Fixed
238
+ - calculatedExpression no longer forces fields to be read-only.
239
+
240
+ ## [30.0.0-beta.3] 2022-01-25
241
+ ### Added
242
+ - Added an onError event, that returns an error when FHIR resources
243
+ fail to load, or when there is an exception during the initialization.
244
+ - Added cypress for e2e tests.
245
+
246
+ ## [30.0.0-beta.2] 2022-01-10
247
+ ### Changed
248
+ - Removed locale files from moment.js
249
+ - Code refactoring on the initial release.
250
+
251
+ ## [30.0.0-beta.1] 2021-12-15
252
+ ### Fixed
253
+ - Fixed a style issue on items with a single unit.
254
+
255
+ ## [30.0.0-beta.0] 2021-12-10
256
+ ### Changed
257
+ - Included the initial release of the Web Component version of the LHC-Forms
258
+ widget in the "next" directory. This will be reorganized out of the "next"
259
+ directory prior to the non-beta release.
260
+
5
261
  ## [29.3.1] 2021-10-20
6
262
  ### Fixed
7
263
  - If a form contained an attachment type question, hitting enter in another
package/README.md CHANGED
@@ -1,38 +1,121 @@
1
1
  ## What is LForms?
2
2
 
3
3
  [LForms](http://lhncbc.github.io/lforms/), a.k.a. LHC-Forms, is a feature-rich,
4
- open-source widget that creates input forms, based on definition files, for
5
- Web-based applications. In addition to its native form-definition format, it
6
- partially supports the HL7 FHIR Questionnaire standard (SDC profile), and work
4
+ open-source Web Component that creates input forms, based on definition files,
5
+ for Web-based applications. In addition to its native form-definition format,
6
+ it partially supports the HL7 FHIR Questionnaire standard (SDC profile), and work
7
7
  is in progress to expand that support.
8
8
 
9
9
  It is being developed by the Lister Hill National Center for Biomedical
10
10
  Communications ([LHNCBC](https://lhncbc.nlm.nih.gov)), National Library of
11
11
  Medicine ([NLM](https://www.nlm.nih.gov)), part of the National Institutes of
12
- Health ([NIH](https://www.nih.gov)), with the collaboration and support from the
13
- [Regenstrief Institute](https://www.regenstrief.org/), Inc. and the
12
+ Health ([NIH](https://www.nih.gov)), with the collaboration and support from
13
+ the [Regenstrief Institute](https://www.regenstrief.org/), Inc. and the
14
14
  [LOINC](https://loinc.org/) Committee.
15
15
 
16
16
  For features and demos, please visit the [project
17
17
  page](http://lhncbc.github.io/lforms/).
18
18
 
19
19
  ## Licensing and Copyright Notice
20
+
20
21
  See [LICENSE.md](LICENSE.md).
21
22
 
22
23
  ## Customizing and Contributing
24
+
23
25
  If you wish to revise this package, the following steps will allow you to make
24
26
  changes and test them:
25
27
 
26
- * Install Node.js (version 10 is what we are currently using, but it should work with later versions)
27
- * Clone the lforms repository and cd to its directory
28
- * npm ci
29
- * Make sure node_modules/.bin is in your path
30
- * bower install
31
- * npm run build
32
- * npm run start # starts the app we use for testing
33
- * npm run test # runs the tests
34
- * Templates are in app/views; CSS in app/styles
28
+ - Install Node.js (version 14 is what we are currently using, but it should work
29
+ with later versions)
30
+ - Clone the lforms repository and cd to its directory
31
+ - `source bashrc.lforms` (make sure node dir is available at ~/)
32
+ - `npm ci`
33
+ - `source bashrc.lforms` # to add node_modules/.bin to your path
34
+ - `npm run build` # build both FHIR libs and LHC-Forms web component
35
+ - `npm run start` # starts the app we use for testing
36
+ - `npm run test` # runs the unit tests and e2e tests
35
37
 
36
38
  If you are planning to contribute new functionality back to us, please
37
39
  coordinate with us, so that the new code is in the right places, and so that
38
40
  you don't accidentally add something that we are also working on.
41
+
42
+ ## Development server
43
+
44
+ - Run `npm run start` for a dev server. Navigate to `http://localhost:4200/`.
45
+ The app will automatically reload if you change any of the source files.
46
+
47
+ - Run `npm run start-public` if you need to access to the dev server from a
48
+ different machine. For example, to run Narrator from a Windows PC.
49
+
50
+ ## Build
51
+
52
+ - Run `npm run build` to build the project and generate a production version of
53
+ the js files, which are much smaller than the development version. It
54
+ generates an ES2017 version of the js files under dist/lforms. For details on
55
+ the files to load, see ["Usng the LHC-Forms Web Component"](#using).
56
+ The `dist` directory is deleted and recreated during the process.
57
+
58
+ The build also concatenates all the js files (except for zone.min.js and the
59
+ FHIR support files) into a single `lhc-forms.js` file, and it works,
60
+ but we don't currently recommend their use because the
61
+ source maps don't work with these files. Also, there is a dist/webcomponent
62
+ directory that is created with a copy of the files in dist/lforms, but that
63
+ is only needed for the tests.
64
+
65
+ ## Running tests
66
+
67
+ 1. Run `npm run test` to run unit tests and e2e tests, which also copies the
68
+ FHIR lib files and built files in places for testing.
69
+
70
+ ## Running unit tests
71
+
72
+ 1. Run `npm run test:unit` to execute the unit tests via
73
+ [Karma](https://karma-runner.github.io).
74
+
75
+ ## Running end-to-end tests
76
+
77
+ 1. Run `npm run test:e2e` to execute the end-to-end tests via
78
+ [Cypress](https://www.cypress.io/). The e2e tests are configured to use Chrome.
79
+
80
+ ## <a id="using">Using the LHC-Forms Web Component</a>
81
+
82
+ There are several script files to load. If you are building this, these files
83
+ will be under `dist/lforms`. If you are using the pre-built versions from
84
+ https://clinicaltables.nlm.nih.gov/lforms-versions, then the file paths below
85
+ are relative to those versioned directories.
86
+
87
+ 1. `webcomponent/styles.css`
88
+
89
+ You need to include the following files in your project:
90
+
91
+ 1. `webcomponent/styles.css`
92
+ 2. `webcomponent/assets/lib/zone.min.js` (unless you already have zone.min.js
93
+ on the page)
94
+ 3. `webcomponent/scripts.js`
95
+ 4. `webcomponent/runtime.js`
96
+ 5. `webcomponent/polyfills.js`
97
+ 6. `webcomponent/main.js`
98
+ 7. _One_ of the FHIR support library files, assuming you are planning to use
99
+ FHIR Questionnaires:
100
+ - `fhir/lformsFHIRAll.min.js`
101
+ - `fhir/R4/lformsFHIR.min.js`
102
+ - `fhir/STU3/lformsFHIR.min.js`
103
+
104
+ There is an example of an app using these files at
105
+ https://lhcforms.nlm.nih.gov/lforms-fhir-app/.
106
+ For details about how to work with this library, and for information about an
107
+ announcements list, see the [documentation](https://lhncbc.github.io/lforms/).
108
+
109
+ ## <a id="npm-package">lforms npm package</a>
110
+
111
+ A complete npm package that you can use with import/require statements in your
112
+ code is not ready yet. The current lforms npm package only contains built files
113
+ in `/dist/lforms` directory. You can use those files as described in above
114
+ section [Using the LHC-Forms Web Component](#using).
115
+
116
+ ## <a id="docs">Related Documents</a>
117
+ - `form_definition.md` The internal data format of the LHC-Forms widget.
118
+ - `changed-features.md` The list of features that changes between the new
119
+ version (v30.0.0) and previous versions.
120
+ - `r4-support.md` The FHIR R4 features supported by LHC-Forms widget.
121
+ - `sdc-support.md` The FHIR SDC features supported by LHC-Forms widget.
@@ -0,0 +1,99 @@
1
+ ## New features in version 30.0.0
2
+ * **Web Component** The new LHC-Forms is a Web Component widget created with angular.
3
+ It is no longer developed with angularjs.
4
+ #### **Web Component Properties:**
5
+ * **questionnaire** - A JSON object of a FHIR Questionnaire (including FHIR SDC Questionnaire),
6
+ or the above LHC-Forms internal format.
7
+ * **options** - Optional, a JSON object. The options defined in [templateOptions](#templateOptions).
8
+ * **prepop** - Optional, a boolean value. A flag indicating whether to run the pre-populate operation
9
+ for the FHIR Questionnaire. The default value is false.
10
+ * **fhirVersion** - Optional, a string value. The specified FHIR version of the data provided in
11
+ 'questionnaire'. If this is not provided, a FHIR version will be determined from
12
+ the 'questionnaire'. The supported FHIR versions are 'R4' and 'STU3'.
13
+
14
+ #### **Emitted Events:**
15
+
16
+ * **onFormReady** - emitted when the form is fully initialied, and FHIRPath expressions
17
+ are run if any, data are pre-populated if any, and the form is ready for user interactions.
18
+ No data is returned in this event.
19
+
20
+ #### **How to use properties and events:**
21
+ * In HTML:
22
+ ```
23
+ <wc-lhc-form id='test-form'></wc-lhc-form>
24
+ ```
25
+ * JavaScript Code:
26
+ ```
27
+ lhcFormWidget = document.getElementById('test-form');
28
+ lhcFormWidget.questionnaire = aQuesionnaire;
29
+ ...
30
+ lhcFormWidget.addEventListener('onFormReady', e => {
31
+ // do something
32
+ ...
33
+ });
34
+ ```
35
+
36
+ ## Features not supported in version 30.0.0
37
+ * **AngularJS Directive** The new LHC-Forms does not includes an AngujarJS directive.
38
+
39
+ * **templateOptions** - The following options within templateOptions are not supported:
40
+ * showColumnHeaders - a boolean that controls whether to show the header row
41
+ with the "Name", "Value", and "Unit" column labels. The default is true.
42
+ * showQuestionCode - a boolean that controls whether to show question codes.
43
+ The default is false.
44
+ * tabOnInputFieldsOnly - a boolean that controls whether to control TAB keys
45
+ to stop on the input fields only (neither buttons, nor units fields).
46
+ The default is false.
47
+ * hideFormControls - a boolean that controls whether to hide the controls section
48
+ on top of the form. The default is true.
49
+ * hideUnits - a boolean that controls whether to all the Units column to
50
+ be hidden from the data table. The default is false.
51
+ * showFormOptionPanel - a boolean that controls whether to show the option panel
52
+ that displays all the form options.
53
+ * showFormOptionPanelButton - a boolean that controls whether to show the button
54
+ next to the form title that hides/shows the form options panel.
55
+ * useAnimation - a boolean that controls whether to use animation on the form.
56
+ The default is true.
57
+ * <a name="showFormHeader"></a>showFormHeader - a boolean that controls whether to
58
+ show a row fields above the actual form like "Date Date", "Comment", etc.
59
+ The default is false.
60
+ * formHeaderItems - an array defining fields above the form (see
61
+ [showFormHeader](#showFormHeader)). If you omit templateOptions, a default will be
62
+ provided which will have the fields "Date Done", "Time Done", "Where
63
+ Done", and "Comment". If you wish to specify your own definitions,
64
+ a complete array should be provided where each
65
+ element in the array should be a hash with the following keys:
66
+ * question - the field label
67
+ * dataType - the kind of field. This can be DT for a date field with a
68
+ calender widget, ST for a normal input field, CNE for a list field in
69
+ which values are required to match the list, or CWE for a list field in
70
+ which values can be off the list.
71
+ * answers - For data types CNE or CWE, this is an array with the list
72
+ data. Each element in the array is a hash with the following keys:
73
+ * text - the display string for the list item
74
+ * code - (optional) a code that identifies the list item
75
+ * displayControl - This controls display styles of the column or the field.
76
+ It is a hash with the keys of "colCSS" for columns styles and "css" for field
77
+ styles. The values are an array of hashes of valid CSS styles. Here is an example:
78
+ `{"colCSS": [{"name":"width","value":"30%"},{"name":"min-width","value":"4em"}]}`
79
+ * <a name="answerCardinality"></a>answerCardinality - For lists, this
80
+ allows you to control whether list is multi-select or not. It is a hash
81
+ that takes two keys, "min" and "max". If you "min" to "1", then the
82
+ user will be required to provide an answer. If you set "max" to "*",
83
+ the list becomes multi-select. (Other possibilities are not yet
84
+ supported.)
85
+
86
+ * **Emitted (AngularJS) Events**
87
+
88
+ * **LF_EVENT_REPEATING_ITEM_ADDED** - emitted when a repeatable item or section is added to the form by clicking
89
+ the "add" button. An event attr object is associated with the event, with the following fields:
90
+ * event - the event name, 'LF_EVENT_REPEATING_ITEM_ADDED'
91
+ * formId - the code of the form
92
+ * itemId - the _elementId of the newly added item or section
93
+ * time - the time stamp when the event happens
94
+ * **LF_EVENT_REPEATING_ITEM_DELETED** - emitted when a repeatable item or section is deleted from the form by clicking
95
+ the "delete" button. The event attr object has the same set of the fields:
96
+ * event - the event name, 'LF_EVENT_REPEATING_ITEM_DELETED'
97
+ * formId - the code of the form
98
+ * itemId - the _elementId of the item or section that has just been deleted.
99
+ * time - the time stamp when the event happens
@@ -0,0 +1,70 @@
1
+ # LICENSE
2
+
3
+ Licensing and Copyright Notice and Terms of Use
4
+
5
+ Owner Notice: This software (including any associated website-service or
6
+ downloadable source (code) was developed by the Lister Hill National Center
7
+ for Biomedical Communications (LHNCBC), a research and development division
8
+ of the U.S. National Library of Medicine (NLM), with the permission and based
9
+ on the copyrighted content of the Regenstrief Institute.
10
+
11
+ This material may contain content from LOINC &#174; (http://loinc.org). The
12
+ LOINC table, LOINC codes, LOINC panels and forms file, LOINC linguistic variants
13
+ file, LOINC/RSNA Radiology Playbook, and LOINC/IEEE Medical Device Code Mapping
14
+ Table are copyright &#169; 1995-2016, Regenstrief Institute, Inc. and the
15
+ Logical Observation Identifiers Names and Codes (LOINC) Committee and is
16
+ available at no cost under the license at http://loinc.org/terms-of-use.
17
+ LOINC &#174; is a registered United States trademark of Regenstrief Institute, Inc.
18
+
19
+ If LOINC content is included, this software is distributed under the conditions
20
+ set forth at https://loinc.org/terms-of-use and the following terms and conditions.
21
+
22
+ If this product includes all or a portion of the UCUM table, UCUM codes, and
23
+ UCUM definitions or is derived from it, it is subject to a license from
24
+ Regenstrief Institute, Inc. and The UCUM Organization. Your use of the UCUM table,
25
+ UCUM codes, UCUM definitions also is subject to this license, a copy of which is
26
+ available at http://unitsofmeasure.org. The current complete UCUM table, UCUM
27
+ Specification are available for download at http://unitsofmeasure.org. The UCUM
28
+ table and UCUM codes are copyright &#169; 1995-2009, Regenstrief Institute, Inc.
29
+ and the Unified Codes for Units of Measures (UCUM) Organization. All rights reserved.
30
+
31
+ If UCUM content is included, this software is distributed under the conditions
32
+ set forth at http://unitsofmeasure.org/trac/wiki/TermsOfUse and the following
33
+ terms and conditions.
34
+
35
+ The following terms and conditions are based on the BSD open-source license.
36
+
37
+ If publishing research that used this software, please include a citation that
38
+ acknowledges it.
39
+
40
+ Redistribution and use in source and binary forms, with or without modification,
41
+ are permitted for commercial and non-commercial purposes and products alike,
42
+ provided that the following conditions are met:
43
+
44
+ * Redistributions of source code shall retain the above Owner Notice, this
45
+ list of conditions and the following disclaimer, and display them prominently.
46
+ * Redistributions in binary form shall prominently reproduce the above Owner
47
+ Notice, this list of conditions and the following disclaimer in the
48
+ documentation and/or other materials provided with the distribution.
49
+ * Neither the names of the National Library of Medicine (NLM), the Lister
50
+ Hill National Center for Biomedical Communications (LHNCBC), the National
51
+ Institutes of Health (NIH), nor the names of any of the software contributors
52
+ may be used to endorse or promote products derived from this software without
53
+ specific prior written permission.
54
+
55
+ THIS SOFTWARE IS PROVIDED BY THE OWNER AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
56
+ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
57
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
58
+ SHALL THE OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
59
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
60
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
61
+ BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
62
+ IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
63
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
64
+ POSSIBILITY OF SUCH DAMAGE.
65
+
66
+ THE UCUM TABLE (IN ALL FORMATS), UCUM DEFINITIONS, AND SPECIFICATION ARE
67
+ PROVIDED "AS IS." ANY EXPRESS OR IMPLIED WARRANTIES ARE DISCLAIMED, INCLUDING,
68
+ BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
69
+ PARTICULAR PURPOSE.
70
+
@@ -0,0 +1,100 @@
1
+ ## What is LForms?
2
+
3
+ [LForms](http://lhncbc.github.io/lforms/), a.k.a. LHC-Forms, is a feature-rich,
4
+ open-source Web Component that creates input forms, based on definition files, for
5
+ Web-based applications. In addition to its native form-definition format, it
6
+ partially supports the HL7 FHIR Questionnaire standard (SDC profile), and work
7
+ is in progress to expand that support.
8
+
9
+ It is being developed by the Lister Hill National Center for Biomedical
10
+ Communications ([LHNCBC](https://lhncbc.nlm.nih.gov)), National Library of
11
+ Medicine ([NLM](https://www.nlm.nih.gov)), part of the National Institutes of
12
+ Health ([NIH](https://www.nih.gov)), with the collaboration and support from the
13
+ [Regenstrief Institute](https://www.regenstrief.org/), Inc. and the
14
+ [LOINC](https://loinc.org/) Committee.
15
+
16
+ For features and demos, please visit the [project
17
+ page](http://lhncbc.github.io/lforms/).
18
+
19
+ ## Licensing and Copyright Notice
20
+ See [LICENSE.md](LICENSE.md).
21
+
22
+ ## Customizing and Contributing
23
+ If you wish to revise this package, the following steps will allow you to make
24
+ changes and test them:
25
+
26
+ * Install Node.js (version 14 is what we are currently using, but it should work with later versions)
27
+ * Clone the lforms repository and cd to its directory
28
+ * `source bashrc.lforms` (make sure node dir is available at ~/)
29
+ * `npm ci`
30
+ * `source bashrc.lforms` # to add node_modules/.bin to your path
31
+ * `npm run build` # build both FHIR libs and LHC-Forms web component
32
+ * `npm run start` # starts the app we use for testing
33
+ * `npm run test` # runs the unit tests and e2e tests
34
+
35
+ If you are planning to contribute new functionality back to us, please
36
+ coordinate with us, so that the new code is in the right places, and so that
37
+ you don't accidentally add something that we are also working on.
38
+
39
+ ## Development server
40
+
41
+ * Run `npm run start` for a dev server. Navigate to `http://localhost:4200/`.
42
+ The app will automatically reload if you change any of the source files.
43
+
44
+ * Run `npm run start-public` if you need to access to the dev server from a different machine.
45
+ For example, to run Narrator from a Windows PC.
46
+
47
+ ## Build
48
+
49
+ * Run `npm run build` to build the project and generate a production version of
50
+ the js files, which are much smaller than the development version. It
51
+ generates an ES2017 version of the js files under dist/lforms. For details on
52
+ the files to load, see ["Usng the LHC-Forms Web Component"](#using).
53
+ The `dist` directory is deleted and recreated during the process.
54
+
55
+ The build also concatenates all the js files (except for zone.min.js and the
56
+ FHIR support files) into a single `lhc-forms.js` file, and it works,
57
+ but we don't currently recommend their use because the
58
+ source maps don't work with these files. Also, there is a dist/webcomponent
59
+ directory that is created with a copy of the files in dist/lforms, but that
60
+ is only needed for the tests.
61
+
62
+ ## Running tests
63
+ 1. Run `npm run test` to run unit tests and e2e tests, which also copies the FHIR lib files
64
+ and built files in places for testing.
65
+
66
+ ## Running unit tests
67
+
68
+ 1. Run `npm run test:unit` to execute the unit tests via [Karma](https://karma-runner.github.io).
69
+
70
+ ## Running end-to-end tests
71
+
72
+ 1. Run `npm run test:e2e:prepare` to copy necessary files in places for the tests and to update the web driver.
73
+
74
+ 1. Run `npm run test:e2e` to execute the end-to-end tests via [Cypress](https://www.cypress.io/).
75
+ The e2e tests is configured to use Chrome.
76
+
77
+ ## <a id="using">Using the LHC-Forms Web Component</a>
78
+ There are several script files to load. If you are building this, these files will be
79
+ under `dist/lforms`. If you are using the pre-built versions from
80
+ https://clinicaltables.nlm.nih.gov/lforms-versions, then the file paths below
81
+ are relative to those versioned directories.
82
+ 1. `webcomponent/styles.css`
83
+
84
+ You need to include the following files in your project:
85
+ 1. `webcomponent/styles.css`
86
+ 2. `webcomponent/assets/lib/zone.min.js` (unless you already have zone.min.js on the page)
87
+ 3. `webcomponent/scripts.js`
88
+ 4. `webcomponent/runtime.js`
89
+ 5. `webcomponent/polyfills.js`
90
+ 6. `webcomponent/main.js`
91
+ 7. *One* of the FHIR support library files, assuming you are planning to use
92
+ FHIR Questionnaires:
93
+ * `fhir/lformsFHIRAll.min.js`
94
+ * `fhir/R4/lformsFHIR.min.js`
95
+ * `fhir/STU3/lformsFHIR.min.js`
96
+
97
+ There is an example of an app using these files at
98
+ https://lhcforms.nlm.nih.gov/lforms-fhir-app/.
99
+ For details about how to work with this library, and for information about an
100
+ announcements list, see the [documentation](https://lhncbc.github.io/lforms/).