mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-02 19:17:10 +00:00
feat(hierarchy): add editable signal with native derivation
This commit is contained in:
1 parent
f572c8ba66
commit
1d01ca77dc
1 file changed
+8
@@ -66,6 +66,7 @@ type Element struct {
|
|||||||
Checked bool `json:"checked,omitempty"`
|
Checked bool `json:"checked,omitempty"`
|
||||||
Focused bool `json:"focused,omitempty"`
|
Focused bool `json:"focused,omitempty"`
|
||||||
Selected bool `json:"selected,omitempty"`
|
Selected bool `json:"selected,omitempty"`
|
||||||
|
Editable bool `json:"editable,omitempty"`
|
||||||
Bounds Bounds `json:"bounds"`
|
Bounds Bounds `json:"bounds"`
|
||||||
Attributes map[string]string `json:"attrs,omitempty"`
|
Attributes map[string]string `json:"attrs,omitempty"`
|
||||||
}
|
}
|
||||||
@@ -91,6 +92,7 @@ type treeNodeJSON struct {
|
|||||||
Focused *bool `json:"focused"`
|
Focused *bool `json:"focused"`
|
||||||
Checked *bool `json:"checked"`
|
Checked *bool `json:"checked"`
|
||||||
Selected *bool `json:"selected"`
|
Selected *bool `json:"selected"`
|
||||||
|
Editable *bool `json:"editable"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Selector describes a multi-attribute AND match.
|
// Selector describes a multi-attribute AND match.
|
||||||
@@ -221,6 +223,11 @@ func elementFromNode(node *treeNodeJSON) *Element {
|
|||||||
if node.Selected != nil {
|
if node.Selected != nil {
|
||||||
element.Selected = *node.Selected
|
element.Selected = *node.Selected
|
||||||
}
|
}
|
||||||
|
if node.Editable != nil {
|
||||||
|
element.Editable = *node.Editable
|
||||||
|
} else {
|
||||||
|
element.Editable = strings.Contains(element.Class, "EditText") || attrs["hintText"] != ""
|
||||||
|
}
|
||||||
|
|
||||||
if b, ok := attrs["bounds"]; ok && b != "" {
|
if b, ok := attrs["bounds"]; ok && b != "" {
|
||||||
bounds, err := parseBounds(b)
|
bounds, err := parseBounds(b)
|
||||||
@@ -246,6 +253,7 @@ func elementFromNode(node *treeNodeJSON) *Element {
|
|||||||
if node.Selected != nil {
|
if node.Selected != nil {
|
||||||
element.Attributes["selected"] = strconv.FormatBool(*node.Selected)
|
element.Attributes["selected"] = strconv.FormatBool(*node.Selected)
|
||||||
}
|
}
|
||||||
|
element.Attributes["editable"] = strconv.FormatBool(element.Editable)
|
||||||
|
|
||||||
return element
|
return element
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user