diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2025-08-18 15:50:57 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2025-08-19 20:15:22 +0800 |
| commit | 7419b49dbd9495f40f09d43bb26115a788d455d6 (patch) | |
| tree | 79c2bd1275610f39fd8600508de20952dac7e277 | |
| parent | 19289b6dc43d51f0405ce6b5b0c33b2259423fd6 (diff) | |
refactor(launcher:components): better handle defaults
| -rw-r--r-- | launcher/components/App.qml | 2 | ||||
| -rw-r--r-- | launcher/components/IComponent.qml | 4 | ||||
| -rw-r--r-- | launcher/components/Spell.qml | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/launcher/components/App.qml b/launcher/components/App.qml index 259a494..0bb5fd9 100644 --- a/launcher/components/App.qml +++ b/launcher/components/App.qml @@ -34,7 +34,7 @@ IComponent { return { valid: isValid, priority: isValid, - answer: selected ? selected.icon : "" + answer: selected?.icon || "" }; } diff --git a/launcher/components/IComponent.qml b/launcher/components/IComponent.qml index 4ff3f2f..4f47b88 100644 --- a/launcher/components/IComponent.qml +++ b/launcher/components/IComponent.qml @@ -15,8 +15,8 @@ IRect { readonly property string inputCleaned: input.toLowerCase().trim() property string prefix property bool active: !standalone ? input && _input.startsWith(prefix) : true - property bool valid: processed?.valid || false - property bool priority: valid && processed?.priority || false // please set priority to false if it's invalid + property bool valid: !standalone ? processed?.valid || false : true + property bool priority: !standalone ? valid && processed?.priority || false : true // please set priority to false if it's invalid property string answer: processed?.answer || "" property Component preview: Component { IText { diff --git a/launcher/components/Spell.qml b/launcher/components/Spell.qml index d4f505b..fe01c3f 100644 --- a/launcher/components/Spell.qml +++ b/launcher/components/Spell.qml @@ -63,8 +63,8 @@ IComponent { return { valid: isValid, priority: isValid, - answer: isValid ? answer : "", - predictiveCompletion: isValid ? answer.slice(input.length) : "" + answer: answer || "", + predictiveCompletion: answer?.slice(input.length) || "" }; } |
