lforms 29.3.1 → 33.3.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 (115) hide show
  1. package/CHANGELOG.md +264 -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 +121 -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 +2472 -0
  17. package/dist/lforms/webcomponent/magnifying_glass.png +0 -0
  18. package/dist/lforms/webcomponent/main.js +2465 -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 +381 -0
  29. package/package.json +94 -88
  30. package/r4-support.md +147 -0
  31. package/sdc-support.md +127 -0
  32. package/app/.npmignore +0 -3
  33. package/app/images/blank.gif +0 -0
  34. package/app/images/signal-stop.png +0 -0
  35. package/app/index.html +0 -10
  36. package/app/lforms.js +0 -56
  37. package/app/lforms.tpl.js +0 -964
  38. package/app/scripts/angular-packages.js +0 -11
  39. package/app/scripts/bootstrap-decorators.js +0 -31
  40. package/app/scripts/bower-index.js +0 -14
  41. package/app/scripts/fhir/R4/export.js +0 -33
  42. package/app/scripts/fhir/R4/fhirRequire.js +0 -36
  43. package/app/scripts/fhir/R4/lformsFHIR.js +0 -27260
  44. package/app/scripts/fhir/R4/sdc-export.js +0 -455
  45. package/app/scripts/fhir/R4/sdc-import.js +0 -483
  46. package/app/scripts/fhir/STU3/export.js +0 -27
  47. package/app/scripts/fhir/STU3/fhirRequire.js +0 -36
  48. package/app/scripts/fhir/STU3/lformsFHIR.js +0 -27291
  49. package/app/scripts/fhir/STU3/sdc-export.js +0 -493
  50. package/app/scripts/fhir/STU3/sdc-import.js +0 -494
  51. package/app/scripts/fhir/diagnostic-report.js +0 -707
  52. package/app/scripts/fhir/export-common.js +0 -209
  53. package/app/scripts/fhir/expression-processor.js +0 -670
  54. package/app/scripts/fhir/extensions/rendering-style.js +0 -23
  55. package/app/scripts/fhir/fhir-common.js +0 -3
  56. package/app/scripts/fhir/obs-prepop.mjs +0 -97
  57. package/app/scripts/fhir/runtime-common.js +0 -33
  58. package/app/scripts/fhir/sdc-common.js +0 -334
  59. package/app/scripts/fhir/sdc-export-common.js +0 -1046
  60. package/app/scripts/fhir/sdc-import-common.js +0 -1343
  61. package/app/scripts/fhir/versions.js +0 -8
  62. package/app/scripts/index.js +0 -20
  63. package/app/scripts/lforms-config.js +0 -12
  64. package/app/scripts/lforms-constants.js +0 -10
  65. package/app/scripts/lforms-controllers.js +0 -1196
  66. package/app/scripts/lforms-directives.js +0 -424
  67. package/app/scripts/lforms-index.js +0 -20
  68. package/app/scripts/lib/cross_browser.js +0 -21
  69. package/app/scripts/lib/lforms-data.js +0 -3591
  70. package/app/scripts/lib/lforms-hl7.js +0 -525
  71. package/app/scripts/lib/lforms-util.js +0 -1122
  72. package/app/scripts/lib/lforms-validate.js +0 -277
  73. package/app/scripts/lib/polyfill.js +0 -81
  74. package/app/scripts/themeList.js +0 -17
  75. package/app/styles/lforms.css +0 -1219
  76. package/app/styles/redmond-theme/README.txt +0 -2
  77. package/app/styles/redmond-theme/images/ui-bg_glass_75_d0e5f5_1x400.png +0 -0
  78. package/app/styles/redmond-theme/images/ui-bg_glass_85_dfeffc_1x400.png +0 -0
  79. package/app/styles/redmond-theme/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  80. package/app/styles/redmond-theme/images/ui-bg_gloss-wave_55_5c9ccc_500x100.png +0 -0
  81. package/app/styles/redmond-theme/images/ui-bg_inset-hard_100_f5f8f9_1x100.png +0 -0
  82. package/app/styles/redmond-theme/images/ui-bg_inset-hard_100_fcfdfd_1x100.png +0 -0
  83. package/app/styles/redmond-theme/images/ui-icons_217bc0_256x240.png +0 -0
  84. package/app/styles/redmond-theme/images/ui-icons_2e83ff_256x240.png +0 -0
  85. package/app/styles/redmond-theme/images/ui-icons_469bdd_256x240.png +0 -0
  86. package/app/styles/redmond-theme/images/ui-icons_6da8d5_256x240.png +0 -0
  87. package/app/styles/redmond-theme/images/ui-icons_cd0a0a_256x240.png +0 -0
  88. package/app/styles/redmond-theme/images/ui-icons_d8e7f3_256x240.png +0 -0
  89. package/app/styles/redmond-theme/images/ui-icons_f9bd01_256x240.png +0 -0
  90. package/app/styles/redmond-theme/jquery-ui.css +0 -1311
  91. package/app/styles/redmond-theme/jquery-ui.min.css +0 -7
  92. package/app/styles/redmond-theme/theme.css +0 -443
  93. package/app/styles/themes.css +0 -1541
  94. package/app/styles/themes.css.map +0 -9
  95. package/app/styles/themes.scss +0 -411
  96. package/app/version.json +0 -1
  97. package/app/views/partials/attachment.html +0 -38
  98. package/app/views/partials/field-answers.html +0 -67
  99. package/app/views/partials/field-units.html +0 -24
  100. package/app/views/partials/form-controls.html +0 -19
  101. package/app/views/partials/form-header.html +0 -35
  102. package/app/views/partials/form-options.html +0 -50
  103. package/app/views/partials/form-title.html +0 -20
  104. package/app/views/partials/form-view.html +0 -13
  105. package/app/views/partials/item-options.html +0 -48
  106. package/app/views/partials/item.html +0 -126
  107. package/app/views/partials/itemPrefixAndText.html +0 -4
  108. package/app/views/partials/layout-horizontal.html +0 -156
  109. package/app/views/partials/layout-matrix.html +0 -145
  110. package/app/views/partials/popover-content.html +0 -1
  111. package/app/views/partials/repeating-button.html +0 -16
  112. package/app/views/partials/table-item.html +0 -30
  113. package/app/views/partials/template-table.html +0 -69
  114. package/app/views/partials/uib-popover-templates/uib-popover-template.html +0 -13
  115. package/app/views/partials/uib-popover-templates/uib-popover.html +0 -11
@@ -0,0 +1,381 @@
1
+ # Form Definition Format
2
+
3
+ The forms rendered by the LForms widget are defined in a JSON format, examples
4
+ of which can be seen in the __app/data__ directory. Note that
5
+ LForms also provides APIs for importing forms defined in the FHIR Questionnaire
6
+ format. (See the [documentation](http://lhncbc.github.io/lforms/) for details.) The
7
+ basic structure (some of which is optional) is shown below, followed by comments
8
+ about the meaning of each key:
9
+
10
+ ```
11
+ {
12
+ "code": string,
13
+ "name": string,
14
+ "template": string
15
+ "templateOptions": {
16
+ },
17
+ "items": [{
18
+ "questionCode": string,
19
+ "linkId": string,
20
+ "questionCardinality": {
21
+ "min": "1",
22
+ "max": "1" or "*"
23
+ },
24
+ "question": string,
25
+ "answerCardinality": {
26
+ min: "0" or "1",
27
+ max: "1" or "*"
28
+ },
29
+ "answers": [{
30
+ "text": string,
31
+ "code": string,
32
+ "label": string,
33
+ "other": string,
34
+ "score": number
35
+ }],
36
+ "answerCodeSystem": "string",
37
+ "externallyDefined": string,
38
+ "dataType": string,
39
+ "units": [{
40
+ "name": string,
41
+ "code": string,
42
+ "system": string,
43
+ "default": boolean
44
+ }],
45
+ "header": boolean,
46
+ "skipLogic": {
47
+ "conditions": [{
48
+ "source": string
49
+ "trigger": {
50
+ "value": string/number/boolean/code-object, or
51
+ "minExclusive": number,
52
+ "minInclusive": number,
53
+ "maxExclusive": number,
54
+ "maxInclusive": number
55
+ }
56
+ }],
57
+ "action": string
58
+ },
59
+ displayControl: {
60
+ "colCSS": [{"name":"width","value":"30%"}, ...],
61
+ "listColHeaders": ["Column 1 Title", "Column 2", ...]
62
+ }
63
+ "codingInstructions": string,
64
+ "calculationMethod": {
65
+ "name": string
66
+ }
67
+ }],
68
+ }
69
+ ```
70
+
71
+ ### Keys:
72
+
73
+ * **code** - a code (identifier) for a panel, or in the context of answer
74
+ lists, for an individual answer in the list. For answer lists, codes are
75
+ optional.
76
+ * **codeSystem** - (optional) the code system for the code of the form.
77
+ * **name** - (required) the name of the form (to be shown to the user).
78
+ * **copyrightNotice** - the copyright information of the form.
79
+ * **template** - (optional) a template name that is used for rendering the form.
80
+ 'table' (default) is the only template supported. More supported templates would be added.
81
+ * <a name="templateOptions"></a>**templateOptions** - a hash of options for the template. This can be
82
+ omitted, but supported values are below.
83
+ * showQuestionCode - a boolean that controls whether to show question codes.
84
+ The default is false.
85
+ * showCodingInstruction - a boolean that controls whether to show coding
86
+ instructions inline or as popover messages (false: in popover; true: inline).
87
+ The default is false;
88
+ * allowMultipleEmptyRepeatingItems - a boolean that controls whether to allow
89
+ more than one unused repeating item/section The default is false.
90
+ * allowHTMLInInstructions - a boolean that controls whether to allow HTML
91
+ content in the codingInstructions field. The default is false. If it is false,
92
+ the **codingInstructionsFormat** field on item level is ignored, and no HTML
93
+ formatted coding instructions will be displayed.
94
+ * <a name="defaultAnswer"></a>defaultAnswer - The default answer for a
95
+ question. For an answer list, it can be an answer label, text, code or
96
+ their combination, using the syntax such as: {"code": "B12"}, {"label: "A"},
97
+ {"text": "Male"}, {"text": "Male", "code": "LA2-8"} and etc.
98
+ For a date field, it can be a date shortcut (like "t" for today).
99
+ For other field types, it can be a text string or a number.
100
+ * displayControl - an object that controls the display of the selected template.
101
+ Currently it only supports a 'questionLayout' attribute, which has supported
102
+ values as 'vertical' (default), 'horizontal' and 'matrix'. Here is an example:
103
+ `{"questionLayout": "matrix"}`
104
+ * <a name="viewMode"></a>viewMode - (optional) the view mode for the form. Permitted values are 'lg',
105
+ 'md', 'sm', and 'auto', which determine the 4 predefined layouts for large
106
+ screen/container, medium screen/container, small screen/container and a
107
+ responsive layout. The default value is 'auto'.
108
+ * <a name="defaultAnswerLayout"></a>defaultAnswerLayout -
109
+ an object that controls the answer layout for each item
110
+ that has a dataType of CWE or CNE and has an answer list but does not specify
111
+ answerLayout on the item itself. It has a single key of "answerLayout", which
112
+ has two keys, "type" and "columns". If "type" is set to be "COMBO_BOX", the
113
+ [autocomplete-lhc](http://lhncbc.github.io/autocomplete-lhc/) widget
114
+ will be used to handle the list. If "type" is set to be "RADIO_CHECKBOX", then
115
+ all the answers are displayed as either radio buttons or check boxes,
116
+ and "columns" controls how many columns are used.
117
+ If value of "columns" is "0", or there are no "columns". The answers will fill
118
+ in available space one after another. If the value of "columns" is "1"
119
+ (or any value other than "0"), the answers are displayed in one column.
120
+ "columns" is valid only when "type" is set to be "RADIO_CHECKBOX".
121
+ Here is an example:
122
+ `{"answerLayout": {"type": "RADIO_CHECKBOX", "columns": "1"}}`
123
+ * hideTreeLine - a boolean that controls whether to hide tree line styles. The default is false.
124
+ * hideIndentation - a boolean that controls whether to hide indentation. The default is false.
125
+ Note that if this is set true, tree line style will not apply regardless of "hideTreeLine" setting.
126
+ * hideRepetitionNumber - a boolean that controls whether to hide repetition numbers next to the
127
+ item's text. The default is false.
128
+ * displayScoreWithAnswerText - a boolean that controls whether to display scores along
129
+ with answer texts for answers that have scores. The default is true.
130
+ * <a name="items"></a><b>items</b> - This is an array of form questions and
131
+ sections. Questions and sections (containing sub-questions) are mostly
132
+ represented the same in this array, but a section will contain its own
133
+ "items" array to specify what it contains. Sections can be nested to create
134
+ sub-sections, so that the definition forms tree-like structure with questions
135
+ at the leaf nodes. Each question/section in the array is represented by a hash
136
+ with the following keys:
137
+
138
+ * linkId - (required) An ID identifying the question or section.
139
+ This code needs to be unique across the form.
140
+ * questionCode - (optional) A code for the question or section.
141
+ * questionCodeSystem - (optional) the code system for the question code.
142
+ * questionCardinality - This controls whether the there is a button for
143
+ adding another of this question/section. It is a hash with "min" and
144
+ "max" keys, and by default both of those are "1" (i.e., not repeatable).
145
+ If you wish for a question or section to be repeatable, pass in `{"min":
146
+ "1", "max": "*"}`.
147
+ * question - The label for the question, or the title of the section.
148
+ * answerCardinality - The same as <a href="#answerCardinality">above</a>.
149
+ * <a name="answers"></a>answers - For questions with answer lists, this is
150
+ an array of hashes for items in the list. Each hash can contain:
151
+ * text - (required) the display string for this list item. This should
152
+ be unique within the list.
153
+ * code - (optional) an identifier for the list item. This can be
154
+ omitted if you do not need coded answers.
155
+ * system - (optional) a code system for the answer's code. If not
156
+ present, the item's answerCodeSystem is used as the default code system.
157
+ * label - (optional) Some lists have a label for each list item, such as
158
+ 'a', 'b', etc. This is an array of such labels, corresponding to the
159
+ items in the "text" array. When this is present, the automatic number
160
+ of list items will be turned off avoid confusion.
161
+ * other - (optional) If this answer is an "Other" item, then this "other" key
162
+ provides a label like "Please specify" for an additional field that
163
+ will be available with the user chooses this answer.
164
+ * <a name="score"></a>score - (optional) Some forms have scored answers
165
+ which get summed into a total field. See TOTALSCORE under <a
166
+ href="#calculationMethod">calculationMethod</a> below for how to
167
+ specify which field holds the total.
168
+ * answerCodeSystem - The default code system for the answer list
169
+ (specified either in "answers" or in "externallyDefined").
170
+ * externallyDefined - List fields can be configured to obtain their lists
171
+ from a URL as the user types. This is usually used for larger lists for
172
+ which it would not be practical to include the whole list with the form.
173
+ The [Clinical Table Search
174
+ Service](https://clin-table-search.lhc.nlm.nih.gov/) website provides a number
175
+ of ready-to-use web APIs that can plugged in here to provide
176
+ searchable lists of drugs, medical conditions, disease names, and more.
177
+ If you wish to set up your own web API on a website, then you just need to
178
+ understand what query parameters to handle on the webserver, and what the
179
+ response format needs to be. LForms uses the
180
+ [autocomplete-lhc](http://lhncbc.github.io/autocomplete-lhc/) package for
181
+ its lists, so see the documentation for its [url
182
+ parameter](http://lhncbc.github.io/autocomplete-lhc/docs.html#url) if you
183
+ are setting up your own list.
184
+ * dataType - (required) The data type of the answer for the question. This determines
185
+ what sort of field control is provided. Supported types are:
186
+ * CWE - an answer list where the user is permitted to enter something
187
+ not on the list.
188
+ * CNE - an answer list where the user is **not** permitted to enter something
189
+ not on the list.
190
+ * REAL - a number which might not be an integer
191
+ * QTY - a type which has both a REAL value and unit object (see "units" below for
192
+ the structure).
193
+ * INT - an integer
194
+ * DT - a date (displayed with a calendar widget)
195
+ * DTM - a string with date and time
196
+ * TM - a string in the time format
197
+ * ST - a normal free-text string
198
+ * YEAR - a string in the format of one to four digits that represents a year
199
+ * MONTH - a string in the format of one or two digits that represents a month
200
+ * DAY - a string in the format of one or two digits that represents a day
201
+ * URL - a string in a valid URL format
202
+ * EMAIL - a string in a valid email format
203
+ * PHONE - a string in a valid phone number format
204
+ * NR - a numeric range, in the format of two values separated by "^".
205
+ Having one number on either side of "^" is allowed.
206
+ * SECTION - a special type for sections, which contain sub items in the
207
+ <a href="#items">items</a> field
208
+ * TITLE - a special type for separators that display some text.
209
+ * attachment - a control to upload and download attachment files.
210
+ * units - For numeric answer fields, this is an optional list for the units
211
+ for the quantity being entered. If the data type is INT or REAL, units
212
+ should only have one unit; otherwise the data type will be converted to
213
+ QTY. Each hash in this array can contain the following keys:
214
+ * name - The display string for the unit
215
+ * code - Code associated with the unit
216
+ * system - Code system associated with the unit
217
+ * default - If true, this unit will be the default unit, which means it
218
+ will show up in the field when the question is shown and the user does
219
+ not have to pick it. If false, this key can be omitted.
220
+ * editable - (optional) If "0" the input field is readonly/disabled; any other value
221
+ makes the input field editable.
222
+ * header - If true, then this is not a question but a section, which can
223
+ contain its own <a href="#items">items</a> array of questions and sections.
224
+ * skipLogic - Controls the hiding/showing of this question or section based
225
+ on data entered in other parts of the form. The value is a hash with the
226
+ following keys:
227
+ * conditions - An array of the conditions to be met. Each condition is a
228
+ hash with the following keys:
229
+ * source - The linkId of another question. The source item could be any question on the form.
230
+ * trigger - A hash defining a condition about the value for the
231
+ question specified by "source". The hash can either have a "value"
232
+ key, or some combination of minExclusive, minInclusive, maxExclusive,
233
+ or maxInclusive. The meaning of the keys is as follows:
234
+ * value - A value that the answer for the “source” question must match to fire the trigger.
235
+ * For value types string, number, or boolean, the answer and trigger value
236
+ must exactly match.
237
+ * For (source) questions with lists (CNE/CWE), the trigger value should
238
+ be a "code object" with any or all of these three fields: code, system, and text,
239
+ for example: {"code": "LA2-8", "system": "http://loinc.org"}.
240
+ The trigger value will be considered to match the answer if 1) code systems
241
+ either match or are unspecified, and 2) either a) codes are specified and match
242
+ or b) codes are unspecified and the texts are specified and match.
243
+ Other trigger value fields, if any, are not used for matching.
244
+ * notEqual - a value which the source question's value is not equal to. it's value could be
245
+ a string, number, or boolean, or a 'code object'. See "value" above.
246
+ * exists - if it is true, the condition is met if the source question has a answer.
247
+ if it is false, the condition is met if the source question has no answers.
248
+ * minExclusive - a value which the source question's value must exceed
249
+ * minInclusive - a value which the source question's value must equal
250
+ or exceed
251
+ * maxExclusive - a value which the source question's value must be
252
+ less than
253
+ * maxInclusive - a value which the source question's value must equal
254
+ or be less than
255
+ * action - (optional) the action to take when the conditions are met. For now the
256
+ one supported value is "show" (which is also the default), and when
257
+ conditions are not met the question or section is disabled (and hidden).
258
+ * logic - (optional) either "ANY" or "ALL". If "ANY" is used, then any condition in
259
+ "conditions" being met will trigger the action, while for "ALL" all
260
+ conditions must be met. If not specified, the default is "ANY".
261
+ * codingInstructions - (optional) a string of help text. When this is
262
+ present, a help button will appear next to the question, or if the "Show
263
+ Help/Description" checkbox is used, the text will appear next to the
264
+ question (so it should be brief).
265
+ * codingInstructionsFormat - (optional) the text format of the codingInstructions,
266
+ either 'html' or 'text'. If not specified, the default is 'text'.
267
+ If **allowHTMLInInstructions** in **templateOptions** is set to be false,
268
+ then codingInstructionsFormat is ignored and treated as if it is set to 'text'.
269
+ No HTML formatted coding instructions will be displayed.
270
+ * <a name="calculationMethod"></a>calculationMethod - For fields whose value
271
+ is calculated from other fields, the means of calculation is specified
272
+ here. At present we only support a formula for summing the <a
273
+ href="#score">scores</a> for all the questions on the form. To have a field be the sum
274
+ of the scores, set calculationMethod to `{"name": "TOTALSCORE"}`.
275
+ * defaultAnswer - The same as [defaultAnswer](#defaultAnswer) in the
276
+ templateOptions section.
277
+ * displayControl - an object that controls the display of the item or the section.
278
+ Supported the fields are:
279
+ * answerLayout - the layout of the answers when a item has a dataType of 'CNE' or 'CWE'.
280
+ The supported values are 'COMBO_BOX' (default), and 'RADIO_CHECKBOX'. (see
281
+ [defaultAnswerLayout](#defaultAnswerLayout))
282
+ * css - an array of valid CSS settings that could apply to an item. (limited supports).
283
+ * colCSS - an array of valid CSS settings that could apply to its related column in a
284
+ horizontal table. It only works when its parent item/section has a
285
+ {"questionLayout": "horizontal"} value in its "displayControl".
286
+ * listColHeaders - For questions that are search lists (specified with a
287
+ URL in "externallyDefined" and dataType "CNE" or "CWE") this specifies
288
+ the column headers (as an array) that will appear over the rows of choices.
289
+ This is useful when each list item displays multiple fields. If
290
+ nothing is specified for this attribute, column headers will not be
291
+ shown. Headers can contain "&nbsp;" for non-breaking spaces between
292
+ words, but cannot contain HTML tags.
293
+ * questionLayout - the layout of the questions in the section. It works on items
294
+ that are sections, i.e. they contain sub items. Supported values are:
295
+ 'vertical' (default), 'horizontal' and 'matrix'.
296
+ * viewMode - (optional) the view mode for the item. Permitted values are 'lg',
297
+ 'md', 'sm', and 'auto', which determine the 4 predefined layouts for large
298
+ screen/container, medium screen/container, small screen/container and a
299
+ responsive layout. It has the priority over the value in the form level [viewMode](#viewMode).
300
+ If its value is not set, then the form level viewMode value is used for the item.
301
+ * dataControl - an array of objects that control the current question's attributes when the controlling
302
+ source question's value changes. Supported fields are:
303
+ * source - an object identifying the controlling source question. It has the following fields:
304
+ * sourceType - optional, the source type. Currently only "INTERNAL" is supported. The
305
+ default value is "INTERNAL".
306
+ * sourceLinkId - the linkId of the source question in the form. The source question
307
+ must be a question on the form.
308
+ * onAttribute - optional, the attribute on this question, whose value will be updated by the newly
309
+ constructed value. The default value is "value".
310
+ * dataFormat - the format of the newly constructed value. It is a hash, such as
311
+ `{"code": "value.RXCUIS", "text": "value.STRENGTHS_AND_FORMS"}`, when the **construction**
312
+ is set to be "ARRAY" or "OBJECT". It is a string, such as `"value.STRENGTHS_AND_FORMS[0]"`,
313
+ when the **construction** is "SIMPLE". See **construction** for details on how these formats are used.
314
+ * construction - the method to construct a new value based on the source question's value.
315
+ It supports three types:
316
+ * SIMPLE - the new value is a direct copy of what is on the controlling source question.
317
+ The **dataFormat**'s value must be string.
318
+ For example, if it's value is `"value.STRENGTHS_AND_FORMS[0]"`,
319
+ the new value could be `"325-2.25-0.19 mg Tab"`.
320
+ * OBJECT - the new value is a hash object. The **dataFormat**'s value must be a hash object.
321
+ For each key/value pair in the **dataFormat** hash object, the key is a key in the new hash object,
322
+ and the value is from the controlling source question's value or its attributes.
323
+ For example, if the **dataFormat** is `{"code": "value.code", "text": "value.GeneSymbol"}`,
324
+ the new object could be created as `{"code": "NM_004315.5", "text": "ASAH1"}`, where "NM_004315.5"
325
+ and "ASAH1" are values retrieved from the controlling source question for "value.code" and
326
+ "value.GeneSymbol", respectively.
327
+ * ARRAY - the new value is an array. The **dataFormat**'s value must be a hash object.
328
+ Each element object in the array is constructed according to that hash object.
329
+ It is similar to the processing for "OBJECT", except that for each key/value pair in the
330
+ **dataFormat** hash object, the value contains an array.
331
+ If there are more than one pairs, the arrays retrieved should have the same length.
332
+ Elements in the new array are constructed with the corresponding elements in these retrieved arrays.
333
+ For example, if the **dataFormat** is `{"code": "value.RXCUIS", "text": "value.STRENGTHS_AND_FORMS"}`,
334
+ the "value.RXCUIS" and the "value.STRENGTHS_AND_FORMS" of the controlling source question should
335
+ both contains an array and these two arrays should have the same length.
336
+ A sample constructed array could be
337
+ `[{"code": "724614", "text": "325-2.25-0.19 mg Tab"},{"code": "637540", "text": "325-4.5-0.38 mg Tab"},{"code": "848768", "text": "325-4.84 mg Tab"}]`
338
+ where "value.RXCUIS" is `["724614", "637540", "848768"]` and "value.STRENGTHS_AND_FORMS" is
339
+ `["325-2.25-0.19 mg Tab", "325-4.5-0.38 mg Tab", "325-4.84 mg Tab"]`.
340
+
341
+ ### Web Component Properties:
342
+ * **questionnaire** - A JSON object of a FHIR Questionnaire (including FHIR SDC Questionnaire),
343
+ or the above LHC-Forms internal format.
344
+ * **options** - Optional, a JSON object. The options defined in [templateOptions](#templateOptions).
345
+ * **prepop** - Optional, a boolean value. A flag indicating whether to run the pre-populate operation
346
+ for the FHIR Questionnaire. The default value is false.
347
+ * **fhirVersion** - Optional, a string value. The specified FHIR version of the data provided in
348
+ 'questionnaire'. If this is not provided, a FHIR version will be determined from
349
+ the 'questionnaire'. The supported FHIR versions are 'R4' and 'STU3'.
350
+
351
+ ### Emitted Events:
352
+
353
+ * **onFormReady** - emitted when the form is fully initialied, and FHIRPath expressions
354
+ are run if any, data are pre-populated if any, and the form is ready for user interactions.
355
+ No data is returned in this event.
356
+ * **onError** - emitted when the ValueSets are not retrieved during the form initialization.
357
+ The form is still initialized and might be rendered, with possible missing data.
358
+ The first error is returned in this event.
359
+
360
+ ### How to use properties and events:
361
+ * In HTML:
362
+ ```
363
+ <wc-lhc-form id='test-form'></wc-lhc-form>
364
+ ```
365
+ * JavaScript Code:
366
+ ```
367
+ lhcFormWidget = document.getElementById('test-form');
368
+ lhcFormWidget.questionnaire = aQuesionnaire;
369
+ ...
370
+ lhcFormWidget.addEventListener('onFormReady', e => {
371
+ // do something
372
+ ...
373
+ });
374
+ ```
375
+
376
+
377
+ ### Utility Functions:
378
+ For a description of functions provided for retrieving user-entered data in
379
+ various formats, including FHIR, and for importing and exporting FHIR resources,
380
+ see the [documentation](https://lhncbc.github.io/lforms/) website.
381
+
package/package.json CHANGED
@@ -1,102 +1,108 @@
1
1
  {
2
2
  "name": "lforms",
3
- "version": "29.3.1",
3
+ "version": "33.3.0",
4
4
  "keywords": [
5
5
  "fhir",
6
6
  "Questionnaire",
7
7
  "SDC"
8
8
  ],
9
- "main": "app/scripts/index.js",
10
- "files": [
11
- "app"
12
- ],
9
+ "repository": "github:lhncbc/lforms",
10
+ "license": "See LICENSE.md",
11
+ "config": {
12
+ "testPort": "4200",
13
+ "testPortFhir": "4201"
14
+ },
15
+ "scripts": {
16
+ "ng": "ng",
17
+ "start": "start-server-and-test start:fhir-dev http://localhost:$npm_package_config_testPortFhir start:lforms-dev",
18
+ "start:lforms-dev": "ng serve --configuration=debugging",
19
+ "start:fhir-dev": "webpack serve -c webpack.fhir.config.js --host localhost --env debugging=true",
20
+ "start-public": "node bin/start-public.js",
21
+ "start-dist-public": "node bin/start-public.js --dist",
22
+ "build:lforms-dev:update": "npm run build:lforms-dev && npm run build:prepare-zip",
23
+ "build:lforms-dev": "ng build --configuration=debugging --extra-webpack-config webpack.lforms.extra.config.js && node concatenate.js",
24
+ "build:lforms": "ng build --configuration production --extra-webpack-config webpack.lforms.extra.config.js && node concatenate.js",
25
+ "build:fhir-dev:update": "npm run build:fhir-dev",
26
+ "build:fhir-dev": "webpack --config ./webpack.fhir.config.js --env fhirOnly=true --env debugging=true",
27
+ "build:fhir": "webpack --config ./webpack.fhir.config.js --env fhirOnly=true",
28
+ "build-dev": "npm run build:init && npm run build:fhir-dev && npm run build:lforms-dev && npm run build:prepare-zip && npm run build:zip",
29
+ "build": "npm run build:init && npm run build:fhir && npm run build:lforms && npm run build:prepare-zip && npm run build:zip",
30
+ "build:clean": "shx rm -rf dist src/test/lib",
31
+ "build:init": "npm run build:clean && shx mkdir -p dist/$npm_package_name && shx cp src/index.js dist && npm run build:version",
32
+ "build:prepare-zip": "node prepare-zip.js",
33
+ "build:zip": "cd dist; shx mv $npm_package_name $npm_package_name-$npm_package_version; bestzip $npm_package_name-$npm_package_version.zip $npm_package_name-$npm_package_version/*; shx mv $npm_package_name-$npm_package_version $npm_package_name",
34
+ "build:version": "node -e 'require(\"fs\").writeFileSync(\"src/version.json\", JSON.stringify({lformsVersion: require(\"./package.json\").version}))'",
35
+ "test:fhir-unit": "karma start test/karma.conf.js",
36
+ "test:ng-unit": "ng test --watch=false",
37
+ "test:unit": "npm run test:fhir-unit && npm run test:ng-unit",
38
+ "test:e2e:fhir-server": "start-server-and-test start:fhir-dev http://localhost:$npm_package_config_testPortFhir test:e2e:lforms-server",
39
+ "test:e2e:lforms-server": "start-server-and-test start:lforms-dev http://localhost:$npm_package_config_testPort cy:run",
40
+ "test:e2e": "npm run test:e2e:fhir-server",
41
+ "test:e2e:fhir-server:open": "start-server-and-test start:fhir-dev http://localhost:$npm_package_config_testPortFhir test:e2e:lforms-server:open",
42
+ "test:e2e:lforms-server:open": "start-server-and-test start:lforms-dev http://localhost:$npm_package_config_testPort cy:open",
43
+ "test:e2e:open": "npm run test:e2e:fhir-server:open",
44
+ "test": "npm run test:unit && npm run test:e2e",
45
+ "test-coverage": "ng test --no-watch --code-coverage",
46
+ "cy:open": "cypress open",
47
+ "cy:run": "cypress run",
48
+ "test-pages": "http-server -o /test/pages/build_test_fhirpath.html"
49
+ },
13
50
  "dependencies": {
14
- "@lhncbc/ucum-lhc": "^4.1.3",
15
- "angular": "^1.8.2",
16
- "angular-animate": "1.8.2",
17
- "angular-ui-bootstrap": "^1.3.3",
18
- "autocomplete-lhc": "^18.1.1",
19
- "bootstrap": "^3.4.1",
20
- "bootstrap-ui-datetime-picker": "^2.6.4",
21
- "element-resize-detector": "^1.1.15",
22
- "fast-deep-equal": "^3.1.3",
23
- "fhirpath": "^2.9.1",
24
- "jquery": "^3.6.0",
25
- "jquery-ui": "^1.12.1",
26
- "js-class": "0.0.3",
27
- "moment": "^2.24.0",
28
- "ngSmoothScroll": "^2.0.1",
29
- "promise-polyfill": "^8.2.0",
30
- "whatwg-fetch": "^3.0.0"
51
+ "@angular/animations": "~14.2.12",
52
+ "@angular/common": "~14.2.12",
53
+ "@angular/compiler": "~14.2.12",
54
+ "@angular/core": "~14.2.12",
55
+ "@angular/elements": "^14.2.12",
56
+ "@angular/forms": "~14.2.12",
57
+ "@angular/platform-browser": "~14.2.12",
58
+ "@angular/platform-browser-dynamic": "~14.2.12",
59
+ "@angular/router": "~14.2.12",
60
+ "@lhncbc/ucum-lhc": "^4.1.6",
61
+ "@types/jquery": "^3.5.14",
62
+ "autocomplete-lhc": "^18.5.0",
63
+ "deep-equal": "^2.0.5",
64
+ "fast-copy": "^2.1.7",
65
+ "fhirpath": "3.2.0",
66
+ "jquery": "^3.6.1",
67
+ "moment": "^2.29.4",
68
+ "ng-zorro-antd": "^14.1.1",
69
+ "rxjs": "~6.6.7",
70
+ "tslib": "^2.4.1",
71
+ "zone.js": "~0.11.8"
31
72
  },
32
73
  "devDependencies": {
33
- "@babel/core": "^7.1.2",
34
- "@babel/preset-env": "^7.1.0",
35
- "babel-loader": "^8.0.4",
36
- "bower": "^1.7.9",
37
- "chai": "^3.5.0",
38
- "clean-css": "^4.2.1",
39
- "clean-css-cli": "^4.3.0",
40
- "css-loader": "^2.1.1",
41
- "file-loader": "^3.0.1",
42
- "grunt": "^1.4.1",
43
- "grunt-angular-templates": "^1.2.0",
44
- "grunt-cli": "^1.4.3",
45
- "grunt-contrib-connect": "^2.0.0",
46
- "grunt-contrib-jshint": "^2.1.0",
47
- "grunt-contrib-watch": "^1.1.0",
48
- "grunt-karma": "^3.0.1",
49
- "grunt-newer": "^1.1.0",
50
- "grunt-protractor-runner": "^5.0.0",
51
- "grunt-wiredep": "^3.0.1",
52
- "jasmine-core": "^2.3.4",
53
- "jasmine-spec-reporter": "^2.7.0",
54
- "jit-grunt": "^0.10.0",
55
- "jshint-stylish": "^1.0.0",
56
- "karma": "^6.3.4",
74
+ "@angular-devkit/build-angular": "~14.2.10",
75
+ "@angular/cli": "^14.2.10",
76
+ "@angular/compiler-cli": "~14.2.12",
77
+ "@cypress/schematic": "^2.2.0",
78
+ "@types/jasmine": "~4.3.0",
79
+ "@types/jasminewd2": "~2.0.10",
80
+ "@types/node": "^18.11.9",
81
+ "bestzip": "^2.2.0",
82
+ "chai": "^4.3.6",
83
+ "concat": "^1.0.3",
84
+ "cypress": "^10.10.0",
85
+ "cypress-real-events": "^1.7.6",
86
+ "fs-extra": "^10.1.0",
87
+ "http-server": "^14.1.1",
88
+ "jasmine-core": "~4.5.0",
89
+ "jasmine-spec-reporter": "~5.0.0",
90
+ "jszip": "^3.10.0",
91
+ "karma": "^6.4.1",
57
92
  "karma-chai": "^0.1.0",
58
- "karma-chrome-launcher": "^2.0.0",
59
- "karma-jasmine": "^0.3.6",
60
- "karma-mocha": "^2.0.0",
93
+ "karma-chrome-launcher": "~3.1.1",
94
+ "karma-coverage": "^2.2.0",
95
+ "karma-jasmine": "~5.1.0",
96
+ "karma-jasmine-html-reporter": "^2.0.0",
97
+ "karma-mocha": "^2.0.1",
61
98
  "karma-mocha-reporter": "^2.2.5",
62
- "karma-requirejs": "^1.1.0",
63
- "mini-css-extract-plugin": "^0.5.0",
64
- "mocha": "^9.1.3",
65
- "moment-locales-webpack-plugin": "^1.0.7",
66
- "node-sass": "^4.14.1",
67
- "phantomjs-prebuilt": "^2.1.16",
68
- "protractor": "^5.4.2",
69
- "requirejs": "^2.3.2",
70
- "serve-static": "^1.13.2",
71
- "style-loader": "^0.23.1",
72
- "time-grunt": "^1.0.0",
73
- "tmp": "^0.2.1",
74
- "uglify-js": "^3.4.10",
75
- "webpack": "^4.42.1",
76
- "webpack-cli": "^3.3.11",
77
- "wiredep": "^4.0.0"
78
- },
79
- "repository": "github:lhncbc/lforms",
80
- "license": "See LICENSE.md",
81
- "scripts": {
82
- "wiredep": "grunt wiredep",
83
- "webpack": "webpack",
84
- "webpack:fhir": "webpack --env.fhirOnly=true",
85
- "webpack:r4": "webpack --env.r4Only=true",
86
- "webpack:main": "webpack --env.mainOnly=true",
87
- "test": "npm run update-webdriver && grunt test",
88
- "test:e2e": "npm run update-webdriver && grunt test:e2e",
89
- "build:clean": "rm -rf dist bower-dist app/generated .tmp",
90
- "build:mkdist": "mkdir dist; mkdir -p dist/$npm_package_name-$npm_package_version/styles; (cd dist; ln -s $npm_package_name-$npm_package_version latest)",
91
- "build:version": "node -e 'require(\"fs\").writeFileSync(\"app/version.json\", JSON.stringify({lformsVersion: require(\"./package.json\").version}))'",
92
- "build:css:lforms": "cleancss --skip-rebase -o dist/latest/styles/lforms.min.css dist/latest/styles/lforms.css",
93
- "build:css:themes": "node-sass app/styles/themes.scss --output .tmp/styles && cleancss --skip-rebase -o dist/latest/styles/themes.min.css .tmp/styles/themes.css",
94
- "build:css": "npm run build:css:themes && npm run build:css:lforms",
95
- "build:zip": "cd dist; dirname=$npm_package_name-$npm_package_version; zip -r $dirname.zip $dirname",
96
- "build:ngtemplates": "grunt ngtemplates",
97
- "build": "npm run build:clean && npm run build:mkdist && npm run build:version && npm run build:ngtemplates && webpack && npm run build:css && npm run wiredep && npm run build:zip",
98
- "update-webdriver": "node node_modules/protractor/bin/webdriver-manager update --versions.chrome $(google-chrome --version |awk '{print $NF}')",
99
- "debug-karma": "karma start karma.conf.js --browsers=Chrome --single-run=false",
100
- "start": "grunt serve"
99
+ "mocha": "^10.1.0",
100
+ "ngx-build-plus": "^14.0.0",
101
+ "shx": "^0.3.4",
102
+ "start-server-and-test": "^1.14.0",
103
+ "ts-node": "~10.9.1",
104
+ "tslint": "~6.1.3",
105
+ "typescript": "~4.8.4",
106
+ "webpack-cli": "^4.10.0"
101
107
  }
102
108
  }