This repository has been archived by the owner on Jan 29, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
MauMatSelect.cs
111 lines (78 loc) · 2.99 KB
/
MauMatSelect.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
using MAU.Attributes;
using MAU.Core;
using MAU.Helper.Types;
using static MAU.Attributes.MauProperty;
using static MAU.Events.MauEventHandlers;
using static MAU.Attributes.MauMethod;
namespace MAU.ReadyComponents.Angular
{
public class MauMatSelect : MauComponent
{
#region [ Mau Events ]
[MauEvent("openedChange")]
public event MauEventHandler OnOpenedChange;
[MauEvent("selectionChange")]
public event MauEventHandler OnSelectionChange;
[MauEvent("valueChange")]
public event MauEventHandler OnValueChange;
#endregion
#region [ Mau Variable ]
[MauVariable("Options")]
public MauDataList<string> Options { get; private set; }
#endregion
#region [ Mau Properties ]
[MauProperty("disableOptionCentering", MauPropertyType.ComponentProperty)]
public bool DisableOptionCentering { get; set; }
[MauProperty("disableRipple", MauPropertyType.ComponentProperty)]
public bool DisableRipple { get; set; }
[MauProperty("disabled", MauPropertyType.ComponentProperty, Important = true)]
public bool Disabled { get; set; }
[MauProperty("id", MauPropertyType.ComponentProperty)]
public string Id { get; set; }
[MauProperty("placeholder", MauPropertyType.ComponentProperty)]
public string Placeholder { get; set; }
[MauProperty("required", MauPropertyType.ComponentProperty)]
public bool Required { get; set; }
[MauProperty("typeaheadDebounceInterval", MauPropertyType.ComponentProperty)]
public long TypeaheadDebounceInterval { get; set; }
[MauProperty("value", MauPropertyType.ComponentProperty)]
public string SelectedItem { get; private set; }
[MauProperty("empty", MauPropertyType.ComponentProperty, PropStatus = MauPropertyStatus.ReadOnly)]
public bool Empty { get; set; }
[MauProperty("focused", MauPropertyType.ComponentProperty, PropStatus = MauPropertyStatus.ReadOnly)]
public bool Focused { get; set; }
[MauProperty("panelOpen", MauPropertyType.ComponentProperty, PropStatus = MauPropertyStatus.ReadOnly)]
public bool PanelOpen { get; set; }
#endregion
#region [ Mau Methods ]
[MauMethod("close", MauMethodType.ComponentMethod, MauMethodCallType.ExecuteInAngular)]
public void Close() { }
[MauMethod("focus", MauMethodType.ComponentMethod, MauMethodCallType.ExecuteInAngular)]
public void Focus() { }
[MauMethod("open", MauMethodType.ComponentMethod, MauMethodCallType.ExecuteInAngular)]
public void Open() { }
[MauMethod("toggle", MauMethodType.ComponentMethod, MauMethodCallType.ExecuteInAngular)]
public void Toggle() { }
#endregion
public MauMatSelect(string mauId) : base(mauId)
{
Options = new MauDataList<string>(this, nameof(Options));
}
#region [ Options Controlling ]
public bool SelectOption(string newOption)
{
if (!Options.Contains(newOption))
return false;
SelectedItem = newOption;
return true;
}
public bool SelectOption(int newOptionIndex)
{
if (newOptionIndex >= Options.Count)
return false;
SelectedItem = Options[newOptionIndex];
return true;
}
#endregion
}
}