イベントとコールバックペイロード
Extableのイベントコールバックのペイロードと戻り値をまとめます。
テーブル状態
subscribeTableState(listener)
Signature:
ts
(listener: TableStateListener) => () => voidListener:
ts
(next: TableState, prev: TableState | null) => void戻り値:
- 解除関数を返します。
- リスナーの戻り値は無視されます。
TableState fields:
canCommit: booleanpendingCommandCount: numberpendingCellCount?: numberundoRedo: { canUndo: boolean; canRedo: boolean }renderMode: "html" | "canvas"activeErrors: TableError[]
TableError:
scope: "validation" | "commit" | "render" | "formula" | "conditionalStyle" | "unknown"message: stringtarget?: { rowId?: string; colKey?: string }
選択/セルイベント
subscribeSelection(listener)
Signature:
ts
(listener: SelectionListener) => () => voidListener:
ts
(next: SelectionSnapshot, prev: SelectionSnapshot | null, reason: SelectionChangeReason) => void戻り値:
- 解除関数を返します。
- リスナーの戻り値は無視されます。
SelectionSnapshot fields:
ranges: SelectionRange[]activeRowIndex: number | nullactiveRowKey: string | nullactiveColumnIndex: number | nullactiveColumnKey: string | nullactiveValueRaw: unknownactiveValueDisplay: stringactiveValueType: ColumnType | nulldiagnostic: CellDiagnostic | nullaction?: CellAction | null(only whenreason === "action")styles: { columnStyle: Partial<ResolvedCellStyle>; cellStyle: Partial<ResolvedCellStyle>; resolved: Partial<ResolvedCellStyle> }
SelectionChangeReason:
selectioneditactionstyleschemaviewdataunknown
CellAction:
kind: "button"rowId: stringcolKey: stringvalue: ButtonActionValue
ButtonActionValue:
{ label: string }{ label: string; command: string; commandfor: string }
Notes:
reason === "action"はボタンクリック/Spaceのみ。- リンクセルは
hrefへ遷移し、actionは出ません。
行状態(Coreのみ)
subscribeRowState(listener)
Signature:
ts
(listener: RowStateListener<T, R>) => () => voidListener:
ts
(rowId: string, next: RowStateSnapshot<T, R> | null, prev: RowStateSnapshot<T, R> | null, reason: RowChangeReason) => void戻り値:
- 解除関数を返します。
- リスナーの戻り値は無視されます。
RowStateSnapshot fields:
rowId: stringrowIndex: numberdata: Rpending?: Partial<T>diagnostics?: TableError[]
RowChangeReason:
neweditdelete
ラッパーのコールバック
React
ts
onTableState?: (next: TableState, prev: TableState | null) => void
onCellEvent?: (next: SelectionSnapshot, prev: SelectionSnapshot | null, reason: SelectionChangeReason) => voidVue
ts
@tableState="(next, prev) => {}"
@cellEvent="(next, prev, reason) => {}"ラッパーのコールバックは戻り値を無視します。