@f1studio/form-spec 5.0.0-alpha.101
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/Designer.d.ts +89 -0
- package/FormSpec.TS/Components/HelloComponent.js +68 -0
- package/FormSpec.TS/Components/HelloComponent.js.map +1 -0
- package/FormSpec.TS/Components/HelloComponent.ts.map +1 -0
- package/FormSpec.TS/Designer.js +526 -0
- package/FormSpec.TS/Designer.js.map +1 -0
- package/FormSpec.TS/Designer.ts.map +1 -0
- package/FormSpec.TS/FormSpec.js +5400 -0
- package/FormSpec.TS/FormSpec.js.map +1 -0
- package/FormSpec.TS/FormSpec.ts.map +1 -0
- package/FormSpec.TS/FormSpecHelpers.js +382 -0
- package/FormSpec.TS/FormSpecHelpers.js.map +1 -0
- package/FormSpec.TS/FormSpecHelpers.ts.map +1 -0
- package/FormSpec.TS/Helpers.js +732 -0
- package/FormSpec.TS/Helpers.js.map +1 -0
- package/FormSpec.TS/Helpers.ts.map +1 -0
- package/FormSpec.TS/Interfaces.js +257 -0
- package/FormSpec.TS/Interfaces.js.map +1 -0
- package/FormSpec.TS/Interfaces.ts.map +1 -0
- package/FormSpec.TS/Interop/FormSpec.Api.Helpers.js +854 -0
- package/FormSpec.TS/Interop/FormSpec.Api.Helpers.js.map +1 -0
- package/FormSpec.TS/Interop/FormSpec.Api.Helpers.ts.map +1 -0
- package/FormSpec.TS/Interop/FormSpec.Api.Option.js +1961 -0
- package/FormSpec.TS/Interop/FormSpec.Api.Option.js.map +1 -0
- package/FormSpec.TS/Interop/FormSpec.Api.Option.ts.map +1 -0
- package/FormSpec.TS/Interop/FormSpec.Values.Api.Option.js +1367 -0
- package/FormSpec.TS/Interop/FormSpec.Values.Api.Option.js.map +1 -0
- package/FormSpec.TS/Interop/FormSpec.Values.Api.Option.ts.map +1 -0
- package/FormSpec.TS/Logging/LogTypes.js +347 -0
- package/FormSpec.TS/Logging/LogTypes.js.map +1 -0
- package/FormSpec.TS/Logging/LogTypes.ts.map +1 -0
- package/FormSpec.TS/Migrator.js +230 -0
- package/FormSpec.TS/Migrator.js.map +1 -0
- package/FormSpec.TS/Migrator.ts.map +1 -0
- package/FormSpec.TS/PathwayDataExtractor.js +361 -0
- package/FormSpec.TS/PathwayDataExtractor.js.map +1 -0
- package/FormSpec.TS/PathwayDataExtractor.ts.map +1 -0
- package/FormSpec.TS/PathwayExecutor.js +1321 -0
- package/FormSpec.TS/PathwayExecutor.js.map +1 -0
- package/FormSpec.TS/PathwayExecutor.ts.map +1 -0
- package/FormSpec.TS/PathwayValidator.js +346 -0
- package/FormSpec.TS/PathwayValidator.js.map +1 -0
- package/FormSpec.TS/PathwayValidator.ts.map +1 -0
- package/FormSpec.TS/PluginInterface.js +171 -0
- package/FormSpec.TS/PluginInterface.js.map +1 -0
- package/FormSpec.TS/PluginInterface.ts.map +1 -0
- package/FormSpec.TS/Prelude.js +59 -0
- package/FormSpec.TS/Prelude.js.map +1 -0
- package/FormSpec.TS/Prelude.ts.map +1 -0
- package/FormSpec.TS/Renderers/FormSpecMarkdownRenderer.js +958 -0
- package/FormSpec.TS/Renderers/FormSpecMarkdownRenderer.js.map +1 -0
- package/FormSpec.TS/Renderers/FormSpecMarkdownRenderer.ts.map +1 -0
- package/FormSpec.TS/Renderers/MermaidRenderer.js +228 -0
- package/FormSpec.TS/Renderers/MermaidRenderer.js.map +1 -0
- package/FormSpec.TS/Renderers/MermaidRenderer.ts.map +1 -0
- package/FormSpec.TS/Renderers/PathwayRenderers.js +190 -0
- package/FormSpec.TS/Renderers/PathwayRenderers.js.map +1 -0
- package/FormSpec.TS/Renderers/PathwayRenderers.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Base.fs +511 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Base.fs.js +437 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Base.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Base.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Error.fs +16 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Error.fs.js +73 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Error.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Error.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Extensions.fs +50 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Extensions.fs.js +72 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Extensions.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Extensions.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Fable.Form.fableproj +28 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Field.fs +24 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Field.fs.js +56 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Field.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Field.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.Form.Simple.5.0.1/Fable.Form.Simple.fableproj +31 -0
- package/FormSpec.TS/fable_modules/Fable.Form.Simple.5.0.1/Form.fs +178 -0
- package/FormSpec.TS/fable_modules/Fable.Form.Simple.5.0.1/Form.fs.js +464 -0
- package/FormSpec.TS/fable_modules/Fable.Form.Simple.5.0.1/Form.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.Form.Simple.5.0.1/Form.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.Extensions.fs +17 -0
- package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.Hooks.fs +152 -0
- package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.Hooks.fs.js +25 -0
- package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.Hooks.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.Hooks.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.Types.fableproj +28 -0
- package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.fs +218 -0
- package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.fs.js +37 -0
- package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.ReactDom.Types.18.2.0/Fable.ReactDom.Types.fableproj +27 -0
- package/FormSpec.TS/fable_modules/Fable.ReactDom.Types.18.2.0/Fable.ReactDom.fs +82 -0
- package/FormSpec.TS/fable_modules/Fable.ReactDom.Types.18.2.0/Fable.ReactDom.fs.js +7 -0
- package/FormSpec.TS/fable_modules/Fable.ReactDom.Types.18.2.0/Fable.ReactDom.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.ReactDom.Types.18.2.0/Fable.ReactDom.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/BorderStyle.fs +59 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Colors.fs +154 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Colors.fs.js +32 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Colors.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Colors.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Feliz.fableproj +42 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Fonts.fs +240 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/GridTypes.fs +24 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Html.fs +826 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Interop.fs +83 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Interop.fs.js +292 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Interop.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Interop.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Key.fs +65 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Key.fs.js +229 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Key.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Key.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Length.fs +91 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Locale.fs +876 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Properties.fs +4080 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Properties.fs.js +133 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Properties.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Properties.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/React.fs +656 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/React.fs.js +561 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/React.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/React.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactDOM.fs +25 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactDOM.fs.js +46 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactDOM.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactDOM.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactInterop.js +63 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactInterop.js.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactTypes.fs +41 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactTypes.fs.js +7 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactTypes.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactTypes.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/StyleTypes.fs +53 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/StyleTypes.fs.js +7 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/StyleTypes.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/StyleTypes.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Styles.fs +5740 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Svg.fs +1455 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Svg.fs.js +39 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Svg.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Svg.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/TextDecorationLine.fs +13 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/TextDecorationStyle.fs +33 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Transform.fs +181 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/TransformOrigin.fs +17 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/TransitionProperty.fs +162 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Types.fs +13 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Types.fs.js +7 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Types.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Types.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Decode.fs +1768 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Decode.fs.js +2337 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Decode.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Decode.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Encode.fs +811 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Encode.fs.js +465 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Encode.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Encode.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Extra.fs +47 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Extra.fs.js +18 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Extra.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Extra.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Thoth.Json.fableproj +34 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Types.fs +68 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Types.fs.js +355 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Types.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Types.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/project_cracked.json +1 -0
- package/FormSpec.d.ts +1257 -0
- package/FormSpecHelpers.d.ts +50 -0
- package/Helpers.d.ts +147 -0
- package/Interfaces.d.ts +70 -0
- package/Interop/FormSpec.Api.Helpers.d.ts +247 -0
- package/Interop/FormSpec.Api.Helpers.d.ts.map +1 -0
- package/Interop/FormSpec.Api.Option.d.ts +384 -0
- package/Interop/FormSpec.Api.Option.d.ts.map +1 -0
- package/Interop/FormSpec.Values.Api.Option.d.ts +324 -0
- package/Interop/FormSpec.Values.Api.Option.d.ts.map +1 -0
- package/Migrator.d.ts +59 -0
- package/PathwayDataExtractor.d.ts +19 -0
- package/PathwayExecutor.d.ts +210 -0
- package/PathwayValidator.d.ts +52 -0
- package/PluginInterface.d.ts +36 -0
- package/Prelude.d.ts +11 -0
- package/README.TS.md +622 -0
- package/README.md +85 -0
- package/package.json +39 -0
- package/src/Components/HelloComponent.ts +48 -0
- package/src/Components/HelloComponent.ts.map +1 -0
- package/src/Designer.ts +389 -0
- package/src/Designer.ts.map +1 -0
- package/src/FormSpec.ts +3114 -0
- package/src/FormSpec.ts.map +1 -0
- package/src/FormSpecHelpers.ts +374 -0
- package/src/FormSpecHelpers.ts.map +1 -0
- package/src/Helpers.ts +765 -0
- package/src/Helpers.ts.map +1 -0
- package/src/Interfaces.ts +166 -0
- package/src/Interfaces.ts.map +1 -0
- package/src/Interop/FormSpec.Api.Helpers.ts +872 -0
- package/src/Interop/FormSpec.Api.Helpers.ts.map +1 -0
- package/src/Interop/FormSpec.Api.Option.ts +1618 -0
- package/src/Interop/FormSpec.Api.Option.ts.map +1 -0
- package/src/Interop/FormSpec.Values.Api.Option.ts +1214 -0
- package/src/Interop/FormSpec.Values.Api.Option.ts.map +1 -0
- package/src/Logging/LogTypes.ts +212 -0
- package/src/Logging/LogTypes.ts.map +1 -0
- package/src/Migrator.ts +156 -0
- package/src/Migrator.ts.map +1 -0
- package/src/PathwayDataExtractor.ts +290 -0
- package/src/PathwayDataExtractor.ts.map +1 -0
- package/src/PathwayExecutor.ts +1102 -0
- package/src/PathwayExecutor.ts.map +1 -0
- package/src/PathwayValidator.ts +244 -0
- package/src/PathwayValidator.ts.map +1 -0
- package/src/PluginInterface.ts +79 -0
- package/src/PluginInterface.ts.map +1 -0
- package/src/Prelude.ts +21 -0
- package/src/Prelude.ts.map +1 -0
- package/src/Renderers/FormSpecMarkdownRenderer.ts +874 -0
- package/src/Renderers/FormSpecMarkdownRenderer.ts.map +1 -0
- package/src/Renderers/MermaidRenderer.ts +218 -0
- package/src/Renderers/MermaidRenderer.ts.map +1 -0
- package/src/Renderers/PathwayRenderers.ts +200 -0
- package/src/Renderers/PathwayRenderers.ts.map +1 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
|
3
|
+
<PropertyGroup>
|
|
4
|
+
<TargetFramework>netstandard2.1</TargetFramework>
|
|
5
|
+
<Description>
|
|
6
|
+
Extensible core library used to build forms
|
|
7
|
+
</Description>
|
|
8
|
+
<FablePackageType>library</FablePackageType>
|
|
9
|
+
<PackageTags>fable-javascript</PackageTags>
|
|
10
|
+
</PropertyGroup>
|
|
11
|
+
<ItemGroup>
|
|
12
|
+
<Compile Include="Extensions.fs" />
|
|
13
|
+
<Compile Include="Error.fs" />
|
|
14
|
+
<Compile Include="Field.fs" />
|
|
15
|
+
<Compile Include="Base.fs" />
|
|
16
|
+
</ItemGroup>
|
|
17
|
+
<ItemGroup>
|
|
18
|
+
<PackageReference Include="EasyBuild.PackageReleaseNotes.Tasks">
|
|
19
|
+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
|
20
|
+
<PrivateAssets>all</PrivateAssets>
|
|
21
|
+
</PackageReference>
|
|
22
|
+
<PackageReference Include="Fable.Package.SDK">
|
|
23
|
+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
|
24
|
+
<PrivateAssets>all</PrivateAssets>
|
|
25
|
+
</PackageReference>
|
|
26
|
+
<PackageReference Include="FSharp.Core" />
|
|
27
|
+
</ItemGroup>
|
|
28
|
+
</Project>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
module Fable.Form.Field
|
|
2
|
+
|
|
3
|
+
type IAttributes =
|
|
4
|
+
abstract GetFieldId: unit -> string
|
|
5
|
+
|
|
6
|
+
[<NoComparison; NoEquality>]
|
|
7
|
+
type Field<'Attributes, 'Value, 'Values when 'Attributes :> IAttributes> =
|
|
8
|
+
{
|
|
9
|
+
Value: 'Value
|
|
10
|
+
Update: 'Value -> 'Values
|
|
11
|
+
Attributes: 'Attributes
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
let mapValues
|
|
15
|
+
(fn: 'A -> 'B)
|
|
16
|
+
(field: Field<'Attributes, 'Value, 'A>)
|
|
17
|
+
: Field<'Attributes, 'Value, 'B>
|
|
18
|
+
=
|
|
19
|
+
|
|
20
|
+
{
|
|
21
|
+
Value = field.Value
|
|
22
|
+
Update = field.Update >> fn
|
|
23
|
+
Attributes = field.Attributes
|
|
24
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
get Field$3 () {
|
|
13
|
+
return Field$3;
|
|
14
|
+
},
|
|
15
|
+
get Field$3_$reflection () {
|
|
16
|
+
return Field$3_$reflection;
|
|
17
|
+
},
|
|
18
|
+
get mapValues () {
|
|
19
|
+
return mapValues;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
const _Types = require("@fable-org/fable-library-js/Types.js");
|
|
23
|
+
const _Reflection = require("@fable-org/fable-library-js/Reflection.js");
|
|
24
|
+
class Field$3 extends _Types.Record {
|
|
25
|
+
constructor(Value, Update, Attributes){
|
|
26
|
+
super();
|
|
27
|
+
this.Value = Value;
|
|
28
|
+
this.Update = Update;
|
|
29
|
+
this.Attributes = Attributes;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function Field$3_$reflection(gen0, gen1, gen2) {
|
|
33
|
+
return (0, _Reflection.record_type)("Fable.Form.Field.Field`3", [
|
|
34
|
+
gen0,
|
|
35
|
+
gen1,
|
|
36
|
+
gen2
|
|
37
|
+
], Field$3, ()=>[
|
|
38
|
+
[
|
|
39
|
+
"Value",
|
|
40
|
+
gen1
|
|
41
|
+
],
|
|
42
|
+
[
|
|
43
|
+
"Update",
|
|
44
|
+
(0, _Reflection.lambda_type)(gen1, gen2)
|
|
45
|
+
],
|
|
46
|
+
[
|
|
47
|
+
"Attributes",
|
|
48
|
+
gen0
|
|
49
|
+
]
|
|
50
|
+
]);
|
|
51
|
+
}
|
|
52
|
+
function mapValues(fn, field) {
|
|
53
|
+
return new Field$3(field.Value, (arg)=>fn(field.Update(arg)), field.Attributes);
|
|
54
|
+
} //# sourceMappingURL=Field.fs.ts.map
|
|
55
|
+
|
|
56
|
+
//# sourceMappingURL=Field.fs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../FormSpec.TS/fable_modules/Fable.Form.3.0.0/Field.fs.ts"],"names":["field","fn"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAmBI,IAAA,QACYA,MAAAA,KAAAA,EAAAA,CAAAA,MACiBC,GAAhBD,MAAAA,MAAAA,CAAAA,OACIA,MAAAA,UAAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["./Field.fs"],"names":["field","fn"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;WAmBI,YACY,AAAAA,gCACC,AAAgBC,GAAhB,AAAAD,oBACI,AAAAA","file":null,"sourcesContent":null,"sourceRoot":null}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
|
3
|
+
<PropertyGroup>
|
|
4
|
+
<TargetFramework>netstandard2.1</TargetFramework>
|
|
5
|
+
<Description>
|
|
6
|
+
Contains the global logic of how a form should behave.
|
|
7
|
+
|
|
8
|
+
It can be used has a standalone library if you want to build your own fields or
|
|
9
|
+
you can use Fable.Form.Simple.Bulma to have a ready to use fields made for Bulma CSS framework.
|
|
10
|
+
</Description>
|
|
11
|
+
<FablePackageType>library</FablePackageType>
|
|
12
|
+
<PackageTags>fable-javascript</PackageTags>
|
|
13
|
+
</PropertyGroup>
|
|
14
|
+
<ItemGroup>
|
|
15
|
+
<Compile Include="Form.fs" />
|
|
16
|
+
</ItemGroup>
|
|
17
|
+
<ItemGroup>
|
|
18
|
+
<ProjectReference Include="..\Fable.Form\Fable.Form.fsproj" />
|
|
19
|
+
</ItemGroup>
|
|
20
|
+
<ItemGroup>
|
|
21
|
+
<PackageReference Include="EasyBuild.PackageReleaseNotes.Tasks">
|
|
22
|
+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
|
23
|
+
<PrivateAssets>all</PrivateAssets>
|
|
24
|
+
</PackageReference>
|
|
25
|
+
<PackageReference Include="Fable.Package.SDK">
|
|
26
|
+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
|
27
|
+
<PrivateAssets>all</PrivateAssets>
|
|
28
|
+
</PackageReference>
|
|
29
|
+
<PackageReference Include="FSharp.Core" />
|
|
30
|
+
</ItemGroup>
|
|
31
|
+
</Project>
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
namespace Fable.Form.Simple
|
|
2
|
+
|
|
3
|
+
open Fable.Form
|
|
4
|
+
|
|
5
|
+
[<RequireQualifiedAccess>]
|
|
6
|
+
module Form =
|
|
7
|
+
|
|
8
|
+
module View =
|
|
9
|
+
|
|
10
|
+
[<NoEquality; NoComparison>]
|
|
11
|
+
type OnSubmit = OnSubmit of (unit -> unit)
|
|
12
|
+
|
|
13
|
+
type State =
|
|
14
|
+
| Idle
|
|
15
|
+
| Loading
|
|
16
|
+
| ReadOnly
|
|
17
|
+
| Error of string
|
|
18
|
+
| Success of string
|
|
19
|
+
|
|
20
|
+
type ErrorTracking =
|
|
21
|
+
| ErrorTracking of
|
|
22
|
+
{|
|
|
23
|
+
ShowAllErrors: bool
|
|
24
|
+
ShowFieldError: Set<string>
|
|
25
|
+
|}
|
|
26
|
+
|
|
27
|
+
type Model<'Values> =
|
|
28
|
+
{
|
|
29
|
+
Values: 'Values
|
|
30
|
+
State: State
|
|
31
|
+
ErrorTracking: ErrorTracking
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
type Validation =
|
|
35
|
+
| ValidateOnBlur
|
|
36
|
+
| ValidateOnSubmit
|
|
37
|
+
|
|
38
|
+
[<RequireQualifiedAccess; NoComparison; NoEquality>]
|
|
39
|
+
type Action<'ViewNode> =
|
|
40
|
+
| SubmitOnly of string
|
|
41
|
+
| Custom of (State -> 'ViewNode)
|
|
42
|
+
|
|
43
|
+
[<NoComparison; NoEquality>]
|
|
44
|
+
type ViewConfig<'Values, 'Output, 'ViewNode> =
|
|
45
|
+
{
|
|
46
|
+
OnChange: Model<'Values> -> unit
|
|
47
|
+
OnSubmit: 'Output -> unit
|
|
48
|
+
Action: Action<'ViewNode>
|
|
49
|
+
Validation: Validation
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
[<NoComparison; NoEquality>]
|
|
53
|
+
type FormConfig<'Output, 'ViewNode> =
|
|
54
|
+
{
|
|
55
|
+
OnSubmit: OnSubmit option
|
|
56
|
+
State: State
|
|
57
|
+
Action: Action<'ViewNode>
|
|
58
|
+
Fields: 'ViewNode list
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
let idle (values: 'Values) =
|
|
62
|
+
{
|
|
63
|
+
Values = values
|
|
64
|
+
State = Idle
|
|
65
|
+
ErrorTracking =
|
|
66
|
+
ErrorTracking
|
|
67
|
+
{|
|
|
68
|
+
ShowAllErrors = false
|
|
69
|
+
ShowFieldError = Set.empty
|
|
70
|
+
|}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
let setLoading (formModel: Model<'Values>) =
|
|
74
|
+
{ formModel with
|
|
75
|
+
State = Loading
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
[<NoComparison; NoEquality>]
|
|
79
|
+
type FieldConfig<'Values, 'Value> =
|
|
80
|
+
{
|
|
81
|
+
OnChange: 'Values -> unit
|
|
82
|
+
OnBlur: (string -> unit) option
|
|
83
|
+
Disabled: bool
|
|
84
|
+
IsReadOnly: bool
|
|
85
|
+
ShowError: string -> bool
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
let errorToString (error: Error.Error) =
|
|
89
|
+
match error with
|
|
90
|
+
| Error.RequiredFieldIsEmpty -> "This field is required"
|
|
91
|
+
|
|
92
|
+
| Error.ValidationFailed validationError -> validationError
|
|
93
|
+
|
|
94
|
+
| Error.External externalError -> externalError
|
|
95
|
+
|
|
96
|
+
let custom
|
|
97
|
+
(viewConfig: ViewConfig<'Values, 'Output, 'ViewNode>)
|
|
98
|
+
(renderForm: FormConfig<'Output, 'ViewNode> -> 'ViewNode)
|
|
99
|
+
(renderField: FieldConfig<'Values, 'Output> -> Base.FilledField<'Field> -> 'ViewNode)
|
|
100
|
+
(form: Base.Form<'Values, 'Output, 'Field>)
|
|
101
|
+
(model: Model<'Values>)
|
|
102
|
+
=
|
|
103
|
+
|
|
104
|
+
let (fields, result) =
|
|
105
|
+
let res = Base.fill form model.Values
|
|
106
|
+
|
|
107
|
+
res.Fields, res.Result
|
|
108
|
+
|
|
109
|
+
let (ErrorTracking errorTracking) = model.ErrorTracking
|
|
110
|
+
|
|
111
|
+
let onSubmit =
|
|
112
|
+
match result with
|
|
113
|
+
| Ok msg ->
|
|
114
|
+
if model.State = Loading then
|
|
115
|
+
None
|
|
116
|
+
|
|
117
|
+
else
|
|
118
|
+
(fun () -> viewConfig.OnSubmit msg) |> OnSubmit |> Some
|
|
119
|
+
|
|
120
|
+
| Result.Error _ ->
|
|
121
|
+
if errorTracking.ShowAllErrors then
|
|
122
|
+
None
|
|
123
|
+
|
|
124
|
+
else
|
|
125
|
+
fun () ->
|
|
126
|
+
viewConfig.OnChange
|
|
127
|
+
{ model with
|
|
128
|
+
ErrorTracking =
|
|
129
|
+
ErrorTracking
|
|
130
|
+
{| errorTracking with
|
|
131
|
+
ShowAllErrors = true
|
|
132
|
+
|}
|
|
133
|
+
}
|
|
134
|
+
|> OnSubmit
|
|
135
|
+
|> Some
|
|
136
|
+
|
|
137
|
+
let onBlur =
|
|
138
|
+
match viewConfig.Validation with
|
|
139
|
+
| ValidateOnSubmit -> None
|
|
140
|
+
|
|
141
|
+
| ValidateOnBlur ->
|
|
142
|
+
Some(fun label ->
|
|
143
|
+
viewConfig.OnChange
|
|
144
|
+
{ model with
|
|
145
|
+
ErrorTracking =
|
|
146
|
+
ErrorTracking
|
|
147
|
+
{| errorTracking with
|
|
148
|
+
ShowFieldError =
|
|
149
|
+
Set.add label errorTracking.ShowFieldError
|
|
150
|
+
|}
|
|
151
|
+
}
|
|
152
|
+
)
|
|
153
|
+
|
|
154
|
+
let showError (label: string) =
|
|
155
|
+
errorTracking.ShowAllErrors || Set.contains label errorTracking.ShowFieldError
|
|
156
|
+
|
|
157
|
+
let fieldToElement =
|
|
158
|
+
renderField
|
|
159
|
+
{
|
|
160
|
+
OnChange =
|
|
161
|
+
fun values ->
|
|
162
|
+
viewConfig.OnChange
|
|
163
|
+
{ model with
|
|
164
|
+
Values = values
|
|
165
|
+
}
|
|
166
|
+
OnBlur = onBlur
|
|
167
|
+
Disabled = model.State = Loading
|
|
168
|
+
IsReadOnly = model.State = ReadOnly
|
|
169
|
+
ShowError = showError
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
renderForm
|
|
173
|
+
{
|
|
174
|
+
OnSubmit = onSubmit
|
|
175
|
+
Action = viewConfig.Action
|
|
176
|
+
State = model.State
|
|
177
|
+
Fields = List.map fieldToElement fields
|
|
178
|
+
}
|