twico-ui 1.20.0 → 1.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/index.cjs +16 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.mjs +16 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -2094,7 +2094,9 @@ interface DatatableColumn<T = any> {
|
|
|
2094
2094
|
* Providing it makes the column editable (unless `editable: false`) and takes precedence over the
|
|
2095
2095
|
* built-in select/text editor. Call `commit(nextValue)` to save (fires `onRowUpdate`/`onRowsChange`)
|
|
2096
2096
|
* or `cancel()` to discard. Twico overlay dropdowns (portaled as `.twc-pop`) are exempt from the
|
|
2097
|
-
* cell's outside-click auto-cancel, so a Combobox popover works inside the cell.
|
|
2097
|
+
* cell's outside-click auto-cancel, so a Combobox popover works inside the cell. **Escape cancels**
|
|
2098
|
+
* the edit automatically (the wrapper calls `cancel()`), so you needn't wire a keydown — stop
|
|
2099
|
+
* propagation on Escape only if your control needs it (e.g. to close its own open dropdown). */
|
|
2098
2100
|
renderEditCell?: (args: { value: any; row: T; field: string; commit: (nextValue: any) => void; cancel: () => void }) => React.ReactNode;
|
|
2099
2101
|
/** Custom control for this column's clause in the **batch** editor (#247) — the counterpart of
|
|
2100
2102
|
* `renderEditCell` for the "Edit N selected rows" popover. Use it when the value is backed by a large,
|
package/dist/index.d.ts
CHANGED
|
@@ -2094,7 +2094,9 @@ interface DatatableColumn<T = any> {
|
|
|
2094
2094
|
* Providing it makes the column editable (unless `editable: false`) and takes precedence over the
|
|
2095
2095
|
* built-in select/text editor. Call `commit(nextValue)` to save (fires `onRowUpdate`/`onRowsChange`)
|
|
2096
2096
|
* or `cancel()` to discard. Twico overlay dropdowns (portaled as `.twc-pop`) are exempt from the
|
|
2097
|
-
* cell's outside-click auto-cancel, so a Combobox popover works inside the cell.
|
|
2097
|
+
* cell's outside-click auto-cancel, so a Combobox popover works inside the cell. **Escape cancels**
|
|
2098
|
+
* the edit automatically (the wrapper calls `cancel()`), so you needn't wire a keydown — stop
|
|
2099
|
+
* propagation on Escape only if your control needs it (e.g. to close its own open dropdown). */
|
|
2098
2100
|
renderEditCell?: (args: { value: any; row: T; field: string; commit: (nextValue: any) => void; cancel: () => void }) => React.ReactNode;
|
|
2099
2101
|
/** Custom control for this column's clause in the **batch** editor (#247) — the counterpart of
|
|
2100
2102
|
* `renderEditCell` for the "Edit N selected rows" popover. Use it when the value is backed by a large,
|
package/dist/index.mjs
CHANGED
|
@@ -10477,7 +10477,22 @@ function Datatable({
|
|
|
10477
10477
|
// async Combobox, …) and drives the lifecycle via commit/cancel. Wrapped in
|
|
10478
10478
|
// .twc-dt__editor-wrap so inline clicks (and any .twc-pop portal dropdown) don't
|
|
10479
10479
|
// trip the outside-click auto-cancel.
|
|
10480
|
-
|
|
10480
|
+
// #273: the wrapper handles Escape → cancel so it works for every custom editor without
|
|
10481
|
+
// each having to wire a keydown (they only get commit/cancel). A custom control that
|
|
10482
|
+
// wants Escape itself (e.g. to close its own open dropdown) stops propagation first.
|
|
10483
|
+
/* @__PURE__ */ jsx(
|
|
10484
|
+
"div",
|
|
10485
|
+
{
|
|
10486
|
+
className: "twc-dt__editor-wrap",
|
|
10487
|
+
onKeyDown: (e) => {
|
|
10488
|
+
if (e.key === "Escape") {
|
|
10489
|
+
e.stopPropagation();
|
|
10490
|
+
cancelEdit();
|
|
10491
|
+
}
|
|
10492
|
+
},
|
|
10493
|
+
children: c.renderEditCell({ value: editing.value, row, field: c.field, commit: (v) => commitEdit(v), cancel: cancelEdit })
|
|
10494
|
+
}
|
|
10495
|
+
)
|
|
10481
10496
|
) : /* @__PURE__ */ jsx(
|
|
10482
10497
|
EditCell,
|
|
10483
10498
|
{
|