| | | 1 | | namespace Nabs.Ui.Abstractions; |
| | | 2 | | |
| | | 3 | | public class BlazorUiMappings |
| | | 4 | | { |
| | | 5 | | public Type? FormGroupWrapper { get; private set; } |
| | | 6 | | public Type? FormInputWrapper { get; private set; } |
| | | 7 | | public Dictionary<string, Type> InputMappings { get; } = []; |
| | | 8 | | |
| | | 9 | | public void ClearMappings() |
| | | 10 | | { |
| | 1 | 11 | | FormGroupWrapper = null; |
| | 1 | 12 | | FormInputWrapper = null; |
| | 1 | 13 | | InputMappings.Clear(); |
| | 1 | 14 | | } |
| | | 15 | | |
| | | 16 | | public void AddFormGroupWrapper(Type componentType) |
| | | 17 | | { |
| | 1 | 18 | | FormGroupWrapper = componentType; |
| | 1 | 19 | | } |
| | | 20 | | |
| | | 21 | | public void AddFormInputWrapper(Type componentType) |
| | | 22 | | { |
| | 1 | 23 | | FormInputWrapper = componentType; |
| | 1 | 24 | | } |
| | | 25 | | |
| | | 26 | | public void AddFormInputMapping<TValue>(Type componentType) |
| | | 27 | | { |
| | 0 | 28 | | var typeName = typeof(TValue).Name; |
| | 0 | 29 | | InputMappings.TryAdd(typeName, componentType); |
| | 0 | 30 | | } |
| | | 31 | | |
| | | 32 | | public void AddFormInputMapping(string typeName, Type componentType) |
| | | 33 | | { |
| | 1 | 34 | | InputMappings.TryAdd(typeName, componentType); |
| | 1 | 35 | | } |
| | | 36 | | } |