Refactor: EditableTextView.Changed() and the Canceled spelling

EditableTextView.Changed is a method like every other result's.
AlertDialogResult, PopconfirmResult and DateTimeResult spell Canceled
the American way, matching EditableTextView and LoadingOverlayResult.
Callers, Gallery and docs updated.
This commit is contained in:
ZacharyZhang-NY committed 2026-10-05 13:50:02 -04:00
1 parent 5d395ad789
commit c0be05d043
22 files changed
+306 -72

No files matched your search

+3 -3
View File
@@ -13,7 +13,7 @@ view := func(c *ui.Context) {
mujica.Use(c, mujica.Settings{})
mujica.Text(c, "Order ID: 4821-AX", mujica.TextOptions{Selectable: true})
mujica.Text(c, "A long note that stops after two lines.", mujica.TextOptions{MaxLines: 2})
if mujica.EditableText(c, &name, mujica.EditableTextOptions{Error: saveErr}).Changed {
if mujica.EditableText(c, &name, mujica.EditableTextOptions{Error: saveErr}).Changed() {
saveErr = "" // save name here; set saveErr on failure
}
}
@@ -36,7 +36,7 @@ view := func(c *ui.Context) {
| `Error` | `string` | `""` | 调用方保存失败的说明,显示在文本下方并报告给辅助技术。 |
| `Label` | `string` | `""` | 辅助技术读出的名称;同时用在显示状态和编辑输入框上。 |
返回值 `EditableTextView`:`Element`;`Changed` 表示本帧确认了新值;`Canceled` 表示本帧按 Escape 放弃了编辑。
返回值 `EditableTextView`:`Element`;`Changed()` 表示本帧确认了新值;`Canceled` 表示本帧按 Escape 放弃了编辑。
## 状态
@@ -49,7 +49,7 @@ view := func(c *ui.Context) {
## 事件
- `EditableTextView.Changed`:用户确认了新值,`*value` 已更新。调用方在此保存,并通过 `Saving` 与 `Error` 回传结果。
- `EditableTextView.Changed()`:用户确认了新值,`*value` 已更新。调用方在此保存,并通过 `Saving` 与 `Error` 回传结果。
- `EditableTextView.Canceled`:用户按 Escape 放弃编辑,`*value` 不变。
## 键盘操作
+1 -1
View File
@@ -40,7 +40,7 @@ ui.Render(view, 400, 300, 1)
## 事件
`Changed()`:点击“确定”或“清空”使值改变时为 true。`Cancelled()`:按 Escape、点击“取消”或点击弹层外关闭、草稿被丢弃时为 true。
`Changed()`:点击“确定”或“清空”使值改变时为 true。`Canceled()`:按 Escape、点击“取消”或点击弹层外关闭、草稿被丢弃时为 true。
## 键盘操作
+1 -1
View File
@@ -47,7 +47,7 @@ ui.Render(view, 400, 300, 1)
## 事件
`Changed()`:确认且时刻改变时为 true,写入的值位于 `Location`。`Cancelled()`:取消、Escape 或点击外部关闭时为 true。
`Changed()`:确认且时刻改变时为 true,写入的值位于 `Location`。`Canceled()`:取消、Escape 或点击外部关闭时为 true。
## 键盘操作
+2 -2
View File
@@ -37,7 +37,7 @@ ui.Render(view, 400, 300, 1)
| `CancelLabel` | `string` | 内置“取消 / Cancel” | 取消按钮文字。 |
| `ConfirmText` | `string` | `""` | 非空时显示输入框,输入内容与之完全相同后确认按钮才可用。 |
`AlertDialogResult{Confirmed, Cancelled bool}` 只在发生选择的那一帧为 true,之后对话框关闭。
`AlertDialogResult{Confirmed, Canceled bool}` 只在发生选择的那一帧为 true,之后对话框关闭。
## 状态
@@ -47,7 +47,7 @@ ui.Render(view, 400, 300, 1)
## 事件
- `Confirmed`:点击确认,或焦点在已解锁的确认按钮上按 Enter / Space。
- `Cancelled`:点击取消、在取消上按 Enter / Space、或按 Escape。
- `Canceled`:点击取消、在取消上按 Enter / Space、或按 Escape。
- 点击遮罩不产生事件。
## 键盘操作
+2 -2
View File
@@ -33,7 +33,7 @@ ui.Render(view, 400, 300, 1)
| `CancelLabel` | `string` | 内置“取消 / Cancel” | 取消按钮文字。 |
| `Danger` | `bool` | `false` | 确认按钮使用危险变体,图标改为 Danger 色,打开时焦点改在取消。 |
`PopconfirmResult{Confirmed, Cancelled bool}` 只在发生选择的那一帧为 true。
`PopconfirmResult{Confirmed, Canceled bool}` 只在发生选择的那一帧为 true。
## 状态
@@ -42,7 +42,7 @@ ui.Render(view, 400, 300, 1)
## 事件
- `Confirmed`:点击确认或在其上按 Enter / Space。
- `Cancelled`:点击取消、Escape、外部点击。
- `Canceled`:点击取消、Escape、外部点击。
## 键盘操作