@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.
- package/Components/HelloComponent.d.ts +20 -0
- package/Components/HelloComponent.d.ts.map +1 -0
- package/Designer.d.ts.map +1 -0
- package/FormSpec.TS/Designer.js +2 -2
- package/FormSpec.TS/Designer.js.map +1 -1
- package/FormSpec.TS/Designer.ts.map +1 -1
- package/FormSpec.TS/FormSpec.js +210 -143
- package/FormSpec.TS/FormSpec.js.map +1 -1
- package/FormSpec.TS/FormSpec.ts.map +1 -1
- package/FormSpec.TS/FormSpecHelpers.js +62 -40
- package/FormSpec.TS/FormSpecHelpers.js.map +1 -1
- package/FormSpec.TS/FormSpecHelpers.ts.map +1 -1
- package/FormSpec.TS/FormSpecValues.js +207 -0
- package/FormSpec.TS/FormSpecValues.js.map +1 -0
- package/FormSpec.TS/FormSpecValues.ts.map +1 -0
- package/FormSpec.TS/Helpers.js +26 -25
- package/FormSpec.TS/Helpers.js.map +1 -1
- package/FormSpec.TS/Helpers.ts.map +1 -1
- package/FormSpec.TS/Interop/FormSpec.Api.Helpers.js +85 -125
- package/FormSpec.TS/Interop/FormSpec.Api.Helpers.js.map +1 -1
- package/FormSpec.TS/Interop/FormSpec.Api.Helpers.ts.map +1 -1
- package/FormSpec.TS/Interop/FormSpec.Api.Option.js +37 -7
- package/FormSpec.TS/Interop/FormSpec.Api.Option.js.map +1 -1
- package/FormSpec.TS/Interop/FormSpec.Api.Option.ts.map +1 -1
- package/FormSpec.TS/Interop/FormSpec.Values.Api.Option.js +103 -80
- package/FormSpec.TS/Interop/FormSpec.Values.Api.Option.js.map +1 -1
- package/FormSpec.TS/Interop/FormSpec.Values.Api.Option.ts.map +1 -1
- package/FormSpec.TS/PathwayExecutor.js +371 -125
- package/FormSpec.TS/PathwayExecutor.js.map +1 -1
- package/FormSpec.TS/PathwayExecutor.ts.map +1 -1
- package/FormSpec.TS/PathwayValidator.js +14 -26
- package/FormSpec.TS/PathwayValidator.js.map +1 -1
- package/FormSpec.TS/PathwayValidator.ts.map +1 -1
- package/FormSpec.TS/Renderers/FormSpecMarkdownRenderer.ts.map +1 -1
- package/FormSpec.TS/Renderers/PathwayRenderers.js +35 -26
- package/FormSpec.TS/Renderers/PathwayRenderers.js.map +1 -1
- package/FormSpec.TS/Renderers/PathwayRenderers.ts.map +1 -1
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Base.fs +0 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Error.fs +0 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Extensions.fs +0 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Fable.Form.fableproj +0 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Field.fs +0 -0
- package/FormSpec.TS/fable_modules/Fable.Form.Simple.5.0.1/Fable.Form.Simple.fableproj +0 -0
- package/FormSpec.TS/fable_modules/Fable.Form.Simple.5.0.1/Form.fs +0 -0
- package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.Extensions.fs +0 -0
- package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.Hooks.fs +0 -0
- package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.Types.fableproj +0 -0
- package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.fs +0 -0
- package/FormSpec.TS/fable_modules/Fable.ReactDom.Types.18.2.0/Fable.ReactDom.Types.fableproj +0 -0
- package/FormSpec.TS/fable_modules/Fable.ReactDom.Types.18.2.0/Fable.ReactDom.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/BorderStyle.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Colors.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Feliz.fableproj +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Fonts.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/GridTypes.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Html.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Interop.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Key.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Length.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Locale.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Properties.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/React.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactDOM.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactInterop.js +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactInterop.js.map +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactTypes.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/StyleTypes.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Styles.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Svg.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/TextDecorationLine.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/TextDecorationStyle.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Transform.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/TransformOrigin.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/TransitionProperty.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Types.fs +0 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Decode.fs +0 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Encode.fs +0 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Encode.fs.js.map +1 -1
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Encode.fs.ts.map +1 -1
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Extra.fs +0 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Thoth.Json.fableproj +0 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Types.fs +0 -0
- package/FormSpec.TS/fable_modules/project_cracked.json +1 -1
- package/FormSpec.d.ts +56 -43
- package/FormSpec.d.ts.map +1 -0
- package/FormSpecHelpers.d.ts +18 -12
- package/FormSpecHelpers.d.ts.map +1 -0
- package/FormSpecValues.d.ts +62 -0
- package/FormSpecValues.d.ts.map +1 -0
- package/Helpers.d.ts +11 -10
- package/Helpers.d.ts.map +1 -0
- package/Interfaces.d.ts.map +1 -0
- package/Interop/FormSpec.Api.Helpers.d.ts +25 -28
- package/Interop/FormSpec.Api.Helpers.d.ts.map +1 -1
- package/Interop/FormSpec.Api.Option.d.ts +10 -6
- package/Interop/FormSpec.Api.Option.d.ts.map +1 -1
- package/Interop/FormSpec.Values.Api.Option.d.ts +35 -22
- package/Interop/FormSpec.Values.Api.Option.d.ts.map +1 -1
- package/Logging/LogTypes.d.ts +112 -0
- package/Logging/LogTypes.d.ts.map +1 -0
- package/Migrator.d.ts.map +1 -0
- package/PathwayDataExtractor.d.ts.map +1 -0
- package/PathwayExecutor.d.ts +63 -33
- package/PathwayExecutor.d.ts.map +1 -0
- package/PathwayValidator.d.ts.map +1 -0
- package/PluginInterface.d.ts.map +1 -0
- package/Prelude.d.ts.map +1 -0
- package/README.TS.md +621 -621
- package/README.md +98 -85
- package/Renderers/FormSpecMarkdownRenderer.d.ts +11 -0
- package/Renderers/FormSpecMarkdownRenderer.d.ts.map +1 -0
- package/Renderers/MermaidRenderer.d.ts +48 -0
- package/Renderers/MermaidRenderer.d.ts.map +1 -0
- package/Renderers/PathwayRenderers.d.ts +59 -0
- package/Renderers/PathwayRenderers.d.ts.map +1 -0
- package/fable_modules/Thoth.Json.10.4.1/Decode.fs.d.ts +126 -0
- package/fable_modules/Thoth.Json.10.4.1/Decode.fs.d.ts.map +1 -0
- package/fable_modules/Thoth.Json.10.4.1/Encode.fs.d.ts +163 -0
- package/fable_modules/Thoth.Json.10.4.1/Encode.fs.d.ts.map +1 -0
- package/fable_modules/Thoth.Json.10.4.1/Types.fs.d.ts +66 -0
- package/fable_modules/Thoth.Json.10.4.1/Types.fs.d.ts.map +1 -0
- package/package.json +53 -39
- package/src/Components/HelloComponent.ts +48 -48
- package/src/Designer.ts +389 -389
- package/src/FormSpec.ts +3154 -3114
- package/src/FormSpecHelpers.ts +397 -374
- package/src/FormSpecValues.ts +158 -0
- package/src/Helpers.ts +766 -765
- package/src/Interfaces.ts +166 -166
- package/src/Interop/FormSpec.Api.Helpers.ts +835 -872
- package/src/Interop/FormSpec.Api.Option.ts +1637 -1618
- package/src/Interop/FormSpec.Values.Api.Option.ts +1241 -1214
- package/src/Logging/LogTypes.ts +212 -212
- package/src/Migrator.ts +156 -156
- package/src/PathwayDataExtractor.ts +290 -290
- package/src/PathwayExecutor.ts +1379 -1102
- package/src/PathwayValidator.ts +238 -244
- package/src/PluginInterface.ts +79 -79
- package/src/Prelude.ts +21 -21
- package/src/Renderers/FormSpecMarkdownRenderer.ts +875 -874
- package/src/Renderers/MermaidRenderer.ts +218 -218
- package/src/Renderers/PathwayRenderers.ts +208 -200
- package/src/Components/HelloComponent.ts.map +0 -1
- package/src/Designer.ts.map +0 -1
- package/src/FormSpec.ts.map +0 -1
- package/src/FormSpecHelpers.ts.map +0 -1
- package/src/Helpers.ts.map +0 -1
- package/src/Interfaces.ts.map +0 -1
- package/src/Interop/FormSpec.Api.Helpers.ts.map +0 -1
- package/src/Interop/FormSpec.Api.Option.ts.map +0 -1
- package/src/Interop/FormSpec.Values.Api.Option.ts.map +0 -1
- package/src/Logging/LogTypes.ts.map +0 -1
- package/src/Migrator.ts.map +0 -1
- package/src/PathwayDataExtractor.ts.map +0 -1
- package/src/PathwayExecutor.ts.map +0 -1
- package/src/PathwayValidator.ts.map +0 -1
- package/src/PluginInterface.ts.map +0 -1
- package/src/Prelude.ts.map +0 -1
- package/src/Renderers/FormSpecMarkdownRenderer.ts.map +0 -1
- package/src/Renderers/MermaidRenderer.ts.map +0 -1
- package/src/Renderers/PathwayRenderers.ts.map +0 -1
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { Record } from "@fable-org/fable-library-js/Types.js";
|
|
2
|
+
import { map as map_1, value as value_1, defaultArg, bind, Option } from "@fable-org/fable-library-js/Option.js";
|
|
3
|
+
import { Values_StepOrder, Shared_FieldValue_Single, Shared_FieldAnswer, Spec_FormSpec$1, Spec_FormStep$1, Spec_FormField$1, Spec_FieldType_$union, Shared_FieldOption_$reflection, Shared_FieldValue_$reflection, Shared_FieldKey_$reflection, Shared_FieldOption, Shared_FieldValue_$union, Shared_FieldKey, Spec_Score_$reflection, Spec_Score } from "./FormSpec.js";
|
|
4
|
+
import { compare, equals, IComparable, IEquatable } from "@fable-org/fable-library-js/Util.js";
|
|
5
|
+
import { list_type, int32_type, record_type, option_type, string_type, class_type, TypeInfo } from "@fable-org/fable-library-js/Reflection.js";
|
|
6
|
+
import { int32 } from "@fable-org/fable-library-js/Int32.js";
|
|
7
|
+
import { findIndex, map, mapIndexed, exists, tryFindIndex, collect, tryFind, empty, FSharpList } from "@fable-org/fable-library-js/List.js";
|
|
8
|
+
import { fold, FSharpMap, ofList } from "@fable-org/fable-library-js/Map.js";
|
|
9
|
+
|
|
10
|
+
export class FormSpecMetadata extends Record implements IEquatable<FormSpecMetadata>, IComparable<FormSpecMetadata> {
|
|
11
|
+
readonly FormSpecId: string;
|
|
12
|
+
readonly FormSpecCode: Option<string>;
|
|
13
|
+
readonly FormSpecVersion: string;
|
|
14
|
+
readonly DynamicVersion: string;
|
|
15
|
+
readonly MaxScore: Option<Spec_Score>;
|
|
16
|
+
constructor(FormSpecId: string, FormSpecCode: Option<string>, FormSpecVersion: string, DynamicVersion: string, MaxScore: Option<Spec_Score>) {
|
|
17
|
+
super();
|
|
18
|
+
this.FormSpecId = FormSpecId;
|
|
19
|
+
this.FormSpecCode = FormSpecCode;
|
|
20
|
+
this.FormSpecVersion = FormSpecVersion;
|
|
21
|
+
this.DynamicVersion = DynamicVersion;
|
|
22
|
+
this.MaxScore = MaxScore;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function FormSpecMetadata_$reflection(): TypeInfo {
|
|
27
|
+
return record_type("F1.Studio.FormSpecValues.FormSpecMetadata", [], FormSpecMetadata, () => [["FormSpecId", class_type("System.Guid")], ["FormSpecCode", option_type(string_type)], ["FormSpecVersion", string_type], ["DynamicVersion", string_type], ["MaxScore", option_type(Spec_Score_$reflection())]]);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export class FieldDetails$1<FieldType> extends Record implements IEquatable<FieldDetails$1<FieldType>>, IComparable<FieldDetails$1<FieldType>> {
|
|
31
|
+
readonly FieldOrder: int32;
|
|
32
|
+
readonly Key: Shared_FieldKey;
|
|
33
|
+
readonly Label: string;
|
|
34
|
+
readonly FieldValue: Shared_FieldValue_$union;
|
|
35
|
+
readonly FieldType: FieldType;
|
|
36
|
+
readonly Options: FSharpList<Shared_FieldOption>;
|
|
37
|
+
constructor(FieldOrder: int32, Key: Shared_FieldKey, Label: string, FieldValue: Shared_FieldValue_$union, FieldType: FieldType, Options: FSharpList<Shared_FieldOption>) {
|
|
38
|
+
super();
|
|
39
|
+
this.FieldOrder = (FieldOrder | 0);
|
|
40
|
+
this.Key = Key;
|
|
41
|
+
this.Label = Label;
|
|
42
|
+
this.FieldValue = FieldValue;
|
|
43
|
+
this.FieldType = FieldType;
|
|
44
|
+
this.Options = Options;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function FieldDetails$1_$reflection(gen0: TypeInfo): TypeInfo {
|
|
49
|
+
return record_type("F1.Studio.FormSpecValues.FieldDetails`1", [gen0], FieldDetails$1, () => [["FieldOrder", int32_type], ["Key", Shared_FieldKey_$reflection()], ["Label", string_type], ["FieldValue", Shared_FieldValue_$reflection()], ["FieldType", gen0], ["Options", list_type(Shared_FieldOption_$reflection())]]);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function optionsFromField(field: Spec_FormField$1<Spec_FieldType_$union>): FSharpList<Shared_FieldOption> {
|
|
53
|
+
const matchValue: Spec_FieldType_$union = field.FieldType;
|
|
54
|
+
switch (matchValue.tag) {
|
|
55
|
+
case /* CheckboxList */ 16:
|
|
56
|
+
return matchValue.fields[0].Options;
|
|
57
|
+
case /* MultiChoice */ 15:
|
|
58
|
+
return matchValue.fields[0].Options;
|
|
59
|
+
case /* TagList */ 17:
|
|
60
|
+
return matchValue.fields[0].Options;
|
|
61
|
+
case /* Dropdown */ 14:
|
|
62
|
+
return matchValue.fields[0].Options;
|
|
63
|
+
case /* Radio */ 12:
|
|
64
|
+
return matchValue.fields[0].Options;
|
|
65
|
+
case /* SingleChoice */ 13:
|
|
66
|
+
return matchValue.fields[0].Options;
|
|
67
|
+
case /* TextAutoComplete */ 18:
|
|
68
|
+
return matchValue.fields[0].Options;
|
|
69
|
+
case /* Matrix */ 19:
|
|
70
|
+
return matchValue.fields[0].Options;
|
|
71
|
+
default:
|
|
72
|
+
return empty<Shared_FieldOption>();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Get field value by FieldKey (searches all steps)
|
|
78
|
+
*/
|
|
79
|
+
export function getFieldValue<FieldType>(spec: Spec_FormSpec$1<FieldType>, fieldKey: Shared_FieldKey): Option<Shared_FieldValue_$union> {
|
|
80
|
+
return bind<Spec_FormField$1<FieldType>, Shared_FieldValue_$union>((f_1: Spec_FormField$1<FieldType>): Option<Shared_FieldValue_$union> => f_1.Value, tryFind<Spec_FormField$1<FieldType>>((f: Spec_FormField$1<FieldType>): boolean => equals(f.FieldKey, fieldKey), collect<Spec_FormStep$1<FieldType>, Spec_FormField$1<FieldType>>((step: Spec_FormStep$1<FieldType>): FSharpList<Spec_FormField$1<FieldType>> => step.Fields, spec.Steps)));
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Find the step index containing the given field
|
|
85
|
+
*/
|
|
86
|
+
export function findStepIndexForField<FieldType>(spec: Spec_FormSpec$1<FieldType>, fieldKey: Shared_FieldKey): Option<int32> {
|
|
87
|
+
return tryFindIndex<Spec_FormStep$1<FieldType>>((step: Spec_FormStep$1<FieldType>): boolean => exists<Spec_FormField$1<FieldType>>((f: Spec_FormField$1<FieldType>): boolean => equals(f.FieldKey, fieldKey), step.Fields), spec.Steps);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Update a single field's value. Returns new FormSpec.
|
|
92
|
+
* If stepIndex is None, searches for the field across all steps.
|
|
93
|
+
*/
|
|
94
|
+
export function updateField<FieldType>(spec: Spec_FormSpec$1<FieldType>, fieldKey: Shared_FieldKey, newValue: Shared_FieldValue_$union, stepIndexOpt: Option<int32>): Spec_FormSpec$1<FieldType> {
|
|
95
|
+
const stepIndex: int32 = ((stepIndexOpt == null) ? defaultArg(findStepIndexForField<FieldType>(spec, fieldKey), 0) : value_1(stepIndexOpt)) | 0;
|
|
96
|
+
return new Spec_FormSpec$1(spec.Id, spec.Code, spec.Title, spec.Abstract, spec.Version, spec.FormSpecVersion, mapIndexed<Spec_FormStep$1<FieldType>, Spec_FormStep$1<FieldType>>((i_1: int32, step: Spec_FormStep$1<FieldType>): Spec_FormStep$1<FieldType> => {
|
|
97
|
+
if (i_1 === stepIndex) {
|
|
98
|
+
return new Spec_FormStep$1(step.StepOrder, step.StepLabel, map<Spec_FormField$1<FieldType>, Spec_FormField$1<FieldType>>((f: Spec_FormField$1<FieldType>): Spec_FormField$1<FieldType> => {
|
|
99
|
+
if (equals(f.FieldKey, fieldKey)) {
|
|
100
|
+
return new Spec_FormField$1(f.FieldOrder, f.FieldKey, f.Label, f.Notes, f.DependsOn, f.IsOptional, f.IsDeprecated, f.FieldType, newValue);
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
return f;
|
|
104
|
+
}
|
|
105
|
+
}, step.Fields));
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
return step;
|
|
109
|
+
}
|
|
110
|
+
}, spec.Steps), spec.CategoryTags, spec.Score, spec.AssociatedCodes, spec.RequiresReview, spec.RequiresReviewAndApproval, spec.ClinicalPathway, spec.Lifecycle, spec.FilledMeta);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Convert FormField to FieldDetails for rendering.
|
|
115
|
+
* Uses field.Value or creates empty default based on field type.
|
|
116
|
+
*/
|
|
117
|
+
export function fieldToDetails(field: Spec_FormField$1<Spec_FieldType_$union>): FieldDetails$1<Spec_FieldType_$union> {
|
|
118
|
+
let matchValue: Option<Shared_FieldValue_$union>;
|
|
119
|
+
return new FieldDetails$1(field.FieldOrder, field.FieldKey, field.Label, (matchValue = field.Value, (matchValue == null) ? Shared_FieldValue_Single(new Shared_FieldAnswer(field.FieldKey, field.Label, "")) : value_1(matchValue)), field.FieldType, optionsFromField(field));
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Get FieldDetails for a field by FieldKey (for pathway/scoring)
|
|
124
|
+
*/
|
|
125
|
+
export function getFieldDetails(spec: Spec_FormSpec$1<Spec_FieldType_$union>, fieldKey: Shared_FieldKey): Option<FieldDetails$1<Spec_FieldType_$union>> {
|
|
126
|
+
return map_1<Spec_FormField$1<Spec_FieldType_$union>, FieldDetails$1<Spec_FieldType_$union>>(fieldToDetails, tryFind<Spec_FormField$1<Spec_FieldType_$union>>((f: Spec_FormField$1<Spec_FieldType_$union>): boolean => equals(f.FieldKey, fieldKey), collect<Spec_FormStep$1<Spec_FieldType_$union>, Spec_FormField$1<Spec_FieldType_$union>>((step: Spec_FormStep$1<Spec_FieldType_$union>): FSharpList<Spec_FormField$1<Spec_FieldType_$union>> => step.Fields, spec.Steps)));
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Build ResultSteps Map from FormSpec (for TypeScript interop / backward compatibility).
|
|
131
|
+
*/
|
|
132
|
+
export function formSpecToResultStepsMap(spec: Spec_FormSpec$1<Spec_FieldType_$union>): FSharpMap<Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>> {
|
|
133
|
+
return ofList<Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>>(map<Spec_FormStep$1<Spec_FieldType_$union>, [Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>]>((step: Spec_FormStep$1<Spec_FieldType_$union>): [Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>] => ([new Values_StepOrder(step.StepOrder), ofList<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>(map<Spec_FormField$1<Spec_FieldType_$union>, [Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>]>((f: Spec_FormField$1<Spec_FieldType_$union>): [Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>] => ([f.FieldKey, fieldToDetails(f)] as [Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>]), step.Fields), {
|
|
134
|
+
Compare: compare,
|
|
135
|
+
})] as [Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>]), spec.Steps), {
|
|
136
|
+
Compare: compare,
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Build FormSpec with values from ResultSteps Map (for TypeScript interop).
|
|
142
|
+
*/
|
|
143
|
+
export function resultStepsMapToFormSpec<FieldType>(spec: Spec_FormSpec$1<FieldType>, resultSteps: FSharpMap<Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<FieldType>>>): Spec_FormSpec$1<FieldType> {
|
|
144
|
+
return fold<Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<FieldType>>, Spec_FormSpec$1<FieldType>>((acc: Spec_FormSpec$1<FieldType>, _arg: Values_StepOrder, stepValues: FSharpMap<Shared_FieldKey, FieldDetails$1<FieldType>>): Spec_FormSpec$1<FieldType> => {
|
|
145
|
+
const stepOrder: int32 = _arg.fields[0] | 0;
|
|
146
|
+
const stepIndex: int32 = findIndex<Spec_FormStep$1<FieldType>>((s: Spec_FormStep$1<FieldType>): boolean => (s.StepOrder === stepOrder), spec.Steps) | 0;
|
|
147
|
+
return fold<Shared_FieldKey, FieldDetails$1<FieldType>, Spec_FormSpec$1<FieldType>>((s_1: Spec_FormSpec$1<FieldType>, _arg_1: Shared_FieldKey, fieldDetails: FieldDetails$1<FieldType>): Spec_FormSpec$1<FieldType> => updateField<FieldType>(s_1, fieldDetails.Key, fieldDetails.FieldValue, stepIndex), acc, stepValues);
|
|
148
|
+
}, spec, resultSteps);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Derive FormSpecMetadata from FormSpec (for TS interop / DynamicForm conversion).
|
|
153
|
+
*/
|
|
154
|
+
export function formSpecToMetadata<FieldType>(spec: Spec_FormSpec$1<FieldType>): FormSpecMetadata {
|
|
155
|
+
return new FormSpecMetadata(spec.Id, spec.Code, spec.FormSpecVersion, spec.FormSpecVersion, spec.Score);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
//# sourceMappingURL=FormSpecValues.ts.map
|