@f1studio/form-spec 5.0.0-alpha.101 → 5.0.0-alpha.103

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 (161) hide show
  1. package/Components/HelloComponent.d.ts +20 -0
  2. package/Components/HelloComponent.d.ts.map +1 -0
  3. package/Designer.d.ts.map +1 -0
  4. package/FormSpec.TS/Designer.js +2 -2
  5. package/FormSpec.TS/Designer.js.map +1 -1
  6. package/FormSpec.TS/Designer.ts.map +1 -1
  7. package/FormSpec.TS/FormSpec.js +210 -143
  8. package/FormSpec.TS/FormSpec.js.map +1 -1
  9. package/FormSpec.TS/FormSpec.ts.map +1 -1
  10. package/FormSpec.TS/FormSpecHelpers.js +62 -40
  11. package/FormSpec.TS/FormSpecHelpers.js.map +1 -1
  12. package/FormSpec.TS/FormSpecHelpers.ts.map +1 -1
  13. package/FormSpec.TS/FormSpecValues.js +207 -0
  14. package/FormSpec.TS/FormSpecValues.js.map +1 -0
  15. package/FormSpec.TS/FormSpecValues.ts.map +1 -0
  16. package/FormSpec.TS/Helpers.js +26 -25
  17. package/FormSpec.TS/Helpers.js.map +1 -1
  18. package/FormSpec.TS/Helpers.ts.map +1 -1
  19. package/FormSpec.TS/Interop/FormSpec.Api.Helpers.js +85 -125
  20. package/FormSpec.TS/Interop/FormSpec.Api.Helpers.js.map +1 -1
  21. package/FormSpec.TS/Interop/FormSpec.Api.Helpers.ts.map +1 -1
  22. package/FormSpec.TS/Interop/FormSpec.Api.Option.js +37 -7
  23. package/FormSpec.TS/Interop/FormSpec.Api.Option.js.map +1 -1
  24. package/FormSpec.TS/Interop/FormSpec.Api.Option.ts.map +1 -1
  25. package/FormSpec.TS/Interop/FormSpec.Values.Api.Option.js +103 -80
  26. package/FormSpec.TS/Interop/FormSpec.Values.Api.Option.js.map +1 -1
  27. package/FormSpec.TS/Interop/FormSpec.Values.Api.Option.ts.map +1 -1
  28. package/FormSpec.TS/PathwayExecutor.js +371 -125
  29. package/FormSpec.TS/PathwayExecutor.js.map +1 -1
  30. package/FormSpec.TS/PathwayExecutor.ts.map +1 -1
  31. package/FormSpec.TS/PathwayValidator.js +14 -26
  32. package/FormSpec.TS/PathwayValidator.js.map +1 -1
  33. package/FormSpec.TS/PathwayValidator.ts.map +1 -1
  34. package/FormSpec.TS/Renderers/FormSpecMarkdownRenderer.ts.map +1 -1
  35. package/FormSpec.TS/Renderers/PathwayRenderers.js +35 -26
  36. package/FormSpec.TS/Renderers/PathwayRenderers.js.map +1 -1
  37. package/FormSpec.TS/Renderers/PathwayRenderers.ts.map +1 -1
  38. package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Base.fs +0 -0
  39. package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Error.fs +0 -0
  40. package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Extensions.fs +0 -0
  41. package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Fable.Form.fableproj +0 -0
  42. package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Field.fs +0 -0
  43. package/FormSpec.TS/fable_modules/Fable.Form.Simple.5.0.1/Fable.Form.Simple.fableproj +0 -0
  44. package/FormSpec.TS/fable_modules/Fable.Form.Simple.5.0.1/Form.fs +0 -0
  45. package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.Extensions.fs +0 -0
  46. package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.Hooks.fs +0 -0
  47. package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.Types.fableproj +0 -0
  48. package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.fs +0 -0
  49. package/FormSpec.TS/fable_modules/Fable.ReactDom.Types.18.2.0/Fable.ReactDom.Types.fableproj +0 -0
  50. package/FormSpec.TS/fable_modules/Fable.ReactDom.Types.18.2.0/Fable.ReactDom.fs +0 -0
  51. package/FormSpec.TS/fable_modules/Feliz.2.7.0/BorderStyle.fs +0 -0
  52. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Colors.fs +0 -0
  53. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Feliz.fableproj +0 -0
  54. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Fonts.fs +0 -0
  55. package/FormSpec.TS/fable_modules/Feliz.2.7.0/GridTypes.fs +0 -0
  56. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Html.fs +0 -0
  57. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Interop.fs +0 -0
  58. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Key.fs +0 -0
  59. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Length.fs +0 -0
  60. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Locale.fs +0 -0
  61. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Properties.fs +0 -0
  62. package/FormSpec.TS/fable_modules/Feliz.2.7.0/React.fs +0 -0
  63. package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactDOM.fs +0 -0
  64. package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactInterop.js +0 -0
  65. package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactInterop.js.map +0 -0
  66. package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactTypes.fs +0 -0
  67. package/FormSpec.TS/fable_modules/Feliz.2.7.0/StyleTypes.fs +0 -0
  68. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Styles.fs +0 -0
  69. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Svg.fs +0 -0
  70. package/FormSpec.TS/fable_modules/Feliz.2.7.0/TextDecorationLine.fs +0 -0
  71. package/FormSpec.TS/fable_modules/Feliz.2.7.0/TextDecorationStyle.fs +0 -0
  72. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Transform.fs +0 -0
  73. package/FormSpec.TS/fable_modules/Feliz.2.7.0/TransformOrigin.fs +0 -0
  74. package/FormSpec.TS/fable_modules/Feliz.2.7.0/TransitionProperty.fs +0 -0
  75. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Types.fs +0 -0
  76. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Decode.fs +0 -0
  77. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Encode.fs +0 -0
  78. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Encode.fs.js.map +1 -1
  79. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Encode.fs.ts.map +1 -1
  80. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Extra.fs +0 -0
  81. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Thoth.Json.fableproj +0 -0
  82. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Types.fs +0 -0
  83. package/FormSpec.TS/fable_modules/project_cracked.json +1 -1
  84. package/FormSpec.d.ts +56 -43
  85. package/FormSpec.d.ts.map +1 -0
  86. package/FormSpecHelpers.d.ts +18 -12
  87. package/FormSpecHelpers.d.ts.map +1 -0
  88. package/FormSpecValues.d.ts +62 -0
  89. package/FormSpecValues.d.ts.map +1 -0
  90. package/Helpers.d.ts +11 -10
  91. package/Helpers.d.ts.map +1 -0
  92. package/Interfaces.d.ts.map +1 -0
  93. package/Interop/FormSpec.Api.Helpers.d.ts +25 -28
  94. package/Interop/FormSpec.Api.Helpers.d.ts.map +1 -1
  95. package/Interop/FormSpec.Api.Option.d.ts +10 -6
  96. package/Interop/FormSpec.Api.Option.d.ts.map +1 -1
  97. package/Interop/FormSpec.Values.Api.Option.d.ts +35 -22
  98. package/Interop/FormSpec.Values.Api.Option.d.ts.map +1 -1
  99. package/Logging/LogTypes.d.ts +112 -0
  100. package/Logging/LogTypes.d.ts.map +1 -0
  101. package/Migrator.d.ts.map +1 -0
  102. package/PathwayDataExtractor.d.ts.map +1 -0
  103. package/PathwayExecutor.d.ts +63 -33
  104. package/PathwayExecutor.d.ts.map +1 -0
  105. package/PathwayValidator.d.ts.map +1 -0
  106. package/PluginInterface.d.ts.map +1 -0
  107. package/Prelude.d.ts.map +1 -0
  108. package/README.TS.md +621 -621
  109. package/README.md +98 -85
  110. package/Renderers/FormSpecMarkdownRenderer.d.ts +11 -0
  111. package/Renderers/FormSpecMarkdownRenderer.d.ts.map +1 -0
  112. package/Renderers/MermaidRenderer.d.ts +48 -0
  113. package/Renderers/MermaidRenderer.d.ts.map +1 -0
  114. package/Renderers/PathwayRenderers.d.ts +59 -0
  115. package/Renderers/PathwayRenderers.d.ts.map +1 -0
  116. package/fable_modules/Thoth.Json.10.4.1/Decode.fs.d.ts +126 -0
  117. package/fable_modules/Thoth.Json.10.4.1/Decode.fs.d.ts.map +1 -0
  118. package/fable_modules/Thoth.Json.10.4.1/Encode.fs.d.ts +163 -0
  119. package/fable_modules/Thoth.Json.10.4.1/Encode.fs.d.ts.map +1 -0
  120. package/fable_modules/Thoth.Json.10.4.1/Types.fs.d.ts +66 -0
  121. package/fable_modules/Thoth.Json.10.4.1/Types.fs.d.ts.map +1 -0
  122. package/package.json +53 -39
  123. package/src/Components/HelloComponent.ts +48 -48
  124. package/src/Designer.ts +389 -389
  125. package/src/FormSpec.ts +3154 -3114
  126. package/src/FormSpecHelpers.ts +397 -374
  127. package/src/FormSpecValues.ts +158 -0
  128. package/src/Helpers.ts +766 -765
  129. package/src/Interfaces.ts +166 -166
  130. package/src/Interop/FormSpec.Api.Helpers.ts +835 -872
  131. package/src/Interop/FormSpec.Api.Option.ts +1637 -1618
  132. package/src/Interop/FormSpec.Values.Api.Option.ts +1241 -1214
  133. package/src/Logging/LogTypes.ts +212 -212
  134. package/src/Migrator.ts +156 -156
  135. package/src/PathwayDataExtractor.ts +290 -290
  136. package/src/PathwayExecutor.ts +1379 -1102
  137. package/src/PathwayValidator.ts +238 -244
  138. package/src/PluginInterface.ts +79 -79
  139. package/src/Prelude.ts +21 -21
  140. package/src/Renderers/FormSpecMarkdownRenderer.ts +875 -874
  141. package/src/Renderers/MermaidRenderer.ts +218 -218
  142. package/src/Renderers/PathwayRenderers.ts +208 -200
  143. package/src/Components/HelloComponent.ts.map +0 -1
  144. package/src/Designer.ts.map +0 -1
  145. package/src/FormSpec.ts.map +0 -1
  146. package/src/FormSpecHelpers.ts.map +0 -1
  147. package/src/Helpers.ts.map +0 -1
  148. package/src/Interfaces.ts.map +0 -1
  149. package/src/Interop/FormSpec.Api.Helpers.ts.map +0 -1
  150. package/src/Interop/FormSpec.Api.Option.ts.map +0 -1
  151. package/src/Interop/FormSpec.Values.Api.Option.ts.map +0 -1
  152. package/src/Logging/LogTypes.ts.map +0 -1
  153. package/src/Migrator.ts.map +0 -1
  154. package/src/PathwayDataExtractor.ts.map +0 -1
  155. package/src/PathwayExecutor.ts.map +0 -1
  156. package/src/PathwayValidator.ts.map +0 -1
  157. package/src/PluginInterface.ts.map +0 -1
  158. package/src/Prelude.ts.map +0 -1
  159. package/src/Renderers/FormSpecMarkdownRenderer.ts.map +0 -1
  160. package/src/Renderers/MermaidRenderer.ts.map +0 -1
  161. package/src/Renderers/PathwayRenderers.ts.map +0 -1
@@ -1,874 +1,875 @@
1
- import { printf, toText, isNullOrWhiteSpace, join, replicate } from "@fable-org/fable-library-js/String.js";
2
- import { int32 } from "@fable-org/fable-library-js/Int32.js";
3
- import { value as value_4, Option, map, defaultArg } from "@fable-org/fable-library-js/Option.js";
4
- import { Values_FieldDetails$1, Shared_FieldKey, Values_StepOrder, Spec_FormStep$1, Spec_FormSpec$1, ClinicalPathway_ClinicalPathwaySpec, Spec_MatrixInfo, Shared_MatrixItemKey, Shared_MatrixAnswer, Spec_FormField$1, Shared_FieldValue_$union, Spec_FieldType_$union, Spec_MultiChoiceInfo, Spec_SingleChoiceInfo, Shared_PluginDataProperty, Shared_FieldAnswer, Shared_FieldOption } from "../FormSpec.js";
5
- import { partition, isEmpty, FSharpList, map as map_1, choose, tryFind } from "@fable-org/fable-library-js/List.js";
6
- import { FSharpSet, toList } from "@fable-org/fable-library-js/Set.js";
7
- import { singleton, append, delay, toList as toList_1 } from "@fable-org/fable-library-js/Seq.js";
8
- import { compare, IDisposable, disposeSafe, IEnumerator, getEnumerator } from "@fable-org/fable-library-js/Util.js";
9
- import { FSharpMap, empty, FSharpMap__TryFind } from "@fable-org/fable-library-js/Map.js";
10
- import { pathwaySpecToGraph } from "./PathwayRenderers.js";
11
- import { MermaidRenderer_$ctor_Z1FBCCD16 } from "./MermaidRenderer.js";
12
-
13
- function generateHeadingLevel(level: int32): string {
14
- return replicate(level, "#");
15
- }
16
-
17
- function formatFieldValue(fieldType: Spec_FieldType_$union, fieldValue: Shared_FieldValue_$union, field: Spec_FormField$1<Spec_FieldType_$union>): string {
18
- let matchResult: int32, answer: Shared_FieldAnswer, answer_1: Shared_FieldAnswer, answer_2: Shared_FieldAnswer, answer_3: Shared_FieldAnswer, answer_4: Shared_FieldAnswer, answer_5: Shared_FieldAnswer, answer_6: Shared_FieldAnswer, answer_7: Shared_FieldAnswer, answer_8: Shared_FieldAnswer, answer_9: Shared_FieldAnswer, answer_10: Shared_FieldAnswer, answer_11: Shared_FieldAnswer, answer_12: Shared_FieldAnswer, info: Spec_SingleChoiceInfo, answer_13: Shared_FieldAnswer, info_1: Spec_SingleChoiceInfo, answer_14: Shared_FieldAnswer, info_2: Spec_SingleChoiceInfo, answer_15: Shared_FieldAnswer, info_3: Spec_SingleChoiceInfo, answers: FSharpSet<Shared_FieldAnswer>, info_4: Spec_MultiChoiceInfo, answers_1: FSharpSet<Shared_FieldAnswer>, info_5: Spec_MultiChoiceInfo, answers_2: FSharpSet<Shared_FieldAnswer>, info_6: Spec_MultiChoiceInfo, answer_19: Shared_FieldAnswer, answer_20: Shared_FieldAnswer, answer_21: Shared_FieldAnswer, pluginData: FSharpList<Shared_PluginDataProperty>;
19
- switch (fieldType.tag) {
20
- case /* TextArea */ 1: {
21
- switch (fieldValue.tag) {
22
- case /* Multiple */ 1: {
23
- matchResult = 23;
24
- break;
25
- }
26
- case /* Matrix */ 2: {
27
- matchResult = 25;
28
- break;
29
- }
30
- case /* PluginData */ 3: {
31
- matchResult = 26;
32
- pluginData = fieldValue.fields[0];
33
- break;
34
- }
35
- default: {
36
- matchResult = 1;
37
- answer_1 = fieldValue.fields[0];
38
- }
39
- }
40
- break;
41
- }
42
- case /* Email */ 2: {
43
- switch (fieldValue.tag) {
44
- case /* Multiple */ 1: {
45
- matchResult = 23;
46
- break;
47
- }
48
- case /* Matrix */ 2: {
49
- matchResult = 25;
50
- break;
51
- }
52
- case /* PluginData */ 3: {
53
- matchResult = 26;
54
- pluginData = fieldValue.fields[0];
55
- break;
56
- }
57
- default: {
58
- matchResult = 2;
59
- answer_2 = fieldValue.fields[0];
60
- }
61
- }
62
- break;
63
- }
64
- case /* Password */ 3: {
65
- switch (fieldValue.tag) {
66
- case /* Multiple */ 1: {
67
- matchResult = 23;
68
- break;
69
- }
70
- case /* Matrix */ 2: {
71
- matchResult = 25;
72
- break;
73
- }
74
- case /* PluginData */ 3: {
75
- matchResult = 26;
76
- pluginData = fieldValue.fields[0];
77
- break;
78
- }
79
- default: {
80
- matchResult = 3;
81
- answer_3 = fieldValue.fields[0];
82
- }
83
- }
84
- break;
85
- }
86
- case /* Search */ 4: {
87
- switch (fieldValue.tag) {
88
- case /* Multiple */ 1: {
89
- matchResult = 23;
90
- break;
91
- }
92
- case /* Matrix */ 2: {
93
- matchResult = 25;
94
- break;
95
- }
96
- case /* PluginData */ 3: {
97
- matchResult = 26;
98
- pluginData = fieldValue.fields[0];
99
- break;
100
- }
101
- default: {
102
- matchResult = 4;
103
- answer_4 = fieldValue.fields[0];
104
- }
105
- }
106
- break;
107
- }
108
- case /* Color */ 5: {
109
- switch (fieldValue.tag) {
110
- case /* Multiple */ 1: {
111
- matchResult = 23;
112
- break;
113
- }
114
- case /* Matrix */ 2: {
115
- matchResult = 25;
116
- break;
117
- }
118
- case /* PluginData */ 3: {
119
- matchResult = 26;
120
- pluginData = fieldValue.fields[0];
121
- break;
122
- }
123
- default: {
124
- matchResult = 5;
125
- answer_5 = fieldValue.fields[0];
126
- }
127
- }
128
- break;
129
- }
130
- case /* Number */ 6: {
131
- switch (fieldValue.tag) {
132
- case /* Multiple */ 1: {
133
- matchResult = 23;
134
- break;
135
- }
136
- case /* Matrix */ 2: {
137
- matchResult = 25;
138
- break;
139
- }
140
- case /* PluginData */ 3: {
141
- matchResult = 26;
142
- pluginData = fieldValue.fields[0];
143
- break;
144
- }
145
- default: {
146
- matchResult = 6;
147
- answer_6 = fieldValue.fields[0];
148
- }
149
- }
150
- break;
151
- }
152
- case /* Tel */ 7: {
153
- switch (fieldValue.tag) {
154
- case /* Multiple */ 1: {
155
- matchResult = 23;
156
- break;
157
- }
158
- case /* Matrix */ 2: {
159
- matchResult = 25;
160
- break;
161
- }
162
- case /* PluginData */ 3: {
163
- matchResult = 26;
164
- pluginData = fieldValue.fields[0];
165
- break;
166
- }
167
- default: {
168
- matchResult = 7;
169
- answer_7 = fieldValue.fields[0];
170
- }
171
- }
172
- break;
173
- }
174
- case /* Date */ 8: {
175
- switch (fieldValue.tag) {
176
- case /* Multiple */ 1: {
177
- matchResult = 23;
178
- break;
179
- }
180
- case /* Matrix */ 2: {
181
- matchResult = 25;
182
- break;
183
- }
184
- case /* PluginData */ 3: {
185
- matchResult = 26;
186
- pluginData = fieldValue.fields[0];
187
- break;
188
- }
189
- default: {
190
- matchResult = 8;
191
- answer_8 = fieldValue.fields[0];
192
- }
193
- }
194
- break;
195
- }
196
- case /* DateTimeLocal */ 9: {
197
- switch (fieldValue.tag) {
198
- case /* Multiple */ 1: {
199
- matchResult = 23;
200
- break;
201
- }
202
- case /* Matrix */ 2: {
203
- matchResult = 25;
204
- break;
205
- }
206
- case /* PluginData */ 3: {
207
- matchResult = 26;
208
- pluginData = fieldValue.fields[0];
209
- break;
210
- }
211
- default: {
212
- matchResult = 9;
213
- answer_9 = fieldValue.fields[0];
214
- }
215
- }
216
- break;
217
- }
218
- case /* Time */ 10: {
219
- switch (fieldValue.tag) {
220
- case /* Multiple */ 1: {
221
- matchResult = 23;
222
- break;
223
- }
224
- case /* Matrix */ 2: {
225
- matchResult = 25;
226
- break;
227
- }
228
- case /* PluginData */ 3: {
229
- matchResult = 26;
230
- pluginData = fieldValue.fields[0];
231
- break;
232
- }
233
- default: {
234
- matchResult = 10;
235
- answer_10 = fieldValue.fields[0];
236
- }
237
- }
238
- break;
239
- }
240
- case /* Checkbox */ 11: {
241
- switch (fieldValue.tag) {
242
- case /* Multiple */ 1: {
243
- matchResult = 23;
244
- break;
245
- }
246
- case /* Matrix */ 2: {
247
- matchResult = 25;
248
- break;
249
- }
250
- case /* PluginData */ 3: {
251
- matchResult = 26;
252
- pluginData = fieldValue.fields[0];
253
- break;
254
- }
255
- default: {
256
- matchResult = 11;
257
- answer_11 = fieldValue.fields[0];
258
- }
259
- }
260
- break;
261
- }
262
- case /* SingleChoice */ 13: {
263
- switch (fieldValue.tag) {
264
- case /* Multiple */ 1: {
265
- matchResult = 23;
266
- break;
267
- }
268
- case /* Matrix */ 2: {
269
- matchResult = 25;
270
- break;
271
- }
272
- case /* PluginData */ 3: {
273
- matchResult = 26;
274
- pluginData = fieldValue.fields[0];
275
- break;
276
- }
277
- default: {
278
- matchResult = 12;
279
- answer_12 = fieldValue.fields[0];
280
- info = fieldType.fields[0];
281
- }
282
- }
283
- break;
284
- }
285
- case /* Radio */ 12: {
286
- switch (fieldValue.tag) {
287
- case /* Multiple */ 1: {
288
- matchResult = 23;
289
- break;
290
- }
291
- case /* Matrix */ 2: {
292
- matchResult = 25;
293
- break;
294
- }
295
- case /* PluginData */ 3: {
296
- matchResult = 26;
297
- pluginData = fieldValue.fields[0];
298
- break;
299
- }
300
- default: {
301
- matchResult = 13;
302
- answer_13 = fieldValue.fields[0];
303
- info_1 = fieldType.fields[0];
304
- }
305
- }
306
- break;
307
- }
308
- case /* Dropdown */ 14: {
309
- switch (fieldValue.tag) {
310
- case /* Multiple */ 1: {
311
- matchResult = 23;
312
- break;
313
- }
314
- case /* Matrix */ 2: {
315
- matchResult = 25;
316
- break;
317
- }
318
- case /* PluginData */ 3: {
319
- matchResult = 26;
320
- pluginData = fieldValue.fields[0];
321
- break;
322
- }
323
- default: {
324
- matchResult = 14;
325
- answer_14 = fieldValue.fields[0];
326
- info_2 = fieldType.fields[0];
327
- }
328
- }
329
- break;
330
- }
331
- case /* TextAutoComplete */ 18: {
332
- switch (fieldValue.tag) {
333
- case /* Multiple */ 1: {
334
- matchResult = 23;
335
- break;
336
- }
337
- case /* Matrix */ 2: {
338
- matchResult = 25;
339
- break;
340
- }
341
- case /* PluginData */ 3: {
342
- matchResult = 26;
343
- pluginData = fieldValue.fields[0];
344
- break;
345
- }
346
- default: {
347
- matchResult = 15;
348
- answer_15 = fieldValue.fields[0];
349
- info_3 = fieldType.fields[0];
350
- }
351
- }
352
- break;
353
- }
354
- case /* MultiChoice */ 15: {
355
- switch (fieldValue.tag) {
356
- case /* Single */ 0: {
357
- matchResult = 24;
358
- answer_21 = fieldValue.fields[0];
359
- break;
360
- }
361
- case /* Matrix */ 2: {
362
- matchResult = 25;
363
- break;
364
- }
365
- case /* PluginData */ 3: {
366
- matchResult = 26;
367
- pluginData = fieldValue.fields[0];
368
- break;
369
- }
370
- default: {
371
- matchResult = 16;
372
- answers = fieldValue.fields[0];
373
- info_4 = fieldType.fields[0];
374
- }
375
- }
376
- break;
377
- }
378
- case /* CheckboxList */ 16: {
379
- switch (fieldValue.tag) {
380
- case /* Single */ 0: {
381
- matchResult = 24;
382
- answer_21 = fieldValue.fields[0];
383
- break;
384
- }
385
- case /* Matrix */ 2: {
386
- matchResult = 25;
387
- break;
388
- }
389
- case /* PluginData */ 3: {
390
- matchResult = 26;
391
- pluginData = fieldValue.fields[0];
392
- break;
393
- }
394
- default: {
395
- matchResult = 17;
396
- answers_1 = fieldValue.fields[0];
397
- info_5 = fieldType.fields[0];
398
- }
399
- }
400
- break;
401
- }
402
- case /* TagList */ 17: {
403
- switch (fieldValue.tag) {
404
- case /* Single */ 0: {
405
- matchResult = 24;
406
- answer_21 = fieldValue.fields[0];
407
- break;
408
- }
409
- case /* Matrix */ 2: {
410
- matchResult = 25;
411
- break;
412
- }
413
- case /* PluginData */ 3: {
414
- matchResult = 26;
415
- pluginData = fieldValue.fields[0];
416
- break;
417
- }
418
- default: {
419
- matchResult = 18;
420
- answers_2 = fieldValue.fields[0];
421
- info_6 = fieldType.fields[0];
422
- }
423
- }
424
- break;
425
- }
426
- case /* Signature */ 20: {
427
- switch (fieldValue.tag) {
428
- case /* Multiple */ 1: {
429
- matchResult = 23;
430
- break;
431
- }
432
- case /* Matrix */ 2: {
433
- matchResult = 25;
434
- break;
435
- }
436
- case /* PluginData */ 3: {
437
- matchResult = 26;
438
- pluginData = fieldValue.fields[0];
439
- break;
440
- }
441
- default: {
442
- matchResult = 19;
443
- answer_19 = fieldValue.fields[0];
444
- }
445
- }
446
- break;
447
- }
448
- case /* Message */ 21: {
449
- matchResult = 20;
450
- break;
451
- }
452
- case /* PluginField */ 22: {
453
- switch (fieldValue.tag) {
454
- case /* Multiple */ 1: {
455
- matchResult = 23;
456
- break;
457
- }
458
- case /* Matrix */ 2: {
459
- matchResult = 25;
460
- break;
461
- }
462
- case /* PluginData */ 3: {
463
- matchResult = 26;
464
- pluginData = fieldValue.fields[0];
465
- break;
466
- }
467
- default: {
468
- matchResult = 21;
469
- answer_20 = fieldValue.fields[0];
470
- }
471
- }
472
- break;
473
- }
474
- case /* Matrix */ 19: {
475
- matchResult = 22;
476
- break;
477
- }
478
- default:
479
- switch (fieldValue.tag) {
480
- case /* Multiple */ 1: {
481
- matchResult = 23;
482
- break;
483
- }
484
- case /* Matrix */ 2: {
485
- matchResult = 25;
486
- break;
487
- }
488
- case /* PluginData */ 3: {
489
- matchResult = 26;
490
- pluginData = fieldValue.fields[0];
491
- break;
492
- }
493
- default: {
494
- matchResult = 0;
495
- answer = fieldValue.fields[0];
496
- }
497
- }
498
- }
499
- switch (matchResult) {
500
- case 0:
501
- return answer!.Value;
502
- case 1:
503
- return answer_1!.Value;
504
- case 2:
505
- return answer_2!.Value;
506
- case 3:
507
- return "***";
508
- case 4:
509
- return answer_4!.Value;
510
- case 5:
511
- return answer_5!.Value;
512
- case 6:
513
- return answer_6!.Value;
514
- case 7:
515
- return answer_7!.Value;
516
- case 8:
517
- return answer_8!.Value;
518
- case 9:
519
- return answer_9!.Value;
520
- case 10:
521
- return answer_10!.Value;
522
- case 11: {
523
- const matchValue_1: string = answer_11!.Value.toLowerCase();
524
- switch (matchValue_1) {
525
- case "true":
526
- case "yes":
527
- case "1":
528
- return "Yes";
529
- default:
530
- return "No";
531
- }
532
- }
533
- case 12:
534
- return defaultArg(map<Shared_FieldOption, string>((opt_1: Shared_FieldOption): string => opt_1.Description, tryFind<Shared_FieldOption>((opt: Shared_FieldOption): boolean => (opt.Value === answer_12!.Value), info!.Options)), answer_12!.Value);
535
- case 13:
536
- return defaultArg(map<Shared_FieldOption, string>((opt_3: Shared_FieldOption): string => opt_3.Description, tryFind<Shared_FieldOption>((opt_2: Shared_FieldOption): boolean => (opt_2.Value === answer_13!.Value), info_1!.Options)), answer_13!.Value);
537
- case 14:
538
- return defaultArg(map<Shared_FieldOption, string>((opt_5: Shared_FieldOption): string => opt_5.Description, tryFind<Shared_FieldOption>((opt_4: Shared_FieldOption): boolean => (opt_4.Value === answer_14!.Value), info_2!.Options)), answer_14!.Value);
539
- case 15:
540
- return defaultArg(map<Shared_FieldOption, string>((opt_7: Shared_FieldOption): string => opt_7.Description, tryFind<Shared_FieldOption>((opt_6: Shared_FieldOption): boolean => (opt_6.Value === answer_15!.Value), info_3!.Options)), answer_15!.Value);
541
- case 16:
542
- return join(", ", choose<Shared_FieldAnswer, string>((answer_16: Shared_FieldAnswer): Option<string> => map<Shared_FieldOption, string>((opt_9: Shared_FieldOption): string => opt_9.Description, tryFind<Shared_FieldOption>((opt_8: Shared_FieldOption): boolean => (opt_8.Value === answer_16.Value), info_4!.Options)), toList<Shared_FieldAnswer>(answers!)));
543
- case 17:
544
- return join(", ", choose<Shared_FieldAnswer, string>((answer_17: Shared_FieldAnswer): Option<string> => map<Shared_FieldOption, string>((opt_11: Shared_FieldOption): string => opt_11.Description, tryFind<Shared_FieldOption>((opt_10: Shared_FieldOption): boolean => (opt_10.Value === answer_17.Value), info_5!.Options)), toList<Shared_FieldAnswer>(answers_1!)));
545
- case 18:
546
- return join(", ", choose<Shared_FieldAnswer, string>((answer_18: Shared_FieldAnswer): Option<string> => map<Shared_FieldOption, string>((opt_13: Shared_FieldOption): string => opt_13.Description, tryFind<Shared_FieldOption>((opt_12: Shared_FieldOption): boolean => (opt_12.Value === answer_18.Value), info_6!.Options)), toList<Shared_FieldAnswer>(answers_2!)));
547
- case 19:
548
- if (!isNullOrWhiteSpace(answer_19!.Value)) {
549
- return "*Signature provided*";
550
- }
551
- else {
552
- return "*No signature*";
553
- }
554
- case 20:
555
- return "";
556
- case 21:
557
- return answer_20!.Value;
558
- case 22:
559
- return "";
560
- case 23:
561
- return "*Type mismatch: Expected single value*";
562
- case 24:
563
- return answer_21!.Value;
564
- case 25:
565
- return "";
566
- default:
567
- return join(", ", map_1<Shared_PluginDataProperty, string>((prop: Shared_PluginDataProperty): string => {
568
- const matchValue_2: Option<string> = prop.DisplayName;
569
- if (matchValue_2 == null) {
570
- return toText(printf("%s: %s"))(prop.Name)(prop.Value);
571
- }
572
- else {
573
- const displayName: string = value_4(matchValue_2);
574
- return toText(printf("%s: %s"))(displayName)(prop.Value);
575
- }
576
- }, pluginData!));
577
- }
578
- }
579
-
580
- function formatMatrixFieldAsTable(fieldLabel: string, matrixInfo: Spec_MatrixInfo, matrixAnswer: Option<Shared_MatrixAnswer>): string {
581
- let arg_3: string, arg_4: string, arg_6: string, sv_1: string, arg_5: string;
582
- const items: FSharpList<Shared_FieldOption> = matrixInfo.Items;
583
- const options: FSharpList<Shared_FieldOption> = matrixInfo.Options;
584
- if (isEmpty(items) ? true : isEmpty(options)) {
585
- return "";
586
- }
587
- else {
588
- const lines: string[] = [];
589
- void (lines.push(toText(printf("#### %s"))(fieldLabel)));
590
- void (lines.push(""));
591
- const headerCells: FSharpList<string> = toList_1<string>(delay<string>((): Iterable<string> => append<string>(singleton<string>("Symptom"), delay<string>((): Iterable<string> => map_1<Shared_FieldOption, string>((opt: Shared_FieldOption): string => toText(printf("%s (%s)"))(opt.Description)(opt.Value), options)))));
592
- void (lines.push((arg_3 = join(" | ", headerCells), toText(printf("| %s |"))(arg_3))));
593
- const separators: FSharpList<string> = toList_1<string>(delay<string>((): Iterable<string> => append<string>(singleton<string>("---"), delay<string>((): Iterable<string> => map_1<Shared_FieldOption, string>((_arg: Shared_FieldOption): string => "---", options)))));
594
- void (lines.push((arg_4 = join(" | ", separators), toText(printf("| %s |"))(arg_4))));
595
- if (matrixAnswer == null) {
596
- const enumerator_2: IEnumerator<Shared_FieldOption> = getEnumerator(items);
597
- try {
598
- while (enumerator_2["System.Collections.IEnumerator.MoveNext"]()) {
599
- const item_1: Shared_FieldOption = enumerator_2["System.Collections.Generic.IEnumerator`1.get_Current"]();
600
- const rowCells_1: FSharpList<string> = toList_1<string>(delay<string>((): Iterable<string> => append<string>(singleton<string>(item_1.Description), delay<string>((): Iterable<string> => map_1<Shared_FieldOption, string>((_arg_1: Shared_FieldOption): string => "", options)))));
601
- void (lines.push((arg_6 = join(" | ", rowCells_1), toText(printf("| %s |"))(arg_6))));
602
- }
603
- }
604
- finally {
605
- disposeSafe(enumerator_2 as IDisposable);
606
- }
607
- }
608
- else {
609
- const answer: Shared_MatrixAnswer = value_4(matrixAnswer);
610
- const enumerator: IEnumerator<Shared_FieldOption> = getEnumerator(items);
611
- try {
612
- while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
613
- const item: Shared_FieldOption = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
614
- const selectedValue: Option<string> = FSharpMap__TryFind(answer.Values, new Shared_MatrixItemKey(item.OptionKey.fields[0]));
615
- const rowCells: string[] = [];
616
- void (rowCells.push(item.Description));
617
- const enumerator_1: IEnumerator<Shared_FieldOption> = getEnumerator(options);
618
- try {
619
- while (enumerator_1["System.Collections.IEnumerator.MoveNext"]()) {
620
- const option: Shared_FieldOption = enumerator_1["System.Collections.Generic.IEnumerator`1.get_Current"]();
621
- if ((selectedValue != null) && ((value_4(selectedValue) === option.Value) && ((sv_1 = value_4(selectedValue), true)))) {
622
- void (rowCells.push("✔️"));
623
- }
624
- else {
625
- void (rowCells.push(""));
626
- }
627
- }
628
- }
629
- finally {
630
- disposeSafe(enumerator_1 as IDisposable);
631
- }
632
- void (lines.push((arg_5 = join(" | ", rowCells), toText(printf("| %s |"))(arg_5))));
633
- }
634
- }
635
- finally {
636
- disposeSafe(enumerator as IDisposable);
637
- }
638
- }
639
- void (lines.push(""));
640
- return join("\n", lines);
641
- }
642
- }
643
-
644
- function getFieldTypeName(fieldType: Spec_FieldType_$union): string {
645
- switch (fieldType.tag) {
646
- case /* TextArea */ 1:
647
- return "TextArea";
648
- case /* Email */ 2:
649
- return "Email";
650
- case /* Password */ 3:
651
- return "Password";
652
- case /* Search */ 4:
653
- return "Search";
654
- case /* Color */ 5:
655
- return "Color";
656
- case /* Number */ 6:
657
- return "Number";
658
- case /* Tel */ 7:
659
- return "Tel";
660
- case /* Date */ 8:
661
- return "Date";
662
- case /* DateTimeLocal */ 9:
663
- return "DateTimeLocal";
664
- case /* Time */ 10:
665
- return "Time";
666
- case /* Checkbox */ 11:
667
- return "Checkbox";
668
- case /* SingleChoice */ 13:
669
- return "SingleChoice";
670
- case /* Radio */ 12:
671
- return "Radio";
672
- case /* Dropdown */ 14:
673
- return "Dropdown";
674
- case /* TextAutoComplete */ 18:
675
- return "TextAutoComplete";
676
- case /* MultiChoice */ 15:
677
- return "MultiChoice";
678
- case /* CheckboxList */ 16:
679
- return "CheckboxList";
680
- case /* TagList */ 17:
681
- return "TagList";
682
- case /* Signature */ 20:
683
- return "Signature";
684
- case /* Message */ 21:
685
- return "Message";
686
- case /* Matrix */ 19:
687
- return "Matrix";
688
- case /* PluginField */ 22:
689
- return "PluginField";
690
- default:
691
- return "Text";
692
- }
693
- }
694
-
695
- function generatePathwayMermaid(pathway: ClinicalPathway_ClinicalPathwaySpec, formSpec: Spec_FormSpec$1<Spec_FieldType_$union>): string {
696
- return pathwaySpecToGraph<void, void, string>(MermaidRenderer_$ctor_Z1FBCCD16(true), pathway, formSpec);
697
- }
698
-
699
- /**
700
- * Renders a FormSpec to markdown format with configurable heading levels and optional pathway diagrams.
701
- * Uses well-typed Spec.FieldType and Values.FieldValue throughout - NO boxing/unboxing.
702
- */
703
- export function renderFormSpecToMarkdown(startHeading: int32, withPathway: boolean, formSpec: Spec_FormSpec$1<Spec_FieldType_$union>, formValues: Option<FSharpMap<Values_StepOrder, FSharpMap<Shared_FieldKey, Values_FieldDetails$1<Spec_FieldType_$union>>>>): string {
704
- let matchValue_4: Option<Values_FieldDetails$1<Spec_FieldType_$union>>, matchValue_5: Shared_FieldValue_$union;
705
- const lines: string[] = [];
706
- const titleHeading: string = generateHeadingLevel(startHeading);
707
- void (lines.push(`${titleHeading} ${formSpec.Title}`));
708
- void (lines.push(""));
709
- const matchValue: Option<string> = formSpec.Code;
710
- if (matchValue == null) {
711
- }
712
- else {
713
- const code: string = value_4(matchValue);
714
- void (lines.push(`**Code:** ${code}`));
715
- }
716
- void (lines.push(`**Version:** ${formSpec.Version}`));
717
- void (lines.push(""));
718
- if (!isNullOrWhiteSpace(formSpec.Abstract)) {
719
- void (lines.push(formSpec.Abstract));
720
- void (lines.push(""));
721
- }
722
- if (!isEmpty(formSpec.CategoryTags)) {
723
- const categoryHeading: string = generateHeadingLevel(startHeading + 1);
724
- void (lines.push(`${categoryHeading} Categories`));
725
- void (lines.push(""));
726
- const enumerator: IEnumerator<string> = getEnumerator(formSpec.CategoryTags);
727
- try {
728
- while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
729
- const tag: string = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
730
- void (lines.push(`- ${tag}`));
731
- }
732
- }
733
- finally {
734
- disposeSafe(enumerator as IDisposable);
735
- }
736
- void (lines.push(""));
737
- }
738
- if (!isEmpty(formSpec.AssociatedCodes)) {
739
- const codesHeading: string = generateHeadingLevel(startHeading + 1);
740
- void (lines.push(`${codesHeading} Associated Codes`));
741
- void (lines.push(""));
742
- const enumerator_1: IEnumerator<string> = getEnumerator(formSpec.AssociatedCodes);
743
- try {
744
- while (enumerator_1["System.Collections.IEnumerator.MoveNext"]()) {
745
- const code_1: string = enumerator_1["System.Collections.Generic.IEnumerator`1.get_Current"]();
746
- void (lines.push(`- \`${code_1}\``));
747
- }
748
- }
749
- finally {
750
- disposeSafe(enumerator_1 as IDisposable);
751
- }
752
- void (lines.push(""));
753
- }
754
- const stepHeading: string = generateHeadingLevel(startHeading + 1);
755
- const enumerator_2: IEnumerator<Spec_FormStep$1<Spec_FieldType_$union>> = getEnumerator(formSpec.Steps);
756
- try {
757
- while (enumerator_2["System.Collections.IEnumerator.MoveNext"]()) {
758
- const step: Spec_FormStep$1<Spec_FieldType_$union> = enumerator_2["System.Collections.Generic.IEnumerator`1.get_Current"]();
759
- const stepLabel: string = isNullOrWhiteSpace(step.StepLabel) ? (`Step ${step.StepOrder}`) : step.StepLabel;
760
- void (lines.push(`${stepHeading} ${stepLabel}`));
761
- void (lines.push(""));
762
- const patternInput: [FSharpList<Spec_FormField$1<Spec_FieldType_$union>>, FSharpList<Spec_FormField$1<Spec_FieldType_$union>>] = partition<Spec_FormField$1<Spec_FieldType_$union>>((field: Spec_FormField$1<Spec_FieldType_$union>): boolean => {
763
- if (field.FieldType.tag === /* Matrix */ 19) {
764
- return true;
765
- }
766
- else {
767
- return false;
768
- }
769
- }, step.Fields);
770
- const regularFields: FSharpList<Spec_FormField$1<Spec_FieldType_$union>> = patternInput[1];
771
- const matrixFields: FSharpList<Spec_FormField$1<Spec_FieldType_$union>> = patternInput[0];
772
- if (formValues == null) {
773
- if (!isEmpty(regularFields)) {
774
- void (lines.push("**Fields:**"));
775
- const enumerator_5: IEnumerator<Spec_FormField$1<Spec_FieldType_$union>> = getEnumerator(regularFields);
776
- try {
777
- while (enumerator_5["System.Collections.IEnumerator.MoveNext"]()) {
778
- const field_3: Spec_FormField$1<Spec_FieldType_$union> = enumerator_5["System.Collections.Generic.IEnumerator`1.get_Current"]();
779
- const fieldTypeName: string = getFieldTypeName(field_3.FieldType);
780
- const requiredText: string = field_3.IsOptional ? "" : " *(required)*";
781
- void (lines.push(toText(printf("- %s%s [%s]"))(field_3.Label)(requiredText)(fieldTypeName)));
782
- }
783
- }
784
- finally {
785
- disposeSafe(enumerator_5 as IDisposable);
786
- }
787
- void (lines.push(""));
788
- }
789
- const enumerator_6: IEnumerator<Spec_FormField$1<Spec_FieldType_$union>> = getEnumerator(matrixFields);
790
- try {
791
- while (enumerator_6["System.Collections.IEnumerator.MoveNext"]()) {
792
- const field_4: Spec_FormField$1<Spec_FieldType_$union> = enumerator_6["System.Collections.Generic.IEnumerator`1.get_Current"]();
793
- const fieldTypeName_1: string = getFieldTypeName(field_4.FieldType);
794
- const requiredText_1: string = field_4.IsOptional ? "" : " *(required)*";
795
- void (lines.push(toText(printf("- %s%s [%s]"))(field_4.Label)(requiredText_1)(fieldTypeName_1)));
796
- }
797
- }
798
- finally {
799
- disposeSafe(enumerator_6 as IDisposable);
800
- }
801
- }
802
- else {
803
- const stepValues: FSharpMap<Shared_FieldKey, Values_FieldDetails$1<Spec_FieldType_$union>> = defaultArg(FSharpMap__TryFind(value_4(formValues), new Values_StepOrder(step.StepOrder)), empty<Shared_FieldKey, Values_FieldDetails$1<Spec_FieldType_$union>>({
804
- Compare: compare,
805
- }));
806
- const enumerator_3: IEnumerator<Spec_FormField$1<Spec_FieldType_$union>> = getEnumerator(regularFields);
807
- try {
808
- while (enumerator_3["System.Collections.IEnumerator.MoveNext"]()) {
809
- const field_1: Spec_FormField$1<Spec_FieldType_$union> = enumerator_3["System.Collections.Generic.IEnumerator`1.get_Current"]();
810
- const matchValue_2: Option<Values_FieldDetails$1<Spec_FieldType_$union>> = FSharpMap__TryFind(stepValues, field_1.FieldKey);
811
- if (matchValue_2 == null) {
812
- void (lines.push(toText(printf("- **%s**: *No response provided*"))(field_1.Label)));
813
- }
814
- else {
815
- const formattedValue: string = formatFieldValue(field_1.FieldType, value_4(matchValue_2).FieldValue, field_1);
816
- if (!isNullOrWhiteSpace(formattedValue)) {
817
- void (lines.push(toText(printf("- **%s**: %s"))(field_1.Label)(formattedValue)));
818
- }
819
- }
820
- }
821
- }
822
- finally {
823
- disposeSafe(enumerator_3 as IDisposable);
824
- }
825
- const enumerator_4: IEnumerator<Spec_FormField$1<Spec_FieldType_$union>> = getEnumerator(matrixFields);
826
- try {
827
- while (enumerator_4["System.Collections.IEnumerator.MoveNext"]()) {
828
- const field_2: Spec_FormField$1<Spec_FieldType_$union> = enumerator_4["System.Collections.Generic.IEnumerator`1.get_Current"]();
829
- const matchValue_3: Spec_FieldType_$union = field_2.FieldType;
830
- if (matchValue_3.tag === /* Matrix */ 19) {
831
- const tableMarkdown: string = formatMatrixFieldAsTable(field_2.Label, matchValue_3.fields[0], (matchValue_4 = FSharpMap__TryFind(stepValues, field_2.FieldKey), (matchValue_4 == null) ? undefined : ((matchValue_5 = value_4(matchValue_4).FieldValue, (matchValue_5.tag === /* Single */ 0) ? undefined : ((matchValue_5.tag === /* Multiple */ 1) ? undefined : ((matchValue_5.tag === /* PluginData */ 3) ? undefined : matchValue_5.fields[0]))))));
832
- if (!isNullOrWhiteSpace(tableMarkdown)) {
833
- void (lines.push(""));
834
- void (lines.push(tableMarkdown));
835
- }
836
- }
837
- }
838
- }
839
- finally {
840
- disposeSafe(enumerator_4 as IDisposable);
841
- }
842
- }
843
- void (lines.push(""));
844
- }
845
- }
846
- finally {
847
- disposeSafe(enumerator_2 as IDisposable);
848
- }
849
- if (withPathway) {
850
- const matchValue_6: Option<ClinicalPathway_ClinicalPathwaySpec> = formSpec.ClinicalPathway;
851
- if (matchValue_6 == null) {
852
- }
853
- else {
854
- const pathway: ClinicalPathway_ClinicalPathwaySpec = value_4(matchValue_6);
855
- const pathwayHeading: string = generateHeadingLevel(startHeading + 1);
856
- void (lines.push(`${pathwayHeading} Clinical Pathway`));
857
- void (lines.push(""));
858
- const mermaid: string = generatePathwayMermaid(pathway, formSpec);
859
- void (lines.push(mermaid));
860
- void (lines.push(""));
861
- }
862
- }
863
- const reviewHeading: string = generateHeadingLevel(startHeading + 1);
864
- void (lines.push(`${reviewHeading} Review Requirements`));
865
- void (lines.push(""));
866
- const requiresReviewText: string = formSpec.RequiresReview ? "Yes" : "No";
867
- const requiresReviewAndApprovalText: string = formSpec.RequiresReviewAndApproval ? "Yes" : "No";
868
- void (lines.push(toText(printf("- **Requires Review:** %s"))(requiresReviewText)));
869
- void (lines.push(toText(printf("- **Requires Review and Approval:** %s"))(requiresReviewAndApprovalText)));
870
- void (lines.push(""));
871
- return join("\n", lines);
872
- }
873
-
874
- //# sourceMappingURL=FormSpecMarkdownRenderer.ts.map
1
+ import { printf, toText, isNullOrWhiteSpace, join, replicate } from "@fable-org/fable-library-js/String.js";
2
+ import { int32 } from "@fable-org/fable-library-js/Int32.js";
3
+ import { value as value_4, Option, map, defaultArg } from "@fable-org/fable-library-js/Option.js";
4
+ import { Shared_FieldKey, Values_StepOrder, Spec_FormStep$1, Spec_FormSpec$1, ClinicalPathway_ClinicalPathwaySpec, Spec_MatrixInfo, Shared_MatrixItemKey, Shared_MatrixAnswer, Spec_FormField$1, Shared_FieldValue_$union, Spec_FieldType_$union, Spec_MultiChoiceInfo, Spec_SingleChoiceInfo, Shared_PluginDataProperty, Shared_FieldAnswer, Shared_FieldOption } from "../FormSpec.js";
5
+ import { partition, isEmpty, FSharpList, map as map_1, choose, tryFind } from "@fable-org/fable-library-js/List.js";
6
+ import { FSharpSet, toList } from "@fable-org/fable-library-js/Set.js";
7
+ import { singleton, append, delay, toList as toList_1 } from "@fable-org/fable-library-js/Seq.js";
8
+ import { compare, IDisposable, disposeSafe, IEnumerator, getEnumerator } from "@fable-org/fable-library-js/Util.js";
9
+ import { FSharpMap, empty, FSharpMap__TryFind } from "@fable-org/fable-library-js/Map.js";
10
+ import { pathwaySpecToGraph } from "./PathwayRenderers.js";
11
+ import { MermaidRenderer_$ctor_Z1FBCCD16 } from "./MermaidRenderer.js";
12
+ import { FieldDetails$1 } from "../FormSpecValues.js";
13
+
14
+ function generateHeadingLevel(level: int32): string {
15
+ return replicate(level, "#");
16
+ }
17
+
18
+ function formatFieldValue(fieldType: Spec_FieldType_$union, fieldValue: Shared_FieldValue_$union, field: Spec_FormField$1<Spec_FieldType_$union>): string {
19
+ let matchResult: int32, answer: Shared_FieldAnswer, answer_1: Shared_FieldAnswer, answer_2: Shared_FieldAnswer, answer_3: Shared_FieldAnswer, answer_4: Shared_FieldAnswer, answer_5: Shared_FieldAnswer, answer_6: Shared_FieldAnswer, answer_7: Shared_FieldAnswer, answer_8: Shared_FieldAnswer, answer_9: Shared_FieldAnswer, answer_10: Shared_FieldAnswer, answer_11: Shared_FieldAnswer, answer_12: Shared_FieldAnswer, info: Spec_SingleChoiceInfo, answer_13: Shared_FieldAnswer, info_1: Spec_SingleChoiceInfo, answer_14: Shared_FieldAnswer, info_2: Spec_SingleChoiceInfo, answer_15: Shared_FieldAnswer, info_3: Spec_SingleChoiceInfo, answers: FSharpSet<Shared_FieldAnswer>, info_4: Spec_MultiChoiceInfo, answers_1: FSharpSet<Shared_FieldAnswer>, info_5: Spec_MultiChoiceInfo, answers_2: FSharpSet<Shared_FieldAnswer>, info_6: Spec_MultiChoiceInfo, answer_19: Shared_FieldAnswer, answer_20: Shared_FieldAnswer, answer_21: Shared_FieldAnswer, pluginData: FSharpList<Shared_PluginDataProperty>;
20
+ switch (fieldType.tag) {
21
+ case /* TextArea */ 1: {
22
+ switch (fieldValue.tag) {
23
+ case /* Multiple */ 1: {
24
+ matchResult = 23;
25
+ break;
26
+ }
27
+ case /* Matrix */ 2: {
28
+ matchResult = 25;
29
+ break;
30
+ }
31
+ case /* PluginData */ 3: {
32
+ matchResult = 26;
33
+ pluginData = fieldValue.fields[0];
34
+ break;
35
+ }
36
+ default: {
37
+ matchResult = 1;
38
+ answer_1 = fieldValue.fields[0];
39
+ }
40
+ }
41
+ break;
42
+ }
43
+ case /* Email */ 2: {
44
+ switch (fieldValue.tag) {
45
+ case /* Multiple */ 1: {
46
+ matchResult = 23;
47
+ break;
48
+ }
49
+ case /* Matrix */ 2: {
50
+ matchResult = 25;
51
+ break;
52
+ }
53
+ case /* PluginData */ 3: {
54
+ matchResult = 26;
55
+ pluginData = fieldValue.fields[0];
56
+ break;
57
+ }
58
+ default: {
59
+ matchResult = 2;
60
+ answer_2 = fieldValue.fields[0];
61
+ }
62
+ }
63
+ break;
64
+ }
65
+ case /* Password */ 3: {
66
+ switch (fieldValue.tag) {
67
+ case /* Multiple */ 1: {
68
+ matchResult = 23;
69
+ break;
70
+ }
71
+ case /* Matrix */ 2: {
72
+ matchResult = 25;
73
+ break;
74
+ }
75
+ case /* PluginData */ 3: {
76
+ matchResult = 26;
77
+ pluginData = fieldValue.fields[0];
78
+ break;
79
+ }
80
+ default: {
81
+ matchResult = 3;
82
+ answer_3 = fieldValue.fields[0];
83
+ }
84
+ }
85
+ break;
86
+ }
87
+ case /* Search */ 4: {
88
+ switch (fieldValue.tag) {
89
+ case /* Multiple */ 1: {
90
+ matchResult = 23;
91
+ break;
92
+ }
93
+ case /* Matrix */ 2: {
94
+ matchResult = 25;
95
+ break;
96
+ }
97
+ case /* PluginData */ 3: {
98
+ matchResult = 26;
99
+ pluginData = fieldValue.fields[0];
100
+ break;
101
+ }
102
+ default: {
103
+ matchResult = 4;
104
+ answer_4 = fieldValue.fields[0];
105
+ }
106
+ }
107
+ break;
108
+ }
109
+ case /* Color */ 5: {
110
+ switch (fieldValue.tag) {
111
+ case /* Multiple */ 1: {
112
+ matchResult = 23;
113
+ break;
114
+ }
115
+ case /* Matrix */ 2: {
116
+ matchResult = 25;
117
+ break;
118
+ }
119
+ case /* PluginData */ 3: {
120
+ matchResult = 26;
121
+ pluginData = fieldValue.fields[0];
122
+ break;
123
+ }
124
+ default: {
125
+ matchResult = 5;
126
+ answer_5 = fieldValue.fields[0];
127
+ }
128
+ }
129
+ break;
130
+ }
131
+ case /* Number */ 6: {
132
+ switch (fieldValue.tag) {
133
+ case /* Multiple */ 1: {
134
+ matchResult = 23;
135
+ break;
136
+ }
137
+ case /* Matrix */ 2: {
138
+ matchResult = 25;
139
+ break;
140
+ }
141
+ case /* PluginData */ 3: {
142
+ matchResult = 26;
143
+ pluginData = fieldValue.fields[0];
144
+ break;
145
+ }
146
+ default: {
147
+ matchResult = 6;
148
+ answer_6 = fieldValue.fields[0];
149
+ }
150
+ }
151
+ break;
152
+ }
153
+ case /* Tel */ 7: {
154
+ switch (fieldValue.tag) {
155
+ case /* Multiple */ 1: {
156
+ matchResult = 23;
157
+ break;
158
+ }
159
+ case /* Matrix */ 2: {
160
+ matchResult = 25;
161
+ break;
162
+ }
163
+ case /* PluginData */ 3: {
164
+ matchResult = 26;
165
+ pluginData = fieldValue.fields[0];
166
+ break;
167
+ }
168
+ default: {
169
+ matchResult = 7;
170
+ answer_7 = fieldValue.fields[0];
171
+ }
172
+ }
173
+ break;
174
+ }
175
+ case /* Date */ 8: {
176
+ switch (fieldValue.tag) {
177
+ case /* Multiple */ 1: {
178
+ matchResult = 23;
179
+ break;
180
+ }
181
+ case /* Matrix */ 2: {
182
+ matchResult = 25;
183
+ break;
184
+ }
185
+ case /* PluginData */ 3: {
186
+ matchResult = 26;
187
+ pluginData = fieldValue.fields[0];
188
+ break;
189
+ }
190
+ default: {
191
+ matchResult = 8;
192
+ answer_8 = fieldValue.fields[0];
193
+ }
194
+ }
195
+ break;
196
+ }
197
+ case /* DateTimeLocal */ 9: {
198
+ switch (fieldValue.tag) {
199
+ case /* Multiple */ 1: {
200
+ matchResult = 23;
201
+ break;
202
+ }
203
+ case /* Matrix */ 2: {
204
+ matchResult = 25;
205
+ break;
206
+ }
207
+ case /* PluginData */ 3: {
208
+ matchResult = 26;
209
+ pluginData = fieldValue.fields[0];
210
+ break;
211
+ }
212
+ default: {
213
+ matchResult = 9;
214
+ answer_9 = fieldValue.fields[0];
215
+ }
216
+ }
217
+ break;
218
+ }
219
+ case /* Time */ 10: {
220
+ switch (fieldValue.tag) {
221
+ case /* Multiple */ 1: {
222
+ matchResult = 23;
223
+ break;
224
+ }
225
+ case /* Matrix */ 2: {
226
+ matchResult = 25;
227
+ break;
228
+ }
229
+ case /* PluginData */ 3: {
230
+ matchResult = 26;
231
+ pluginData = fieldValue.fields[0];
232
+ break;
233
+ }
234
+ default: {
235
+ matchResult = 10;
236
+ answer_10 = fieldValue.fields[0];
237
+ }
238
+ }
239
+ break;
240
+ }
241
+ case /* Checkbox */ 11: {
242
+ switch (fieldValue.tag) {
243
+ case /* Multiple */ 1: {
244
+ matchResult = 23;
245
+ break;
246
+ }
247
+ case /* Matrix */ 2: {
248
+ matchResult = 25;
249
+ break;
250
+ }
251
+ case /* PluginData */ 3: {
252
+ matchResult = 26;
253
+ pluginData = fieldValue.fields[0];
254
+ break;
255
+ }
256
+ default: {
257
+ matchResult = 11;
258
+ answer_11 = fieldValue.fields[0];
259
+ }
260
+ }
261
+ break;
262
+ }
263
+ case /* SingleChoice */ 13: {
264
+ switch (fieldValue.tag) {
265
+ case /* Multiple */ 1: {
266
+ matchResult = 23;
267
+ break;
268
+ }
269
+ case /* Matrix */ 2: {
270
+ matchResult = 25;
271
+ break;
272
+ }
273
+ case /* PluginData */ 3: {
274
+ matchResult = 26;
275
+ pluginData = fieldValue.fields[0];
276
+ break;
277
+ }
278
+ default: {
279
+ matchResult = 12;
280
+ answer_12 = fieldValue.fields[0];
281
+ info = fieldType.fields[0];
282
+ }
283
+ }
284
+ break;
285
+ }
286
+ case /* Radio */ 12: {
287
+ switch (fieldValue.tag) {
288
+ case /* Multiple */ 1: {
289
+ matchResult = 23;
290
+ break;
291
+ }
292
+ case /* Matrix */ 2: {
293
+ matchResult = 25;
294
+ break;
295
+ }
296
+ case /* PluginData */ 3: {
297
+ matchResult = 26;
298
+ pluginData = fieldValue.fields[0];
299
+ break;
300
+ }
301
+ default: {
302
+ matchResult = 13;
303
+ answer_13 = fieldValue.fields[0];
304
+ info_1 = fieldType.fields[0];
305
+ }
306
+ }
307
+ break;
308
+ }
309
+ case /* Dropdown */ 14: {
310
+ switch (fieldValue.tag) {
311
+ case /* Multiple */ 1: {
312
+ matchResult = 23;
313
+ break;
314
+ }
315
+ case /* Matrix */ 2: {
316
+ matchResult = 25;
317
+ break;
318
+ }
319
+ case /* PluginData */ 3: {
320
+ matchResult = 26;
321
+ pluginData = fieldValue.fields[0];
322
+ break;
323
+ }
324
+ default: {
325
+ matchResult = 14;
326
+ answer_14 = fieldValue.fields[0];
327
+ info_2 = fieldType.fields[0];
328
+ }
329
+ }
330
+ break;
331
+ }
332
+ case /* TextAutoComplete */ 18: {
333
+ switch (fieldValue.tag) {
334
+ case /* Multiple */ 1: {
335
+ matchResult = 23;
336
+ break;
337
+ }
338
+ case /* Matrix */ 2: {
339
+ matchResult = 25;
340
+ break;
341
+ }
342
+ case /* PluginData */ 3: {
343
+ matchResult = 26;
344
+ pluginData = fieldValue.fields[0];
345
+ break;
346
+ }
347
+ default: {
348
+ matchResult = 15;
349
+ answer_15 = fieldValue.fields[0];
350
+ info_3 = fieldType.fields[0];
351
+ }
352
+ }
353
+ break;
354
+ }
355
+ case /* MultiChoice */ 15: {
356
+ switch (fieldValue.tag) {
357
+ case /* Single */ 0: {
358
+ matchResult = 24;
359
+ answer_21 = fieldValue.fields[0];
360
+ break;
361
+ }
362
+ case /* Matrix */ 2: {
363
+ matchResult = 25;
364
+ break;
365
+ }
366
+ case /* PluginData */ 3: {
367
+ matchResult = 26;
368
+ pluginData = fieldValue.fields[0];
369
+ break;
370
+ }
371
+ default: {
372
+ matchResult = 16;
373
+ answers = fieldValue.fields[0];
374
+ info_4 = fieldType.fields[0];
375
+ }
376
+ }
377
+ break;
378
+ }
379
+ case /* CheckboxList */ 16: {
380
+ switch (fieldValue.tag) {
381
+ case /* Single */ 0: {
382
+ matchResult = 24;
383
+ answer_21 = fieldValue.fields[0];
384
+ break;
385
+ }
386
+ case /* Matrix */ 2: {
387
+ matchResult = 25;
388
+ break;
389
+ }
390
+ case /* PluginData */ 3: {
391
+ matchResult = 26;
392
+ pluginData = fieldValue.fields[0];
393
+ break;
394
+ }
395
+ default: {
396
+ matchResult = 17;
397
+ answers_1 = fieldValue.fields[0];
398
+ info_5 = fieldType.fields[0];
399
+ }
400
+ }
401
+ break;
402
+ }
403
+ case /* TagList */ 17: {
404
+ switch (fieldValue.tag) {
405
+ case /* Single */ 0: {
406
+ matchResult = 24;
407
+ answer_21 = fieldValue.fields[0];
408
+ break;
409
+ }
410
+ case /* Matrix */ 2: {
411
+ matchResult = 25;
412
+ break;
413
+ }
414
+ case /* PluginData */ 3: {
415
+ matchResult = 26;
416
+ pluginData = fieldValue.fields[0];
417
+ break;
418
+ }
419
+ default: {
420
+ matchResult = 18;
421
+ answers_2 = fieldValue.fields[0];
422
+ info_6 = fieldType.fields[0];
423
+ }
424
+ }
425
+ break;
426
+ }
427
+ case /* Signature */ 20: {
428
+ switch (fieldValue.tag) {
429
+ case /* Multiple */ 1: {
430
+ matchResult = 23;
431
+ break;
432
+ }
433
+ case /* Matrix */ 2: {
434
+ matchResult = 25;
435
+ break;
436
+ }
437
+ case /* PluginData */ 3: {
438
+ matchResult = 26;
439
+ pluginData = fieldValue.fields[0];
440
+ break;
441
+ }
442
+ default: {
443
+ matchResult = 19;
444
+ answer_19 = fieldValue.fields[0];
445
+ }
446
+ }
447
+ break;
448
+ }
449
+ case /* Message */ 21: {
450
+ matchResult = 20;
451
+ break;
452
+ }
453
+ case /* PluginField */ 22: {
454
+ switch (fieldValue.tag) {
455
+ case /* Multiple */ 1: {
456
+ matchResult = 23;
457
+ break;
458
+ }
459
+ case /* Matrix */ 2: {
460
+ matchResult = 25;
461
+ break;
462
+ }
463
+ case /* PluginData */ 3: {
464
+ matchResult = 26;
465
+ pluginData = fieldValue.fields[0];
466
+ break;
467
+ }
468
+ default: {
469
+ matchResult = 21;
470
+ answer_20 = fieldValue.fields[0];
471
+ }
472
+ }
473
+ break;
474
+ }
475
+ case /* Matrix */ 19: {
476
+ matchResult = 22;
477
+ break;
478
+ }
479
+ default:
480
+ switch (fieldValue.tag) {
481
+ case /* Multiple */ 1: {
482
+ matchResult = 23;
483
+ break;
484
+ }
485
+ case /* Matrix */ 2: {
486
+ matchResult = 25;
487
+ break;
488
+ }
489
+ case /* PluginData */ 3: {
490
+ matchResult = 26;
491
+ pluginData = fieldValue.fields[0];
492
+ break;
493
+ }
494
+ default: {
495
+ matchResult = 0;
496
+ answer = fieldValue.fields[0];
497
+ }
498
+ }
499
+ }
500
+ switch (matchResult) {
501
+ case 0:
502
+ return answer!.Value;
503
+ case 1:
504
+ return answer_1!.Value;
505
+ case 2:
506
+ return answer_2!.Value;
507
+ case 3:
508
+ return "***";
509
+ case 4:
510
+ return answer_4!.Value;
511
+ case 5:
512
+ return answer_5!.Value;
513
+ case 6:
514
+ return answer_6!.Value;
515
+ case 7:
516
+ return answer_7!.Value;
517
+ case 8:
518
+ return answer_8!.Value;
519
+ case 9:
520
+ return answer_9!.Value;
521
+ case 10:
522
+ return answer_10!.Value;
523
+ case 11: {
524
+ const matchValue_1: string = answer_11!.Value.toLowerCase();
525
+ switch (matchValue_1) {
526
+ case "true":
527
+ case "yes":
528
+ case "1":
529
+ return "Yes";
530
+ default:
531
+ return "No";
532
+ }
533
+ }
534
+ case 12:
535
+ return defaultArg(map<Shared_FieldOption, string>((opt_1: Shared_FieldOption): string => opt_1.Description, tryFind<Shared_FieldOption>((opt: Shared_FieldOption): boolean => (opt.Value === answer_12!.Value), info!.Options)), answer_12!.Value);
536
+ case 13:
537
+ return defaultArg(map<Shared_FieldOption, string>((opt_3: Shared_FieldOption): string => opt_3.Description, tryFind<Shared_FieldOption>((opt_2: Shared_FieldOption): boolean => (opt_2.Value === answer_13!.Value), info_1!.Options)), answer_13!.Value);
538
+ case 14:
539
+ return defaultArg(map<Shared_FieldOption, string>((opt_5: Shared_FieldOption): string => opt_5.Description, tryFind<Shared_FieldOption>((opt_4: Shared_FieldOption): boolean => (opt_4.Value === answer_14!.Value), info_2!.Options)), answer_14!.Value);
540
+ case 15:
541
+ return defaultArg(map<Shared_FieldOption, string>((opt_7: Shared_FieldOption): string => opt_7.Description, tryFind<Shared_FieldOption>((opt_6: Shared_FieldOption): boolean => (opt_6.Value === answer_15!.Value), info_3!.Options)), answer_15!.Value);
542
+ case 16:
543
+ return join(", ", choose<Shared_FieldAnswer, string>((answer_16: Shared_FieldAnswer): Option<string> => map<Shared_FieldOption, string>((opt_9: Shared_FieldOption): string => opt_9.Description, tryFind<Shared_FieldOption>((opt_8: Shared_FieldOption): boolean => (opt_8.Value === answer_16.Value), info_4!.Options)), toList<Shared_FieldAnswer>(answers!)));
544
+ case 17:
545
+ return join(", ", choose<Shared_FieldAnswer, string>((answer_17: Shared_FieldAnswer): Option<string> => map<Shared_FieldOption, string>((opt_11: Shared_FieldOption): string => opt_11.Description, tryFind<Shared_FieldOption>((opt_10: Shared_FieldOption): boolean => (opt_10.Value === answer_17.Value), info_5!.Options)), toList<Shared_FieldAnswer>(answers_1!)));
546
+ case 18:
547
+ return join(", ", choose<Shared_FieldAnswer, string>((answer_18: Shared_FieldAnswer): Option<string> => map<Shared_FieldOption, string>((opt_13: Shared_FieldOption): string => opt_13.Description, tryFind<Shared_FieldOption>((opt_12: Shared_FieldOption): boolean => (opt_12.Value === answer_18.Value), info_6!.Options)), toList<Shared_FieldAnswer>(answers_2!)));
548
+ case 19:
549
+ if (!isNullOrWhiteSpace(answer_19!.Value)) {
550
+ return "*Signature provided*";
551
+ }
552
+ else {
553
+ return "*No signature*";
554
+ }
555
+ case 20:
556
+ return "";
557
+ case 21:
558
+ return answer_20!.Value;
559
+ case 22:
560
+ return "";
561
+ case 23:
562
+ return "*Type mismatch: Expected single value*";
563
+ case 24:
564
+ return answer_21!.Value;
565
+ case 25:
566
+ return "";
567
+ default:
568
+ return join(", ", map_1<Shared_PluginDataProperty, string>((prop: Shared_PluginDataProperty): string => {
569
+ const matchValue_2: Option<string> = prop.DisplayName;
570
+ if (matchValue_2 == null) {
571
+ return toText(printf("%s: %s"))(prop.Name)(prop.Value);
572
+ }
573
+ else {
574
+ const displayName: string = value_4(matchValue_2);
575
+ return toText(printf("%s: %s"))(displayName)(prop.Value);
576
+ }
577
+ }, pluginData!));
578
+ }
579
+ }
580
+
581
+ function formatMatrixFieldAsTable(fieldLabel: string, matrixInfo: Spec_MatrixInfo, matrixAnswer: Option<Shared_MatrixAnswer>): string {
582
+ let arg_3: string, arg_4: string, arg_6: string, sv_1: string, arg_5: string;
583
+ const items: FSharpList<Shared_FieldOption> = matrixInfo.Items;
584
+ const options: FSharpList<Shared_FieldOption> = matrixInfo.Options;
585
+ if (isEmpty(items) ? true : isEmpty(options)) {
586
+ return "";
587
+ }
588
+ else {
589
+ const lines: string[] = [];
590
+ void (lines.push(toText(printf("#### %s"))(fieldLabel)));
591
+ void (lines.push(""));
592
+ const headerCells: FSharpList<string> = toList_1<string>(delay<string>((): Iterable<string> => append<string>(singleton<string>("Symptom"), delay<string>((): Iterable<string> => map_1<Shared_FieldOption, string>((opt: Shared_FieldOption): string => toText(printf("%s (%s)"))(opt.Description)(opt.Value), options)))));
593
+ void (lines.push((arg_3 = join(" | ", headerCells), toText(printf("| %s |"))(arg_3))));
594
+ const separators: FSharpList<string> = toList_1<string>(delay<string>((): Iterable<string> => append<string>(singleton<string>("---"), delay<string>((): Iterable<string> => map_1<Shared_FieldOption, string>((_arg: Shared_FieldOption): string => "---", options)))));
595
+ void (lines.push((arg_4 = join(" | ", separators), toText(printf("| %s |"))(arg_4))));
596
+ if (matrixAnswer == null) {
597
+ const enumerator_2: IEnumerator<Shared_FieldOption> = getEnumerator(items);
598
+ try {
599
+ while (enumerator_2["System.Collections.IEnumerator.MoveNext"]()) {
600
+ const item_1: Shared_FieldOption = enumerator_2["System.Collections.Generic.IEnumerator`1.get_Current"]();
601
+ const rowCells_1: FSharpList<string> = toList_1<string>(delay<string>((): Iterable<string> => append<string>(singleton<string>(item_1.Description), delay<string>((): Iterable<string> => map_1<Shared_FieldOption, string>((_arg_1: Shared_FieldOption): string => "", options)))));
602
+ void (lines.push((arg_6 = join(" | ", rowCells_1), toText(printf("| %s |"))(arg_6))));
603
+ }
604
+ }
605
+ finally {
606
+ disposeSafe(enumerator_2 as IDisposable);
607
+ }
608
+ }
609
+ else {
610
+ const answer: Shared_MatrixAnswer = value_4(matrixAnswer);
611
+ const enumerator: IEnumerator<Shared_FieldOption> = getEnumerator(items);
612
+ try {
613
+ while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
614
+ const item: Shared_FieldOption = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
615
+ const selectedValue: Option<string> = FSharpMap__TryFind(answer.Values, new Shared_MatrixItemKey(item.OptionKey.fields[0]));
616
+ const rowCells: string[] = [];
617
+ void (rowCells.push(item.Description));
618
+ const enumerator_1: IEnumerator<Shared_FieldOption> = getEnumerator(options);
619
+ try {
620
+ while (enumerator_1["System.Collections.IEnumerator.MoveNext"]()) {
621
+ const option: Shared_FieldOption = enumerator_1["System.Collections.Generic.IEnumerator`1.get_Current"]();
622
+ if ((selectedValue != null) && ((value_4(selectedValue) === option.Value) && ((sv_1 = value_4(selectedValue), true)))) {
623
+ void (rowCells.push("✔️"));
624
+ }
625
+ else {
626
+ void (rowCells.push(""));
627
+ }
628
+ }
629
+ }
630
+ finally {
631
+ disposeSafe(enumerator_1 as IDisposable);
632
+ }
633
+ void (lines.push((arg_5 = join(" | ", rowCells), toText(printf("| %s |"))(arg_5))));
634
+ }
635
+ }
636
+ finally {
637
+ disposeSafe(enumerator as IDisposable);
638
+ }
639
+ }
640
+ void (lines.push(""));
641
+ return join("\n", lines);
642
+ }
643
+ }
644
+
645
+ function getFieldTypeName(fieldType: Spec_FieldType_$union): string {
646
+ switch (fieldType.tag) {
647
+ case /* TextArea */ 1:
648
+ return "TextArea";
649
+ case /* Email */ 2:
650
+ return "Email";
651
+ case /* Password */ 3:
652
+ return "Password";
653
+ case /* Search */ 4:
654
+ return "Search";
655
+ case /* Color */ 5:
656
+ return "Color";
657
+ case /* Number */ 6:
658
+ return "Number";
659
+ case /* Tel */ 7:
660
+ return "Tel";
661
+ case /* Date */ 8:
662
+ return "Date";
663
+ case /* DateTimeLocal */ 9:
664
+ return "DateTimeLocal";
665
+ case /* Time */ 10:
666
+ return "Time";
667
+ case /* Checkbox */ 11:
668
+ return "Checkbox";
669
+ case /* SingleChoice */ 13:
670
+ return "SingleChoice";
671
+ case /* Radio */ 12:
672
+ return "Radio";
673
+ case /* Dropdown */ 14:
674
+ return "Dropdown";
675
+ case /* TextAutoComplete */ 18:
676
+ return "TextAutoComplete";
677
+ case /* MultiChoice */ 15:
678
+ return "MultiChoice";
679
+ case /* CheckboxList */ 16:
680
+ return "CheckboxList";
681
+ case /* TagList */ 17:
682
+ return "TagList";
683
+ case /* Signature */ 20:
684
+ return "Signature";
685
+ case /* Message */ 21:
686
+ return "Message";
687
+ case /* Matrix */ 19:
688
+ return "Matrix";
689
+ case /* PluginField */ 22:
690
+ return "PluginField";
691
+ default:
692
+ return "Text";
693
+ }
694
+ }
695
+
696
+ function generatePathwayMermaid(pathway: ClinicalPathway_ClinicalPathwaySpec, formSpec: Spec_FormSpec$1<Spec_FieldType_$union>): string {
697
+ return pathwaySpecToGraph<void, void, string>(MermaidRenderer_$ctor_Z1FBCCD16(true), pathway, formSpec);
698
+ }
699
+
700
+ /**
701
+ * Renders a FormSpec to markdown format with configurable heading levels and optional pathway diagrams.
702
+ * Uses well-typed Spec.FieldType and Values.FieldValue throughout - NO boxing/unboxing.
703
+ */
704
+ export function renderFormSpecToMarkdown(startHeading: int32, withPathway: boolean, formSpec: Spec_FormSpec$1<Spec_FieldType_$union>, formValues: Option<FSharpMap<Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>>>): string {
705
+ let matchValue_4: Option<FieldDetails$1<Spec_FieldType_$union>>, matchValue_5: Shared_FieldValue_$union;
706
+ const lines: string[] = [];
707
+ const titleHeading: string = generateHeadingLevel(startHeading);
708
+ void (lines.push(`${titleHeading} ${formSpec.Title}`));
709
+ void (lines.push(""));
710
+ const matchValue: Option<string> = formSpec.Code;
711
+ if (matchValue == null) {
712
+ }
713
+ else {
714
+ const code: string = value_4(matchValue);
715
+ void (lines.push(`**Code:** ${code}`));
716
+ }
717
+ void (lines.push(`**Version:** ${formSpec.Version}`));
718
+ void (lines.push(""));
719
+ if (!isNullOrWhiteSpace(formSpec.Abstract)) {
720
+ void (lines.push(formSpec.Abstract));
721
+ void (lines.push(""));
722
+ }
723
+ if (!isEmpty(formSpec.CategoryTags)) {
724
+ const categoryHeading: string = generateHeadingLevel(startHeading + 1);
725
+ void (lines.push(`${categoryHeading} Categories`));
726
+ void (lines.push(""));
727
+ const enumerator: IEnumerator<string> = getEnumerator(formSpec.CategoryTags);
728
+ try {
729
+ while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
730
+ const tag: string = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
731
+ void (lines.push(`- ${tag}`));
732
+ }
733
+ }
734
+ finally {
735
+ disposeSafe(enumerator as IDisposable);
736
+ }
737
+ void (lines.push(""));
738
+ }
739
+ if (!isEmpty(formSpec.AssociatedCodes)) {
740
+ const codesHeading: string = generateHeadingLevel(startHeading + 1);
741
+ void (lines.push(`${codesHeading} Associated Codes`));
742
+ void (lines.push(""));
743
+ const enumerator_1: IEnumerator<string> = getEnumerator(formSpec.AssociatedCodes);
744
+ try {
745
+ while (enumerator_1["System.Collections.IEnumerator.MoveNext"]()) {
746
+ const code_1: string = enumerator_1["System.Collections.Generic.IEnumerator`1.get_Current"]();
747
+ void (lines.push(`- \`${code_1}\``));
748
+ }
749
+ }
750
+ finally {
751
+ disposeSafe(enumerator_1 as IDisposable);
752
+ }
753
+ void (lines.push(""));
754
+ }
755
+ const stepHeading: string = generateHeadingLevel(startHeading + 1);
756
+ const enumerator_2: IEnumerator<Spec_FormStep$1<Spec_FieldType_$union>> = getEnumerator(formSpec.Steps);
757
+ try {
758
+ while (enumerator_2["System.Collections.IEnumerator.MoveNext"]()) {
759
+ const step: Spec_FormStep$1<Spec_FieldType_$union> = enumerator_2["System.Collections.Generic.IEnumerator`1.get_Current"]();
760
+ const stepLabel: string = isNullOrWhiteSpace(step.StepLabel) ? (`Step ${step.StepOrder}`) : step.StepLabel;
761
+ void (lines.push(`${stepHeading} ${stepLabel}`));
762
+ void (lines.push(""));
763
+ const patternInput: [FSharpList<Spec_FormField$1<Spec_FieldType_$union>>, FSharpList<Spec_FormField$1<Spec_FieldType_$union>>] = partition<Spec_FormField$1<Spec_FieldType_$union>>((field: Spec_FormField$1<Spec_FieldType_$union>): boolean => {
764
+ if (field.FieldType.tag === /* Matrix */ 19) {
765
+ return true;
766
+ }
767
+ else {
768
+ return false;
769
+ }
770
+ }, step.Fields);
771
+ const regularFields: FSharpList<Spec_FormField$1<Spec_FieldType_$union>> = patternInput[1];
772
+ const matrixFields: FSharpList<Spec_FormField$1<Spec_FieldType_$union>> = patternInput[0];
773
+ if (formValues == null) {
774
+ if (!isEmpty(regularFields)) {
775
+ void (lines.push("**Fields:**"));
776
+ const enumerator_5: IEnumerator<Spec_FormField$1<Spec_FieldType_$union>> = getEnumerator(regularFields);
777
+ try {
778
+ while (enumerator_5["System.Collections.IEnumerator.MoveNext"]()) {
779
+ const field_3: Spec_FormField$1<Spec_FieldType_$union> = enumerator_5["System.Collections.Generic.IEnumerator`1.get_Current"]();
780
+ const fieldTypeName: string = getFieldTypeName(field_3.FieldType);
781
+ const requiredText: string = field_3.IsOptional ? "" : " *(required)*";
782
+ void (lines.push(toText(printf("- %s%s [%s]"))(field_3.Label)(requiredText)(fieldTypeName)));
783
+ }
784
+ }
785
+ finally {
786
+ disposeSafe(enumerator_5 as IDisposable);
787
+ }
788
+ void (lines.push(""));
789
+ }
790
+ const enumerator_6: IEnumerator<Spec_FormField$1<Spec_FieldType_$union>> = getEnumerator(matrixFields);
791
+ try {
792
+ while (enumerator_6["System.Collections.IEnumerator.MoveNext"]()) {
793
+ const field_4: Spec_FormField$1<Spec_FieldType_$union> = enumerator_6["System.Collections.Generic.IEnumerator`1.get_Current"]();
794
+ const fieldTypeName_1: string = getFieldTypeName(field_4.FieldType);
795
+ const requiredText_1: string = field_4.IsOptional ? "" : " *(required)*";
796
+ void (lines.push(toText(printf("- %s%s [%s]"))(field_4.Label)(requiredText_1)(fieldTypeName_1)));
797
+ }
798
+ }
799
+ finally {
800
+ disposeSafe(enumerator_6 as IDisposable);
801
+ }
802
+ }
803
+ else {
804
+ const stepValues: FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>> = defaultArg(FSharpMap__TryFind(value_4(formValues), new Values_StepOrder(step.StepOrder)), empty<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>({
805
+ Compare: compare,
806
+ }));
807
+ const enumerator_3: IEnumerator<Spec_FormField$1<Spec_FieldType_$union>> = getEnumerator(regularFields);
808
+ try {
809
+ while (enumerator_3["System.Collections.IEnumerator.MoveNext"]()) {
810
+ const field_1: Spec_FormField$1<Spec_FieldType_$union> = enumerator_3["System.Collections.Generic.IEnumerator`1.get_Current"]();
811
+ const matchValue_2: Option<FieldDetails$1<Spec_FieldType_$union>> = FSharpMap__TryFind(stepValues, field_1.FieldKey);
812
+ if (matchValue_2 == null) {
813
+ void (lines.push(toText(printf("- **%s**: *No response provided*"))(field_1.Label)));
814
+ }
815
+ else {
816
+ const formattedValue: string = formatFieldValue(field_1.FieldType, value_4(matchValue_2).FieldValue, field_1);
817
+ if (!isNullOrWhiteSpace(formattedValue)) {
818
+ void (lines.push(toText(printf("- **%s**: %s"))(field_1.Label)(formattedValue)));
819
+ }
820
+ }
821
+ }
822
+ }
823
+ finally {
824
+ disposeSafe(enumerator_3 as IDisposable);
825
+ }
826
+ const enumerator_4: IEnumerator<Spec_FormField$1<Spec_FieldType_$union>> = getEnumerator(matrixFields);
827
+ try {
828
+ while (enumerator_4["System.Collections.IEnumerator.MoveNext"]()) {
829
+ const field_2: Spec_FormField$1<Spec_FieldType_$union> = enumerator_4["System.Collections.Generic.IEnumerator`1.get_Current"]();
830
+ const matchValue_3: Spec_FieldType_$union = field_2.FieldType;
831
+ if (matchValue_3.tag === /* Matrix */ 19) {
832
+ const tableMarkdown: string = formatMatrixFieldAsTable(field_2.Label, matchValue_3.fields[0], (matchValue_4 = FSharpMap__TryFind(stepValues, field_2.FieldKey), (matchValue_4 == null) ? undefined : ((matchValue_5 = value_4(matchValue_4).FieldValue, (matchValue_5.tag === /* Single */ 0) ? undefined : ((matchValue_5.tag === /* Multiple */ 1) ? undefined : ((matchValue_5.tag === /* PluginData */ 3) ? undefined : matchValue_5.fields[0]))))));
833
+ if (!isNullOrWhiteSpace(tableMarkdown)) {
834
+ void (lines.push(""));
835
+ void (lines.push(tableMarkdown));
836
+ }
837
+ }
838
+ }
839
+ }
840
+ finally {
841
+ disposeSafe(enumerator_4 as IDisposable);
842
+ }
843
+ }
844
+ void (lines.push(""));
845
+ }
846
+ }
847
+ finally {
848
+ disposeSafe(enumerator_2 as IDisposable);
849
+ }
850
+ if (withPathway) {
851
+ const matchValue_6: Option<ClinicalPathway_ClinicalPathwaySpec> = formSpec.ClinicalPathway;
852
+ if (matchValue_6 == null) {
853
+ }
854
+ else {
855
+ const pathway: ClinicalPathway_ClinicalPathwaySpec = value_4(matchValue_6);
856
+ const pathwayHeading: string = generateHeadingLevel(startHeading + 1);
857
+ void (lines.push(`${pathwayHeading} Clinical Pathway`));
858
+ void (lines.push(""));
859
+ const mermaid: string = generatePathwayMermaid(pathway, formSpec);
860
+ void (lines.push(mermaid));
861
+ void (lines.push(""));
862
+ }
863
+ }
864
+ const reviewHeading: string = generateHeadingLevel(startHeading + 1);
865
+ void (lines.push(`${reviewHeading} Review Requirements`));
866
+ void (lines.push(""));
867
+ const requiresReviewText: string = formSpec.RequiresReview ? "Yes" : "No";
868
+ const requiresReviewAndApprovalText: string = formSpec.RequiresReviewAndApproval ? "Yes" : "No";
869
+ void (lines.push(toText(printf("- **Requires Review:** %s"))(requiresReviewText)));
870
+ void (lines.push(toText(printf("- **Requires Review and Approval:** %s"))(requiresReviewAndApprovalText)));
871
+ void (lines.push(""));
872
+ return join("\n", lines);
873
+ }
874
+
875
+ //# sourceMappingURL=FormSpecMarkdownRenderer.ts.map