-
-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: make Fable.Form.Simple pluggable #54
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MangelMaxime
force-pushed
the
feature/pluggable
branch
from
September 6, 2024 17:01
fe741b3
to
80e20e4
Compare
MangelMaxime
force-pushed
the
feature/pluggable
branch
2 times, most recently
from
September 8, 2024 15:40
19e12dc
to
e1cb605
Compare
MangelMaxime
force-pushed
the
feature/pluggable
branch
from
September 8, 2024 16:21
e1cb605
to
c5097aa
Compare
[Fable.Form] === changelog === * Field attributes now needs to inherit from `IAttributes` * Refactor `Base.fill` to explicitly take a `values` argument instead of returning a lambda ```fsharp val fill: Form<'Values,'Output,'Field> -> 'Values -> FilledForm<'Output,'Field> ``` ```fsharp val fill: Form<'Values,'Output,'Field> -> values: 'Values -> FilledForm<'Output,'Field> ``` === changelog ===
[Fable.Form.Simple] === changelog === `Fable.Form.Simple` is now field agnostic. It only contains logic on how a Form should be represented and how it behaves. * Change `Form.View.custom` to take an additional `renderForm` and `renderField` functions * Remove all `Form.xxx` functions (they moved to Fable.Form.Simple.Bulma) * `Form.succeed` * `Form.append` * `Form.disable` * `Form.andThen` * `Form.optional` * `Form.textField` * `Form.passwordField` * `Form.colorField` * `Form.dateField` * `Form.dateTimeLocalField` * `Form.numberField` * `Form.searchField` * `Form.telField` * `Form.timeField` * `Form.emailField` * `Form.textareaField` * `Form.checkboxField` * `Form.radioField` * `Form.selectField` * `Form.fileField` * `Form.group` * `Form.section` * `Form.fill` * `Form.rec mapFieldValues` * `Form.list` * `Form.meta` * `Form.mapValues` === changelog ===
[Fable.Form.Simple.Bulma] === changelog === It is now easy to create custom form fields. The drawback right now is that customising only the view requires a little more work than before. But I think the trade-off is worth it. Before, people needed to fork `Fable.Form.Simple` and `Fable.Form.Simple.Bulma` to add custom fields. Now, they just need to implements `IField` API and it is done. * Define how fields are represented thanks to the `IField`, `StandardRenderFieldConfig`, `IStandardField`, `IGenericField` and more. * Add `FieldId` to most of field attributes because using only the label to detect field error don't guarantee a unique result. For example, you can have two fields with a label "FirstName". Thanks to the field id you do "firstname-student" and "firstname-teacher" * Export removed `Form.xxx` functions from `Fable.Form.Simple` making transition to 2.0 easy * `Form.succeed` * `Form.append` * `Form.disable` * `Form.andThen` * `Form.optional` * `Form.textField` * `Form.passwordField` * `Form.colorField` * `Form.dateField` * `Form.dateTimeLocalField` * `Form.numberField` * `Form.searchField` * `Form.telField` * `Form.timeField` * `Form.emailField` * `Form.textareaField` * `Form.checkboxField` * `Form.radioField` * `Form.selectField` * `Form.fileField` * `Form.group` * `Form.section` * `Form.fill` * `Form.rec mapFieldValues` * `Form.list` * `Form.meta` * `Form.mapValues` === changelog ===
…fix regarding breaking change parsing
MangelMaxime
force-pushed
the
feature/pluggable
branch
from
September 8, 2024 18:49
d003b89
to
37f2dcc
Compare
[Fable.Form][Fable.Form.Simple.Bulma] Fix #45
MangelMaxime
force-pushed
the
feature/pluggable
branch
2 times, most recently
from
September 9, 2024 15:25
e2e9b67
to
f93359e
Compare
[Fable.Form][Fable.Form.Simple][Fable.Form.Simple.Bulma] === changelog === 1. Set it at the field level ```fsharp Form.textField // ... |> Form.readOnly // or Form.textField // ... |> Form.readOnlyIf myCondition ``` 2. Set it at the form level ```fsharp let formValue : Form.View.Model<Values> = // ... { formValue with State = Form.View.State.Loading } ``` === changelog ===
MangelMaxime
force-pushed
the
feature/pluggable
branch
from
September 9, 2024 15:27
f93359e
to
02e31e6
Compare
[Fable.Form.Simple.Bulma]
…x Fable.Form dependency version
[Fable.Form.Simple][Fable.Form.Simple.Bulma]
[Fable.Form.Simple][Fable.Form.Simple.Bulma][Fable.Form.Simple.Sutil.Bulma]
MangelMaxime
force-pushed
the
feature/pluggable
branch
from
October 7, 2024 18:19
395685d
to
94435b9
Compare
[Fable.Form.Simple.Bulma]
MangelMaxime
force-pushed
the
feature/pluggable
branch
from
October 7, 2024 20:06
d9275ab
to
08d3531
Compare
[Fable.Form.Simple.Bulma]
…+ Introduce pipeline builder API [Fable.Form.Simple.Fields.Html][Fable.Form.Simple.Bulma]
[Fable.Form.Simple]
MangelMaxime
force-pushed
the
feature/pluggable
branch
from
October 12, 2024 18:59
0e53555
to
f189390
Compare
…elog before release
…ations + improve DaisyUI demo [Fable.Form.Simple.Sutil.Bulma]
I already spent more time than I planned on this rewrite, and I don't think that a lot of people are using Fable.Lit. If someone want to add Fable.Lit support they can maintain it.
chore: dw
MangelMaxime
force-pushed
the
feature/pluggable
branch
from
October 20, 2024 16:56
bf20451
to
2533d9d
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Beta versions are already out, so you can give it a try 🎉
Upgrade form previous version:
Change
Form.Form<Values, Msg, _> =
orForm.Form<Values, Msg, IReactProperty> =
toForm<Values, Msg> =
Add
FieldId = "replace-me"
to all the attributes that fails to compile.FieldId
should be unique across your formIf you want to create a custom field you can looks at:
API is not final yet, but looking at how things went I don't think the expose API will change too much. 🤞
Would be nice to have done before making a stable release:
Attributes
without breaking the user code because such new features will have a default value. For example, if we add Add help policy #26Base.disableIf
#45IsLoading
to the field config #44 (look what can be done here)readOnly
support (it works similarly todisable
)Record
to store the field state instead of just a primitive (could be an autocomplete text for example, to have a show/hide boolean for the list of choices)(string * string)
Won't do:
Look into using TypeScript to create a field
After looking into it, it is in theory possible to use TypeScript to create field. But it requires, access to the generate code by Fable.
The reason, is that even if most of the new API is testing things by the shape of it. Some of the API needs to call internal API:
Things like
StandardRenderFieldConfig
needs to have access to:And the list goes on. I think for now, this is not worth it looking into it. This could be revisited once Fable is able to consume pre-compiled packages from NPM for example.
Or we expose the require API via a global module for usage in TypeScript code. I will left that to explore for others