@udecode/plate-table
Advanced tools
Comparing version 40.0.0 to 41.0.0
import * as slate from 'slate'; | ||
import { Path, Location } from 'slate'; | ||
import { Location, Path, Range } from 'slate'; | ||
import * as _udecode_slate from '@udecode/slate'; | ||
import { B as BorderDirection, T as TableStoreCellAttributes, C as CreateCellOptions, a as TTableCellElement, b as TableConfig, c as TTableElement, d as TableStoreSizeOverrides } from './getEmptyTableNode-BTpZEVNY.js'; | ||
export { f as BorderStyle, G as GetEmptyRowNodeOptions, k as GetEmptyTableNodeOptions, g as TTableRowElement, e as TableApi, j as getEmptyRowNode, l as getEmptyTableNode, i as insertTableColumn, h as insertTableRow } from './getEmptyTableNode-BTpZEVNY.js'; | ||
import { C as CreateCellOptions, T as TTableCellElement, a as TTableElement, B as BorderDirection, b as TableStoreCellAttributes, c as TableConfig, d as TableStoreSizeOverrides } from './getTableCellBorders-DBZALuqI.js'; | ||
export { f as BorderStyle, j as BorderStylesDefault, g as TTableRowElement, e as TableApi, k as getTableCellBorders, i as insertTableColumn, h as insertTableRow } from './getTableCellBorders-DBZALuqI.js'; | ||
import * as _udecode_plate_core from '@udecode/plate-core'; | ||
import { SlateEditor, TEditor, GetAboveNodeOptions, ExtendEditor, TNodeEntry, TElement } from '@udecode/plate-common'; | ||
import { SlateEditor, InsertNodesOptions, TRange, TEditor, GetAboveNodeOptions, ExtendEditor, TNodeEntry, TElement, TElementEntry } from '@udecode/plate-common'; | ||
declare const deleteColumn: (editor: SlateEditor) => void; | ||
declare const deleteRow: (editor: SlateEditor) => void; | ||
declare const deleteTable: (editor: SlateEditor) => void; | ||
interface GetEmptyRowNodeOptions extends CreateCellOptions { | ||
colCount?: number; | ||
} | ||
declare const getEmptyRowNode: (editor: SlateEditor, { colCount, ...cellOptions }?: GetEmptyRowNodeOptions) => { | ||
children: TTableCellElement[]; | ||
type: string; | ||
}; | ||
interface GetEmptyTableNodeOptions extends GetEmptyRowNodeOptions { | ||
rowCount?: number; | ||
} | ||
declare const getEmptyTableNode: (editor: SlateEditor, { colCount, header, rowCount, ...cellOptions }?: GetEmptyTableNodeOptions) => TTableElement; | ||
/** Insert table if selection not in table. Select start of table. */ | ||
declare const insertTable: <E extends SlateEditor>(editor: E, { colCount, header, rowCount }?: GetEmptyTableNodeOptions, options?: InsertNodesOptions<E>) => void; | ||
/** Move selection by cell unit. */ | ||
declare const moveSelectionFromCell: (editor: SlateEditor, { at, edge, fromOneCell, reverse, }?: { | ||
at?: Location; | ||
/** Expand cell selection to an edge. */ | ||
edge?: "bottom" | "left" | "right" | "top"; | ||
/** Move selection from one selected cell */ | ||
fromOneCell?: boolean; | ||
/** False: move selection to cell below true: move selection to cell above */ | ||
reverse?: boolean; | ||
}) => true | undefined; | ||
/** | ||
* Override the new selection if the previous selection and the new one are in | ||
* different cells. | ||
*/ | ||
declare const overrideSelectionFromCell: (editor: SlateEditor, newSelection?: TRange | null) => void; | ||
declare const setBorderSize: (editor: SlateEditor, size: number, { at, border, }?: { | ||
@@ -84,2 +121,30 @@ at?: Path; | ||
/** | ||
* Return true if: | ||
* | ||
* - At start/end of a cell. | ||
* - Next to a table cell. Move selection to the table cell. | ||
*/ | ||
declare const preventDeleteTableCell: (editor: SlateEditor, { reverse, unit, }: { | ||
reverse?: boolean; | ||
unit?: "block" | "character" | "line" | "word"; | ||
}) => true | undefined; | ||
/** Prevent cell deletion. */ | ||
declare const withDeleteTable: ExtendEditor<TableConfig>; | ||
/** If selection is in a table, get subtable above. */ | ||
declare const withGetFragmentTable: ExtendEditor<TableConfig>; | ||
/** | ||
* If inserting a table, If block above anchor is a table, | ||
* | ||
* - Replace each cell above by the inserted table until out of bounds. | ||
* - Select the inserted cells. | ||
*/ | ||
declare const withInsertFragmentTable: ExtendEditor<TableConfig>; | ||
declare const withInsertTextTable: ExtendEditor<TableConfig>; | ||
declare const withMarkTable: ExtendEditor<TableConfig>; | ||
/** | ||
* Normalize table: | ||
@@ -91,2 +156,15 @@ * | ||
/** | ||
* Selection table: | ||
* | ||
* - If anchor is in table, focus in a block before: set focus to start of table | ||
* - If anchor is in table, focus in a block after: set focus to end of table | ||
* - If focus is in table, anchor in a block before: set focus to end of table | ||
* - If focus is in table, anchor in a block after: set focus to the point before | ||
* start of table | ||
*/ | ||
declare const withSelectionTable: ExtendEditor<TableConfig>; | ||
declare const withSetFragmentDataTable: ExtendEditor<TableConfig>; | ||
declare const withTable: ExtendEditor<TableConfig>; | ||
@@ -99,2 +177,10 @@ | ||
declare const deleteTableMergeColumn: (editor: SlateEditor) => void; | ||
declare const deleteColumnWhenExpanded: (editor: SlateEditor, tableEntry: TNodeEntry<TTableCellElement>) => void; | ||
declare const deleteTableMergeRow: (editor: SlateEditor) => void; | ||
declare const deleteRowWhenExpanded: (editor: SlateEditor, [table, tablePath]: TNodeEntry<TTableCellElement>) => void; | ||
declare const findCellByIndexes: (editor: SlateEditor, table: TTableElement, searchRowIndex: number, searchColIndex: number) => TTableCellElement | undefined; | ||
@@ -119,2 +205,27 @@ | ||
/** Get table column index of a cell node. */ | ||
declare const getTableColumnIndex: (editor: TEditor, cellNode: TElement) => number; | ||
type FormatType = 'all' | 'cell' | 'table'; | ||
interface TableGridEntries { | ||
cellEntries: TElementEntry[]; | ||
tableEntries: TElementEntry[]; | ||
} | ||
type GetTableGridReturnType<T> = T extends 'all' ? TableGridEntries : TElementEntry[]; | ||
interface GetTableGridByRangeOptions$1<T extends FormatType> { | ||
at: Range; | ||
/** | ||
* Format of the output: | ||
* | ||
* - Table element | ||
* - Array of cells | ||
*/ | ||
format?: T; | ||
} | ||
/** | ||
* Get sub table between 2 cell paths. Ensure that the selection is always a | ||
* valid table grid. | ||
*/ | ||
declare const getTableMergeGridByRange: <T extends FormatType>(editor: SlateEditor, { at, format }: GetTableGridByRangeOptions$1<T>) => GetTableGridReturnType<T>; | ||
declare const getTableMergedColumnCount: (tableNode: TElement) => number; | ||
@@ -146,2 +257,7 @@ | ||
/** Merges multiple selected cells into one. */ | ||
declare const mergeTableCells: (editor: SlateEditor) => void; | ||
declare const unmergeTableCells: (editor: SlateEditor) => void; | ||
declare const getCellInNextTableRow: (editor: TEditor, currentRowPath: Path) => TNodeEntry | undefined; | ||
@@ -189,2 +305,19 @@ | ||
interface GetTableGridByRangeOptions { | ||
at: Range; | ||
/** | ||
* Format of the output: | ||
* | ||
* - Table element | ||
* - Array of cells | ||
*/ | ||
format?: 'cell' | 'table'; | ||
} | ||
/** Get sub table between 2 cell paths. */ | ||
declare const getTableGridByRange: (editor: SlateEditor, { at, format }: GetTableGridByRangeOptions) => TElementEntry[]; | ||
type GetTableGridAboveOptions<E extends TEditor = TEditor> = GetAboveNodeOptions<E> & Pick<GetTableGridByRangeOptions, 'format'>; | ||
/** Get sub table above anchor and focus. Format: tables or cells. */ | ||
declare const getTableGridAbove: <E extends SlateEditor>(editor: E, { format, ...options }?: GetTableGridAboveOptions<E>) => TElementEntry[]; | ||
/** | ||
@@ -196,2 +329,5 @@ * Returns node.colSizes if it exists, applying overrides, otherwise returns a | ||
/** Get table row index of a cell node. */ | ||
declare const getTableRowIndex: (editor: TEditor, cellNode: TElement) => number; | ||
declare const getTopTableCell: (editor: SlateEditor, { at: cellPath, }?: { | ||
@@ -213,2 +349,2 @@ at?: Path; | ||
export { BaseTableCellHeaderPlugin, BaseTableCellPlugin, BaseTablePlugin, BaseTableRowPlugin, BorderDirection, CreateCellOptions, KEY_SHIFT_EDGES, TTableCellElement, TTableElement, TableConfig, TableStoreCellAttributes, TableStoreSizeOverrides, computeCellIndices, deleteTable, findCellByIndexes, getCellInNextTableRow, getCellInPreviousTableRow, getCellIndices, getCellIndicesWithSpans, getCellPath, getCellRowIndexByPath, getCellTypes, getColSpan, getEmptyCellNode, getLeftTableCell, getNextTableCell, getPreviousTableCell, getRowSpan, getSelectionWidth, getTableAbove, getTableColumnCount, getTableEntries, getTableMergedColumnCount, getTableOverriddenColSizes, getTopTableCell, insertTableMergeColumn, insertTableMergeRow, isTableBorderHidden, isTableRectangular, setBorderSize, setTableColSize, setTableMarginLeft, setTableRowSize, withNormalizeTable, withTable }; | ||
export { BaseTableCellHeaderPlugin, BaseTableCellPlugin, BaseTablePlugin, BaseTableRowPlugin, BorderDirection, CreateCellOptions, type GetEmptyRowNodeOptions, type GetEmptyTableNodeOptions, type GetTableGridAboveOptions, type GetTableGridByRangeOptions, KEY_SHIFT_EDGES, TTableCellElement, TTableElement, TableConfig, TableStoreCellAttributes, TableStoreSizeOverrides, computeCellIndices, deleteColumn, deleteColumnWhenExpanded, deleteRow, deleteRowWhenExpanded, deleteTable, deleteTableMergeColumn, deleteTableMergeRow, findCellByIndexes, getCellInNextTableRow, getCellInPreviousTableRow, getCellIndices, getCellIndicesWithSpans, getCellPath, getCellRowIndexByPath, getCellTypes, getColSpan, getEmptyCellNode, getEmptyRowNode, getEmptyTableNode, getLeftTableCell, getNextTableCell, getPreviousTableCell, getRowSpan, getSelectionWidth, getTableAbove, getTableColumnCount, getTableColumnIndex, getTableEntries, getTableGridAbove, getTableGridByRange, getTableMergeGridByRange, getTableMergedColumnCount, getTableOverriddenColSizes, getTableRowIndex, getTopTableCell, insertTable, insertTableMergeColumn, insertTableMergeRow, isTableBorderHidden, isTableRectangular, mergeTableCells, moveSelectionFromCell, overrideSelectionFromCell, preventDeleteTableCell, setBorderSize, setTableColSize, setTableMarginLeft, setTableRowSize, unmergeTableCells, withDeleteTable, withGetFragmentTable, withInsertFragmentTable, withInsertTextTable, withMarkTable, withNormalizeTable, withSelectionTable, withSetFragmentDataTable, withTable }; |
import * as slate from 'slate'; | ||
import { Range, Location } from 'slate'; | ||
import * as _udecode_utils from '@udecode/utils'; | ||
import * as _udecode_slate from '@udecode/slate'; | ||
import { T as TableStoreCellAttributes, e as TableApi, C as CreateCellOptions, a as TTableCellElement, i as insertTableColumn, h as insertTableRow, b as TableConfig, B as BorderDirection, f as BorderStyle, c as TTableElement, d as TableStoreSizeOverrides, k as GetEmptyTableNodeOptions } from '../getEmptyTableNode-BTpZEVNY.js'; | ||
import { b as TableStoreCellAttributes, e as TableApi, C as CreateCellOptions, T as TTableCellElement, i as insertTableColumn, h as insertTableRow, c as TableConfig, B as BorderDirection, j as BorderStylesDefault, a as TTableElement, d as TableStoreSizeOverrides } from '../getTableCellBorders-DBZALuqI.js'; | ||
import * as _udecode_plate_core from '@udecode/plate-core'; | ||
import * as _udecode_plate_core_react from '@udecode/plate-core/react'; | ||
import { KeyboardHandler, ExtendEditor } from '@udecode/plate-common/react'; | ||
import { SlateEditor, TElement, TNodeEntry, TEditor, TElementEntry, GetAboveNodeOptions, InsertNodesOptions, TRange } from '@udecode/plate-common'; | ||
import { KeyboardHandler } from '@udecode/plate-common/react'; | ||
import { SlateEditor, TElement } from '@udecode/plate-common'; | ||
import React from 'react'; | ||
@@ -68,59 +67,4 @@ import { ResizeHandle } from '@udecode/plate-resizable'; | ||
/** | ||
* Return true if: | ||
* | ||
* - At start/end of a cell. | ||
* - Next to a table cell. Move selection to the table cell. | ||
*/ | ||
declare const preventDeleteTableCell: (editor: SlateEditor, { reverse, unit, }: { | ||
reverse?: boolean; | ||
unit?: "block" | "character" | "line" | "word"; | ||
}) => true | undefined; | ||
/** Prevent cell deletion. */ | ||
declare const withDeleteTable: ExtendEditor<TableConfig>; | ||
/** If selection is in a table, get subtable above. */ | ||
declare const withGetFragmentTable: ExtendEditor<TableConfig>; | ||
/** | ||
* If inserting a table, If block above anchor is a table, | ||
* | ||
* - Replace each cell above by the inserted table until out of bounds. | ||
* - Select the inserted cells. | ||
*/ | ||
declare const withInsertFragmentTable: ExtendEditor<TableConfig>; | ||
declare const withInsertTextTable: ExtendEditor<TableConfig>; | ||
declare const withMarkTable: ExtendEditor<TableConfig>; | ||
/** | ||
* Selection table: | ||
* | ||
* - If anchor is in table, focus in a block before: set focus to start of table | ||
* - If anchor is in table, focus in a block after: set focus to end of table | ||
* - If focus is in table, anchor in a block before: set focus to end of table | ||
* - If focus is in table, anchor in a block after: set focus to the point before | ||
* start of table | ||
*/ | ||
declare const withSelectionTable: ExtendEditor<TableConfig>; | ||
declare const withSetFragmentDataTable: ExtendEditor<TableConfig>; | ||
declare const withTable: ExtendEditor<TableConfig>; | ||
declare const getOnSelectTableBorderFactory: (editor: SlateEditor, selectedCells: TElement[] | null) => (border: BorderDirection | "none" | "outer") => () => void; | ||
interface BorderStylesDefault { | ||
bottom: Required<BorderStyle>; | ||
right: Required<BorderStyle>; | ||
left?: Required<BorderStyle>; | ||
top?: Required<BorderStyle>; | ||
} | ||
declare const getTableCellBorders: (element: TTableCellElement, { defaultBorder, isFirstCell, isFirstRow, }?: { | ||
defaultBorder?: Required<BorderStyle>; | ||
isFirstCell?: boolean; | ||
isFirstRow?: boolean; | ||
}) => BorderStylesDefault; | ||
/** | ||
@@ -232,60 +176,2 @@ * Rounds a cell size to the nearest step, or returns the size if the step is | ||
declare const deleteTableMergeColumn: (editor: SlateEditor) => void; | ||
declare const deleteColumnWhenExpanded: (editor: SlateEditor, tableEntry: TNodeEntry<TTableCellElement>) => void; | ||
declare const deleteTableMergeRow: (editor: SlateEditor) => void; | ||
declare const deleteRowWhenExpanded: (editor: SlateEditor, [table, tablePath]: TNodeEntry<TTableCellElement>) => void; | ||
/** Get table column index of a cell node. */ | ||
declare const getTableColumnIndex: (editor: TEditor, cellNode: TElement) => number; | ||
type FormatType = 'all' | 'cell' | 'table'; | ||
interface TableGridEntries { | ||
cellEntries: TElementEntry[]; | ||
tableEntries: TElementEntry[]; | ||
} | ||
type GetTableGridReturnType<T> = T extends 'all' ? TableGridEntries : TElementEntry[]; | ||
interface GetTableGridByRangeOptions$1<T extends FormatType> { | ||
at: Range; | ||
/** | ||
* Format of the output: | ||
* | ||
* - Table element | ||
* - Array of cells | ||
*/ | ||
format?: T; | ||
} | ||
/** | ||
* Get sub table between 2 cell paths. Ensure that the selection is always a | ||
* valid table grid. | ||
*/ | ||
declare const getTableMergeGridByRange: <T extends FormatType>(editor: SlateEditor, { at, format }: GetTableGridByRangeOptions$1<T>) => GetTableGridReturnType<T>; | ||
/** Merges multiple selected cells into one. */ | ||
declare const mergeTableCells: (editor: SlateEditor) => void; | ||
declare const unmergeTableCells: (editor: SlateEditor) => void; | ||
interface GetTableGridByRangeOptions { | ||
at: Range; | ||
/** | ||
* Format of the output: | ||
* | ||
* - Table element | ||
* - Array of cells | ||
*/ | ||
format?: 'cell' | 'table'; | ||
} | ||
/** Get sub table between 2 cell paths. */ | ||
declare const getTableGridByRange: (editor: SlateEditor, { at, format }: GetTableGridByRangeOptions) => TElementEntry[]; | ||
type GetTableGridAboveOptions<E extends TEditor = TEditor> = GetAboveNodeOptions<E> & Pick<GetTableGridByRangeOptions, 'format'>; | ||
/** Get sub table above anchor and focus. Format: tables or cells. */ | ||
declare const getTableGridAbove: <E extends SlateEditor>(editor: E, { format, ...options }?: GetTableGridAboveOptions<E>) => TElementEntry[]; | ||
/** Get table row index of a cell node. */ | ||
declare const getTableRowIndex: (editor: TEditor, cellNode: TElement) => number; | ||
declare const TableProvider: React.FC<jotai_x.ProviderProps<{ | ||
@@ -327,26 +213,2 @@ colSizeOverrides: TableStoreSizeOverrides; | ||
declare const deleteColumn: (editor: SlateEditor) => void; | ||
declare const deleteRow: (editor: SlateEditor) => void; | ||
/** Insert table if selection not in table. Select start of table. */ | ||
declare const insertTable: <E extends SlateEditor>(editor: E, { colCount, header, rowCount }?: GetEmptyTableNodeOptions, options?: InsertNodesOptions<E>) => void; | ||
/** Move selection by cell unit. */ | ||
declare const moveSelectionFromCell: (editor: SlateEditor, { at, edge, fromOneCell, reverse, }?: { | ||
at?: Location; | ||
/** Expand cell selection to an edge. */ | ||
edge?: "bottom" | "left" | "right" | "top"; | ||
/** Move selection from one selected cell */ | ||
fromOneCell?: boolean; | ||
/** False: move selection to cell below true: move selection to cell above */ | ||
reverse?: boolean; | ||
}) => true | undefined; | ||
/** | ||
* Override the new selection if the previous selection and the new one are in | ||
* different cells. | ||
*/ | ||
declare const overrideSelectionFromCell: (editor: SlateEditor, newSelection?: TRange | null) => void; | ||
export { type BorderStylesDefault, type GetTableGridAboveOptions, type GetTableGridByRangeOptions, type TableCellElementResizableOptions, type TableCellElementState, TableCellHeaderPlugin, TableCellPlugin, type TableElementState, TablePlugin, TableProvider, TableRowPlugin, deleteColumn, deleteColumnWhenExpanded, deleteRow, deleteRowWhenExpanded, deleteTableMergeColumn, deleteTableMergeRow, getOnSelectTableBorderFactory, getTableCellBorders, getTableColumnIndex, getTableGridAbove, getTableGridByRange, getTableMergeGridByRange, getTableRowIndex, insertTable, mergeTableCells, moveSelectionFromCell, onKeyDownTable, overrideSelectionFromCell, preventDeleteTableCell, roundCellSizeToStep, tableStore, unmergeTableCells, useIsCellSelected, useOverrideColSize, useOverrideMarginLeft, useOverrideRowSize, useSelectedCells, useTableBordersDropdownMenuContentState, useTableCellElement, useTableCellElementResizable, useTableCellElementResizableState, useTableCellElementState, useTableColSizes, useTableElement, useTableElementState, useTableMergeState, useTableStore, withDeleteTable, withGetFragmentTable, withInsertFragmentTable, withInsertTextTable, withMarkTable, withSelectionTable, withSetFragmentDataTable, withTable }; | ||
export { type TableCellElementResizableOptions, type TableCellElementState, TableCellHeaderPlugin, TableCellPlugin, type TableElementState, TablePlugin, TableProvider, TableRowPlugin, getOnSelectTableBorderFactory, onKeyDownTable, roundCellSizeToStep, tableStore, useIsCellSelected, useOverrideColSize, useOverrideMarginLeft, useOverrideRowSize, useSelectedCells, useTableBordersDropdownMenuContentState, useTableCellElement, useTableCellElementResizable, useTableCellElementResizableState, useTableCellElementState, useTableColSizes, useTableElement, useTableElementState, useTableMergeState, useTableStore }; |
{ | ||
"name": "@udecode/plate-table", | ||
"version": "40.0.0", | ||
"version": "41.0.0", | ||
"description": "Table plugin for Plate", | ||
@@ -53,3 +53,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@udecode/plate-resizable": "40.0.0", | ||
"@udecode/plate-resizable": "41.0.0", | ||
"lodash": "^4.17.21" | ||
@@ -61,6 +61,6 @@ }, | ||
"peerDependencies": { | ||
"@udecode/plate-common": ">=40.0.0", | ||
"@udecode/plate-common": ">=41.0.0", | ||
"react": ">=16.8.0", | ||
"react-dom": ">=16.8.0", | ||
"slate": ">=0.103.0", | ||
"slate": ">=0.112.0", | ||
"slate-dom": ">=0.111.0", | ||
@@ -67,0 +67,0 @@ "slate-history": ">=0.93.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1130556
11545
+ Added@udecode/plate-resizable@41.0.0(transitive)
- Removed@udecode/plate-resizable@40.0.0(transitive)