Closed Zaid-Ajaj closed 6 years ago
Hi !
First of all : THANK !
I just look your code.
It's look very interesting for CascaderValue
.
But not sur why you don't use StringEnum for simple stuff ?
[<StringEnum>]
type CascaderExpandTrigger = Click | Hover
What is the flexibility of not using this ?
Yes there is many work to do to clean this lib. Help can be very nice ;p I still have problems about complex type used in typescript def:
this is a nightmare :
type ShowSearchType = {
filter: (inputValue: string, path: CascaderOptionType[], names: FilledFiledNamesType) => boolean;
render?: (
inputValue: string,
path: CascaderOptionType[],
prefixCls: string | undefined,
names: FilledFiledNamesType,
) => React.ReactNode;
sort?: (a: CascaderOptionType[], b: CascaderOptionType[], inputValue: string, names: FilledFiledNamesType) => number;
matchInputWidth?: boolean;
}
But not sur why you don't use StringEnum for simple stuff ?
I could have used StringEnum indeed, no particular reason for not using it, they are the same
this is a nightmare :
I agree that this is complex, the idea is to not put everything inside a record, you can also use a class with helper builder methods for constructing the object literal.
Also, you don't have to support every single option and configuration in the library (ant design is huge). I think we should aim for supporting common use-cases we just make sure that it is well done
So I still prefer StringEnum for this time. Less code -> less bug -> less maintenance
Think you are right I need to stop looking at all options. For exemple, I think renderer/rendering function are useless for Fable/elmish. I was converting code from typescript def but maybe it's not a good approch.
By the way I already started the cascader, I just push it in this branch : https://github.com/evilz/fable-ant-design/blob/Cascader/src/Fable.Ant.Design/Cascader.fs
Less code -> less bug -> less maintenance
The maintenance is usually minimal once you do it right and have working examples
I was converting code from typescript def but maybe it's not a good approch.
I am converting the types right from the docs and the demos because these provide the most common use-cases
By the way I already started the cascader, I just push it in this branch
I see, which Cascader
do you wish to keep? :wink:
Yours with StringEnum
:p
Done
This PR adds initial Cascader support in the library along with docs and working demo page.
Note that I use special interop techniques to map F# types and values manually into javascript object literals, this way you don't have to rely on
[<Pojo>]
or[<StringEnum>]
attributes, norErased unions
to map the options. It is a bit more work but allows for great flexibility that this library definitely needs for in order be clean, type-safe and above all, enjoyable to work with.Let me know what you think :smile: